| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // NOTE: we ignore the style. | 152 // NOTE: we ignore the style. |
| 153 // The element should contain a filename. | 153 // The element should contain a filename. |
| 154 for (size_t i = 0; ATTS_NON_NULL(attributes, i); i += 2) { | 154 for (size_t i = 0; ATTS_NON_NULL(attributes, i); i += 2) { |
| 155 const char* name = attributes[i]; | 155 const char* name = attributes[i]; |
| 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)) { |
| 163 if (!parse_non_negative_integer(value, &file->fIndex)) { |
| 164 SkDebugf("---- Font index %s (INVALID)", value); |
| 165 } |
| 162 } | 166 } |
| 163 } | 167 } |
| 164 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); | 168 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); |
| 165 } | 169 } |
| 166 | 170 |
| 167 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { | 171 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { |
| 168 for (int i = 0; i < self->fFamilies.count(); i++) { | 172 for (int i = 0; i < self->fFamilies.count(); i++) { |
| 169 FontFamily* candidate = self->fFamilies[i]; | 173 FontFamily* candidate = self->fFamilies[i]; |
| 170 for (int j = 0; j < candidate->fNames.count(); j++) { | 174 for (int j = 0; j < candidate->fNames.count(); j++) { |
| 171 if (candidate->fNames[j] == familyName) { | 175 if (candidate->fNames[j] == familyName) { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 const char* tag = fTag.c_str(); | 627 const char* tag = fTag.c_str(); |
| 624 | 628 |
| 625 // strip off the rightmost "-.*" | 629 // strip off the rightmost "-.*" |
| 626 const char* parentTagEnd = strrchr(tag, '-'); | 630 const char* parentTagEnd = strrchr(tag, '-'); |
| 627 if (parentTagEnd == NULL) { | 631 if (parentTagEnd == NULL) { |
| 628 return SkLanguage(); | 632 return SkLanguage(); |
| 629 } | 633 } |
| 630 size_t parentTagLen = parentTagEnd - tag; | 634 size_t parentTagLen = parentTagEnd - tag; |
| 631 return SkLanguage(tag, parentTagLen); | 635 return SkLanguage(tag, parentTagLen); |
| 632 } | 636 } |
| OLD | NEW |