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("style", name, nameLen)) { | |
163 size_t valueLen = strlen(value); | |
164 if (MEMEQ("normal", value, valueLen)) { | |
165 file->fStyle = FontFileInfo::Style::kNormal; | |
166 } else if (MEMEQ("italic", value, valueLen)) { | |
167 file->fStyle = FontFileInfo::Style::kItalic; | |
168 } | |
169 } else if (MEMEQ("index", name, nameLen)) { | 162 } else if (MEMEQ("index", name, nameLen)) { |
170 if (!parse_non_negative_integer(value, &file->fIndex)) { | 163 if (!parse_non_negative_integer(value, &file->fIndex)) { |
171 SkDebugf("---- Font index %s (INVALID)", value); | 164 SkDebugf("---- Font index %s (INVALID)", value); |
172 } | 165 } |
173 } | 166 } |
174 } | 167 } |
175 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); | 168 XML_SetCharacterDataHandler(self->fParser, font_file_name_handler); |
176 } | 169 } |
177 | 170 |
178 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { | 171 static FontFamily* find_family(FamilyData* self, const SkString& familyName) { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 const char* tag = fTag.c_str(); | 627 const char* tag = fTag.c_str(); |
635 | 628 |
636 // strip off the rightmost "-.*" | 629 // strip off the rightmost "-.*" |
637 const char* parentTagEnd = strrchr(tag, '-'); | 630 const char* parentTagEnd = strrchr(tag, '-'); |
638 if (parentTagEnd == NULL) { | 631 if (parentTagEnd == NULL) { |
639 return SkLanguage(); | 632 return SkLanguage(); |
640 } | 633 } |
641 size_t parentTagLen = parentTagEnd - tag; | 634 size_t parentTagLen = parentTagEnd - tag; |
642 return SkLanguage(tag, parentTagLen); | 635 return SkLanguage(tag, parentTagLen); |
643 } | 636 } |
OLD | NEW |