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

Unified Diff: third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp

Issue 2137483004: Enable "system-ui" generic font family (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor and cleanup Created 4 years, 2 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
Index: third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
index 16678e70b19b88a6feb4f67e57f32b195d9e5e93..92442840161d800d53c25cdad1d733881de670ba 100644
--- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
+++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
@@ -229,21 +229,33 @@ sk_sp<SkTypeface> FontCache::createTypeface(
}
#endif
+#if OS(WIN)
+ DCHECK_NE(family, FontFamilyNames::system_ui);
+ const char* familyNameForSkia = name.data();
+#else
+ // When the system UI font is localized, "system-ui" should have
+ // been replaced to the localied name. Use the Skia default family
drott 2016/10/12 11:01:59 Can you add some explanations where was it replace
kojii 2016/10/12 11:14:52 FontCacheLinux already has setSystemFontFamily() i
+ // if it is not localized by using nullptr.
+ const char* familyNameForSkia =
+ family == FontFamilyNames::system_ui ? nullptr : name.data();
+#endif
+
#if OS(LINUX) || OS(WIN)
// On linux if the fontManager has been overridden then we should be calling
// the embedder provided font Manager rather than calling
// SkTypeface::CreateFromName which may redirect the call to the default font
// Manager. On Windows the font manager is always present.
- if (m_fontManager)
+ if (m_fontManager) {
return sk_sp<SkTypeface>(m_fontManager->matchFamilyStyle(
- name.data(), fontDescription.skiaFontStyle()));
+ familyNameForSkia, fontDescription.skiaFontStyle()));
+ }
#endif
// FIXME: Use m_fontManager, matchFamilyStyle instead of
// legacyCreateTypeface on all platforms.
sk_sp<SkFontMgr> fm(SkFontMgr::RefDefault());
- return sk_sp<SkTypeface>(
- fm->legacyCreateTypeface(name.data(), fontDescription.skiaFontStyle()));
+ return sk_sp<SkTypeface>(fm->legacyCreateTypeface(
+ familyNameForSkia, fontDescription.skiaFontStyle()));
}
#if !OS(WIN)

Powered by Google App Engine
This is Rietveld 408576698