Bug 1171357 - log font matching for textruns. r=m_kato
☠☠ backed out by b3649fd5cd7a ☠ ☠
authorJohn Daggett <jdaggett@mozilla.com>
Thu, 04 Jun 2015 23:24:55 +0900
changeset 247151 7d0d8d304cd871f657effcc2d21d4eae5155fd1b
parent 247150 d1f7a6e2653dfd838f7fce560ac4ed16561fd1d8
child 247152 b3649fd5cd7a76506d2cf04f45e39cbc972fb553
push id60617
push userjdaggett@mozilla.com
push dateThu, 04 Jun 2015 14:26:29 +0000
treeherdermozilla-inbound@7d0d8d304cd8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersm_kato
bugs1171357
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1171357 - log font matching for textruns. r=m_kato
gfx/thebes/gfxTextRun.cpp
--- a/gfx/thebes/gfxTextRun.cpp
+++ b/gfx/thebes/gfxTextRun.cpp
@@ -2981,26 +2981,53 @@ void gfxFontGroup::ComputeRanges(nsTArra
                     prevFont = font;
                 }
             }
         }
     }
 
     aRanges[lastRangeIndex].end = aLength;
 
-#if 0
-    // dump out font matching info
-    if (mStyle.systemFont) return;
-    for (size_t i = 0, i_end = aRanges.Length(); i < i_end; i++) {
-        const gfxTextRange& r = aRanges[i];
-        printf("fontmatch %zd:%zd font: %s (%d)\n",
-               r.start, r.end,
-               (r.font.get() ?
-                    NS_ConvertUTF16toUTF8(r.font->GetName()).get() : "<null>"),
-               r.matchType);
+#ifndef RELEASE_BUILD
+    PRLogModuleInfo *log = (mStyle.systemFont ?
+                            gfxPlatform::GetLog(eGfxLog_textrunui) :
+                            gfxPlatform::GetLog(eGfxLog_textrun));
+
+    if (MOZ_UNLIKELY(PR_LOG_TEST(log, PR_LOG_DEBUG))) {
+        nsAutoCString lang;
+        mStyle.language->ToUTF8String(lang);
+        nsAutoString families;
+        mFamilyList.ToString(families);
+
+        // collect the font matched for each range
+        nsAutoCString fontMatches;
+        for (size_t i = 0, i_end = aRanges.Length(); i < i_end; i++) {
+            char match[256];
+            const gfxTextRange& r = aRanges[i];
+            sprintf(match, " [%u:%u] %.200s (%s)",
+                    r.start, r.end,
+                    (r.font.get() ?
+                     NS_ConvertUTF16toUTF8(r.font->GetName()).get() : "<null>"),
+                    (r.matchType == gfxTextRange::kFontGroup ?
+                         "list" :
+                         (r.matchType == gfxTextRange::kPrefsFallback) ?
+                              "prefs" : "sys"));
+            fontMatches.Append(match);
+        }
+        MOZ_LOG(log, PR_LOG_DEBUG,\
+               ("(%s-fontmatching) fontgroup: [%s] default: %s lang: %s script: %d"
+                "%s\n",
+                (mStyle.systemFont ? "textrunui" : "textrun"),
+                NS_ConvertUTF16toUTF8(families).get(),
+                (mFamilyList.GetDefaultFontType() == eFamily_serif ?
+                 "serif" :
+                 (mFamilyList.GetDefaultFontType() == eFamily_sans_serif ?
+                  "sans-serif" : "none")),
+                lang.get(), aRunScript,
+                fontMatches.get()));
     }
 #endif
 }
 
 gfxUserFontSet*
 gfxFontGroup::GetUserFontSet()
 {
     return mUserFontSet;