Bug 652754. Eliminate unnecessary font data enumerations at startup. r=jkew

This commit is contained in:
John Daggett 2011-05-20 15:09:30 +09:00
Родитель b738f3acb7
Коммит aa033e7c25
5 изменённых файлов: 41 добавлений и 51 удалений

Просмотреть файл

@ -99,6 +99,11 @@ gfxFontEntry::~gfxFontEntry()
delete mUserFontData;
}
PRBool gfxFontEntry::IsSymbolFont()
{
return mSymbolFont;
}
PRBool gfxFontEntry::TestCharacterMap(PRUint32 aCh)
{
if (!mCmapInitialized) {

Просмотреть файл

@ -234,9 +234,10 @@ public:
PRBool IsFixedPitch() const { return mFixedPitch; }
PRBool IsItalic() const { return mItalic; }
PRBool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
PRBool IsSymbolFont() const { return mSymbolFont; }
PRBool IgnoreGDEF() const { return mIgnoreGDEF; }
virtual PRBool IsSymbolFont();
inline PRBool HasCmapTable() {
if (!mCmapInitialized) {
ReadCMAP();

Просмотреть файл

@ -215,7 +215,6 @@ GDIFontEntry::GDIFontEntry(const nsAString& aFaceName, gfxWindowsFontType aFontT
mWindowsFamily(0), mWindowsPitch(0),
mFontType(aFontType),
mForceGDI(PR_FALSE), mUnknownCMAP(PR_FALSE),
mUnicodeFont(PR_FALSE),
mCharset(), mUnicodeRanges()
{
mUserFontData = aUserFontData;
@ -254,7 +253,6 @@ GDIFontEntry::ReadCMAP()
nsresult rv = gfxFontUtils::ReadCMAP(cmap, buffer.Length(),
mCharacterMap, mUVSOffset,
unicodeFont, symbolFont);
mUnicodeFont = unicodeFont;
mSymbolFont = symbolFont;
mHasCmapTable = NS_SUCCEEDED(rv);
@ -265,6 +263,14 @@ GDIFontEntry::ReadCMAP()
return rv;
}
PRBool
GDIFontEntry::IsSymbolFont()
{
// initialize cmap first
HasCmapTable();
return mSymbolFont;
}
gfxFont *
GDIFontEntry::CreateFontInstance(const gfxFontStyle* aFontStyle, PRBool aNeedsBold)
{
@ -334,10 +340,6 @@ PRBool
GDIFontEntry::TestCharacterMap(PRUint32 aCh)
{
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,
// we can take a slow path to look up glyphs character by character
mUnknownCMAP = PR_TRUE;
@ -447,20 +449,6 @@ GDIFontEntry::CreateFontEntry(const nsAString& aName, gfxWindowsFontType aFontTy
GDIFontEntry *fe = new GDIFontEntry(aName, aFontType, aItalic, aWeight,
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;
}

Просмотреть файл

@ -144,6 +144,8 @@ public:
nsresult ReadCMAP();
virtual PRBool IsSymbolFont();
void FillLogFont(LOGFONTW *aLogFont, PRBool aItalic,
PRUint16 aWeight, gfxFloat aSize, PRBool aUseCleartype);
@ -179,11 +181,6 @@ public:
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 {
if (aGeneric.IsEmpty()) {
return PR_TRUE;
@ -293,7 +290,6 @@ public:
gfxWindowsFontType mFontType;
PRPackedBool mForceGDI : 1;
PRPackedBool mUnknownCMAP : 1;
PRPackedBool mUnicodeFont : 1;
gfxSparseBitSet mCharset;
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.cursive.he", "Guttman Yad, Ktav, Arial");
pref("font.name.serif.ja", " P明朝"); // "MS PMincho"
pref("font.name.sans-serif.ja", " Pゴシック"); // "MS PGothic"
pref("font.name.monospace.ja", " ゴシック"); // "MS Gothic"
pref("font.name.serif.ja", "MS PMincho");
pref("font.name.sans-serif.ja", "MS PGothic");
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.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.serif.ko", "바탕"); // "Batang"
pref("font.name.sans-serif.ko", "굴림"); // "Gulim"
pref("font.name.monospace.ko", "굴림체"); // "GulimChe"
pref("font.name.cursive.ko", "궁서"); // "Gungseo"
pref("font.name.serif.ko", "Batang");
pref("font.name.sans-serif.ko", "Gulim");
pref("font.name.monospace.ko", "GulimChe");
pref("font.name.cursive.ko", "Gungsuh");
pref("font.name-list.serif.ko", "Batang, Gulim");
pref("font.name-list.sans-serif.ko", "Gulim");
pref("font.name-list.monospace.ko", "GulimChe");
pref("font.name-list.cursive.ko", "Gungseo");
pref("font.name-list.serif.ko", "Batang, Gulim");
pref("font.name-list.sans-serif.ko", "Gulim");
pref("font.name-list.monospace.ko", "GulimChe");
pref("font.name-list.cursive.ko", "Gungsuh");
pref("font.name.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.cursive.x-western", "Comic Sans MS");
pref("font.name.serif.zh-CN", "宋体"); //MS Song
pref("font.name.sans-serif.zh-CN", "宋体"); //MS Song
pref("font.name.monospace.zh-CN", "宋体"); //MS Song
pref("font.name.serif.zh-CN", "SimSun");
pref("font.name.sans-serif.zh-CN", "SimSun");
pref("font.name.monospace.zh-CN", "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.monospace.zh-CN", "MS Song, SimSun");
@ -1495,18 +1495,18 @@ pref("font.name-list.monospace.zh-CN", "MS Song, SimSun");
// rendering Latin letters. (bug 88579)
pref("font.name.serif.zh-TW", "Times New Roman");
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.sans-serif.zh-TW", "PMingLiU, MingLiU");
pref("font.name-list.monospace.zh-TW", "MingLiU");
// hkscsm3u.ttf (HKSCS-2001) : http://www.microsoft.com/hk/hkscs
// Hong Kong users have the same demand about glyphs for Latin letters (bug 88579)
pref("font.name.serif.zh-HK", "Times New Roman");
// hkscsm3u.ttf (HKSCS-2001) : http://www.microsoft.com/hk/hkscs
// 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.sans-serif.zh-HK", "Arial");
pref("font.name.monospace.zh-HK", "細明體_HKSCS");
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.monospace.zh-HK", "MingLiu_HKSCS");
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.monospace.zh-HK", "MingLiU_HKSCS, Ming(for ISO10646), MingLiU");
pref("font.name.serif.x-devanagari", "Mangal");
@ -1552,19 +1552,19 @@ pref("font.name-list.monospace.x-ethi", "Ethiopia Jiret, Code2000");
pref("font.name.serif.x-geor", "Sylfaen");
pref("font.name.sans-serif.x-geor", "BPG Classic 99U");
pref("font.name.monospace.x-geor", "Code2000");
pref("font.name-list.serif.x-geor", "Sylfaen, BPG Paata Khutsuri U, TITUS Cyberbit Basic");
pref("font.name-list.serif.x-geor", "Sylfaen, BPG Paata Khutsuri U, TITUS Cyberbit Basic");
pref("font.name-list.monospace.x-geor", "BPG Classic 99U, Code2000, Arial Unicode MS");
pref("font.name.serif.x-gujr", "Shruti");
pref("font.name.sans-serif.x-gujr", "Shruti");
pref("font.name.monospace.x-gujr", "Code2000");
pref("font.name-list.serif.x-gujr", "Shruti, Code2000, Arial Unicode MS");
pref("font.name-list.serif.x-gujr", "Shruti, Code2000, Arial Unicode MS");
pref("font.name-list.monospace.x-gujr", "Code2000, Shruti, Arial Unicode MS");
pref("font.name.serif.x-guru", "Raavi");
pref("font.name.sans-serif.x-guru", "Code2000");
pref("font.name.monospace.x-guru", "Code2000");
pref("font.name-list.serif.x-guru", "Raavi, Saab, Code2000, Arial Unicode MS");
pref("font.name-list.serif.x-guru", "Raavi, Saab, Code2000, Arial Unicode MS");
pref("font.name-list.monospace.x-guru", "Code2000, Raavi, Saab, Arial Unicode MS");
pref("font.name.serif.x-khmr", "PhnomPenh OT");