1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/ports/SkFontConfigParser_android.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* 1.5 + * Copyright 2011 The Android Open Source Project 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#ifndef SKFONTCONFIGPARSER_ANDROID_H_ 1.12 +#define SKFONTCONFIGPARSER_ANDROID_H_ 1.13 + 1.14 +#include "SkTypes.h" 1.15 + 1.16 +#include "SkPaintOptionsAndroid.h" 1.17 +#include "SkString.h" 1.18 +#include "SkTDArray.h" 1.19 + 1.20 +struct FontFileInfo { 1.21 + FontFileInfo() : fFileName(NULL) {} 1.22 + 1.23 + const char* fFileName; 1.24 + SkPaintOptionsAndroid fPaintOptions; 1.25 +}; 1.26 + 1.27 +/** 1.28 + * The FontFamily data structure is created during parsing and handed back to 1.29 + * Skia to fold into its representation of font families. fNames is the list of 1.30 + * font names that alias to a font family. fontFileArray is the list of information 1.31 + * about each file. Order is the priority order for the font. This is 1.32 + * used internally to determine the order in which to place fallback fonts as 1.33 + * they are read from the configuration files. 1.34 + */ 1.35 +struct FontFamily { 1.36 + FontFamily() : fIsFallbackFont(false), order(-1) {} 1.37 + 1.38 + SkTDArray<const char*> fNames; 1.39 + SkTDArray<FontFileInfo*> fFontFiles; 1.40 + bool fIsFallbackFont; 1.41 + int order; // only used internally by SkFontConfigParser 1.42 +}; 1.43 + 1.44 +namespace SkFontConfigParser { 1.45 + 1.46 +/** 1.47 + * Parses all system font configuration files and returns the results in an 1.48 + * array of FontFamily structures. 1.49 + */ 1.50 +void GetFontFamilies(SkTDArray<FontFamily*> &fontFamilies); 1.51 + 1.52 +/** 1.53 + * Parses all test font configuration files and returns the results in an 1.54 + * array of FontFamily structures. 1.55 + */ 1.56 +void GetTestFontFamilies(SkTDArray<FontFamily*> &fontFamilies, 1.57 + const char* testMainConfigFile, 1.58 + const char* testFallbackConfigFile); 1.59 + 1.60 +SkString GetLocale(); 1.61 + 1.62 +} // SkFontConfigParser namespace 1.63 + 1.64 +#endif /* SKFONTCONFIGPARSER_ANDROID_H_ */