Files
Zachary D. Rowitsch ff97121faf Add WOFF2 web-font decoding (wiki F-002)
The font pipeline deliberately skipped WOFF2 @font-face sources
("// Skip WOFF2 (needs separate decompressor)"), falling through to the
next source. FontAwesome 6 (and many sites) list woff2 first and the ttf
is often absent on the server (e.g. fa-solid-900.woff2 -> 200,
fa-solid-900.ttf -> 404), so icons rendered as empty boxes.

Add a WOFF/WOFF2 -> sfnt decoder at the fonts crate layer (new dep
`wuff` 0.2, MIT, pure-Rust) so decoding is transparent to both the layout
engine and rasterizer via FontDb::register_font. Sniff wOF2/wOFF magic,
decode to sfnt, pass real sfnt through unchanged, and return None on decode
failure. Remove the WOFF2 skip in the app_browser pipeline and gate only
truly-undecodable formats (svg/eot); first source that fetches+parses wins,
with graceful fallback to the next source.

Regression tests: woff2/woff magic detection, decode-to-sfnt of a real
~3.4KB test asset, corrupt-woff2 rejection, register_font accepts woff2,
and pipeline tests for woff2-first load + corrupt-woff2 fallback to ttf.

New dep rationale: wuff is a small pure-Rust WOFF/WOFF2 decoder; new
transitive deps (brotli-decompressor, alloc-no-stdlib, alloc-stdlib,
arrayvec) are all MIT/Apache-2.0/BSD and allowed by deny.toml. No FFI.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 00:43:41 -04:00
..