From 4300a18b852f67ad2b45fb9c1c04474c9f234eb2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 18 Jan 2023 10:44:13 -0700 Subject: [PATCH] [arabic-fallback] Fix ligature code Fixes https://github.com/harfbuzz/harfbuzz/issues/4042 This was broken in 20e9f0b. --- src/hb-ot-shaper-arabic-fallback.hh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/hb-ot-shaper-arabic-fallback.hh b/src/hb-ot-shaper-arabic-fallback.hh index b9f92f72d..6ba1ec795 100644 --- a/src/hb-ot-shaper-arabic-fallback.hh +++ b/src/hb-ot-shaper-arabic-fallback.hh @@ -154,16 +154,22 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN const auto &components = ligature_table[first_glyph_idx].ligatures[ligature_idx].components; unsigned component_count = ARRAY_LENGTH_CONST (components); - for (unsigned i = 0; i < component_count; i++) + bool matched = true; + for (unsigned j = 0; j < component_count; j++) { - hb_codepoint_t component_u = ligature_table[first_glyph_idx].ligatures[ligature_idx].components[i]; + hb_codepoint_t component_u = ligature_table[first_glyph_idx].ligatures[ligature_idx].components[j]; hb_codepoint_t component_glyph; if (!component_u || - !hb_font_get_glyph (font, component_u, 0, &component_glyph)) - continue; + !hb_font_get_nominal_glyph (font, component_u, &component_glyph)) + { + matched = false; + break; + } component_list[num_components++] = component_glyph; } + if (!matched) + continue; component_count_list[num_ligatures] = 1 + component_count; ligature_list[num_ligatures] = ligature_glyph;