Bug 602792. Clean up font logs and add system fallback logging. r=bas, a=blocker

This commit is contained in:
John Daggett 2011-01-22 01:44:33 +09:00
parent a1b47791ac
commit eeb92a1447
11 changed files with 337 additions and 130 deletions

View File

@ -62,14 +62,6 @@
#include "nsUnicodeRange.h" #include "nsUnicodeRange.h"
// Uncomment this to dump all text runs created to the log (if enabled)
//#define DUMP_TEXT_RUNS
#ifdef DUMP_TEXT_RUNS
static PRLogModuleInfo *gCoreTextTextRunLog = PR_NewLogModule("coreTextTextRun");
#endif
// standard font descriptors that we construct the first time they're needed // standard font descriptors that we construct the first time they're needed
CTFontDescriptorRef gfxCoreTextShaper::sDefaultFeaturesDescriptor = NULL; CTFontDescriptorRef gfxCoreTextShaper::sDefaultFeaturesDescriptor = NULL;
CTFontDescriptorRef gfxCoreTextShaper::sDisableLigaturesDescriptor = NULL; CTFontDescriptorRef gfxCoreTextShaper::sDisableLigaturesDescriptor = NULL;

View File

@ -51,10 +51,20 @@
#include "nsIWindowsRegKey.h" #include "nsIWindowsRegKey.h"
#ifdef PR_LOGGING #ifdef PR_LOGGING
static PRLogModuleInfo *gFontInitLog = nsnull;
#define LOG(args) PR_LOG(gFontInitLog, PR_LOG_DEBUG, args) #define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
#define LOG_ENABLED() (gFontInitLog) && PR_LOG_TEST(gFontInitLog, PR_LOG_DEBUG) PR_LOG_DEBUG, args)
#endif /* PR_LOGGING */ #define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \
gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG)
#define LOG_FONTINIT(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \
PR_LOG_DEBUG, args)
#define LOG_FONTINIT_ENABLED() PR_LOG_TEST( \
gfxPlatform::GetLog(eGfxLog_fontinit), \
PR_LOG_DEBUG)
#endif // PR_LOGGING
// font info loader constants // font info loader constants
@ -135,6 +145,7 @@ gfxDWriteFontFamily::FindStyleVariations()
} }
nsString fullID(mName); nsString fullID(mName);
fullID.Append(NS_LITERAL_STRING(" "));
fullID.Append(faceName.Elements()); fullID.Append(faceName.Elements());
/** /**
@ -145,6 +156,17 @@ gfxDWriteFontFamily::FindStyleVariations()
new gfxDWriteFontEntry(fullID, font); new gfxDWriteFontEntry(fullID, font);
fe->SetFamily(this); fe->SetFamily(this);
#ifdef PR_LOGGING
if (LOG_FONTLIST_ENABLED()) {
LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
" with style: %s weight: %d stretch: %d",
NS_ConvertUTF16toUTF8(fe->Name()).get(),
NS_ConvertUTF16toUTF8(Name()).get(),
(fe->IsItalic()) ? "italic" : "normal",
fe->Weight(), fe->Stretch()));
}
#endif
mAvailableFonts.AppendElement(fe); mAvailableFonts.AppendElement(fe);
} }
if (!mAvailableFonts.Length()) { if (!mAvailableFonts.Length()) {
@ -360,6 +382,11 @@ gfxDWriteFontEntry::ReadCMAP()
} }
fontFace->ReleaseFontTable(tableContext); fontFace->ReleaseFontTable(tableContext);
#ifdef PR_LOGGING
LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %d\n",
NS_ConvertUTF16toUTF8(mName).get(), mCharacterMap.GetSize()));
#endif
mHasCmapTable = NS_SUCCEEDED(rv); mHasCmapTable = NS_SUCCEEDED(rv);
return rv; return rv;
} }
@ -558,14 +585,12 @@ gfxDWriteFontList::InitFontList()
{ {
#ifdef PR_LOGGING #ifdef PR_LOGGING
gFontInitLog = PR_NewLogModule("fontinit");
LARGE_INTEGER frequency; // ticks per second LARGE_INTEGER frequency; // ticks per second
LARGE_INTEGER t1, t2, t3, t4, t5, t6; // ticks LARGE_INTEGER t1, t2, t3, t4, t5, t6; // ticks
double elapsedTime, upTime; double elapsedTime, upTime;
char nowTime[256], nowDate[256]; char nowTime[256], nowDate[256];
if (LOG_ENABLED()) { if (LOG_FONTINIT_ENABLED()) {
GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT, GetTimeFormat(LOCALE_INVARIANT, TIME_FORCE24HOURFORMAT,
NULL, NULL, nowTime, 256); NULL, NULL, nowTime, 256);
GetDateFormat(LOCALE_INVARIANT, NULL, NULL, NULL, nowDate, 256); GetDateFormat(LOCALE_INVARIANT, NULL, NULL, NULL, nowDate, 256);
@ -597,7 +622,7 @@ gfxDWriteFontList::InitFontList()
mNonExistingFonts.Clear(); mNonExistingFonts.Clear();
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t2); QueryPerformanceCounter(&t2);
} }
#endif #endif
@ -612,7 +637,7 @@ gfxDWriteFontList::InitFontList()
} }
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t3); QueryPerformanceCounter(&t3);
} }
#endif #endif
@ -624,7 +649,7 @@ gfxDWriteFontList::InitFontList()
} }
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t4); QueryPerformanceCounter(&t4);
} }
#endif #endif
@ -736,29 +761,31 @@ gfxDWriteFontList::InitFontList()
StartLoader(kDelayBeforeLoadingFonts, kIntervalBetweenLoadingFonts); StartLoader(kDelayBeforeLoadingFonts, kIntervalBetweenLoadingFonts);
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTINIT_ENABLED()) {
QueryPerformanceCounter(&t5); QueryPerformanceCounter(&t5);
// determine dwrite version // determine dwrite version
nsAutoString dwriteVers; nsAutoString dwriteVers;
gfxWindowsPlatform::GetPlatform()->GetDLLVersion(L"dwrite.dll", gfxWindowsPlatform::GetPlatform()->GetDLLVersion(L"dwrite.dll",
dwriteVers); dwriteVers);
LOG(("InitFontList\n")); LOG_FONTINIT(("InitFontList\n"));
LOG(("Start: %s %s\n", nowDate, nowTime)); LOG_FONTINIT(("Start: %s %s\n", nowDate, nowTime));
LOG(("Uptime: %9.3f s\n", upTime/1000)); LOG_FONTINIT(("Uptime: %9.3f s\n", upTime/1000));
LOG(("dwrite version: %s\n", NS_ConvertUTF16toUTF8(dwriteVers).get())); LOG_FONTINIT(("dwrite version: %s\n",
NS_ConvertUTF16toUTF8(dwriteVers).get()));
elapsedTime = (t5.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; elapsedTime = (t5.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG(("Total time in InitFontList: %9.3f ms (families: %d, %s)\n", LOG_FONTINIT((
elapsedTime, systemFonts->GetFontFamilyCount(), "Total time in InitFontList: %9.3f ms (families: %d, %s)\n",
elapsedTime, systemFonts->GetFontFamilyCount(),
(mGDIFontTableAccess ? "gdi table access" : "dwrite table access"))); (mGDIFontTableAccess ? "gdi table access" : "dwrite table access")));
elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart; elapsedTime = (t2.QuadPart - t1.QuadPart) * 1000.0 / frequency.QuadPart;
LOG((" --- gfxPlatformFontList init: %9.3f ms\n", elapsedTime)); LOG_FONTINIT((" --- gfxPlatformFontList init: %9.3f ms\n", elapsedTime));
elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart; elapsedTime = (t3.QuadPart - t2.QuadPart) * 1000.0 / frequency.QuadPart;
LOG((" --- GetSystemFontCollection: %9.3f ms\n", elapsedTime)); LOG_FONTINIT((" --- GetSystemFontCollection: %9.3f ms\n", elapsedTime));
elapsedTime = (t4.QuadPart - t3.QuadPart) * 1000.0 / frequency.QuadPart; elapsedTime = (t4.QuadPart - t3.QuadPart) * 1000.0 / frequency.QuadPart;
LOG((" --- GdiInterop object: %9.3f ms\n", elapsedTime)); LOG_FONTINIT((" --- GdiInterop object: %9.3f ms\n", elapsedTime));
elapsedTime = (t5.QuadPart - t4.QuadPart) * 1000.0 / frequency.QuadPart; elapsedTime = (t5.QuadPart - t4.QuadPart) * 1000.0 / frequency.QuadPart;
LOG((" --- iterate over families: %9.3f ms\n", elapsedTime)); LOG_FONTINIT((" --- iterate over families: %9.3f ms\n", elapsedTime));
} }
#endif #endif

View File

@ -38,6 +38,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "nsIPrefService.h" #include "nsIPrefService.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
@ -72,8 +77,6 @@ using namespace mozilla;
gfxFontCache *gfxFontCache::gGlobalCache = nsnull; gfxFontCache *gfxFontCache::gGlobalCache = nsnull;
static PRLogModuleInfo *gFontSelection = PR_NewLogModule("fontSelectionLog");
#ifdef DEBUG_roc #ifdef DEBUG_roc
#define DEBUG_TEXT_RUN_STORAGE_METRICS #define DEBUG_TEXT_RUN_STORAGE_METRICS
#endif #endif
@ -466,11 +469,6 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
// check remaining faces in order of preference to find the first that actually exists // check remaining faces in order of preference to find the first that actually exists
fe = mAvailableFonts[order[trial]]; fe = mAvailableFonts[order[trial]];
if (fe) { if (fe) {
PR_LOG(gFontSelection, PR_LOG_DEBUG,
("(FindFontForStyle) name: %s, sty: %02x, wt: %d, sz: %.1f -> %s (trial %d)\n",
NS_ConvertUTF16toUTF8(mName).get(),
aFontStyle.style, aFontStyle.weight, aFontStyle.size,
NS_ConvertUTF16toUTF8(fe->Name()).get(), trial));
aNeedsSyntheticBold = wantBold && !fe->IsBold(); aNeedsSyntheticBold = wantBold && !fe->IsBold();
return fe; return fe;
} }
@ -489,10 +487,6 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
gfxFontEntry *weightList[10] = { 0 }; gfxFontEntry *weightList[10] = { 0 };
PRBool foundWeights = FindWeightsForStyle(weightList, wantItalic, aFontStyle.stretch); PRBool foundWeights = FindWeightsForStyle(weightList, wantItalic, aFontStyle.stretch);
if (!foundWeights) { if (!foundWeights) {
PR_LOG(gFontSelection, PR_LOG_DEBUG,
("(FindFontForStyle) name: %s, sty: %02x, wt: %d, sz: %.1f -> null\n",
NS_ConvertUTF16toUTF8(mName).get(),
aFontStyle.style, aFontStyle.weight, aFontStyle.size));
return nsnull; return nsnull;
} }
@ -535,11 +529,6 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
aNeedsSyntheticBold = PR_TRUE; aNeedsSyntheticBold = PR_TRUE;
} }
PR_LOG(gFontSelection, PR_LOG_DEBUG,
("(FindFontForStyle) name: %s, sty: %02x, wt: %d, sz: %.1f -> %s\n",
NS_ConvertUTF16toUTF8(mName).get(),
aFontStyle.style, aFontStyle.weight, aFontStyle.size,
NS_ConvertUTF16toUTF8(matchFE->Name()).get()));
return matchFE; return matchFE;
} }
@ -677,6 +666,22 @@ gfxFontFamily::FindFontForChar(FontSearch *aMatchData)
if (fe->TestCharacterMap(aMatchData->mCh)) { if (fe->TestCharacterMap(aMatchData->mCh)) {
rank += 20; rank += 20;
aMatchData->mCount++;
#ifdef PR_LOGGING
PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun);
if (NS_UNLIKELY(log)) {
PRUint32 charRange = gfxFontUtils::CharRangeBit(aMatchData->mCh);
PRUint32 unicodeRange = FindCharUnicodeRange(aMatchData->mCh);
PRUint32 hbscript = gfxUnicodeProperties::GetScriptCode(aMatchData->mCh);
PR_LOG(log, PR_LOG_DEBUG,\
("(textrun-systemfallback-fonts) char: u+%6.6x "
"char-range: %d unicode-range: %d script: %d match: [%s]\n",
aMatchData->mCh,
charRange, unicodeRange, hbscript,
NS_ConvertUTF16toUTF8(fe->Name()).get()));
}
#endif
} }
// if we didn't match any characters don't bother wasting more time with this face. // if we didn't match any characters don't bother wasting more time with this face.
@ -1444,6 +1449,24 @@ gfxFont::SplitAndInitTextRun(gfxContext *aContext,
{ {
PRBool ok; PRBool ok;
#ifdef PR_LOGGING
PRLogModuleInfo *log = (mStyle.systemFont ?
gfxPlatform::GetLog(eGfxLog_textrunui) :
gfxPlatform::GetLog(eGfxLog_textrun));
if (NS_UNLIKELY(log)) {
nsCAutoString lang;
mStyle.language->ToUTF8String(lang);
PR_LOG(log, PR_LOG_DEBUG,\
("(%s-fontmatching) font: [%s] lang: %s script: %d len: %d "
"TEXTRUN [%s] ENDTEXTRUN\n",
(mStyle.systemFont ? "textrunui" : "textrun"),
NS_ConvertUTF16toUTF8(GetName()).get(),
lang.get(), aRunScript, aRunLength,
NS_ConvertUTF16toUTF8(aString + aRunStart, aRunLength).get()));
}
#endif
do { do {
// Because various shaping backends struggle with very long runs, // Because various shaping backends struggle with very long runs,
// we look for appropriate break locations (preferring whitespace), // we look for appropriate break locations (preferring whitespace),
@ -2385,9 +2408,36 @@ gfxFontGroup::InitTextRun(gfxContext *aContext,
// the font matching process below // the font matching process below
gfxScriptItemizer scriptRuns(aString, aLength); gfxScriptItemizer scriptRuns(aString, aLength);
#ifdef PR_LOGGING
PRLogModuleInfo *log = (mStyle.systemFont ?
gfxPlatform::GetLog(eGfxLog_textrunui) :
gfxPlatform::GetLog(eGfxLog_textrun));
#endif
PRUint32 runStart = 0, runLimit = aLength; PRUint32 runStart = 0, runLimit = aLength;
PRInt32 runScript = HB_SCRIPT_LATIN; PRInt32 runScript = HB_SCRIPT_LATIN;
while (scriptRuns.Next(runStart, runLimit, runScript)) { while (scriptRuns.Next(runStart, runLimit, runScript)) {
#ifdef PR_LOGGING
if (NS_UNLIKELY(log)) {
nsCAutoString lang;
mStyle.language->ToUTF8String(lang);
PRUint32 runLen = runLimit - runStart;
PR_LOG(log, PR_LOG_DEBUG,\
("(%s) fontgroup: [%s] lang: %s script: %d len %d "
"weight: %d width: %d style: %s "
"TEXTRUN [%s] ENDTEXTRUN\n",
(mStyle.systemFont ? "textrunui" : "textrun"),
NS_ConvertUTF16toUTF8(mFamilies).get(),
lang.get(), runScript, runLen,
PRUint32(mStyle.weight), PRUint32(mStyle.stretch),
(mStyle.style & FONT_STYLE_ITALIC ? "italic" :
(mStyle.style & FONT_STYLE_OBLIQUE ? "oblique" :
"normal")),
NS_ConvertUTF16toUTF8(aString + runStart, runLen).get()));
}
#endif
InitScriptRun(aContext, aTextRun, aString, aLength, InitScriptRun(aContext, aTextRun, aString, aLength,
runStart, runLimit, runScript); runStart, runLimit, runScript);
} }
@ -2454,18 +2504,6 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
// ligatures" with the wrong font. // ligatures" with the wrong font.
aTextRun->SanitizeGlyphRuns(); aTextRun->SanitizeGlyphRuns();
#ifdef DUMP_TEXT_RUNS
nsCAutoString lang;
style->language->ToUTF8String(lang);
PR_LOG(gFontSelection, PR_LOG_DEBUG,\
("InitTextRun %p fontgroup %p (%s) lang: %s len %d features: %s "
"TEXTRUN \"%s\" ENDTEXTRUN\n",
aTextRun, this,
NS_ConvertUTF16toUTF8(mFamilies).get(),
lang.get(), aLength,
NS_ConvertUTF16toUTF8(mStyle.featureSettings).get(),
NS_ConvertUTF16toUTF8(aString, aLength).get()) );
#endif
} }

View File

@ -460,12 +460,13 @@ private:
// used when picking fallback font // used when picking fallback font
struct FontSearch { struct FontSearch {
FontSearch(const PRUint32 aCharacter, gfxFont *aFont) : FontSearch(const PRUint32 aCharacter, gfxFont *aFont) :
mCh(aCharacter), mFontToMatch(aFont), mMatchRank(0) { mCh(aCharacter), mFontToMatch(aFont), mMatchRank(0), mCount(0) {
} }
const PRUint32 mCh; const PRUint32 mCh;
gfxFont* mFontToMatch; gfxFont* mFontToMatch;
PRInt32 mMatchRank; PRInt32 mMatchRank;
nsRefPtr<gfxFontEntry> mBestMatch; nsRefPtr<gfxFontEntry> mBestMatch;
PRUint32 mCount;
}; };
class gfxFontFamily { class gfxFontFamily {

View File

@ -65,10 +65,10 @@
using namespace mozilla; // for the AutoSwap_* types using namespace mozilla; // for the AutoSwap_* types
/* Unicode subrange table /* Unicode subrange table
* from: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/unicode_63ub.asp * from: http://msdn.microsoft.com/en-us/library/dd374090
* *
* Use something like: * Edit the text to extend the initial digit, then use something like:
* perl -pi -e 's/^(\d+)\s+([\dA-Fa-f]+)\s+-\s+([\dA-Fa-f]+)\s+\b(.*)/ { \1, 0x\2, 0x\3,\"\4\" },/' < unicoderanges.txt * perl -pi -e 's/^(\d+)\t([\dA-Fa-f]+)\s+-\s+([\dA-Fa-f]+)\s+\b([a-zA-Z0-9\(\)\- ]+)/ { \1, 0x\2, 0x\3, \"\4\" },/' < unicoderange.txt
* to generate the below list. * to generate the below list.
*/ */
struct UnicodeRangeTableEntry struct UnicodeRangeTableEntry
@ -79,7 +79,7 @@ struct UnicodeRangeTableEntry
const char *info; const char *info;
}; };
static const struct UnicodeRangeTableEntry gUnicodeRanges[] = { static struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 0, 0x0000, 0x007F, "Basic Latin" }, { 0, 0x0000, 0x007F, "Basic Latin" },
{ 1, 0x0080, 0x00FF, "Latin-1 Supplement" }, { 1, 0x0080, 0x00FF, "Latin-1 Supplement" },
{ 2, 0x0100, 0x017F, "Latin Extended-A" }, { 2, 0x0100, 0x017F, "Latin Extended-A" },
@ -89,18 +89,20 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 4, 0x1D80, 0x1DBF, "Phonetic Extensions Supplement" }, { 4, 0x1D80, 0x1DBF, "Phonetic Extensions Supplement" },
{ 5, 0x02B0, 0x02FF, "Spacing Modifier Letters" }, { 5, 0x02B0, 0x02FF, "Spacing Modifier Letters" },
{ 5, 0xA700, 0xA71F, "Modifier Tone Letters" }, { 5, 0xA700, 0xA71F, "Modifier Tone Letters" },
{ 6, 0x0300, 0x036F, "Spacing Modifier Letters" }, { 6, 0x0300, 0x036F, "Combining Diacritical Marks" },
{ 6, 0x1DC0, 0x1DFF, "Combining Diacritical Marks Supplement" }, { 6, 0x1DC0, 0x1DFF, "Combining Diacritical Marks Supplement" },
{ 7, 0x0370, 0x03FF, "Greek and Coptic" }, { 7, 0x0370, 0x03FF, "Greek and Coptic" },
{ 8, 0x2C80, 0x2CFF, "Coptic" }, { 8, 0x2C80, 0x2CFF, "Coptic" },
{ 9, 0x0400, 0x04FF, "Cyrillic" }, { 9, 0x0400, 0x04FF, "Cyrillic" },
{ 9, 0x0500, 0x052F, "Cyrillic Supplementary" }, { 9, 0x0500, 0x052F, "Cyrillic Supplement" },
{ 9, 0x2DE0, 0x2DFF, "Cyrillic Extended-A" },
{ 9, 0xA640, 0xA69F, "Cyrillic Extended-B" },
{ 10, 0x0530, 0x058F, "Armenian" }, { 10, 0x0530, 0x058F, "Armenian" },
{ 11, 0x0590, 0x05FF, "Basic Hebrew" }, { 11, 0x0590, 0x05FF, "Hebrew" },
/* 12 - reserved */ { 12, 0xA500, 0xA63F, "Vai" },
{ 13, 0x0600, 0x06FF, "Basic Arabic" }, { 13, 0x0600, 0x06FF, "Arabic" },
{ 13, 0x0750, 0x077F, "Arabic Supplement" }, { 13, 0x0750, 0x077F, "Arabic Supplement" },
{ 14, 0x07C0, 0x07FF, "N'Ko" }, { 14, 0x07C0, 0x07FF, "NKo" },
{ 15, 0x0900, 0x097F, "Devanagari" }, { 15, 0x0900, 0x097F, "Devanagari" },
{ 16, 0x0980, 0x09FF, "Bengali" }, { 16, 0x0980, 0x09FF, "Bengali" },
{ 17, 0x0A00, 0x0A7F, "Gurmukhi" }, { 17, 0x0A00, 0x0A7F, "Gurmukhi" },
@ -118,13 +120,14 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 28, 0x1100, 0x11FF, "Hangul Jamo" }, { 28, 0x1100, 0x11FF, "Hangul Jamo" },
{ 29, 0x1E00, 0x1EFF, "Latin Extended Additional" }, { 29, 0x1E00, 0x1EFF, "Latin Extended Additional" },
{ 29, 0x2C60, 0x2C7F, "Latin Extended-C" }, { 29, 0x2C60, 0x2C7F, "Latin Extended-C" },
{ 29, 0xA720, 0xA7FF, "Latin Extended-D" },
{ 30, 0x1F00, 0x1FFF, "Greek Extended" }, { 30, 0x1F00, 0x1FFF, "Greek Extended" },
{ 31, 0x2000, 0x206F, "General Punctuation" }, { 31, 0x2000, 0x206F, "General Punctuation" },
{ 31, 0x2E00, 0x2E7F, "Supplemental Punctuation" }, { 31, 0x2E00, 0x2E7F, "Supplemental Punctuation" },
{ 32, 0x2070, 0x209F, "Subscripts and Superscripts" }, { 32, 0x2070, 0x209F, "Superscripts And Subscripts" },
{ 33, 0x20A0, 0x20CF, "Currency Symbols" }, { 33, 0x20A0, 0x20CF, "Currency Symbols" },
{ 34, 0x20D0, 0x20FF, "Combining Diacritical Marks for Symbols" }, { 34, 0x20D0, 0x20FF, "Combining Diacritical Marks For Symbols" },
{ 35, 0x2100, 0x214F, "Letter-like Symbols" }, { 35, 0x2100, 0x214F, "Letterlike Symbols" },
{ 36, 0x2150, 0x218F, "Number Forms" }, { 36, 0x2150, 0x218F, "Number Forms" },
{ 37, 0x2190, 0x21FF, "Arrows" }, { 37, 0x2190, 0x21FF, "Arrows" },
{ 37, 0x27F0, 0x27FF, "Supplemental Arrows-A" }, { 37, 0x27F0, 0x27FF, "Supplemental Arrows-A" },
@ -143,18 +146,18 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 45, 0x25A0, 0x25FF, "Geometric Shapes" }, { 45, 0x25A0, 0x25FF, "Geometric Shapes" },
{ 46, 0x2600, 0x26FF, "Miscellaneous Symbols" }, { 46, 0x2600, 0x26FF, "Miscellaneous Symbols" },
{ 47, 0x2700, 0x27BF, "Dingbats" }, { 47, 0x2700, 0x27BF, "Dingbats" },
{ 48, 0x3000, 0x303F, "Chinese, Japanese, and Korean (CJK) Symbols and Punctuation" }, { 48, 0x3000, 0x303F, "CJK Symbols And Punctuation" },
{ 49, 0x3040, 0x309F, "Hiragana" }, { 49, 0x3040, 0x309F, "Hiragana" },
{ 50, 0x30A0, 0x30FF, "Katakana" }, { 50, 0x30A0, 0x30FF, "Katakana" },
{ 50, 0x31F0, 0x31FF, "Katakana Phonetic Extensions" }, { 50, 0x31F0, 0x31FF, "Katakana Phonetic Extensions" },
{ 51, 0x3100, 0x312F, "Bopomofo" }, { 51, 0x3100, 0x312F, "Bopomofo" },
{ 51, 0x31A0, 0x31BF, "Extended Bopomofo" }, { 50, 0x31A0, 0x31BF, "Bopomofo Extended" },
{ 52, 0x3130, 0x318F, "Hangul Compatibility Jamo" }, { 52, 0x3130, 0x318F, "Hangul Compatibility Jamo" },
{ 53, 0xA840, 0xA87F, "Phags-pa" }, { 53, 0xA840, 0xA87F, "Phags-pa" },
{ 54, 0x3200, 0x32FF, "Enclosed CJK Letters and Months" }, { 54, 0x3200, 0x32FF, "Enclosed CJK Letters And Months" },
{ 55, 0x3300, 0x33FF, "CJK Compatibility" }, { 55, 0x3300, 0x33FF, "CJK Compatibility" },
{ 56, 0xAC00, 0xD7A3, "Hangul" }, { 56, 0xAC00, 0xD7AF, "Hangul Syllables" },
{ 57, 0xD800, 0xDFFF, "Surrogates. Note that setting this bit implies that there is at least one supplementary code point beyond the Basic Multilingual Plane (BMP) that is supported by this font. See Surrogates and Supplementary Characters." }, { 57, 0xD800, 0xDFFF, "Non-Plane 0" },
{ 58, 0x10900, 0x1091F, "Phoenician" }, { 58, 0x10900, 0x1091F, "Phoenician" },
{ 59, 0x2E80, 0x2EFF, "CJK Radicals Supplement" }, { 59, 0x2E80, 0x2EFF, "CJK Radicals Supplement" },
{ 59, 0x2F00, 0x2FDF, "Kangxi Radicals" }, { 59, 0x2F00, 0x2FDF, "Kangxi Radicals" },
@ -163,18 +166,18 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 59, 0x3400, 0x4DBF, "CJK Unified Ideographs Extension A" }, { 59, 0x3400, 0x4DBF, "CJK Unified Ideographs Extension A" },
{ 59, 0x4E00, 0x9FFF, "CJK Unified Ideographs" }, { 59, 0x4E00, 0x9FFF, "CJK Unified Ideographs" },
{ 59, 0x20000, 0x2A6DF, "CJK Unified Ideographs Extension B" }, { 59, 0x20000, 0x2A6DF, "CJK Unified Ideographs Extension B" },
{ 60, 0xE000, 0xF8FF, "Private Use (Plane 0)" }, { 60, 0xE000, 0xF8FF, "Private Use Area" },
{ 61, 0x31C0, 0x31EF, "CJK Base Strokes" }, { 61, 0x31C0, 0x31EF, "CJK Strokes" },
{ 61, 0xF900, 0xFAFF, "CJK Compatibility Ideographs" }, { 61, 0xF900, 0xFAFF, "CJK Compatibility Ideographs" },
{ 61, 0x2F800, 0x2FA1F, "CJK Compatibility Ideographs Supplement" }, { 61, 0x2F800, 0x2FA1F, "CJK Compatibility Ideographs Supplement" },
{ 62, 0xFB00, 0xFB4F, "Alphabetical Presentation Forms" }, { 62, 0xFB00, 0xFB4F, "Alphabetic Presentation Forms" },
{ 63, 0xFB50, 0xFDFF, "Arabic Presentation Forms-A" }, { 63, 0xFB50, 0xFDFF, "Arabic Presentation Forms-A" },
{ 64, 0xFE20, 0xFE2F, "Combining Half Marks" }, { 64, 0xFE20, 0xFE2F, "Combining Half Marks" },
{ 65, 0xFE10, 0xFE1F, "Vertical Forms" }, { 65, 0xFE10, 0xFE1F, "Vertical Forms" },
{ 65, 0xFE30, 0xFE4F, "CJK Compatibility Forms" }, { 65, 0xFE30, 0xFE4F, "CJK Compatibility Forms" },
{ 66, 0xFE50, 0xFE6F, "Small Form Variants" }, { 66, 0xFE50, 0xFE6F, "Small Form Variants" },
{ 67, 0xFE70, 0xFEFE, "Arabic Presentation Forms-B" }, { 67, 0xFE70, 0xFEFF, "Arabic Presentation Forms-B" },
{ 68, 0xFF00, 0xFFEF, "Halfwidth and Fullwidth Forms" }, { 68, 0xFF00, 0xFFEF, "Halfwidth And Fullwidth Forms" },
{ 69, 0xFFF0, 0xFFFF, "Specials" }, { 69, 0xFFF0, 0xFFFF, "Specials" },
{ 70, 0x0F00, 0x0FFF, "Tibetan" }, { 70, 0x0F00, 0x0FFF, "Tibetan" },
{ 71, 0x0700, 0x074F, "Syriac" }, { 71, 0x0700, 0x074F, "Syriac" },
@ -185,14 +188,14 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 75, 0x1380, 0x139F, "Ethiopic Supplement" }, { 75, 0x1380, 0x139F, "Ethiopic Supplement" },
{ 75, 0x2D80, 0x2DDF, "Ethiopic Extended" }, { 75, 0x2D80, 0x2DDF, "Ethiopic Extended" },
{ 76, 0x13A0, 0x13FF, "Cherokee" }, { 76, 0x13A0, 0x13FF, "Cherokee" },
{ 77, 0x1400, 0x167F, "Canadian Aboriginal Syllabics" }, { 77, 0x1400, 0x167F, "Unified Canadian Aboriginal Syllabics" },
{ 78, 0x1680, 0x169F, "Ogham" }, { 78, 0x1680, 0x169F, "Ogham" },
{ 79, 0x16A0, 0x16FF, "Runic" }, { 79, 0x16A0, 0x16FF, "Runic" },
{ 80, 0x1780, 0x17FF, "Khmer" }, { 80, 0x1780, 0x17FF, "Khmer" },
{ 80, 0x19E0, 0x19FF, "Khmer Symbols" }, { 80, 0x19E0, 0x19FF, "Khmer Symbols" },
{ 81, 0x1800, 0x18AF, "Mongolian" }, { 81, 0x1800, 0x18AF, "Mongolian" },
{ 82, 0x2800, 0x28FF, "Braille" }, { 82, 0x2800, 0x28FF, "Braille Patterns" },
{ 83, 0xA000, 0xA48F, "Yi" }, { 83, 0xA000, 0xA48F, "Yi Syllables" },
{ 83, 0xA490, 0xA4CF, "Yi Radicals" }, { 83, 0xA490, 0xA4CF, "Yi Radicals" },
{ 84, 0x1700, 0x171F, "Tagalog" }, { 84, 0x1700, 0x171F, "Tagalog" },
{ 84, 0x1720, 0x173F, "Hanunoo" }, { 84, 0x1720, 0x173F, "Hanunoo" },
@ -200,13 +203,13 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 84, 0x1760, 0x177F, "Tagbanwa" }, { 84, 0x1760, 0x177F, "Tagbanwa" },
{ 85, 0x10300, 0x1032F, "Old Italic" }, { 85, 0x10300, 0x1032F, "Old Italic" },
{ 86, 0x10330, 0x1034F, "Gothic" }, { 86, 0x10330, 0x1034F, "Gothic" },
{ 87, 0x10440, 0x1044F, "Deseret" }, { 87, 0x10400, 0x1044F, "Deseret" },
{ 88, 0x1D000, 0x1D0FF, "Byzantine Musical Symbols" }, { 88, 0x1D000, 0x1D0FF, "Byzantine Musical Symbols" },
{ 88, 0x1D100, 0x1D1FF, "Musical Symbols" }, { 88, 0x1D100, 0x1D1FF, "Musical Symbols" },
{ 88, 0x1D200, 0x1D24F, "Ancient Greek Musical Notation" }, { 88, 0x1D200, 0x1D24F, "Ancient Greek Musical Notation" },
{ 89, 0x1D400, 0x1D7FF, "Mathematical Alphanumeric Symbols" }, { 89, 0x1D400, 0x1D7FF, "Mathematical Alphanumeric Symbols" },
{ 90, 0xFF000, 0xFFFFD, "Private Use (Plane 15)" }, { 90, 0xFF000, 0xFFFFD, "Private Use (plane 15)" },
{ 90, 0x100000, 0x10FFFD, "Private Use (Plane 16)" }, { 90, 0x100000, 0x10FFFD, "Private Use (plane 16)" },
{ 91, 0xFE00, 0xFE0F, "Variation Selectors" }, { 91, 0xFE00, 0xFE0F, "Variation Selectors" },
{ 91, 0xE0100, 0xE01EF, "Variation Selectors Supplement" }, { 91, 0xE0100, 0xE01EF, "Variation Selectors Supplement" },
{ 92, 0xE0000, 0xE007F, "Tags" }, { 92, 0xE0000, 0xE007F, "Tags" },
@ -215,7 +218,7 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 95, 0x1980, 0x19DF, "New Tai Lue" }, { 95, 0x1980, 0x19DF, "New Tai Lue" },
{ 96, 0x1A00, 0x1A1F, "Buginese" }, { 96, 0x1A00, 0x1A1F, "Buginese" },
{ 97, 0x2C00, 0x2C5F, "Glagolitic" }, { 97, 0x2C00, 0x2C5F, "Glagolitic" },
{ 98, 0x2D40, 0x2D7F, "Tifinagh" }, { 98, 0x2D30, 0x2D7F, "Tifinagh" },
{ 99, 0x4DC0, 0x4DFF, "Yijing Hexagram Symbols" }, { 99, 0x4DC0, 0x4DFF, "Yijing Hexagram Symbols" },
{ 100, 0xA800, 0xA82F, "Syloti Nagri" }, { 100, 0xA800, 0xA82F, "Syloti Nagri" },
{ 101, 0x10000, 0x1007F, "Linear B Syllabary" }, { 101, 0x10000, 0x1007F, "Linear B Syllabary" },
@ -231,7 +234,21 @@ static const struct UnicodeRangeTableEntry gUnicodeRanges[] = {
{ 109, 0x1D300, 0x1D35F, "Tai Xuan Jing Symbols" }, { 109, 0x1D300, 0x1D35F, "Tai Xuan Jing Symbols" },
{ 110, 0x12000, 0x123FF, "Cuneiform" }, { 110, 0x12000, 0x123FF, "Cuneiform" },
{ 110, 0x12400, 0x1247F, "Cuneiform Numbers and Punctuation" }, { 110, 0x12400, 0x1247F, "Cuneiform Numbers and Punctuation" },
{ 111, 0x1D360, 0x1D37F, "Counting Rod Numerals" } { 111, 0x1D360, 0x1D37F, "Counting Rod Numerals" },
{ 112, 0x1B80, 0x1BBF, "Sundanese" },
{ 113, 0x1C00, 0x1C4F, "Lepcha" },
{ 114, 0x1C50, 0x1C7F, "Ol Chiki" },
{ 115, 0xA880, 0xA8DF, "Saurashtra" },
{ 116, 0xA900, 0xA92F, "Kayah Li" },
{ 117, 0xA930, 0xA95F, "Rejang" },
{ 118, 0xAA00, 0xAA5F, "Cham" },
{ 119, 0x10190, 0x101CF, "Ancient Symbols" },
{ 120, 0x101D0, 0x101FF, "Phaistos Disc" },
{ 121, 0x10280, 0x1029F, "Lycian" },
{ 121, 0x102A0, 0x102DF, "Carian" },
{ 121, 0x10920, 0x1093F, "Lydian" },
{ 122, 0x1F000, 0x1F02F, "Mahjong Tiles" },
{ 122, 0x1F030, 0x1F09F, "Domino Tiles" }
}; };
#pragma pack(1) #pragma pack(1)

View File

@ -39,6 +39,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "gfxGDIFontList.h" #include "gfxGDIFontList.h"
#include "gfxWindowsPlatform.h" #include "gfxWindowsPlatform.h"
#include "gfxUserFontSet.h" #include "gfxUserFontSet.h"
@ -65,11 +70,13 @@
#endif #endif
#ifdef PR_LOGGING #ifdef PR_LOGGING
static PRLogModuleInfo *gFontInfoLog = PR_NewLogModule("fontInfoLog"); #define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
#endif /* PR_LOGGING */ PR_LOG_DEBUG, args)
#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \
gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG)
#define LOG(args) PR_LOG(gFontInfoLog, PR_LOG_DEBUG, args) #endif // PR_LOGGING
#define LOG_ENABLED() PR_LOG_TEST(gFontInfoLog, PR_LOG_DEBUG)
// font info loader constants // font info loader constants
@ -251,8 +258,10 @@ GDIFontEntry::ReadCMAP()
mSymbolFont = symbolFont; mSymbolFont = symbolFont;
mHasCmapTable = NS_SUCCEEDED(rv); mHasCmapTable = NS_SUCCEEDED(rv);
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontinit-cmap) psname: %s, size: %d\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(mName).get(), mCharacterMap.GetSize())); LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %d\n",
NS_ConvertUTF16toUTF8(mName).get(), mCharacterMap.GetSize()));
#endif
return rv; return rv;
} }
@ -528,8 +537,8 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
} }
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTLIST_ENABLED()) {
LOG(("(fontinit) added (%s) to family (%s)" LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
" with style: %s weight: %d stretch: %d", " with style: %s weight: %d stretch: %d",
NS_ConvertUTF16toUTF8(fe->Name()).get(), NS_ConvertUTF16toUTF8(fe->Name()).get(),
NS_ConvertUTF16toUTF8(ff->Name()).get(), NS_ConvertUTF16toUTF8(ff->Name()).get(),
@ -564,8 +573,9 @@ GDIFontFamily::FindStyleVariations()
(FONTENUMPROCW)GDIFontFamily::FamilyAddStylesProc, (FONTENUMPROCW)GDIFontFamily::FamilyAddStylesProc,
(LPARAM)this, 0); (LPARAM)this, 0);
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED() && mAvailableFonts.Length() == 0) { if (LOG_FONTLIST_ENABLED() && mAvailableFonts.Length() == 0) {
LOG(("no styles available in family \"%s\"", NS_ConvertUTF16toUTF8(mName).get())); LOG_FONTLIST(("(fontlist) no styles available in family \"%s\"",
NS_ConvertUTF16toUTF8(mName).get()));
} }
#endif #endif

View File

@ -38,6 +38,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#import <AppKit/AppKit.h> #import <AppKit/AppKit.h>
@ -121,11 +126,14 @@ static NSString* GetNSStringForString(const nsAString& aSrc)
} }
#ifdef PR_LOGGING #ifdef PR_LOGGING
static PRLogModuleInfo *gFontInfoLog = PR_NewLogModule("fontInfoLog");
#endif /* PR_LOGGING */
#define LOG(args) PR_LOG(gFontInfoLog, PR_LOG_DEBUG, args) #define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
#define LOG_ENABLED() PR_LOG_TEST(gFontInfoLog, PR_LOG_DEBUG) PR_LOG_DEBUG, args)
#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \
gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG)
#endif // PR_LOGGING
/* MacOSFontEntry */ /* MacOSFontEntry */
#pragma mark- #pragma mark-
@ -287,9 +295,11 @@ MacOSFontEntry::ReadCMAP()
} }
} }
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontinit-cmap) psname: %s, size: %d\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(mName).get(), LOG_FONTLIST(("(fontlist-cmap) name: %s, size: %d\n",
mCharacterMap.GetSize())); NS_ConvertUTF16toUTF8(mName).get(),
mCharacterMap.GetSize()));
#endif
return rv; return rv;
} }
@ -467,8 +477,8 @@ gfxMacFontFamily::FindStyleVariations()
} }
#ifdef PR_LOGGING #ifdef PR_LOGGING
if (LOG_ENABLED()) { if (LOG_FONTLIST_ENABLED()) {
LOG(("(fontinit) added (%s) to family (%s)" LOG_FONTLIST(("(fontlist) added (%s) to family (%s)"
" with style: %s weight: %d stretch: %d" " with style: %s weight: %d stretch: %d"
" (apple-weight: %d macTraits: %8.8x)", " (apple-weight: %d macTraits: %8.8x)",
NS_ConvertUTF16toUTF8(fontEntry->Name()).get(), NS_ConvertUTF16toUTF8(fontEntry->Name()).get(),
@ -636,7 +646,9 @@ gfxMacPlatformFontList::InitFontList()
return NS_OK; return NS_OK;
mATSGeneration = currentGeneration; mATSGeneration = currentGeneration;
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontinit) updating to generation: %d", mATSGeneration)); #ifdef PR_LOGGING
LOG_FONTLIST(("(fontlist) updating to generation: %d", mATSGeneration));
#endif
// reset font lists // reset font lists
gfxPlatformFontList::InitFontList(); gfxPlatformFontList::InitFontList();
@ -700,15 +712,20 @@ gfxMacPlatformFontList::InitSingleFaceList()
PRUint32 numFonts = singleFaceFonts.Length(); PRUint32 numFonts = singleFaceFonts.Length();
for (PRUint32 i = 0; i < numFonts; i++) { for (PRUint32 i = 0; i < numFonts; i++) {
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontlist-singleface) face name: %s\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(singleFaceFonts[i]).get())); LOG_FONTLIST(("(fontlist-singleface) face name: %s\n",
NS_ConvertUTF16toUTF8(singleFaceFonts[i]).get()));
#endif
gfxFontEntry *fontEntry = LookupLocalFont(nsnull, singleFaceFonts[i]); gfxFontEntry *fontEntry = LookupLocalFont(nsnull, singleFaceFonts[i]);
if (fontEntry) { if (fontEntry) {
nsAutoString familyName, key; nsAutoString familyName, key;
familyName = singleFaceFonts[i]; familyName = singleFaceFonts[i];
GenerateFontListKey(familyName, key); GenerateFontListKey(familyName, key);
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontlist-singleface) family name: %s, key: %s\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(familyName).get(), NS_ConvertUTF16toUTF8(key).get())); LOG_FONTLIST(("(fontlist-singleface) family name: %s, key: %s\n",
NS_ConvertUTF16toUTF8(familyName).get(),
NS_ConvertUTF16toUTF8(key).get()));
#endif
// add only if doesn't exist already // add only if doesn't exist already
PRBool found; PRBool found;
@ -719,8 +736,11 @@ gfxMacPlatformFontList::InitSingleFaceList()
familyEntry->SetHasStyles(PR_TRUE); familyEntry->SetHasStyles(PR_TRUE);
mFontFamilies.Put(key, familyEntry); mFontFamilies.Put(key, familyEntry);
fontEntry->mFamily = familyEntry; fontEntry->mFamily = familyEntry;
PR_LOG(gFontInfoLog, PR_LOG_DEBUG, ("(fontlist-singleface) added new family\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(familyName).get(), NS_ConvertUTF16toUTF8(key).get())); LOG_FONTLIST(("(fontlist-singleface) added new family\n",
NS_ConvertUTF16toUTF8(familyName).get(),
NS_ConvertUTF16toUTF8(key).get()));
#endif
} }
} }
} }

View File

@ -35,6 +35,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "gfxPlatform.h" #include "gfxPlatform.h"
#if defined(XP_WIN) #if defined(XP_WIN)
@ -111,6 +116,15 @@ static const char *CMForceSRGBPrefName = "gfx.color_management.force_srgb";
static void ShutdownCMS(); static void ShutdownCMS();
static void MigratePrefs(); static void MigratePrefs();
// logs shared across gfx
#ifdef PR_LOGGING
static PRLogModuleInfo *sFontlistLog = nsnull;
static PRLogModuleInfo *sFontInitLog = nsnull;
static PRLogModuleInfo *sTextrunLog = nsnull;
static PRLogModuleInfo *sTextrunuiLog = nsnull;
#endif
/* Class to listen for pref changes so that chrome code can dynamically /* Class to listen for pref changes so that chrome code can dynamically
force sRGB as an output profile. See Bug #452125. */ force sRGB as an output profile. See Bug #452125. */
class SRGBOverrideObserver : public nsIObserver, class SRGBOverrideObserver : public nsIObserver,
@ -229,6 +243,14 @@ gfxPlatform::Init()
gfxAtoms::RegisterAtoms(); gfxAtoms::RegisterAtoms();
#ifdef PR_LOGGING
sFontlistLog = PR_NewLogModule("fontlist");;
sFontInitLog = PR_NewLogModule("fontinit");;
sTextrunLog = PR_NewLogModule("textrun");;
sTextrunuiLog = PR_NewLogModule("textrunui");;
#endif
/* Initialize the GfxInfo service. /* Initialize the GfxInfo service.
* Note: we can't call functions on GfxInfo that depend * Note: we can't call functions on GfxInfo that depend
* on gPlatform until after it has been initialized * on gPlatform until after it has been initialized
@ -1246,3 +1268,31 @@ gfxPlatform::FontsPrefsChanged(nsIPrefBranch *aPrefBranch, const char *aPref)
gfxFontCache::GetCache()->AgeAllGenerations(); gfxFontCache::GetCache()->AgeAllGenerations();
} }
} }
PRLogModuleInfo*
gfxPlatform::GetLog(eGfxLog aWhichLog)
{
#ifdef PR_LOGGING
switch (aWhichLog) {
case eGfxLog_fontlist:
return sFontlistLog;
break;
case eGfxLog_fontinit:
return sFontInitLog;
break;
case eGfxLog_textrun:
return sTextrunLog;
break;
case eGfxLog_textrunui:
return sTextrunuiLog;
break;
default:
break;
}
return nsnull;
#else
return nsnull;
#endif
}

View File

@ -40,6 +40,7 @@
#define GFX_PLATFORM_H #define GFX_PLATFORM_H
#include "prtypes.h" #include "prtypes.h"
#include "prlog.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIObserver.h" #include "nsIObserver.h"
@ -118,6 +119,17 @@ enum eCMSMode {
eCMSMode_AllCount = 3 eCMSMode_AllCount = 3
}; };
enum eGfxLog {
// all font enumerations, localized names, fullname/psnames, cmap loads
eGfxLog_fontlist = 0,
// timing info on font initialization
eGfxLog_fontinit = 1,
// dump text runs, font matching, system fallback for content
eGfxLog_textrun = 2,
// dump text runs, font matching, system fallback for chrome
eGfxLog_textrunui = 3
};
// when searching through pref langs, max number of pref langs // when searching through pref langs, max number of pref langs
const PRUint32 kMaxLenPrefLangList = 32; const PRUint32 kMaxLenPrefLangList = 32;
@ -362,6 +374,11 @@ public:
virtual gfxImageFormat GetOffscreenFormat() virtual gfxImageFormat GetOffscreenFormat()
{ return gfxASurface::FormatFromContent(gfxASurface::CONTENT_COLOR); } { return gfxASurface::FormatFromContent(gfxASurface::CONTENT_COLOR); }
/**
* Returns a logger if one is available and logging is enabled
*/
static PRLogModuleInfo* GetLog(eGfxLog aWhichLog);
protected: protected:
gfxPlatform(); gfxPlatform();
virtual ~gfxPlatform(); virtual ~gfxPlatform();

View File

@ -64,6 +64,11 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "gfxPlatformFontList.h" #include "gfxPlatformFontList.h"
#include "gfxTextRunWordCache.h" #include "gfxTextRunWordCache.h"
@ -71,14 +76,23 @@
#include "nsIPrefBranch2.h" // for pref changes callback notification #include "nsIPrefBranch2.h" // for pref changes callback notification
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsUnicharUtils.h" #include "nsUnicharUtils.h"
#include "nsUnicodeRange.h"
#include "gfxUnicodeProperties.h"
// font info loader constants // font info loader constants
static const PRUint32 kDelayBeforeLoadingCmaps = 8 * 1000; // 8secs static const PRUint32 kDelayBeforeLoadingCmaps = 8 * 1000; // 8secs
static const PRUint32 kIntervalBetweenLoadingCmaps = 150; // 150ms static const PRUint32 kIntervalBetweenLoadingCmaps = 150; // 150ms
static const PRUint32 kNumFontsPerSlice = 10; // read in info 10 fonts at a time static const PRUint32 kNumFontsPerSlice = 10; // read in info 10 fonts at a time
static PRLogModuleInfo *gFontListLog = PR_NewLogModule("fontListLog"); #ifdef PR_LOGGING
#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG, args)
#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \
gfxPlatform::GetLog(eGfxLog_fontlist), \
PR_LOG_DEBUG)
#endif // PR_LOGGING
gfxPlatformFontList *gfxPlatformFontList::sPlatformFontList = nsnull; gfxPlatformFontList *gfxPlatformFontList::sPlatformFontList = nsnull;
@ -383,6 +397,25 @@ gfxPlatformFontList::FindFontForChar(const PRUint32 aCh, gfxFont *aPrevFont)
// iterate over all font families to find a font that support the character // iterate over all font families to find a font that support the character
mFontFamilies.Enumerate(gfxPlatformFontList::FindFontForCharProc, &data); mFontFamilies.Enumerate(gfxPlatformFontList::FindFontForCharProc, &data);
#ifdef PR_LOGGING
PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun);
if (NS_UNLIKELY(log)) {
PRUint32 charRange = gfxFontUtils::CharRangeBit(aCh);
PRUint32 unicodeRange = FindCharUnicodeRange(aCh);
PRUint32 hbscript = gfxUnicodeProperties::GetScriptCode(aCh);
PR_LOG(log, PR_LOG_DEBUG,\
("(textrun-systemfallback) char: u+%6.6x "
"char-range: %d unicode-range: %d script: %d match: [%s] count: %d\n",
aCh,
charRange, unicodeRange, hbscript,
(data.mBestMatch ?
NS_ConvertUTF16toUTF8(data.mBestMatch->Name()).get() :
"<none>"),
data.mCount));
}
#endif
// no match? add to set of non-matching codepoints // no match? add to set of non-matching codepoints
if (!data.mBestMatch) { if (!data.mBestMatch) {
mCodepointsWithNoFonts.set(aCh); mCodepointsWithNoFonts.set(aCh);
@ -471,9 +504,12 @@ gfxPlatformFontList::AddOtherFamilyName(gfxFontFamily *aFamilyEntry, nsAString&
if (!mOtherFamilyNames.GetWeak(key, &found)) { if (!mOtherFamilyNames.GetWeak(key, &found)) {
mOtherFamilyNames.Put(key, aFamilyEntry); mOtherFamilyNames.Put(key, aFamilyEntry);
PR_LOG(gFontListLog, PR_LOG_DEBUG, ("(fontlist-otherfamily) canonical family: %s, other family: %s\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(aFamilyEntry->Name()).get(), LOG_FONTLIST(("(fontlist-otherfamily) canonical family: %s, "
NS_ConvertUTF16toUTF8(aOtherFamilyName).get())); "other family: %s\n",
NS_ConvertUTF16toUTF8(aFamilyEntry->Name()).get(),
NS_ConvertUTF16toUTF8(aOtherFamilyName).get()));
#endif
if (mBadUnderlineFamilyNames.Contains(key)) if (mBadUnderlineFamilyNames.Contains(key))
aFamilyEntry->SetBadUnderlineFamily(); aFamilyEntry->SetBadUnderlineFamily();
} }
@ -486,9 +522,11 @@ gfxPlatformFontList::AddFullname(gfxFontEntry *aFontEntry, nsAString& aFullname)
if (!mFullnames.GetWeak(aFullname, &found)) { if (!mFullnames.GetWeak(aFullname, &found)) {
mFullnames.Put(aFullname, aFontEntry); mFullnames.Put(aFullname, aFontEntry);
PR_LOG(gFontListLog, PR_LOG_DEBUG, ("(fontlist-fullname) name: %s, fullname: %s\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(aFontEntry->Name()).get(), LOG_FONTLIST(("(fontlist-fullname) name: %s, fullname: %s\n",
NS_ConvertUTF16toUTF8(aFullname).get())); NS_ConvertUTF16toUTF8(aFontEntry->Name()).get(),
NS_ConvertUTF16toUTF8(aFullname).get()));
#endif
} }
} }
@ -499,9 +537,11 @@ gfxPlatformFontList::AddPostscriptName(gfxFontEntry *aFontEntry, nsAString& aPos
if (!mPostscriptNames.GetWeak(aPostscriptName, &found)) { if (!mPostscriptNames.GetWeak(aPostscriptName, &found)) {
mPostscriptNames.Put(aPostscriptName, aFontEntry); mPostscriptNames.Put(aPostscriptName, aFontEntry);
PR_LOG(gFontListLog, PR_LOG_DEBUG, ("(fontlist-postscript) name: %s, psname: %s\n", #ifdef PR_LOGGING
NS_ConvertUTF16toUTF8(aFontEntry->Name()).get(), LOG_FONTLIST(("(fontlist-postscript) name: %s, psname: %s\n",
NS_ConvertUTF16toUTF8(aPostscriptName).get())); NS_ConvertUTF16toUTF8(aFontEntry->Name()).get(),
NS_ConvertUTF16toUTF8(aPostscriptName).get()));
#endif
} }
} }

View File

@ -39,8 +39,6 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
//#define FORCE_PR_LOG
#include "prtypes.h" #include "prtypes.h"
#include "gfxTypes.h" #include "gfxTypes.h"
@ -58,9 +56,7 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "prlog.h"
#include "prinit.h" #include "prinit.h"
static PRLogModuleInfo *gFontLog = PR_NewLogModule("winfonts");
/********************************************************************** /**********************************************************************
* *
@ -523,7 +519,6 @@ gfxUniscribeShaper::InitTextRun(gfxContext *aContext,
rv = item.Shape(); rv = item.Shape();
if (FAILED(rv)) { if (FAILED(rv)) {
PR_LOG(gFontLog, PR_LOG_DEBUG, ("shaping failed"));
// we know we have the glyphs to display this font already // we know we have the glyphs to display this font already
// so Uniscribe just doesn't know how to shape the script. // so Uniscribe just doesn't know how to shape the script.
// Render the glyphs without shaping. // Render the glyphs without shaping.