зеркало из https://github.com/mozilla/pjs.git
Bug 652754. Eliminate unnecessary font data enumerations at startup. r=jkew
This commit is contained in:
Родитель
b738f3acb7
Коммит
aa033e7c25
|
@ -99,6 +99,11 @@ gfxFontEntry::~gfxFontEntry()
|
||||||
delete mUserFontData;
|
delete mUserFontData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool gfxFontEntry::IsSymbolFont()
|
||||||
|
{
|
||||||
|
return mSymbolFont;
|
||||||
|
}
|
||||||
|
|
||||||
PRBool gfxFontEntry::TestCharacterMap(PRUint32 aCh)
|
PRBool gfxFontEntry::TestCharacterMap(PRUint32 aCh)
|
||||||
{
|
{
|
||||||
if (!mCmapInitialized) {
|
if (!mCmapInitialized) {
|
||||||
|
|
|
@ -234,9 +234,10 @@ public:
|
||||||
PRBool IsFixedPitch() const { return mFixedPitch; }
|
PRBool IsFixedPitch() const { return mFixedPitch; }
|
||||||
PRBool IsItalic() const { return mItalic; }
|
PRBool IsItalic() const { return mItalic; }
|
||||||
PRBool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
|
PRBool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
|
||||||
PRBool IsSymbolFont() const { return mSymbolFont; }
|
|
||||||
PRBool IgnoreGDEF() const { return mIgnoreGDEF; }
|
PRBool IgnoreGDEF() const { return mIgnoreGDEF; }
|
||||||
|
|
||||||
|
virtual PRBool IsSymbolFont();
|
||||||
|
|
||||||
inline PRBool HasCmapTable() {
|
inline PRBool HasCmapTable() {
|
||||||
if (!mCmapInitialized) {
|
if (!mCmapInitialized) {
|
||||||
ReadCMAP();
|
ReadCMAP();
|
||||||
|
|
|
@ -215,7 +215,6 @@ GDIFontEntry::GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontT
|
||||||
mWindowsFamily(0), mWindowsPitch(0),
|
mWindowsFamily(0), mWindowsPitch(0),
|
||||||
mFontType(aFontType),
|
mFontType(aFontType),
|
||||||
mForceGDI(PR_FALSE), mUnknownCMAP(PR_FALSE),
|
mForceGDI(PR_FALSE), mUnknownCMAP(PR_FALSE),
|
||||||
mUnicodeFont(PR_FALSE),
|
|
||||||
mCharset(), mUnicodeRanges()
|
mCharset(), mUnicodeRanges()
|
||||||
{
|
{
|
||||||
mUserFontData = aUserFontData;
|
mUserFontData = aUserFontData;
|
||||||
|
@ -254,7 +253,6 @@ GDIFontEntry::ReadCMAP()
|
||||||
nsresult rv = gfxFontUtils::ReadCMAP(cmap, buffer.Length(),
|
nsresult rv = gfxFontUtils::ReadCMAP(cmap, buffer.Length(),
|
||||||
mCharacterMap, mUVSOffset,
|
mCharacterMap, mUVSOffset,
|
||||||
unicodeFont, symbolFont);
|
unicodeFont, symbolFont);
|
||||||
mUnicodeFont = unicodeFont;
|
|
||||||
mSymbolFont = symbolFont;
|
mSymbolFont = symbolFont;
|
||||||
mHasCmapTable = NS_SUCCEEDED(rv);
|
mHasCmapTable = NS_SUCCEEDED(rv);
|
||||||
|
|
||||||
|
@ -265,6 +263,14 @@ GDIFontEntry::ReadCMAP()
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
GDIFontEntry::IsSymbolFont()
|
||||||
|
{
|
||||||
|
// initialize cmap first
|
||||||
|
HasCmapTable();
|
||||||
|
return mSymbolFont;
|
||||||
|
}
|
||||||
|
|
||||||
gfxFont *
|
gfxFont *
|
||||||
GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, PRBool aNeedsBold)
|
GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, PRBool aNeedsBold)
|
||||||
{
|
{
|
||||||
|
@ -334,10 +340,6 @@ PRBool
|
||||||
GDIFontEntry::TestCharacterMap(PRUint32 aCh)
|
GDIFontEntry::TestCharacterMap(PRUint32 aCh)
|
||||||
{
|
{
|
||||||
if (ReadCMAP() != NS_OK) {
|
if (ReadCMAP() != NS_OK) {
|
||||||
// Type1 fonts aren't necessarily Unicode but
|
|
||||||
// this is the best guess we can make here
|
|
||||||
mUnicodeFont = IsType1();
|
|
||||||
|
|
||||||
// For fonts where we failed to read the character map,
|
// For fonts where we failed to read the character map,
|
||||||
// we can take a slow path to look up glyphs character by character
|
// we can take a slow path to look up glyphs character by character
|
||||||
mUnknownCMAP = PR_TRUE;
|
mUnknownCMAP = PR_TRUE;
|
||||||
|
@ -447,20 +449,6 @@ GDIFontEntry::CreateFontEntry(const nsAString& aName, gfxWindowsFontType aFontTy
|
||||||
GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aItalic, aWeight,
|
GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aItalic, aWeight,
|
||||||
aUserFontData);
|
aUserFontData);
|
||||||
|
|
||||||
// ReadCMAP may change the values of mUnicodeFont and mSymbolFont
|
|
||||||
if (NS_FAILED(fe->ReadCMAP())) {
|
|
||||||
// Type1 fonts aren't necessarily Unicode but
|
|
||||||
// this is the best guess we can make here
|
|
||||||
if (fe->IsType1())
|
|
||||||
fe->mUnicodeFont = PR_TRUE;
|
|
||||||
else
|
|
||||||
fe->mUnicodeFont = PR_FALSE;
|
|
||||||
|
|
||||||
// For fonts where we failed to read the character map,
|
|
||||||
// we can take a slow path to look up glyphs character by character
|
|
||||||
fe->mUnknownCMAP = PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fe;
|
return fe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,6 +144,8 @@ public:
|
||||||
|
|
||||||
nsresult ReadCMAP();
|
nsresult ReadCMAP();
|
||||||
|
|
||||||
|
virtual PRBool IsSymbolFont();
|
||||||
|
|
||||||
void FillLogFont(LOGFONTW *aLogFont, PRBool aItalic,
|
void FillLogFont(LOGFONTW *aLogFont, PRBool aItalic,
|
||||||
PRUint16 aWeight, gfxFloat aSize, PRBool aUseCleartype);
|
PRUint16 aWeight, gfxFloat aSize, PRBool aUseCleartype);
|
||||||
|
|
||||||
|
@ -179,11 +181,6 @@ public:
|
||||||
mFontType == GFX_FONT_TYPE_TT_OPENTYPE);
|
mFontType == GFX_FONT_TYPE_TT_OPENTYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool IsCrappyFont() const {
|
|
||||||
/* return if it is a bitmap not a unicode font */
|
|
||||||
return (!mUnicodeFont || IsSymbolFont() || IsType1());
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual PRBool MatchesGenericFamily(const nsACString& aGeneric) const {
|
virtual PRBool MatchesGenericFamily(const nsACString& aGeneric) const {
|
||||||
if (aGeneric.IsEmpty()) {
|
if (aGeneric.IsEmpty()) {
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
@ -293,7 +290,6 @@ public:
|
||||||
gfxWindowsFontType mFontType;
|
gfxWindowsFontType mFontType;
|
||||||
PRPackedBool mForceGDI : 1;
|
PRPackedBool mForceGDI : 1;
|
||||||
PRPackedBool mUnknownCMAP : 1;
|
PRPackedBool mUnknownCMAP : 1;
|
||||||
PRPackedBool mUnicodeFont : 1;
|
|
||||||
|
|
||||||
gfxSparseBitSet mCharset;
|
gfxSparseBitSet mCharset;
|
||||||
gfxSparseBitSet mUnicodeRanges;
|
gfxSparseBitSet mUnicodeRanges;
|
||||||
|
|
|
@ -1432,22 +1432,22 @@ pref("font.name-list.serif.he", "Narkisim, David");
|
||||||
pref("font.name-list.monospace.he", "Fixed Miriam Transparent, Miriam Fixed, Rod, Courier New");
|
pref("font.name-list.monospace.he", "Fixed Miriam Transparent, Miriam Fixed, Rod, Courier New");
|
||||||
pref("font.name-list.cursive.he", "Guttman Yad, Ktav, Arial");
|
pref("font.name-list.cursive.he", "Guttman Yad, Ktav, Arial");
|
||||||
|
|
||||||
pref("font.name.serif.ja", "MS P明朝"); // "MS PMincho"
|
pref("font.name.serif.ja", "MS PMincho");
|
||||||
pref("font.name.sans-serif.ja", "MS Pゴシック"); // "MS PGothic"
|
pref("font.name.sans-serif.ja", "MS PGothic");
|
||||||
pref("font.name.monospace.ja", "MS ゴシック"); // "MS Gothic"
|
pref("font.name.monospace.ja", "MS Gothic");
|
||||||
pref("font.name-list.serif.ja", "MS PMincho, MS Mincho, MS PGothic, MS Gothic");
|
pref("font.name-list.serif.ja", "MS PMincho, MS Mincho, MS PGothic, MS Gothic");
|
||||||
pref("font.name-list.sans-serif.ja", "MS PGothic, MS Gothic, MS PMincho, MS Mincho");
|
pref("font.name-list.sans-serif.ja", "MS PGothic, MS Gothic, MS PMincho, MS Mincho");
|
||||||
pref("font.name-list.monospace.ja", "MS Gothic, MS Mincho, MS PGothic, MS PMincho");
|
pref("font.name-list.monospace.ja", "MS Gothic, MS Mincho, MS PGothic, MS PMincho");
|
||||||
|
|
||||||
pref("font.name.serif.ko", "바탕"); // "Batang"
|
pref("font.name.serif.ko", "Batang");
|
||||||
pref("font.name.sans-serif.ko", "굴림"); // "Gulim"
|
pref("font.name.sans-serif.ko", "Gulim");
|
||||||
pref("font.name.monospace.ko", "굴림체"); // "GulimChe"
|
pref("font.name.monospace.ko", "GulimChe");
|
||||||
pref("font.name.cursive.ko", "궁서"); // "Gungseo"
|
pref("font.name.cursive.ko", "Gungsuh");
|
||||||
|
|
||||||
pref("font.name-list.serif.ko", "Batang, Gulim");
|
pref("font.name-list.serif.ko", "Batang, Gulim");
|
||||||
pref("font.name-list.sans-serif.ko", "Gulim");
|
pref("font.name-list.sans-serif.ko", "Gulim");
|
||||||
pref("font.name-list.monospace.ko", "GulimChe");
|
pref("font.name-list.monospace.ko", "GulimChe");
|
||||||
pref("font.name-list.cursive.ko", "Gungseo");
|
pref("font.name-list.cursive.ko", "Gungsuh");
|
||||||
|
|
||||||
pref("font.name.serif.th", "Tahoma");
|
pref("font.name.serif.th", "Tahoma");
|
||||||
pref("font.name.sans-serif.th", "Tahoma");
|
pref("font.name.sans-serif.th", "Tahoma");
|
||||||
|
@ -1484,9 +1484,9 @@ pref("font.name.sans-serif.x-western", "Arial");
|
||||||
pref("font.name.monospace.x-western", "Courier New");
|
pref("font.name.monospace.x-western", "Courier New");
|
||||||
pref("font.name.cursive.x-western", "Comic Sans MS");
|
pref("font.name.cursive.x-western", "Comic Sans MS");
|
||||||
|
|
||||||
pref("font.name.serif.zh-CN", "宋体"); //MS Song
|
pref("font.name.serif.zh-CN", "SimSun");
|
||||||
pref("font.name.sans-serif.zh-CN", "宋体"); //MS Song
|
pref("font.name.sans-serif.zh-CN", "SimSun");
|
||||||
pref("font.name.monospace.zh-CN", "宋体"); //MS Song
|
pref("font.name.monospace.zh-CN", "SimSun");
|
||||||
pref("font.name-list.serif.zh-CN", "MS Song, SimSun");
|
pref("font.name-list.serif.zh-CN", "MS Song, SimSun");
|
||||||
pref("font.name-list.sans-serif.zh-CN", "MS Song, SimSun");
|
pref("font.name-list.sans-serif.zh-CN", "MS Song, SimSun");
|
||||||
pref("font.name-list.monospace.zh-CN", "MS Song, SimSun");
|
pref("font.name-list.monospace.zh-CN", "MS Song, SimSun");
|
||||||
|
@ -1495,7 +1495,7 @@ pref("font.name-list.monospace.zh-CN", "MS Song, SimSun");
|
||||||
// rendering Latin letters. (bug 88579)
|
// rendering Latin letters. (bug 88579)
|
||||||
pref("font.name.serif.zh-TW", "Times New Roman");
|
pref("font.name.serif.zh-TW", "Times New Roman");
|
||||||
pref("font.name.sans-serif.zh-TW", "Arial");
|
pref("font.name.sans-serif.zh-TW", "Arial");
|
||||||
pref("font.name.monospace.zh-TW", "細明體"); // MingLiU
|
pref("font.name.monospace.zh-TW", "MingLiU");
|
||||||
pref("font.name-list.serif.zh-TW", "PMingLiu, MingLiU");
|
pref("font.name-list.serif.zh-TW", "PMingLiu, MingLiU");
|
||||||
pref("font.name-list.sans-serif.zh-TW", "PMingLiU, MingLiU");
|
pref("font.name-list.sans-serif.zh-TW", "PMingLiU, MingLiU");
|
||||||
pref("font.name-list.monospace.zh-TW", "MingLiU");
|
pref("font.name-list.monospace.zh-TW", "MingLiU");
|
||||||
|
@ -1504,7 +1504,7 @@ pref("font.name-list.monospace.zh-TW", "MingLiU");
|
||||||
// Hong Kong users have the same demand about glyphs for Latin letters (bug 88579)
|
// Hong Kong users have the same demand about glyphs for Latin letters (bug 88579)
|
||||||
pref("font.name.serif.zh-HK", "Times New Roman");
|
pref("font.name.serif.zh-HK", "Times New Roman");
|
||||||
pref("font.name.sans-serif.zh-HK", "Arial");
|
pref("font.name.sans-serif.zh-HK", "Arial");
|
||||||
pref("font.name.monospace.zh-HK", "細明體_HKSCS");
|
pref("font.name.monospace.zh-HK", "MingLiu_HKSCS");
|
||||||
pref("font.name-list.serif.zh-HK", "MingLiu_HKSCS, Ming(for ISO10646), MingLiU");
|
pref("font.name-list.serif.zh-HK", "MingLiu_HKSCS, Ming(for ISO10646), MingLiU");
|
||||||
pref("font.name-list.sans-serif.zh-HK", "MingLiU_HKSCS, Ming(for ISO10646), MingLiU");
|
pref("font.name-list.sans-serif.zh-HK", "MingLiU_HKSCS, Ming(for ISO10646), MingLiU");
|
||||||
pref("font.name-list.monospace.zh-HK", "MingLiU_HKSCS, Ming(for ISO10646), MingLiU");
|
pref("font.name-list.monospace.zh-HK", "MingLiU_HKSCS, Ming(for ISO10646), MingLiU");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче