mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-25 18:07:31 +09:00
Issue #1862 - Follow-up: Replace deprecated Harfbuzz functions with current ones.
Based on Mozilla bug 1500356.
This commit is contained in:
parent
45b34592b6
commit
51426d1053
7 changed files with 73 additions and 78 deletions
|
|
@ -484,7 +484,7 @@ FT2FontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
||||||
// check to see if the cmap includes complex script codepoints
|
// check to see if the cmap includes complex script codepoints
|
||||||
if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) {
|
if (charmap->TestRange(sr->rangeStart, sr->rangeEnd)) {
|
||||||
// We check for GSUB here, as GPOS alone would not be ok.
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
charmap->ClearRange(sr->rangeStart, sr->rangeEnd);
|
charmap->ClearRange(sr->rangeStart, sr->rangeEnd);
|
||||||
|
|
|
||||||
|
|
@ -1171,12 +1171,14 @@ gfxFont::CheckForFeaturesInvolvingSpace()
|
||||||
sScriptTagToCode->Put(HB_TAG('D','F','L','T'), Script::COMMON);
|
sScriptTagToCode->Put(HB_TAG('D','F','L','T'), Script::COMMON);
|
||||||
for (Script s = Script::ARABIC; s < Script::NUM_SCRIPT_CODES;
|
for (Script s = Script::ARABIC; s < Script::NUM_SCRIPT_CODES;
|
||||||
s = Script(static_cast<int>(s) + 1)) {
|
s = Script(static_cast<int>(s) + 1)) {
|
||||||
hb_script_t scriptTag = hb_script_t(GetScriptTagForCode(s));
|
hb_script_t script = hb_script_t(GetScriptTagForCode(s));
|
||||||
hb_tag_t s1, s2;
|
unsigned int scriptCount = 4;
|
||||||
hb_ot_tags_from_script(scriptTag, &s1, &s2);
|
hb_tag_t scriptTags[4];
|
||||||
sScriptTagToCode->Put(s1, s);
|
hb_ot_tags_from_script_and_language(script, HB_LANGUAGE_INVALID,
|
||||||
if (s2 != HB_OT_TAG_DEFAULT_SCRIPT) {
|
&scriptCount, scriptTags, nullptr,
|
||||||
sScriptTagToCode->Put(s2, s);
|
nullptr);
|
||||||
|
for (unsigned int i = 0; i < scriptCount; i++) {
|
||||||
|
sScriptTagToCode->Put(scriptTags[i], s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,9 @@ uint16_t gfxFontEntry::GetUVSGlyph(uint32_t aCh, uint32_t aVS)
|
||||||
return 0;
|
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();
|
hb_face_t *face = GetHBFace();
|
||||||
if (!face) {
|
if (!face) {
|
||||||
|
|
@ -242,9 +244,9 @@ bool gfxFontEntry::SupportsScriptInGSUB(const hb_tag_t* aScriptTags)
|
||||||
|
|
||||||
unsigned int index;
|
unsigned int index;
|
||||||
hb_tag_t chosenScript;
|
hb_tag_t chosenScript;
|
||||||
bool found =
|
bool found = hb_ot_layout_table_select_script(
|
||||||
hb_ot_layout_table_choose_script(face, TRUETYPE_TAG('G','S','U','B'),
|
face, TRUETYPE_TAG('G', 'S', 'U', 'B'), aNumTags, aScriptTags, &index,
|
||||||
aScriptTags, &index, &chosenScript);
|
&chosenScript);
|
||||||
hb_face_destroy(face);
|
hb_face_destroy(face);
|
||||||
|
|
||||||
return found && chosenScript != TRUETYPE_TAG('D','F','L','T');
|
return found && chosenScript != TRUETYPE_TAG('D','F','L','T');
|
||||||
|
|
@ -819,27 +821,22 @@ gfxFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag)
|
||||||
gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript);
|
gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript);
|
||||||
|
|
||||||
// Get the OpenType tag(s) that match this script code
|
// Get the OpenType tag(s) that match this script code
|
||||||
hb_tag_t scriptTags[4] = {
|
unsigned int scriptCount = 4;
|
||||||
HB_TAG_NONE,
|
hb_tag_t scriptTags[4];
|
||||||
HB_TAG_NONE,
|
hb_ot_tags_from_script_and_language(hbScript, HB_LANGUAGE_INVALID,
|
||||||
HB_TAG_NONE,
|
&scriptCount, scriptTags, nullptr,
|
||||||
HB_TAG_NONE
|
nullptr);
|
||||||
};
|
|
||||||
hb_ot_tags_from_script(hbScript, &scriptTags[0], &scriptTags[1]);
|
|
||||||
|
|
||||||
// Replace the first remaining NONE with DEFAULT
|
// Append DEFAULT to the returned tags, if room
|
||||||
hb_tag_t* scriptTag = &scriptTags[0];
|
if (scriptCount < 4) {
|
||||||
while (*scriptTag != HB_TAG_NONE) {
|
scriptTags[scriptCount++] = HB_OT_TAG_DEFAULT_SCRIPT;
|
||||||
++scriptTag;
|
|
||||||
}
|
}
|
||||||
*scriptTag = HB_OT_TAG_DEFAULT_SCRIPT;
|
|
||||||
|
|
||||||
// Now check for 'smcp' under the first of those scripts that is present
|
// Now check for 'smcp' under the first of those scripts that is present
|
||||||
const hb_tag_t kGSUB = HB_TAG('G','S','U','B');
|
const hb_tag_t kGSUB = HB_TAG('G','S','U','B');
|
||||||
scriptTag = &scriptTags[0];
|
for (unsigned int i = 0; i < scriptCount; i++) {
|
||||||
while (*scriptTag != HB_TAG_NONE) {
|
|
||||||
unsigned int scriptIndex;
|
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)) {
|
&scriptIndex)) {
|
||||||
if (hb_ot_layout_language_find_feature(face, kGSUB,
|
if (hb_ot_layout_language_find_feature(face, kGSUB,
|
||||||
scriptIndex,
|
scriptIndex,
|
||||||
|
|
@ -849,7 +846,6 @@ gfxFontEntry::SupportsOpenTypeFeature(Script aScript, uint32_t aFeatureTag)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++scriptTag;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -886,20 +882,17 @@ gfxFontEntry::InputsForOpenTypeFeature(Script aScript, uint32_t aFeatureTag)
|
||||||
gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript);
|
gfxHarfBuzzShaper::GetHBScriptUsedForShaping(aScript);
|
||||||
|
|
||||||
// Get the OpenType tag(s) that match this script code
|
// Get the OpenType tag(s) that match this script code
|
||||||
hb_tag_t scriptTags[4] = {
|
unsigned int scriptCount = 4;
|
||||||
HB_TAG_NONE,
|
hb_tag_t scriptTags[5]; // space for null terminator
|
||||||
HB_TAG_NONE,
|
hb_ot_tags_from_script_and_language(hbScript, HB_LANGUAGE_INVALID,
|
||||||
HB_TAG_NONE,
|
&scriptCount, scriptTags, nullptr,
|
||||||
HB_TAG_NONE
|
nullptr);
|
||||||
};
|
|
||||||
hb_ot_tags_from_script(hbScript, &scriptTags[0], &scriptTags[1]);
|
|
||||||
|
|
||||||
// Replace the first remaining NONE with DEFAULT
|
// Append DEFAULT to the returned tags, if room
|
||||||
hb_tag_t* scriptTag = &scriptTags[0];
|
if (scriptCount < 4) {
|
||||||
while (*scriptTag != HB_TAG_NONE) {
|
scriptTags[scriptCount++] = HB_OT_TAG_DEFAULT_SCRIPT;
|
||||||
++scriptTag;
|
|
||||||
}
|
}
|
||||||
*scriptTag = HB_OT_TAG_DEFAULT_SCRIPT;
|
scriptTags[scriptCount++] = 0;
|
||||||
|
|
||||||
const hb_tag_t kGSUB = HB_TAG('G','S','U','B');
|
const hb_tag_t kGSUB = HB_TAG('G','S','U','B');
|
||||||
hb_tag_t features[2] = { aFeatureTag, HB_TAG_NONE };
|
hb_tag_t features[2] = { aFeatureTag, HB_TAG_NONE };
|
||||||
|
|
|
||||||
|
|
@ -320,11 +320,11 @@ public:
|
||||||
struct ScriptRange {
|
struct ScriptRange {
|
||||||
uint32_t rangeStart;
|
uint32_t rangeStart;
|
||||||
uint32_t rangeEnd;
|
uint32_t rangeEnd;
|
||||||
hb_tag_t tags[3]; // one or two OpenType script tags to check,
|
uint32_t numTags; // number of entries in the tags[] array
|
||||||
// plus a NULL terminator
|
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 mName;
|
||||||
nsString mFamilyName;
|
nsString mFamilyName;
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,7 @@ MacOSFontEntry::ReadCMAP(FontInfoData *aFontInfoData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// We check for GSUB here, as GPOS alone would not be ok.
|
// 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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,39 +52,39 @@ const gfxFontEntry::ScriptRange gfxPlatformFontList::sComplexScriptRanges[] = {
|
||||||
// want to mask the basic Arabic block here?
|
// want to mask the basic Arabic block here?
|
||||||
// This affects the arabic-fallback-*.html reftests, which rely on
|
// This affects the arabic-fallback-*.html reftests, which rely on
|
||||||
// loading a font that *doesn't* have any GSUB table.
|
// loading a font that *doesn't* have any GSUB table.
|
||||||
{ 0x0600, 0x06FF, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } },
|
{0x0600, 0x06FF, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}},
|
||||||
{ 0x0700, 0x074F, { TRUETYPE_TAG('s','y','r','c'), 0, 0 } },
|
{0x0700, 0x074F, 1, {TRUETYPE_TAG('s', 'y', 'r', 'c'), 0, 0}},
|
||||||
{ 0x0750, 0x077F, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } },
|
{0x0750, 0x077F, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}},
|
||||||
{ 0x08A0, 0x08FF, { TRUETYPE_TAG('a','r','a','b'), 0, 0 } },
|
{0x08A0, 0x08FF, 1, {TRUETYPE_TAG('a', 'r', 'a', 'b'), 0, 0}},
|
||||||
{ 0x0900, 0x097F, { TRUETYPE_TAG('d','e','v','2'),
|
{ 0x0900, 0x097F, 2, { TRUETYPE_TAG('d','e','v','2'),
|
||||||
TRUETYPE_TAG('d','e','v','a'), 0 } },
|
TRUETYPE_TAG('d','e','v','a'), 0 } },
|
||||||
{ 0x0980, 0x09FF, { TRUETYPE_TAG('b','n','g','2'),
|
{ 0x0980, 0x09FF, 2, { TRUETYPE_TAG('b','n','g','2'),
|
||||||
TRUETYPE_TAG('b','e','n','g'), 0 } },
|
TRUETYPE_TAG('b','e','n','g'), 0 } },
|
||||||
{ 0x0A00, 0x0A7F, { TRUETYPE_TAG('g','u','r','2'),
|
{ 0x0A00, 0x0A7F, 2, { TRUETYPE_TAG('g','u','r','2'),
|
||||||
TRUETYPE_TAG('g','u','r','u'), 0 } },
|
TRUETYPE_TAG('g','u','r','u'), 0 } },
|
||||||
{ 0x0A80, 0x0AFF, { TRUETYPE_TAG('g','j','r','2'),
|
{ 0x0A80, 0x0AFF, 2, { TRUETYPE_TAG('g','j','r','2'),
|
||||||
TRUETYPE_TAG('g','u','j','r'), 0 } },
|
TRUETYPE_TAG('g','u','j','r'), 0 } },
|
||||||
{ 0x0B00, 0x0B7F, { TRUETYPE_TAG('o','r','y','2'),
|
{ 0x0B00, 0x0B7F, 2, { TRUETYPE_TAG('o','r','y','2'),
|
||||||
TRUETYPE_TAG('o','r','y','a'), 0 } },
|
TRUETYPE_TAG('o','r','y','a'), 0 } },
|
||||||
{ 0x0B80, 0x0BFF, { TRUETYPE_TAG('t','m','l','2'),
|
{ 0x0B80, 0x0BFF, 2, { TRUETYPE_TAG('t','m','l','2'),
|
||||||
TRUETYPE_TAG('t','a','m','l'), 0 } },
|
TRUETYPE_TAG('t','a','m','l'), 0 } },
|
||||||
{ 0x0C00, 0x0C7F, { TRUETYPE_TAG('t','e','l','2'),
|
{ 0x0C00, 0x0C7F, 2, { TRUETYPE_TAG('t','e','l','2'),
|
||||||
TRUETYPE_TAG('t','e','l','u'), 0 } },
|
TRUETYPE_TAG('t','e','l','u'), 0 } },
|
||||||
{ 0x0C80, 0x0CFF, { TRUETYPE_TAG('k','n','d','2'),
|
{ 0x0C80, 0x0CFF, 2, { TRUETYPE_TAG('k','n','d','2'),
|
||||||
TRUETYPE_TAG('k','n','d','a'), 0 } },
|
TRUETYPE_TAG('k','n','d','a'), 0 } },
|
||||||
{ 0x0D00, 0x0D7F, { TRUETYPE_TAG('m','l','m','2'),
|
{ 0x0D00, 0x0D7F, 2, { TRUETYPE_TAG('m','l','m','2'),
|
||||||
TRUETYPE_TAG('m','l','y','m'), 0 } },
|
TRUETYPE_TAG('m','l','y','m'), 0 } },
|
||||||
{ 0x0D80, 0x0DFF, { TRUETYPE_TAG('s','i','n','h'), 0, 0 } },
|
{0x0D80, 0x0DFF, 1, {TRUETYPE_TAG('s', 'i', 'n', 'h'), 0, 0}},
|
||||||
{ 0x0E80, 0x0EFF, { TRUETYPE_TAG('l','a','o',' '), 0, 0 } },
|
{0x0E80, 0x0EFF, 1, {TRUETYPE_TAG('l', 'a', 'o', ' '), 0, 0}},
|
||||||
{ 0x0F00, 0x0FFF, { TRUETYPE_TAG('t','i','b','t'), 0, 0 } },
|
{0x0F00, 0x0FFF, 1, {TRUETYPE_TAG('t', 'i', 'b', 't'), 0, 0}},
|
||||||
{ 0x1000, 0x109f, { TRUETYPE_TAG('m','y','m','r'),
|
{ 0x1000, 0x109f, 2, { TRUETYPE_TAG('m','y','m','r'),
|
||||||
TRUETYPE_TAG('m','y','m','2'), 0 } },
|
TRUETYPE_TAG('m','y','m','2'), 0 } },
|
||||||
{ 0x1780, 0x17ff, { TRUETYPE_TAG('k','h','m','r'), 0, 0 } },
|
{ 0x1780, 0x17ff, 1, { TRUETYPE_TAG('k','h','m','r'), 0, 0 } },
|
||||||
// Khmer Symbols (19e0..19ff) don't seem to need any special shaping
|
// Khmer Symbols (19e0..19ff) don't seem to need any special shaping
|
||||||
{ 0xaa60, 0xaa7f, { TRUETYPE_TAG('m','y','m','r'),
|
{ 0xaa60, 0xaa7f, 2, { TRUETYPE_TAG('m','y','m','r'),
|
||||||
TRUETYPE_TAG('m','y','m','2'), 0 } },
|
TRUETYPE_TAG('m','y','m','2'), 0 } },
|
||||||
// Thai seems to be "renderable" without AAT morphing tables
|
// 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
|
// prefs for the font info loader
|
||||||
|
|
|
||||||
|
|
@ -639,9 +639,9 @@ hb_ot_layout_language_get_feature_tags
|
||||||
hb_ot_layout_language_get_required_feature_index
|
hb_ot_layout_language_get_required_feature_index
|
||||||
hb_ot_layout_lookup_collect_glyphs
|
hb_ot_layout_lookup_collect_glyphs
|
||||||
hb_ot_layout_script_get_language_tags
|
hb_ot_layout_script_get_language_tags
|
||||||
hb_ot_layout_table_choose_script
|
|
||||||
hb_ot_layout_table_find_script
|
hb_ot_layout_table_find_script
|
||||||
hb_ot_layout_table_get_script_tags
|
hb_ot_layout_table_get_script_tags
|
||||||
|
hb_ot_layout_table_select_script
|
||||||
hb_ot_math_get_constant
|
hb_ot_math_get_constant
|
||||||
hb_ot_math_get_glyph_assembly
|
hb_ot_math_get_glyph_assembly
|
||||||
hb_ot_math_get_glyph_italics_correction
|
hb_ot_math_get_glyph_italics_correction
|
||||||
|
|
@ -649,7 +649,7 @@ hb_ot_math_get_glyph_variants
|
||||||
hb_ot_math_has_data
|
hb_ot_math_has_data
|
||||||
hb_ot_tag_to_language
|
hb_ot_tag_to_language
|
||||||
hb_ot_tag_to_script
|
hb_ot_tag_to_script
|
||||||
hb_ot_tags_from_script
|
hb_ot_tags_from_script_and_language
|
||||||
hb_set_add
|
hb_set_add
|
||||||
hb_set_clear
|
hb_set_clear
|
||||||
hb_set_create
|
hb_set_create
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue