djsollen@google.com | bfae9d3 | 2013-05-21 16:53:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SKFONTCONFIGPARSER_ANDROID_H_ |
| 9 | #define SKFONTCONFIGPARSER_ANDROID_H_ |
| 10 | |
| 11 | #include "SkTypes.h" |
| 12 | |
| 13 | #include "SkPaintOptionsAndroid.h" |
djsollen@google.com | 9a70f34 | 2013-06-25 18:07:45 +0000 | [diff] [blame] | 14 | #include "SkString.h" |
djsollen@google.com | bfae9d3 | 2013-05-21 16:53:50 +0000 | [diff] [blame] | 15 | #include "SkTDArray.h" |
| 16 | |
| 17 | struct FontFileInfo { |
commit-bot@chromium.org | 31db71d | 2014-04-04 18:14:39 +0000 | [diff] [blame] | 18 | SkString fFileName; |
djsollen@google.com | bfae9d3 | 2013-05-21 16:53:50 +0000 | [diff] [blame] | 19 | SkPaintOptionsAndroid fPaintOptions; |
| 20 | }; |
| 21 | |
| 22 | /** |
| 23 | * The FontFamily data structure is created during parsing and handed back to |
| 24 | * Skia to fold into its representation of font families. fNames is the list of |
| 25 | * font names that alias to a font family. fontFileArray is the list of information |
| 26 | * about each file. Order is the priority order for the font. This is |
| 27 | * used internally to determine the order in which to place fallback fonts as |
| 28 | * they are read from the configuration files. |
| 29 | */ |
| 30 | struct FontFamily { |
| 31 | FontFamily() : fIsFallbackFont(false), order(-1) {} |
| 32 | |
commit-bot@chromium.org | 31db71d | 2014-04-04 18:14:39 +0000 | [diff] [blame] | 33 | SkTArray<SkString> fNames; |
| 34 | SkTArray<FontFileInfo> fFontFiles; |
djsollen@google.com | bfae9d3 | 2013-05-21 16:53:50 +0000 | [diff] [blame] | 35 | bool fIsFallbackFont; |
| 36 | int order; // only used internally by SkFontConfigParser |
| 37 | }; |
| 38 | |
| 39 | namespace SkFontConfigParser { |
| 40 | |
| 41 | /** |
| 42 | * Parses all system font configuration files and returns the results in an |
| 43 | * array of FontFamily structures. |
| 44 | */ |
| 45 | void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); |
| 46 | |
| 47 | /** |
| 48 | * Parses all test font configuration files and returns the results in an |
| 49 | * array of FontFamily structures. |
| 50 | */ |
| 51 | void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, |
| 52 | const char* testMainConfigFile, |
| 53 | const char* testFallbackConfigFile); |
| 54 | |
djsollen@google.com | 9a70f34 | 2013-06-25 18:07:45 +0000 | [diff] [blame] | 55 | SkString GetLocale(); |
djsollen@google.com | bfae9d3 | 2013-05-21 16:53:50 +0000 | [diff] [blame] | 56 | |
| 57 | } // SkFontConfigParser namespace |
| 58 | |
| 59 | #endif /* SKFONTCONFIGPARSER_ANDROID_H_ */ |