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

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: Updated comments 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..c427d7823609a5c1e8afa69d274c1d9498604a54 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)
drott 2016/10/13 07:59:35 Okay, thanks for your explanations in the other pa
kojii 2016/10/13 09:03:20 Done in Blink. Sorry touching UI in browser is too
drott 2016/10/13 12:36:13 I'm reluctant to fallback to Skia's default font n
kojii 2016/10/13 13:37:59 Not only it's a lot of work for me, but also I don
drott 2016/10/13 16:45:13 In the document you're saying: "ResourceBundle::G
kojii 2016/10/14 04:40:19 Can you elaborate your question more? On Linux, th
drott 2016/10/14 07:34:21 The phrasing in the document sounds to me like Ski
+ DCHECK_NE(family, FontFamilyNames::system_ui);
+ const char* familyNameForSkia = name.data();
+#else
+ // When the system UI font is set by setSystemFontFamily(), "system-ui" should
+ // have been replaced to it in getFontPlatformData. Use the Skia default
+ // family if it is not set, to be consistent with our UI/menu rendering.
+ 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