35#ifdef SK_TYPEFACE_FACTORY_FONTATIONS
51 int countOfFallbackFonts = 0;
52 for (
int i = 0;
i < fontFamilies.
size();
i++) {
53 if (fontFamilies[
i]->fIsFallbackFont) {
54 countOfFallbackFonts++;
57 return countOfFallbackFonts;
62 return (
'a' <= c && c <=
'z') || (
'A' <= c && c <=
'Z');
67 return (
'0' <= c && c <=
'9');
75 !strcmp(fontFamilies[0]->fFonts[0].fFileName.c_str(), firstExpectedFile));
79 for (
const auto& fontFamily : fontFamilies) {
80 for (
const auto&
lang : fontFamily->fLanguages) {
82 for (
size_t i = 0;
i < langString.
size(); ++
i) {
83 int c = langString[
i];
92 for (
int i = 0;
i < fontFamilies.
size(); ++
i) {
94 for (
int j = 0; j < family.
fFonts.
size(); ++j) {
97 file.fFileName[0] >=
'A' &&
98 file.fFileName[0] <=
'Z');
104 for (
int j = 0; j < fontFamily.
fFonts.
size(); ++j) {
109 (
char)((coordinate.axis >> 24) & 0xFF),
110 (
char)((coordinate.axis >> 16) & 0xFF),
111 (
char)((coordinate.axis >> 8) & 0xFF),
112 (
char)((coordinate.axis) & 0xFF),
120 if (!FLAGS_verboseFontMgr) {
124 SkDebugf(
"\n--- Dumping %s\n", label);
125 for (
int i = 0;
i < fontFamilies.
size(); ++
i) {
127 switch(fontFamilies[
i]->fVariant) {
132 SkDebugf(
" basePath %s\n", fontFamilies[
i]->fBasePath.c_str());
133 if (!fontFamilies[
i]->fLanguages.
empty()) {
135 for (
const auto&
lang : fontFamilies[
i]->fLanguages) {
140 for (
int j = 0; j < fontFamilies[
i]->fNames.
size(); ++j) {
141 SkDebugf(
" name %s\n", fontFamilies[
i]->fNames[j].c_str());
144 for (
const auto& [
unused, fallbackFamily] : fontFamilies[
i]->fallbackFamilies) {
145 SkDebugf(
" Fallback for: %s\n", fallbackFamily->fFallbackFor.c_str());
153 double low,
double high,
double inc)
155 double SK_FixedMax_double = nextafter(1 << (
sizeof(
T) * CHAR_BIT -
N - 1), 0.0);
156 double SK_FixedEpsilon_double = (1.0 / (1 <<
N));
159 for (
double f = low;
f < high;
f += inc) {
165 bool b = parse_fixed<N>(
buffer, &fix);
167 double f2 = fix * SK_FixedEpsilon_double;
168 double error = fabs(
f - f2);
181 test_parse_fixed_r<27, int32_t>(
reporter, -8.1, -7.9, 0.000001);
182 test_parse_fixed_r<27, int32_t>(
reporter, -0.1, 0.1, 0.000001);
183 test_parse_fixed_r<27, int32_t>(
reporter, 7.9, 8.1, 0.000001);
184 test_parse_fixed_r<16, int32_t>(
reporter, -0.125, 0.125, 1.0 / (1 << 19));
185 test_parse_fixed_r<16, int32_t>(
reporter, -32768.125, -32766.875, 1.0 / (1 << 17));
186 test_parse_fixed_r<16, int32_t>(
reporter, 32766.875, 32768.125, 1.0 / (1 << 17));
187 test_parse_fixed_r<16, int32_t>(
reporter, -1.1, 1.1, 0.0001);
199#ifdef SK_TYPEFACE_FACTORY_FONTATIONS
200#define DEF_TEST_FONTATIONS(name, reporter) \
201 DEF_TEST(name##Fontations, reporter) { name(reporter, std::make_unique<SkFontScanner_Fontations>()); }
203#define DEF_TEST_FONTATIONS(name, reporter)
206#define DEF_TEST_SCANNERS(name, reporter) \
207 static void name(skiatest::Reporter*, std::unique_ptr<SkFontScanner>); \
208 DEF_TEST(name, reporter) { name(reporter, std::make_unique<SkFontScanner_FreeType>()); } \
209 DEF_TEST_FONTATIONS(name, reporter) \
210 void name(skiatest::Reporter* reporter, std::unique_ptr<SkFontScanner> fs)
215 bool resourcesMissing =
false;
223 if (preV17FontFamilies.
size() > 0) {
230 resourcesMissing =
true;
235 preV17FontFamilies.
reset();
245 if (v17FontFamilies.
size() > 0) {
252 resourcesMissing =
true;
257 v17FontFamilies.
reset();
266 if (v22FontFamilies.
size() > 0) {
273 resourcesMissing =
true;
278 v22FontFamilies.
reset();
280 if (resourcesMissing) {
281 SkDebugf(
"---- Resource files missing for FontConfigParser test\n");
286 constexpr char fontsXmlFilename[] =
"fonts/fonts.xml";
308 for (
int y = 0;
y <
test.height(); ++
y) {
309 for (
int x = 0;
x <
test.width(); ++
x) {
312 if (refColor != testColor) {
321 constexpr char fontsXmlFilename[] =
"fonts/fonts.xml";
343 SkCanvas canvasStream(bitmapStream);
353 paint.setAntiAlias(
true);
354 constexpr float kTextSize = 20;
356 std::unique_ptr<SkStreamAsset> distortableStream(
358 if (!distortableStream) {
365 for (
int i = 0;
i < 10; ++
i) {
369 coordinates[] = {{tag, styleValue}};
371 position = {coordinates,
std::size(coordinates)};
384 constexpr char text[] =
"abc";
398 constexpr char fontsXmlFilename[] =
"fonts/fonts.xml";
static bool isDIGIT(int c)
static void test_parse_fixed(skiatest::Reporter *reporter)
static void DumpLoadedFonts(SkTDArray< FontFamily * > fontFamilies, const char *label)
DECLARE_bool(verboseFontMgr) int CountFallbacks(SkTDArray< FontFamily * > fontFamilies)
static void DumpFiles(const FontFamily &fontFamily)
#define DEF_TEST_SCANNERS(name, reporter)
static bool isALPHA(int c)
static double test_parse_fixed_r(skiatest::Reporter *reporter, double low, double high, double inc)
static void ValidateLoadedFonts(SkTDArray< FontFamily * > fontFamilies, const char *firstExpectedFile, skiatest::Reporter *reporter)
static bool bitmap_compare(const SkBitmap &ref, const SkBitmap &test)
std::unique_ptr< SkStreamAsset > GetResourceAsStream(const char *resource, bool useFileStream)
SkString GetResourcePath(const char *resource)
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API sk_sp< SkFontMgr > SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts *custom)
bool sk_exists(const char *path, SkFILE_Flags=(SkFILE_Flags) 0)
#define SkDoubleToScalar(x)
static constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d)
#define REPORTER_ASSERT(r, cond,...)
SkColor getColor(int x, int y) const
void allocN32Pixels(int width, int height, bool isOpaque=false)
void drawColor(SkColor color, SkBlendMode mode=SkBlendMode::kSrcOver)
void drawString(const char str[], SkScalar x, SkScalar y, const SkFont &font, const SkPaint &paint)
sk_sp< SkTypeface > matchFamilyStyleCharacter(const char familyName[], const SkFontStyle &, const char *bcp47[], int bcp47Count, SkUnichar character) const
sk_sp< SkTypeface > makeFromStream(std::unique_ptr< SkStreamAsset >, int ttcIndex=0) const
sk_sp< SkTypeface > legacyMakeTypeface(const char familyName[], SkFontStyle style) const
static constexpr SkFontStyle Bold()
void setEdging(Edging edging)
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
const char * c_str() const
SkFontStyle fontStyle() const
sk_sp< SkTypeface > makeClone(const SkFontArguments &) const
sk_sp< SkFontMgr > fontMgr
const uint8_t uint32_t uint32_t GError ** error
static float max(float r, float g, float b)
void GetCustomFontFamilies(SkTDArray< FontFamily * > &fontFamilies, const SkString &basePath, const char *fontsXml, const char *fallbackFontsXml, const char *langFallbackFontsDir=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
skia_private::TArray< FontFileInfo, true > fFonts
skia_private::TArray< SkFontArguments::VariationPosition::Coordinate, true > fVariationDesignPosition
const char * fFallbackFontsXml
SystemFontUse fSystemFontUse
static constexpr SkPoint Make(float x, float y)