зеркало из https://github.com/mozilla/pjs.git
Bug 492309. Remove useless gfxTextRuNnFactory flags. r=vlad
--HG-- extra : rebase_source : 4cdbc37f404c07f509adbfb581c662187813bc4a
This commit is contained in:
Родитель
95c44491cd
Коммит
22e45a4c15
|
@ -745,25 +745,16 @@ public:
|
|||
* on the spacing provider.
|
||||
*/
|
||||
TEXT_ENABLE_SPACING = 0x0008,
|
||||
/**
|
||||
* When set, GetSpacing can return negative spacing.
|
||||
*/
|
||||
TEXT_ENABLE_NEGATIVE_SPACING = 0x0010,
|
||||
/**
|
||||
* When set, GetHyphenationBreaks may return true for some character
|
||||
* positions, otherwise it will always return false for all characters.
|
||||
*/
|
||||
TEXT_ENABLE_HYPHEN_BREAKS = 0x0040,
|
||||
TEXT_ENABLE_HYPHEN_BREAKS = 0x0010,
|
||||
/**
|
||||
* When set, the text has no characters above 255 and it is stored
|
||||
* in the textrun in 8-bit format.
|
||||
*/
|
||||
TEXT_IS_8BIT = 0x0080,
|
||||
/**
|
||||
* When set, the text may have UTF16 surrogate pairs, otherwise it
|
||||
* doesn't.
|
||||
*/
|
||||
TEXT_HAS_SURROGATES = 0x0100,
|
||||
TEXT_IS_8BIT = 0x0020,
|
||||
/**
|
||||
* When set, the RunMetrics::mBoundingBox field will be initialized
|
||||
* properly based on glyph extents, in particular, glyph extents that
|
||||
|
@ -771,18 +762,18 @@ public:
|
|||
* and advance width of the glyph). When not set, it may just be the
|
||||
* standard font-box even if glyphs overflow.
|
||||
*/
|
||||
TEXT_NEED_BOUNDING_BOX = 0x0200,
|
||||
TEXT_NEED_BOUNDING_BOX = 0x0040,
|
||||
/**
|
||||
* When set, optional ligatures are disabled. Ligatures that are
|
||||
* required for legible text should still be enabled.
|
||||
*/
|
||||
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0400,
|
||||
TEXT_DISABLE_OPTIONAL_LIGATURES = 0x0080,
|
||||
/**
|
||||
* When set, the textrun should favour speed of construction over
|
||||
* quality. This may involve disabling ligatures and/or kerning or
|
||||
* other effects.
|
||||
*/
|
||||
TEXT_OPTIMIZE_SPEED = 0x0800
|
||||
TEXT_OPTIMIZE_SPEED = 0x0100
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1196,7 +1187,6 @@ public:
|
|||
FLAG_NOT_MISSING = 0x01,
|
||||
FLAG_NOT_CLUSTER_START = 0x02,
|
||||
FLAG_NOT_LIGATURE_GROUP_START = 0x04,
|
||||
FLAG_LOW_SURROGATE = 0x08,
|
||||
|
||||
GLYPH_COUNT_MASK = 0x00FFFF00U,
|
||||
GLYPH_COUNT_SHIFT = 8
|
||||
|
@ -1222,9 +1212,6 @@ public:
|
|||
PRUint32 GetSimpleGlyph() const { return mValue & GLYPH_MASK; }
|
||||
|
||||
PRBool IsMissing() const { return (mValue & (FLAG_NOT_MISSING|FLAG_IS_SIMPLE_GLYPH)) == 0; }
|
||||
PRBool IsLowSurrogate() const {
|
||||
return (mValue & (FLAG_LOW_SURROGATE|FLAG_IS_SIMPLE_GLYPH)) == FLAG_LOW_SURROGATE;
|
||||
}
|
||||
PRBool IsClusterStart() const {
|
||||
return (mValue & FLAG_IS_SIMPLE_GLYPH) || !(mValue & FLAG_NOT_CLUSTER_START);
|
||||
}
|
||||
|
@ -1271,15 +1258,6 @@ public:
|
|||
(aGlyphCount << GLYPH_COUNT_SHIFT);
|
||||
return *this;
|
||||
}
|
||||
/**
|
||||
* Low surrogates don't have any glyphs and are not the start of
|
||||
* a cluster or ligature group.
|
||||
*/
|
||||
CompressedGlyph& SetLowSurrogate() {
|
||||
mValue = (mValue & FLAG_CAN_BREAK_BEFORE) | FLAG_NOT_MISSING |
|
||||
FLAG_LOW_SURROGATE;
|
||||
return *this;
|
||||
}
|
||||
PRUint32 GetGlyphCount() const {
|
||||
NS_ASSERTION(!IsSimpleGlyph(), "Expected non-simple-glyph");
|
||||
return (mValue & GLYPH_COUNT_MASK) >> GLYPH_COUNT_SHIFT;
|
||||
|
@ -1351,11 +1329,6 @@ public:
|
|||
|
||||
// API for setting up the textrun glyphs. Should only be called by
|
||||
// things that construct textruns.
|
||||
/**
|
||||
* Record every character that is the second half of a surrogate pair.
|
||||
* This should be called after creating a Unicode textrun.
|
||||
*/
|
||||
void RecordSurrogates(const PRUnichar *aString);
|
||||
/**
|
||||
* We've found a run of text that should use a particular font. Call this
|
||||
* only during initialization when font substitution has been computed.
|
||||
|
|
|
@ -52,8 +52,7 @@ public:
|
|||
* Get a textrun for the given text, using a global cache. The textrun
|
||||
* must be released via ReleaseTextRun, not deleted.
|
||||
* Do not set any state in the textrun (e.g. actual or potential linebreaks).
|
||||
* Flags IS_8BIT, IS_ASCII and HAS_SURROGATES are automatically set
|
||||
* appropriately.
|
||||
* Flags IS_8BIT and IS_ASCII are automatically set appropriately.
|
||||
* Flag IS_PERSISTENT must NOT be set unless aText is guaranteed to live
|
||||
* forever.
|
||||
* The string can contain any characters, invalid ones will be stripped
|
||||
|
|
|
@ -70,10 +70,10 @@ public:
|
|||
* Create a textrun using cached words.
|
||||
* Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
|
||||
* treated as invisible missing.
|
||||
* @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
|
||||
* by the caller, if applicable; TEXT_IN_CACHE is added if we
|
||||
* have a reference to the textrun in the cache and RemoveTextRun must
|
||||
* be called when the textrun dies.
|
||||
* @param aFlags the flag TEXT_IS_ASCII must be set by the caller,
|
||||
* if applicable; TEXT_IN_CACHE is added if we have a reference to
|
||||
* the textrun in the cache and RemoveTextRun must be called when the
|
||||
* textrun dies.
|
||||
*/
|
||||
static gfxTextRun *MakeTextRun(const PRUnichar *aText, PRUint32 aLength,
|
||||
gfxFontGroup *aFontGroup,
|
||||
|
@ -83,10 +83,10 @@ public:
|
|||
* Create a textrun using cached words.
|
||||
* Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
|
||||
* treated as invisible missing.
|
||||
* @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
|
||||
* by the caller, if applicable; TEXT_IN_CACHE is added if we
|
||||
* have a reference to the textrun in the cache and RemoveTextRun must
|
||||
* be called when the textrun dies.
|
||||
* @param aFlags the flag TEXT_IS_ASCII must be set by the caller,
|
||||
* if applicable; TEXT_IN_CACHE is added if we have a reference to
|
||||
* the textrun in the cache and RemoveTextRun must be called when the
|
||||
* textrun dies.
|
||||
*/
|
||||
static gfxTextRun *MakeTextRun(const PRUint8 *aText, PRUint32 aLength,
|
||||
gfxFontGroup *aFontGroup,
|
||||
|
|
|
@ -714,7 +714,6 @@ gfxAtsuiFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
|
|||
if (!textRun)
|
||||
return nsnull;
|
||||
|
||||
textRun->RecordSurrogates(aString);
|
||||
gfxPlatformMac::SetupClusterBoundaries(textRun, aString);
|
||||
|
||||
PRUint32 maxLen;
|
||||
|
|
|
@ -721,7 +721,6 @@ gfxCoreTextFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
|
|||
if (!textRun)
|
||||
return nsnull;
|
||||
|
||||
textRun->RecordSurrogates(aString);
|
||||
gfxPlatformMac::SetupClusterBoundaries(textRun, aString);
|
||||
|
||||
nsAutoString utf16;
|
||||
|
|
|
@ -289,8 +289,6 @@ gfxTextRun *gfxFT2FontGroup::MakeTextRun(const PRUnichar* aString, PRUint32 aLen
|
|||
if (!textRun)
|
||||
return nsnull;
|
||||
|
||||
textRun->RecordSurrogates(aString);
|
||||
|
||||
mString.Assign(nsDependentSubstring(aString, aString + aLength));
|
||||
|
||||
InitTextRun(textRun);
|
||||
|
|
|
@ -2377,30 +2377,6 @@ gfxTextRun::SetMissingGlyph(PRUint32 aIndex, PRUint32 aChar)
|
|||
mCharacterGlyphs[aIndex].SetMissing(1);
|
||||
}
|
||||
|
||||
void
|
||||
gfxTextRun::RecordSurrogates(const PRUnichar *aString)
|
||||
{
|
||||
// !! FIXME !!
|
||||
//
|
||||
// This is called from the platform font implementations when making text runs, but currently it
|
||||
// doesn't do anything because callers do not (consistently, or ever?) set the TEXT_HAS_SURROGATES flag.
|
||||
// However, I have not seen anything that relies on the surrogate flag on glyphs, so perhaps we can
|
||||
// simply eliminate this and remove that flag from gfxTextRunFactory?
|
||||
|
||||
if (!(mFlags & gfxTextRunFactory::TEXT_HAS_SURROGATES))
|
||||
return;
|
||||
|
||||
// Remember which characters are low surrogates (the second half of
|
||||
// a surrogate pair).
|
||||
PRUint32 i;
|
||||
gfxTextRun::CompressedGlyph g;
|
||||
for (i = 0; i < mCharacterCount; ++i) {
|
||||
if (NS_IS_LOW_SURROGATE(aString[i])) {
|
||||
SetGlyphs(i, g.SetLowSurrogate(), nsnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ClearCharacters(gfxTextRun::CompressedGlyph *aGlyphs, PRUint32 aLength)
|
||||
{
|
||||
|
|
|
@ -548,8 +548,6 @@ gfxTextRun *gfxOS2FontGroup::MakeTextRun(const PRUnichar* aString, PRUint32 aLen
|
|||
|
||||
mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED);
|
||||
|
||||
textRun->RecordSurrogates(aString);
|
||||
|
||||
nsCAutoString utf8;
|
||||
PRInt32 headerLen = AppendDirectionalIndicatorUTF8(textRun->IsRightToLeft(), utf8);
|
||||
AppendUTF16toUTF8(Substring(aString, aString + aLength), utf8);
|
||||
|
|
|
@ -2860,8 +2860,6 @@ gfxPangoFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
|
|||
if (!run)
|
||||
return nsnull;
|
||||
|
||||
run->RecordSurrogates(aString);
|
||||
|
||||
nsCAutoString utf8;
|
||||
PRInt32 headerLen = AppendDirectionalIndicatorUTF8(run->IsRightToLeft(), utf8);
|
||||
AppendUTF16toUTF8(Substring(aString, aString + aLength), utf8);
|
||||
|
|
|
@ -93,8 +93,8 @@ public:
|
|||
* Create a textrun using cached words.
|
||||
* Invalid characters (see gfxFontGroup::IsInvalidChar) will be automatically
|
||||
* treated as invisible missing.
|
||||
* @param aFlags the flags TEXT_IS_ASCII and TEXT_HAS_SURROGATES must be set
|
||||
* by the caller, if applicable
|
||||
* @param aFlags the flag TEXT_IS_ASCII must be set by the caller,
|
||||
* if applicable
|
||||
* @param aIsInCache if true is returned, then RemoveTextRun must be called
|
||||
* before the textrun changes or dies.
|
||||
*/
|
||||
|
|
|
@ -1477,8 +1477,6 @@ gfxWindowsFontGroup::MakeTextRun(const PRUnichar *aString, PRUint32 aLength,
|
|||
return nsnull;
|
||||
NS_ASSERTION(aParams->mContext, "MakeTextRun called without a gfxContext");
|
||||
|
||||
textRun->RecordSurrogates(aString);
|
||||
|
||||
#ifdef FORCE_UNISCRIBE
|
||||
const PRBool isComplex = PR_TRUE;
|
||||
#else
|
||||
|
|
|
@ -304,7 +304,6 @@ RunTest (TestEntry *test, gfxContext *ctx) {
|
|||
length = strlen(test->string);
|
||||
textRun = gfxTextRunWordCache::MakeTextRun(reinterpret_cast<PRUint8*>(test->string), length, fontGroup, ¶ms, flags);
|
||||
} else {
|
||||
flags |= gfxTextRunFactory::TEXT_HAS_SURROGATES; // just in case
|
||||
NS_ConvertUTF8toUTF16 str(nsDependentCString(test->string));
|
||||
length = str.Length();
|
||||
textRun = gfxTextRunWordCache::MakeTextRun(str.get(), length, fontGroup, ¶ms, flags);
|
||||
|
|
|
@ -119,7 +119,6 @@ RunTest (TestEntry *test, gfxContext *ctx) {
|
|||
length = strlen(test->mString);
|
||||
textRun = fontGroup->MakeTextRun(reinterpret_cast<const PRUint8*>(test->mString), length, ¶ms, flags);
|
||||
} else {
|
||||
flags |= gfxTextRunFactory::TEXT_HAS_SURROGATES; // just in case
|
||||
NS_ConvertUTF8toUTF16 str(nsDependentCString(test->mString));
|
||||
length = str.Length();
|
||||
textRun = fontGroup->MakeTextRun(str.get(), length, ¶ms, flags);
|
||||
|
|
|
@ -1434,12 +1434,7 @@ BuildTextRunsScanner::GetNextBreakBeforeFrame(PRUint32* aIndex)
|
|||
static PRUint32
|
||||
GetSpacingFlags(nscoord spacing)
|
||||
{
|
||||
if (!spacing)
|
||||
return 0;
|
||||
if (spacing > 0)
|
||||
return gfxTextRunFactory::TEXT_ENABLE_SPACING;
|
||||
return gfxTextRunFactory::TEXT_ENABLE_SPACING |
|
||||
gfxTextRunFactory::TEXT_ENABLE_NEGATIVE_SPACING;
|
||||
return spacing ? gfxTextRunFactory::TEXT_ENABLE_SPACING : 0;
|
||||
}
|
||||
|
||||
static gfxFontGroup*
|
||||
|
|
|
@ -173,15 +173,13 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
|
|||
// to merge S's (uppercase ß), so it's not worth it.
|
||||
|
||||
if (k + 1 < iter.GetStringEnd() && aCharsToMerge[k + 1]) {
|
||||
NS_ASSERTION(g.IsClusterStart() && g.IsLigatureGroupStart() &&
|
||||
!g.IsLowSurrogate(),
|
||||
NS_ASSERTION(g.IsClusterStart() && g.IsLigatureGroupStart(),
|
||||
"Don't know how to merge this stuff");
|
||||
continue;
|
||||
}
|
||||
|
||||
NS_ASSERTION(mergeRunStart == k ||
|
||||
(g.IsClusterStart() && g.IsLigatureGroupStart() &&
|
||||
!g.IsLowSurrogate()),
|
||||
(g.IsClusterStart() && g.IsLigatureGroupStart()),
|
||||
"Don't know how to merge this stuff");
|
||||
|
||||
// If the start of the merge run is actually a character that should
|
||||
|
|
Загрузка…
Ссылка в новой задаче