Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1467)

Unified Diff: Source/platform/fonts/win/FontCacheSkiaWin.cpp

Issue 790733005: Blink side of the change to pass the system font metrics from the browser to the renderer on Windo… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Address review comments Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/fonts/FontCache.h ('k') | Source/web/win/WebFontRendering.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/fonts/win/FontCacheSkiaWin.cpp
diff --git a/Source/platform/fonts/win/FontCacheSkiaWin.cpp b/Source/platform/fonts/win/FontCacheSkiaWin.cpp
index 47d376c1709a37c52d94fdb39a662eb639efb807..896e7d1c7d103af31eeb06a82b7d1786ee8d0d14 100644
--- a/Source/platform/fonts/win/FontCacheSkiaWin.cpp
+++ b/Source/platform/fonts/win/FontCacheSkiaWin.cpp
@@ -45,6 +45,25 @@ namespace blink {
HashMap<String, RefPtr<SkTypeface> >* FontCache::s_sideloadedFonts = 0;
+// Cached system font metrics.
+AtomicString* FontCache::s_menuFontFamilyName = 0;
+int32_t FontCache::s_menuFontHeight = 0;
+AtomicString* FontCache::s_smallCaptionFontFamilyName = 0;
+int32_t FontCache::s_smallCaptionFontHeight = 0;
+AtomicString* FontCache::s_statusFontFamilyName = 0;
+int32_t FontCache::s_statusFontHeight = 0;
+
+namespace {
+
+int32_t ensureMinimumFontHeightIfNeeded(int32_t fontHeight)
+{
+ // Adjustment for codepage 936 to make the fonts more legible in Simplified Chinese.
+ // Please refer to RenderThemeChromiumFontProviderWin.cpp for more information.
+ return (fontHeight < 12.0f) && (GetACP() == 936) ? 12.0f : fontHeight;
+}
+
+} // namespace
+
// static
void FontCache::addSideloadedFontForTesting(SkTypeface* typeface)
{
@@ -55,6 +74,27 @@ void FontCache::addSideloadedFontForTesting(SkTypeface* typeface)
s_sideloadedFonts->set(name.c_str(), adoptRef(typeface));
}
+// static
+void FontCache::setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight)
+{
+ s_menuFontFamilyName = new AtomicString(familyName);
+ s_menuFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight);
+}
+
+// static
+void FontCache::setSmallCaptionFontMetrics(const wchar_t* familyName, int32_t fontHeight)
+{
+ s_smallCaptionFontFamilyName = new AtomicString(familyName);
+ s_smallCaptionFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight);
+}
+
+// static
+void FontCache::setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeight)
+{
+ s_statusFontFamilyName = new AtomicString(familyName);
+ s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight);
+}
+
FontCache::FontCache()
: m_purgePreventCount(0)
{
« no previous file with comments | « Source/platform/fonts/FontCache.h ('k') | Source/web/win/WebFontRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698