| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |