diff --git a/src/OT/Layout/GPOS/SinglePosFormat1.hh b/src/OT/Layout/GPOS/SinglePosFormat1.hh index 01c148f00..b4c9fc3db 100644 --- a/src/OT/Layout/GPOS/SinglePosFormat1.hh +++ b/src/OT/Layout/GPOS/SinglePosFormat1.hh @@ -81,13 +81,20 @@ struct SinglePosFormat1 } bool - position_single (hb_ot_apply_context_t *c, - hb_codepoint_t gid, - hb_glyph_position_t &pos) const + position_single (hb_font_t *font, + hb_direction_t direction, + hb_codepoint_t gid, + hb_glyph_position_t &pos) const { unsigned int index = (this+coverage).get_coverage (gid); if (likely (index == NOT_COVERED)) return false; - valueFormat.apply_value (c, this, values, pos); + + /* This is ugly... */ + hb_buffer_t buffer; + buffer.props.direction = direction; + OT::hb_ot_apply_context_t c (1, font, &buffer); + + valueFormat.apply_value (&c, this, values, pos); return true; } diff --git a/src/OT/Layout/GPOS/SinglePosFormat2.hh b/src/OT/Layout/GPOS/SinglePosFormat2.hh index 1f0d72844..c77951156 100644 --- a/src/OT/Layout/GPOS/SinglePosFormat2.hh +++ b/src/OT/Layout/GPOS/SinglePosFormat2.hh @@ -93,14 +93,21 @@ struct SinglePosFormat2 } bool - position_single (hb_ot_apply_context_t *c, - hb_codepoint_t gid, - hb_glyph_position_t &pos) const + position_single (hb_font_t *font, + hb_direction_t direction, + hb_codepoint_t gid, + hb_glyph_position_t &pos) const { unsigned int index = (this+coverage).get_coverage (gid); if (likely (index == NOT_COVERED)) return false; if (unlikely (index >= valueCount)) return false; - valueFormat.apply_value (c, this, + + /* This is ugly... */ + hb_buffer_t buffer; + buffer.props.direction = direction; + OT::hb_ot_apply_context_t c (1, font, &buffer); + + valueFormat.apply_value (&c, this, &values[index * valueFormat.get_len ()], pos); return true; diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 2e0b8d5e2..30cedbb7d 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -1735,14 +1735,10 @@ hb_ot_layout_get_optical_bound (hb_font_t *font, hb_direction_t direction, hb_codepoint_t glyph) { - /* This is ugly... */ - hb_buffer_t buffer; - buffer.props.direction = direction; - OT::hb_ot_apply_context_t c_apply (1, font, &buffer); const OT::PosLookup &lookup = font->face->table.GPOS->table->get_lookup (lookup_index); hb_glyph_position_t pos = {0}; hb_position_single_dispatch_t c; - lookup.dispatch (&c, &c_apply, glyph, pos); + lookup.dispatch (&c, font, direction, glyph, pos); hb_position_t ret = 0; switch (direction) {