diff --git a/src/kernel/tqfontengine_x11.cpp b/src/kernel/tqfontengine_x11.cpp index 6363aac9..8002c42d 100644 --- a/src/kernel/tqfontengine_x11.cpp +++ b/src/kernel/tqfontengine_x11.cpp @@ -2264,6 +2264,8 @@ struct OTScripts { int flags; }; +// Refer to https://learn.microsoft.com/en-us/typography/opentype/spec/scripttags +// for OpenType language tags definition static const OTScripts ot_scripts [] = { // // European Alphabetic Scripts // Latin, @@ -2351,6 +2353,7 @@ static const OTScripts ot_scripts [] = { { FT_MAKE_TAG( 'c', 'a', 'n', 's' ), 0 }, // Mongolian, { FT_MAKE_TAG( 'm', 'o', 'n', 'g' ), 0 }, + // // Symbols // CurrencySymbols, { FT_MAKE_TAG( 'D', 'F', 'L', 'T' ), 0 }, @@ -2370,13 +2373,26 @@ static const OTScripts ot_scripts [] = { { FT_MAKE_TAG( 'D', 'F', 'L', 'T' ), 0 }, // Braille, { FT_MAKE_TAG( 'b', 'r', 'a', 'i' ), 0 }, -// Unicode, should be used - { FT_MAKE_TAG( 'D', 'F', 'L', 'T' ), 0 } - // ### where are these? -// { FT_MAKE_TAG( 'b', 'y', 'z', 'm' ), 0 }, -// { FT_MAKE_TAG( 'D', 'F', 'L', 'T' ), 0 }, - // ### Hangul Jamo -// { FT_MAKE_TAG( 'j', 'a', 'm', 'o' ), 0 }, + +// Unicode + { FT_MAKE_TAG( 'D', 'F', 'L', 'T' ), 0 }, + +// Tagalog, + { FT_MAKE_TAG( 't', 'g', 'l', 'g' ), 0 }, +// Hanunoo, + { FT_MAKE_TAG( 'h', 'a', 'n', 'o' ), 0 }, +// Buhid, + { FT_MAKE_TAG( 'b', 'u', 'h', 'd' ), 0 }, +// Tagbanwa, + { FT_MAKE_TAG( 't', 'a', 'g', 'b' ), 0 }, + +// KatakanaHalfWidth, -- can't find it, use Katakana code + { FT_MAKE_TAG( 'k', 'a', 'n', 'a' ), 0 }, + +// Limbu, + { FT_MAKE_TAG( 'l', 'i', 'm', 'b' ), 0 }, +// TaiLe, + { FT_MAKE_TAG( 't', 'a', 'l', 'e' ), 0 } }; TQOpenType::TQOpenType(TQFontEngineXft *fe) @@ -2435,7 +2451,10 @@ TQOpenType::~TQOpenType() bool TQOpenType::checkScript(unsigned int script) { - assert(script < TQFont::NScripts); + if (script >= TQFont::NScripts || script >= sizeof(ot_scripts) / sizeof(OTScripts)) + { + return false; + } uint tag = ot_scripts[script].tag; int requirements = ot_scripts[script].flags; @@ -2477,7 +2496,11 @@ void TQOpenType::selectScript(unsigned int script, const Features *features) if (current_script == script) return; - assert(script < TQFont::NScripts); + if (script >= TQFont::NScripts || script >= sizeof(ot_scripts) / sizeof(OTScripts)) + { + return; + } + // find script in our list of supported scripts. uint tag = ot_scripts[script].tag;