[arabic-fallback] Fix ligature code

Fixes https://github.com/harfbuzz/harfbuzz/issues/4042

This was broken in 20e9f0b.
This commit is contained in:
Behdad Esfahbod 2023-01-18 10:44:13 -07:00
parent b9646dfd62
commit 4300a18b85
1 changed files with 10 additions and 4 deletions

View File

@ -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;