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_FreeType_common.h" | 8 #include "SkFontHost_FreeType_common.h" |
9 #include "SkFontDescriptor.h" | 9 #include "SkFontDescriptor.h" |
10 #include "SkFontMgr.h" | 10 #include "SkFontMgr.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 virtual const char* getUniqueString() const = 0; | 35 virtual const char* getUniqueString() const = 0; |
36 | 36 |
37 protected: | 37 protected: |
38 void onGetFamilyName(SkString* familyName) const override { | 38 void onGetFamilyName(SkString* familyName) const override { |
39 *familyName = fFamilyName; | 39 *familyName = fFamilyName; |
40 } | 40 } |
41 | 41 |
42 void onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const overri
de { | 42 void onGetFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const overri
de { |
43 desc->setFamilyName(fFamilyName.c_str()); | 43 desc->setFamilyName(fFamilyName.c_str()); |
44 desc->setFontFileName(this->getUniqueString()); | |
45 desc->setFontIndex(fIndex); | |
46 *isLocal = !this->isSysFont(); | 44 *isLocal = !this->isSysFont(); |
47 } | 45 } |
48 | 46 |
49 int getIndex() const { return fIndex; } | 47 int getIndex() const { return fIndex; } |
50 | 48 |
51 private: | 49 private: |
52 const bool fIsSysFont; | 50 const bool fIsSysFont; |
53 const SkString fFamilyName; | 51 const SkString fFamilyName; |
54 const int fIndex; | 52 const int fIndex; |
55 | 53 |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 #else | 539 #else |
542 | 540 |
543 #ifndef SK_FONT_FILE_PREFIX | 541 #ifndef SK_FONT_FILE_PREFIX |
544 # define SK_FONT_FILE_PREFIX "/usr/share/fonts/" | 542 # define SK_FONT_FILE_PREFIX "/usr/share/fonts/" |
545 #endif | 543 #endif |
546 SkFontMgr* SkFontMgr::Factory() { | 544 SkFontMgr* SkFontMgr::Factory() { |
547 return new SkFontMgr_Custom(DirectorySystemFontLoader(SK_FONT_FILE_PREFIX)); | 545 return new SkFontMgr_Custom(DirectorySystemFontLoader(SK_FONT_FILE_PREFIX)); |
548 } | 546 } |
549 | 547 |
550 #endif | 548 #endif |
OLD | NEW |