From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../tests/css/css-fonts/matching/META.yml | 5 ++ .../tests/css/css-fonts/matching/README.md | 50 ++++++++++++++++ .../fixed-stretch-style-over-weight-ref.html | 28 +++++++++ .../matching/fixed-stretch-style-over-weight.html | 39 +++++++++++++ .../tests/css/css-fonts/matching/font-matching.css | 60 +++++++++++++++++++ .../css-fonts/matching/font-unicode-PUA-ref.html | 24 ++++++++ .../css/css-fonts/matching/font-unicode-PUA.html | 25 ++++++++ .../matching/range-descriptor-reversed-ref.html | 20 +++++++ .../matching/range-descriptor-reversed.html | 28 +++++++++ .../matching/resources/variabletest_matching.ttf | Bin 0 -> 4648 bytes .../stretch-distance-over-weight-distance-ref.html | 28 +++++++++ .../stretch-distance-over-weight-distance.html | 63 ++++++++++++++++++++ .../style-ranges-over-weight-direction-ref.html | 28 +++++++++ .../style-ranges-over-weight-direction.html | 65 +++++++++++++++++++++ 14 files changed, 463 insertions(+) create mode 100644 testing/web-platform/tests/css/css-fonts/matching/META.yml create mode 100644 testing/web-platform/tests/css/css-fonts/matching/README.md create mode 100644 testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight-ref.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/font-matching.css create mode 100644 testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-ref.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed-ref.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/resources/variabletest_matching.ttf create mode 100644 testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance-ref.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction-ref.html create mode 100644 testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction.html (limited to 'testing/web-platform/tests/css/css-fonts/matching') diff --git a/testing/web-platform/tests/css/css-fonts/matching/META.yml b/testing/web-platform/tests/css/css-fonts/matching/META.yml new file mode 100644 index 0000000000..53487a6d85 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/META.yml @@ -0,0 +1,5 @@ +suggested_reviewers: + - drott + - fantasai + - litherum + - svgeesus diff --git a/testing/web-platform/tests/css/css-fonts/matching/README.md b/testing/web-platform/tests/css/css-fonts/matching/README.md new file mode 100644 index 0000000000..7d333c5bca --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/README.md @@ -0,0 +1,50 @@ +# Stretch, Style, Weight Matching Tests +This directory contains a set of tests for [the font style matching algorithm, section 5.2](https://drafts.csswg.org/css-fonts-4/#font-style-matching) of the [CSS Fonts Module Level 4](https://drafts.csswg.org/css-fonts-4/) specification. + +In Level 4 of the spec, the font style matching algorithm has been extended to +support [OpenType Variations](https://www.microsoft.com/typography/otspec/otvaroverview.htm). This means, the +`@font-face` property descriptors accept ranges for `font-style`, `font-stretch` and `font-weight` and the matching +algorithm has been modified to take these into account, and to set variable fonts axis parameters accordingly. + +## Test Font + +For testing font matching with Variations support a test font called **Variable Test Axis Matching** was created (`variabletest_matching.ttf`). + +The design goal for this font is to match variable glyphs against non-variable, static reference glyphs. The variable glyphs are +scaled according to variation axes for stretch, style, weight. The reference glyphs are not subject to variation interpolation. + +### Test Glyphs +The test font contains glyphs M, N, O, P which scale according to the `wdth`, `slnt`, `ital`, and `wght` registered axes respectively. Glyphs M, N, O have zero advance width. When they are combined with the last, the P glyph, which has a width of 2000 FUnits, they form a full "test grapheme". The glyphs M, N, O, P line up vertically to form something resembling a bar chart of the applied axis parameters. For example, when the `wdth` design space coordinate is set to 100, the M bar glyph is 200 FUnits wide, when it is set to 500, the M bar glyph is 1000 FUnits wide. + +### Reference Glyphs + +The **Variable Test Axis Matching** font contains reference glyphs 0-9 to match different stops in the design coordinates space of the `wdth` axis, from 0 matching 200 FUnits to 9 matching 2000 FUnits. Analogously, glyphs p, q, w, e, r, t, y, u (the row between the numbers on a QWERTY keyboard) line up to match the N glyph at various stops for `slnt`. Glyphs ;, a, s, d, e, f, g, h, j, k, l match the O glyph for `ital`, and finally /, z, x, c, v, b, n, m match the P glyph for `wdth`. + + +### Building reference tests + +Using the **Variable Test Axis Matching** font, [reference tests](https://web-platform-tests.org/writing-tests/reftests.html) in this directory are created as follows: + + 1. Define `@font-face`s with range expressions, which trigger variation axes to be applied to the variable font. + 2. Use CSS style definitions to request font faces from the set of declared `@font-face`s and use blocks of the glyph sequence MNOP. + 3. To avoid flakiness, add reftest-wait to the html root element and use JS to remove it once font loading is complete. + 4. When the test is run, a screenshot is generated from the resulting output rendering. + 5. Define a reference rendering in a *-ref.html file, using only the non-variable reference glyphs q-p, a-;, z-/. + 6. When the test is run, a screenshot for the reference rendering is generated. + 7. For the test to pass the screenshot from 4. using OpenType Variations is compared to the reference screenshot from 6. (which is no using OpenType variations). + +## Font Glyphs Reference + +The following table explains the relationship between the M, N, O, P variation axis controlled glyphs and the non-scaled glyphs used as references. The values are specified as OpenType axis parameter values. CSS values are mapped to to those values, for example from CSS font-weight values straight to `wght`, for width from percentages straight to `wdth`. For `slnt` the CSS values are positive clockwise, but the OpenType values are positive turning counterclockwise. Here the mapping is inverted, i.e. the CSS value is multiple by -1. Compare the note in [the CSS font style property](https://drafts.csswg.org/css-fonts/#font-style-prop). + +| Bar Length in FUnits | 200 | 400 | 600 | 800 | 1000 | 1200 | 1400 | 1600 | 1800 +| :---: | :---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: |:---: | +| Glyph **N**, Style, `slnt` | 90 | 67.5 | 45 | 20 | 0.00 | -20 | -45 | -67.5 | -90 +| Glyph **M**, Stretch Axis `wdth` | 50 | 62.5 | 75 | 87.5 | 100 | 112.5 | 125 | 150 | 200 +| Glyph **O**, Style, `ital` | 0 | 0.125 | 0.25 | 0.375 | 0.5 | 0.625 | 0.75 | 0.875 | 1 +| Glyph **P**, Weight, `wght` | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 +| **Ref Glyphs for:** | | | | | | | | | +| **M** | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 +| **N** | p | q | w | e | r | t | y | u | i +| **O** | ; | a | s | d | f | g | h | j | k +| **P** | / | z | x | c | v | b | n | m | , diff --git a/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight-ref.html b/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight-ref.html new file mode 100644 index 0000000000..16826307c8 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight-ref.html @@ -0,0 +1,28 @@ + + + + +4q;n + 4q;n + 4w;n + 4w;n + 4y;x + 4y;x + 4y;x + 4u;x + 4u;x + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight.html b/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight.html new file mode 100644 index 0000000000..c2b27be120 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/fixed-stretch-style-over-weight.html @@ -0,0 +1,39 @@ + + + + + + + +MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/font-matching.css b/testing/web-platform/tests/css/css-fonts/matching/font-matching.css new file mode 100644 index 0000000000..ebbef02f62 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/font-matching.css @@ -0,0 +1,60 @@ +body { + font-family: variable_axes, sans-serif; + font-size: 80px; + font-synthesis: none; +} + +#stretch_style_weight_1 { + font-stretch: 50%; + font-style: oblique -90deg; + font-weight: 100; +} + +#stretch_style_weight_2 { + font-stretch: 62.50%; + font-style: oblique -67.5deg; + font-weight: 200; +} + +#stretch_style_weight_3 { + font-stretch: 75%; + font-style: oblique -45deg; + font-weight: 300; +} + +#stretch_style_weight_4 { + font-stretch: 87.50%; + font-style: oblique -20deg; + font-weight: 400; +} + +#stretch_style_weight_5 { + font-stretch: 100%; + font-style: oblique 0deg; + font-weight: 500; +} + +#stretch_style_weight_6 { + font-stretch: 112.50%; + font-style: oblique 20deg; + font-weight: 600; +} + +#stretch_style_weight_7 { + font-stretch: 125%; + font-style: oblique 45deg; + font-weight: 700; +} + +#stretch_style_weight_8 { + font-stretch: 150%; + font-style: oblique 67.5deg; + font-weight: 800; +} + +#stretch_style_weight_9 { + font-stretch: 200%; + font-style: oblique 90deg; + font-weight: 900; +} + diff --git a/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-ref.html b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-ref.html new file mode 100644 index 0000000000..01b95e8e72 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA-ref.html @@ -0,0 +1,24 @@ + + + + + + + + +"If a given character is a Private-Use Area Unicode codepoint, user agents must only match font families named in the font-family list that are not generic families. If none of the families named in the font-family list contain a glyph for that codepoint, user agents must display some form of missing glyph symbol for that character rather than attempting installed font fallback for that codepoint." - css-fonts-4 +

The first line should render as the second. This means that no generic font was used during fallback and the first non generic font was used.

+



+



+ + diff --git a/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA.html b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA.html new file mode 100644 index 0000000000..9ed897aa00 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/font-unicode-PUA.html @@ -0,0 +1,25 @@ + + + + + + + + + +"If a given character is a Private-Use Area Unicode codepoint, user agents must only match font families named in the font-family list that are not generic families. If none of the families named in the font-family list contain a glyph for that codepoint, user agents must display some form of missing glyph symbol for that character rather than attempting installed font fallback for that codepoint." - css-fonts-4 +

The first line should render as the second. This means that no generic font was used during fallback and the first non generic font was used.

+



+



+ + diff --git a/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed-ref.html b/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed-ref.html new file mode 100644 index 0000000000..e59dc50dc7 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed-ref.html @@ -0,0 +1,20 @@ + + + +0p;/ +8i;, + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed.html b/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed.html new file mode 100644 index 0000000000..71b424d5fe --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/range-descriptor-reversed.html @@ -0,0 +1,28 @@ + + + + +CSS Fonts Module Level 3: Property descriptor ranges + + + + + + + + +MNOP +MNOP + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/resources/variabletest_matching.ttf b/testing/web-platform/tests/css/css-fonts/matching/resources/variabletest_matching.ttf new file mode 100644 index 0000000000..89ed12a2c0 Binary files /dev/null and b/testing/web-platform/tests/css/css-fonts/matching/resources/variabletest_matching.ttf differ diff --git a/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance-ref.html b/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance-ref.html new file mode 100644 index 0000000000..7589a15f12 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance-ref.html @@ -0,0 +1,28 @@ + + + + +1y;n + 1y;n + 2y;n + 2y;n + 2y;n + 6w;x + 6w;x + 7w;x + 7w;x + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance.html b/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance.html new file mode 100644 index 0000000000..e899c8b4d0 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/stretch-distance-over-weight-distance.html @@ -0,0 +1,63 @@ + + + + + + + +MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction-ref.html b/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction-ref.html new file mode 100644 index 0000000000..5a7c13959a --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction-ref.html @@ -0,0 +1,28 @@ + + + + +1p;c + 1p;c + 2p;c + 2e;x + 2e;x + 6t;n + 6i;v + 7i;v + 7i;v + + diff --git a/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction.html b/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction.html new file mode 100644 index 0000000000..f263a11127 --- /dev/null +++ b/testing/web-platform/tests/css/css-fonts/matching/style-ranges-over-weight-direction.html @@ -0,0 +1,65 @@ + + + + + + + +MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + MNOP + + -- cgit v1.2.3