Merge branch 'area/app3' into area/app4

# Conflicts:
#	apps/vectorcraft-web/Cargo.toml
This commit is contained in:
bflatastic
2026-11-24 07:15:04 +07:00
14 changed files with 86 additions and 34 deletions
Generated
-1
View File
@@ -8391,7 +8391,6 @@ dependencies = [
"proptest",
"serde",
"serde_json",
"thiserror 2.0.21",
"vectorcraft-testkit",
]
+2 -2
View File
@@ -16,8 +16,6 @@ path = "src/main.rs"
[dependencies]
vectorcraft-engine = { workspace = true, features = ["bundled-fonts", "heif"] }
vectorcraft-ui-egui = { workspace = true }
# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft.
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "bf62d509fb26e92ab5c45a9fd613d8aab9ffafd0", version = "0.1.0" }
vectorcraft-format = { workspace = true }
vectorcraft-text = { workspace = true }
craft = { workspace = true, features = ["ui", "keymap", "automation", "platform"] }
@@ -28,6 +26,8 @@ log = { workspace = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
# `wgpu` pulls egui-wgpu's defaults: WebGPU plus the WebGL2 fallback.
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
# The page command API (storytold/craft-libs#413): the request plumbing behind window.vectorcraft.
craft-web-api = { git = "https://github.com/storytold/craft-libs", rev = "bf62d509fb26e92ab5c45a9fd613d8aab9ffafd0", version = "0.1.0" }
wasm-bindgen = "0.2"
serde_json = { workspace = true }
@@ -26,6 +26,7 @@ pub const MAX_FILE: usize = 64 << 10;
/// The most setups `view.proofSetup.list` lists.
pub const MAX_LISTED: usize = 100;
/// The most folder entries `view.proofSetup.list` looks at, setup files or not.
#[cfg(not(target_arch = "wasm32"))]
const MAX_SCANNED: usize = 100_000;
/// The longest `name`, in characters.
const MAX_NAME: usize = 100;
-1
View File
@@ -11,7 +11,6 @@ workspace = true
[dependencies]
kurbo = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }
[dev-dependencies]
vectorcraft-testkit = { workspace = true }
+3 -1
View File
@@ -11,7 +11,9 @@ use super::names::{norm, norm_chars, script_families};
#[cfg(not(target_arch = "wasm32"))]
use super::scan::{enumerate_faces, file_face_names, font_files};
use super::traits::{Alias, FontMatch, FontTraits, regular_rank};
use super::{Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphImage, MetadataProvider, NEXT_ID, OUTLINE_CACHE_MAX, Ordering};
#[cfg(not(target_arch = "wasm32"))]
use super::MetadataProvider;
use super::{Arc, BezPath, CANONICAL_CACHE_MAX, Color, ColourContent, FontDb, GlyphImage, NEXT_ID, OUTLINE_CACHE_MAX, Ordering};
fn has_file_fonts(n: &vectorcraft_doc::Node) -> bool {
matches!(&n.kind, vectorcraft_doc::NodeKind::Text(t) if t.file_fonts.is_some())
+1 -1
View File
@@ -69,7 +69,6 @@ egui = { workspace = true, features = ["bytemuck", "default_fonts", "monochrome_
# reach our tests; `theme::install_fonts` starts from `FontDefinitions::default()`, which is empty
# without them (production would lay out tofu, and the no-interface-fonts tests would bind nothing).
bytemuck = { version = "1", features = ["extern_crate_alloc"] }
egui_extras = { workspace = true }
image = { workspace = true }
craft-image-codecs = { workspace = true }
serde = { workspace = true }
@@ -99,6 +98,7 @@ rustix = { workspace = true, features = ["std", "process"] }
# `Fixture` and the stories sit behind craft-ui's `testing` feature.
craft = { workspace = true, features = ["ui-testing"] }
egui_kittest = { workspace = true, features = ["wgpu", "snapshot"] }
egui_extras = { workspace = true }
vectorcraft-apischema = { workspace = true }
vectorcraft-testkit = { workspace = true }
# A variable font built in code (no font file is committed).
+1
View File
@@ -173,6 +173,7 @@ impl VectorcraftApp {
pointer_waits: Vec::new(),
context: 0,
ui_ctx: None,
#[cfg(not(target_arch = "wasm32"))]
updates_rt: Default::default(),
frame_rate: Default::default(),
hover_doc: None,
+22 -3
View File
@@ -52,13 +52,29 @@ pub(super) fn quick_pen_bar(app: &mut VectorcraftApp, ui: &mut Ui, space: &Canva
// Beside the end, on the side the path arrives from (a path of one point: right and below), a gap off it
// both ways, as production's corner did; the bar's sides are reading-order ones, so a rightward arrival is
// `End` under LTR and `Start` under RTL. The anchor moves the gap down (or up), the side adds it across.
// The framework flips the side across; up or down is chosen here, as the framework's flip would line the
// bar up with the gapped point instead of a gap off the other side of the end.
let height_id = egui::Id::unique("quick-pen-bar-height");
let (anchor, side, align) = match end {
Some((p, dir)) => {
let heading = dir.map(|d| space.view.to_screen(p + d) - space.view.to_screen(p));
let at = space.view.to_screen(p);
let heading = dir.map(|d| space.view.to_screen(p + d) - at);
let right = heading.is_none_or(|d| d.x >= 0.0);
let down = heading.is_none_or(|d| d.y >= 0.0);
let mut down = heading.is_none_or(|d| d.y >= 0.0);
let gap = env.tokens.space.gap.section;
let off = space.view.to_doc(space.view.to_screen(p) + egui::vec2(0.0, if down { gap } else { -gap }));
// With the bar's height from the last pass, that side gives way where it runs off the canvas and the
// other fits or runs off by less, as in production.
if let Some(height) = ui.ctx().data(|d| d.get_temp::<f32>(height_id)) {
let area = space.view.rect;
let over = |down: bool| {
let top = if down { at.y + gap } else { at.y - gap - height };
(area.top() - top).max(0.0) + (top + height - area.bottom()).max(0.0)
};
if over(!down) < over(down) {
down = !down;
}
}
let off = space.view.to_doc(at + egui::vec2(0.0, if down { gap } else { -gap }));
(vec![off], if right != rtl { Side::End } else { Side::Start }, if down { Align::Start } else { Align::End })
}
None => (vec![space.view.to_doc(space.view.rect.center_bottom())], Side::Above, Align::Center),
@@ -82,6 +98,9 @@ pub(super) fn quick_pen_bar(app: &mut VectorcraftApp, ui: &mut Ui, space: &Canva
run = Some(("tool.quickPen.flipArc", json!({})));
}
});
if shown.output.rect.is_positive() {
ui.ctx().data_mut(|d| d.insert_temp(height_id, shown.output.rect.height()));
}
if shown.output.hide {
run = Some(("window.quickPenToolbar", json!({})));
}
+1
View File
@@ -182,6 +182,7 @@ pub struct VectorcraftApp {
/// The current context (set by [`Self::adopt_context`]): the dialogs, the overlays and the
/// window host are read through it.
ui_ctx: Option<egui::Context>,
#[cfg(not(target_arch = "wasm32"))]
pub(crate) updates_rt: updates_ui::Runtime,
/// The status bar's frame rate ([`frame_rate`]).
frame_rate: frame_rate::FrameRate,
+1
View File
@@ -1535,6 +1535,7 @@ pub(crate) const SYSTEM_CLIPBOARD_POLL: f64 = 0.25;
/// How often the font catalog looks for fonts a font manager activated while the app stays in
/// front (#2576).
#[cfg(not(target_arch = "wasm32"))]
pub(crate) const FONT_INSTALL_POLL: std::time::Duration = std::time::Duration::from_secs(2);
#[cfg(test)]
+27
View File
@@ -218,6 +218,33 @@ fn the_toolbar_follows_the_drawing_and_flips_the_last_arc() {
});
}
/// Near the bottom of the canvas, a path heading down gets its toolbar above its end, not over it; near
/// the top, one heading up gets it below.
#[test]
fn the_toolbar_goes_to_the_other_side_where_it_runs_off_the_canvas() {
let mut app = app();
on_canvas(&mut app, |rig| {
assert!(bar(rig).is_some());
let canvas = canvas_rect(rig);
let doc = |rig: &Rig, y: f32| rig.app().canvas_view().unwrap().to_doc(egui::pos2(canvas.center().x, y));
// A line to the right along the canvas's bottom edge, then one along its top edge drawn upward.
for (from, to, heads_down) in [(canvas.bottom() - 8.0, canvas.bottom() - 8.0, true), (canvas.top() + 40.0, canvas.top() + 8.0, false)] {
escape(rig);
let (a, b) = (doc(rig, from), doc(rig, to));
click_doc(rig, a.x - 40.0, a.y);
click_doc(rig, b.x, b.y);
let r = bar(rig).unwrap();
let end = screen(rig, b.x, b.y);
assert!(canvas.contains_rect(r), "{r:?} on the canvas {canvas:?}");
if heads_down {
assert!(r.bottom() < end.y && r.left() > end.x, "{r:?} above and right of {end:?}");
} else {
assert!(r.top() > end.y, "{r:?} below {end:?}");
}
}
});
}
/// The toolbar stays shown while its handle is dragged farther than the toolbar's height, when the
/// press is no longer on it.
#[test]
+2 -5
View File
@@ -12,15 +12,12 @@ use craft::update::stack_dialogs::{CheckChoice, UpdateCheckDialog, UpdatePromptD
#[cfg(not(target_arch = "wasm32"))]
use craft::update::updater::{Action, Status, Updater};
#[cfg_attr(target_arch = "wasm32", derive(Default))]
#[cfg(not(target_arch = "wasm32"))]
pub(crate) struct Runtime {
#[cfg(not(target_arch = "wasm32"))]
updater: Updater,
/// The desktop app turns the check at start on; tests and the web build leave it off.
#[cfg(not(target_arch = "wasm32"))]
/// The desktop app turns the check at start on; tests leave it off.
startup_check: bool,
/// Whether a modal update dialog was open in the last pass.
#[cfg(not(target_arch = "wasm32"))]
was_modal: bool,
}
+23 -18
View File
@@ -1,5 +1,6 @@
# Development
> **Last updated:** 2026-11-24 · **Change:** Fonts: the interface font stack is the framework's, set up by `ui_fonts()` and installed by `embed::install`; `theme::install_fonts` is gone and the `interface-fonts` feature changes nothing.
> **Last updated:** 2026-11-12 · **Change:** Tests canonicalize temporary roots and normalize Windows verbatim prefixes before comparing preset refusal paths or probing a case-variant script folder (#6860); production access checks unchanged.
> **Last updated:** 2026-11-12 · **Change:** minor (clipboard failure helper follows its Linux/BSD and test callers; previously: Hindi catalog and zero/one plural rule; desktop Devanagari fallback and optional craft-fonts UI face; native review pending).
> **Last updated:** 2026-11-01 · **Change:** Linux: Automatic Linux Display Server opens the window through XWayland when a pen is attached on a Wayland session, so the pen draws (#4967); `VECTORCRAFT_NATIVE_WAYLAND=1` keeps Wayland.
@@ -170,10 +171,13 @@ CRAFT_FONTS_DIR="$PWD/../craft-fonts" cargo xtask ci # also runs the Japanese-
All other supplied faces follow those existing document fallbacks in manifest order, so they
can also be selected by family name. This does not change which faces the web build embeds
or fetches, and no craft-fonts faces are registered when the optional input is absent.
- UI: `theme::install_fonts` adds them at the end of every egui family (BIZ UDPGothic first, then
Noto Sans Georgian for the Georgian interface), after the UI fonts and before the installed fonts
`ui_fonts.rs` discovers for other scripts. On the web, Noto Sans Georgian is fetched at startup
and reaches the UI through `ui_fonts.rs`.
- UI: `ui_fonts()` (`crates/ui-egui/src/ui_fonts.rs`) hands them to the framework's interface font
stack, which puts the UI language's faces after the interface face (ahead of it for a script
that face lacks and that doesn't fit a Latin row, such as Georgian), then the other scripts'
faces, then the installed fonts it finds for other scripts on the desktop. On the web the
`startup` and `demand` faces of `crates/text/web-fonts.txt` are served under `fonts/ui/`
instead: the stack fetches the UI language's at once and the others the first time text needs
them.
- Tests that need Japanese or Georgian glyphs skip with a message when built without craft-fonts. The FreeBSD
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`.
@@ -191,18 +195,18 @@ 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, 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).
engine's on; `vectorcraft-mcp` has the same feature. The panels' interface faces come from the
framework, with or without these features: Inter Regular and SemiBold (cut to Latin, Greek and
Cyrillic) and egui's Hack for monospace, which craft-fonts' monospace face leads when the build
embeds it. `vectorcraft-ui-egui`'s `interface-fonts` feature is still declared but changes nothing.
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 panels and dialogs draw in egui's proportional and monospace families and the framework's
semibold family (`craft::ui::fonts::SEMIBOLD`), and egui panics drawing text in a family no font is
bound to. `embed::install(ctx, spec, &vectorcraft_ui_egui::ui_fonts())` binds them; the desktop and
web apps call it once when they create the app (the web app adds `.fetcher(BrowserFetcher)` so the
served faces are fetched), and an embedder that draws the panels or dialogs calls it once on its
context. It replaces the context's font definitions, so an embedder's own faces go into the stack
(`ui_fonts().app_face(…)`) before it is installed.
- 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);
@@ -215,9 +219,9 @@ context's font definitions, so the embedder's own fonts are added after it.
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, 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.
install_fonts` that the fonts `embed::install` sets up bind the proportional, monospace and
semibold families, so an effect dialog draws; the same step lints `vectorcraft-ui-egui` without
its default features.
### Arabic fonts and the web build
@@ -564,6 +568,7 @@ Scores and hour estimates are unchanged.
| Date | Change | Summary |
|---|---|---|
| 2026-11-24 | minor | Fonts: the interface font stack is the framework's, set up by `ui_fonts()` and installed by `embed::install` (craft-fonts faces, the web's served faces, embedders); `theme::install_fonts` is gone and `interface-fonts` changes nothing. |
| 2026-11-12 | minor | Tests (#6860): compare preset refusal roots after canonicalization and Windows display normalization; canonicalize the script fixture base before constructing `MAIN`. This keeps macOS `/var` → `/private/var` aliases from masking the case-sensitivity checks; no production-code change. |
| 2026-11-12 | minor | Compile the clipboard failure helper only for Linux/BSD worker callers and unit tests; keep production macOS free of the unused helper without suppressing workspace dead-code warnings. |
| 2026-11-06 | minor | Localisation: Hindi catalog, zero/one plurals, desktop and web font requirements; AI/MT draft, native review pending. |
+2 -2
View File
@@ -1853,8 +1853,8 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
With Line-end Punctuation Half Width, both composers measure a line with its last character set as narrow as Mojikumi sets it ([the help page](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/use-mojikumi-for-japanese-text-composition.html)): a closing bracket, comma or full stop that fits at half width ends the line, and the character before it no longer goes to the next line with it. A mark that already lost its half to the punctuation after it and a line that ends in a hyphen take nothing more off, and the quarter em between Japanese and Latin text counts only where the line ends there. Kinsoku Shori Type and Burasagari Regular measure lines the same way; right-to-left lines and Mojikumi None break as before. In a frame that is not a rectangle, or with text wrap, a line's first word is measured as it is set (an opening bracket at its start flush, its last character narrowed) when layout looks for a line wide enough for it, and it ends only where the line may break, so kinsoku keeps an opening bracket with the character after it and a No Break run counts whole (`crates/text/src/layout/wrapping_tests.rs`, `crates/text/src/tests/vertical.rs`). Scores and estimates are unchanged.
Burasagari ([the help page](https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html)) leaves a right-to-left paragraph's comma or full stop inside its line, which then ends at a break where it fits with the mark, and in a left-to-right line with right-to-left text and a tab it hangs a mark only when the mark is drawn at the line's right end and the rest of the line fits as drawn; otherwise the line ends at the latest break that fits as drawn. Both are VectorCraft's own rules (`crates/text/src/layout/wrapping_tests.rs`, `crates/text/src/tests/hang.rs`). Scores and estimates are unchanged.
The Paragraph panel's Mojikumi Set lists the five predefined sets the help page names (None, YakumonoHankaku, GyomatsuYakumonoHankaku, GyomatsuYakumonoZenkaku and YakumonoZenkaku), then Line-end Punctuation Half Width, and `text.setFormat {mojikumi}` takes each of them. YakumonoHankaku sets every bracket, comma and full stop half width and takes a quarter em off each side of a middle dot; GyomatsuYakumonoHankaku keeps punctuation full width inside a line, sets an opening bracket flush at a line's start and a closing mark half width at its end, and takes the quarter em after a middle dot off at a line's end; GyomatsuYakumonoZenkaku keeps punctuation full width and adds a quarter em between Japanese and Latin text; YakumonoZenkaku sets characters as None does. These widths are VectorCraft's own rules, from the help page's one-line description of each set. Both composers and vertical type measure each line as it is set, the sets save with the document and paragraph styles, and a `.ai` save reports the new sets as left out (`crates/text/src/tests/vertical.rs`, `crates/ui-egui/src/panels/paragraph/tests.rs`). Scores and estimates are unchanged.
Interface text in characters the interface's fonts lack, drawn in a bundled Japanese, Georgian or Devanagari face or in an installed font that covers them, sits on the baseline of the Latin text beside it, monospace text included (#5816; `crates/ui-egui/src/ui_fonts.rs`, `crates/ui-egui/src/theme.rs`).
On the web, Korean and Hindi interface text draws with real glyphs: a web build made with craft-fonts fetches NanumGothic for Hangul (about 2 MB) or Noto Sans Devanagari (about 280 KB) only when the interface language or the interface's own text (a layer or file name, the language picker) needs that script. The frame after the face arrives adds it to the interface fonts, and the frame after that draws the characters painted before it with that face. Sessions in other languages do not download them at startup. After a failed fetch the next try comes about 30 seconds later, and the wait doubles after each further failure, for at most five tries (`crates/text/web-fonts.txt`, `apps/vectorcraft-web/src/fonts.rs`, `apps/vectorcraft-web/src/demand.rs`, `crates/ui-egui/src/ui_fonts.rs`).
Interface text in characters the interface's fonts lack, drawn in a bundled Japanese, Georgian or Devanagari face or in an installed font that covers them, sits on the baseline of the Latin text beside it, monospace text included (#5816; the framework's interface font stack, set up in `crates/ui-egui/src/ui_fonts.rs`).
On the web, Korean and Hindi interface text draws with real glyphs: a web build made with craft-fonts fetches NanumGothic for Hangul (about 2 MB) or Noto Sans Devanagari (about 280 KB) only when the interface language or the interface's own text (a layer or file name, the language picker) needs that script. The frame after the face arrives adds it to the interface fonts, and the frame after that draws the characters painted before it with that face. Sessions in other languages do not download them at startup. After a failed fetch the next try comes 2 seconds later, and the wait doubles after each further failure, up to 10 minutes (the framework's interface font stack; `crates/text/web-fonts.txt`, `apps/vectorcraft-web/src/fonts.rs`, `crates/ui-egui/src/ui_fonts.rs`).
Character panel menu › Standard Vertical Roman Alignment (with the East Asian options; `text.setFormat` or `text.setRangeStyle {standardVerticalRoman}`, off by default) stands the selected Latin letters, digits and other half-width characters upright one below the other in vertical type instead of rotating them ([formatting Asian characters](https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html)); spaces keep their width, tate-chu-yoko blocks stay across the column, and Character Style Options gives it its own checkbox beside Character Alignment.
The Glyphs panel menu (with the East Asian options) offers Traditional, Expert, JIS 04, JIS 90, JIS 78 and JIS 83 Forms, Monospaced Full-Width, Half-Width, Third-Width and Quarter-Width Forms, and Revert To Default Forms ([formatting Asian characters](https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html)); each draws the selected characters with the font's OpenType feature for that form (`trad`, `expt`, `jp04`, `jp90`, `jp78`, `jp83`, `fwid`, `hwid`, `twid`, `qwid`), one form at a time, and a form none of the faces that draw the selected text has a feature for (in `GSUB`, or for the width forms `GSUB` or `GPOS`) is disabled. A form other than the default takes away a character's glyph choice, and with a width form Proportional Metrics' `palt` is not applied and the font's pair kerning is off. `text.setFormat` and `text.setRangeStyle {glyphForm}` set it; the native file, character styles, the canvas, PDF and SVG (`font-feature-settings`) keep it (`tests::typo::glyph_forms_draw_the_fonts_east_asian_forms`, `typecmd::area_tests::glyph_form_is_one_character_attribute_saved_only_when_set`, `typecmd::area_tests::a_glyph_form_takes_away_the_characters_glyph_choice`, `features::tests::width_forms_turn_off_proportional_metrics`, `panels::glyphs` tests).
Character panel menu › Tate-chu-yoko Settings… (with the East Asian options; `ui.tateChuYokoSettings`, `text.setFormat` or `text.setRangeStyle {tcyUpDown, tcyLeftRight}`, in points, 0 by default) moves a marked tate-chu-yoko block in vertical type up by a positive Up/Down and right by a positive Left/Right ([format East Asian characters in vertical text](https://helpx.adobe.com/illustrator/desktop/design-with-text/edit-format-text/format-east-asian-characters-in-vertical-text.html), [formatting Asian characters](https://helpx.adobe.com/illustrator/using/formatting-asian-characters.html)); the block moves as one piece with its first character's values and keeps its one em down the column, on a vertical path it moves toward the path's start and to the path's left, automatic digit blocks do not move, Reset Panel sets both back to 0, and character styles and the native file keep them.