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 "SkTDArray.h" | 9 #include "SkTDArray.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 char buffer[512]; | 212 char buffer[512]; |
213 bool done = false; | 213 bool done = false; |
214 while (!done) { | 214 while (!done) { |
215 fgets(buffer, sizeof(buffer), file); | 215 fgets(buffer, sizeof(buffer), file); |
216 int len = strlen(buffer); | 216 int len = strlen(buffer); |
217 if (feof(file) != 0) { | 217 if (feof(file) != 0) { |
218 done = true; | 218 done = true; |
219 } | 219 } |
220 XML_Parse(parser, buffer, len, done); | 220 XML_Parse(parser, buffer, len, done); |
221 } | 221 } |
| 222 XML_ParserFree(parser); |
222 fclose(file); | 223 fclose(file); |
223 } | 224 } |
224 | 225 |
225 static void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies) { | 226 static void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies) { |
226 parseConfigFile(SYSTEM_FONTS_FILE, fontFamilies); | 227 parseConfigFile(SYSTEM_FONTS_FILE, fontFamilies); |
227 } | 228 } |
228 | 229 |
229 static void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts) { | 230 static void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts) { |
230 SkTDArray<FontFamily*> vendorFonts; | 231 SkTDArray<FontFamily*> vendorFonts; |
231 parseConfigFile(FALLBACK_FONTS_FILE, fallbackFonts); | 232 parseConfigFile(FALLBACK_FONTS_FILE, fallbackFonts); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 SkString locale(6); | 310 SkString locale(6); |
310 char* localeCStr = locale.writable_str(); | 311 char* localeCStr = locale.writable_str(); |
311 | 312 |
312 strncpy(localeCStr, propLang, 2); | 313 strncpy(localeCStr, propLang, 2); |
313 localeCStr[2] = '-'; | 314 localeCStr[2] = '-'; |
314 strncpy(&localeCStr[3], propRegn, 2); | 315 strncpy(&localeCStr[3], propRegn, 2); |
315 localeCStr[5] = '\0'; | 316 localeCStr[5] = '\0'; |
316 | 317 |
317 return locale; | 318 return locale; |
318 } | 319 } |
OLD | NEW |