| 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), fWeight(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 int fWeight; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 /** | 26 /** |
| 27 * The FontFamily data structure is created during parsing and handed back to | 27 * A font family provides one or more names for a collection of fonts, each of |
| 28 * Skia to fold into its representation of font families. fNames is the list of | 28 * which has a different style (normal, italic) or weight (thin, light, bold, |
| 29 * font names that alias to a font family. fontFileArray is the list of informat
ion | 29 * etc). |
| 30 * about each file. Order is the priority order for the font. This is | 30 * Some fonts may occur in compact variants for use in the user interface. |
| 31 * used internally to determine the order in which to place fallback fonts as | 31 * Android distinguishes "fallback" fonts to support non-ASCII character sets. |
| 32 * they are read from the configuration files. | |
| 33 */ | 32 */ |
| 34 struct FontFamily { | 33 struct FontFamily { |
| 35 FontFamily() | 34 FontFamily() |
| 36 : fVariant(SkPaintOptionsAndroid::kDefault_Variant) | 35 : fVariant(SkPaintOptionsAndroid::kDefault_Variant) |
| 37 , order(-1) | 36 , fOrder(-1) |
| 38 , fIsFallbackFont(false) { } | 37 , fIsFallbackFont(false) { } |
| 39 | 38 |
| 40 SkTArray<SkString> fNames; | 39 SkTArray<SkString> fNames; |
| 41 SkTArray<FontFileInfo> fFontFiles; | 40 SkTArray<FontFileInfo> fFonts; |
| 42 SkLanguage fLanguage; | 41 SkLanguage fLanguage; |
| 43 SkPaintOptionsAndroid::FontVariant fVariant; | 42 SkPaintOptionsAndroid::FontVariant fVariant; |
| 44 int order; // only used internally by SkFontC
onfigParser | 43 int fOrder; // internal to SkFontConfigParser |
| 45 bool fIsFallbackFont; | 44 bool fIsFallbackFont; |
| 46 }; | 45 }; |
| 47 | 46 |
| 48 namespace SkFontConfigParser { | 47 namespace SkFontConfigParser { |
| 49 | 48 |
| 50 /** | 49 /** |
| 51 * Parses all system font configuration files and returns the results in an | 50 * Parses all system font configuration files and returns the results in an |
| 52 * array of FontFamily structures. | 51 * array of FontFamily structures. |
| 53 */ | 52 */ |
| 54 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); | 53 void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); |
| 55 | 54 |
| 56 /** | 55 /** |
| 57 * Parses all test font configuration files and returns the results in an | 56 * Parses all test font configuration files and returns the results in an |
| 58 * array of FontFamily structures. | 57 * array of FontFamily structures. |
| 59 */ | 58 */ |
| 60 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, | 59 void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, |
| 61 const char* testMainConfigFile, | 60 const char* testMainConfigFile, |
| 62 const char* testFallbackConfigFile); | 61 const char* testFallbackConfigFile); |
| 63 | 62 |
| 64 } // SkFontConfigParser namespace | 63 } // SkFontConfigParser namespace |
| 65 | 64 |
| 66 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ | 65 #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ |
| OLD | NEW |