[otlayout] Simplify set_class() usage

This commit is contained in:
Behdad Esfahbod 2013-10-18 00:06:30 +02:00
parent 3ddf892b53
commit a016174658
1 changed files with 19 additions and 14 deletions

View File

@ -615,7 +615,8 @@ struct hb_apply_context_t
return match_properties (info->codepoint, property, lookup_props); return match_properties (info->codepoint, property, lookup_props);
} }
inline void set_class (hb_codepoint_t glyph_index, unsigned int class_guess) const inline void _set_glyph_props (hb_codepoint_t glyph_index,
unsigned int class_guess = 0) const
{ {
if (likely (has_glyph_classes)) if (likely (has_glyph_classes))
buffer->cur().glyph_props() = gdef.get_glyph_props (glyph_index); buffer->cur().glyph_props() = gdef.get_glyph_props (glyph_index);
@ -623,24 +624,28 @@ struct hb_apply_context_t
buffer->cur().glyph_props() = class_guess; buffer->cur().glyph_props() = class_guess;
} }
inline void output_glyph (hb_codepoint_t glyph_index, inline void replace_glyph (hb_codepoint_t glyph_index) const
unsigned int class_guess = 0) const
{ {
set_class (glyph_index, class_guess); _set_glyph_props (glyph_index);
buffer->output_glyph (glyph_index);
}
inline void replace_glyph (hb_codepoint_t glyph_index,
unsigned int class_guess = 0) const
{
set_class (glyph_index, class_guess);
buffer->replace_glyph (glyph_index); buffer->replace_glyph (glyph_index);
} }
inline void replace_glyph_inplace (hb_codepoint_t glyph_index, inline void replace_glyph_inplace (hb_codepoint_t glyph_index) const
unsigned int class_guess = 0) const
{ {
set_class (glyph_index, class_guess); _set_glyph_props (glyph_index);
buffer->cur().codepoint = glyph_index; buffer->cur().codepoint = glyph_index;
} }
inline void replace_glyph_with_ligature (hb_codepoint_t glyph_index,
unsigned int class_guess) const
{
_set_glyph_props (glyph_index, class_guess);
buffer->replace_glyph (glyph_index);
}
inline void output_glyph (hb_codepoint_t glyph_index,
unsigned int class_guess) const
{
_set_glyph_props (glyph_index, class_guess);
buffer->output_glyph (glyph_index);
}
}; };
@ -885,7 +890,7 @@ static inline void ligate_input (hb_apply_context_t *c,
if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK) if (_hb_glyph_info_get_general_category (&buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
_hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER); _hb_glyph_info_set_general_category (&buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
} }
c->replace_glyph (lig_glyph, klass); c->replace_glyph_with_ligature (lig_glyph, klass);
for (unsigned int i = 1; i < count; i++) for (unsigned int i = 1; i < count; i++)
{ {