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

Unified Diff: src/utils/win/SkDWrite.h

Issue 946603002: Implement onMatchFamilyStyleCharacter for DirectWrite. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Line length. Created 5 years, 10 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') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/ports/SkRemotableFontMgr_win_dw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698