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

Unified Diff: src/ports/SkFontHost_win.cpp

Issue 1873923002: Begin switch to SkFontStyle for legacy calls. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Dont update bzl file now. 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 | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkFontHost_win.cpp
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 395307cf043c714729fa25b286acf475c896b939..9ded4f5f5393bfc4828524f02bfd7a35c321e154 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2501,8 +2501,12 @@ protected:
return this->createFromStream(SkStream::NewFromFile(path));
}
- virtual SkTypeface* onLegacyCreateTypeface(const char familyName[],
- unsigned styleBits) const override {
+#ifdef SK_VERY_LEGACY_CREATE_TYPEFACE
+ SkTypeface* onLegacyCreateTypeface(const char familyName[], unsigned styleBits) const override {
+ SkFontStyle style = SkFontStyle::FromOldStyle(styleBits);
+#else
+ SkTypeface* onLegacyCreateTypeface(const char familyName[], SkFontStyle style) const override {
+#endif
LOGFONT lf;
if (nullptr == familyName) {
lf = get_default_font();
@@ -2510,9 +2514,8 @@ protected:
logfont_for_name(familyName, &lf);
}
- SkTypeface::Style style = (SkTypeface::Style)styleBits;
- lf.lfWeight = (style & SkTypeface::kBold) != 0 ? FW_BOLD : FW_NORMAL;
- lf.lfItalic = ((style & SkTypeface::kItalic) != 0);
+ lf.lfWeight = style.weight();
+ lf.lfItalic = style.isItalic() ? TRUE : FALSE;
return SkCreateTypefaceFromLOGFONT(lf);
}
« no previous file with comments | « src/ports/SkFontHost_mac.cpp ('k') | src/ports/SkFontMgr_android.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698