From: Behdad Esfahbod Date: Mon, 20 May 2013 13:18:52 +0000 (-0400) Subject: Minor refactoring X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d785fa0c45f7f25f5e5f352b933a5f6fa29be5c0;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Minor refactoring --- diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 59a5bbc..6a0c786 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -401,6 +401,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) { hb_ot_layout_position_start (c->font, c->buffer); @@ -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: