#include "include/core/SkFontMgr.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkFixed.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTDArray.h"
#include "include/private/base/SkTLogic.h"
#include "include/private/base/SkTemplates.h"
#include "src/base/SkTSearch.h"
#include "src/core/SkOSFile.h"
#include "src/ports/SkFontMgr_android_parser.h"
#include <expat.h>
#include <stdlib.h>
#include <string.h>
#include <memory>
usingnamespaceskia_private;
#define LMP_SYSTEM_FONTS_FILE …
#define OLD_SYSTEM_FONTS_FILE …
#define FALLBACK_FONTS_FILE …
#define VENDOR_FONTS_FILE …
#define LOCALE_FALLBACK_FONTS_SYSTEM_DIR …
#define LOCALE_FALLBACK_FONTS_VENDOR_DIR …
#define LOCALE_FALLBACK_FONTS_PREFIX …
#define LOCALE_FALLBACK_FONTS_SUFFIX …
#ifndef SK_FONT_FILE_PREFIX
#define SK_FONT_FILE_PREFIX …
#endif
struct FamilyData;
struct TagHandler { … };
struct FamilyData { … };
static bool memeq(const char* s1, const char* s2, size_t n1, size_t n2) { … }
#define MEMEQ(c, s, n) …
#define ATTS_NON_NULL(a, i) …
#define SK_FONTMGR_ANDROID_PARSER_PREFIX …
#define SK_FONTCONFIGPARSER_WARNING(message, ...) …
static bool is_whitespace(char c) { … }
static void trim_string(SkString* s) { … }
static void parse_space_separated_languages(const char* value, size_t valueLen,
TArray<SkLanguage, true>& languages)
{ … }
namespace lmpParser {
static const TagHandler axisHandler = …& file = …axisTag = …axisStyleValue = …bool axisTagIsValid = …bool axisStyleValueIsValid = …i = …const char* name = …const char* value = …nameLen = …valueLen = …int j = …auto& coordinate = …;
static const TagHandler fontHandler = …& file = …fallbackFor;
for (size_t i = …const char* name = …const char* value = …nameLen = …valueLen = …::unique_ptr<FontFamily>* fallbackFamily = …::unique_ptr<FontFamily> newFallbackFamily(
new FontFamily(self->fCurrentFamily->fBasePath, true));
fallbackFamily = …len = …* self = …;
static const TagHandler familyHandler = …* family = …i = …const char* name = …const char* value = …nameLen = …valueLen = …tolc(value);
family->fNames.push_back().set(tolc.lc());
family->fIsFallbackFont = …len = …;
static FontFamily* find_family(FamilyData* self, const SkString& familyName) { … }
static const TagHandler aliasHandler = …aliasName;
SkString to;
int weight = …i = …const char* name = …const char* value = …nameLen = …tolc(value);
aliasName.set(tolc.lc());
} else if (MEMEQ("to", name, nameLen)) { … } else if (MEMEQ("weight", name, nameLen)) { … }
}
FontFamily* targetFamily = …* family = …int i = …;
static const TagHandler familySetHandler = …len = …;
}
namespace jbParser {
static const TagHandler fileHandler = …& currentFamily = …& newFileInfo = …i = …const char* name = …const char* value = …nameLen = …valueLen = …const FontVariant prevVariant = …currentLanguage = …bool showWarning = …* self = …;
static const TagHandler fileSetHandler = …len = …;
static const TagHandler nameHandler = …* self = …tolc(s, len);
self->fCurrentFamily->fNames.back().append(tolc.lc(), len);
}
};
static const TagHandler nameSetHandler = …len = …;
static const TagHandler familyHandler = …i = …const char* value = …len = …;
static const TagHandler familySetHandler = …len = …;
}
static const TagHandler topLevelHandler = …len = …i = …const char* name = …nameLen = …const char* value = …;
static void XMLCALL start_element_handler(void *data, const char *tag, const char **attributes) { … }
static void XMLCALL end_element_handler(void* data, const char* tag) { … }
static void XMLCALL xml_entity_decl_handler(void *data,
const XML_Char *entityName,
int is_parameter_entity,
const XML_Char *value,
int value_length,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName)
{ … }
static const XML_Memory_Handling_Suite sk_XML_alloc = …;
static int parse_config_file(const char* filename, SkTDArray<FontFamily*>& families,
const SkString& basePath, bool isFallback)
{ … }
static int append_system_font_families(SkTDArray<FontFamily*>& fontFamilies,
const SkString& basePath)
{ … }
static void append_fallback_font_families_for_locale(SkTDArray<FontFamily*>& fallbackFonts,
const char* dir,
const SkString& basePath)
{ … }
static void append_system_fallback_font_families(SkTDArray<FontFamily*>& fallbackFonts,
const SkString& basePath)
{ … }
static void mixin_vendor_fallback_font_families(SkTDArray<FontFamily*>& fallbackFonts,
const SkString& basePath)
{ … }
void SkFontMgr_Android_Parser::GetSystemFontFamilies(SkTDArray<FontFamily*>& fontFamilies) { … }
void SkFontMgr_Android_Parser::GetCustomFontFamilies(SkTDArray<FontFamily*>& fontFamilies,
const SkString& basePath,
const char* fontsXml,
const char* fallbackFontsXml,
const char* langFallbackFontsDir)
{ … }
SkLanguage SkLanguage::getParent() const { … }