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

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: Merge Created 4 years, 9 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 ee19f799bb01ac5ca8cd3efab671b28427bb84d3..cde54996f91e78b47033a4320ff8b9765813cfd4 100644
--- a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
@@ -278,4 +278,22 @@ unsigned FontDescription::styleHashWithoutFamilyList() const
return hash;
}
+SkFontStyle FontDescription::skiaFontStyle() const
+{
+ int width = static_cast<int>(stretch());
+ SkFontStyle::Slant slant = style() == FontStyleItalic
+ ? SkFontStyle::kItalic_Slant
+ : SkFontStyle::kUpright_Slant;
+ return SkFontStyle(numericFontWeight(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");
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/FontDescription.h ('k') | third_party/WebKit/Source/platform/fonts/FontTraits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698