From 612c73329bc5a996cbae81bd711e7488ec12a5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20R=C3=B6ttsches?= Date: Tue, 9 Nov 2021 16:13:19 +0200 Subject: [PATCH] COLRv1 GM test for foreground color MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated COLRv1 samples font file from https://github.com/googlefonts/color-fonts/pull/80 Bug: skia:12576 Cq-Include-Trybots: luci.skia.skia.primary:Test-Android-Clang-GalaxyS20-GPU-MaliG77-arm64-Release-All-Android_NativeFonts,Test-Debian10-Clang-GCE-CPU-AVX2-x86_64-Debug-All-NativeFonts Change-Id: I18164fda87ffc3a2a05749f55ca61813cac14b41 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/468236 Reviewed-by: Ben Wagner Commit-Queue: Ben Wagner Auto-Submit: Dominik Röttsches --- gm/colrv1.cpp | 14 +++++++++++++- resources/fonts/more_samples-glyf_colr_1.ttf | Bin 5864 -> 6616 bytes 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gm/colrv1.cpp b/gm/colrv1.cpp index 82aefa348a..51fa77005c 100644 --- a/gm/colrv1.cpp +++ b/gm/colrv1.cpp @@ -37,7 +37,8 @@ public: kColorFontsRepoSkew, kColorFontsRepoTransform, kColorFontsRepoClipBox, - kColorFontsRepoComposite + kColorFontsRepoComposite, + kColorFontsRepoForeground }; ColrV1GM(ColrV1TestType testType, SkScalar skewX, SkScalar rotateDeg) @@ -64,6 +65,8 @@ protected: return SkString("clipbox"); case kColorFontsRepoComposite: return SkString("composite"); + case kColorFontsRepoForeground: + return SkString("foreground"); } SkASSERT(false); /* not reached */ return SkString(); @@ -112,6 +115,9 @@ protected: case kColorFontsRepoComposite: fEmojiFont.fGlyphs = {40, 41, 42, 43, 44, 45, 46}; break; + case kColorFontsRepoForeground: + fEmojiFont.fGlyphs = {47, 48, 49, 50, 51, 52, 53, 54}; + break; } } @@ -148,15 +154,20 @@ protected: SkFontMetrics metrics; SkScalar y = 0; + std::vector paint_colors = { + SK_ColorBLACK, SK_ColorGREEN, SK_ColorRED, SK_ColorBLUE}; + auto paint_color_iterator = paint_colors.begin(); for (SkScalar textSize : { 12, 18, 30, 120 }) { font.setSize(textSize); font.getMetrics(&metrics); y += -metrics.fAscent; + paint.setColor(*paint_color_iterator); canvas->drawSimpleText(fEmojiFont.fGlyphs.data(), fEmojiFont.bytesize(), SkTextEncoding::kGlyphID, 10, y, font, paint); y += metrics.fDescent + metrics.fLeading; + paint_color_iterator++; } return DrawResult::kOk; } @@ -181,5 +192,6 @@ DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoTransform, 0.f, 0.f);) DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoClipBox, 0.f, 0.f);) DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoClipBox, -0.5f, 20.f);) DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoComposite, 0.f, 0.f);) +DEF_GM(return new ColrV1GM(ColrV1GM::kColorFontsRepoForeground, 0.f, 0.f);) } // namespace skiagm diff --git a/resources/fonts/more_samples-glyf_colr_1.ttf b/resources/fonts/more_samples-glyf_colr_1.ttf index ae28d15759058056d028467709349cf1f300cbb7..55d4415bd2325780c9890d8c85233a2307233519 100644 GIT binary patch delta 1740 zcmb7^X>3$g6vzMfPG{}NK-;MlY&$J2OPA>^FiUC6G?;)w1)&%uX#40)I}Nirw6Y{R zHIBv)#$sNG4MZbf1mg!uCK^6z^^1|zXiQC9zz}1!iD)#4F_kd>-%Fdcj+i*h@7;6m zx#uqDf8SjDm;M|C06QjNKxF%#-TSWH$W8+lF2MZs_PxEkZ_Fp+K+Wrn3hde6;XCkY z;wm6^(jFX2Dw$m$UwsFVZL|-MBu);`TsS%j7%YJChj>hh)*ZfZkbN`S_&6QbGq}U? zWwe{($+6rCN6O4#agmOEB0Z$EU2*SV!WU>yB$X2x^kN13H_~>clw|DNC*lRb@+)JM zO#0Z^M|;gb1LggI>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