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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // Append all fallback fonts to system fonts | 247 // Append all fallback fonts to system fonts |
248 for (int i = 0; i < fallbackFonts.count(); ++i) { | 248 for (int i = 0; i < fallbackFonts.count(); ++i) { |
249 fallbackFonts[i]->fIsFallbackFont = true; | 249 fallbackFonts[i]->fIsFallbackFont = true; |
250 *fontFamilies.append() = fallbackFonts[i]; | 250 *fontFamilies.append() = fallbackFonts[i]; |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 /** | 254 /** |
255 * Read the persistent locale. | 255 * Read the persistent locale. |
256 */ | 256 */ |
257 void SkFontConfigParser::GetLocale(AndroidLocale &locale) | 257 SkString SkFontConfigParser::GetLocale() |
258 { | 258 { |
259 char propLang[PROP_VALUE_MAX], propRegn[PROP_VALUE_MAX]; | 259 char propLang[PROP_VALUE_MAX], propRegn[PROP_VALUE_MAX]; |
260 __system_property_get("persist.sys.language", propLang); | 260 __system_property_get("persist.sys.language", propLang); |
261 __system_property_get("persist.sys.country", propRegn); | 261 __system_property_get("persist.sys.country", propRegn); |
262 | 262 |
263 if (*propLang == 0 && *propRegn == 0) { | 263 if (*propLang == 0 && *propRegn == 0) { |
264 /* Set to ro properties, default is en_US */ | 264 /* Set to ro properties, default is en_US */ |
265 __system_property_get("ro.product.locale.language", propLang); | 265 __system_property_get("ro.product.locale.language", propLang); |
266 __system_property_get("ro.product.locale.region", propRegn); | 266 __system_property_get("ro.product.locale.region", propRegn); |
267 if (*propLang == 0 && *propRegn == 0) { | 267 if (*propLang == 0 && *propRegn == 0) { |
268 strcpy(propLang, "en"); | 268 strcpy(propLang, "en"); |
269 strcpy(propRegn, "US"); | 269 strcpy(propRegn, "US"); |
270 } | 270 } |
271 } | 271 } |
272 strncpy(locale.language, propLang, 2); | 272 |
273 locale.language[2] = '\0'; | 273 SkString locale(6); |
274 strncpy(locale.region, propRegn, 2); | 274 char* localeCStr = locale.writable_str(); |
275 locale.region[2] = '\0'; | 275 |
| 276 strncpy(localeCStr, propLang, 2); |
| 277 localeCStr[2] = '-'; |
| 278 strncpy(&localeCStr[3], propRegn, 2); |
| 279 localeCStr[5] = '\0'; |
| 280 |
| 281 return locale; |
276 } | 282 } |
OLD | NEW |