OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef SkOTUtils_DEFINED | 8 #ifndef SkOTUtils_DEFINED |
9 #define SkOTUtils_DEFINED | 9 #define SkOTUtils_DEFINED |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 int typesCount) | 47 int typesCount) |
48 : fTypes(types), fTypesCount(typesCount), fTypesIndex(0) | 48 : fTypes(types), fTypesCount(typesCount), fTypesIndex(0) |
49 , fNameTableData(nameTableData), fFamilyNameIter(*nameTableData, fTy
pes[fTypesIndex]) | 49 , fNameTableData(nameTableData), fFamilyNameIter(*nameTableData, fTy
pes[fTypesIndex]) |
50 { } | 50 { } |
51 | 51 |
52 /** Creates an iterator over all the family names in the 'name' table of
a typeface. | 52 /** Creates an iterator over all the family names in the 'name' table of
a typeface. |
53 * If no valid 'name' table can be found, returns NULL. | 53 * If no valid 'name' table can be found, returns NULL. |
54 */ | 54 */ |
55 static LocalizedStrings_NameTable* CreateForFamilyNames(const SkTypeface
& typeface); | 55 static LocalizedStrings_NameTable* CreateForFamilyNames(const SkTypeface
& typeface); |
56 | 56 |
57 bool next(SkTypeface::LocalizedString* localizedString) SK_OVERRIDE; | 57 bool next(SkTypeface::LocalizedString* localizedString) override; |
58 private: | 58 private: |
59 static SkOTTableName::Record::NameID::Predefined::Value familyNameTypes[
3]; | 59 static SkOTTableName::Record::NameID::Predefined::Value familyNameTypes[
3]; |
60 | 60 |
61 SkOTTableName::Record::NameID::Predefined::Value* fTypes; | 61 SkOTTableName::Record::NameID::Predefined::Value* fTypes; |
62 int fTypesCount; | 62 int fTypesCount; |
63 int fTypesIndex; | 63 int fTypesIndex; |
64 SkAutoTDeleteArray<SkOTTableName> fNameTableData; | 64 SkAutoTDeleteArray<SkOTTableName> fNameTableData; |
65 SkOTTableName::Iterator fFamilyNameIter; | 65 SkOTTableName::Iterator fFamilyNameIter; |
66 }; | 66 }; |
67 | 67 |
68 /** An implementation of LocalizedStrings which has one name. */ | 68 /** An implementation of LocalizedStrings which has one name. */ |
69 class LocalizedStrings_SingleName : public SkTypeface::LocalizedStrings { | 69 class LocalizedStrings_SingleName : public SkTypeface::LocalizedStrings { |
70 public: | 70 public: |
71 LocalizedStrings_SingleName(SkString name, SkString language) | 71 LocalizedStrings_SingleName(SkString name, SkString language) |
72 : fName(name), fLanguage(language), fHasNext(true) | 72 : fName(name), fLanguage(language), fHasNext(true) |
73 { } | 73 { } |
74 | 74 |
75 bool next(SkTypeface::LocalizedString* localizedString) SK_OVERRIDE { | 75 bool next(SkTypeface::LocalizedString* localizedString) override { |
76 localizedString->fString = fName; | 76 localizedString->fString = fName; |
77 localizedString->fLanguage = fLanguage; | 77 localizedString->fLanguage = fLanguage; |
78 | 78 |
79 bool hadNext = fHasNext; | 79 bool hadNext = fHasNext; |
80 fHasNext = false; | 80 fHasNext = false; |
81 return hadNext; | 81 return hadNext; |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 SkString fName; | 85 SkString fName; |
86 SkString fLanguage; | 86 SkString fLanguage; |
87 bool fHasNext; | 87 bool fHasNext; |
88 }; | 88 }; |
89 }; | 89 }; |
90 | 90 |
91 #endif | 91 #endif |
OLD | NEW |