diff --git a/src/hb-ot-shaper-arabic-fallback.hh b/src/hb-ot-shaper-arabic-fallback.hh index e96ae8f88..8c513be78 100644 --- a/src/hb-ot-shaper-arabic-fallback.hh +++ b/src/hb-ot-shaper-arabic-fallback.hh @@ -118,6 +118,7 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN OT::HBGlyphID16 component_list[ARRAY_LENGTH_CONST (ligature_list) * ARRAY_LENGTH_CONST (ligature_table[0].ligatures[0].components)]; unsigned int num_ligatures = 0; + unsigned int num_components = 0; /* Populate arrays */ @@ -149,15 +150,18 @@ arabic_fallback_synthesize_lookup_ligature (const hb_ot_shape_plan_t *plan HB_UN if (!hb_font_get_glyph (font, ligature_u, 0, &ligature_glyph)) continue; - hb_codepoint_t second_u = ligature_table[first_glyph_idx].ligatures[ligature_idx].components[0]; - hb_codepoint_t second_glyph; - if (!second_u || - !hb_font_get_glyph (font, second_u, 0, &second_glyph)) + const auto &components = ligature_table[first_glyph_idx].ligatures[ligature_idx].components; + unsigned component_count = ARRAY_LENGTH_CONST (components); + + hb_codepoint_t component_u = ligature_table[first_glyph_idx].ligatures[ligature_idx].components[0]; + hb_codepoint_t component_glyph; + if (!component_u || + !hb_font_get_glyph (font, component_u, 0, &component_glyph)) continue; - component_list[num_ligatures] = second_glyph; - component_count_list[num_ligatures] = 2; + component_list[num_components++] = component_glyph; + component_count_list[num_ligatures] = 1 + component_count; ligature_list[num_ligatures] = ligature_glyph; ligature_per_first_glyph_count_list[i]++;