Don't zero advance of mark-non-mark ligatures
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 27 May 2013 18:48:34 +0000 (14:48 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 27 May 2013 18:50:00 +0000 (14:50 -0400)
If there's a mark ligating forward with non-mark, they were
inheriting the GC of the mark and later get advance-zeroed.
Don't do that if there's any non-mark glyph in the ligature.

Sample test: U+1780,U+17D2,U+179F with Kh-Metal-Chrieng.ttf

Also:
Bug 58922 - Issue with mark advance zeroing in generic shaper

src/hb-ot-layout-gsubgpos-private.hh
src/hb-ot-layout-private.hh

index 9fc638b..32c4a6d 100644 (file)
@@ -872,7 +872,11 @@ static inline void ligate_input (hb_apply_context_t *c,
   unsigned int components_so_far = last_num_components;
 
   if (!is_mark_ligature)
+  {
     set_lig_props_for_ligature (c->buffer->cur(), lig_id, total_component_count);
+    if (_hb_glyph_info_get_general_category (&c->buffer->cur()) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+      _hb_glyph_info_set_general_category (&c->buffer->cur(), HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER);
+  }
   c->replace_glyph (lig_glyph, klass);
 
   for (unsigned int i = 1; i < count; i++)
index a9de356..c5ba8b4 100644 (file)
@@ -58,6 +58,12 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_unicode_funcs_t *uni
   info->unicode_props1() = unicode->modified_combining_class (info->codepoint);
 }
 
+inline void
+_hb_glyph_info_set_general_category (hb_glyph_info_t *info, hb_unicode_general_category_t gen_cat)
+{
+  info->unicode_props0() = (unsigned int) gen_cat | ((info->unicode_props0()) & ~0x1F);
+}
+
 inline hb_unicode_general_category_t
 _hb_glyph_info_get_general_category (const hb_glyph_info_t *info)
 {