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