Bug 1331339 - Don't start a new script run when the current script appears in the next character's ScriptExtensions property, or next char is a cluster-extender. r=jrmuizel
This commit is contained in:
@@ -107,12 +107,17 @@ gfxScriptItemizer::fixup(Script newScriptCode)
|
||||
}
|
||||
}
|
||||
|
||||
// We regard the current char as having the same script as the in-progress run
|
||||
// if either script code is Common or Inherited, or if the run script appears
|
||||
// in the character's ScriptExtensions, or if the char is a cluster extender.
|
||||
static inline bool
|
||||
SameScript(Script runScript, Script currCharScript)
|
||||
SameScript(Script runScript, Script currCharScript, uint32_t aCurrCh)
|
||||
{
|
||||
return runScript <= Script::INHERITED ||
|
||||
currCharScript <= Script::INHERITED ||
|
||||
currCharScript == runScript;
|
||||
currCharScript == runScript ||
|
||||
IsClusterExtender(aCurrCh) ||
|
||||
HasScript(aCurrCh, runScript);
|
||||
}
|
||||
|
||||
gfxScriptItemizer::gfxScriptItemizer(const char16_t *src, uint32_t length)
|
||||
@@ -194,7 +199,7 @@ gfxScriptItemizer::Next(uint32_t& aRunStart, uint32_t& aRunLimit,
|
||||
}
|
||||
}
|
||||
|
||||
if (SameScript(scriptCode, sc)) {
|
||||
if (SameScript(scriptCode, sc, ch)) {
|
||||
if (scriptCode <= Script::INHERITED &&
|
||||
sc > Script::INHERITED)
|
||||
{
|
||||
|
||||
@@ -105,6 +105,12 @@ GetScriptCode(uint32_t aCh)
|
||||
return Script(uscript_getScript(aCh, &err));
|
||||
}
|
||||
|
||||
inline bool
|
||||
HasScript(uint32_t aCh, Script aScript)
|
||||
{
|
||||
return uscript_hasScript(aCh, UScriptCode(aScript));
|
||||
}
|
||||
|
||||
inline uint32_t
|
||||
GetScriptTagForCode(Script aScriptCode)
|
||||
{
|
||||
@@ -189,6 +195,16 @@ uint8_t GetLineBreakClass(uint32_t aCh);
|
||||
|
||||
Script GetScriptCode(uint32_t aCh);
|
||||
|
||||
// We don't support ScriptExtensions.txt data when building without ICU.
|
||||
// The most important cases will still be handled in gfxScriptItemizer
|
||||
// by checking IsClusterExtender to avoid breaking script runs within
|
||||
// a cluster.
|
||||
inline bool
|
||||
HasScript(uint32_t aCh, Script aScript)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32_t GetScriptTagForCode(Script aScriptCode);
|
||||
|
||||
PairedBracketType GetPairedBracketType(uint32_t aCh);
|
||||
|
||||
Reference in New Issue
Block a user