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 #ifndef FONTHOSTCONFIGURATION_ANDROID_H_ | 8 #ifndef SKFONTCONFIGPARSER_ANDROID_H_ |
9 #define FONTHOSTCONFIGURATION_ANDROID_H_ | 9 #define SKFONTCONFIGPARSER_ANDROID_H_ |
10 | 10 |
| 11 #include "SkTypes.h" |
| 12 |
| 13 #include "SkPaintOptionsAndroid.h" |
11 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
12 | 15 |
| 16 struct FontFileInfo { |
| 17 FontFileInfo() : fFileName(NULL) {} |
| 18 |
| 19 const char* fFileName; |
| 20 SkPaintOptionsAndroid fPaintOptions; |
| 21 }; |
| 22 |
13 /** | 23 /** |
14 * The FontFamily data structure is created during parsing and handed back to | 24 * The FontFamily data structure is created during parsing and handed back to |
15 * Skia to fold into its representation of font families. fNames is the list of | 25 * Skia to fold into its representation of font families. fNames is the list of |
16 * font names that alias to a font family. fFileNames is the list of font | 26 * font names that alias to a font family. fontFileArray is the list of informat
ion |
17 * filenames for the family. Order is the priority order for the font. This is | 27 * about each file. Order is the priority order for the font. This is |
18 * used internally to determine the order in which to place fallback fonts as | 28 * used internally to determine the order in which to place fallback fonts as |
19 * they are read from the configuration files. | 29 * they are read from the configuration files. |
20 */ | 30 */ |
21 struct FontFamily { | 31 struct FontFamily { |
22 SkTDArray<const char*> fNames; | 32 FontFamily() : fIsFallbackFont(false), order(-1) {} |
23 SkTDArray<const char*> fFileNames; | 33 |
24 int order; | 34 SkTDArray<const char*> fNames; |
| 35 SkTDArray<FontFileInfo*> fFontFiles; |
| 36 bool fIsFallbackFont; |
| 37 int order; // only used internally by SkFontConfigParser |
25 }; | 38 }; |
26 | 39 |
| 40 namespace SkFontConfigParser { |
| 41 |
27 /** | 42 /** |
28 * Parses all system font configuration files and returns the results in an | 43 * Parses all system font configuration files and returns the results in an |
29 * array of FontFamily structures. | 44 * array of FontFamily structures. |
30 */ | 45 */ |
31 void getFontFamilies(SkTDArray<FontFamily*> &fontFamilies); | 46 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); |
32 | |
33 /** | |
34 * Parse the fallback and vendor system font configuration files and return the | |
35 * results in an array of FontFamily structures. | |
36 */ | |
37 void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts); | |
38 | 47 |
39 /** | 48 /** |
40 * Parses all test font configuration files and returns the results in an | 49 * Parses all test font configuration files and returns the results in an |
41 * array of FontFamily structures. | 50 * array of FontFamily structures. |
42 */ | 51 */ |
43 void getTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, | 52 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, |
44 const char* testMainConfigFile, | 53 const char* testMainConfigFile, |
45 const char* testFallbackConfigFile); | 54 const char* testFallbackConfigFile); |
46 | 55 |
47 struct AndroidLocale { | 56 struct AndroidLocale { |
48 char language[3]; | 57 char language[3]; |
49 char region[3]; | 58 char region[3]; |
50 }; | 59 }; |
51 | 60 |
52 void getLocale(AndroidLocale &locale); | 61 void GetLocale(AndroidLocale &locale); |
53 | 62 |
54 #endif /* FONTHOSTCONFIGURATION_ANDROID_H_ */ | 63 } // SkFontConfigParser namespace |
| 64 |
| 65 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ |
OLD | NEW |