Index: src/utils/win/SkDWrite.h |
diff --git a/src/utils/win/SkDWrite.h b/src/utils/win/SkDWrite.h |
index 5b566730e5db6a24ecd6eda4a2bcdcc80d471c82..1716b837856006195af0f34fd31fd84884aae695 100644 |
--- a/src/utils/win/SkDWrite.h |
+++ b/src/utils/win/SkDWrite.h |
@@ -9,6 +9,7 @@ |
#define SkDWrite_DEFINED |
#include "SkTemplates.h" |
+#include "SkFontStyle.h" |
#include <dwrite.h> |
#include <winsdkver.h> |
@@ -80,4 +81,28 @@ public: |
const T* operator->() const { return reinterpret_cast<const T*>(fData); } |
}; |
+//////////////////////////////////////////////////////////////////////////////// |
+// Style conversion |
+ |
+struct DWriteStyle { |
+ explicit DWriteStyle(const SkFontStyle& pattern) { |
+ switch (pattern.slant()) { |
+ case SkFontStyle::kUpright_Slant: |
+ fSlant = DWRITE_FONT_STYLE_NORMAL; |
+ break; |
+ case SkFontStyle::kItalic_Slant: |
+ fSlant = DWRITE_FONT_STYLE_ITALIC; |
+ break; |
+ default: |
+ SkASSERT(false); |
+ } |
+ |
+ fWeight = (DWRITE_FONT_WEIGHT)pattern.weight(); |
+ fWidth = (DWRITE_FONT_STRETCH)pattern.width(); |
+ } |
+ DWRITE_FONT_STYLE fSlant; |
+ DWRITE_FONT_WEIGHT fWeight; |
+ DWRITE_FONT_STRETCH fWidth; |
+}; |
+ |
#endif |