Index: src/ports/SkTypeface_win_dw.h |
diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h |
index 531dc51a1179b907acbbd098bf04e31bcdb0e55c..7d72dfd4d649233490214a23d5929d99100b6929 100644 |
--- a/src/ports/SkTypeface_win_dw.h |
+++ b/src/ports/SkTypeface_win_dw.h |
@@ -24,22 +24,19 @@ |
class SkFontDescriptor; |
struct SkScalerContextRec; |
-static SkTypeface::Style get_style(IDWriteFont* font) { |
- int style = SkTypeface::kNormal; |
- DWRITE_FONT_WEIGHT weight = font->GetWeight(); |
- if (DWRITE_FONT_WEIGHT_DEMI_BOLD <= weight) { |
- style |= SkTypeface::kBold; |
- } |
- DWRITE_FONT_STYLE angle = font->GetStyle(); |
- if (DWRITE_FONT_STYLE_OBLIQUE == angle || DWRITE_FONT_STYLE_ITALIC == angle) { |
- style |= SkTypeface::kItalic; |
- } |
- return static_cast<SkTypeface::Style>(style); |
+static SkFontStyle get_style(IDWriteFont* font) { |
+ DWRITE_FONT_STYLE dwStyle = font->GetStyle(); |
+ return SkFontStyle(font->GetWeight(), |
+ font->GetStretch(), |
+ (DWRITE_FONT_STYLE_OBLIQUE == dwStyle || |
+ DWRITE_FONT_STYLE_ITALIC == dwStyle) |
+ ? SkFontStyle::kItalic_Slant |
+ : SkFontStyle::kUpright_Slant); |
} |
class DWriteFontTypeface : public SkTypeface { |
private: |
- DWriteFontTypeface(SkTypeface::Style style, SkFontID fontID, |
+ DWriteFontTypeface(const SkFontStyle& style, SkFontID fontID, |
IDWriteFactory* factory, |
IDWriteFontFace* fontFace, |
IDWriteFont* font, |
@@ -80,9 +77,8 @@ public: |
IDWriteFontFamily* fontFamily, |
IDWriteFontFileLoader* fontFileLoader = NULL, |
IDWriteFontCollectionLoader* fontCollectionLoader = NULL) { |
- SkTypeface::Style style = get_style(font); |
SkFontID fontID = SkTypefaceCache::NewFontID(); |
- return SkNEW_ARGS(DWriteFontTypeface, (style, fontID, |
+ return SkNEW_ARGS(DWriteFontTypeface, (get_style(font), fontID, |
factory, fontFace, font, fontFamily, |
fontFileLoader, fontCollectionLoader)); |
} |