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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontCustomPlatformData.cpp

Issue 1877673002: Move legacyCreateTypeface to SkFontStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove DEPS change now that Skia change has landed. Created 4 years, 8 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
« no previous file with comments | « skia/ext/skia_utils_base.cc ('k') | third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « skia/ext/skia_utils_base.cc ('k') | third_party/WebKit/Source/platform/fonts/skia/FontCacheSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698