diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index c23240c80..15f4461b5 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -418,8 +418,6 @@ zero_mark_widths_by_gdef (hb_buffer_t *buffer) static inline void hb_ot_position_default (hb_ot_shape_context_t *c) { - hb_ot_layout_position_start (c->font, c->buffer); - unsigned int count = c->buffer->len; for (unsigned int i = 0; i < count; i++) { @@ -433,6 +431,13 @@ hb_ot_position_default (hb_ot_shape_context_t *c) &c->buffer->pos[i].y_offset); } +} + +static inline bool +hb_ot_position_complex (hb_ot_shape_context_t *c) +{ + bool ret = false; + unsigned int count = c->buffer->len; switch (c->plan->shaper->zero_width_marks) { @@ -452,13 +457,6 @@ hb_ot_position_default (hb_ot_shape_context_t *c) case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE: break; } -} - -static inline bool -hb_ot_position_complex (hb_ot_shape_context_t *c) -{ - bool ret = false; - unsigned int count = c->buffer->len; if (hb_ot_layout_has_positioning (c->face)) { @@ -500,18 +498,20 @@ hb_ot_position_complex (hb_ot_shape_context_t *c) break; } - hb_ot_layout_position_finish (c->font, c->buffer); - return ret; } static inline void hb_ot_position (hb_ot_shape_context_t *c) { + hb_ot_layout_position_start (c->font, c->buffer); + hb_ot_position_default (c); hb_bool_t fallback = !hb_ot_position_complex (c); + hb_ot_layout_position_finish (c->font, c->buffer); + if (fallback && c->plan->shaper->fallback_position) _hb_ot_shape_fallback_position (c->plan, c->font, c->buffer);