diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 452214aff..f6a757530 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -212,9 +212,8 @@ struct Sequence TRACE_APPLY (); if (unlikely (!substitute.len)) return TRACE_RETURN (false); - if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE) - c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH); - c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array); + unsigned int klass = c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE ? HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH : 0; + c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array, klass); return TRACE_RETURN (true); } @@ -495,8 +494,7 @@ struct Ligature if (likely (c->buffer->info[skippy_iter.idx].codepoint != component[i])) return TRACE_RETURN (false); } - if (first_was_mark && found_non_mark) - c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE); + unsigned int klass = first_was_mark && found_non_mark ? HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE : 0; /* Allocate new ligature id */ unsigned int lig_id = allocate_lig_id (c->buffer); @@ -504,7 +502,7 @@ struct Ligature if (skippy_iter.idx < c->buffer->idx + count) /* No input glyphs skipped */ { - c->replace_glyphs_be16 (count, 1, (const uint16_t *) &ligGlyph); + c->replace_glyphs_be16 (count, 1, (const uint16_t *) &ligGlyph, klass); } else { diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 919360fdd..a2e4b2fdb 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -222,31 +222,20 @@ struct hb_apply_context_t - inline void replace_glyph (hb_codepoint_t glyph_index) const + inline void replace_glyph (hb_codepoint_t glyph_index, + unsigned int klass = 0) const { - clear_property (); + buffer->cur().props_cache() = klass; /*XXX if has gdef? */ buffer->replace_glyph (glyph_index); } inline void replace_glyphs_be16 (unsigned int num_in, unsigned int num_out, - const uint16_t *glyph_data_be) const + const uint16_t *glyph_data_be, + unsigned int klass = 0) const { - clear_property (); + buffer->cur().props_cache() = klass; /* XXX if has gdef? */ buffer->replace_glyphs_be16 (num_in, num_out, glyph_data_be); } - - inline void guess_glyph_class (unsigned int klass) - { - /* XXX if ! has gdef */ - buffer->cur().props_cache() = klass; - } - - private: - inline void clear_property (void) const - { - /* XXX if has gdef */ - buffer->cur().props_cache() = 0; - } };