diff options
-rw-r--r-- | gfx/thebes/gfxFT2FontList.cpp | 2 | ||||
-rw-r--r-- | gfx/thebes/gfxFont.cpp | 14 | ||||
-rw-r--r-- | gfx/thebes/gfxFontEntry.cpp | 61 | ||||
-rw-r--r-- | gfx/thebes/gfxFontEntry.h | 6 | ||||
-rw-r--r-- | gfx/thebes/gfxMacPlatformFontList.mm | 2 | ||||
-rw-r--r-- | gfx/thebes/gfxPlatformFontList.cpp | 62 | ||||
-rw-r--r-- | layout/media/symbols.def.in | 4 |
7 files changed, 73 insertions, 78 deletions
diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index b032be13dc..93603f5167 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -484,7 +484,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData) // check to see if the cmap includes complex script codepoints if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) { // We check for GSUB here, as GPOS alone would not be ok. - if (hasGSUB && SupportsScriptInGSUB(sr->tags)) { + if (hasGSUB && SupportsScriptInGSUB(sr->tags, sr->numTags)) { continue; } charmap->ClearRange(sr->rangeStart, sr->rangeEnd); diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 8ac64bc1b4..3857c4cd38 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -1171,12 +1171,14 @@ gfxFont::CheckForFeaturesInvolvingSpace() sScriptTagToCode->Put(HB_TAG('D','F','L','T'), Script::COMMON); for (Script s = Script::ARABIC; s < Script::NUM_SCRIPT_CODES; s = Script(static_cast<int>(s) + 1)) { - hb_script_t scriptTag = hb_script_t(GetScriptTagForCode(s)); - hb_tag_t s1, s2; - hb_ot_tags_from_script(scriptTag, &s1, &s2); - sScriptTagToCode->Put(s1, s); - if (s2 != HB_OT_TAG_DEFAULT_SCRIPT) { - sScriptTagToCode->Put(s2, s); + hb_script_t script = hb_script_t(GetScriptTagForCode(s)); + unsigned int scriptCount = 4; + hb_tag_t scriptTags[4]; + hb_ot_tags_from_script_and_language(script, HB_LANGUAGE_INVALID, + &scriptCount, scriptTags, nullptr, + nullptr); + for (unsigned int i = 0; i < scriptCount; i++) { + sScriptTagToCode->Put(scriptTags[i], s); } } diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index 90c0bc8585..765332aef5 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -233,7 +233,9 @@ uint16_t gfxFontEntry::GetUVSGlyph(uint32_t aCh, uint32_t aVS) return 0; } -bool gfxFontEntry::SupportsScriptInGSUB(const hb_tag_t* aScriptTags) +bool +gfxFontEntry::SupportsScriptInGSUB(const hb_tag_t* aScriptTags, + uint32_t aNumTags) { hb_face_t *face = GetHBFace(); if (!face) { @@ -242,9 +244,9 @@ bool gfxFontEntry::SupportsScriptInGSUB(const hb_tag_t* aScriptTags) unsigned int index; hb_tag_t chosenScript; - bool found = - hb_ot_layout_table_choose_script(face, TRUETYPE_TAG('G','S','U','B'), - aScriptTags, &index, &chosenScript); + bool found = hb_ot_layout_table_select_script( + face, TRUETYPE_TAG('G', 'S', 'U', 'B'), aNumTags, aScriptTags, &index, + &chosenScript); hb_face_destroy(face); return found && chosenScript != TRUETYPE_TAG('D','F','L','T'); @@ -819,27 +821,22 @@ gfxFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag) gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript); // Get the OpenType tag(s) that match this script code - hb_tag_t scriptTags[4] = { - HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE - }; - hb_ot_tags_from_script(hbScript, &scriptTags[0], &scriptTags[1]); - - // Replace the first remaining NONE with DEFAULT - hb_tag_t* scriptTag = &scriptTags[0]; - while (*scriptTag != HB_TAG_NONE) { - ++scriptTag; + unsigned int scriptCount = 4; + hb_tag_t scriptTags[4]; + hb_ot_tags_from_script_and_language(hbScript, HB_LANGUAGE_INVALID, + &scriptCount, scriptTags, nullptr, + nullptr); + + // Append DEFAULT to the returned tags, if room + if (scriptCount < 4) { + scriptTags[scriptCount++] = HB_OT_TAG_DEFAULT_SCRIPT; } - *scriptTag = HB_OT_TAG_DEFAULT_SCRIPT; // Now check for 'smcp' under the first of those scripts that is present const hb_tag_t kGSUB = HB_TAG('G','S','U','B'); - scriptTag = &scriptTags[0]; - while (*scriptTag != HB_TAG_NONE) { + for (unsigned int i = 0; i < scriptCount; i++) { unsigned int scriptIndex; - if (hb_ot_layout_table_find_script(face, kGSUB, *scriptTag, + if (hb_ot_layout_table_find_script(face, kGSUB, scriptTags[i], &scriptIndex)) { if (hb_ot_layout_language_find_feature(face, kGSUB, scriptIndex, @@ -849,7 +846,6 @@ gfxFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag) } break; } - ++scriptTag; } } @@ -886,20 +882,17 @@ gfxFontEntry::InputsForOpenTypeFeature(Script aScript, uint32_t aFeatureTag) gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript); // Get the OpenType tag(s) that match this script code - hb_tag_t scriptTags[4] = { - HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE, - HB_TAG_NONE - }; - hb_ot_tags_from_script(hbScript, &scriptTags[0], &scriptTags[1]); - - // Replace the first remaining NONE with DEFAULT - hb_tag_t* scriptTag = &scriptTags[0]; - while (*scriptTag != HB_TAG_NONE) { - ++scriptTag; + unsigned int scriptCount = 4; + hb_tag_t scriptTags[5]; // space for null terminator + hb_ot_tags_from_script_and_language(hbScript, HB_LANGUAGE_INVALID, + &scriptCount, scriptTags, nullptr, + nullptr); + + // Append DEFAULT to the returned tags, if room + if (scriptCount < 4) { + scriptTags[scriptCount++] = HB_OT_TAG_DEFAULT_SCRIPT; } - *scriptTag = HB_OT_TAG_DEFAULT_SCRIPT; + scriptTags[scriptCount++] = 0; const hb_tag_t kGSUB = HB_TAG('G','S','U','B'); hb_tag_t features[2] = { aFeatureTag, HB_TAG_NONE }; diff --git a/gfx/thebes/gfxFontEntry.h b/gfx/thebes/gfxFontEntry.h index 7f0e7215be..77346f3ea3 100644 --- a/gfx/thebes/gfxFontEntry.h +++ b/gfx/thebes/gfxFontEntry.h @@ -320,11 +320,11 @@ public: struct ScriptRange { uint32_t rangeStart; uint32_t rangeEnd; - hb_tag_t tags[3]; // one or two OpenType script tags to check, - // plus a NULL terminator + uint32_t numTags; // number of entries in the tags[] array + hb_tag_t tags[3]; // up to three OpenType script tags to check }; - bool SupportsScriptInGSUB(const hb_tag_t* aScriptTags); + bool SupportsScriptInGSUB(const hb_tag_t* aScriptTags, uint32_t aNumTags); nsString mName; nsString mFamilyName; diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 55263e7e6b..375d307230 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -204,7 +204,7 @@ MacOSFontEntry::ReadCMAP(FontInfoData *aFontInfoData) } // We check for GSUB here, as GPOS alone would not be ok. - if (hasGSUB && SupportsScriptInGSUB(sr->tags)) { + if (hasGSUB && SupportsScriptInGSUB(sr->tags, sr->numTags)) { continue; } diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index 5f7bbb832f..1a4a72cb5a 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -52,39 +52,39 @@ const gfxFontEntry::ScriptRange gfxPlatformFontList::sComplexScriptRanges[] = { // want to mask the basic Arabic block here? // This affects the arabic-fallback-*.html reftests, which rely on // loading a font that *doesn't* have any GSUB table. - { 0x0600, 0x06FF, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } }, - { 0x0700, 0x074F, { TRUETYPE_TAG('s','y','r','c'), 0, 0 } }, - { 0x0750, 0x077F, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } }, - { 0x08A0, 0x08FF, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } }, - { 0x0900, 0x097F, { TRUETYPE_TAG('d','e','v','2'), - TRUETYPE_TAG('d','e','v','a'), 0 } }, - { 0x0980, 0x09FF, { TRUETYPE_TAG('b','n','g','2'), - TRUETYPE_TAG('b','e','n','g'), 0 } }, - { 0x0A00, 0x0A7F, { TRUETYPE_TAG('g','u','r','2'), - TRUETYPE_TAG('g','u','r','u'), 0 } }, - { 0x0A80, 0x0AFF, { TRUETYPE_TAG('g','j','r','2'), - TRUETYPE_TAG('g','u','j','r'), 0 } }, - { 0x0B00, 0x0B7F, { TRUETYPE_TAG('o','r','y','2'), - TRUETYPE_TAG('o','r','y','a'), 0 } }, - { 0x0B80, 0x0BFF, { TRUETYPE_TAG('t','m','l','2'), - TRUETYPE_TAG('t','a','m','l'), 0 } }, - { 0x0C00, 0x0C7F, { TRUETYPE_TAG('t','e','l','2'), - TRUETYPE_TAG('t','e','l','u'), 0 } }, - { 0x0C80, 0x0CFF, { TRUETYPE_TAG('k','n','d','2'), - TRUETYPE_TAG('k','n','d','a'), 0 } }, - { 0x0D00, 0x0D7F, { TRUETYPE_TAG('m','l','m','2'), - TRUETYPE_TAG('m','l','y','m'), 0 } }, - { 0x0D80, 0x0DFF, { TRUETYPE_TAG('s','i','n','h'), 0, 0 } }, - { 0x0E80, 0x0EFF, { TRUETYPE_TAG('l','a','o',' '), 0, 0 } }, - { 0x0F00, 0x0FFF, { TRUETYPE_TAG('t','i','b','t'), 0, 0 } }, - { 0x1000, 0x109f, { TRUETYPE_TAG('m','y','m','r'), - TRUETYPE_TAG('m','y','m','2'), 0 } }, - { 0x1780, 0x17ff, { TRUETYPE_TAG('k','h','m','r'), 0, 0 } }, + {0x0600, 0x06FF, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}}, + {0x0700, 0x074F, 1, {TRUETYPE_TAG('s', 'y', 'r', 'c'), 0, 0}}, + {0x0750, 0x077F, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}}, + {0x08A0, 0x08FF, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}}, + { 0x0900, 0x097F, 2, { TRUETYPE_TAG('d','e','v','2'), + TRUETYPE_TAG('d','e','v','a'), 0 } }, + { 0x0980, 0x09FF, 2, { TRUETYPE_TAG('b','n','g','2'), + TRUETYPE_TAG('b','e','n','g'), 0 } }, + { 0x0A00, 0x0A7F, 2, { TRUETYPE_TAG('g','u','r','2'), + TRUETYPE_TAG('g','u','r','u'), 0 } }, + { 0x0A80, 0x0AFF, 2, { TRUETYPE_TAG('g','j','r','2'), + TRUETYPE_TAG('g','u','j','r'), 0 } }, + { 0x0B00, 0x0B7F, 2, { TRUETYPE_TAG('o','r','y','2'), + TRUETYPE_TAG('o','r','y','a'), 0 } }, + { 0x0B80, 0x0BFF, 2, { TRUETYPE_TAG('t','m','l','2'), + TRUETYPE_TAG('t','a','m','l'), 0 } }, + { 0x0C00, 0x0C7F, 2, { TRUETYPE_TAG('t','e','l','2'), + TRUETYPE_TAG('t','e','l','u'), 0 } }, + { 0x0C80, 0x0CFF, 2, { TRUETYPE_TAG('k','n','d','2'), + TRUETYPE_TAG('k','n','d','a'), 0 } }, + { 0x0D00, 0x0D7F, 2, { TRUETYPE_TAG('m','l','m','2'), + TRUETYPE_TAG('m','l','y','m'), 0 } }, + {0x0D80, 0x0DFF, 1, {TRUETYPE_TAG('s', 'i', 'n', 'h'), 0, 0}}, + {0x0E80, 0x0EFF, 1, {TRUETYPE_TAG('l', 'a', 'o', ' '), 0, 0}}, + {0x0F00, 0x0FFF, 1, {TRUETYPE_TAG('t', 'i', 'b', 't'), 0, 0}}, + { 0x1000, 0x109f, 2, { TRUETYPE_TAG('m','y','m','r'), + TRUETYPE_TAG('m','y','m','2'), 0 } }, + { 0x1780, 0x17ff, 1, { TRUETYPE_TAG('k','h','m','r'), 0, 0 } }, // Khmer Symbols (19e0..19ff) don't seem to need any special shaping - { 0xaa60, 0xaa7f, { TRUETYPE_TAG('m','y','m','r'), - TRUETYPE_TAG('m','y','m','2'), 0 } }, + { 0xaa60, 0xaa7f, 2, { TRUETYPE_TAG('m','y','m','r'), + TRUETYPE_TAG('m','y','m','2'), 0 } }, // Thai seems to be "renderable" without AAT morphing tables - { 0, 0, { 0, 0, 0 } } // terminator + {0, 0, 0, {0, 0, 0}} // terminator }; // prefs for the font info loader diff --git a/layout/media/symbols.def.in b/layout/media/symbols.def.in index d604e5b14b..2ad49cbfcf 100644 --- a/layout/media/symbols.def.in +++ b/layout/media/symbols.def.in @@ -658,9 +658,9 @@ hb_ot_layout_language_get_feature_tags hb_ot_layout_language_get_required_feature_index hb_ot_layout_lookup_collect_glyphs hb_ot_layout_script_get_language_tags -hb_ot_layout_table_choose_script hb_ot_layout_table_find_script hb_ot_layout_table_get_script_tags +hb_ot_layout_table_select_script hb_ot_math_get_constant hb_ot_math_get_glyph_assembly hb_ot_math_get_glyph_italics_correction @@ -668,7 +668,7 @@ hb_ot_math_get_glyph_variants hb_ot_math_has_data hb_ot_tag_to_language hb_ot_tag_to_script -hb_ot_tags_from_script +hb_ot_tags_from_script_and_language hb_set_add hb_set_clear hb_set_create |