Minor refactoring

This commit is contained in:
Behdad Esfahbod 2013-05-20 09:18:52 -04:00
parent 127daf15e0
commit d785fa0c45
1 changed files with 28 additions and 26 deletions

View File

@ -400,6 +400,30 @@ hb_ot_substitute (hb_ot_shape_context_t *c)
/* Position */
static inline void
zero_mark_widths_by_unicode (hb_buffer_t *buffer)
{
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{
buffer->pos[i].x_advance = 0;
buffer->pos[i].y_advance = 0;
}
}
static inline void
zero_mark_widths_by_gdef (hb_buffer_t *buffer)
{
unsigned int count = buffer->len;
for (unsigned int i = 0; i < count; i++)
if ((buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
{
buffer->pos[i].x_advance = 0;
buffer->pos[i].y_advance = 0;
}
}
static inline void
hb_ot_position_default (hb_ot_shape_context_t *c)
{
@ -421,25 +445,13 @@ hb_ot_position_default (hb_ot_shape_context_t *c)
switch (c->plan->shaper->zero_width_marks)
{
/* Zero'ing mark widths by GDEF (as used in Myanmar spec) may happen
* *before* GPOS. */
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
for (unsigned int i = 0; i < count; i++)
if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
zero_mark_widths_by_gdef (c->buffer);
break;
/* Not currently used for any shaper:
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
for (unsigned int i = 0; i < count; i++)
if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
zero_mark_widths_by_unicode (c->buffer);
break;
*/
@ -483,21 +495,11 @@ hb_ot_position_complex (hb_ot_shape_context_t *c)
switch (c->plan->shaper->zero_width_marks)
{
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
for (unsigned int i = 0; i < count; i++)
if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
zero_mark_widths_by_unicode (c->buffer);
break;
case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
for (unsigned int i = 0; i < count; i++)
if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
{
c->buffer->pos[i].x_advance = 0;
c->buffer->pos[i].y_advance = 0;
}
zero_mark_widths_by_gdef (c->buffer);
break;
default: