Chromium Code Reviews| 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 |
|
drott
2016/04/13 17:36:21
FontCacheSkia has a
static inline SkFontStyle fo
|
| +{ |
| + 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 |