From 7b84c536c10ab90ed96a033d88e9ad232d46c5b8 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 8 Jun 2012 22:04:23 -0400 Subject: [PATCH] In MarkBase attachment, only attach to first of a MultipleSubst sequence This is apparently what Uniscribe does. Test case is: SEEN FATHA TEH ALEF with Arabic Typesetting. Originally reported by Khaled Hosny. --- src/hb-ot-layout-gpos-table.hh | 7 ++++++- src/hb-ot-layout-gsubgpos-private.hh | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 49986ea..c9e10bd 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -955,7 +955,12 @@ struct MarkBasePosFormat1 /* now we search backwards for a non-mark glyph */ unsigned int property; hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false); + do { + if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false); + /* We only want to attach to the first of a MultipleSubst sequence. Reject others. */ + if (0 == get_lig_comp (c->buffer->info[skippy_iter.idx])) break; + skippy_iter.reject (); + } while (1); /* The following assertion is too strong, so we've disabled it. */ if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/} diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d73bb29..4cf6150 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -144,6 +144,10 @@ struct hb_apply_context_t { return unlikely (num_items && idx + num_items >= end); } + inline bool reject (void) + { + num_items++; + } inline bool next (unsigned int *property_out, unsigned int lookup_props) { @@ -189,6 +193,10 @@ struct hb_apply_context_t { return unlikely (idx < num_items); } + inline bool reject (void) + { + num_items++; + } inline bool prev (unsigned int *property_out, unsigned int lookup_props) { -- 2.7.4