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 SKFONTCONFIGPARSER_ANDROID_H_ | 8 #ifndef SKFONTCONFIGPARSER_ANDROID_H_ |
9 #define SKFONTCONFIGPARSER_ANDROID_H_ | 9 #define SKFONTCONFIGPARSER_ANDROID_H_ |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 #include "SkPaintOptionsAndroid.h" | 13 #include "SkPaintOptionsAndroid.h" |
14 #include "SkString.h" | 14 #include "SkString.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 | 16 |
17 struct FontFileInfo { | 17 struct FontFileInfo { |
18 FontFileInfo() : fIndex(0) { } | 18 FontFileInfo() : fIndex(0), fWeight(0) { } |
19 | 19 |
20 SkString fFileName; | 20 SkString fFileName; |
21 int fIndex; | 21 int fIndex; |
22 SkPaintOptionsAndroid fPaintOptions; | 22 SkPaintOptionsAndroid fPaintOptions; |
23 int fWeight; | |
23 }; | 24 }; |
24 | 25 |
25 /** | 26 /** |
26 * The FontFamily data structure is created during parsing and handed back to | 27 * The FontFamily data structure is created during parsing and handed back to |
27 * Skia to fold into its representation of font families. fNames is the list of | 28 * Skia to fold into its representation of font families. fNames is the list of |
28 * font names that alias to a font family. fontFileArray is the list of informat ion | 29 * font names that alias to a font family. fontFileArray is the list of informat ion |
palmer
2014/08/06 21:05:30
"fontFileArray" should be "fFontFiles"? (Which its
tomhudson
2014/08/07 14:39:43
Comment fix done. I disagree on the naming as a ge
| |
29 * about each file. Order is the priority order for the font. This is | 30 * about each file. Order is the priority order for the font. This is |
palmer
2014/08/06 21:05:30
It's |order|, not |Order|; but also, why not |fOrd
tomhudson
2014/08/07 14:39:43
I suspect this is code archaeology: in my experien
| |
30 * used internally to determine the order in which to place fallback fonts as | 31 * used internally to determine the order in which to place fallback fonts as |
31 * they are read from the configuration files. | 32 * they are read from the configuration files. |
32 */ | 33 */ |
33 struct FontFamily { | 34 struct FontFamily { |
34 FontFamily() : fIsFallbackFont(false), order(-1) {} | 35 FontFamily() |
36 : fVariant(SkPaintOptionsAndroid::kDefault_Variant) | |
37 , order(-1) | |
38 , fIsFallbackFont(false) { } | |
35 | 39 |
36 SkTArray<SkString> fNames; | 40 SkTArray<SkString> fNames; |
37 SkTArray<FontFileInfo> fFontFiles; | 41 SkTArray<FontFileInfo> fFontFiles; |
38 bool fIsFallbackFont; | 42 SkLanguage fLanguage; |
39 int order; // only used internally by SkFontConfigParser | 43 SkPaintOptionsAndroid::FontVariant fVariant; |
44 int order; // only used internally by SkFontC onfigParser | |
45 bool fIsFallbackFont; | |
40 }; | 46 }; |
41 | 47 |
42 namespace SkFontConfigParser { | 48 namespace SkFontConfigParser { |
43 | 49 |
44 /** | 50 /** |
45 * Parses all system font configuration files and returns the results in an | 51 * Parses all system font configuration files and returns the results in an |
46 * array of FontFamily structures. | 52 * array of FontFamily structures. |
47 */ | 53 */ |
48 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); | 54 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); |
49 | 55 |
50 /** | 56 /** |
51 * Parses all test font configuration files and returns the results in an | 57 * Parses all test font configuration files and returns the results in an |
52 * array of FontFamily structures. | 58 * array of FontFamily structures. |
53 */ | 59 */ |
54 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, | 60 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, |
55 const char* testMainConfigFile, | 61 const char* testMainConfigFile, |
56 const char* testFallbackConfigFile); | 62 const char* testFallbackConfigFile); |
57 | 63 |
58 SkString GetLocale(); | 64 SkString GetLocale(); |
59 | 65 |
60 } // SkFontConfigParser namespace | 66 } // SkFontConfigParser namespace |
61 | 67 |
62 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ | 68 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ |
OLD | NEW |