Index: third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp |
diff --git a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp |
index 9709ab84022a03821ab2bd3cbefeb9721e040410..9ad92e8f34566766f581ac52b75a0f8101d4892a 100644 |
--- a/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp |
+++ b/third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp |
@@ -58,7 +58,7 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, |
// FIXME: Skia currently renders synthetic bold and italics with |
// hinting and without linear metrics on the windows GDI backend |
// while the DirectWrite backend does the right thing. Using |
- // CreateFromName and specifying the bold/italics style allows |
+ // legacyCreateTypeface and specifying the bold/italics style allows |
// for proper rendering of synthetic style. Once Skia has been |
// updated this workaround will no longer be needed. |
// http://crbug.com/332958 |
@@ -68,13 +68,12 @@ FontPlatformData FontCustomPlatformData::fontPlatformData(float size, bool bold, |
SkString name; |
m_typeface->getFamilyName(&name); |
- int style = SkTypeface::kNormal; |
- if (syntheticBold) |
- style |= SkTypeface::kBold; |
- if (syntheticItalic) |
- style |= SkTypeface::kItalic; |
- |
- RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()->legacyCreateTypeface(name.c_str(), static_cast<SkTypeface::Style>(style))); |
+ SkFontStyle realStyle = m_typeface->fontStyle(); |
+ SkFontStyle syntheticStyle = SkFontStyle( |
+ realStyle.weight() + (syntheticBold ? 200 : 0), |
+ realStyle.width(), |
+ syntheticItalic ? SkFontStyle::kItalic_Slant : realStyle.slant()); |
+ RefPtr<SkTypeface> typeface = adoptRef(FontCache::fontCache()->fontManager()->legacyCreateTypeface(name.c_str(), syntheticStyle)); |
syntheticBold = false; |
syntheticItalic = false; |
return FontPlatformData(typeface.release(), "", size, syntheticBold, syntheticItalic, orientation); |