From 8e8d6fbbceb9d900fec5f2420486d65e04de67da Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 16 Aug 2022 12:48:35 +0000 Subject: [PATCH] Bug 1740530 - patch 10 - Basic reftests for COLRv1 font rendering. r=gfx-reviewers,lsalzman The font here is a copy of Ahem with a COLRv1 table added, using various of the COLRv1 paint and transform tables. This is far from an exhaustive set of tests, but serves to check that basic rendering functionality is working. The reference file uses CSS blocks filled with gradients, etc, to simulate the expected rendering of the colored Ahem glyphs. This is unlikely to be a perfect match in any but the simplest cases, thanks to antialiasing, pixel-rounding, etc., but the results are visually indistinguishable, or virtually so, and the amount of "fuzz" is far less than the differences would be in the case of the COLRv1 glyphs actually being mis-rendered. (There's a try run *without* the fuzz annotations at https://treeherder.mozilla.org/jobs?repo=try&revision=4a2e2f7190661614ecddd223dd7178589d0ec5f2 where the results can be viewed in reftest-analyzer.) We may eventually want to move this or similar tests into WPT, but I'm expecting more extensive test coverage to be a co-operative effort with the other vendors who are also implementing support, so this is intended as an interim step just to ensure we have the basic functionality tested in-tree. Depends on D154585 Differential Revision: https://phabricator.services.mozilla.com/D154586 --- layout/reftests/font-face/CAhem.ttf | Bin 0 -> 10680 bytes layout/reftests/font-face/colrv1-01-ref.html | 43 ++++++++++++++++++ layout/reftests/font-face/colrv1-01.html | 16 +++++++ layout/reftests/font-face/colrv1-02.html | 17 +++++++ layout/reftests/font-face/colrv1-02a-ref.html | 13 ++++++ layout/reftests/font-face/colrv1-02b-ref.html | 13 ++++++ layout/reftests/font-face/reftest.list | 30 ++++++++++++ 7 files changed, 132 insertions(+) create mode 100644 layout/reftests/font-face/CAhem.ttf create mode 100644 layout/reftests/font-face/colrv1-01-ref.html create mode 100644 layout/reftests/font-face/colrv1-01.html create mode 100644 layout/reftests/font-face/colrv1-02.html create mode 100644 layout/reftests/font-face/colrv1-02a-ref.html create mode 100644 layout/reftests/font-face/colrv1-02b-ref.html diff --git a/layout/reftests/font-face/CAhem.ttf b/layout/reftests/font-face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endering:

+
+ + diff --git a/layout/reftests/font-face/colrv1-01.html b/layout/reftests/font-face/colrv1-01.html new file mode 100644 index 000000000000..1ac9bc7ebba5 --- /dev/null +++ b/layout/reftests/font-face/colrv1-01.html @@ -0,0 +1,16 @@ + + + +COLRv1 font test: comparing against CSS representation + + +

COLRv1 font rendering:

+
+ + diff --git a/layout/reftests/font-face/colrv1-02.html b/layout/reftests/font-face/colrv1-02.html new file mode 100644 index 000000000000..14cee4feb50c --- /dev/null +++ b/layout/reftests/font-face/colrv1-02.html @@ -0,0 +1,17 @@ + + + +COLRv1 font test: using the tech() function + + + +
ABC
diff --git a/layout/reftests/font-face/colrv1-02a-ref.html b/layout/reftests/font-face/colrv1-02a-ref.html new file mode 100644 index 000000000000..dbd44cdb50e5 --- /dev/null +++ b/layout/reftests/font-face/colrv1-02a-ref.html @@ -0,0 +1,13 @@ + + + +COLRv1 font test: using the tech() function + + +
ABC
diff --git a/layout/reftests/font-face/colrv1-02b-ref.html b/layout/reftests/font-face/colrv1-02b-ref.html new file mode 100644 index 000000000000..2312909ddc5c --- /dev/null +++ b/layout/reftests/font-face/colrv1-02b-ref.html @@ -0,0 +1,13 @@ + + + +COLRv1 font test: using the tech() function + + +
ABC
diff --git a/layout/reftests/font-face/reftest.list b/layout/reftests/font-face/reftest.list index 322aa5a20457..b74f579f9be1 100644 --- a/layout/reftests/font-face/reftest.list +++ b/layout/reftests/font-face/reftest.list @@ -160,6 +160,36 @@ fuzzy-if(OSX,198-198,172-172) == color-1b.html color-1-ref.html == color-2a.html color-2-ref.html != color-2a.html color-2-notref.html +# COLRv1 (enhanced color font) format +# Comparing COLRv1 glyph rendering to CSS backgrounds we can expect "fuzz" in lots of gradients +# and along antialiased diagonals, etc., but the differences are barely perceptible to the eye. +defaults pref(gfx.font_rendering.colr_v1.enabled,true) +== colrv1-01.html#A colrv1-01-ref.html#A +== colrv1-01.html#B colrv1-01-ref.html#B +fuzzy(0-1,0-10000) == colrv1-01.html#C colrv1-01-ref.html#C +fuzzy(0-1,0-600) == colrv1-01.html#D colrv1-01-ref.html#D +fuzzy(0-1,0-200) == colrv1-01.html#E colrv1-01-ref.html#E +fuzzy(0-1,0-200) == colrv1-01.html#F colrv1-01-ref.html#F +fuzzy(0-1,0-400) == colrv1-01.html#G colrv1-01-ref.html#G +fuzzy(0-1,0-400) == colrv1-01.html#H colrv1-01-ref.html#H +fuzzy(0-1,0-10000) == colrv1-01.html#I colrv1-01-ref.html#I +fuzzy(0-1,0-576) == colrv1-01.html#J colrv1-01-ref.html#J +fuzzy(0-1,0-748) == colrv1-01.html#K colrv1-01-ref.html#K +fuzzy(0-1,0-851) == colrv1-01.html#L colrv1-01-ref.html#L +fuzzy(0-1,0-668) == colrv1-01.html#M colrv1-01-ref.html#M +fuzzy(0-1,0-848) == colrv1-01.html#N colrv1-01-ref.html#N +fuzzy(0-1,0-675) == colrv1-01.html#O colrv1-01-ref.html#O +== colrv1-01.html#P colrv1-01-ref.html#P +fuzzy(0-138,0-318) == colrv1-01.html#Q colrv1-01-ref.html#Q +fuzzy(0-207,0-156) == colrv1-01.html#R colrv1-01-ref.html#R +fuzzy(0-255,0-156) == colrv1-01.html#S colrv1-01-ref.html#S +fuzzy(0-237,0-277) == colrv1-01.html#T colrv1-01-ref.html#T +defaults + +# Check that the tech(color-COLRv1) function responds to whether COLRv1 support is enabled. +pref(gfx.font_rendering.colr_v1.enabled,true) == colrv1-02.html colrv1-02a-ref.html +pref(gfx.font_rendering.colr_v1.enabled,false) == colrv1-02.html colrv1-02b-ref.html + == woff2-1.html woff2-1-ref.html == woff2-totalsfntsize.html woff2-totalsfntsize-ref.html