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); |
} |