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

Side by Side Diff: src/utils/win/SkDWrite.h

Issue 1921903002: Add oblique as a slant. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase and add test. Created 4 years, 7 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
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
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 const T* get() const { return reinterpret_cast<const T*>(fData); } 84 const T* get() const { return reinterpret_cast<const T*>(fData); }
85 const T* operator->() const { return reinterpret_cast<const T*>(fData); } 85 const T* operator->() const { return reinterpret_cast<const T*>(fData); }
86 }; 86 };
87 87
88 //////////////////////////////////////////////////////////////////////////////// 88 ////////////////////////////////////////////////////////////////////////////////
89 // Style conversion 89 // Style conversion
90 90
91 struct DWriteStyle { 91 struct DWriteStyle {
92 explicit DWriteStyle(const SkFontStyle& pattern) { 92 explicit DWriteStyle(const SkFontStyle& pattern) {
93 switch (pattern.slant()) {
94 case SkFontStyle::kUpright_Slant:
95 fSlant = DWRITE_FONT_STYLE_NORMAL;
96 break;
97 case SkFontStyle::kItalic_Slant:
98 fSlant = DWRITE_FONT_STYLE_ITALIC;
99 break;
100 default:
101 SkASSERT(false);
102 }
103
104 fWeight = (DWRITE_FONT_WEIGHT)pattern.weight(); 93 fWeight = (DWRITE_FONT_WEIGHT)pattern.weight();
105 fWidth = (DWRITE_FONT_STRETCH)pattern.width(); 94 fWidth = (DWRITE_FONT_STRETCH)pattern.width();
95 switch (pattern.slant()) {
96 case SkFontStyle::kUpright_Slant: fSlant = DWRITE_FONT_STYLE_NORMAL ; break;
97 case SkFontStyle::kItalic_Slant: fSlant = DWRITE_FONT_STYLE_ITALIC ; break;
98 case SkFontStyle::kOblique_Slant: fSlant = DWRITE_FONT_STYLE_OBLIQUE ; break;
99 default: SkASSERT(false); break;
100 }
106 } 101 }
107 DWRITE_FONT_STYLE fSlant;
108 DWRITE_FONT_WEIGHT fWeight; 102 DWRITE_FONT_WEIGHT fWeight;
109 DWRITE_FONT_STRETCH fWidth; 103 DWRITE_FONT_STRETCH fWidth;
104 DWRITE_FONT_STYLE fSlant;
110 }; 105 };
111 106
112 #endif 107 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698