Flutter Engine
The Flutter Engine
Functions
SkFontMgr_Android_Parser Namespace Reference

Functions

void GetSystemFontFamilies (SkTDArray< FontFamily * > &fontFamilies)
 
void GetCustomFontFamilies (SkTDArray< FontFamily * > &fontFamilies, const SkString &basePath, const char *fontsXml, const char *fallbackFontsXml, const char *langFallbackFontsDir=nullptr)
 

Function Documentation

◆ GetCustomFontFamilies()

void SkFontMgr_Android_Parser::GetCustomFontFamilies ( SkTDArray< FontFamily * > &  fontFamilies,
const SkString basePath,
const char *  fontsXml,
const char *  fallbackFontsXml,
const char *  langFallbackFontsDir = nullptr 
)

Parses font configuration files and appends result to fontFamilies.

Definition at line 818 of file SkFontMgr_android_parser.cpp.

823{
824 if (fontsXml) {
825 parse_config_file(fontsXml, fontFamilies, basePath, false);
826 }
827 if (fallbackFontsXml) {
828 parse_config_file(fallbackFontsXml, fontFamilies, basePath, true);
829 }
830 if (langFallbackFontsDir) {
832 langFallbackFontsDir,
833 basePath);
834 }
835}
static void append_fallback_font_families_for_locale(SkTDArray< FontFamily * > &fallbackFonts, const char *dir, const SkString &basePath)
static int parse_config_file(const char *filename, SkTDArray< FontFamily * > &families, const SkString &basePath, bool isFallback)

◆ GetSystemFontFamilies()

void SkFontMgr_Android_Parser::GetSystemFontFamilies ( SkTDArray< FontFamily * > &  fontFamilies)

Parses system font configuration files and appends result to fontFamilies.

Definition at line 802 of file SkFontMgr_android_parser.cpp.

802 {
803 // Version 21 of the system font configuration does not need any fallback configuration files.
804 SkString basePath(getenv("ANDROID_ROOT"));
805 basePath.append(SK_FONT_FILE_PREFIX, sizeof(SK_FONT_FILE_PREFIX) - 1);
806
807 if (append_system_font_families(fontFamilies, basePath) >= 21) {
808 return;
809 }
810
811 // Append all the fallback fonts to system fonts
812 SkTDArray<FontFamily*> fallbackFonts;
813 append_system_fallback_font_families(fallbackFonts, basePath);
814 mixin_vendor_fallback_font_families(fallbackFonts, basePath);
815 fontFamilies.append(fallbackFonts.size(), fallbackFonts.begin());
816}
static void mixin_vendor_fallback_font_families(SkTDArray< FontFamily * > &fallbackFonts, const SkString &basePath)
static void append_system_fallback_font_families(SkTDArray< FontFamily * > &fallbackFonts, const SkString &basePath)
#define SK_FONT_FILE_PREFIX
static int append_system_font_families(SkTDArray< FontFamily * > &fontFamilies, const SkString &basePath)
int size() const
Definition: SkTDArray.h:138
T * begin()
Definition: SkTDArray.h:150
T * append()
Definition: SkTDArray.h:191