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 "SkFontConfigParser_android.h" | 8 #include "SkFontConfigParser_android.h" |
9 #include "SkFontMgr_android.h" | 9 #include "SkFontMgr_android.h" |
10 #include "SkStream.h" | 10 #include "SkStream.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
156 const char* value = attributes[i+1]; | 156 const char* value = attributes[i+1]; |
157 size_t nameLen = strlen(name); | 157 size_t nameLen = strlen(name); |
158 if (MEMEQ("weight", name, nameLen)) { | 158 if (MEMEQ("weight", name, nameLen)) { |
159 if (!parse_non_negative_integer(value, &file->fWeight)) { | 159 if (!parse_non_negative_integer(value, &file->fWeight)) { |
160 SkDebugf("---- Font weight %s (INVALID)", value); | 160 SkDebugf("---- Font weight %s (INVALID)", value); |
161 } | 161 } |
162 } else if (MEMEQ("index", name, nameLen)) { | 162 } else if (MEMEQ("index", name, nameLen)) { |
163 if (!parse_non_negative_integer(value, &file->fIndex)) { | 163 if (!parse_non_negative_integer(value, &file->fIndex)) { |
164 SkDebugf("---- Font index %s (INVALID)", value); | 164 SkDebugf("---- Font index %s (INVALID)", value); |
165 } | 165 } |
166 } else if (MEMEQ("axis", name, nameLen)) { | |
bungeman-skia
2015/04/01 20:38:28
Need support for multiple axes. By index, id (four
| |
167 if (!parse_non_negative_integer(value, &file->fAxes.push_back())) { | |
168 SkDebugf("---- Font axis %s (INVALID)", value); | |
169 } | |
166 } | 170 } |
167 } | 171 } |
168 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); | 172 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); |
169 } | 173 } |
170 | 174 |
171 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { | 175 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { |
172 for (int i = 0; i < self->fFamilies.count(); i++) { | 176 for (int i = 0; i < self->fFamilies.count(); i++) { |
173 FontFamily* candidate = self->fFamilies[i]; | 177 FontFamily* candidate = self->fFamilies[i]; |
174 for (int j = 0; j < candidate->fNames.count(); j++) { | 178 for (int j = 0; j < candidate->fNames.count(); j++) { |
175 if (candidate->fNames[j] == familyName) { | 179 if (candidate->fNames[j] == familyName) { |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
627 const char* tag = fTag.c_str(); | 631 const char* tag = fTag.c_str(); |
628 | 632 |
629 // strip off the rightmost "-.*" | 633 // strip off the rightmost "-.*" |
630 const char* parentTagEnd = strrchr(tag, '-'); | 634 const char* parentTagEnd = strrchr(tag, '-'); |
631 if (parentTagEnd == NULL) { | 635 if (parentTagEnd == NULL) { |
632 return SkLanguage(); | 636 return SkLanguage(); |
633 } | 637 } |
634 size_t parentTagLen = parentTagEnd - tag; | 638 size_t parentTagLen = parentTagEnd - tag; |
635 return SkLanguage(tag, parentTagLen); | 639 return SkLanguage(tag, parentTagLen); |
636 } | 640 } |
OLD | NEW |