mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-26 02:17:34 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
0a4a1d8a63
32 changed files with 299 additions and 188 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
unsigned int scriptCount = 4;
|
||||
hb_tag_t scriptTags[4];
|
||||
hb_ot_tags_from_script_and_language(hbScript, HB_LANGUAGE_INVALID,
|
||||
&scriptCount, scriptTags, nullptr,
|
||||
nullptr);
|
||||
|
||||
// Replace the first remaining NONE with DEFAULT
|
||||
hb_tag_t* scriptTag = &scriptTags[0];
|
||||
while (*scriptTag != HB_TAG_NONE) {
|
||||
++scriptTag;
|
||||
// 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]);
|
||||
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);
|
||||
|
||||
// Replace the first remaining NONE with DEFAULT
|
||||
hb_tag_t* scriptTag = &scriptTags[0];
|
||||
while (*scriptTag != HB_TAG_NONE) {
|
||||
++scriptTag;
|
||||
// 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 };
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue