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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkDescriptor.h" | 10 #include "SkDescriptor.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, | 168 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, |
169 uint16_t glyphs[], int glyphCount) const { | 169 uint16_t glyphs[], int glyphCount) const { |
170 SkASSERT(encoding == kUTF16_Encoding); | 170 SkASSERT(encoding == kUTF16_Encoding); |
171 for (int index = 0; index < glyphCount; ++index) { | 171 for (int index = 0; index < glyphCount; ++index) { |
172 SkUnichar ch = ((SkUnichar*) chars)[index]; | 172 SkUnichar ch = ((SkUnichar*) chars)[index]; |
173 glyphs[index] = fTestFont->codeToIndex(ch); | 173 glyphs[index] = fTestFont->codeToIndex(ch); |
174 } | 174 } |
175 return glyphCount; | 175 return glyphCount; |
176 } | 176 } |
177 | 177 |
| 178 void SkTestTypeface::onGetFamilyName(SkString* familyName) const { |
| 179 *familyName = fTestFont->fName; |
| 180 } |
| 181 |
178 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const
{ | 182 SkTypeface::LocalizedStrings* SkTestTypeface::onCreateFamilyNameIterator() const
{ |
179 SkString familyName(fTestFont->fName); | 183 SkString familyName(fTestFont->fName); |
180 SkString language("und"); //undetermined | 184 SkString language("und"); //undetermined |
181 SkASSERT(0); // incomplete | 185 SkASSERT(0); // incomplete |
182 return NULL; | 186 return NULL; |
183 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language); | 187 // return new SkOTUtils::LocalizedStrings_SingleName(familyName, language); |
184 } | 188 } |
185 | 189 |
186 class SkTestScalerContext : public SkScalerContext { | 190 class SkTestScalerContext : public SkScalerContext { |
187 public: | 191 public: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 } | 288 } |
285 | 289 |
286 private: | 290 private: |
287 SkTestTypeface* fFace; | 291 SkTestTypeface* fFace; |
288 SkMatrix fMatrix; | 292 SkMatrix fMatrix; |
289 }; | 293 }; |
290 | 294 |
291 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { | 295 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkDescriptor* desc)
const { |
292 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d
esc)); | 296 return SkNEW_ARGS(SkTestScalerContext, (const_cast<SkTestTypeface*>(this), d
esc)); |
293 } | 297 } |
OLD | NEW |