mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-24 09:46:59 -06:00
UI: an embedder of the egui panels binds their font families without shipping their faces
The panels and dialogs draw in their own egui families (`ui`, `ui-semibold`, `mono`), and egui panics drawing text in a family no font is bound to. Only `theme::install_fonts` binds them, and only `VectorcraftApp::logic` calls it, on its first frame. An embedder that draws the panels or dialogs itself (`dialogs::show`, a panel's `ui`) on its own context, without `logic`, panics on the first semibold title it draws, an effect dialog's for one. Calling `install_fonts` avoids that, but it embeds the interface's five faces (about 2 MB) whatever the embedder wants: today such an embedder keeps them out of its binary only by never calling it, so that the linker drops them. vectorcraft-ui-egui gets an `interface-fonts` feature, on by default, that embeds those faces. Without it `install_fonts` binds the same three families to egui's built-in fonts, so an embedder can always call it. Those lack some symbols the panels show (→ ▾ ● ✓), which the docs say. With the feature, `install_fonts` installs exactly what it did before: the same font data and the same family stacks. `tests/install_fonts.rs` draws an effect dialog on a context only `install_fonts` prepared, and checks the face at the head of each family in both configurations. `cargo xtask ci`'s `no-bundled-fonts` step runs it without default features and lints the crate that way. Without the `install_fonts` call, or without the semibold binding, both tests fail with egui's "FontFamily::Name(\"ui-semibold\") is not bound to any fonts". The two lib tests about the interface faces are adjusted: the graphics-loss test checks a family install_fonts binds, and the catalogs' glyph coverage test needs `interface-fonts`. docs/development.md says when an embedder calls `install_fonts`, and that it replaces the context's font definitions. 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
438c6194a6
commit
317ca00ccc
+17
-3
@@ -1,5 +1,6 @@
|
||||
# Development
|
||||
|
||||
> **Last updated:** 2026-10-21 · **Change:** the interface faces as vectorcraft-ui-egui's `interface-fonts` feature, and `theme::install_fonts` for an embedder that draws the panels itself.
|
||||
> **Last updated:** 2026-10-21 · **Change:** leaving out the bundled fonts with the egui panels (vectorcraft-ui-egui's and vectorcraft-mcp's `bundled-fonts` features).
|
||||
> **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.
|
||||
@@ -171,8 +172,17 @@ and text has no glyphs until a font is added.
|
||||
An embedder that also hosts the egui panels depends on `vectorcraft-ui-egui` with
|
||||
`default-features = false` as well: its own `bundled-fonts` feature, on by default, turns the
|
||||
engine's on; `vectorcraft-mcp` has the same feature. The panels' interface faces (Source Sans 3
|
||||
Regular and Semibold, Inter Regular and SemiBold, JetBrains Mono) are separate copies in
|
||||
`theme.rs` and stay either way.
|
||||
Regular and Semibold, Inter Regular and SemiBold, JetBrains Mono, about 2 MB: `theme.rs`) are
|
||||
`vectorcraft-ui-egui`'s `interface-fonts` feature, also on by default; without it the panels draw in
|
||||
egui's built-in fonts, which lack some symbols they show (→ ▾ ● ✓), so such an embedder adds a
|
||||
font that has them to each of the families below (`ctx.add_font` with an `InsertFontFamily` per
|
||||
family).
|
||||
|
||||
The panels and dialogs draw in their own egui families (`theme::FONT_UI`, `FONT_UI_SEMIBOLD`,
|
||||
`FONT_MONO`), and egui panics drawing text in a family no font is bound to. `VectorcraftApp::logic`
|
||||
binds them on its first frame; an embedder that draws the panels or dialogs without it calls
|
||||
`theme::install_fonts` once on its context, with or without `interface-fonts`. It replaces the
|
||||
context's font definitions, so the embedder's own fonts are added after it.
|
||||
|
||||
- The workspace declares `vectorcraft-text` and `vectorcraft-engine` without default features, so
|
||||
each crate that wants the fonts asks for them (the apps, and `vectorcraft-testkit` for tests);
|
||||
@@ -184,7 +194,10 @@ Regular and Semibold, Inter Regular and SemiBold, JetBrains Mono) are separate c
|
||||
vectorcraft-text`, and the same for `vectorcraft-mcp`), and with them do; a test of either can't
|
||||
see that configuration, since their dev-dependencies turn the fonts on.
|
||||
- `cargo test -p vectorcraft-text --no-default-features --test without_bundled_fonts` checks the
|
||||
configuration without them.
|
||||
configuration without them, and `cargo test -p vectorcraft-ui-egui --no-default-features --test
|
||||
install_fonts` that the panels without their interface faces still bind every family; the same
|
||||
step lints `vectorcraft-ui-egui` without its default features. Of the crate's other tests, those
|
||||
about the interface faces need them.
|
||||
|
||||
### Arabic fonts and the web build
|
||||
|
||||
@@ -442,6 +455,7 @@ Scores and hour estimates are unchanged.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-10-21 | minor | Fonts › Leaving out the bundled fonts: vectorcraft-ui-egui's `interface-fonts` feature, and `theme::install_fonts` for an embedder that draws the panels without `VectorcraftApp::logic`. |
|
||||
| 2026-10-21 | minor | M3: highlighted-text Eyedropper sampling preserves ranges and rejects unsupported source/target transparency atomically; regression-tested; scores and estimates unchanged. |
|
||||
| 2026-10-21 | minor | Fonts › Leaving out the bundled fonts: vectorcraft-ui-egui's and vectorcraft-mcp's `bundled-fonts` features, and the engine declared without default features. |
|
||||
| 2026-10-14 | minor | Document the `bundled-fonts` feature of vectorcraft-text and vectorcraft-engine (Fonts › Leaving out the bundled fonts). |
|
||||
|
||||
Reference in New Issue
Block a user