299 static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) {
300 ScopedUtfChars localeChars(env, locale);
301 char langTag[ULOC_FULLNAME_CAPACITY];
302 toLanguageTag(langTag, ULOC_FULLNAME_CAPACITY, localeChars.c_str());
mEnv =
mString =
mUtfChars = "ja_JP"
303 obj->setLanguage(SkLanguage(langTag));
304 }
33 SkLanguage(const char* tag) : fInfo(getInfo(tag)) { }
34 SK_DECLARE_STATIC_MUTEX(gGetInfoMutex);
35 const SkLanguageInfo* SkLanguage::getInfo(const char* tag) {
36 SkAutoMutexAcquire lock(gGetInfoMutex);
37
38 static const size_t kDictSize = 128;
39 static SkTDict<SkLanguageInfo*> tagToInfo(kDictSize);
40
41
42 SkLanguageInfo* info;
43 if (tagToInfo.find(tag, &info)) {
44 return info;
45 }
46
47
48 info = new SkLanguageInfo(tag);
49 tagToInfo.set(tag, info);
50 return info;
51 }
19 struct SkLanguageInfo {
20 SkLanguageInfo(const char* tag) : fTag(tag) { }
21 SkString fTag; //! BCP 47 language identifier
22 };