diff --git a/src/hb-ot-shape-complex-arabic-fallback.hh b/src/hb-ot-shape-complex-arabic-fallback.hh index 00d75ac1f..a991af926 100644 --- a/src/hb-ot-shape-complex-arabic-fallback.hh +++ b/src/hb-ot-shape-complex-arabic-fallback.hh @@ -33,7 +33,8 @@ #include "hb-ot-layout-gsub-table.hh" -/* Features ordered the same as the entries in shaping_table rows. */ +/* Features ordered the same as the entries in shaping_table rows, + * followed by rlig. Don't change. */ static const hb_tag_t arabic_fallback_features[] = { HB_TAG('i','n','i','t'), @@ -43,16 +44,6 @@ static const hb_tag_t arabic_fallback_features[] = HB_TAG('r','l','i','g'), }; -/* Same order as the fallback feature array */ -enum { - FALLBACK_INIT, - FALLBACK_MEDI, - FALLBACK_FINA, - FALLBACK_ISOL, - FALLBACK_RLIG, - ARABIC_NUM_FALLBACK_FEATURES -}; - static OT::SubstLookup * arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUSED, hb_font_t *font, @@ -200,6 +191,8 @@ arabic_fallback_synthesize_lookup (const hb_ot_shape_plan_t *plan, return arabic_fallback_synthesize_lookup_ligature (plan, font); } +#define ARABIC_FALLBACK_MAX_LOOKUPS 6 + struct arabic_fallback_plan_t { ASSERT_POD (); @@ -207,9 +200,9 @@ struct arabic_fallback_plan_t unsigned int num_lookups; bool free_lookups; - hb_mask_t mask_array[ARABIC_NUM_FALLBACK_FEATURES]; - OT::SubstLookup *lookup_array[ARABIC_NUM_FALLBACK_FEATURES]; - hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_NUM_FALLBACK_FEATURES]; + hb_mask_t mask_array[ARABIC_FALLBACK_MAX_LOOKUPS]; + OT::SubstLookup *lookup_array[ARABIC_FALLBACK_MAX_LOOKUPS]; + hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS]; }; static const arabic_fallback_plan_t arabic_fallback_plan_nil = {}; @@ -245,7 +238,7 @@ arabic_fallback_plan_init_win1256 (arabic_fallback_plan_t *fallback_plan, const Manifest &manifest = reinterpret_cast (arabic_win1256_gsub_lookups.manifest); ASSERT_STATIC (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup) - <= ARABIC_NUM_FALLBACK_FEATURES); + <= ARABIC_FALLBACK_MAX_LOOKUPS); /* TODO sanitize the table? */ unsigned j = 0; @@ -278,8 +271,9 @@ arabic_fallback_plan_init_unicode (arabic_fallback_plan_t *fallback_plan, const hb_ot_shape_plan_t *plan, hb_font_t *font) { + ASSERT_STATIC (ARRAY_LENGTH(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS); unsigned int j = 0; - for (unsigned int i = 0; i < ARABIC_NUM_FALLBACK_FEATURES; i++) + for (unsigned int i = 0; i < ARRAY_LENGTH(arabic_fallback_features) ; i++) { fallback_plan->mask_array[j] = plan->map.get_1_mask (arabic_fallback_features[i]); if (fallback_plan->mask_array[j]) diff --git a/src/hb-ot-shape-complex-arabic-win1256.hh b/src/hb-ot-shape-complex-arabic-win1256.hh index e4cb626e1..a19ce6ce8 100644 --- a/src/hb-ot-shape-complex-arabic-win1256.hh +++ b/src/hb-ot-shape-complex-arabic-win1256.hh @@ -224,6 +224,7 @@ OT_TABLE_START MANIFEST( MANIFEST_LOOKUP(OT_TAG('i','n','i','t'), initLookup) MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLookup) + MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLamLookup) MANIFEST_LOOKUP(OT_TAG('f','i','n','a'), finaLookup) MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligLookup) MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup)