mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
The nine OFL faces in `assets/fonts` are compiled into every build of vectorcraft-text: 3.4 MB of the binary, about 1.6 MB of a gzipped wasm. An embedder that loads every font at run time with `FontDb::add_font` (a web app serving its own font catalogue, say) ships them twice and can't turn them off. - vectorcraft-text: `bundled-fonts`, a default feature, holds the `include_bytes!` list. Off, a database starts without them (craft-fonts and system fonts are unaffected) and text has no glyphs until a font is added, as when the bundled fonts fail to parse. - vectorcraft-engine: a `bundled-fonts` default feature forwards to it, so the apps and any embedder using the engine keep the fonts unless they build it with `default-features = false`. - The workspace declares vectorcraft-text without default features, so no library crate turns the fonts back on. The tests of cad, metafile and tools, which lay type out, ask for the feature in their dev-dependencies; the other crates' tests get it through testkit. `cargo test --workspace` builds with the fonts, as before. A new integration test, `without_bundled_fonts`, covers the configuration without them (`cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts`): the database starts without them, text in no font lays out with no glyphs, and a font added later is used and is the fallback for families the database lacks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>