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

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

Issue 1740593002: Use Skia's matchFamilyStyleCharacter API for font fallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 d9af8814f20745f374402948176848edc5db9597..6fe626e80cbb7bba7a58f922ee53e3a7cdc579ee 100644
--- a/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
+++ b/third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp
@@ -216,25 +216,6 @@ const Vector<AtomicString> FontCache::platformFontListForFallbackPriority(FontFa
return returnVector;
}
-#if OS(WIN)
-static inline SkFontStyle fontStyle(const FontDescription& fontDescription)
-{
- int width = static_cast<int>(fontDescription.stretch());
- int weight = (fontDescription.weight() - FontWeight100 + 1) * 100;
- SkFontStyle::Slant slant = fontDescription.style() == FontStyleItalic
- ? SkFontStyle::kItalic_Slant
- : SkFontStyle::kUpright_Slant;
- return SkFontStyle(weight, width, slant);
-}
-
-static_assert(static_cast<int>(FontStretchUltraCondensed) == static_cast<int>(SkFontStyle::kUltraCondensed_Width),
- "FontStretchUltraCondensed should map to kUltraCondensed_Width");
-static_assert(static_cast<int>(FontStretchNormal) == static_cast<int>(SkFontStyle::kNormal_Width),
- "FontStretchNormal should map to kNormal_Width");
-static_assert(static_cast<int>(FontStretchUltraExpanded) == static_cast<int>(SkFontStyle::kUltaExpanded_Width),
- "FontStretchUltraExpanded should map to kUltaExpanded_Width");
-#endif
-
PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDescription, const FontFaceCreationParams& creationParams, CString& name)
{
#if !OS(WIN) && !OS(ANDROID)
@@ -271,9 +252,8 @@ PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
if (m_fontManager) {
return adoptRef(useDirectWrite()
- ? m_fontManager->matchFamilyStyle(name.data(), fontStyle(fontDescription))
- : m_fontManager->legacyCreateTypeface(name.data(), style)
- );
+ ? m_fontManager->matchFamilyStyle(name.data(), fontDescription.skiaFontStyle())
+ : m_fontManager->legacyCreateTypeface(name.data(), style));
}
#endif

Powered by Google App Engine
This is Rietveld 408576698