LibGfx+LibWeb: Update definitions of supported font formats and features

Based very scientifically on what's listed here:
https://harfbuzz.github.io/what-does-harfbuzz-do.html

I've moved the code into LibGfx because including a HarfBuzz header
directly from LibWeb is a little unpleasant. But the Gfx::FontTech enum
follows the CSS definitions for font features for simplicity.

TrueType collections are supported. SVG and Embedded OpenType are not,
but they're not widely supported by other browsers so that's fine.

Most of the features are completely supported by HarfBuzz, so we can
just return true. Graphite support is optional (and it appears we use a
build of HarfBuzz without it) but there's a define we can check.
Incremental Font Transfer is a whole separate thing that we definitely
don't support yet.
This commit is contained in:
Sam Atkins 2025-06-03 15:48:24 +01:00
parent ea101c6336
commit 5a1c73d7e2
Notes: github-actions[bot] 2025-06-05 11:39:09 +00:00
6 changed files with 155 additions and 32 deletions

View file

@ -2,21 +2,20 @@ Harness status: OK
Found 35 tests
33 Pass
2 Fail
35 Pass
Pass Check that src: url("foo.ttf") is valid
Pass Check that src: url("foo.ttf"), url("bar.ttf") is valid
Pass Check that src: url("foo.ttf") format() is invalid
Pass Check that src: url("foo.ttf") dummy() is invalid
Pass Check that src: url("foo.ttf") format("woff") dummy() is invalid
Pass Check that src: url("foo.ttf") dummy() format("woff") is invalid
Fail Check that src: url("foo.ttf") format("collection") is valid
Pass Check that src: url("foo.ttf") format("collection") is valid
Pass Check that src: url("foo.ttf") format("opentype") is valid
Pass Check that src: url("foo.ttf") format("truetype") is valid
Pass Check that src: url("foo.ttf") format("woff") is valid
Pass Check that src: url("foo.ttf") format("woff2") is valid
Pass Check that src: url("foo.ttf") format("opentype", "truetype") is invalid
Fail Check that src: url("foo.ttf") format(collection) is valid
Pass Check that src: url("foo.ttf") format(collection) is valid
Pass Check that src: url("foo.ttf") format(opentype) is valid
Pass Check that src: url("foo.ttf") format(truetype) is valid
Pass Check that src: url("foo.ttf") format(woff) is valid

View file

@ -2,22 +2,21 @@ Harness status: OK
Found 39 tests
34 Pass
5 Fail
39 Pass
Pass Check that src: url("foo.ttf") is valid
Pass Check that src: url("foo.ttf") tech() is invalid
Pass Check that src: url("foo.ttf") tech(features-opentype) is valid
Fail Check that src: url("foo.ttf") tech(features-aat) is valid
Pass Check that src: url("foo.ttf") tech(features-aat) is valid
Pass Check that src: url("foo.ttf") tech(color-COLRv0) is valid
Pass Check that src: url("foo.ttf") tech(color-COLRv1) is valid
Fail Check that src: url("foo.ttf") tech(color-sbix) is valid
Fail Check that src: url("foo.ttf") tech(color-CBDT) is valid
Pass Check that src: url("foo.ttf") tech(color-sbix) is valid
Pass Check that src: url("foo.ttf") tech(color-CBDT) is valid
Pass Check that src: url("foo.ttf") tech(variations) is valid
Fail Check that src: url("foo.ttf") tech(palettes) is valid
Pass Check that src: url("foo.ttf") tech(palettes) is valid
Pass Check that src: url("foo.ttf") tech("features-opentype") is invalid
Pass Check that src: url("foo.ttf") tech("color-COLRv0") is invalid
Pass Check that src: url("foo.ttf") tech("variations") is invalid
Fail Check that src: url("foo.ttf") tech(features-opentype, color-COLRv0, variations, palettes) is valid
Pass Check that src: url("foo.ttf") tech(features-opentype, color-COLRv0, variations, palettes) is valid
Pass Check that src: url("foo.ttf") tech(features-opentype color-COLRv0 variations palettes) is invalid
Pass Check that src: url("foo.ttf") tech(feature-opentype) is invalid
Pass Check that src: url("foo.ttf") tech(feature-aat) is invalid