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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/ports/SkRemotableFontMgr_win_dw.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkDWrite_DEFINED 8 #ifndef SkDWrite_DEFINED
9 #define SkDWrite_DEFINED 9 #define SkDWrite_DEFINED
10 10
11 #include "SkTemplates.h" 11 #include "SkTemplates.h"
12 #include "SkFontStyle.h"
12 13
13 #include <dwrite.h> 14 #include <dwrite.h>
14 #include <winsdkver.h> 15 #include <winsdkver.h>
15 16
16 class SkString; 17 class SkString;
17 18
18 //////////////////////////////////////////////////////////////////////////////// 19 ////////////////////////////////////////////////////////////////////////////////
19 // Factory 20 // Factory
20 21
21 #ifndef SK_HAS_DWRITE_1_H 22 #ifndef SK_HAS_DWRITE_1_H
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 }; 74 };
74 template<typename T> class AutoTDWriteTable : public AutoDWriteTable { 75 template<typename T> class AutoTDWriteTable : public AutoDWriteTable {
75 public: 76 public:
76 static const UINT32 tag = DWRITE_MAKE_OPENTYPE_TAG(T::TAG0, T::TAG1, T::TAG2 , T::TAG3); 77 static const UINT32 tag = DWRITE_MAKE_OPENTYPE_TAG(T::TAG0, T::TAG1, T::TAG2 , T::TAG3);
77 AutoTDWriteTable(IDWriteFontFace* fontFace) : AutoDWriteTable(fontFace, tag) { } 78 AutoTDWriteTable(IDWriteFontFace* fontFace) : AutoDWriteTable(fontFace, tag) { }
78 79
79 const T* get() const { return reinterpret_cast<const T*>(fData); } 80 const T* get() const { return reinterpret_cast<const T*>(fData); }
80 const T* operator->() const { return reinterpret_cast<const T*>(fData); } 81 const T* operator->() const { return reinterpret_cast<const T*>(fData); }
81 }; 82 };
82 83
84 ////////////////////////////////////////////////////////////////////////////////
85 // Style conversion
86
87 struct DWriteStyle {
88 explicit DWriteStyle(const SkFontStyle& pattern) {
89 switch (pattern.slant()) {
90 case SkFontStyle::kUpright_Slant:
91 fSlant = DWRITE_FONT_STYLE_NORMAL;
92 break;
93 case SkFontStyle::kItalic_Slant:
94 fSlant = DWRITE_FONT_STYLE_ITALIC;
95 break;
96 default:
97 SkASSERT(false);
98 }
99
100 fWeight = (DWRITE_FONT_WEIGHT)pattern.weight();
101 fWidth = (DWRITE_FONT_STRETCH)pattern.width();
102 }
103 DWRITE_FONT_STYLE fSlant;
104 DWRITE_FONT_WEIGHT fWeight;
105 DWRITE_FONT_STRETCH fWidth;
106 };
107
83 #endif 108 #endif
OLDNEW
« 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