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

Unified Diff: src/ports/SkTypeface_win_dw.h

Issue 1921903002: Add oblique as a slant. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: static_assert what can be. 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/SkRemotableFontMgr_win_dw.cpp ('k') | src/utils/win/SkDWrite.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ports/SkTypeface_win_dw.h
diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h
index b1237c0e98e48200563101fb4af7e314fad0b508..3e429f47cb351ea297425b00c274a3231213212d 100644
--- a/src/ports/SkTypeface_win_dw.h
+++ b/src/ports/SkTypeface_win_dw.h
@@ -25,13 +25,16 @@ class SkFontDescriptor;
struct SkScalerContextRec;
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);
+ int weight = font->GetWeight();
+ int width = font->GetStretch();
+ SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
+ switch (font->GetStyle()) {
+ case DWRITE_FONT_STYLE_NORMAL: slant = SkFontStyle::kUpright_Slant; break;
+ case DWRITE_FONT_STYLE_OBLIQUE: slant = SkFontStyle::kOblique_Slant; break;
+ case DWRITE_FONT_STYLE_ITALIC: slant = SkFontStyle::kItalic_Slant; break;
+ default: SkASSERT(false); break;
+ }
+ return SkFontStyle(weight, width, slant);
}
class DWriteFontTypeface : public SkTypeface {
« no previous file with comments | « src/ports/SkRemotableFontMgr_win_dw.cpp ('k') | src/utils/win/SkDWrite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698