[arabic/win1256] Hook up lamMedi lookup

Restructure lookup array to accommodate.

https://bugzilla.mozilla.org/show_bug.cgi?id=1045139#c18
This commit is contained in:
Behdad Esfahbod 2014-08-01 16:14:33 -04:00
parent e839e2523e
commit 55977f2a46
2 changed files with 11 additions and 16 deletions

View File

@ -33,7 +33,8 @@
#include "hb-ot-layout-gsub-table.hh" #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[] = static const hb_tag_t arabic_fallback_features[] =
{ {
HB_TAG('i','n','i','t'), HB_TAG('i','n','i','t'),
@ -43,16 +44,6 @@ static const hb_tag_t arabic_fallback_features[] =
HB_TAG('r','l','i','g'), 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 * static OT::SubstLookup *
arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUSED, arabic_fallback_synthesize_lookup_single (const hb_ot_shape_plan_t *plan HB_UNUSED,
hb_font_t *font, 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); return arabic_fallback_synthesize_lookup_ligature (plan, font);
} }
#define ARABIC_FALLBACK_MAX_LOOKUPS 6
struct arabic_fallback_plan_t struct arabic_fallback_plan_t
{ {
ASSERT_POD (); ASSERT_POD ();
@ -207,9 +200,9 @@ struct arabic_fallback_plan_t
unsigned int num_lookups; unsigned int num_lookups;
bool free_lookups; bool free_lookups;
hb_mask_t mask_array[ARABIC_NUM_FALLBACK_FEATURES]; hb_mask_t mask_array[ARABIC_FALLBACK_MAX_LOOKUPS];
OT::SubstLookup *lookup_array[ARABIC_NUM_FALLBACK_FEATURES]; OT::SubstLookup *lookup_array[ARABIC_FALLBACK_MAX_LOOKUPS];
hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_NUM_FALLBACK_FEATURES]; hb_ot_layout_lookup_accelerator_t accel_array[ARABIC_FALLBACK_MAX_LOOKUPS];
}; };
static const arabic_fallback_plan_t arabic_fallback_plan_nil = {}; 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<const Manifest&> (arabic_win1256_gsub_lookups.manifest); const Manifest &manifest = reinterpret_cast<const Manifest&> (arabic_win1256_gsub_lookups.manifest);
ASSERT_STATIC (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup) ASSERT_STATIC (sizeof (arabic_win1256_gsub_lookups.manifestData) / sizeof (ManifestLookup)
<= ARABIC_NUM_FALLBACK_FEATURES); <= ARABIC_FALLBACK_MAX_LOOKUPS);
/* TODO sanitize the table? */ /* TODO sanitize the table? */
unsigned j = 0; 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, const hb_ot_shape_plan_t *plan,
hb_font_t *font) hb_font_t *font)
{ {
ASSERT_STATIC (ARRAY_LENGTH(arabic_fallback_features) <= ARABIC_FALLBACK_MAX_LOOKUPS);
unsigned int j = 0; 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]); fallback_plan->mask_array[j] = plan->map.get_1_mask (arabic_fallback_features[i]);
if (fallback_plan->mask_array[j]) if (fallback_plan->mask_array[j])

View File

@ -224,6 +224,7 @@ OT_TABLE_START
MANIFEST( MANIFEST(
MANIFEST_LOOKUP(OT_TAG('i','n','i','t'), initLookup) 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'), mediLookup)
MANIFEST_LOOKUP(OT_TAG('m','e','d','i'), mediLamLookup)
MANIFEST_LOOKUP(OT_TAG('f','i','n','a'), finaLookup) 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'), rligLookup)
MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup) MANIFEST_LOOKUP(OT_TAG('r','l','i','g'), rligMarksLookup)