From 624a299b829ccf9864dd2f3001b1a49476e96b4a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 11 Aug 2014 15:29:18 -0400 Subject: [PATCH] [coretext] Attach marks to base clusters Fixes https://githu.com/behdad/harfbuzz/issues/49 to the extent that it can be fixed. --- src/hb-coretext.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 498b730c9..54691016e 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -428,6 +428,22 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan, hb_coretext_shaper_face_data_t *face_data = HB_SHAPER_DATA_GET (face); hb_coretext_shaper_font_data_t *font_data = HB_SHAPER_DATA_GET (font); + /* Attach marks to their bases, to match the 'ot' shaper. + * Adapted from hb-ot-shape:hb_form_clusters(). + * Note that this only makes us be closer to the 'ot' shaper, + * but by no means the same. For example, if there's + * B1 M1 B2 M2, and B1-B2 form a ligature, M2's cluster will + * continue pointing to B2 even though B2 was merged into B1's + * cluster... */ + { + hb_unicode_funcs_t *unicode = buffer->unicode; + unsigned int count = buffer->len; + hb_glyph_info_t *info = buffer->info; + for (unsigned int i = 1; i < count; i++) + if (HB_UNICODE_GENERAL_CATEGORY_IS_MARK (unicode->general_category (info[i].codepoint))) + buffer->merge_clusters (i - 1, i + 1); + } + hb_auto_array_t feature_records; hb_auto_array_t range_records;