OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 The Android Open Source Project | 3 * Copyright 2013 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkFontConfigInterface.h" | 9 #include "SkFontConfigInterface.h" |
10 #include "SkTypeface_android.h" | 10 #include "SkTypeface_android.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 SkTDict<FallbackFontList*> fFallbackFontAliasDict; | 125 SkTDict<FallbackFontList*> fFallbackFontAliasDict; |
126 FallbackFontList fDefaultFallbackList; | 126 FallbackFontList fDefaultFallbackList; |
127 | 127 |
128 // fallback info for current locale | 128 // fallback info for current locale |
129 SkString fCachedLocale; | 129 SkString fCachedLocale; |
130 FallbackFontList* fLocaleFallbackFontList; | 130 FallbackFontList* fLocaleFallbackFontList; |
131 }; | 131 }; |
132 | 132 |
133 /////////////////////////////////////////////////////////////////////////////// | 133 /////////////////////////////////////////////////////////////////////////////// |
134 | 134 |
| 135 SK_DECLARE_STATIC_MUTEX(gGetSingletonInterfaceMutex); |
135 static SkFontConfigInterfaceAndroid* getSingletonInterface() { | 136 static SkFontConfigInterfaceAndroid* getSingletonInterface() { |
136 SK_DECLARE_STATIC_MUTEX(gMutex); | |
137 static SkFontConfigInterfaceAndroid* gFontConfigInterface; | 137 static SkFontConfigInterfaceAndroid* gFontConfigInterface; |
138 | 138 |
139 SkAutoMutexAcquire ac(gMutex); | 139 SkAutoMutexAcquire ac(gGetSingletonInterfaceMutex); |
140 if (NULL == gFontConfigInterface) { | 140 if (NULL == gFontConfigInterface) { |
141 // load info from a configuration file that we can use to populate the | 141 // load info from a configuration file that we can use to populate the |
142 // system/fallback font structures | 142 // system/fallback font structures |
143 SkTDArray<FontFamily*> fontFamilies; | 143 SkTDArray<FontFamily*> fontFamilies; |
144 if (!gTestMainConfigFile) { | 144 if (!gTestMainConfigFile) { |
145 SkFontConfigParser::GetFontFamilies(fontFamilies); | 145 SkFontConfigParser::GetFontFamilies(fontFamilies); |
146 } else { | 146 } else { |
147 SkFontConfigParser::GetTestFontFamilies(fontFamilies, gTestMainConfi
gFile, | 147 SkFontConfigParser::GetTestFontFamilies(fontFamilies, gTestMainConfi
gFile, |
148 gTestFallbackConfigFile); | 148 gTestFallbackConfigFile); |
149 } | 149 } |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 key.typeface = retTypeface; | 900 key.typeface = retTypeface; |
901 *gTypefaceTable.insert(~index) = key; | 901 *gTypefaceTable.insert(~index) = key; |
902 } | 902 } |
903 | 903 |
904 // we ref(), the caller is expected to unref when they are done | 904 // we ref(), the caller is expected to unref when they are done |
905 return SkSafeRef(retTypeface); | 905 return SkSafeRef(retTypeface); |
906 } | 906 } |
907 | 907 |
908 #endif | 908 #endif |
909 | 909 |
OLD | NEW |