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