|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
* Copyright © 1998-2004 David Turner and Werner Lemberg |
|
|
|
|
* Copyright © 2006 Behdad Esfahbod |
|
|
|
|
* Copyright © 2007,2008,2009 Red Hat, Inc. |
|
|
|
|
* Copyright © 2012 Google, Inc. |
|
|
|
|
* |
|
|
|
|
* This is part of HarfBuzz, a text shaping library. |
|
|
|
|
* |
|
|
|
@ -24,6 +25,7 @@ |
|
|
|
|
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
|
|
|
|
* |
|
|
|
|
* Red Hat Author(s): Behdad Esfahbod |
|
|
|
|
* Google Author(s): Behdad Esfahbod |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
#include "hb-ot-layout-private.hh" |
|
|
|
@ -93,6 +95,24 @@ _get_gpos (hb_face_t *face) |
|
|
|
|
return *hb_ot_layout_from_face (face)->gpos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static inline const GDEF& |
|
|
|
|
_get_gdef_fast (hb_face_t *face) |
|
|
|
|
{ |
|
|
|
|
return *hb_ot_layout_from_face (face)->gdef; |
|
|
|
|
} |
|
|
|
|
static inline const GSUB& |
|
|
|
|
_get_gsub_fast (hb_face_t *face) |
|
|
|
|
{ |
|
|
|
|
if (unlikely (!hb_ot_layout_ensure (face))) return Null(GSUB); |
|
|
|
|
return *hb_ot_layout_from_face (face)->gsub; |
|
|
|
|
} |
|
|
|
|
static inline const GPOS& |
|
|
|
|
_get_gpos_fast (hb_face_t *face) |
|
|
|
|
{ |
|
|
|
|
if (unlikely (!hb_ot_layout_ensure (face))) return Null(GPOS); |
|
|
|
|
return *hb_ot_layout_from_face (face)->gpos; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* GDEF |
|
|
|
@ -110,7 +130,7 @@ _hb_ot_layout_get_glyph_property (hb_face_t *face, |
|
|
|
|
{ |
|
|
|
|
if (!info->props_cache()) |
|
|
|
|
{ |
|
|
|
|
const GDEF &gdef = _get_gdef (face); |
|
|
|
|
const GDEF &gdef = _get_gdef_fast (face); |
|
|
|
|
info->props_cache() = gdef.get_glyph_props (info->codepoint); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -127,7 +147,7 @@ _hb_ot_layout_match_properties_mark (hb_face_t *face, |
|
|
|
|
* lookup_props has the set index. |
|
|
|
|
*/ |
|
|
|
|
if (lookup_props & LookupFlag::UseMarkFilteringSet) |
|
|
|
|
return _get_gdef (face).mark_set_covers (lookup_props >> 16, glyph); |
|
|
|
|
return _get_gdef_fast (face).mark_set_covers (lookup_props >> 16, glyph); |
|
|
|
|
|
|
|
|
|
/* The second byte of lookup_props has the meaning
|
|
|
|
|
* "ignore marks of attachment type different than |
|
|
|
@ -479,6 +499,17 @@ hb_ot_layout_would_substitute_lookup (hb_face_t *face, |
|
|
|
|
return _get_gsub (face).would_substitute_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hb_bool_t |
|
|
|
|
hb_ot_layout_would_substitute_lookup_fast (hb_face_t *face, |
|
|
|
|
const hb_codepoint_t *glyphs, |
|
|
|
|
unsigned int glyphs_length, |
|
|
|
|
unsigned int lookup_index) |
|
|
|
|
{ |
|
|
|
|
if (unlikely (glyphs_length < 1 || glyphs_length > 2)) return false; |
|
|
|
|
hb_would_apply_context_t c (face, glyphs[0], glyphs_length == 2 ? glyphs[1] : -1); |
|
|
|
|
return _get_gsub_fast (face).would_substitute_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
hb_ot_layout_substitute_start (hb_buffer_t *buffer) |
|
|
|
|
{ |
|
|
|
@ -495,6 +526,16 @@ hb_ot_layout_substitute_lookup (hb_face_t *face, |
|
|
|
|
return _get_gsub (face).substitute_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hb_bool_t |
|
|
|
|
hb_ot_layout_substitute_lookup_fast (hb_face_t *face, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
unsigned int lookup_index, |
|
|
|
|
hb_mask_t mask) |
|
|
|
|
{ |
|
|
|
|
hb_apply_context_t c (NULL, face, buffer, mask); |
|
|
|
|
return _get_gsub_fast (face).substitute_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
hb_ot_layout_substitute_finish (hb_buffer_t *buffer HB_UNUSED) |
|
|
|
|
{ |
|
|
|
@ -527,15 +568,25 @@ hb_ot_layout_position_start (hb_buffer_t *buffer) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hb_bool_t |
|
|
|
|
hb_ot_layout_position_lookup (hb_font_t *font, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
unsigned int lookup_index, |
|
|
|
|
hb_mask_t mask) |
|
|
|
|
hb_ot_layout_position_lookup (hb_font_t *font, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
unsigned int lookup_index, |
|
|
|
|
hb_mask_t mask) |
|
|
|
|
{ |
|
|
|
|
hb_apply_context_t c (font, font->face, buffer, mask); |
|
|
|
|
return _get_gpos (font->face).position_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
hb_bool_t |
|
|
|
|
hb_ot_layout_position_lookup_fast (hb_font_t *font, |
|
|
|
|
hb_buffer_t *buffer, |
|
|
|
|
unsigned int lookup_index, |
|
|
|
|
hb_mask_t mask) |
|
|
|
|
{ |
|
|
|
|
hb_apply_context_t c (font, font->face, buffer, mask); |
|
|
|
|
return _get_gpos_fast (font->face).position_lookup (&c, lookup_index); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void |
|
|
|
|
hb_ot_layout_position_finish (hb_buffer_t *buffer) |
|
|
|
|
{ |
|
|
|
|