| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
| 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 "SkEndian.h" | 9 #include "SkEndian.h" |
| 10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 sk_bzero(glyphs, glyphCount * sizeof(glyphs[0])); | 60 sk_bzero(glyphs, glyphCount * sizeof(glyphs[0])); |
| 61 } | 61 } |
| 62 return 0; | 62 return 0; |
| 63 } | 63 } |
| 64 virtual int onCountGlyphs() const SK_OVERRIDE { return 0; }; | 64 virtual int onCountGlyphs() const SK_OVERRIDE { return 0; }; |
| 65 virtual int onGetUPEM() const SK_OVERRIDE { return 0; }; | 65 virtual int onGetUPEM() const SK_OVERRIDE { return 0; }; |
| 66 class EmptyLocalizedStrings : public SkTypeface::LocalizedStrings { | 66 class EmptyLocalizedStrings : public SkTypeface::LocalizedStrings { |
| 67 public: | 67 public: |
| 68 virtual bool next(SkTypeface::LocalizedString*) SK_OVERRIDE { return fal
se; } | 68 virtual bool next(SkTypeface::LocalizedString*) SK_OVERRIDE { return fal
se; } |
| 69 }; | 69 }; |
| 70 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { |
| 71 familyName->reset(); |
| 72 } |
| 70 virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_
OVERRIDE { | 73 virtual SkTypeface::LocalizedStrings* onCreateFamilyNameIterator() const SK_
OVERRIDE { |
| 71 return SkNEW(EmptyLocalizedStrings); | 74 return SkNEW(EmptyLocalizedStrings); |
| 72 }; | 75 }; |
| 73 virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE { return
0; } | 76 virtual int onGetTableTags(SkFontTableTag tags[]) const SK_OVERRIDE { return
0; } |
| 74 virtual size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const S
K_OVERRIDE { | 77 virtual size_t onGetTableData(SkFontTableTag, size_t, size_t, void*) const S
K_OVERRIDE { |
| 75 return 0; | 78 return 0; |
| 76 } | 79 } |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); | 82 SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 SkASSERT(NULL == adjustments); | 269 SkASSERT(NULL == adjustments); |
| 267 } | 270 } |
| 268 return this->onGetKerningPairAdjustments(glyphs, count, adjustments); | 271 return this->onGetKerningPairAdjustments(glyphs, count, adjustments); |
| 269 } | 272 } |
| 270 | 273 |
| 271 SkTypeface::LocalizedStrings* SkTypeface::createFamilyNameIterator() const { | 274 SkTypeface::LocalizedStrings* SkTypeface::createFamilyNameIterator() const { |
| 272 return this->onCreateFamilyNameIterator(); | 275 return this->onCreateFamilyNameIterator(); |
| 273 } | 276 } |
| 274 | 277 |
| 275 void SkTypeface::getFamilyName(SkString* name) const { | 278 void SkTypeface::getFamilyName(SkString* name) const { |
| 276 bool isLocal = false; | 279 SkASSERT(name); |
| 277 SkFontDescriptor desc(this->style()); | 280 this->onGetFamilyName(name); |
| 278 this->onGetFontDescriptor(&desc, &isLocal); | |
| 279 name->set(desc.getFamilyName()); | |
| 280 } | 281 } |
| 281 | 282 |
| 282 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( | 283 SkAdvancedTypefaceMetrics* SkTypeface::getAdvancedTypefaceMetrics( |
| 283 SkAdvancedTypefaceMetrics::PerGlyphInfo info, | 284 SkAdvancedTypefaceMetrics::PerGlyphInfo info, |
| 284 const uint32_t* glyphIDs, | 285 const uint32_t* glyphIDs, |
| 285 uint32_t glyphIDsCount) const { | 286 uint32_t glyphIDsCount) const { |
| 286 SkAdvancedTypefaceMetrics* result = | 287 SkAdvancedTypefaceMetrics* result = |
| 287 this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); | 288 this->onGetAdvancedTypefaceMetrics(info, glyphIDs, glyphIDsCount); |
| 288 if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) { | 289 if (result && result->fType == SkAdvancedTypefaceMetrics::kTrueType_Font) { |
| 289 struct SkOTTableOS2 os2table; | 290 struct SkOTTableOS2 os2table; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 306 } | 307 } |
| 307 return result; | 308 return result; |
| 308 } | 309 } |
| 309 | 310 |
| 310 /////////////////////////////////////////////////////////////////////////////// | 311 /////////////////////////////////////////////////////////////////////////////// |
| 311 | 312 |
| 312 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, | 313 bool SkTypeface::onGetKerningPairAdjustments(const uint16_t glyphs[], int count, |
| 313 int32_t adjustments[]) const { | 314 int32_t adjustments[]) const { |
| 314 return false; | 315 return false; |
| 315 } | 316 } |
| OLD | NEW |