| 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" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 uint32_t glyphIDsCount) const { | 149 uint32_t glyphIDsCount) const { |
| 150 // pdf only | 150 // pdf only |
| 151 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; | 151 SkAdvancedTypefaceMetrics* info = new SkAdvancedTypefaceMetrics; |
| 152 info->fFontName.set(fTestFont->fName); | 152 info->fFontName.set(fTestFont->fName); |
| 153 info->fLastGlyphID = SkToU16(onCountGlyphs() - 1); | 153 info->fLastGlyphID = SkToU16(onCountGlyphs() - 1); |
| 154 return info; | 154 return info; |
| 155 } | 155 } |
| 156 | 156 |
| 157 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal)
const { | 157 void SkTestTypeface::onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal)
const { |
| 158 desc->setFamilyName(fTestFont->fName); | 158 desc->setFamilyName(fTestFont->fName); |
| 159 desc->setStyle(this->fontStyle()); | |
| 160 *isLocal = false; | 159 *isLocal = false; |
| 161 } | 160 } |
| 162 | 161 |
| 163 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, | 162 int SkTestTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, |
| 164 uint16_t glyphs[], int glyphCount) const { | 163 uint16_t glyphs[], int glyphCount) const { |
| 165 SkASSERT(encoding == kUTF16_Encoding); | 164 SkASSERT(encoding == kUTF16_Encoding); |
| 166 for (int index = 0; index < glyphCount; ++index) { | 165 for (int index = 0; index < glyphCount; ++index) { |
| 167 SkUnichar ch = ((SkUnichar*) chars)[index]; | 166 SkUnichar ch = ((SkUnichar*) chars)[index]; |
| 168 glyphs[index] = fTestFont->codeToIndex(ch); | 167 glyphs[index] = fTestFont->codeToIndex(ch); |
| 169 } | 168 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 | 281 |
| 283 private: | 282 private: |
| 284 SkTestTypeface* fFace; | 283 SkTestTypeface* fFace; |
| 285 SkMatrix fMatrix; | 284 SkMatrix fMatrix; |
| 286 }; | 285 }; |
| 287 | 286 |
| 288 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffe
cts& effects, | 287 SkScalerContext* SkTestTypeface::onCreateScalerContext(const SkScalerContextEffe
cts& effects, |
| 289 const SkDescriptor* desc)
const { | 288 const SkDescriptor* desc)
const { |
| 290 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, d
esc); | 289 return new SkTestScalerContext(const_cast<SkTestTypeface*>(this), effects, d
esc); |
| 291 } | 290 } |
| OLD | NEW |