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 #include "SkAdvancedTypefaceMetrics.h" | 8 #include "SkAdvancedTypefaceMetrics.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "SkDescriptor.h" | 11 #include "SkDescriptor.h" |
12 #include "SkFontDescriptor.h" | 12 #include "SkFontDescriptor.h" |
13 #include "SkGlyph.h" | 13 #include "SkGlyph.h" |
14 #include "SkMask.h" | 14 #include "SkMask.h" |
15 // #include "SkOTUtils.h" | 15 // #include "SkOTUtils.h" |
16 #include "SkScalerContext.h" | 16 #include "SkScalerContext.h" |
17 #include "SkTestScalerContext.h" | 17 #include "SkTestScalerContext.h" |
18 #include "SkTypefaceCache.h" | 18 #include "SkTypefaceCache.h" |
19 | 19 |
20 SkTestFont::SkTestFont(const SkTestFontData& fontData) | 20 SkTestFont::SkTestFont(const SkTestFontData& fontData) |
21 : INHERITED() | 21 : INHERITED() |
22 , fCharCodes(fontData.fCharCodes) | 22 , fCharCodes(fontData.fCharCodes) |
23 , fCharCodesCount(fontData.fCharCodesCount) | 23 , fCharCodesCount(fontData.fCharCodesCount) |
24 , fWidths(fontData.fWidths) | 24 , fWidths(fontData.fWidths) |
25 , fMetrics(fontData.fMetrics) | 25 , fMetrics(fontData.fMetrics) |
26 , fName(fontData.fName) | 26 , fName(fontData.fName) |
27 , fPaths(NULL) | 27 , fPaths(nullptr) |
28 { | 28 { |
29 init(fontData.fPoints, fontData.fVerbs); | 29 init(fontData.fPoints, fontData.fVerbs); |
30 #ifdef SK_DEBUG | 30 #ifdef SK_DEBUG |
31 sk_bzero(fDebugBits, sizeof(fDebugBits)); | 31 sk_bzero(fDebugBits, sizeof(fDebugBits)); |
32 sk_bzero(fDebugOverage, sizeof(fDebugOverage)); | 32 sk_bzero(fDebugOverage, sizeof(fDebugOverage)); |
33 #endif | 33 #endif |
34 } | 34 } |
35 | 35 |
36 SkTestFont::~SkTestFont() { | 36 SkTestFont::~SkTestFont() { |
37 for (unsigned index = 0; index < fCharCodesCount; ++index) { | 37 for (unsigned index = 0; index < fCharCodesCount; ++index) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 void SkTestTypeface::onGetFamilyName(SkString* familyName) const { | 168 void SkTestTypeface::onGetFamilyName(SkString* familyName) const { |
169 *familyName = fTestFont->fName; | 169 *familyName = fTestFont->fName; |
170 } | 170 } |
171 | 171 |
172 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const
{ | 172 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const
{ |
173 SkString familyName(fTestFont->fName); | 173 SkString familyName(fTestFont->fName); |
174 SkString language("und"); //undetermined | 174 SkString language("und"); //undetermined |
175 SkASSERT(0); // incomplete | 175 SkASSERT(0); // incomplete |
176 return NULL; | 176 return nullptr; |
177 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language); | 177 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language); |
178 } | 178 } |
179 | 179 |
180 class SkTestScalerContext : public SkScalerContext { | 180 class SkTestScalerContext : public SkScalerContext { |
181 public: | 181 public: |
182 SkTestScalerContext(SkTestTypeface* face, const SkDescriptor* desc) | 182 SkTestScalerContext(SkTestTypeface* face, const SkDescriptor* desc) |
183 : SkScalerContext(face, desc) | 183 : SkScalerContext(face, desc) |
184 , fFace(face) | 184 , fFace(face) |
185 { | 185 { |
186 fRec.getSingleMatrix(&fMatrix); | 186 fRec.getSingleMatrix(&fMatrix); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 private: | 277 private: |
278 SkTestTypeface* fFace; | 278 SkTestTypeface* fFace; |
279 SkMatrix fMatrix; | 279 SkMatrix fMatrix; |
280 }; | 280 }; |
281 | 281 |
282 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { | 282 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { |
283 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc); | 283 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), desc); |
284 } | 284 } |
OLD | NEW |