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 FONTHOSTCONFIGURATION_ANDROID_H_ 9#define FONTHOSTCONFIGURATION_ANDROID_H_ 10 11#include "SkTypes.h" 12 13#include "SkLanguage.h" 14#include "SkPaint.h" 15#include "SkTDArray.h" 16 17struct FontFileInfo { 18 FontFileInfo() : fFileName(NULL), fVariant(SkPaint::kDefault_Variant), 19 fLanguage() { 20 } 21 22 const char* fFileName; 23 SkPaint::FontVariant fVariant; 24 SkLanguage fLanguage; 25}; 26 27/** 28 * The FontFamily data structure is created during parsing and handed back to 29 * Skia to fold into its representation of font families. fNames is the list of 30 * font names that alias to a font family. fontFileArray is the list of information 31 * about each file. Order is the priority order for the font. This is 32 * used internally to determine the order in which to place fallback fonts as 33 * they are read from the configuration files. 34 */ 35struct FontFamily { 36 SkTDArray<const char*> fNames; 37 SkTDArray<FontFileInfo*> fFontFileArray; 38 int order; 39}; 40 41/** 42 * Parses all system font configuration files and returns the results in an 43 * array of FontFamily structures. 44 */ 45void getFontFamilies(SkTDArray<FontFamily*> &fontFamilies); 46 47/** 48 * Parse only the core system font configuration file and return the results in 49 * an array of FontFamily structures. 50 */ 51void getSystemFontFamilies(SkTDArray<FontFamily*> &fontFamilies); 52 53/** 54 * Parse the fallback and vendor system font configuration files and return the 55 * results in an array of FontFamily structures. 56 */ 57void getFallbackFontFamilies(SkTDArray<FontFamily*> &fallbackFonts); 58 59#endif /* FONTHOSTCONFIGURATION_ANDROID_H_ */ 60