mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-26 02:37:01 -06:00
Text: a bundled-fonts feature (on by default) lets embedders that bring their own fonts leave ours out
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>
This commit is contained in:
committed by
bflatastic
co-authored by
Claude Opus 5.5
parent
1e8f5025c6
commit
55fadb6afe
@@ -1,5 +1,6 @@
|
||||
# Development
|
||||
|
||||
> **Last updated:** 2026-10-14 · **Change:** leaving out the bundled fonts (`bundled-fonts` feature).
|
||||
> **Last updated:** 2026-10-14 · **Change:** document-font registration for all explicitly supplied faces.
|
||||
|
||||
## Web build
|
||||
@@ -148,6 +149,22 @@ CRAFT_FONTS_DIR="$PWD/../craft-fonts" cargo xtask ci # also runs the Japanese-
|
||||
CI job and every release job (`release.yml`) check craft-fonts out at a pinned commit; release
|
||||
packages carry each embedded font's `OFL-<family>.txt`.
|
||||
|
||||
### Leaving out the bundled fonts (embedders)
|
||||
|
||||
The Latin fonts in `assets/fonts/` are compiled into `vectorcraft-text` by its `bundled-fonts`
|
||||
feature (3.4 MB of the binary). It is on by default, and `vectorcraft-engine`'s default
|
||||
`bundled-fonts` feature turns it on, so the apps and anything built on the engine have them. An
|
||||
embedder that brings every font itself at run time (`FontDb::add_font`, say a web app serving its
|
||||
own font catalogue) depends on the engine with `default-features = false` and doesn't ship them
|
||||
twice. Its font database starts without them: on the web and without craft-fonts it starts empty,
|
||||
and text has no glyphs until a font is added.
|
||||
|
||||
- The workspace declares `vectorcraft-text` without default features, so no library crate turns the
|
||||
fonts back on; a crate whose tests lay type out asks for `bundled-fonts` in its
|
||||
dev-dependencies (or gets it through `vectorcraft-testkit`, which uses the engine).
|
||||
- `cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts` checks the
|
||||
configuration without them.
|
||||
|
||||
### Arabic fonts and the web build
|
||||
|
||||
Desktop builds load craft-fonts' Arabic families into the document font database (Noto Sans
|
||||
@@ -346,5 +363,6 @@ do not replace expected hashes automatically in response to a download mismatch.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-14 | minor | Document the `bundled-fonts` feature of vectorcraft-text and vectorcraft-engine (Fonts › Leaving out the bundled fonts). |
|
||||
| 2026-10-14 | minor | Document registration of every explicitly supplied craft-fonts face after the existing script-specific prefix; empty input and web selection remain unchanged. |
|
||||
| 2026-10-13 | minor | Document pinned PngSuite files, integrity checks and download budgets (#1729). |
|
||||
|
||||
Reference in New Issue
Block a user