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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontDescription.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/FontDescription.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
index 2008681e0ccd0973e5bae08faa3d38b697a41d62..0b221694ef79984a4ac34d938a60b6a846d30be9 100644
--- a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
@@ -278,4 +278,20 @@ unsigned FontDescription::styleHashWithoutFamilyList() const
return hash;
}
+SkFontStyle FontDescription::skiaFontStyle() const
+{
+ int width = static_cast<int>(stretch());
+ int fontWeight = (weight() - FontWeight100 + 1) * 100;
eae 2016/02/29 23:11:26 We might want to add a helper for this. numericFon
Ilya Kulshin 2016/03/01 03:31:14 Done. Added a helper, although perhaps the actual
+ SkFontStyle::Slant slant = style() == FontStyleItalic
+ ? SkFontStyle::kItalic_Slant
+ : SkFontStyle::kUpright_Slant;
+ return SkFontStyle(fontWeight, 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");
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698