From ed2f1363a391add41f10cff18792003583a10257 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 22 May 2012 22:12:22 -0400 Subject: [PATCH] Fix substitution glyph class propagation The old code was doing nothing. Still got to find an example font+string that makes this matter, but need this for fixing synthetic GDEF anyway. --- src/hb-ot-layout-gsub-table.hh | 10 ++++------ src/hb-ot-layout-gsubgpos-private.hh | 23 ++++++----------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 452214a..f6a7575 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 919360f..a2e4b2f 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; - } }; -- 2.7.4