Merge main into fix/tests-render-trace

This commit is contained in:
dotCooCoo committed 2026-12-01 17:42:49 -08:00
commit 22cdb2f9ab
9 files changed
+181 -24

No files matched your search

+1 -1
View File
@@ -54,7 +54,7 @@ pub fn specs() -> Vec<CommandSpec> {
"Export for Screens",
["File", "Export"],
None,
"{folder?, zip?: false (one .zip of every file, each deflated or stored, whichever is smaller: no folder → {name, dataBase64, bytes, files: [name…]}; with a folder it is written there → {path, bytes, files}), artboard?: index | artboards?: [index…] | range?: \"1-3\" (default all), assets?: [asset id…] (instead of artboards: each asset's art alone, cropped to its bounds and named after the asset; see assets.list), layers?: [layer id…] (instead of artboards: each layer's art alone, sublayers included, named after the layer), selection?: one|each (instead of artboards: the selected art as one file, or a file per selected object, named after it), fullDocument?: false (one file per format instead: a PDF of every artboard, other formats the bounds of all visible art, named after the document), includeBleed?: false (artboards grown by the document's bleed; a PDF page keeps the artboard as its TrimBox and puts its row's bleed around it once, the document's bleed when the row sets none and its preset gives none or 0), includeArtboardFill?: true (Include Artboard Fill: each artboard's background color behind its art; false leaves it out), pdfs?: multiple|single (Export PDFs As: with several artboards, single writes them as the pages of one PDF per PDF row, named after the document; refused with assets, layers or selection: each), exportPreset?: (a preset of document.exportPresets.list: its settings, under these params), subfolders?: false (each row's files in a sub-folder: its folder, else its size for raster (1x, 2x, 100w…) or its format (SVG, PDF)), folders?: none|rows (as subfolders)|format (a folder per extension: png, svg, pdf…)|item (a folder per artboard, asset, layer or object)|itemFormat (item/extension) (default: rows with subfolders or a preset, else none), name?: (a file name pattern instead of the item's name, with <filename> for the document, <name> for the artboard, asset, layer or object, <index> from 1, #### for the counter zero-padded to the run of #, <format>, <scale>, <suffix> (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, <date>, <time>, <YYYY>, <MM>, <DD>, <hh>, <mm> and <ss>; a trailing .ext is dropped, as in `COMPANY-Logo-<filename>-####-YYYYMMDD`; different files it names alike get -2, -3…), counterStart?: 1, counterPer?: item (every file of an item has its number)|file, date?: YYYY-MM-DD (the date the pattern uses; default today, UTC), preset?: mobile (PNG 1x, 2x, 3x) | density (PNG 0.75x–4x in ldpi…xxxhdpi sub-folders) instead of formats (turns subfolders on), formats?: [{format: png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft, scale?: 1 | \"2x\" | \"100w\" | \"100h\" | \"72ppi\", width?: px | height?: px | ppi? (raster only; width, then height, then ppi win over scale), suffix?: (raster default: @2x, @100w, @100h, none at 1x; vector formats drop size suffixes), folder?: (its sub-folder), quality?: (jpg 0–100; webp 0–100 with lossless: false), …the format's options (antiAlias, background, preset (pdf)…)}], settings?: {png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft: {…options for every row of that format}} (rows' own options win), prefix?, antiAlias?: none|art|type (raster rows without their own), openLocation?: (remembered; the app shows the files after exporting)} one file per artboard and format (a PDF holds its artboard alone; artboards with the same name, in any case, get -2, -3…; an unnamed one is Artboard-N; a row whose file would take a name another row's file has, in any case, gets -2, -3… too, and identical rows write one file; row folders that differ only in case are one folder, spelled as the first row spells it) → {files: [path…]} (into the folder of exportPreset, outside the automation read roots: no ZIP path, and files relative to that folder); no folder → {files: [{name, dataBase64}]} (names include sub-folders: 2x/[email protected]); every reply has warnings: [the encoders' warnings for the files, each once: an image that couldn't be decoded, type written in the fallback font…]. eps, ai and vectorcraft rows write a document of the item alone (its one artboard). The params (but zip and assets) are remembered in the document (document.exportSettings; not an undo step). A key it doesn't take, a key no format takes in a format row or in settings, settings for a format it doesn't write, and an unknown key inside a PDF, EPS or SVG option's object, are refused; a key only another format takes in a row or in settings is not used, and warnings name it as given (formats[0].quality; a key in settings only when no row of that format reads it; not a key of an exportPreset). Under automation read roots, an svg or svgz row, and a row whose files carry the native document (vectorcraft, eps, ai but a version 7 file, a pdf with preserveEditing on that holds every artboard of the document it is written from), is refused, before the folder is made or any file is written, while t Line truncated
"{folder?, zip?: false (one .zip of every file, each deflated or stored, whichever is smaller: no folder → {name, dataBase64, bytes, files: [name…]}; with a folder it is written there → {path, bytes, files}), artboard?: index | artboards?: [index…] | range?: \"1-3\" (default all), assets?: [asset id…] (instead of artboards: each asset's art alone, cropped to its bounds and named after the asset; see assets.list), layers?: [layer id…] (instead of artboards: each layer's art alone, sublayers included, named after the layer), selection?: one|each (instead of artboards: the selected art as one file, or a file per selected object, named after it), fullDocument?: false (one file per format instead: a PDF of every artboard, other formats the bounds of all visible art, named after the document), includeBleed?: false (artboards grown by the document's bleed; a PDF page keeps the artboard as its TrimBox and puts its row's bleed around it once, the document's bleed when the row sets none and its preset gives none or 0; a native, .ai or EPS file of an artboard holds the grown artboard with a bleed of 0), includeArtboardFill?: true (Include Artboard Fill: each artboard's background color behind its art; false leaves it out), pdfs?: multiple|single (Export PDFs As: with several artboards, single writes them as the pages of one PDF per PDF row, named after the document; refused with assets, layers or selection: each), exportPreset?: (a preset of document.exportPresets.list: its settings, under these params), subfolders?: false (each row's files in a sub-folder: its folder, else its size for raster (1x, 2x, 100w…) or its format (SVG, PDF)), folders?: none|rows (as subfolders)|format (a folder per extension: png, svg, pdf…)|item (a folder per artboard, asset, layer or object)|itemFormat (item/extension) (default: rows with subfolders or a preset, else none), name?: (a file name pattern instead of the item's name, with <filename> for the document, <name> for the artboard, asset, layer or object, <index> from 1, #### for the counter zero-padded to the run of #, <format>, <scale>, <suffix> (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, <date>, <time>, <YYYY>, <MM>, <DD>, <hh>, <mm> and <ss>; a trailing .ext is dropped, as in `COMPANY-Logo-<filename>-####-YYYYMMDD`; different files it names alike get -2, -3…), counterStart?: 1, counterPer?: item (every file of an item has its number)|file, date?: YYYY-MM-DD (the date the pattern uses; default today, UTC), preset?: mobile (PNG 1x, 2x, 3x) | density (PNG 0.75x–4x in ldpi…xxxhdpi sub-folders) instead of formats (turns subfolders on), formats?: [{format: png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft, scale?: 1 | \"2x\" | \"100w\" | \"100h\" | \"72ppi\", width?: px | height?: px | ppi? (raster only; width, then height, then ppi win over scale), suffix?: (raster default: @2x, @100w, @100h, none at 1x; vector formats drop size suffixes), folder?: (its sub-folder), quality?: (jpg 0–100; webp 0–100 with lossless: false), …the format's options (antiAlias, background, preset (pdf)…)}], settings?: {png|png8|jpg|webp|gif|tiff|bmp|tga|psd|svg|svgz|pdf|eps|ai|vectorcraft: {…options for every row of that format}} (rows' own options win), prefix?, antiAlias?: none|art|type (raster rows without their own), openLocation?: (remembered; the app shows the files after exporting)} one file per artboard and format (a PDF holds its artboard alone; artboards with the same name, in any case, get -2, -3…; an unnamed one is Artboard-N; a row whose file would take a name another row's file has, in any case, gets -2, -3… too, and identical rows write one file; row folders that differ only in case are one folder, spelled as the first row spells it) → {files: [path…]} (into the folder of exportPreset, outside the automation read roots: no ZIP path, and files relative to that folder); no folder → {files: [{name, dataBase64}]} (names include sub-folders: 2x/[email protected]); every reply has warnings: [the encoders' warnings for the files, each once: an image that couldn't be decoded, type written in the fallback font…]. eps, ai and vectorcraft rows write a document of the item alone (its one artboard). The params (but zip and assets) are remembered in the document (document.exportSettings; not an undo step). A key it doesn't take, a key no format takes in a format row or in settings, settings for a format it doesn't write, and an unknown key inside a PDF, EPS or SVG option's object, are refused; a key only another format takes in a row or in settings is not used, and warnings name it as given (formats[0].quality; a key in settings only when no row of that format reads it; not a key of an exportPreset). Under automation read roots, an svg or svgz row, and a row whose files carry the native document (vectorcraft, eps, ai but a version 7 file, a pdf with preserveEditing on that holds every artboard of the document it is Line truncated
has_doc,
screens::export_for_screens
),
+16 -7
View File
@@ -1131,23 +1131,29 @@ fn names_scripts(item: &Item, r: &Row, single: Option<&[usize]>) -> bool {
/// The document the file of `item` that row `r` writes carries when it carries one
/// ([`names_scripts`]): Full Document's PDF of every artboard, the item's artboard alone for a
/// native, `.ai` or EPS row ([`board_document`]), else the item's document.
fn carried_document<'a>(item: &'a Item, r: &Row, single: Option<&[usize]>) -> std::borrow::Cow<'a, Document> {
/// native, `.ai` or EPS row ([`board_document`]), else the item's document. `grown`: Include Bleed
/// grew the artboards by the document's bleed.
fn carried_document<'a>(item: &'a Item, r: &Row, single: Option<&[usize]>, grown: bool) -> std::borrow::Cow<'a, Document> {
match (&item.every_artboard, r.format.id, single) {
(Some(all), "pdf", None) => std::borrow::Cow::Borrowed(&**all),
_ if r.whole_document() && item.artboard.is_some() => std::borrow::Cow::Owned(board_document(item)),
_ if r.whole_document() && item.artboard.is_some() => std::borrow::Cow::Owned(board_document(item, grown)),
_ => std::borrow::Cow::Borrowed(&*item.doc),
}
}
/// The document a native, `.ai` or EPS row writes for `item`'s artboard: that artboard alone, with
/// its background color and the art on it, as Save's separateArtboards writes it (#3868).
fn board_document(item: &Item) -> Document {
/// its background color and the art on it, as Save's separateArtboards writes it (#3868). When
/// Include Bleed grew the artboard (`grown`), the artboard already holds the bleed, so the document
/// is written with a bleed of 0: opened again, its pages are not grown by the bleed a second time.
fn board_document(item: &Item, grown: bool) -> Document {
let mut d = single_artboard(&item.doc, item.region, &item.name);
if let (Some(a), Some(from)) = (d.artboards.first_mut(), item.doc.artboards.get(item.artboard.unwrap_or(0))) {
a.color = from.color;
}
super::save::keep_art_on(&mut d, item.region);
if grown && item.every_artboard.is_none() {
d.setup.bleed = [0.0; 4];
}
d
}
@@ -1209,7 +1215,7 @@ pub(crate) fn export(s: &mut Session, p: &Value, asked: &Value) -> Result<Value>
let all = item.every_artboard.is_some() && r.format.id == "pdf" && single.is_none();
let board = item.artboard.filter(|_| !all && r.whole_document());
if looked.insert((Arc::as_ptr(&item.doc) as usize, all, board))
&& crate::cmd::links::names_hidden_file(&carried_document(item, r, single.as_deref()), base)
&& crate::cmd::links::names_hidden_file(&carried_document(item, r, single.as_deref(), ungrown.is_some()), base)
{
return Err(bad(C, super::access::IMAGE_OUTSIDE));
}
@@ -1402,7 +1408,10 @@ fn encode_and_write(export: ScreenExport, writer: &mut dyn FnMut(&str, &[u8]) ->
write(pdf_doc.unwrap_or(all), "pdf", &options)?
} else if r.whole_document() && item.artboard.is_some() {
let b = item.artboard.unwrap_or(0);
let d = board_docs.entry((Arc::as_ptr(&item.doc) as usize, b)).or_insert_with(|| Arc::new(board_document(item))).clone();
let d = board_docs
.entry((Arc::as_ptr(&item.doc) as usize, b))
.or_insert_with(|| Arc::new(board_document(item, pdf_doc.is_some())))
.clone();
let mut options = r.options_for(item.region, None)?;
// An EPS page is the artboard, not its art's bounds: an artboard without art still writes.
if r.format.id == "eps" {
@@ -1512,3 +1512,39 @@ fn each_piece_writes_its_own_native_document() {
assert!(name.contains(&board), "{name} holds the artboard {board}");
}
}
/// With Include Bleed, a native, `.ai` or EPS file of an artboard holds the artboard grown by the
/// bleed, and no bleed of its own: opened again, a PDF with the document's bleed has the same page
/// as the export's own PDF row, not one grown by the bleed twice. A Full Document file keeps the
/// document's bleed around its art's bounds, which Include Bleed doesn't grow.
#[test]
fn include_bleed_native_files_hold_the_bleed_once() {
let mut s = Session::new();
s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap();
s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap();
s.execute("document.setup", &json!({"bleed": 9})).unwrap();
let r = export(&mut s, json!({"includeBleed": true, "artboard": 0, "formats": [{"format": "pdf"}]}));
let [(_, pdf)] = &files(&r)[..] else { panic!("one PDF: {r}") };
let [(media, bleed, ..)] = page_sizes(pdf)[..] else { panic!("one page") };
let reopened = |name: &str, bytes: &[u8]| -> (Session, Vec<PageSizes>) {
let mut t = Session::new();
t.execute("document.open", &json!({"name": name, "dataBase64": vectorcraft_format::base64_encode(bytes)})).unwrap();
let r = t.execute("document.exportPdf", &json!({"bleed": {"useDocument": true}, "preserveEditing": false})).unwrap();
let pages = page_sizes(&b64(&r));
(t, pages)
};
for format in ["vectorcraft", "ai", "eps"] {
let r = export(&mut s, json!({"includeBleed": true, "artboard": 0, "formats": [{"format": format}]}));
let [(name, bytes)] = &files(&r)[..] else { panic!("one {format} file: {r}") };
let (t, pages) = reopened(name, bytes);
let [(m, b, trim, _)] = pages[..] else { panic!("{format}: one page") };
assert_eq!((m, b), (media, bleed), "{format}: the page of the PDF row");
assert_eq!(trim, bleed, "{format}: the artboard holds the bleed");
assert_eq!(t.doc().unwrap().doc.setup.bleed, [0.0; 4], "{format}: no second bleed");
}
// Full Document: the art's bounds, with the document's bleed around them.
let r = export(&mut s, json!({"includeBleed": true, "fullDocument": true, "formats": [{"format": "vectorcraft"}]}));
let [(name, bytes)] = &files(&r)[..] else { panic!("one file: {r}") };
let (t, _) = reopened(name, bytes);
assert_eq!(t.doc().unwrap().doc.setup.bleed, [9.0; 4]);
}
+86 -8
View File
@@ -17,7 +17,8 @@ use std::sync::Arc;
use craft::behavior::IconId;
use craft::color_ui::ui::{
ColorPanel, ColorPanelLayout, ColorPanelMode, ColorPanelOutput, ColorPanelShown, ColorPanelState, ColorPanelWords, DropperButton, SwatchPalette,
ColorPanel, ColorPanelLayout, ColorPanelMode, ColorPanelOutput, ColorPanelShown, ColorPanelState, ColorPanelWords, DropperButton, PickedColor,
SwatchPalette,
};
use craft::theme::Srgba;
use craft::theme::variant::Tone;
@@ -43,6 +44,7 @@ use vectorcraft_geom::{Point, Rect};
use vectorcraft_tools::params::color_json;
use crate::VectorcraftApp;
use crate::panels::color::model_values;
use crate::panels::gradient::{edit_point, edits_points, set_stops, set_stops_keeping_models, shown_points};
use crate::panels::{Live, active_paint, c32};
@@ -470,6 +472,9 @@ fn body(ui: &mut Ui, feed: &Feed, tab: &mut Tab, panel: &mut ColorPanelState, fi
filed.panels.push(
ColorPanel::new(Bind::bound(&mut *panel), [feed.current; 2])
.layout(ColorPanelLayout::FillStroke)
// The rows show and edit the stop's own values (CMYK %, working RGB), not values
// derived again from its sRGB on every frame.
.edited(Some(PickedColor::in_model(feed.current, model_values(&feed.color))))
.shown(feed.shown.clone())
.show(ui),
);
@@ -575,13 +580,11 @@ fn place(app: &VectorcraftApp, ctx: &egui::Context, anchor: Anchor) -> Pos2 {
}
}
/// Pushes `target`'s values, the swatches, what the Color panel shows and the place into the open popover `id`.
fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Target) {
let Some(dialogs) = app.dialogs() else { return };
let Some(anchor) = dialogs.with(|host| host.get_by_id::<GradientStopPopover>(id).map(|popover| popover.anchor)) else { return };
/// `target`'s values, the document's swatches and what the Color panel shows, for the popover's body.
fn feed(app: &VectorcraftApp, target: &Target) -> Feed {
let shown = crate::panels::color::shown(app, &crate::panels::color::target_now(app));
let swatches = swatch_colors(app);
let feed = Feed {
Feed {
point: matches!(target, Target::Point(..)),
color: target.color(),
current: Srgba::from(c32(&target.color())),
@@ -590,7 +593,14 @@ fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Tar
tiles: swatches.iter().map(|(name, c)| (Label::from(name.clone()), Srgba::from(c32(c)))).collect(),
swatches,
shown,
};
}
}
/// Pushes `target`'s values, the swatches, what the Color panel shows and the place into the open popover `id`.
fn refresh(app: &VectorcraftApp, ctx: &egui::Context, id: DialogId, target: &Target) {
let Some(dialogs) = app.dialogs() else { return };
let Some(anchor) = dialogs.with(|host| host.get_by_id::<GradientStopPopover>(id).map(|popover| popover.anchor)) else { return };
let feed = feed(app, target);
let at = place(app, ctx, anchor);
dialogs.with(|host| {
if let Some(popover) = host.get_mut_by_id::<GradientStopPopover>(id) {
@@ -776,7 +786,14 @@ fn apply(app: &mut VectorcraftApp, target: &Target, f: &PopoverFields) {
#[cfg(test)]
mod tests {
use craft::behavior::{EditEvent, GestureId, Mixed};
use craft::color_ui::ui::{PanelTarget, PickedColor};
use std::cell::RefCell;
use std::rc::Rc;
use craft::color_ui::ui::PanelTarget;
use craft::ui::runtime::access::Role;
use craft::ui::testing::Fixture;
use craft::ui::testing::focus::AccessActionKind;
use egui::{Key, Modifiers};
use vectorcraft_engine::Session;
use super::*;
@@ -1203,4 +1220,65 @@ mod tests {
host::pump(&mut app, &ctx);
assert!(!is_open(&app));
}
/// The popover's body over `app`'s selected stop in `mode`, drawn headless; each frame's Color panel output is
/// applied to the stop as `pump` applies it.
fn panel_body(app: Rc<RefCell<VectorcraftApp>>, mode: ColorPanelMode) -> Fixture {
let mut tab = Tab::Color;
let mut panel = ColorPanelState::default();
panel.mode = mode;
app.borrow_mut().ui.color_panel.mode = mode;
let mut fx = Fixture::new(move |ui| {
let mut app = app.borrow_mut();
let Some(target) = selected(&app) else { return };
let feed = feed(&app, &target);
let mut filed = Filed::default();
body(ui, &feed, &mut tab, &mut panel, &mut filed);
for output in &filed.panels {
crate::panels::color::apply_output(&mut app, output);
}
});
fx.room(vec2(320.0, 640.0)).settle();
fx
}
fn stop_cmyk(app: &VectorcraftApp) -> [f32; 4] {
let Color::Cmyk { c, m, y, k } = stops(app)[1].color else { panic!("a CMYK stop: {:?}", stops(app)[1].color) };
[c, m, y, k]
}
/// A CMYK value typed or set on one row of the popover changes only that channel: the others keep their
/// exact values instead of being worked out again from the stop's RGB.
#[test]
fn a_cmyk_stop_keeps_its_other_channels_when_one_is_typed_or_dragged() {
let mut app = app();
app.run("file.documentColorMode", json!({"mode": "cmyk"})).unwrap();
let stops_json = json!([{"offset": 0, "color": "#ffffff"}, {"offset": 0.5, "color": {"c": 10, "m": 20, "y": 30, "k": 5}}, {"offset": 1, "color": "#000000"}]);
app.run("paint.setFill", json!({"gradient": {"stops": stops_json, "start": [100, 150], "end": [200, 150]}, "keepModel": true})).unwrap();
app.run("gradient.selectStop", json!({"index": 1})).unwrap();
let close = |a: [f32; 4], b: [f32; 4]| a.iter().zip(b).all(|(x, y)| (x - y).abs() < 1e-4);
assert!(close(stop_cmyk(&app), [0.10, 0.20, 0.30, 0.05]), "{:?}", stop_cmyk(&app));
let app = Rc::new(RefCell::new(app));
let mut fx = panel_body(app.clone(), ColorPanelMode::CmykSliders);
let row = |fx: &Fixture, name: &str| {
fx.by_role(Role::SLIDER).into_iter().find(|t| fx.tree().name_of(t.node) == Some(name)).unwrap_or_else(|| panic!("the {name} slider"))
};
// Typed: the Cyan field gets 40.
let field = fx.by_role(Role::SPIN_BUTTON).into_iter().find(|t| fx.tree().name_of(t.node) == Some("Cyan")).expect("the Cyan field");
fx.click(&field).key(Key::A, Modifiers::COMMAND).type_text("40").key(Key::Enter, Modifiers::NONE).settle();
let typed = stop_cmyk(&app.borrow());
assert!(close(typed, [0.40, 0.20, 0.30, 0.05]), "typed Cyan: {typed:?}");
// Set as a screen reader sets it: the Magenta slider goes to 60.
let magenta = row(&fx, "Magenta");
fx.access(AccessActionKind::SetValue(60.0), &magenta).idle(2);
let set = stop_cmyk(&app.borrow());
assert!(close(set, [0.40, 0.60, 0.30, 0.05]), "Magenta set to 60: {set:?}");
// Dragged with the pointer: the Yellow slider's thumb goes from a tenth to most of the way across.
let yellow = row(&fx, "Yellow");
let along = |f: f32| egui::pos2(yellow.rect.left() + f * yellow.rect.width(), yellow.rect.center().y);
fx.drag_at(along(0.1), along(0.8) - along(0.1)).idle(2);
let [c, m, y, k] = stop_cmyk(&app.borrow());
assert!(close([c, m, k, 0.0], [0.40, 0.60, 0.05, 0.0]), "dragged Yellow kept the other channels: {:?}", [c, m, y, k]);
assert!(y > 0.5, "the drag moved Yellow: {y}");
}
}
+5 -3
View File
@@ -69,13 +69,15 @@ static EMBEDDED: &Embedded = &[
("fi", "", include_str!("i18n/fi.tsv")),
("tr", "", include_str!("i18n/tr.tsv")),
("ca", "", include_str!("i18n/ca.tsv")),
("ar", "", include_str!("i18n/ar.tsv")),
];
/// The codes of [`EMBEDDED`] the interface offers. Browsers cannot use the native installed-font
/// fallback, so on the web a language whose text would be missing-glyph boxes (Gujarati without a
/// bundled Gujarati face) is not offered, including when restoring a preference.
/// bundled Gujarati face) is not offered, including when restoring a preference. Arabic is kept
/// unavailable to users until the shared catalog in `storytold/craft-i18n` is consumed.
fn offered_codes(web: bool, gujarati_font: bool) -> Vec<&'static str> {
EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "gu" || !web || gujarati_font).collect()
EMBEDDED.iter().map(|(code, ..)| *code).filter(|code| *code != "ar" && (*code != "gu" || !web || gujarati_font)).collect()
}
/// The one catalog set of the process, built on first use.
@@ -141,7 +143,7 @@ impl LangExt for Lang {
}
fn complete_menus(self) -> bool {
self != Lang::EN
self != Lang::EN && self.code() != "ar"
}
fn from_code(code: &str) -> Option<Lang> {
+8
View File
@@ -0,0 +1,8 @@
# Arabic (ar) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation
# (empty context = a plain UI string; `@id` = a command id; `@plural` = 6 CLDR forms;
# `@msg` = a status or error message).
#
# Translations are maintained upstream in storytold/craft-i18n (locales/ar/vectorcraft.tsv)
# under AGENTS.md rule 16.
@id language.name العربية
@plural {n} commit|{n} commits {n} إيداع|{n} إيداع|{n} إيداعين|{n} إيداعات|{n} إيداعًا|{n} إيداع
1 # Arabic (ar) catalog. Same format as zh-hant.tsv: context <TAB> source <TAB> translation
2 # (empty context = a plain UI string; `@id` = a command id; `@plural` = 6 CLDR forms;
3 # `@msg` = a status or error message).
4 #
5 # Translations are maintained upstream in storytold/craft-i18n (locales/ar/vectorcraft.tsv)
6 # under AGENTS.md rule 16.
7 @id language.name العربية
8 @plural {n} commit|{n} commits {n} إيداع|{n} إيداع|{n} إيداعين|{n} إيداعات|{n} إيداعًا|{n} إيداع
+24 -2
View File
@@ -7,9 +7,9 @@ fn lang(code: &str) -> Lang {
Lang::from_code(code).unwrap_or_else(|| panic!("{code} registered"))
}
/// The languages that are not English, the source language.
/// The languages that are not English, the source language, and have complete catalogs.
fn translated() -> Vec<Lang> {
Lang::all().filter(|l| *l != Lang::EN).collect()
Lang::all().filter(|l| l.complete_menus()).collect()
}
/// (language, context, English source, the term the language's glossary gives it). One row per
@@ -173,6 +173,28 @@ fn numbered_labels_translate_the_name_before_the_number() {
assert_eq!(numbered_label(Lang::EN, "Grays 12"), "Grays 12");
}
#[test]
fn arabic_is_preparatory_and_unavailable_to_users() {
assert_eq!(Lang::from_code("ar"), None);
assert!(!Lang::for_picker().iter().any(|l| l.code() == "ar"));
assert_eq!(Lang::from_pref("ar"), Lang::from_pref("auto"));
}
#[test]
fn arabic_plural_rule_and_catalog_infrastructure() {
let (i18n, problems) = I18n::new(EMBEDDED, &["ar"]);
assert!(problems.is_empty(), "{problems:?}");
let ar = i18n.from_code("ar").expect("ar offered in custom instance");
assert_eq!(i18n.name(ar), "العربية");
for tag in ["ar", "AR", "ar-SA", "ar_EG", "ar_EG.UTF-8", "ar-AE", "ar-MA"] {
assert_eq!(i18n.match_tag(tag), Some(ar), "{tag}");
}
for (n, want) in [(0, "0 إيداع"), (1, "1 إيداع"), (2, "2 إيداعين"), (3, "3 إيداعات"), (11, "11 إيداعًا"), (100, "100 إيداع")]
{
assert_eq!(i18n.trn_plain(ar, n, "{n} commit", "{n} commits"), want, "for n={n}");
}
}
#[test]
fn current_language_is_a_frame_setting() {
set_current(ZH());
+3 -2
View File
@@ -1,6 +1,6 @@
# Localization parity
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests)
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-25 · **Change:** patch (Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests)
Per-language status of VectorCraft's interface. How the catalogs work and how to add a language:
[`development.md` › Localisation](development.md#localisation). Part of
@@ -35,7 +35,7 @@ Chinese by `imachus`). Georgian and the original Gujarati catalog are recorded a
| Spanish | `es` | 4,009 / 4,020 (99.7%) | all (3,770 `@msg` and 55 `@msgplural` rows, counted 2026-11-18: the untranslated report lists 269 messages without a Spanish row, 236 in its own section and 33 that all 24 checked languages lack) | Latin | no | full | — (review) |
| Hindi | `hi` | 8,782 rows (2026-11-13): 3,014 `@msg`, 47 `@msgplural`, 41 `@plural`; the untranslated report on main `f793044f83` (2026-11-14) lists 676 missing rows for it: 608 in its own section and 68 that every checked language lacks | menus, dialogs, tooltips and scanned messages; contributor-approved loanword terminology; agent wording pass | UI and document text shape with HarfRust; installed desktop Devanagari fallback, or a `Deva` craft-fonts face; the web fetches Noto Sans Devanagari when the interface needs it | contributor terminology review; 2026-11-13 wording pass on messages and longer labels, and a word-sense pass on short labels, with a glossary-term test; wider proofread welcome | complete catalog, machine-assisted draft | reported missing rows, native review and layout |
| Gujarati | `gu` | 4,673 rows (2026-11-14): original 4,286 unchanged; all 387 additions contributor-reviewed and approved | menus and dialogs; status/error messages partial | installed Gujarati fonts on desktop; optional `Gujr` craft-fonts fallback; no Gujarati face in the pinned CI/release fonts or web startup list | original catalog reviewed by a native speaker; all 387 later additions approved by the contributor, with 11 wording corrections | contributor-reviewed catalog | remaining messages and a bundled Gujarati web font |
| Arabic | `ar` | 0 | none | document text: bidi layout and Paragraph Direction; interface: no right-to-left layout, no Arabic shaping in egui | no | none | 25–40 |
| Arabic | `ar` | preparatory registration (native name العربية) and 6-form CLDR plural probe only; translations maintained upstream in `storytold/craft-i18n` (`locales/ar/vectorcraft.tsv`) and not yet consumed | none (UI not exposed pending shared catalog) | document text: existing bidirectional layout and paragraph direction; interface UI: not exposed pending shared catalog, with full shell mirroring pending STD-I18N-001 | — (preparatory) | preparatory (not exposed) | 15–20 |
| French | `fr` | 9,166 rows, 3,436 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 178 missing messages for it | all | Latin | no | full | — (review) |
| Portuguese | `pt-br` | 9,378 rows, 3,563 of them `@msg` and 48 `@msgplural` (counted 2026-11-13): the untranslated report lists 55 missing messages for it, which open #7116, #7211, #7330, #7378 and #7405 translate; one/other plurals | all | Latin | contributor is a Brazilian Portuguese speaker; further native review welcome | full | — (review) |
| Indonesian | `id` | 7,553 rows, 1,682 of them `@msg` and 49 `@msgplural` (counted 2026-11-15 on `main` at `df984b2a02`): in `COMPLETE_MESSAGES`, and the untranslated report lists 50 missing menu strings, 35 `tl!` literals, 11 undo labels and 1,929 messages for it, the same sets as for Danish; one plural form | most dialogs and tooltips; status and error messages partial | Latin | no | full | — (review) |
@@ -101,6 +101,7 @@ font for the web build.
| Date | Change | Summary |
|---|---|---|
| 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog |
| 2026-11-14 | minor | Gujarati (#6613): contributor proofreading completed for all 387 additions, with 11 wording corrections; 4,673 reviewed catalog rows. Status/error messages remain partial; web selection requires a bundled Gujarati face. Scores and estimates unchanged. |
| 2026-11-12 | minor | Gujarati (`gu`): reviewed by a native speaker; zero/one singular plurals (CLDR); Gujarati craft-fonts faces join the UI fonts; strings added on main since branching translated (4,286 rows) |
| 2026-11-11 | minor | Gujarati (`gu`): 4,235-row machine-assisted interface catalog, one/other plurals, desktop Gujarati font fallback and a glyph-coverage filter; status and error messages not yet translated; native review pending |
+2 -1
View File
@@ -12086,7 +12086,8 @@ height (`"100h"`) or a resolution (`"72ppi"`); raster rows name their files `@2x
otherwise. `fullDocument` writes one file per row instead (a PDF of every artboard, other formats the bounds of all
art), `includeBleed` grows each artboard by the document's bleed (a PDF row's page keeps the artboard as its
TrimBox and puts the row's `bleed` around it once: the row's own values, zero included, else the document's bleed
when the row sets none and its PDF preset gives none or a bleed of 0), `includeArtboardFill: false` (Include Artboard
when the row sets none and its PDF preset gives none or a bleed of 0; a native, `.ai` or EPS file of an artboard
holds the grown artboard with a bleed of 0, so the bleed is not added again when the file is opened), `includeArtboardFill: false` (Include Artboard
Fill unchecked) leaves the artboards' background colors out of the files, `pdfs: "single"` (Export PDFs As › Single file)
writes the artboards a PDF row exports as the pages of one PDF named after the document (it is refused with
`assets`, `layers` or `selection: "each"`, whose files each hold one item's art), `subfolders` puts each