OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 "SkFontHost.h" | 8 #include "SkFontHost.h" |
9 #include "SkFontHost_FreeType_common.h" | 9 #include "SkFontHost_FreeType_common.h" |
10 #include "SkFontDescriptor.h" | 10 #include "SkFontDescriptor.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 SkTypeface_Custom(Style style, bool isFixedPitch, bool sysFont, const SkStri
ng familyName) | 33 SkTypeface_Custom(Style style, bool isFixedPitch, bool sysFont, const SkStri
ng familyName) |
34 : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch) | 34 : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch) |
35 , fIsSysFont(sysFont), fFamilyName(familyName) | 35 , fIsSysFont(sysFont), fFamilyName(familyName) |
36 { } | 36 { } |
37 | 37 |
38 bool isSysFont() const { return fIsSysFont; } | 38 bool isSysFont() const { return fIsSysFont; } |
39 | 39 |
40 virtual const char* getUniqueString() const = 0; | 40 virtual const char* getUniqueString() const = 0; |
41 | 41 |
42 protected: | 42 protected: |
| 43 virtual void onGetFamilyName(SkString* familyName) const SK_OVERRIDE { |
| 44 *familyName = fFamilyName; |
| 45 } |
| 46 |
43 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) cons
t SK_OVERRIDE { | 47 virtual void onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) cons
t SK_OVERRIDE { |
44 desc->setFamilyName(fFamilyName.c_str()); | 48 desc->setFamilyName(fFamilyName.c_str()); |
45 desc->setFontFileName(this->getUniqueString()); | 49 desc->setFontFileName(this->getUniqueString()); |
46 *isLocal = !this->isSysFont(); | 50 *isLocal = !this->isSysFont(); |
47 } | 51 } |
48 | 52 |
49 private: | 53 private: |
50 bool fIsSysFont; | 54 bool fIsSysFont; |
51 SkString fFamilyName; | 55 SkString fFamilyName; |
52 | 56 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } | 401 } |
398 | 402 |
399 SkTArray<SkAutoTUnref<SkFontStyleSet_Custom>, true> fFamilies; | 403 SkTArray<SkAutoTUnref<SkFontStyleSet_Custom>, true> fFamilies; |
400 SkFontStyleSet_Custom* gDefaultFamily; | 404 SkFontStyleSet_Custom* gDefaultFamily; |
401 SkTypeface* gDefaultNormal; | 405 SkTypeface* gDefaultNormal; |
402 }; | 406 }; |
403 | 407 |
404 SkFontMgr* SkFontMgr::Factory() { | 408 SkFontMgr* SkFontMgr::Factory() { |
405 return new SkFontMgr_Custom(SK_FONT_FILE_PREFIX); | 409 return new SkFontMgr_Custom(SK_FONT_FILE_PREFIX); |
406 } | 410 } |
OLD | NEW |