From f79673bbae0a662c1428755e2719dadf944e4ba1 Mon Sep 17 00:00:00 2001 From: tomhudson Date: Tue, 5 Aug 2014 06:36:11 -0700 Subject: [PATCH] Test and generalize font configuration parser Add a basic unit test for the Android font configuration parser. Add a check for the new LMP file format; on detection, switch to a new (as-yet unwritten) parser. R=bungeman@google.com, djsollen@google.com, tomhudson@google.com Author: tomhudson@chromium.org Review URL: https://codereview.chromium.org/439813002 --- gyp/tests.gypi | 11 + .../android_fonts/pre_v17/fallback_fonts.xml | 77 ++++++ .../android_fonts/pre_v17/system_fonts.xml | 80 ++++++ .../android_fonts/v17/fallback_fonts.xml | 213 ++++++++++++++++ resources/android_fonts/v17/system_fonts.xml | 138 +++++++++++ resources/android_fonts/v22/fonts.xml | 232 ++++++++++++++++++ src/ports/SkFontConfigParser_android.cpp | 125 +++++++--- tests/FontConfigParser.cpp | 69 ++++++ 8 files changed, 905 insertions(+), 40 deletions(-) create mode 100644 resources/android_fonts/pre_v17/fallback_fonts.xml create mode 100644 resources/android_fonts/pre_v17/system_fonts.xml create mode 100644 resources/android_fonts/v17/fallback_fonts.xml create mode 100644 resources/android_fonts/v17/system_fonts.xml create mode 100644 resources/android_fonts/v22/fonts.xml create mode 100644 tests/FontConfigParser.cpp diff --git a/gyp/tests.gypi b/gyp/tests.gypi index cf4ca35dcb..77dba694d6 100644 --- a/gyp/tests.gypi +++ b/gyp/tests.gypi @@ -26,6 +26,17 @@ 'tools.gyp:sk_tool_utils', ], 'conditions': [ + [ 'skia_os == "android"', { + 'dependencies': [ + 'ports.gyp:ports', + ], + 'include_dirs': [ + '../src/ports', + ], + 'sources': [ + '../tests/FontConfigParser.cpp', + ], + }], [ 'skia_android_framework == 1', { 'libraries': [ '-ldl', diff --git a/resources/android_fonts/pre_v17/fallback_fonts.xml b/resources/android_fonts/pre_v17/fallback_fonts.xml new file mode 100644 index 0000000000..e23004b3d9 --- /dev/null +++ b/resources/android_fonts/pre_v17/fallback_fonts.xml @@ -0,0 +1,77 @@ + + + + + + DroidNaskh-Regular.ttf + + + + + DroidSansEthiopic-Regular.ttf + + + + + DroidSansHebrew-Regular.ttf + DroidSansHebrew-Bold.ttf + + + + + DroidSansThai.ttf + + + + + DroidSansArmenian.ttf + + + + + DroidSansGeorgian.ttf + + + + + Lohit-Devanagari.ttf + + + + + Lohit-Bengali.ttf + + + + + Lohit-Tamil.ttf + + + + + DroidSansFallback.ttf + + + diff --git a/resources/android_fonts/pre_v17/system_fonts.xml b/resources/android_fonts/pre_v17/system_fonts.xml new file mode 100644 index 0000000000..d2fe5467d2 --- /dev/null +++ b/resources/android_fonts/pre_v17/system_fonts.xml @@ -0,0 +1,80 @@ + + + + + + + sans-serif + arial + helvetica + tahoma + verdana + + + Roboto-Regular.ttf + Roboto-Bold.ttf + Roboto-Italic.ttf + Roboto-BoldItalic.ttf + + + + + + serif + times + times new roman + palatino + georgia + baskerville + goudy + fantasy + cursive + ITC Stone Serif + + + DroidSerif-Regular.ttf + DroidSerif-Bold.ttf + DroidSerif-Italic.ttf + DroidSerif-BoldItalic.ttf + + + + + + Droid Sans + + + DroidSans.ttf + DroidSans-Bold.ttf + + + + + + monospace + courier + courier new + monaco + + + DroidSansMono.ttf + + + + diff --git a/resources/android_fonts/v17/fallback_fonts.xml b/resources/android_fonts/v17/fallback_fonts.xml new file mode 100644 index 0000000000..ede7ef47d2 --- /dev/null +++ b/resources/android_fonts/v17/fallback_fonts.xml @@ -0,0 +1,213 @@ + + + + + + DroidNaskh-Regular.ttf + + + + + DroidNaskhUI-Regular.ttf + + + + + DroidSansEthiopic-Regular.ttf + + + + + DroidSansHebrew-Regular.ttf + DroidSansHebrew-Bold.ttf + + + + + NotoSansThai-Regular.ttf + NotoSansThai-Bold.ttf + + + + + NotoSansThaiUI-Regular.ttf + NotoSansThaiUI-Bold.ttf + + + + + DroidSansArmenian.ttf + + + + + DroidSansGeorgian.ttf + + + + + NotoSansDevanagari-Regular.ttf + NotoSansDevanagari-Bold.ttf + + + + + NotoSansDevanagariUI-Regular.ttf + NotoSansDevanagariUI-Bold.ttf + + + + + NotoSansTamil-Regular.ttf + NotoSansTamil-Bold.ttf + + + + + NotoSansTamilUI-Regular.ttf + NotoSansTamilUI-Bold.ttf + + + + + NotoSansMalayalam-Regular.ttf + NotoSansMalayalam-Bold.ttf + + + + + NotoSansMalayalamUI-Regular.ttf + NotoSansMalayalamUI-Bold.ttf + + + + + NotoSansBengali-Regular.ttf + NotoSansBengali-Bold.ttf + + + + + NotoSansBengaliUI-Regular.ttf + NotoSansBengaliUI-Bold.ttf + + + + + NotoSansTelugu-Regular.ttf + NotoSansTelugu-Bold.ttf + + + + + NotoSansTeluguUI-Regular.ttf + NotoSansTeluguUI-Bold.ttf + + + + + NotoSansKannada-Regular.ttf + NotoSansKannada-Bold.ttf + + + + + NotoSansKannadaUI-Regular.ttf + NotoSansKannadaUI-Bold.ttf + + + + + NotoSansKhmer-Regular.ttf + NotoSansKhmer-Bold.ttf + + + + + NotoSansKhmerUI-Regular.ttf + NotoSansKhmerUI-Bold.ttf + + + + + NotoSansLao-Regular.ttf + NotoSansLao-Bold.ttf + + + + + NotoSansLaoUI-Regular.ttf + NotoSansLaoUI-Bold.ttf + + + + + NanumGothic.ttf + + + + + Padauk-book.ttf + Padauk-bookbold.ttf + + + + + NotoSansSymbols-Regular.ttf + + + + + AndroidEmoji.ttf + + + + + NotoColorEmoji.ttf + + + + + DroidSansFallback.ttf + + + + + MTLmr3m.ttf + + + + diff --git a/resources/android_fonts/v17/system_fonts.xml b/resources/android_fonts/v17/system_fonts.xml new file mode 100644 index 0000000000..549f061b0c --- /dev/null +++ b/resources/android_fonts/v17/system_fonts.xml @@ -0,0 +1,138 @@ + + + + + + + sans-serif + arial + helvetica + tahoma + verdana + + + Roboto-Regular.ttf + Roboto-Bold.ttf + Roboto-Italic.ttf + Roboto-BoldItalic.ttf + + + + + + sans-serif-light + + + Roboto-Light.ttf + Roboto-LightItalic.ttf + + + + + + sans-serif-thin + + + Roboto-Thin.ttf + Roboto-ThinItalic.ttf + + + + + + sans-serif-condensed + + + RobotoCondensed-Regular.ttf + RobotoCondensed-Bold.ttf + RobotoCondensed-Italic.ttf + RobotoCondensed-BoldItalic.ttf + + + + + serif + times + times new roman + palatino + georgia + baskerville + goudy + fantasy + ITC Stone Serif + + + DroidSerif-Regular.ttf + DroidSerif-Bold.ttf + DroidSerif-Italic.ttf + DroidSerif-BoldItalic.ttf + + + + + + Droid Sans + + + DroidSans.ttf + DroidSans-Bold.ttf + + + + + + monospace + courier + courier new + monaco + + + DroidSansMono.ttf + + + + + + casual + + + ComingSoon.ttf + + + + + + cursive + + + DancingScript-Regular.ttf + DancingScript-Bold.ttf + + + + + + sans-serif-smallcaps + + + CarroisGothicSC-Regular.ttf + + + + diff --git a/resources/android_fonts/v22/fonts.xml b/resources/android_fonts/v22/fonts.xml new file mode 100644 index 0000000000..180d5f7d9c --- /dev/null +++ b/resources/android_fonts/v22/fonts.xml @@ -0,0 +1,232 @@ + + + + + Roboto-Thin.ttf + Roboto-ThinItalic.ttf + Roboto-Light.ttf + Roboto-LightItalic.ttf + Roboto-Regular.ttf + Roboto-Italic.ttf + Roboto-Medium.ttf + Roboto-MediumItalic.ttf + Roboto-Bold.ttf + Roboto-BoldItalic.ttf + Roboto-Black.ttf + Roboto-BlackItalic.ttf + + + + + + + + + + + RobotoCondensed-Light.ttf + RobotoCondensed-LightItalic.ttf + RobotoCondensed-Regular.ttf + RobotoCondensed-Italic.ttf + RobotoCondensed-Bold.ttf + RobotoCondensed-BoldItalic.ttf + + + + + + NotoSerif-Regular.ttf + NotoSerif-Bold.ttf + NotoSerif-Italic.ttf + NotoSerif-BoldItalic.ttf + + + + + + + + + + + + DroidSansMono.ttf + + + + + + + ComingSoon.ttf + + + + DancingScript-Regular.ttf + DancingScript-Bold.ttf + + + + CarroisGothicSC-Regular.ttf + + + + + NotoNaskh-Regular.ttf + NotoNaskh-Bold.ttf + + + NotoNaskhUI-Regular.ttf + NotoNaskhUI-Bold.ttf + + + NotoSansEthiopic-Regular.ttf + NotoSansEthiopic-Bold.ttf + + + NotoSansHebrew-Regular.ttf + NotoSansHebrew-Bold.ttf + + + NotoSansThai-Regular.ttf + NotoSansThai-Bold.ttf + + + NotoSansThaiUI-Regular.ttf + NotoSansThaiUI-Bold.ttf + + + NotoSansArmenian-Regular.ttf + NotoSansArmenian-Bold.ttf + + + NotoSansGeorgian-Regular.ttf + NotoSansGeorgian-Bold.ttf + + + NotoSansDevanagari-Regular.ttf + NotoSansDevanagari-Bold.ttf + + + NotoSansDevanagariUI-Regular.ttf + NotoSansDevanagariUI-Bold.ttf + + + + NotoSansGujarati-Regular.ttf + NotoSansGujarati-Bold.ttf + + + NotoSansGujaratiUI-Regular.ttf + NotoSansGujaratiUI-Bold.ttf + + + + NotoSansGurmukhi-Regular.ttf + NotoSansGurmukhi-Bold.ttf + + + NotoSansGurmukhiUI-Regular.ttf + NotoSansGurmukhiUI-Bold.ttf + + + NotoSansTamil-Regular.ttf + NotoSansTamil-Bold.ttf + + + NotoSansTamilUI-Regular.ttf + NotoSansTamilUI-Bold.ttf + + + NotoSansMalayalam-Regular.ttf + NotoSansMalayalam-Bold.ttf + + + NotoSansMalayalamUI-Regular.ttf + NotoSansMalayalamUI-Bold.ttf + + + NotoSansBengali-Regular.ttf + NotoSansBengali-Bold.ttf + + + NotoSansBengaliUI-Regular.ttf + NotoSansBengaliUI-Bold.ttf + + + NotoSansTelugu-Regular.ttf + NotoSansTelugu-Bold.ttf + + + NotoSansTeluguUI-Regular.ttf + NotoSansTeluguUI-Bold.ttf + + + NotoSansKannada-Regular.ttf + NotoSansKannada-Bold.ttf + + + NotoSansKannadaUI-Regular.ttf + NotoSansKannadaUI-Bold.ttf + + + NotoSansSinhala-Regular.ttf + NotoSansSinhala-Bold.ttf + + + NotoSansKhmer-Regular.ttf + NotoSansKhmer-Bold.ttf + + + NotoSansKhmerUI-Regular.ttf + NotoSansKhmerUI-Bold.ttf + + + NotoSansLao-Regular.ttf + NotoSansLao-Bold.ttf + + + NotoSansLaoUI-Regular.ttf + NotoSansLaoUI-Bold.ttf + + + NotoSansMyanmar-Regular.ttf + NotoSansMyanmar-Bold.ttf + + + NotoSansMyanmarUI-Regular.ttf + NotoSansMyanmarUI-Bold.ttf + + + NotoSansCherokee-Regular.ttf + + + NotoSansCanadianAboriginal-Regular.ttf + + + NotoSansYi-Regular.ttf + + + NotoSansHans-Regular.otf + + + NotoSansHant-Regular.otf + + + NotoSansJP-Regular.otf + + + NotoSansKR-Regular.otf + + + NanumGothic.ttf + + + NotoSansSymbols-Regular-Subsetted.ttf + + + NotoColorEmoji.ttf + + + MTLmr3m.ttf + + diff --git a/src/ports/SkFontConfigParser_android.cpp b/src/ports/SkFontConfigParser_android.cpp index cc2ca8cad9..fbbb6a627a 100644 --- a/src/ports/SkFontConfigParser_android.cpp +++ b/src/ports/SkFontConfigParser_android.cpp @@ -20,6 +20,13 @@ #define FALLBACK_FONTS_FILE "/system/etc/fallback_fonts.xml" #define VENDOR_FONTS_FILE "/vendor/etc/fallback_fonts.xml" +/** + * This file contains TWO parsers: one for JB and earlier (system_fonts.xml / + * fallback_fonts.xml), one for LMP and later (fonts.xml). + * We start with the JB parser, and if we detect a tag with + * version 21 or higher we switch to the LMP parser. + */ + // These defines are used to determine the kind of tag that we're currently // populating with data. We only care about the sibling tags nameset and fileset // for now. @@ -46,6 +53,45 @@ struct FamilyData { int currentTag; // A flag to indicate whether we're in nameset/fileset tags }; +/** http://www.w3.org/TR/html-markup/datatypes.html#common.data.integer.non-negative-def */ +template static bool parseNonNegativeInteger(const char* s, T* value) { + SK_COMPILE_ASSERT(std::numeric_limits::is_integer, T_must_be_integer); + const T nMax = std::numeric_limits::max() / 10; + const T dMax = std::numeric_limits::max() - (nMax * 10); + T n = 0; + for (; *s; ++s) { + // Check if digit + if (*s < '0' || '9' < *s) { + return false; + } + int d = *s - '0'; + // Check for overflow + if (n > nMax || (n == nMax && d > dMax)) { + return false; + } + n = (n * 10) + d; + } + *value = n; + return true; +} + +namespace lmpParser { + +void startElementHandler(void* data, const char* tag, + const char** attributes) { + //SkDebugf("lmp started %s", tag); +} + +void endElementHandler(void* data, const char* tag) { + + //SkDebugf("lmp ended %s", tag); + +} + +} // lmpParser + +namespace jbParser { + /** * Handler for arbitrary text. This is used to parse the text inside each name * or file tag. The resulting strings are put into the fNames or FontFileInfo arrays. @@ -73,34 +119,11 @@ static void textHandler(void *data, const char *s, int len) { } } -/** http://www.w3.org/TR/html-markup/datatypes.html#common.data.integer.non-negative-def */ -template static bool parseNonNegativeInteger(const char* s, T* value) { - SK_COMPILE_ASSERT(std::numeric_limits::is_integer, T_must_be_integer); - const T nMax = std::numeric_limits::max() / 10; - const T dMax = std::numeric_limits::max() - (nMax * 10); - T n = 0; - for (; *s; ++s) { - // Check if digit - if (*s < '0' || '9' < *s) { - return false; - } - int d = *s - '0'; - // Check for overflow - if (n > nMax || (n == nMax && d > dMax)) { - return false; - } - n = (n * 10) + d; - } - *value = n; - return true; -} - /** * Handler for font files. This processes the attributes for language and * variants then lets textHandler handle the actual file name */ static void fontFileElementHandler(FamilyData *familyData, const char **attributes) { - FontFileInfo& newFileInfo = familyData->currentFamily->fFontFiles.push_back(); if (attributes) { int currentAttributeIndex = 0; @@ -109,15 +132,16 @@ static void fontFileElementHandler(FamilyData *familyData, const char **attribut const char* attributeValue = attributes[currentAttributeIndex+1]; int nameLength = strlen(attributeName); int valueLength = strlen(attributeValue); - if (strncmp(attributeName, "variant", nameLength) == 0) { - if (strncmp(attributeValue, "elegant", valueLength) == 0) { + if (nameLength == 7 && strncmp(attributeName, "variant", nameLength) == 0) { + if (valueLength == 7 && strncmp(attributeValue, "elegant", valueLength) == 0) { newFileInfo.fPaintOptions.setFontVariant(SkPaintOptionsAndroid::kElegant_Variant); - } else if (strncmp(attributeValue, "compact", valueLength) == 0) { + } else if (valueLength == 7 && + strncmp(attributeValue, "compact", valueLength) == 0) { newFileInfo.fPaintOptions.setFontVariant(SkPaintOptionsAndroid::kCompact_Variant); } - } else if (strncmp(attributeName, "lang", nameLength) == 0) { + } else if (nameLength == 4 && strncmp(attributeName, "lang", nameLength) == 0) { newFileInfo.fPaintOptions.setLanguage(attributeValue); - } else if (strncmp(attributeName, "index", nameLength) == 0) { + } else if (nameLength == 5 && strncmp(attributeName, "index", nameLength) == 0) { int value; if (parseNonNegativeInteger(attributeValue, &value)) { newFileInfo.fIndex = value; @@ -134,13 +158,26 @@ static void fontFileElementHandler(FamilyData *familyData, const char **attribut } /** - * Handler for the start of a tag. The only tags we expect are family, nameset, - * fileset, name, and file. + * Handler for the start of a tag. The only tags we expect are familyset, family, + * nameset, fileset, name, and file. */ static void startElementHandler(void *data, const char *tag, const char **atts) { FamilyData *familyData = (FamilyData*) data; int len = strlen(tag); - if (strncmp(tag, "family", len)== 0) { + if (len == 9 && strncmp(tag, "familyset", len) == 0) { + // The familyset tag has an optional "version" attribute with an integer value >= 0 + for (int i = 0; atts[i] != NULL; i += 2) { + int nameLen = strlen(atts[i]); + if (nameLen == 7 && strncmp(atts[i], "version", nameLen)) continue; + const char* valueString = atts[i+1]; + int version; + if (parseNonNegativeInteger(valueString, &version) && (version >= 21)) { + XML_SetElementHandler(*familyData->parser, + lmpParser::startElementHandler, + lmpParser::endElementHandler); + } + } + } else if (len == 6 && strncmp(tag, "family", len) == 0) { familyData->currentFamily = new FontFamily(); familyData->currentFamily->order = -1; // The Family tag has an optional "order" attribute with an integer value >= 0 @@ -148,8 +185,7 @@ static void startElementHandler(void *data, const char *tag, const char **atts) for (int i = 0; atts[i] != NULL; i += 2) { const char* valueString = atts[i+1]; int value; - int len = sscanf(valueString, "%d", &value); - if (len > 0) { + if (parseNonNegativeInteger(valueString, &value)) { familyData->currentFamily->order = value; } } @@ -157,10 +193,10 @@ static void startElementHandler(void *data, const char *tag, const char **atts) familyData->currentTag = NAMESET_TAG; } else if (len == 7 && strncmp(tag, "fileset", len) == 0) { familyData->currentTag = FILESET_TAG; - } else if (strncmp(tag, "name", len) == 0 && familyData->currentTag == NAMESET_TAG) { + } else if (len == 4 && strncmp(tag, "name", len) == 0 && familyData->currentTag == NAMESET_TAG) { // If it's a Name, parse the text inside XML_SetCharacterDataHandler(*familyData->parser, textHandler); - } else if (strncmp(tag, "file", len) == 0 && familyData->currentTag == FILESET_TAG) { + } else if (len == 4 && strncmp(tag, "file", len) == 0 && familyData->currentTag == FILESET_TAG) { // If it's a file, parse the attributes, then parse the text inside fontFileElementHandler(familyData, atts); } @@ -173,7 +209,7 @@ static void startElementHandler(void *data, const char *tag, const char **atts) static void endElementHandler(void *data, const char *tag) { FamilyData *familyData = (FamilyData*) data; int len = strlen(tag); - if (strncmp(tag, "family", len)== 0) { + if (len == 6 && strncmp(tag, "family", len)== 0) { // Done parsing a Family - store the created currentFamily in the families array *familyData->families.append() = familyData->currentFamily; familyData->currentFamily = NULL; @@ -181,13 +217,19 @@ static void endElementHandler(void *data, const char *tag) { familyData->currentTag = NO_TAG; } else if (len == 7 && strncmp(tag, "fileset", len) == 0) { familyData->currentTag = NO_TAG; - } else if ((strncmp(tag, "name", len) == 0 && familyData->currentTag == NAMESET_TAG) || - (strncmp(tag, "file", len) == 0 && familyData->currentTag == FILESET_TAG)) { + } else if ((len == 4 && + strncmp(tag, "name", len) == 0 && + familyData->currentTag == NAMESET_TAG) || + (len == 4 && + strncmp(tag, "file", len) == 0 && + familyData->currentTag == FILESET_TAG)) { // Disable the arbitrary text handler installed to load Name data XML_SetCharacterDataHandler(*familyData->parser, NULL); } } +} // namespace jbParser + /** * This function parses the given filename and stores the results in the given * families array. @@ -237,7 +279,8 @@ static void parseConfigFile(const char *filename, SkTDArray &famili XML_Parser parser = XML_ParserCreate(NULL); FamilyData *familyData = new FamilyData(&parser, families); XML_SetUserData(parser, familyData); - XML_SetElementHandler(parser, startElementHandler, endElementHandler); + // Start parsing oldschool; switch these in flight if we detect a newer version of the file. + XML_SetElementHandler(parser, jbParser::startElementHandler, jbParser::endElementHandler); char buffer[512]; bool done = false; @@ -309,7 +352,9 @@ void SkFontConfigParser::GetTestFontFamilies(SkTDArray &fontFamilie parseConfigFile(testMainConfigFile, fontFamilies); SkTDArray fallbackFonts; - parseConfigFile(testFallbackConfigFile, fallbackFonts); + if (NULL != testFallbackConfigFile) { + parseConfigFile(testFallbackConfigFile, fallbackFonts); + } // Append all fallback fonts to system fonts for (int i = 0; i < fallbackFonts.count(); ++i) { diff --git a/tests/FontConfigParser.cpp b/tests/FontConfigParser.cpp new file mode 100644 index 0000000000..78d01d95b9 --- /dev/null +++ b/tests/FontConfigParser.cpp @@ -0,0 +1,69 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "Resources.h" +#include "SkFontConfigParser_android.h" +#include "Test.h" + +void ValidateLoadedFonts(SkTDArray fontFamilies, + skiatest::Reporter* reporter) { + REPORTER_ASSERT(reporter, fontFamilies[0]->fNames.count() == 5); + REPORTER_ASSERT(reporter, !strcmp(fontFamilies[0]->fNames[0].c_str(), "sans-serif")); + REPORTER_ASSERT(reporter, + !strcmp(fontFamilies[0]->fFontFiles[0].fFileName.c_str(), + "Roboto-Regular.ttf")); + REPORTER_ASSERT(reporter, !fontFamilies[0]->fIsFallbackFont); + +} + +void DumpLoadedFonts(SkTDArray fontFamilies) { +#if SK_DEBUG_FONTS + for (int i = 0; i < fontFamilies.count(); ++i) { + SkDebugf("Family %d:\n", i); + for (int j = 0; j < fontFamilies[i]->fNames.count(); ++j) { + SkDebugf(" name %s\n", fontFamilies[i]->fNames[j].c_str()); + } + } +#endif // SK_DEBUG_FONTS +} + +DEF_TEST(FontConfigParserAndroid, reporter) { + + SkTDArray preV17FontFamilies; + SkFontConfigParser::GetTestFontFamilies(preV17FontFamilies, + GetResourcePath("android_fonts/pre_v17/system_fonts.xml").c_str(), + GetResourcePath("android_fonts/pre_v17/fallback_fonts.xml").c_str()); + + REPORTER_ASSERT(reporter, preV17FontFamilies.count() == 14); + + DumpLoadedFonts(preV17FontFamilies); + ValidateLoadedFonts(preV17FontFamilies, reporter); + + SkTDArray v17FontFamilies; + SkFontConfigParser::GetTestFontFamilies(v17FontFamilies, + GetResourcePath("android_fonts/v17/system_fonts.xml").c_str(), + GetResourcePath("android_fonts/v17/fallback_fonts.xml").c_str()); + + + REPORTER_ASSERT(reporter, v17FontFamilies.count() == 41); + + DumpLoadedFonts(v17FontFamilies); + ValidateLoadedFonts(v17FontFamilies, reporter); + + SkTDArray v22FontFamilies; + SkFontConfigParser::GetTestFontFamilies(v22FontFamilies, + GetResourcePath("android_fonts/v22/fonts.xml").c_str(), + NULL); + + //REPORTER_ASSERT(reporter, v22FontFamilies.count() > 0); + if (v22FontFamilies.count() > 0) { + REPORTER_ASSERT(reporter, v22FontFamilies[0]->fNames.count() > 0); + } + + //ValidateLoadedFonts(v22FontFamilies, reporter); +} + -- 2.34.1