diff --git a/Cargo.lock b/Cargo.lock index 00fe4ca454..f3e85a08a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6386,6 +6386,7 @@ dependencies = [ "pollster 1.0.1", "raw-window-handle", "rfd", + "rustix 1.1.6", "serde_json", "socket2", "tempfile", @@ -6822,6 +6823,7 @@ dependencies = [ "skrifa 0.47.0", "svgtypes 0.16.1", "thiserror 2.0.21", + "unicode-bidi", "usvg 0.48.1", "vectorcraft-brush", "vectorcraft-color", diff --git a/ROADMAP.md b/ROADMAP.md index fe038ec97a..dabed3eb94 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -18,6 +18,8 @@ gate: all six core workflows (path drawing and editing, paint and style, type, l production, file exchange) work end to end on macOS with save and reopen, and only the last is partial, without blocking it ([Alpha gate](docs/roadmap.md#alpha-gate)). +> **Gujarati status (2026-11-14, #6613):** 4,673 catalog rows: the original 4,286 remain unchanged; all 387 additions are contributor-reviewed and approved, with 11 wording corrections. Status/error messages remain partial, and the pinned CI/release fonts and web startup list contain no Gujarati face; web selection stays unavailable until a Gujarati interface face is bundled. Scores and estimates unchanged. + ## Headline numbers | | Value | Kind | @@ -96,6 +98,7 @@ Weights, evidence and the missing items per area: [target-app-parity.md](docs/ta | Simplified Chinese | `zh-hans` | partial (messages in English) | 85% | | Spanish | `es` | full | 100% | | Hindi | `hi` | catalog complete; machine-assisted draft, native review pending | complete under the scanner | +| Gujarati | `gu` | 4,673 contributor-reviewed catalog rows; 11 corrections applied to the 387 additions | menus and dialogs; status/error messages partial | | Arabic | `ar` | none (no right-to-left interface) | 0% | | French | `fr` | full | 100% | | Portuguese (Brazil) | `pt-br` | full | 100% | @@ -121,6 +124,8 @@ Ranked; detail in [docs/roadmap.md](docs/roadmap.md) and [docs/gaps.md](docs/gap ## Progress log +- 2026-11-14: Built-in symbol library Weather Icons: adds a sixth procedural symbol library (Window › Symbol Libraries, the Symbols panel's Symbol Libraries Menu) containing six original vector symbols (Sun, Moon, Cloud, Rain, Thunder, Snow) generated in code without default 9-slice guides (part of Gap 5). Headline numbers unchanged. + - 2026-11-05: Window › Toolbars › Keep Tools Beside the Canvas, off by default, docks the Tools panel between left-side panels and the canvas instead of at the window's left edge, and the canvas's left edge then also docks a floating Tools panel (`window.toolsBesideCanvas`, #5395). Workspaces keep the setting; workspaces saved without it keep Tools at the window's edge. An optional VectorCraft layout choice; headline numbers unchanged. - 2026-11-12: Stencil Bridges in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): strips of a set width are cut out of the selected art so that every island of a stencil cut from it (the inside of an O, a hole in a shape) stays attached to the sheet, by the shortest crossings first, vertical, horizontal or the shortest among 12 directions 15° apart, with up to 16 bridges per island; type is measured by its glyph outlines and stays type, and the original goes to a hidden layer or is replaced. One undo step (`addon.cutting.bridges`). A VectorCraft addition: headline numbers unchanged. - 2026-11-13: Banner Hems and Grommets in the Cutting Tools add-on (Object › Plug-ins › Cutting Tools): on the chosen sides of the selected art's bounds, or of each artboard, a hem line at a set depth inside the edge and grommet marks (a circle with a cross) at a set inset, one at each end of a side and the rest spread evenly at most a set spacing apart, stroked in a chosen swatch; a dialog with Preview, one undo step (`addon.cutting.banner`). A VectorCraft addition: headline numbers unchanged. @@ -218,6 +223,7 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap | Date | Change | Summary | |---|---|---| +| 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-10 | minor | Tidy-up, no content change: the unheaded change bullets at the top of the file and a revision row inside the headline-numbers table move to this table under their commit dates. Scores and estimates unchanged. | | 2026-11-10 | minor | Raster effects: Effect Gallery thumbnails and an in-dialog preview (an original drawing through each filter). Features-table Raster effects 85% → 88%, hours 1–2 → none. Headline numbers unchanged, so the progress log is unchanged. | | 2026-11-05 | minor | Compound Shapes add-on (beyond Illustrator): a menu for Make, Release and Expand Compound Shape and a setting, off by default, that makes the Pathfinder panel's Shape Mode buttons create compound shapes on a click. Scores and estimates unchanged. | @@ -226,6 +232,8 @@ The full earlier record of what landed is kept in [docs/roadmap.md](docs/roadmap | 2026-11-03 | minor | UI: Window → Help Bar toggles the tool-help strip separately from the status bar and saves visibility with workspaces. Scores and estimates unchanged. | | 2026-11-03 | minor | Docked Tools stays between left-side panels and the canvas; redocking accepts canvas and window edges. Requested layout choice; scores and estimates unchanged. | | 2026-11-02 | minor | Selection QoL: saved marquee modes, screen drag direction with a 3 px dead zone, and translated mode/E feedback (#5313); VectorCraft addition, 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; messages not yet translated; native review pending | | 2026-11-06 | minor | Hindi (`hi`): 7,877-row machine-assisted catalog, zero/one singular plurals, desktop font fallback and optional Devanagari craft-fonts fallback; all 55 translation tests pass; native review and a web font remain; scores and estimates unchanged | | 2026-11-05 | minor | Progress log row for the Type Tools add-on's Release Type on a Path (#5532); headline numbers unchanged. | | 2026-11-03 | minor | Progress log row for the Type Tools add-on's Text Tweaker (#4924); headline numbers unchanged. | diff --git a/apps/vectorcraft-web/src/locks.rs b/apps/vectorcraft-web/src/locks.rs index 7eb2e6cdb7..dffd87868a 100644 --- a/apps/vectorcraft-web/src/locks.rs +++ b/apps/vectorcraft-web/src/locks.rs @@ -8,23 +8,40 @@ //! Pages that aren't secure (plain `http://` other than localhost) and older browsers have none: //! heartbeats alone decide there. +#[cfg(target_arch = "wasm32")] use std::cell::RefCell; +#[cfg(target_arch = "wasm32")] use std::collections::{BTreeMap, BTreeSet}; +#[cfg(target_arch = "wasm32")] use std::sync::{Arc, Mutex}; +#[cfg(target_arch = "wasm32")] use js_sys::{Function, Promise, Reflect}; +#[cfg(target_arch = "wasm32")] use vectorcraft_engine::cmd::recovery::Hold; +#[cfg(target_arch = "wasm32")] use wasm_bindgen::JsCast as _; +#[cfg(target_arch = "wasm32")] use wasm_bindgen::JsValue; +#[cfg(target_arch = "wasm32")] use wasm_bindgen::closure::Closure; /// How often the snapshot of the locks held is refreshed (ms). +#[cfg(target_arch = "wasm32")] const REFRESH_MS: i32 = 10_000; /// How old a snapshot may be and still be trusted (ms). A lock asked for after the snapshot was /// taken comes with a heartbeat, which stays fresh for at least three minutes, so anything under /// that is safe; an older snapshot counts every area as held. const FRESH_MS: f64 = 60_000.0; +/// Whether a snapshot asked for at `asked` can still be trusted at `now`, both in ms on +/// [`vectorcraft_ui_egui::now_ms`]'s clock: it is at most [`FRESH_MS`] old, and not stamped later +/// than `now`. +fn trusted(asked: f64, now: f64) -> bool { + (0.0..=FRESH_MS).contains(&(now - asked)) +} + +#[cfg(target_arch = "wasm32")] thread_local! { /// What releases each lock this tab holds, by name: it resolves the promise the lock is held /// by (wasm runs on one thread). @@ -32,26 +49,31 @@ thread_local! { } /// The locks of the page, named ``. +#[cfg(target_arch = "wasm32")] #[derive(Clone)] pub struct WebLocks { prefix: &'static str, - /// The areas whose locks were held at the last snapshot, and when it was asked for (ms since - /// the epoch). `navigator.locks.query()` is asynchronous, so the snapshot is refreshed every + /// The areas whose locks were held at the last snapshot, and when it was asked for (ms on + /// [`vectorcraft_ui_egui::now_ms`]'s monotonic clock, which a change to the system clock does + /// not move). `navigator.locks.query()` is asynchronous, so the snapshot is refreshed every /// [`REFRESH_MS`] and read from here. seen: Arc)>>, } /// `navigator.locks`, if the browser has it here. +#[cfg(target_arch = "wasm32")] fn manager() -> Option { let locks = Reflect::get(&web_sys::window()?.navigator(), &"locks".into()).ok()?; locks.is_object().then_some(locks) } /// Method `name` of `obj`. +#[cfg(target_arch = "wasm32")] fn method(obj: &JsValue, name: &str) -> Option { Reflect::get(obj, &name.into()).ok()?.dyn_into().ok() } +#[cfg(target_arch = "wasm32")] impl WebLocks { /// The page's Web Locks with a first snapshot of them, kept fresh from then on; `None` when /// the browser has none or won't say which are held (heartbeats alone decide then). @@ -75,7 +97,7 @@ impl WebLocks { /// Take a new snapshot of the locks held. async fn refresh(&self) -> Option<()> { let m = manager()?; - let asked = js_sys::Date::now(); + let asked = vectorcraft_ui_egui::now_ms(); let query: Promise = method(&m, "query")?.call0(&m).ok()?.dyn_into().ok()?; let snapshot = wasm_bindgen_futures::JsFuture::from(query).await.ok()?; let held = js_sys::Array::from(&Reflect::get(&snapshot, &"held".into()).ok()?); @@ -91,7 +113,7 @@ impl WebLocks { /// Does a tab hold `area`'s lock? Yes when the last snapshot is too old to tell. pub fn held(&self, area: &str) -> bool { let seen = self.seen.lock().unwrap_or_else(|e| e.into_inner()); - js_sys::Date::now() - seen.0 > FRESH_MS || seen.1.contains(area) + !trusted(seen.0, vectorcraft_ui_egui::now_ms()) || seen.1.contains(area) } /// Hold `area`'s lock until the returned hold is dropped (or the page goes). @@ -110,8 +132,10 @@ impl WebLocks { } /// A lock this tab holds (by name), released when dropped. +#[cfg(target_arch = "wasm32")] struct LockHold(String); +#[cfg(target_arch = "wasm32")] impl Drop for LockHold { fn drop(&mut self) { if let Some(resolve) = RELEASE.with(|r| r.borrow_mut().remove(&self.0)) { @@ -120,3 +144,24 @@ impl Drop for LockHold { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn a_snapshot_is_trusted_for_a_minute() { + assert!(trusted(1_000.0, 1_000.0)); + assert!(trusted(1_000.0, 1_000.0 + FRESH_MS)); + assert!(!trusted(1_000.0, 1_001.0 + FRESH_MS)); + // Before the first snapshot every area counts as held. + assert!(!trusted(f64::NEG_INFINITY, 0.0)); + } + + #[test] + fn a_snapshot_stamped_later_than_now_is_not_trusted() { + // A clock that went back reads an old snapshot as taken in the future. + assert!(!trusted(5_000_000.0, 1_000.0)); + assert!(!trusted(1_001.0, 1_000.0)); + } +} diff --git a/apps/vectorcraft-web/src/main.rs b/apps/vectorcraft-web/src/main.rs index 3808c281f9..457d8d4640 100644 --- a/apps/vectorcraft-web/src/main.rs +++ b/apps/vectorcraft-web/src/main.rs @@ -25,7 +25,7 @@ mod api; mod fonts; #[cfg(any(target_arch = "wasm32", test))] mod keys; -#[cfg(target_arch = "wasm32")] +#[cfg(any(target_arch = "wasm32", test))] mod locks; #[cfg(any(target_arch = "wasm32", test))] mod pencil; diff --git a/apps/vectorcraft/Cargo.toml b/apps/vectorcraft/Cargo.toml index 2da5f0083d..9a1b11e350 100644 --- a/apps/vectorcraft/Cargo.toml +++ b/apps/vectorcraft/Cargo.toml @@ -110,6 +110,10 @@ wayland-protocols = { version = "0.32", features = ["client", "unstable"] } # wayland-protocols' `unstable` set) made on the window's own connection. MIT, already in the build # through winit and rfd. wayland-backend = { version = "0.3", features = ["client_system"] } +# The Wayland clipboard's pipes (src/clipboard.rs): `poll` and the nonblocking flag give up a read +# or send when the other app moves no data for a while. Apache-2.0 WITH LLVM-exception OR +# Apache-2.0 OR MIT, already in the build through the workspace. +rustix = { workspace = true, features = ["std", "event", "fs"] } # The save dialog's file type (src/portal_save.rs, #2679): the desktop portal over D-Bus, on the # systems where rfd shows the portal's dialog. MIT, already in the build through accesskit. Pinned diff --git a/apps/vectorcraft/src/app.rs b/apps/vectorcraft/src/app.rs index 126b671877..dddaf0a91e 100644 --- a/apps/vectorcraft/src/app.rs +++ b/apps/vectorcraft/src/app.rs @@ -108,37 +108,14 @@ impl eframe::App for App { self.app.start_pending_update(); #[cfg(target_os = "macos")] super::mac_cursor::release(); + // Dropping the app can wait for the clipboard handles to let go: the windows leave the + // screen first (`quit_windows`). #[cfg(not(any(target_os = "macos", windows)))] - hide_before_teardown(self.winit_window.as_deref()); + super::quit_windows::before_teardown(self.winit_window.as_deref()); end_before_teardown(self.frames); } } -/// The main window as [`hide_before_teardown`] sees it. -#[cfg(not(any(target_os = "macos", windows)))] -pub(crate) trait QuittingWindow { - fn hide(&self); -} - -#[cfg(not(any(target_os = "macos", windows)))] -impl QuittingWindow for winit::window::Window { - fn hide(&self) { - self.set_visible(false); - } -} - -/// On Linux and the BSDs, hide the main window before eframe drops the app. Dropping the app waits -/// up to [`vectorcraft_ui_egui::CLIPBOARD_PROBE_STOP_WAIT`] for the clipboard handles to let go, and -/// the window would stay on screen for that time. The window is hidden, not closed: the Wayland -/// clipboard reads text on the window's connection. winit hides X11 windows (XWayland included) and -/// cannot hide a Wayland window. -#[cfg(not(any(target_os = "macos", windows)))] -pub(crate) fn hide_before_teardown(window: Option<&W>) { - if let Some(window) = window { - window.hide(); - } -} - impl App { /// The frame's times for the hang report, and its last stage ([`hang_beacon::after_frame`]): a /// focused, shown window whose windows had input waits for the renderer and the next frame, diff --git a/apps/vectorcraft/src/clipboard.rs b/apps/vectorcraft/src/clipboard.rs index 77a96442c4..bcd37ecce3 100644 --- a/apps/vectorcraft/src/clipboard.rs +++ b/apps/vectorcraft/src/clipboard.rs @@ -11,9 +11,9 @@ //! backend reads the compositor's clipboard (X11 through XWayland only sees what X11 apps //! copied), falling back to X11 where the compositor lacks the protocol, and where there is no //! X11 either (a Flatpak on GNOME) to the compositor's core protocol on the window's connection: -//! Copy offers SVG (`image/svg+xml`), PNG (`image/png`) and text together, and Paste reads SVG, -//! text and PNG. A clipboard that can't be opened is tried again after a wait that grows to a -//! minute, not each time Paste asks. On Linux and the BSDs a read waits 2 s at most for the app +//! Copy offers SVG (`image/svg+xml`), PNG (`image/png`) and text together, and Paste reads copied +//! files (`text/uri-list`), SVG, text and PNG. A clipboard that can't be opened is tried again +//! after a wait that grows to a minute, not each time Paste asks. On Linux and the BSDs a read waits 2 s at most for the app //! that copied to send its data (a bitmap 10 s), and until that app answers, later reads fail at //! once; a paste then waits for that read's answer off the UI thread. //! - Everywhere: files copied in a file manager paste as the first one that is art (SVG, PDF, EPS, @@ -172,6 +172,85 @@ fn copied_file(paths: Vec, mimes: &[&'static str]) -> Option { }) } +/// The most URIs a copied file list may hold, VectorCraft's own limit: a longer list (untrusted +/// data) names no files. +const MAX_URIS: usize = 1024; + +/// The local files a `text/uri-list` names, in order ([`file_uri_path`]). Each line holds one URI +/// and a line that starts with `#` is a comment (RFC 2483, section 5); lines end in CRLF or LF. +/// Lines that are not UTF-8 and URIs that don't name a local file are skipped. A list of more than +/// [`MAX_URIS`] URIs names none. +#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +fn uri_list_paths(list: &[u8]) -> Vec { + let uris: Vec<&[u8]> = list + .split(|&b| b == b'\n') + .map(|line| line.strip_suffix(b"\r").unwrap_or(line)) + .filter(|line| !line.is_empty() && !line.starts_with(b"#")) + .take(MAX_URIS + 1) + .collect(); + if uris.len() > MAX_URIS { + return vec![]; + } + uris.into_iter().filter_map(|uri| file_uri_path(std::str::from_utf8(uri).ok()?)).collect() +} + +/// The local files GNOME Files' `x-special/gnome-copied-files` names: a first line of `copy` or +/// `cut`, then one URI a line, read as [`uri_list_paths`] reads them. A paste places the files' +/// art either way and leaves the files where they are. No files when the first line is neither. +#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +fn gnome_copied_paths(list: &[u8]) -> Vec { + let (action, uris) = match list.iter().position(|&b| b == b'\n') { + Some(end) => (list.get(..end).unwrap_or_default(), list.get(end + 1..).unwrap_or_default()), + None => (list, &[][..]), + }; + match action.strip_suffix(b"\r").unwrap_or(action) { + b"copy" | b"cut" => uri_list_paths(uris), + _ => vec![], + } +} + +/// The absolute path a `file:` URI names on this machine: `file:/path`, `file:///path` or +/// `file://localhost/path` (RFC 8089, section 2; scheme and host in any letter case), its percent +/// escapes decoded once (RFC 3986, section 2.1) and a fragment (`#…`) left out. None for another +/// scheme, another host, a relative path, a query (`?…`), a bad escape, an escaped NUL or a path +/// that is not UTF-8 once decoded. +#[cfg_attr(not(target_os = "linux"), allow(dead_code))] +fn file_uri_path(uri: &str) -> Option { + let uri = uri.trim_matches(|c: char| c.is_ascii_whitespace()); + let uri = uri.split_once('#').map_or(uri, |(before, _)| before); + if uri.contains('?') { + return None; + } + let scheme = uri.get(..5).filter(|s| s.eq_ignore_ascii_case("file:"))?; + let rest = uri.get(scheme.len()..)?; + let path = match rest.strip_prefix("//") { + Some(authority_and_path) => { + let slash = authority_and_path.find('/')?; + let host = authority_and_path.get(..slash)?; + if !host.is_empty() && !host.eq_ignore_ascii_case("localhost") { + return None; + } + authority_and_path.get(slash..)? + } + None => rest.starts_with('/').then_some(rest)?, + }; + let mut bytes = Vec::with_capacity(path.len()); + let mut it = path.bytes(); + while let Some(b) = it.next() { + if b == b'%' { + let hex = |d: Option| char::from(d?).to_digit(16); + let (hi, lo) = (hex(it.next())?, hex(it.next())?); + bytes.push(u8::try_from(hi * 16 + lo).ok()?); + } else { + bytes.push(b); + } + } + if bytes.contains(&0) { + return None; + } + String::from_utf8(bytes).ok().map(PathBuf::from) +} + #[cfg(windows)] mod win { use std::num::NonZeroU32; @@ -1094,7 +1173,9 @@ mod portable { } } - /// Files copied in a file manager (none where the backend can't read a file list). + /// Files copied in a file manager, read through arboard. The Wayland core protocol reads + /// its file list with the rest of a paste + /// ([`DataClipboard::read`](super::wayland::DataClipboard::read)). fn file_list(&mut self) -> Vec { match self { Self::Arboard(cb) => cb.read(Request::Files).files(), @@ -1233,8 +1314,9 @@ mod portable { } /// Text and copied files are read here, and work that reads arboard's image comes back. On - /// the Wayland core protocol the first of `mimes` the clipboard offers is read: text here, - /// SVG and PNG by the work that comes back, which waits [`IMAGE_WAIT`] at most. + /// the Wayland core protocol the copied files, else the first of `mimes` the clipboard + /// offers, is read: text here, file lists, SVG and PNG by the work that comes back, which + /// waits [`IMAGE_WAIT`] at most. fn read_now_or_later(&mut self, mimes: &[&'static str]) -> Option { let cb = self.cb(Asker::User).ok()?; #[cfg(target_os = "linux")] @@ -1335,9 +1417,9 @@ mod portable { } /// Text, on macOS vector art or a bitmap (by the pasteboard's types), and on the Wayland - /// core protocol SVG, text or PNG (by the types offered, nothing read). arboard has no - /// cheap way to ask for a bitmap (reading one costs as much as pasting it): the paste keys - /// take it, the menu item waits for text. + /// core protocol copied files, SVG, text or PNG (by the types offered, nothing read). + /// arboard has no cheap way to ask for a bitmap (reading one costs as much as pasting it): + /// the paste keys take it, the menu item waits for text. fn has(&mut self, mimes: &[&'static str]) -> bool { #[cfg(target_os = "macos")] if super::mac::has(mimes) { @@ -1784,21 +1866,24 @@ mod portable { /// window's own Wayland connection: what Copy and Paste use where the compositor lacks the /// data-control protocol arboard needs (GNOME) and there is no X11 to fall back on (the Flatpak on /// a Wayland session). A Copy offers its SVG as `image/svg+xml`, its PNG as `image/png` and its -/// text under each of [`TEXT_TYPES`]; Paste reads the clipboard's SVG, text and PNG, and the paste -/// check looks at the types offered without reading any data. The protocol gives the clipboard to -/// the window with the keyboard focus only. A worker thread handles the protocol's events and -/// starts a thread for each paste of a Copy's data by another app ([`MAX_SENDS`] at once). Reads -/// run on another worker and take [`MAX_BYTES`] at most; text waits [`LOAD_WAIT`] at most, SVG and -/// PNG as long as a paste's bitmap from arboard. A read that gets no answer in its wait is kept for -/// a paste to wait for off the UI thread, as arboard's are. +/// text under each of [`TEXT_TYPES`]; Paste reads the files a file manager copied +/// ([`FILE_LISTS`]), then the clipboard's SVG, text and PNG, and the paste check looks at the types +/// offered without reading any data. The protocol gives the clipboard to the window with the +/// keyboard focus only. A worker thread handles the protocol's events and starts a thread for each +/// paste of a Copy's data by another app ([`MAX_SENDS`] at once). Reads run on another worker and +/// take [`MAX_BYTES`] at most; text waits [`LOAD_WAIT`] at most, file lists, SVG and PNG as long as +/// a paste's bitmap from arboard. A read that gets no answer in its wait is kept for +/// a paste to wait for off the UI thread, as arboard's are. A read or send whose pipe moves no data +/// for [`IDLE_WAIT`] fails and closes the pipe, which frees its worker or thread. #[cfg(target_os = "linux")] mod wayland { - use std::io::{Read, Write}; - use std::os::fd::AsFd as _; + use std::io::{ErrorKind, Read, Write}; + use std::os::fd::{AsFd, BorrowedFd}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::{Arc, Mutex, MutexGuard, PoisonError, mpsc}; use std::time::{Duration, Instant}; + use rustix::event::{PollFd, PollFlags, Timespec}; use vectorcraft_engine::cmd::clipboard::names_a_picture; use vectorcraft_ui_egui::ClipboardRead; use wayland_client::backend::ObjectData; @@ -1815,11 +1900,17 @@ mod wayland { use wayland_client::{Connection, Dispatch, Proxy, QueueHandle, WEnum}; use super::loads::{Asker, GONE, LOAD_WAIT, Loads, wait_for_answer}; - use super::{BITMAP, Flavour, PNG, SVG, TEXT}; + use super::{BITMAP, Flavour, PNG, PathBuf, SVG, TEXT, copied_file, gnome_copied_paths, uri_list_paths}; /// The types text is offered under and read from, best first: `text/plain;charset=utf-8` (GTK /// and Qt apps), `UTF8_STRING` (X11 apps through XWayland) and `text/plain`. const TEXT_TYPES: [&str; 3] = ["text/plain;charset=utf-8", "UTF8_STRING", "text/plain"]; + /// What reads the files a file list names. + type PathsOf = fn(&[u8]) -> Vec; + /// The types files copied in a file manager are offered under, each with what reads its files, + /// best first: `text/uri-list` (RFC 2483), and GNOME Files' own list, read only when the first + /// names no file. + const FILE_LISTS: [(&str, PathsOf); 2] = [("text/uri-list", uri_list_paths), ("x-special/gnome-copied-files", gnome_copied_paths)]; /// The most bytes a read takes from the app that copied (untrusted data), VectorCraft's own /// limit: a read of more fails. const MAX_BYTES: usize = 64 << 20; @@ -1827,6 +1918,11 @@ mod wayland { const MAX_SENDS: usize = 8; /// The most types of an offer that are kept (untrusted data). const MAX_TYPES: usize = 256; + /// How long a read or send waits for the other app to move a byte through the pipe before it + /// fails, VectorCraft's own limit; the wait starts again after each byte moved. + const IDLE_WAIT: Duration = LOAD_WAIT; + /// The most bytes a read takes from the pipe at a time. + const CHUNK: usize = 64 << 10; /// What a read gives: the bytes, or why there are none. type Got = Result, String>; @@ -1898,37 +1994,146 @@ mod wayland { Some(first) } - /// `from` read to its end, `cap` bytes at most: more is an error, as is a failed read. - fn read_capped(from: impl Read, cap: usize) -> Got { - let mut data = vec![]; - from.take(cap as u64 + 1).read_to_end(&mut data).map_err(|e| format!("couldn't read the clipboard's data: {e}"))?; - if data.len() > cap { - return Err(format!("the clipboard's data is larger than {} MiB", cap >> 20)); + /// Whether a paste of one of `mimes` can take a copied file: one of them is not text. + fn takes_files(mimes: &[&'static str]) -> bool { + mimes.iter().any(|&m| m != TEXT) + } + + /// The first type among `offered` that lists copied files ([`FILE_LISTS`]), in any letter case. + fn file_list_type(offered: &[String]) -> Option<&str> { + FILE_LISTS.iter().find_map(|(list, _)| offered.iter().find(|o| o.eq_ignore_ascii_case(list))).map(String::as_str) + } + + /// The first file a file manager copied that pastes as one of `mimes` ([`copied_file`]), from + /// the first of [`FILE_LISTS`] among `offered` that names a file, `read` reading each list. + fn copied(offered: &[String], mimes: &[&'static str], mut read: impl FnMut(&str) -> Option>) -> Option { + if !takes_files(mimes) { + return None; } - Ok(data) + let paths = FILE_LISTS.iter().find_map(|(list, paths_of)| { + let wire = offered.iter().find(|o| o.eq_ignore_ascii_case(list))?; + Some(paths_of(&read(wire)?)).filter(|paths| !paths.is_empty()) + })?; + copied_file(paths, mimes) + } + + /// What a paste of one of `mimes` takes: the first copied file that is art ([`copied`]), else + /// what [`pick`] takes. + fn pick_pasted(offered: &[String], mimes: &[&'static str], mut read: impl FnMut(&str) -> Option>) -> Option { + copied(offered, mimes, &mut read).or_else(|| pick(offered, mimes, read)) + } + + /// The time `idle` from now; None when that is past the clock's range (no limit). + fn idle_until(idle: Duration) -> Option { + Instant::now().checked_add(idle) + } + + /// Makes `fd` nonblocking, its other flags kept. + fn nonblocking(fd: BorrowedFd<'_>) -> std::io::Result<()> { + let flags = rustix::fs::fcntl_getfl(fd)?; + rustix::fs::fcntl_setfl(fd, flags | rustix::fs::OFlags::NONBLOCK)?; + Ok(()) + } + + /// Waits until `fd` is ready for `events`, closed or failed (true), or `until` passes (false); + /// None waits without a limit. A wait a signal cuts short goes on until `until`. + fn ready(fd: BorrowedFd<'_>, events: PollFlags, until: Option) -> std::io::Result { + loop { + let left = until.map(|t| t.saturating_duration_since(Instant::now())); + let timeout = left.and_then(|d| Timespec::try_from(d).ok()); + let mut fds = [PollFd::new(&fd, events)]; + match rustix::event::poll(&mut fds, timeout.as_ref()) { + Ok(n) => return Ok(n > 0), + Err(rustix::io::Errno::INTR) => {} + Err(e) => return Err(e.into()), + } + } + } + + /// `from` read to its end, `cap` bytes at most: more is an error, as is a failed read and a + /// pipe that is left open with no byte coming for `idle`. A read that fails gives none of the + /// bytes it took, and closes `from`. + fn read_capped(mut from: impl Read + AsFd, cap: usize, idle: Duration) -> Got { + let failed = |e: std::io::Error| format!("couldn't read the clipboard's data: {e}"); + nonblocking(from.as_fd()).map_err(failed)?; + let (mut data, mut chunk) = (vec![], vec![0u8; CHUNK]); + let mut until = idle_until(idle); + loop { + match from.read(&mut chunk) { + Ok(0) => return Ok(data), + Ok(n) => { + let got = chunk.get(..n).ok_or_else(|| failed(ErrorKind::InvalidData.into()))?; + if data.len() + got.len() > cap { + return Err(format!("the clipboard's data is larger than {} MiB", cap >> 20)); + } + data.extend_from_slice(got); + until = idle_until(idle); + } + Err(e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) if e.kind() == ErrorKind::WouldBlock => { + if !ready(from.as_fd(), PollFlags::IN, until).map_err(failed)? { + return Err("the app that copied stopped sending the clipboard's data".to_string()); + } + } + Err(e) => return Err(failed(e)), + } + } + } + + /// `data` written to `to`: an error when the app that pastes closes its end (the process + /// ignores `SIGPIPE`) or takes no byte for `idle`. + fn send(mut to: impl Write + AsFd, data: &[u8], idle: Duration) -> std::io::Result<()> { + nonblocking(to.as_fd())?; + let (mut sent, mut until) = (0, idle_until(idle)); + while let Some(rest) = data.get(sent..).filter(|rest| !rest.is_empty()) { + match to.write(rest) { + Ok(0) => return Err(ErrorKind::WriteZero.into()), + Ok(n) => { + sent += n; + until = idle_until(idle); + } + Err(e) if e.kind() == ErrorKind::Interrupted => {} + Err(e) if e.kind() == ErrorKind::WouldBlock => { + if !ready(to.as_fd(), PollFlags::OUT, until)? { + return Err(ErrorKind::TimedOut.into()); + } + } + Err(e) => return Err(e), + } + } + Ok(()) } /// The threads that send a Copy's data to the apps that paste it, counted. - #[derive(Clone, Default)] - struct Sends(Arc); + #[derive(Clone)] + struct Sends { + running: Arc, + /// How long a send waits for the app that pastes to take a byte. + idle: Duration, + } + + impl Default for Sends { + fn default() -> Self { + Self { running: Arc::default(), idle: IDLE_WAIT } + } + } impl Sends { - /// `data` written to `to` on a thread of its own, which then closes `to`; an app that - /// closes its end early ends the write (the process ignores `SIGPIPE`). While - /// [`MAX_SENDS`] are being written `to` is closed at once with nothing written → false. - fn start(&self, mut to: impl Write + Send + 'static, data: Arc<[u8]>) -> bool { - if self.0.fetch_add(1, Ordering::SeqCst) >= MAX_SENDS { - self.0.fetch_sub(1, Ordering::SeqCst); + /// `data` written to `to` on a thread of its own ([`send`]), which then closes `to`; an app + /// that closes its end early or takes no byte for the send's idle wait ends the write. + /// While [`MAX_SENDS`] are being written `to` is closed at once with nothing written → false. + fn start(&self, to: impl Write + AsFd + Send + 'static, data: Arc<[u8]>) -> bool { + if self.running.fetch_add(1, Ordering::SeqCst) >= MAX_SENDS { + self.running.fetch_sub(1, Ordering::SeqCst); return false; } - let count = self.0.clone(); - let send = move || { - let _ = to.write_all(&data); - drop(to); + let (count, idle) = (self.running.clone(), self.idle); + let work = move || { + let _ = send(to, &data, idle); count.fetch_sub(1, Ordering::SeqCst); }; - if std::thread::Builder::new().name("wayland-clipboard-send".into()).spawn(send).is_err() { - self.0.fetch_sub(1, Ordering::SeqCst); + if std::thread::Builder::new().name("wayland-clipboard-send".into()).spawn(work).is_err() { + self.running.fetch_sub(1, Ordering::SeqCst); return false; } true @@ -1937,7 +2142,7 @@ mod wayland { /// How many are being written. #[cfg(test)] fn running(&self) -> usize { - self.0.load(Ordering::SeqCst) + self.running.load(Ordering::SeqCst) } } @@ -2002,9 +2207,9 @@ mod wayland { impl Unanswered { /// What a paste of one of `mimes` takes once this read's answer comes, waiting for it until - /// `limit` after the read was sent: the clipboard read again as [`pick`] reads it, each read - /// waiting as long, [`LOAD_WAIT`] at least, since the app that answers late may have lost the - /// clipboard meanwhile. None when the answer doesn't come or the clipboard holds this + /// `limit` after the read was sent: the clipboard read again as [`pick_pasted`] reads it, + /// each read waiting as long, [`LOAD_WAIT`] at least, since the app that answers late may + /// have lost the clipboard meanwhile. None when the answer doesn't come or the clipboard holds this /// connection's Copy. pub(super) fn paste(self, mimes: &[&'static str], limit: Duration) -> Option { let left = |now: Instant| (self.sent + limit).saturating_duration_since(now); @@ -2016,7 +2221,9 @@ mod wayland { } seen.offered.clone() }; - pick(&offered, mimes, |wire| wait_for_answer(&self.reads.ask(wire.to_string()).ok()?, LOAD_WAIT.max(left(Instant::now()))).ok()?.ok()) + pick_pasted(&offered, mimes, |wire| { + wait_for_answer(&self.reads.ask(wire.to_string()).ok()?, LOAD_WAIT.max(left(Instant::now()))).ok()?.ok() + }) } } @@ -2049,12 +2256,36 @@ mod wayland { } } - /// What a paste of one of `mimes` reads: the first the clipboard offers. Text is read here, - /// [`LOAD_WAIT`] at most, and pasted unless it is empty; SVG and PNG are asked for here and - /// waited for, `wait` at most, by the work that comes back. When that read fails or is - /// empty, the work reads the rest of `mimes` as [`pick`] does, each read waiting until - /// `wait` after the first was sent, [`LOAD_WAIT`] at least. + /// What a paste of one of `mimes` reads: the files a file manager copied, else the first of + /// `mimes` the clipboard offers. A file list is asked for here and read, with the files, + /// by the work that comes back, which pastes the first file that is art ([`copied`]) and + /// else reads `mimes` as [`pick`] does. Text is read here, [`LOAD_WAIT`] at most, and + /// pasted unless it is empty; SVG and PNG are asked for here and waited for, `wait` at most, + /// by the work that comes back. When that read fails or is empty, the work reads the rest + /// of `mimes` as [`pick`] does. Each read the work makes after the first waits until `wait` + /// after the first was sent, [`LOAD_WAIT`] at least. pub(super) fn read(&mut self, mimes: &[&'static str], wait: Duration) -> Option { + if takes_files(mimes) { + let offered = lock(&self.seen).offered.clone(); + if let Some(list) = file_list_type(&offered).map(str::to_string) { + let sent = Instant::now(); + let answer = self.loads.ask(list.clone()).ok()?; + self.unanswered = None; + let (reads, mimes) = (self.loads.asker(), mimes.to_vec()); + return Some(ClipboardRead::Later(Box::new(move || { + let left = || LOAD_WAIT.max((sent + wait).saturating_duration_since(Instant::now())); + // The list asked for here is read from its answer, every other type anew. + let mut first = Some((list, answer)); + pick_pasted(&offered, &mimes, |wire| { + let answer = match first.take_if(|(list, _)| list.as_str() == wire) { + Some((_, answer)) => answer, + None => reads.ask(wire.to_string()).ok()?, + }; + wait_for_answer(&answer, left()).ok()?.ok() + }) + }))); + } + } mimes.iter().enumerate().find_map(|(i, &mime)| { let wire = self.wire(mime)?; if mime == TEXT { @@ -2076,10 +2307,11 @@ mod wayland { }) } - /// Whether the clipboard offers one of `mimes`; nothing is read. + /// Whether the clipboard offers one of `mimes`, or files a file manager copied when a paste + /// of `mimes` can take a file; nothing is read. pub(super) fn has(&self, mimes: &[&'static str]) -> bool { let seen = lock(&self.seen); - mimes.iter().any(|m| wire_type(m, &seen.offered).is_some()) + (takes_files(mimes) && file_list_type(&seen.offered).is_some()) || mimes.iter().any(|m| wire_type(m, &seen.offered).is_some()) } /// Whether the clipboard holds this connection's last Copy. @@ -2298,7 +2530,7 @@ mod wayland { impl Receiver { /// The clipboard's data of type `wire`, read until the app that copied closes the pipe, - /// [`MAX_BYTES`] at most. + /// [`MAX_BYTES`] at most; an error when that app sends no byte for [`IDLE_WAIT`]. fn receive(&self, wire: String) -> Got { let offer = lock(&self.objects).selection.clone().ok_or("the clipboard is empty")?; let (from, to) = std::io::pipe().map_err(|e| format!("couldn't open a pipe for the clipboard's data: {e}"))?; @@ -2307,7 +2539,7 @@ mod wayland { // holds the only one, and the read ends when that app closes it. drop(to); self.conn.flush().map_err(|e| format!("couldn't reach the compositor: {e}"))?; - read_capped(from, MAX_BYTES) + read_capped(from, MAX_BYTES, IDLE_WAIT) } } @@ -2557,31 +2789,86 @@ mod wayland { assert_eq!(keyboard_serial(&modifiers(9), None), None); } + /// A wait no test reaches: the other end of each pipe below either moves data or closes. + const LONG: Duration = Duration::from_secs(600); + + /// A pipe holding `data`, its write end closed when `close`. + fn pipe_with(data: &[u8], close: bool) -> (std::io::PipeReader, Option) { + let (from, mut to) = std::io::pipe().unwrap(); + to.write_all(data).unwrap(); + (from, (!close).then_some(to)) + } + #[test] fn a_read_stops_at_its_limit() { assert_eq!(MAX_BYTES, 64 * 1024 * 1024); - assert_eq!(read_capped(&b"12345678"[..], 8), Ok(b"12345678".to_vec())); - assert_eq!(read_capped(&b""[..], 8), Ok(vec![])); - assert_eq!(read_capped(&[0u8; 9][..], 8), Err("the clipboard's data is larger than 0 MiB".to_string())); - assert_eq!(read_capped(&vec![0u8; (2 << 20) + 1][..], 2 << 20), Err("the clipboard's data is larger than 2 MiB".to_string())); - /// A pipe that breaks. - struct Broken; - impl Read for Broken { - fn read(&mut self, _: &mut [u8]) -> std::io::Result { - Err(std::io::ErrorKind::BrokenPipe.into()) - } + assert_eq!(IDLE_WAIT, LOAD_WAIT); + assert_eq!(read_capped(pipe_with(b"12345678", true).0, 8, Duration::ZERO), Ok(b"12345678".to_vec())); + assert_eq!(read_capped(pipe_with(b"", true).0, 8, Duration::ZERO), Ok(vec![])); + assert_eq!(read_capped(pipe_with(&[0u8; 9], true).0, 8, Duration::ZERO), Err("the clipboard's data is larger than 0 MiB".to_string())); + // More than a pipe holds, from an app that is still sending. + let (from, to) = std::io::pipe().unwrap(); + assert!(Sends::default().start(to, vec![0u8; (2 << 20) + 1].into())); + assert_eq!(read_capped(from, 2 << 20, LONG), Err("the clipboard's data is larger than 2 MiB".to_string())); + // A pipe that can't be read: the write end. + let (_, to) = std::io::pipe().unwrap(); + let unreadable = std::fs::File::from(std::os::fd::OwnedFd::from(to)); + assert!(read_capped(unreadable, 8, LONG).is_err_and(|e| e.starts_with("couldn't read the clipboard's data"))); + } + + #[test] + fn a_read_from_an_app_that_stops_sending_fails_and_closes_the_pipe() { + let stopped = Err("the app that copied stopped sending the clipboard's data".to_string()); + // Some bytes and then nothing, the pipe left open: none of them are pasted. + let (from, to) = pipe_with(b"part", false); + assert_eq!(read_capped(from, MAX_BYTES, Duration::ZERO), stopped); + // The read end is closed, so that app's next write fails. + let mut to = to.unwrap(); + assert_eq!(to.write(b"x").map_err(|e| e.kind()), Err(ErrorKind::BrokenPipe)); + // Nothing at all, and data that fills the limit exactly with more never coming. + let (from, _held) = pipe_with(b"", false); + assert_eq!(read_capped(from, MAX_BYTES, Duration::ZERO), stopped); + let (from, _held) = pipe_with(b"12345678", false); + assert_eq!(read_capped(from, 8, Duration::ZERO), stopped); + // The next read gets its data. + assert_eq!(read_capped(pipe_with(b"words", true).0, MAX_BYTES, Duration::ZERO), Ok(b"words".to_vec())); + } + + #[test] + fn a_send_to_an_app_that_stops_reading_fails_and_frees_its_thread() { + let data: Arc<[u8]> = vec![3u8; 300_000].into(); + // More than a pipe holds, to an app that never reads. + let (_held, to) = std::io::pipe().unwrap(); + assert_eq!(send(to, &data, Duration::ZERO).map_err(|e| e.kind()), Err(ErrorKind::TimedOut)); + // An app that closes its end before reading. + let (from, to) = std::io::pipe().unwrap(); + drop(from); + assert_eq!(send(to, &data, LONG).map_err(|e| e.kind()), Err(ErrorKind::BrokenPipe)); + // A send thread to an app that does not read until the send gives up, its end still open. + let sends = Sends { idle: Duration::ZERO, ..Sends::default() }; + let (from, to) = std::io::pipe().unwrap(); + assert!(sends.start(to, data.clone())); + while sends.running() > 0 { + std::thread::yield_now(); } - assert!(read_capped(Broken, 8).is_err_and(|e| e.starts_with("couldn't read the clipboard's data"))); + // What the pipe held when the send gave up, then the end of the data: the send closed it. + let got = read_capped(from, MAX_BYTES, Duration::ZERO).map(|d| d.len()); + assert!(got.as_ref().is_ok_and(|&n| n > 0 && n < data.len()), "{got:?}"); + // The thread is free for the next paste. + let (from, to) = std::io::pipe().unwrap(); + assert!(sends.start(to, b"words"[..].into())); + assert_eq!(read_capped(from, MAX_BYTES, LONG), Ok(b"words".to_vec())); } #[test] fn a_copys_data_is_sent_through_the_pipe_and_closed() { let sends = Sends::default(); + assert_eq!(sends.idle, IDLE_WAIT); let (from, to) = std::io::pipe().unwrap(); let data: Arc<[u8]> = vec![7u8; 300_000].into(); assert!(sends.start(to, data.clone())); // More than a pipe holds: the write ends once all of it is read, then the pipe closes. - assert_eq!(read_capped(from, MAX_BYTES).as_deref(), Ok(&data[..])); + assert_eq!(read_capped(from, MAX_BYTES, LONG).as_deref(), Ok(&data[..])); // An app that closes its end before reading ends the send. let (from, to) = std::io::pipe().unwrap(); drop(from); @@ -2593,9 +2880,9 @@ mod wayland { #[test] fn pastes_that_read_nothing_hold_a_few_sends_at_most() { - let sends = Sends::default(); + let sends = Sends { idle: LONG, ..Sends::default() }; let data: Arc<[u8]> = vec![1u8; 300_000].into(); - // Apps that ask for the data and never read it. + // Apps that ask for the data and never read it, within the sends' idle wait. let stalled: Vec<_> = (0..MAX_SENDS) .map(|_| { let (from, to) = std::io::pipe().unwrap(); @@ -2606,7 +2893,7 @@ mod wayland { // The next paste gets its pipe closed at once, with nothing written. let (from, to) = std::io::pipe().unwrap(); assert!(!sends.start(to, data.clone())); - assert_eq!(read_capped(from, MAX_BYTES), Ok(vec![])); + assert_eq!(read_capped(from, MAX_BYTES, Duration::ZERO), Ok(vec![])); // Once those apps close their pipes, the sends end and others are sent again. drop(stalled); while sends.running() > 0 { @@ -2614,7 +2901,7 @@ mod wayland { } let (from, to) = std::io::pipe().unwrap(); assert!(sends.start(to, data.clone())); - assert_eq!(read_capped(from, MAX_BYTES).map(|d| d.len()), Ok(data.len())); + assert_eq!(read_capped(from, MAX_BYTES, LONG).map(|d| d.len()), Ok(data.len())); } /// What a clipboard holds, by type. @@ -2693,6 +2980,85 @@ mod wayland { let Some(ClipboardRead::Later(work)) = reads.read(&[BITMAP], Duration::from_secs(600)) else { panic!("the PNG is asked for") }; assert!(work().is_none()); } + + /// Reads of a clipboard holding `data` by type, answered at once. + fn reads_holding(data: Vec<(String, Vec)>) -> Reads { + let types: Vec = data.iter().map(|(t, _)| t.clone()).collect(); + let loads = Loads::spawn("test", Duration::ZERO, move |wire: String| { + data.iter().find(|(t, _)| *t == wire).map(|(_, d)| d.clone()).ok_or_else(|| "not offered".to_string()) + }) + .unwrap(); + let types: Vec<&str> = types.iter().map(String::as_str).collect(); + Reads::new(loads, Arc::new(Mutex::new(Seen::offering(&types)))) + } + + /// The `file:` URI of `path`, its spaces escaped. + fn file_uri(path: &std::path::Path) -> String { + format!("file://{}", path.display().to_string().replace(' ', "%20")) + } + + /// What a paste of `mimes` takes from `reads`. + fn paste(reads: &mut Reads, mimes: &[&'static str]) -> Option<(&'static str, Vec)> { + match reads.read(mimes, Duration::from_secs(600))? { + ClipboardRead::Now(f) => Some((f.mime, f.data)), + ClipboardRead::Later(work) => work().map(|f| (f.mime, f.data)), + } + } + + #[test] + fn files_copied_in_a_file_manager_paste_as_their_art() { + use vectorcraft_engine::cmd::clipboard::PASTE_ORDER; + let d = tempfile::Builder::new().prefix("vectorcraft-wayland-files-").tempdir().unwrap(); + let (notes, red) = (d.path().join("notes.txt"), d.path().join("red image.png")); + let mut png = vec![]; + image::RgbaImage::new(2, 2).write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).unwrap(); + std::fs::write(¬es, "not art").unwrap(); + std::fs::write(&red, &png).unwrap(); + let list = |paths: &[&std::path::Path]| paths.iter().map(|p| file_uri(p) + "\r\n").collect::().into_bytes(); + let held = |types: &[(&str, Vec)]| reads_holding(types.iter().map(|(t, d)| (t.to_string(), d.clone())).collect()); + let text = ("text/plain;charset=utf-8", b"the files' paths".to_vec()); + // A file list alone enables Paste and pastes the first file that is art. + let mut reads = held(&[("text/uri-list", list(&[¬es, &red]))]); + assert!(reads.has(&PASTE_ORDER) && reads.has(&[BITMAP])); + assert_eq!(paste(&mut reads, &PASTE_ORDER), Some((PNG, png.clone()))); + // A paste of text alone takes no file. + assert!(!reads.has(&[TEXT])); + assert_eq!(paste(&mut reads, &[TEXT]), None); + // The files come before the other types offered, as on the other platforms; the type in + // any letter case. + let mut reads = held(&[(SVG, b"".to_vec()), text.clone(), ("Text/URI-List", list(&[&red]))]); + assert_eq!(paste(&mut reads, &PASTE_ORDER), Some((PNG, png.clone()))); + assert_eq!(paste(&mut reads, &[TEXT]), Some((TEXT, text.1.clone()))); + // With no file that is art, the paste takes the other types. + let mut reads = held(&[("text/uri-list", list(&[¬es, &d.path().join("gone.png")])), text.clone()]); + assert_eq!(paste(&mut reads, &PASTE_ORDER), Some((TEXT, text.1.clone()))); + let mut reads = held(&[("text/uri-list", b"https://example.com/art.png\r\n".to_vec())]); + assert_eq!(paste(&mut reads, &PASTE_ORDER), None); + // GNOME Files' own list, alone or when the URI list names no local file. + let gnome = [b"copy\n".to_vec(), file_uri(&red).into_bytes()].concat(); + let mut reads = held(&[("x-special/gnome-copied-files", gnome.clone())]); + assert!(reads.has(&PASTE_ORDER)); + assert_eq!(paste(&mut reads, &PASTE_ORDER), Some((PNG, png.clone()))); + let mut reads = held(&[("text/uri-list", b"file://server/art.png\r\n".to_vec()), ("x-special/gnome-copied-files", gnome)]); + assert_eq!(paste(&mut reads, &PASTE_ORDER), Some((PNG, png.clone()))); + // KDE's cut marker is not a file list. + let mut reads = held(&[("application/x-kde-cutselection", b"1".to_vec())]); + assert!(!reads.has(&PASTE_ORDER)); + assert_eq!(paste(&mut reads, &PASTE_ORDER), None); + } + + #[test] + fn a_file_list_that_cant_be_read_gives_way_to_the_other_types() { + use vectorcraft_engine::cmd::clipboard::PASTE_ORDER; + let offered = offered(&["text/uri-list", "text/plain"]); + let mut asked = vec![]; + let f = pick_pasted(&offered, &PASTE_ORDER, |wire| { + asked.push(wire.to_string()); + (wire == "text/plain").then(|| b"words".to_vec()) + }); + assert_eq!(f.map(|f| (f.mime, f.data)), Some((TEXT, b"words".to_vec()))); + assert_eq!(asked, ["text/uri-list", "text/plain"]); + } } } @@ -2810,6 +3176,70 @@ mod tests { assert_eq!(copied_file(vec![with_cr], &PASTE_ORDER).map(|f| f.mime), Some(PNG)); } + fn uri_paths(list: &[u8]) -> Vec { + uri_list_paths(list).into_iter().map(|p| p.to_string_lossy().into_owned()).collect() + } + + #[test] + fn a_uri_list_names_the_local_files_of_its_lines() { + // CRLF or LF, comment lines and blank lines. + assert_eq!(uri_paths(b"# copied\r\nfile:///home/a/one.svg\r\n\r\nfile:///home/a/two.png\n"), ["/home/a/one.svg", "/home/a/two.png"]); + assert_eq!(uri_paths(b"file:///a.svg"), ["/a.svg"]); + // Percent escapes are decoded once; `+` and an escaped `#` are part of the name. + assert_eq!(uri_paths(b"file:///home/a/red%20image.png"), ["/home/a/red image.png"]); + assert_eq!(uri_paths(b"file:///home/a/caf%C3%A9.svg\nfile:///home/a/caf\xC3\xA9.svg"), ["/home/a/café.svg", "/home/a/café.svg"]); + assert_eq!(uri_paths(b"file:///a/%231+2.svg"), ["/a/#1+2.svg"]); + assert_eq!(uri_paths(b"file:///a/100%2525.svg"), ["/a/100%25.svg"]); + // No host, `localhost` in any case, and the short form name this machine; a fragment is + // left out. + assert_eq!( + uri_paths(b"file://localhost/a.svg\nFILE://LocalHost/b.svg\nfile:/c.svg\nfile:///d.svg#page=2"), + ["/a.svg", "/b.svg", "/c.svg", "/d.svg"] + ); + // Other hosts and schemes, relative paths, queries, bad escapes, an escaped NUL, a name + // that is not UTF-8 once decoded and a line that is not UTF-8 name no file. + for uri in [ + &b"file://server/a.svg"[..], + b"https://example.com/a.svg", + b"file:a.svg", + b"file://", + b"file://localhost", + b"file:///a.svg?x=1", + b"file:///a%2", + b"file:///a%zz.svg", + b"file:///a%00b.svg", + b"file:///a%FF.svg", + b"file:///a\xFF.svg", + b"/home/a/one.svg", + b"#file:///a.svg", + ] { + assert!(uri_list_paths(uri).is_empty(), "{}", String::from_utf8_lossy(uri)); + } + // The files beside a URI that names none are kept. + assert_eq!(uri_paths(b"https://example.com/a.svg\r\nfile:///b.svg\r\n"), ["/b.svg"]); + assert!(uri_list_paths(b"").is_empty()); + } + + #[test] + fn a_uri_list_longer_than_the_limit_names_no_file() { + assert_eq!(MAX_URIS, 1024); + let list = |n: usize| (0..n).map(|i| format!("# file {i}\r\nfile:///f{i}.svg\r\n")).collect::(); + // Comment lines don't count. + assert_eq!(uri_list_paths(list(MAX_URIS).as_bytes()).len(), MAX_URIS); + assert!(uri_list_paths(list(MAX_URIS + 1).as_bytes()).is_empty()); + } + + #[test] + fn gnome_files_list_names_its_files_after_copy_or_cut() { + let paths = |list: &[u8]| gnome_copied_paths(list).into_iter().map(|p| p.to_string_lossy().into_owned()).collect::>(); + assert_eq!(paths(b"copy\nfile:///a.svg\nfile:///b%20c.png"), ["/a.svg", "/b c.png"]); + assert_eq!(paths(b"cut\r\nfile:///a.svg\r\n"), ["/a.svg"]); + // Another first line, none, or no files. + for list in [&b"move\nfile:///a.svg"[..], b"file:///a.svg\nfile:///b.svg", b"copy", b"", b"Copy\nfile:///a.svg"] { + assert!(gnome_copied_paths(list).is_empty(), "{}", String::from_utf8_lossy(list)); + } + } + /// A DIB of `w`×`h` pixels (top row first when `h` is negative): a `header`-byte header (40, /// or 124 for a BITMAPV5HEADER with BGRA masks), `extra` (the masks after a 40-byte header, a /// colour table), then `rows`, each padded to 4 bytes. diff --git a/apps/vectorcraft/src/main.rs b/apps/vectorcraft/src/main.rs index fdbec59bfc..c55785cfdf 100644 --- a/apps/vectorcraft/src/main.rs +++ b/apps/vectorcraft/src/main.rs @@ -60,6 +60,8 @@ mod portal_request; mod portal_save; mod prefs_dir; mod printing; +#[cfg(not(any(target_os = "macos", windows)))] +mod quit_windows; #[cfg(not(target_os = "macos"))] mod single_instance; #[cfg(windows)] @@ -90,8 +92,6 @@ mod titlebar; use app::bring_window_forward; use app::native_input_hook; use app::open_or_hold; -#[cfg(all(test, not(any(target_os = "macos", windows))))] -use app::{QuittingWindow, hide_before_teardown}; use host_services::services; #[cfg(all(test, feature = "wgpu"))] use prefs::{KEEP_UI_PREFS, decode_saved_prefs, keep_prefs_copy, prefs_bytes}; @@ -122,7 +122,7 @@ struct App { /// Keeps the custom title bar's window borderless (Windows, #1758). window_frame: Option, /// The main window; used to read and set maximized state the UI layer does not see on Linux (#3635), - /// and to hide the window on quit before the clipboard handles let go (`app::hide_before_teardown`). + /// and to take the window off screen on quit before the clipboard handles let go (`quit_windows`). winit_window: Option>, /// A saved or fitted geometry asked for maximize once the window is mapped (Linux). pending_maximize: bool, @@ -373,11 +373,14 @@ fn main() -> std::process::ExitCode { // Display Server › X11 opens the window through XWayland instead, where file drops work (#1151), // and the other choices do so when a pen is attached, where the pen draws (#2028, #4967). #[cfg(target_os = "linux")] + let mut forced_to_x11 = false; + #[cfg(target_os = "linux")] let options = { let mut options = options; let pref = saved.as_ref().and_then(|ui| ui.engine_prefs.get("linuxDisplayServer")).and_then(serde_json::Value::as_str); if xwayland::wanted(pref, |name| std::env::var_os(name), xwayland::pen_attached) { if xwayland::x11_libraries_found() { + forced_to_x11 = true; if pref != Some("x11") { log::info!("pen found: opening the window through XWayland, where the pen works (VECTORCRAFT_NATIVE_WAYLAND=1 keeps Wayland)"); } else { @@ -393,6 +396,11 @@ fn main() -> std::process::ExitCode { } options }; + #[cfg(not(target_os = "linux"))] + let forced_to_x11 = false; + // Preferences › User Interface notes under System Title Bar when the desktop draws the frame + // with it on or off. + let desktop_keeps_frame = titlebar::desktop_keeps_frame(forced_to_x11); // With Windows Ink, winit reports a pen as a touch and drops its barrel button and which end // is down; the message hook notes each pointer contact and whether it starts with the barrel // button held, and writes the pen's end into the pen feed (`windows_stylus`). It also notes the @@ -410,6 +418,10 @@ fn main() -> std::process::ExitCode { })); options }; + // Quitting takes the X11 windows of floating panels and documents off screen with the main + // window, so eframe's windows are recorded as it makes and drops them (`quit_windows`). + #[cfg(target_os = "linux")] + let options = eframe::NativeOptions { viewport_hooks: Some(std::sync::Arc::new(quit_windows::Hooks)), ..options }; #[cfg(feature = "wgpu")] let options = { let mut options = options; @@ -595,6 +607,7 @@ fn main() -> std::process::ExitCode { app.custom_titlebar = custom_titlebar; app.caption_layout = caption_layout; app.desktop_frame = !custom_titlebar; + app.desktop_keeps_frame = desktop_keeps_frame; if let Some(port) = control_port { let rx = control_server::start(port, cc.egui_ctx.clone()); app = app.with_control(rx).with_automation_roots(roots.clone()); diff --git a/apps/vectorcraft/src/portal_save.rs b/apps/vectorcraft/src/portal_save.rs index 6d1a8734b2..65970c87f7 100644 --- a/apps/vectorcraft/src/portal_save.rs +++ b/apps/vectorcraft/src/portal_save.rs @@ -242,7 +242,7 @@ fn parent(window: &winit::window::Window) -> (String, Option<()>) { /// (), made as rfd's `window_identifier` /// makes it. #[cfg(target_os = "linux")] -mod wayland { +pub(crate) mod wayland { use wayland_client::globals::{GlobalListContents, registry_queue_init}; use wayland_client::protocol::wl_registry::{self, WlRegistry}; use wayland_client::protocol::wl_surface::WlSurface; @@ -308,9 +308,10 @@ mod wayland { } } - /// `window`'s Wayland connection and surface, from its raw handles. + /// `window`'s Wayland connection and surface, from its raw handles. The caller holds `window` + /// while it uses them (`quit_windows` unmaps the main window's surface through them). #[allow(unsafe_code)] - fn surface(window: &winit::window::Window) -> Option<(Connection, WlSurface)> { + pub(crate) fn surface(window: &winit::window::Window) -> Option<(Connection, WlSurface)> { use wayland_backend::sys::client::{Backend, ObjectId}; use winit::raw_window_handle::{HasDisplayHandle as _, HasWindowHandle as _, RawDisplayHandle, RawWindowHandle}; let (RawWindowHandle::Wayland(w), RawDisplayHandle::Wayland(d)) = @@ -319,8 +320,8 @@ mod wayland { return None; }; // SAFETY: the display is winit's open `wl_display`, which outlives `window` (the caller - // holds it until the export is dropped); a backend made from a foreign display does not - // close it when dropped. + // holds it while it uses the connection, and the export holds it until it is dropped); a + // backend made from a foreign display does not close it when dropped. let backend = unsafe { Backend::from_foreign_display(d.display.as_ptr().cast()) }; let conn = Connection::from_backend(backend); // SAFETY: the pointer is the window's live `wl_surface` proxy on that display. diff --git a/apps/vectorcraft/src/quit_windows.rs b/apps/vectorcraft/src/quit_windows.rs new file mode 100644 index 0000000000..36497f4f4f --- /dev/null +++ b/apps/vectorcraft/src/quit_windows.rs @@ -0,0 +1,280 @@ +//! Takes the app's windows off screen when it quits on Linux and the BSDs, before eframe drops the +//! app. Dropping the app waits up to [`vectorcraft_ui_egui::CLIPBOARD_PROBE_STOP_WAIT`] for the +//! clipboard handles to let go, and eframe closes the windows only after that wait. +//! +//! The main window is hidden on X11 (XWayland included). winit cannot hide a Wayland window, so on +//! Linux a Wayland main window is unmapped instead: its surface gets no buffer, and the window stays +//! open with the connection the Wayland clipboard copies and reads on. On Linux the X11 windows of +//! floating panels and documents are recorded as eframe creates and drops them ([`Hooks`]), and +//! quitting unmaps them through an X11 connection of its own. On native Wayland, floating panels and +//! documents are normally drawn inside the main window. + +#[cfg(target_os = "linux")] +use std::collections::HashMap; +#[cfg(target_os = "linux")] +use std::sync::{LazyLock, Mutex, MutexGuard, PoisonError}; + +#[cfg(target_os = "linux")] +use winit::raw_window_handle::{HasWindowHandle as _, RawWindowHandle}; + +/// The main window as quitting sees it. +pub(crate) trait QuittingWindow { + /// The window is a Wayland surface. + fn is_wayland(&self) -> bool; + /// Hides an X11 window. + fn hide(&self); + /// Takes a Wayland window off screen and keeps it open. + fn unmap(&self); +} + +impl QuittingWindow for winit::window::Window { + #[cfg(target_os = "linux")] + fn is_wayland(&self) -> bool { + matches!(self.window_handle().map(|h| h.as_raw()), Ok(RawWindowHandle::Wayland(_))) + } + + /// The BSDs have no Wayland unmap: their windows are hidden through winit. + #[cfg(not(target_os = "linux"))] + fn is_wayland(&self) -> bool { + false + } + + fn hide(&self) { + self.set_visible(false); + } + + #[cfg(target_os = "linux")] + fn unmap(&self) { + unmap_wayland(self); + } + + #[cfg(not(target_os = "linux"))] + fn unmap(&self) { + self.set_visible(false); + } +} + +/// Takes the main window and the floating windows `x11` lists off screen: a Wayland main window is +/// unmapped and any other main window hidden, and `unmap_x11` unmaps the floating windows. +pub(crate) fn off_screen(main: Option<&W>, x11: &[u32], unmap_x11: impl FnOnce(&[u32])) { + if let Some(window) = main { + if window.is_wayland() { + window.unmap(); + } else { + window.hide(); + } + } + if !x11.is_empty() { + unmap_x11(x11); + } +} + +/// [`off_screen`] with the running app's main window and the floating windows [`Hooks`] recorded. +/// Runs on quit, before eframe drops the app. +pub(crate) fn before_teardown(main: Option<&winit::window::Window>) { + #[cfg(target_os = "linux")] + off_screen(main, &CHILD_WINDOWS.x11(), unmap_x11); + #[cfg(not(target_os = "linux"))] + off_screen(main, &[], |_| {}); +} + +/// The X11 windows of floating panels and documents, by viewport, while eframe holds them. +#[cfg(target_os = "linux")] +#[derive(Default)] +pub(crate) struct ChildWindows(Mutex>); + +#[cfg(target_os = "linux")] +impl ChildWindows { + /// eframe made `viewport`'s window, with `handle`. The main window, and windows of other window + /// systems, are not recorded; a window made again for the same viewport replaces its record. + pub(crate) fn created(&self, viewport: egui::ViewportId, handle: Option) { + let mut windows = self.lock(); + match handle.and_then(x11_window) { + Some(id) if viewport != egui::ViewportId::ROOT => windows.insert(viewport, id), + _ => windows.remove(&viewport), + }; + } + + /// eframe dropped `viewport`'s window. + pub(crate) fn destroyed(&self, viewport: egui::ViewportId) { + self.lock().remove(&viewport); + } + + /// The recorded windows, in id order. + pub(crate) fn x11(&self) -> Vec { + let mut ids: Vec = self.lock().values().copied().collect(); + ids.sort_unstable(); + ids.dedup(); + ids + } + + fn lock(&self) -> MutexGuard<'_, HashMap> { + self.0.lock().unwrap_or_else(PoisonError::into_inner) + } +} + +/// The X11 window id of `handle`, None for another window system. +#[cfg(target_os = "linux")] +fn x11_window(handle: RawWindowHandle) -> Option { + match handle { + RawWindowHandle::Xlib(h) => u32::try_from(h.window).ok(), + RawWindowHandle::Xcb(h) => Some(h.window.get()), + _ => None, + } +} + +/// The running app's floating windows, which [`Hooks`] records. +#[cfg(target_os = "linux")] +static CHILD_WINDOWS: LazyLock = LazyLock::new(ChildWindows::default); + +/// Records the windows eframe creates and drops in [`CHILD_WINDOWS`]; set as +/// [`eframe::NativeOptions::viewport_hooks`]. +#[cfg(target_os = "linux")] +pub(crate) struct Hooks; + +#[cfg(target_os = "linux")] +impl eframe::ViewportHooks for Hooks { + fn window_created(&self, viewport: egui::ViewportId, window: &winit::window::Window) { + CHILD_WINDOWS.created(viewport, window.window_handle().ok().map(|h| h.as_raw())); + } + + fn window_destroyed(&self, viewport: egui::ViewportId) { + CHILD_WINDOWS.destroyed(viewport); + } +} + +/// Unmaps the X11 `windows` through a connection of its own, and waits until the server has done so. +/// An id whose window is gone gets an error, which is ignored. +#[cfg(target_os = "linux")] +fn unmap_x11(windows: &[u32]) { + use x11rb::protocol::xproto::ConnectionExt as _; + let conn = match x11rb::connect(None) { + Ok((conn, _)) => conn, + Err(e) => { + log::warn!("couldn't reach the X server to hide the floating windows on quit: {e}"); + return; + } + }; + for &window in windows { + if let Ok(cookie) = conn.unmap_window(window) { + cookie.ignore_error(); + } + } + // The server answers once it has handled the requests before this one. + if let Ok(cookie) = conn.get_input_focus() { + let _ = cookie.reply(); + } +} + +/// Attaches no buffer to `window`'s Wayland surface and commits it, which unmaps the window: the +/// compositor stops showing it, and the window and its connection stay open. +#[cfg(target_os = "linux")] +fn unmap_wayland(window: &winit::window::Window) { + let Some((conn, surface)) = super::portal_save::wayland::surface(window) else { return }; + surface.attach(None, 0, 0); + surface.commit(); + if let Err(e) = conn.flush() { + log::warn!("couldn't reach the compositor to hide the window on quit: {e}"); + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::cell::RefCell; + + /// A main window that records what quitting did to it. + struct Window<'a> { + wayland: bool, + done: &'a RefCell>, + } + + impl QuittingWindow for Window<'_> { + fn is_wayland(&self) -> bool { + self.wayland + } + fn hide(&self) { + self.done.borrow_mut().push("hide".into()); + } + fn unmap(&self) { + self.done.borrow_mut().push("unmap".into()); + } + } + + fn quit(wayland: Option, x11: &[u32]) -> Vec { + let done = RefCell::new(Vec::new()); + let window = wayland.map(|wayland| Window { wayland, done: &done }); + off_screen(window.as_ref(), x11, |ids| done.borrow_mut().push(format!("unmap x11 {ids:?}"))); + done.into_inner() + } + + /// winit cannot hide a Wayland window: quitting unmaps it, and never only asks winit to hide it. + #[test] + fn quitting_unmaps_a_wayland_main_window() { + assert_eq!(quit(Some(true), &[]), ["unmap"]); + } + + /// An X11 main window (XWayland included) is hidden, and the floating panels' and documents' X11 + /// windows are unmapped with it. + #[test] + fn quitting_hides_an_x11_main_window_and_its_floating_windows() { + assert_eq!(quit(Some(false), &[]), ["hide"]); + assert_eq!(quit(Some(false), &[7, 9]), ["hide", "unmap x11 [7, 9]"]); + } + + /// Without a main window (none was made), the floating windows still go, and with none at all + /// nothing is done. + #[test] + fn quitting_without_a_main_window() { + assert_eq!(quit(None, &[3]), ["unmap x11 [3]"]); + assert!(quit(None, &[]).is_empty()); + } + + #[cfg(target_os = "linux")] + fn xlib(id: std::os::raw::c_ulong) -> Option { + Some(RawWindowHandle::Xlib(winit::raw_window_handle::XlibWindowHandle::new(id))) + } + + #[cfg(target_os = "linux")] + fn viewport(name: &str) -> egui::ViewportId { + egui::ViewportId::from_hash_of(name) + } + + /// The floating windows eframe made are recorded until it drops them; the main window, which + /// quitting reaches through winit, is not. + #[cfg(target_os = "linux")] + #[test] + fn floating_x11_windows_are_recorded_while_they_exist() { + let windows = ChildWindows::default(); + windows.created(egui::ViewportId::ROOT, xlib(1)); + windows.created(viewport("Layers"), xlib(9)); + let xcb = winit::raw_window_handle::XcbWindowHandle::new(std::num::NonZeroU32::new(5).expect("not zero")); + windows.created(viewport("Untitled-2"), Some(RawWindowHandle::Xcb(xcb))); + windows.created(viewport("Color"), xlib(7)); + assert_eq!(windows.x11(), [5, 7, 9]); + windows.destroyed(viewport("Color")); + assert_eq!(windows.x11(), [5, 9]); + // A viewport that eframe has already dropped, or never made, is no error. + windows.destroyed(viewport("Color")); + windows.destroyed(viewport("Swatches")); + assert_eq!(windows.x11(), [5, 9]); + } + + /// A window made again for a viewport replaces its record, and one of another window system, or + /// one whose handle could not be read, removes it. + #[cfg(target_os = "linux")] + #[test] + fn a_window_made_again_replaces_its_record() { + let windows = ChildWindows::default(); + windows.created(viewport("Layers"), xlib(9)); + windows.created(viewport("Layers"), xlib(11)); + assert_eq!(windows.x11(), [11]); + let surface = std::ptr::NonNull::::dangling(); + let wayland = winit::raw_window_handle::WaylandWindowHandle::new(surface); + windows.created(viewport("Layers"), Some(RawWindowHandle::Wayland(wayland))); + assert!(windows.x11().is_empty()); + windows.created(viewport("Layers"), xlib(11)); + windows.created(viewport("Layers"), None); + assert!(windows.x11().is_empty()); + } +} diff --git a/apps/vectorcraft/src/tests.rs b/apps/vectorcraft/src/tests.rs index 99ca880bc9..54fa01da03 100644 --- a/apps/vectorcraft/src/tests.rs +++ b/apps/vectorcraft/src/tests.rs @@ -346,6 +346,34 @@ fn the_titlebar_variable_decides_the_frame_before_the_window_opens() { } } +/// Preferences says under System Title Bar that the desktop draws the frame with it on or off +/// exactly where the start frame without VectorCraft Title Bar on Every Desktop is the desktop's +/// with System Title Bar off as well as on and `VECTORCRAFT_TITLEBAR` is unset: Linux and the BSDs +/// only. +#[test] +fn the_desktop_keeps_the_frame_where_system_title_bar_does_not_change_it() { + use crate::titlebar::desktop_keeps_frame_from; + use craft_window::{Frame, Layout}; + let linux = cfg!(not(any(target_os = "macos", target_os = "windows"))); + for probed in [Frame::Desktop, Frame::App(Layout::default())] { + for forced_to_x11 in [false, true] { + let frame = super::start_frame(probed.clone(), None, forced_to_x11, false); + let either_way = !super::custom_titlebar_from(&frame, false) && !super::custom_titlebar_from(&frame, true); + assert_eq!(desktop_keeps_frame_from(&probed, None, forced_to_x11), linux && either_way, "{probed:?} {forced_to_x11}"); + } + } + // KDE, Sway and X11, and GNOME through XWayland, keep the desktop's frame; GNOME on Wayland does not. + assert_eq!(desktop_keeps_frame_from(&Frame::Desktop, None, false), linux); + assert_eq!(desktop_keeps_frame_from(&Frame::App(Layout::default()), None, true), linux); + assert!(!desktop_keeps_frame_from(&Frame::App(Layout::default()), None, false)); + // While `VECTORCRAFT_TITLEBAR` chooses the frame, System Title Bar does not apply and there is no note. + for (frame, overridden) in [(Frame::App(Layout::default()), Some(true)), (Frame::Desktop, Some(false))] { + for forced_to_x11 in [false, true] { + assert!(!desktop_keeps_frame_from(&frame, overridden, forced_to_x11), "{overridden:?} {forced_to_x11}"); + } + } +} + /// The file extensions the macOS bundle declares: its document types and its own exported type. fn plist_extensions(plist: &str) -> Vec<&str> { ["CFBundleTypeExtensions", "public.filename-extension"] @@ -487,21 +515,3 @@ fn the_linux_desktop_entry_opens_every_readable_format() { } } } - -/// On Linux and the BSDs, quitting hides the main window before eframe drops the app, whose -/// clipboard handles may take up to `CLIPBOARD_PROBE_STOP_WAIT` to let go. -#[cfg(not(any(target_os = "macos", windows)))] -#[test] -fn quitting_hides_the_window_before_the_clipboards_let_go() { - struct Window(std::cell::Cell); - impl QuittingWindow for Window { - fn hide(&self) { - self.0.set(self.0.get() + 1); - } - } - let window = Window(std::cell::Cell::new(0)); - hide_before_teardown(Some(&window)); - assert_eq!(window.0.get(), 1, "the window was not hidden"); - // Without a window (none was made), there is nothing to hide. - hide_before_teardown::(None); -} diff --git a/apps/vectorcraft/src/titlebar.rs b/apps/vectorcraft/src/titlebar.rs index 88dce26897..cb98fa2648 100644 --- a/apps/vectorcraft/src/titlebar.rs +++ b/apps/vectorcraft/src/titlebar.rs @@ -191,6 +191,25 @@ pub(crate) fn custom_titlebar(saved: Option<&vectorcraft_ui_egui::UiState>) -> ( (custom_titlebar_from(&frame, opted_into_system), caption_layout_from(&frame)) } +/// Whether the desktop would draw this window's frame with System Title Bar on or off while +/// VectorCraft Title Bar on Every Desktop is off: `VECTORCRAFT_TITLEBAR` is not set to `app`, +/// `system` or `desktop` (`overridden` is `None`), and the probe chose +/// [`craft_window::Frame::Desktop`] or the window opens through XWayland (`forced_to_x11`) +/// ([`app_draws_frame`]). The saved VectorCraft Title Bar on Every Desktop is left out, so the value +/// stays `true` on such a desktop while that preference gives the app the frame. Always `false` on +/// macOS and Windows, where System Title Bar decides the frame by itself. +pub(crate) fn desktop_keeps_frame_from(probed: &craft_window::Frame, overridden: Option, forced_to_x11: bool) -> bool { + let probed_app = matches!(probed, craft_window::Frame::App(_)); + cfg!(not(any(target_os = "macos", target_os = "windows"))) && overridden.is_none() && !app_draws_frame(probed_app, None, forced_to_x11, false) +} + +/// [`desktop_keeps_frame_from`] for this start's probe, given whether the launch path opens the +/// window through XWayland. +pub(crate) fn desktop_keeps_frame(forced_to_x11: bool) -> bool { + let choice = probed_choice(); + desktop_keeps_frame_from(choice.frame(), choice.overridden(), forced_to_x11) +} + pub(crate) fn native_options(custom_titlebar: bool) -> eframe::NativeOptions { eframe::NativeOptions { viewport: egui::ViewportBuilder::default() diff --git a/crates/brush/src/colorize.rs b/crates/brush/src/colorize.rs index 2cf9f43c97..00edeb3113 100644 --- a/crates/brush/src/colorize.rs +++ b/crates/brush/src/colorize.rs @@ -114,51 +114,9 @@ fn strip_brushes(n: &mut Node) { } } -/// Mix every solid paint under `n` towards `color` by `amount` (0..1) — the Symbol Stainer. -pub fn tint_node(n: &mut Node, color: &Color, amount: f32) { - let amount = amount.clamp(0.0, 1.0); - for it in &mut n.appearance.items { - let p = match it { - AppearanceItem::Fill(f) => &mut f.paint, - AppearanceItem::Stroke(s) => &mut s.paint, - }; - if let Paint::Solid { color: c, .. } = p { - *p = Paint::solid(c.lerp(color, amount)); - } - } - if let vectorcraft_doc::NodeKind::Text(t) = &mut n.kind { - for r in &mut t.runs { - for p in [&mut r.style.fill, &mut r.style.stroke] { - if let Paint::Solid { color: c, .. } = p { - *p = Paint::solid(c.lerp(color, amount)); - } - } - } - } - if let Some(ch) = n.children_mut() { - for c in ch.iter_mut() { - tint_node(Arc::make_mut(c), color, amount); - } - } -} - -/// The stain instance `inst` puts on its symbol's art: its visible fill colour and that fill's -/// opacity (how far the art mixes towards it). `None` for an unstained instance, including one -/// whose fill has an opacity of 0, so its art keeps its paints and their swatch links. -pub fn stain(inst: &Node) -> Option<(Color, f32)> { - let f = inst.appearance.fill().filter(|f| f.visible && f.opacity > 0.0)?; - Some((f.paint.color()?, f.opacity)) -} - -/// A symbol's art for instance `inst`: with the instance's own appearance changes to it (a dynamic -/// symbol's, [`vectorcraft_doc::symbol_overrides`]), stained by the instance's fill ([`stain`]). -pub fn instance_art(art: &Node, inst: &Node) -> Node { - let mut a = vectorcraft_doc::symbol_overrides::dynamic_art(art, inst); - if let Some((c, amount)) = stain(inst) { - tint_node(&mut a, &c, amount); - } - a -} +/// The Symbol Stainer's mix, an instance's stain and its stained art, from +/// [`vectorcraft_doc::symbol_overrides`], which the effects that reshape an instance also read. +pub use vectorcraft_doc::symbol_overrides::{instance_art, stain, tint_node}; /// The solid colours of the fills and strokes under `nodes`, most used first (then in the order /// they first appear): the colours Brush Options offers as Hue Shift's key colour, the first being diff --git a/crates/brush/src/lib.rs b/crates/brush/src/lib.rs index 080462d0b6..0b3c59ab7b 100644 --- a/crates/brush/src/lib.rs +++ b/crates/brush/src/lib.rs @@ -13,6 +13,7 @@ mod calli; mod colorize; mod defaults; +pub mod stored_art; pub mod track; mod warp; @@ -351,7 +352,8 @@ pub enum Direction { #[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase", tag = "mode")] pub enum ArtScale { - /// Keep the art's proportions (length follows the path; width scales with it). + /// Keep the art's proportions (length follows the path; width scales with it, times the + /// stroke weight and the brush width). Proportional, /// Stretch the art to the path length. #[default] @@ -798,9 +800,15 @@ fn number_repeated_names(lib: &mut [Brush]) { } } -/// Store `lib` as the document's brush library. +/// Store `lib` as the document's brush library. When the art of a brush holds images or placed +/// documents, each object in that art whose id is 0 or repeats another object's is given a new +/// id ([`stored_art::StoredArt::persist_ids`]), so the Links panel lists it by the same id until it +/// changes. pub fn store(doc: &mut Document, lib: &[Brush]) { doc.unknown.insert(DOC_KEY.into(), serde_json::to_value(lib).unwrap_or_default()); + if lib.iter().any(|b| b.art().into_iter().any(stored_art::holds_files)) { + stored_art::StoredArt::persist_ids(doc); + } } /// Find a brush by name. diff --git a/crates/brush/src/stored_art.rs b/crates/brush/src/stored_art.rs new file mode 100644 index 0000000000..a386e2e181 --- /dev/null +++ b/crates/brush/src/stored_art.rs @@ -0,0 +1,176 @@ +//! The art of the stored brushes (a scatter or art brush's art, a pattern brush's tiles) as stored +//! art of the document ([`Document::mounted_art`]): set on the document while a command looks it up +//! by id or changes it, then written back into the library entries whose art changed. The Links +//! panel finds the images and placed documents in that art this way. + +use std::sync::Arc; + +use serde_json::{Value, json}; +use vectorcraft_doc::{Document, Node, NodeKind}; + +use crate::{Brush, BrushKind, DOC_KEY}; + +/// The brushes of a document's stored library whose art holds images or placed documents. +#[derive(Default)] +pub struct StoredArt { + entries: Vec, + /// How many entries the stored library had when it was read. + read_entries: usize, +} + +/// A library entry whose brush's art holds images or placed documents. +struct Entry { + /// Its index in the stored library. + slot: usize, + /// The entry as it was read. + raw: Value, + brush: Brush, + /// The brush's art ([`Brush::art`]), each root with the `owner` the Links panel names for it. + art: Vec<(Arc, Value)>, +} + +/// What names each root of [`Brush::art`] among the brush's art: a pattern brush's tile, in the +/// same order; nothing for the one root of a scatter or art brush. +fn tiles(b: &Brush) -> Vec> { + match &b.kind { + BrushKind::Pattern(p) => std::iter::once(Some("side")) + .chain( + [ + (p.outer_corner.is_some(), "outerCorner"), + (p.inner_corner.is_some(), "innerCorner"), + (p.start.is_some(), "start"), + (p.end.is_some(), "end"), + ] + .into_iter() + .filter(|(held, _)| *held) + .map(|(_, tile)| Some(tile)), + ) + .collect(), + _ => vec![None], + } +} + +/// Whether `n` or its subtree, opacity-mask art included, holds an image or a placed document. +pub(crate) fn holds_files(n: &Node) -> bool { + let mut found = false; + vectorcraft_doc::swatches::walk_with_masks(n, &mut |c| found |= matches!(c.kind, NodeKind::Image(_) | NodeKind::PlacedDocument(_))); + found +} + +impl StoredArt { + /// The brushes of `doc`'s stored library whose art holds an image or a placed document (opacity + /// masks included). An entry that does not read as a brush is left out, and so is left as it + /// is. A root's owner is + /// `{kind: "brush", name, index, tile?}`, with the name and index the brush has in the library as + /// the Brushes panel lists it ([`crate::library`], a repeated name numbered). + pub fn read(doc: &Document) -> Self { + let Some(stored) = doc.unknown.get(DOC_KEY) else { return Self::default() }; + let Some(list) = stored.as_array() else { return Self::default() }; + let listed = crate::parse_library(stored); + let parsed = list.iter().enumerate().filter_map(|(slot, raw)| Brush::from_json(raw.clone()).ok().map(|b| (slot, raw, b))); + let mut entries = vec![]; + for (index, (slot, raw, brush)) in parsed.enumerate() { + if !brush.art().into_iter().any(holds_files) { + continue; + } + let name = listed.get(index).map_or(brush.name.as_str(), |b| b.name.as_str()); + let art: Vec<(Arc, Value)> = brush + .art() + .into_iter() + .zip(tiles(&brush)) + .map(|(n, tile)| { + let mut owner = json!({ "kind": "brush", "name": name, "index": index }); + if let Some(tile) = tile { + owner["tile"] = json!(tile); + } + (Arc::new(n.clone()), owner) + }) + .collect(); + if !art.is_empty() { + entries.push(Entry { slot, raw: raw.clone(), brush, art }); + } + } + Self { entries, read_entries: list.len() } + } + + /// Gives the objects of the stored brushes' art that holds images or placed documents ids of + /// their own in `doc`'s library, as [`Self::mount`] gives them, and writes the brushes whose + /// ids changed back. Does nothing while art is set on `doc` ([`Document::mounted_art`]). + pub fn persist_ids(doc: &mut Document) { + if !doc.mounted_art.is_empty() { + return; + } + let art = Self::read(doc); + if !art.is_empty() { + art.mount(doc); + art.write_entries(doc); + } + } + + /// No stored brush's art holds an image or a placed document. + pub fn is_empty(&self) -> bool { + self.entries.is_empty() + } + + /// Sets the art on `doc` as [`Document::mounted_art`], each object with an id of its own + /// ([`Document::number_mounted_art`]: an id another stored object has, or none, is replaced, and + /// the id counter stands above them all). + pub fn mount(&self, doc: &mut Document) { + doc.mounted_art = self.entries.iter().flat_map(|e| e.art.iter().cloned()).collect(); + doc.number_mounted_art(); + } + + /// Takes [`Document::mounted_art`] off `doc` and writes each brush whose art changed (new ids + /// included) back into its library entry: the entry at its index when that entry is as it was + /// read or reads as the brush as it was apart from its name, else the first entry that reads as + /// the brush as it was, else the first that does apart from its name. An entry found apart from + /// its name keeps that name (the library was written again meanwhile, as placing a document's + /// brushes into it does, numbering a repeated name). The other entries are left as + /// they are. Then the art of brushes added meanwhile gets ids of its own + /// ([`Self::persist_ids`]). + pub fn write_back(self, doc: &mut Document) { + let read_entries = self.read_entries; + self.write_entries(doc); + if doc.unknown.get(DOC_KEY).and_then(Value::as_array).map(Vec::len) != Some(read_entries) { + Self::persist_ids(doc); + } + } + + /// [`Self::write_back`] without giving ids to the art of brushes added meanwhile. + fn write_entries(self, doc: &mut Document) { + let mut mounted = std::mem::take(&mut doc.mounted_art).into_iter(); + let mut changed = vec![]; + for e in self.entries { + let now: Vec> = mounted.by_ref().take(e.art.len()).map(|(n, _)| n).collect(); + if now.len() != e.art.len() || now.iter().zip(&e.art).all(|(a, (b, _))| Arc::ptr_eq(a, b)) { + continue; + } + let mut brush = e.brush.clone(); + for (slot, art) in brush.art_mut().into_iter().zip(now) { + *slot = Arc::unwrap_or_clone(art); + } + changed.push((e.slot, e.raw, e.brush, brush)); + } + let Some(list) = doc.unknown.get_mut(DOC_KEY).and_then(Value::as_array_mut) else { return }; + for (slot, raw, was, mut brush) in changed { + // The entry's name when it reads as `was` apart from its name. + let name_of = |entry: &Value| { + Brush::from_json(entry.clone()).ok().and_then(|mut b| { + let name = std::mem::replace(&mut b.name, was.name.clone()); + (b == was).then_some(name) + }) + }; + let at = match list.get(slot) { + Some(entry) if *entry == raw || name_of(entry).is_some() => Some(slot), + _ => list.iter().position(|e| name_of(e).as_ref() == Some(&was.name)).or_else(|| list.iter().position(|e| name_of(e).is_some())), + }; + let Some(entry) = at.and_then(|i| list.get_mut(i)) else { continue }; + if let Some(name) = name_of(entry) { + brush.name = name; + } + if let Ok(v) = serde_json::to_value(&brush) { + *entry = v; + } + } + } +} diff --git a/crates/brush/src/tests.rs b/crates/brush/src/tests.rs index 2d62a1a993..de178c76ac 100644 --- a/crates/brush/src/tests.rs +++ b/crates/brush/src/tests.rs @@ -141,6 +141,50 @@ fn art_brush_proportional_keeps_aspect() { assert!(near(bounds(&out).height(), 8.0, 1e-6)); } +/// Scale Proportionately art is scaled across by the stroke weight and the Width, as Stretch art +/// is, on top of the scale the path length gives it. +#[test] +fn art_brush_proportional_grows_with_weight() { + let brush = |width: f64, overlap: bool| { + let mut b = art_brush(rect_art(100.0, 4.0), ArtScale::Proportional); + if let BrushKind::Art(a) = &mut b.kind { + (a.width, a.overlap) = (width, overlap); + } + b + }; + let draw = |b: &Brush, bp: &BezPath, st: &StrokeLayer| stroke_pieces(&Document::new(1.0, 1.0), b, bp, st); + // 3 pt stroke → 3× wider than at 1 pt (8 pt); the length still follows the path. + let b = bounds(&draw(&brush(100.0, false), &line(0.0, 0.0, 200.0, 0.0), &stroke(3.0))); + assert!(near(b.height(), 24.0, 1e-6) && near(b.x0, 0.0, 1e-6) && near(b.x1, 200.0, 1e-6), "{b:?}"); + // The Width (50 %) applies on top of the stroke weight. + let b = bounds(&draw(&brush(50.0, false), &line(0.0, 0.0, 200.0, 0.0), &stroke(3.0))); + assert!(near(b.height(), 12.0, 1e-6), "{b:?}"); + // A path twice as long at twice the weight (as Scale Strokes & Effects at 200 % leaves it): + // 2× from the length and 2× from the weight. + let b = bounds(&draw(&brush(100.0, false), &line(0.0, 0.0, 400.0, 0.0), &stroke(2.0))); + assert!(near(b.height(), 32.0, 1e-6), "{b:?}"); + // With Overlap, each run between corners is scaled by its own length and by the weight: the + // 100 pt run 4 pt × 3 across, the 50 pt run 2 pt × 3. + let mut bent = BezPath::new(); + bent.move_to((0.0, 0.0)); + bent.line_to((100.0, 0.0)); + bent.line_to((100.0, 50.0)); + let out = draw(&brush(100.0, true), &bent, &stroke(3.0)); + assert_eq!(out.len(), 2); + let (r0, r1) = (out[0].geometric_bounds().unwrap(), out[1].geometric_bounds().unwrap()); + assert!(near(r0.height(), 12.0, 1e-6) && near(r1.width(), 6.0, 1e-6), "{r0:?} {r1:?}"); + // A width that follows the pen: 50 % at the lightest pressure, 300 % at the heaviest, times + // the 2 pt weight (4 pt art on a 100 pt path: 4 pt across at 100 %, 1 pt either side). + let mut pen = brush(50.0, false); + if let BrushKind::Art(a) = &mut pen.kind { + (a.width_mode, a.width_max) = (Some(Variation::Pressure), Some(300.0)); + } + let ramp = StrokeLayer { width: 2.0, ..pressed(vec![(0.0, 0.0), (1.0, 1.0)]) }; + let out = draw(&pen, &line(0.0, 0.0, 100.0, 0.0), &ramp); + assert!(near(half_width(&out, 0.0, 1.0), 2.0, 0.1), "{}", half_width(&out, 0.0, 1.0)); + assert!(near(half_width(&out, 99.0, 100.0), 12.0, 0.2), "{}", half_width(&out, 99.0, 100.0)); +} + #[test] fn art_brush_between_guides_keeps_ends() { // Head (last 20 % of a 100 pt art) keeps its 20 pt length on a 300 pt path. @@ -973,6 +1017,159 @@ fn repeated_brush_names_are_numbered_when_read() { assert_eq!(names.iter().collect::>().len(), names.len()); } +/// Art of `w`×`h` points holding a linked image: a group of [`rect_art`] and the image, both with id 0. +fn linked_art(w: f64, h: f64) -> Node { + let image = Node::new( + NodeId(0), + NodeKind::Image(Box::new(vectorcraft_doc::ImageObject { + key: "k".into(), + width: 4, + height: 4, + xf: Affine::IDENTITY, + link: Some(vectorcraft_doc::LinkInfo::new("/art/a.png")), + placement: Default::default(), + pixels: None, + })), + ); + Node::group(NodeId(0), vec![std::sync::Arc::new(rect_art(w, h)), std::sync::Arc::new(image)]) +} + +/// The art of the stored brushes that holds images mounts on the document as stored art, each tile +/// with the brush, its place in the library and the tile as owner, its objects with ids of their +/// own; writing it back changes only the entries whose art changed, and leaves an entry that does +/// not read as a brush, a brush without art and a brush whose art holds no image as they were stored. +#[test] +fn stored_brush_art_mounts_and_writes_back_only_what_changed() { + use stored_art::StoredArt; + let mut d = Document::new(100.0, 100.0); + let layer_object = d.layers[0].id; + let mut side = linked_art(10.0, 4.0); + side.id = layer_object; + let pattern = + Brush { name: "Frame".into(), kind: BrushKind::Pattern(PatternBrush { side, start: Some(linked_art(4.0, 4.0)), ..Default::default() }) }; + let scatter = Brush { + name: "Dots".into(), + kind: BrushKind::Scatter(Scatter { art: linked_art(2.0, 2.0), colorization: Colorization::None, ..Default::default() }), + }; + // Written as a file holds it, without the ids `store` gives. + let lib = [calli(0.0, 100.0, 3.0), pattern, scatter, art_brush(rect_art(10.0, 4.0), ArtScale::Stretch)]; + d.unknown.insert(DOC_KEY.into(), serde_json::to_value(lib).unwrap()); + let odd = serde_json::json!({ "name": "Odd", "type": "unknown" }); + if let Some(list) = d.unknown.get_mut(DOC_KEY).and_then(serde_json::Value::as_array_mut) { + list.insert(1, odd.clone()); + } + let stored = d.unknown[DOC_KEY].clone(); + let art = StoredArt::read(&d); + art.mount(&mut d); + let owners: Vec<&serde_json::Value> = d.mounted_art.iter().map(|(_, o)| o).collect(); + assert_eq!( + owners, + [ + &serde_json::json!({ "kind": "brush", "name": "Frame", "index": 1, "tile": "side" }), + &serde_json::json!({ "kind": "brush", "name": "Frame", "index": 1, "tile": "start" }), + &serde_json::json!({ "kind": "brush", "name": "Dots", "index": 2 }), + ] + ); + let ids: Vec = d.mounted_art.iter().map(|(n, _)| n.id).collect(); + let mut all = vec![]; + d.visit_stored(|n, _| all.push(n.id)); + assert!(all.iter().all(|id| id.0 != 0) && !all[1..].contains(&layer_object), "{all:?}"); + assert_eq!(all.iter().collect::>().len(), all.len(), "{all:?}"); + // The scatter brush's art changes; the pattern brush's tiles keep the ids mounting gave them. + d.stored_node_mut(ids[2]).unwrap().name = Some("changed".into()); + art.write_back(&mut d); + assert!(d.mounted_art.is_empty()); + let now = d.unknown[DOC_KEY].as_array().unwrap(); + assert_eq!(now.len(), 5); + assert_eq!((&now[0], &now[1], &now[4]), (&stored[0], &odd, &stored[4]), "the entries without images stay as stored"); + assert_ne!(now[2], stored[2], "the pattern brush keeps the ids its art was given"); + let lib = library(&d); + let Some(BrushKind::Pattern(p)) = lib.iter().find(|b| b.name == "Frame").map(|b| &b.kind) else { panic!("no pattern brush") }; + assert_eq!((p.side.id, p.start.as_ref().map(|n| n.id)), (ids[0], Some(ids[1]))); + assert_eq!(find(&d, "Dots").unwrap().art()[0].name.as_deref(), Some("changed")); + // Mounting again gives the same ids and changes nothing, so writing back leaves the library as it is. + let again = d.unknown[DOC_KEY].clone(); + let art = StoredArt::read(&d); + art.mount(&mut d); + assert_eq!(d.mounted_art.iter().map(|(n, _)| n.id).collect::>(), ids); + art.write_back(&mut d); + assert_eq!(d.unknown[DOC_KEY], again); +} + +/// A brush whose stored name repeats an earlier brush's is named in its art's owner as the Brushes +/// panel lists it, numbered. +#[test] +fn stored_brush_art_owner_names_a_repeated_name_as_listed() { + use stored_art::StoredArt; + let mut d = Document::new(100.0, 100.0); + let scatter = Brush { name: "Dots".into(), kind: BrushKind::Scatter(Scatter { art: linked_art(2.0, 2.0), ..Default::default() }) }; + store(&mut d, &[scatter.clone(), scatter]); + StoredArt::read(&d).mount(&mut d); + let names: Vec<&serde_json::Value> = d.mounted_art.iter().map(|(_, o)| &o["name"]).collect(); + assert_eq!(names, ["Dots", "Dots 2"]); +} + +/// Storing a library whose brush art holds an image gives that art ids of its own, so mounting it +/// later gives the same ids whatever the document allocated in between; art without images keeps +/// the ids it was stored with. +#[test] +fn storing_brush_art_with_images_keeps_ids_of_its_own() { + use stored_art::StoredArt; + let mut d = Document::new(100.0, 100.0); + let mut art = linked_art(2.0, 2.0); + art.id = d.layers[0].id; + let scatter = Brush { name: "Dots".into(), kind: BrushKind::Scatter(Scatter { art, ..Default::default() }) }; + store(&mut d, &[scatter, art_brush(rect_art(10.0, 4.0), ArtScale::Stretch)]); + let lib = library(&d); + let stored = lib[0].art()[0].id; + assert_ne!(stored, d.layers[0].id); + assert_eq!(lib[1].art()[0].id, NodeId(0), "art without images is stored as it was"); + d.alloc_id(); + StoredArt::read(&d).mount(&mut d); + assert_eq!(d.mounted_art[0].0.id, stored); +} + +/// When the library is written again while the art is mounted, numbering a repeated name and +/// adding a brush (as placing a document's brushes into it does), writing back changes the entry +/// at its own place that reads as the brush apart from its new name, keeping that name, even when +/// an earlier brush is the same as the one it was, and gives the added brush's art ids of its own. +#[test] +fn brush_art_written_back_finds_its_renamed_entry_and_numbers_added_art() { + use stored_art::StoredArt; + /// `n` with ids from `next` on, in paint order. + fn numbered(mut n: Node, next: &mut u64) -> Node { + n.id = NodeId(*next); + *next += 1; + for c in n.children_mut().into_iter().flatten() { + *c = std::sync::Arc::new(numbered((**c).clone(), next)); + } + n + } + let mut d = Document::new(100.0, 100.0); + let scatter = + |n: &str| Brush { name: n.into(), kind: BrushKind::Scatter(Scatter { art: numbered(linked_art(2.0, 2.0), &mut 50), ..Default::default() }) }; + // Two brushes the same apart from the ids mounting gives the second. + d.unknown.insert(DOC_KEY.into(), serde_json::to_value([scatter("Dots"), scatter("Dots")]).unwrap()); + let art = StoredArt::read(&d); + art.mount(&mut d); + assert_eq!(d.mounted_art[0].0.id, NodeId(50)); + let second = d.mounted_art[1].0.id; + // The library is written again: the repeated name numbered, a brush whose art repeats an id added. + let mut added = scatter("New"); + if let BrushKind::Scatter(s) = &mut added.kind { + s.art.id = d.layers[0].id; + } + let lib = [library(&d), vec![added]].concat(); + d.unknown.insert(DOC_KEY.into(), serde_json::to_value(&lib).unwrap()); + assert_eq!(lib[1].name, "Dots 2"); + d.stored_node_mut(second).unwrap().name = Some("changed".into()); + art.write_back(&mut d); + let lib = library(&d); + assert_eq!(lib.iter().map(|b| b.name.as_str()).collect::>(), ["Dots", "Dots 2", "New"]); + assert_eq!((lib[0].art()[0].name.as_deref(), lib[1].art()[0].name.as_deref()), (None, Some("changed"))); + assert_ne!(lib[2].art()[0].id, d.layers[0].id, "the added brush's art has ids of its own"); +} + #[test] fn brushes_serde_round_trip() { let lib = defaults().to_vec(); diff --git a/crates/brush/src/warp.rs b/crates/brush/src/warp.rs index c72e1c33f8..edf0ac0567 100644 --- a/crates/brush/src/warp.rs +++ b/crates/brush/src/warp.rs @@ -465,17 +465,8 @@ fn art_runs(t: &Track) -> Vec<(f64, f64)> { bounds.windows(2).map(|w| (w[0], w[1])).collect() } -/// The art on [s0, s1] of `t`, `cross` across where `widen` (0..=1, by arc length) is 1, and -/// `width` the width (%) there. -fn art_on_run( - t: &Track, - (s0, s1): (f64, f64), - a: &ArtBrush, - (art, b): (&Node, Rect), - cross: f64, - width: f64, - widen: &dyn Fn(f64) -> f64, -) -> Option { +/// The art on [s0, s1] of `t`, `cross` across where `widen` (0..=1, by arc length) is 1. +fn art_on_run(t: &Track, (s0, s1): (f64, f64), a: &ArtBrush, (art, b): (&Node, Rect), cross: f64, widen: &dyn Fn(f64) -> f64) -> Option { let l = s1 - s0; if l <= 1e-9 { return None; @@ -483,10 +474,8 @@ fn art_on_run( let w = b.width(); let (along, cross) = match a.scale { ArtScale::Stretch => (AlongMap::linear(w, s0, s1), cross), - ArtScale::Proportional => { - let k = l / w; - (AlongMap::linear(w, s0, s1), k * width / 100.0) - } + // Scaled across as much as along, times the stroke weight and the width, as the other modes are. + ArtScale::Proportional => (AlongMap::linear(w, s0, s1), l / w * cross), ArtScale::BetweenGuides { start, end } => { let (g0, g1) = (start.clamp(0.0, 1.0) * w, end.clamp(0.0, 1.0) * w); let (g0, g1) = (g0.min(g1), g0.max(g1)); @@ -528,7 +517,7 @@ pub(crate) fn art(a: &ArtBrush, bp: &BezPath, weight: f64, stroke: &StrokeLayer) }; let runs = if a.overlap { art_runs(&t) } else { vec![(0.0, l)] }; for run in runs { - if let Some(n) = art_on_run(&t, run, a, (&art, b), cross, width, &widen) { + if let Some(n) = art_on_run(&t, run, a, (&art, b), cross, &widen) { out.push(n); } } diff --git a/crates/cad/src/scene.rs b/crates/cad/src/scene.rs index 4860e4989a..ea3c962053 100644 --- a/crates/cad/src/scene.rs +++ b/crates/cad/src/scene.rs @@ -683,7 +683,7 @@ impl<'a> Scene<'a> { { // Symbols holding instances of symbols are written in full for each instance, // empty or not: every instance's art counts against one budget for the export. - let art = vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n); + let art = vectorcraft_doc::symbol_overrides::instance_art(&sym.art, n); let count = art.count_with_masks() as u64; // Counted as `place_symbol_art_unclipped` places it: no clip groups. let most = doc.symbol_slice_map(symbol, *xf).map_or(count, |m| m.most_placed_unclipped(&art, doc)); diff --git a/crates/cad/src/tests.rs b/crates/cad/src/tests.rs index 96c037a4a7..a14af8d929 100644 --- a/crates/cad/src/tests.rs +++ b/crates/cad/src/tests.rs @@ -1395,6 +1395,21 @@ fn crop_keeps_an_instance_whose_art_reaches_the_region() { assert!(!kinds(&export(&d, &o).unwrap()).is_empty()); } +/// An instance stained blue by its fill writes its symbol's red art in blue, as the canvas draws it. +#[test] +fn a_stained_instance_is_written_in_its_stained_color() { + let mut d = doc_with(|d| { + let mut n = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Mark".into(), xf: Affine::translate((30.0, 30.0)) }); + n.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0).into(); + vec![n] + }); + let art = path(&mut d, shapes::rectangle(Rect::new(0.0, 0.0, 40.0, 40.0)), Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Mark".into(), art: Arc::new(art) }); + let out = export(&d, &opts(&d)).unwrap(); + let colors: Vec> = entities(&out).iter().map(|e| get(e, 420).map(str::to_string)).collect(); + assert!(!colors.is_empty() && colors.iter().all(|c| c.as_deref() == Some("255")), "{colors:?}"); +} + #[test] fn symbols_fanning_out_into_empty_symbols_stop_at_the_symbol_budget() { // Five levels of 100 instances of the level below, ending in an empty symbol: 10^10 empty diff --git a/crates/color/src/cms.rs b/crates/color/src/cms.rs index f4297343a6..7fd8707a99 100644 --- a/crates/color/src/cms.rs +++ b/crates/color/src/cms.rs @@ -9,13 +9,16 @@ //! any CMYK `.icc` the user loads goes through `moxcms` (LUT-based profiles). //! * The **active settings** are process-wide: the working settings (Edit → Color Settings), with //! the profiles [`use_document_profiles`] last put in place of the working spaces; -//! [`crate::Color::to_rgb`] uses them. Code that needs deterministic numbers builds its own [`Cms`] with [`Cms::new`]. +//! [`crate::Color::to_rgb`] uses them. [`with_active`] puts other settings in their place on one +//! thread, as for a document drawn through its own profiles ([`for_document`]). Code that needs +//! deterministic numbers builds its own [`Cms`] with [`Cms::new`]. pub mod display; pub mod generic; pub mod icc; pub mod lab; +use std::cell::{Cell, RefCell}; use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::{Arc, Mutex, OnceLock, RwLock}; @@ -910,9 +913,32 @@ static WORKING: RwLock>> = RwLock::new(None); static RGB_IS_SRGB: AtomicBool = AtomicBool::new(true); static CMYK_IS_DEVICE: AtomicBool = AtomicBool::new(false); +thread_local! { + /// The settings [`with_active`] put in place of the active settings on this thread. + static SCOPED: RefCell>> = const { RefCell::new(None) }; + /// [`SCOPED`]'s flags for the fast paths: [`SCOPED_SET`] while it is set, [`SCOPED_SRGB`] when + /// its RGB space is sRGB, and [`SCOPED_DEVICE`] when its CMYK space is device CMYK. + static SCOPED_FLAGS: Cell = const { Cell::new(0) }; +} +const SCOPED_SET: u8 = 1; +const SCOPED_SRGB: u8 = 2; +const SCOPED_DEVICE: u8 = 4; + /// The active color-management context: the working settings, with the profiles -/// [`use_document_profiles`] last put in place of the working spaces. +/// [`use_document_profiles`] last put in place of the working spaces. Inside [`with_active`] on +/// this thread: the settings it was given. pub fn active() -> Arc { + if SCOPED_FLAGS.with(Cell::get) & SCOPED_SET != 0 + && let Some(c) = SCOPED.with(|s| s.borrow().clone()) + { + return c; + } + installed() +} + +/// The active settings of the process, as [`use_document_profiles`] or [`set_active`] last put them +/// in place. +fn installed() -> Arc { if let Some(c) = ACTIVE.read().unwrap_or_else(|e| e.into_inner()).as_ref() { return c.clone(); } @@ -954,14 +980,8 @@ pub fn set_active(settings: &ColorSettings) -> Result<(), CmsError> { /// the active settings changed. pub fn use_document_profiles(rgb: Option<&str>, cmyk: Option<&str>) -> bool { let working = working(); - let mut st = working.settings.clone(); - if let Some(p) = rgb.and_then(profile).filter(|p| p.kind == ProfileKind::Rgb) { - st.rgb = p.name; - } - if let Some(p) = cmyk.and_then(profile).filter(|p| p.kind == ProfileKind::Cmyk) { - st.cmyk = p.name; - } - if st == active().settings { + let st = document_settings(&working.settings, rgb, cmyk); + if st == installed().settings { return false; } if st == working.settings { @@ -976,6 +996,72 @@ pub fn use_document_profiles(rgb: Option<&str>, cmyk: Option<&str>) -> bool { true } +/// The working settings `working` with the profiles a document is assigned (`None`: none) in place +/// of the working spaces, as [`use_document_profiles`] takes them. +fn document_settings(working: &ColorSettings, rgb: Option<&str>, cmyk: Option<&str>) -> ColorSettings { + let mut st = working.clone(); + if let Some(p) = rgb.and_then(profile).filter(|p| p.kind == ProfileKind::Rgb) { + st.rgb = p.name; + } + if let Some(p) = cmyk.and_then(profile).filter(|p| p.kind == ProfileKind::Cmyk) { + st.cmyk = p.name; + } + st +} + +/// How many contexts [`for_document`] keeps. +const DOCUMENT_CONTEXTS: usize = 8; + +/// The color-management context a document assigned the profiles `rgb` and `cmyk` (`None`: none) +/// draws through: the one [`use_document_profiles`] would make active for it. A context that is the +/// active or the working one is that one; the others are kept for the same working settings and +/// loaded profiles, so the same document gets the same context again. A profile that cannot be +/// loaded gives the working settings. +pub fn for_document(rgb: Option<&str>, cmyk: Option<&str>) -> Arc { + static KEPT: Mutex)>> = Mutex::new(Vec::new()); + let working = working(); + let st = document_settings(&working.settings, rgb, cmyk); + let installed = installed(); + if st == installed.settings { + return installed; + } + if st == working.settings { + return working; + } + let generation = profiles_generation(); + let mut kept = KEPT.lock().unwrap_or_else(|e| e.into_inner()); + kept.retain(|(g, c)| *g == generation && c.working.as_ref().is_some_and(|w| Arc::ptr_eq(w, &working))); + if let Some((_, c)) = kept.iter().find(|(_, c)| c.settings == st) { + return c.clone(); + } + let Ok(mut cms) = Cms::new(&st) else { return working }; + cms.working = Some(working); + let cms = Arc::new(cms); + if kept.len() >= DOCUMENT_CONTEXTS { + kept.remove(0); + } + kept.push((generation, cms.clone())); + cms +} + +/// Run `f` with `cms` as the active settings on this thread ([`active`], [`crate::Color::to_rgb`] +/// and the conversions that read them), as when drawing a document other than the front one +/// through its own profiles. Other threads, and this thread after `f`, keep the settings they had. +pub fn with_active(cms: Arc, f: impl FnOnce() -> R) -> R { + /// Puts back the settings this thread had before, when `f` returns or unwinds. + struct Restore(Option>, u8); + impl Drop for Restore { + fn drop(&mut self) { + SCOPED.with(|s| *s.borrow_mut() = self.0.take()); + SCOPED_FLAGS.with(|c| c.set(self.1)); + } + } + let flags = SCOPED_SET | if cms.rgb_is_srgb() { SCOPED_SRGB } else { 0 } | if matches!(cms.cmyk, CmykSpace::Device) { SCOPED_DEVICE } else { 0 }; + let before = SCOPED.with(|s| s.borrow_mut().replace(cms)); + let _restore = Restore(before, SCOPED_FLAGS.with(|c| c.replace(flags))); + f() +} + fn install(cms: Arc) { RGB_IS_SRGB.store(cms.rgb_is_srgb(), Ordering::Relaxed); CMYK_IS_DEVICE.store(matches!(cms.cmyk, CmykSpace::Device), Ordering::Relaxed); @@ -984,10 +1070,16 @@ fn install(cms: Arc) { /// Fast path for [`Color::to_rgb`]: RGB colours need no conversion while the working space is sRGB. pub(crate) fn rgb_is_srgb() -> bool { - RGB_IS_SRGB.load(Ordering::Relaxed) + match SCOPED_FLAGS.with(Cell::get) { + f if f & SCOPED_SET != 0 => f & SCOPED_SRGB != 0, + _ => RGB_IS_SRGB.load(Ordering::Relaxed), + } } pub(crate) fn cmyk_is_device() -> bool { - CMYK_IS_DEVICE.load(Ordering::Relaxed) + match SCOPED_FLAGS.with(Cell::get) { + f if f & SCOPED_SET != 0 => f & SCOPED_DEVICE != 0, + _ => CMYK_IS_DEVICE.load(Ordering::Relaxed), + } } #[cfg(test)] diff --git a/crates/color/src/cms/tests.rs b/crates/color/src/cms/tests.rs index 57709abe66..7b22163525 100644 --- a/crates/color/src/cms/tests.rs +++ b/crates/color/src/cms/tests.rs @@ -403,3 +403,42 @@ fn lab_colours_round_trip_through_the_cms() { let Color::Gray { k } = c.convert(&Color::lab(50.0, 0.0, 0.0), Model::Gray, ri) else { panic!("Gray") }; assert!((k - 0.53).abs() < 0.01, "{k}"); } + +#[test] +fn with_active_puts_settings_in_place_on_this_thread_only() { + let p3 = Arc::new(Cms::new(&ColorSettings { rgb: DISPLAY_P3.into(), cmyk: DEVICE_CMYK.into(), ..Default::default() }).unwrap()); + let (rgb, ink) = (Color::Rgb { r: 0.2, g: 0.6, b: 0.4 }, Color::Cmyk { c: 0.2, m: 0.3, y: 0.4, k: 0.1 }); + let before = (rgb.to_rgb(), ink.to_rgb()); + let (inside, ink_inside, other_thread, nested) = with_active(p3.clone(), || { + let other = std::thread::spawn(move || rgb.to_rgb()).join().unwrap(); + let nested = with_active(Arc::new(cms()), || rgb.to_rgb()); + (rgb.to_rgb(), ink.to_rgb(), other, nested) + }); + assert_eq!(inside, p3.display_rgb(&rgb), "RGB is drawn through the settings given"); + assert_ne!(inside, before.0); + assert_eq!(ink_inside, naive_cmyk_to_rgb([0.2, 0.3, 0.4, 0.1]), "CMYK takes the device formula of the settings given"); + assert_eq!(other_thread, before.0, "another thread keeps the active settings"); + assert_eq!(nested, before.0, "an inner call puts its own settings in place"); + assert_eq!((rgb.to_rgb(), ink.to_rgb()), before, "the active settings come back after"); + let unwound = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| with_active(p3.clone(), || panic!("unwinds")))); + assert!(unwound.is_err()); + assert_eq!((rgb.to_rgb(), ink.to_rgb()), before, "the active settings come back after a panic"); +} + +#[test] +fn a_document_gets_the_same_context_for_the_same_profiles() { + // Other tests load profiles meanwhile, and a load makes the contexts again: try until one pair + // of calls sees none. + let same = (0..100).any(|_| { + let generation = profiles_generation(); + let (a, b) = (for_document(Some(DISPLAY_P3), None), for_document(Some(DISPLAY_P3), None)); + profiles_generation() == generation && Arc::ptr_eq(&a, &b) + }); + assert!(same, "the same profiles give the same context"); + let p3 = for_document(Some(DISPLAY_P3), None); + assert_eq!(p3.settings().rgb, DISPLAY_P3); + assert_eq!(p3.settings().cmyk, working_settings().cmyk, "the working CMYK space stays"); + assert_eq!(for_document(None, None).settings(), &working_settings(), "no profiles: the working settings"); + let unknown = for_document(Some("no such profile"), Some(SRGB)); + assert_eq!(unknown.settings(), &working_settings(), "an unknown profile or one of the other model leaves the working space"); +} diff --git a/crates/color/src/gradient.rs b/crates/color/src/gradient.rs index 54cb50c197..05b7f4839c 100644 --- a/crates/color/src/gradient.rs +++ b/crates/color/src/gradient.rs @@ -547,6 +547,49 @@ impl Gradient { None => (Color::BLACK, 1.0), } } + /// Which of its stops color some part of it that draws, by the stretches [`Self::sample`] + /// mixes in, for stops in any order: the pair of stop `k` and stop `k + 1` covers the offsets + /// above every offset of stops `0..=k` up to stop `k + 1`'s, and both its stops count when that + /// stretch has positive width and either stop is above opacity 0. The first stop also counts + /// when it is above opacity 0, since it colors the offsets up to its own, and so does the last + /// stop, since it colors the offsets above every stop's. Any other stop, opaque or not, counts + /// only through a pair: a stop out of order whose pairs have no width (another stop before it + /// reaches past both ends) colors nothing. A freeform gradient draws from its points, so each of + /// its stops counts while any stop is above opacity 0. + pub fn drawn_stops(&self) -> Vec { + self.stops_with_color(|s| s.opacity > 0.0) + } + /// [`Self::drawn_stops`] with every stop taken as opaque, for output that leaves stop opacity + /// out: the stops that color a stretch of positive width, and the first and last stops. + pub fn reached_stops(&self) -> Vec { + self.stops_with_color(|_| true) + } + /// [`Self::drawn_stops`] with `shows` telling whether a stop's opacity shows its color. + fn stops_with_color(&self, shows: impl Fn(&GradientStop) -> bool) -> Vec { + let stops = &self.stops; + if self.kind == GradientKind::Freeform { + let any = stops.iter().any(&shows); + return vec![any; stops.len()]; + } + let mut drawn = vec![false; stops.len()]; + if let (Some(first), Some(d)) = (stops.first(), drawn.first_mut()) { + *d = shows(first); + } + if let (Some(last), Some(d)) = (stops.last(), drawn.last_mut()) { + *d |= shows(last); + } + // `f32::max` skips a NaN offset, which the sampler never picks either. + let mut reach = f32::NEG_INFINITY; + for k in 0..stops.len().saturating_sub(1) { + reach = reach.max(stops[k].offset); + let (a, b) = (&stops[k], &stops[k + 1]); + if b.offset > reach && (shows(a) || shows(b)) { + drawn[k] = true; + drawn[k + 1] = true; + } + } + drawn + } /// [`Self::sample_with`] at each of `ts`, which must not decrease. Each search starts where /// the one before it stopped, so the work is the samples plus the stops, not their product. pub fn sample_increasing_with(&self, ts: impl IntoIterator, mix: impl Fn(&Color, &Color, f32) -> Color) -> Vec<(Color, f32)> { diff --git a/crates/color/src/gradient/tests.rs b/crates/color/src/gradient/tests.rs index cd25753a05..16d8005786 100644 --- a/crates/color/src/gradient/tests.rs +++ b/crates/color/src/gradient/tests.rs @@ -66,6 +66,69 @@ fn stop_reach_matches_scanning_the_stops() { } } +/// A gradient's stops color what draws where they color a stretch that draws, for stops in any +/// order: the sampler mixes stop `k` with stop `k + 1` above every offset of the stops before it, +/// so an out-of-order stop's pair can have no width. +#[test] +fn drawn_stops_follow_the_sampled_stretches() { + let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, Color::BLACK) }; + let g = |stops: Vec| Gradient::new(GradientKind::Linear, stops); + // In order: the clear stop next to the opaque one, not the one after it. + assert_eq!(g(vec![stop(0.0, 1.0), stop(0.5, 0.0), stop(1.0, 0.0)]).drawn_stops(), vec![true, true, false]); + // Out of order: the pair (0.8, 0.3) has no width, so the clear stop at 0.3 mixes only with + // the clear stop at 0.8 before it, and the pair (0.3, 1.0) is sampled above 0.8. + assert_eq!(g(vec![stop(0.0, 0.0), stop(0.8, 0.0), stop(0.3, 0.0), stop(1.0, 1.0)]).drawn_stops(), vec![false, false, true, true]); + // An opaque stop out of order: the pairs (0, 0.8) and (0.7, 1) cover every offset, so the + // pairs next to the stop at 0.3 have no width and it colors nothing. + let out_of_order = |o: f32| g(vec![stop(0.0, 0.0), stop(0.8, o), stop(0.3, 1.0), stop(0.7, 0.0), stop(1.0, 0.0)]); + assert_eq!(out_of_order(0.0).drawn_stops(), vec![false; 5]); + // With the stop at 0.8 opaque, the pairs next to it with width are drawn. + assert_eq!(out_of_order(1.0).drawn_stops(), vec![true, true, false, false, false]); + // The last stop colors the offsets above every stop's, even when it is out of order. + assert_eq!(g(vec![stop(0.0, 0.0), stop(0.6, 0.0), stop(0.5, 1.0)]).drawn_stops(), vec![false, false, true]); + // The first stop colors the offsets up to its own. + assert_eq!(g(vec![stop(0.0, 1.0), stop(0.0, 0.0), stop(1.0, 0.0)]).drawn_stops(), vec![true, false, false]); + // One stop, every stop clear, and no stops at all. + assert_eq!(g(vec![stop(0.5, 1.0)]).drawn_stops(), vec![true]); + assert_eq!(g(vec![stop(0.0, 0.0), stop(1.0, 0.0)]).drawn_stops(), vec![false, false]); + assert!(g(vec![]).drawn_stops().is_empty()); + // A freeform gradient draws from its points: its stops count while any is above opacity 0. + let mut free = g(vec![stop(0.0, 1.0), stop(0.5, 0.0), stop(1.0, 0.0)]); + free.kind = GradientKind::Freeform; + assert_eq!(free.drawn_stops(), vec![true, true, true]); + free.stops.iter_mut().for_each(|s| s.opacity = 0.0); + assert_eq!(free.drawn_stops(), vec![false; 3]); +} + +/// Taken as opaque, every stop that colors a stretch of positive width counts, and the first and +/// last stops, whatever their opacity; an out-of-order stop whose pairs have no width does not. +#[test] +fn reached_stops_leave_out_only_stops_without_width() { + let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, Color::BLACK) }; + let g = |stops: Vec| Gradient::new(GradientKind::Linear, stops); + // Clear stops in order color their stretches once opaque. + assert_eq!(g(vec![stop(0.0, 1.0), stop(0.5, 0.0), stop(1.0, 0.0)]).reached_stops(), vec![true; 3]); + assert_eq!(g(vec![stop(0.0, 0.0), stop(1.0, 0.0)]).reached_stops(), vec![true, true]); + // The stop at 0.3 sits inside the stretch the stops at 0 and 0.8 cover. + let out_of_order = g(vec![stop(0.0, 0.0), stop(0.8, 0.0), stop(0.3, 1.0), stop(0.7, 0.0), stop(1.0, 0.0)]); + assert_eq!(out_of_order.reached_stops(), vec![true, true, false, true, true]); + // A stop at the offset of the stop before it: its pair has no width, the next one does. + assert_eq!(g(vec![stop(0.0, 1.0), stop(0.0, 1.0), stop(1.0, 1.0)]).reached_stops(), vec![true, true, true]); + assert_eq!( + g(vec![stop(0.0, 1.0), stop(0.6, 1.0), stop(0.6, 1.0), stop(0.2, 1.0), stop(1.0, 1.0)]).reached_stops(), + vec![true, true, false, true, true] + ); + assert!(g(vec![]).reached_stops().is_empty()); + // Every pair the sampler picks between the ends has both its stops counted. + let stops: Vec = [0.1, 0.4, 0.4, 0.2, 0.9, 0.5].iter().map(|&o| stop(o, 1.0)).collect(); + let g = g(stops); + let (reached, reach) = (g.reached_stops(), StopReach::new(&g.stops)); + for t in (5..=95).map(|k| k as f32 / 100.0).filter(|&t| t > 0.1 && t <= 0.9) { + let k = reach.0.partition_point(|r| *r < t); + assert!(reached[k] && reached[k + 1], "pair {k} at {t}: {reached:?}"); + } +} + /// Repeated offsets turn off the direct midpoint mix, and the midpoints still come out as /// `sample` gives them, with work that stays near linear in the stops (thousands of stops at one /// offset used to scan them all for each midpoint). diff --git a/crates/color/src/lib.rs b/crates/color/src/lib.rs index 3afca8063c..fa8cd564f2 100644 --- a/crates/color/src/lib.rs +++ b/crates/color/src/lib.rs @@ -435,9 +435,10 @@ impl Paint { } /// Apply `f` to the colours of this paint that can link to a swatch (a solid colour, each /// gradient stop) with their link and tint; `f` returns true when it changed them. A colour - /// left without a link gets tint 1. A freeform gradient's points, which it draws from, go - /// through `f` too, as unlinked colours (a link `f` gives them is dropped). Returns whether - /// anything changed. + /// left without a link gets tint 1, and a stop left without one also loses its process plates + /// ([`GradientStop::plates`], which print with a linked spot tint). A freeform gradient's + /// points, which it draws from, go through `f` too, as unlinked colours (a link `f` gives them + /// is dropped). Returns whether anything changed. pub fn map_links(&mut self, f: &mut dyn FnMut(&mut Color, &mut Option, &mut f32) -> bool) -> bool { let mut one = |c: &mut Color, link: &mut Option, tint: &mut f32| { let changed = f(c, link, tint); @@ -449,7 +450,11 @@ impl Paint { match self { Paint::Solid { color, swatch, tint } => one(color, swatch, tint), Paint::Gradient(g) => { - let stops = g.gradient.stops.iter_mut().fold(false, |ch, s| one(&mut s.color, &mut s.swatch, &mut s.tint) | ch); + let stops = g.gradient.stops.iter_mut().fold(false, |ch, s| { + let changed = one(&mut s.color, &mut s.swatch, &mut s.tint); + let unplated = s.swatch.is_none() && s.plates.take().is_some(); + changed | unplated | ch + }); let points = g.freeform.iter_mut().flat_map(|ff| ff.points.iter_mut()).fold(false, |ch, p| one(&mut p.color, &mut None, &mut 1.0) | ch); stops | points @@ -593,6 +598,34 @@ mod tests { assert!(g.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Ink") && s.tint == 0.5)); } + #[test] + fn mapping_links_drops_the_process_plates_of_unlinked_stops() { + let mut gradient = Gradient::default(); + let ink = Color::cmyk(0.0, 0.4, 0.0, 0.0); + gradient.stops[0].swatch = Some("Ink".into()); + (gradient.stops[0].color, gradient.stops[0].tint, gradient.stops[0].plates) = (ink, 0.4, Some([0.3, 0.0, 0.0, 0.0])); + let mut g = Paint::Gradient(Box::new(GradientPaint::new(gradient))); + // Unlinking the stop takes its plates with its tint and keeps the colour it shows. + assert!(g.map_links(&mut |_, l, _| l.take().is_some())); + let Paint::Gradient(gp) = &g else { panic!("a gradient") }; + let st = &gp.gradient.stops[0]; + assert_eq!((st.color, st.swatch.as_deref(), st.tint, st.plates), (ink, None, 1.0, None)); + // A linked stop keeps its plates. + let mut linked = Gradient::default(); + (linked.stops[0].swatch, linked.stops[0].plates) = (Some("Ink".into()), Some([0.3, 0.0, 0.0, 0.0])); + let mut l = Paint::Gradient(Box::new(GradientPaint::new(linked))); + assert!(!l.map_links(&mut |_, _, _| false)); + let Paint::Gradient(lp) = &l else { panic!("a gradient") }; + assert_eq!(lp.gradient.stops[0].plates, Some([0.3, 0.0, 0.0, 0.0])); + // An unlinked stop that still has plates loses them, and that counts as a change. + let mut stale = Gradient::default(); + stale.stops[1].plates = Some([0.0, 0.0, 0.2, 0.0]); + let mut p = Paint::Gradient(Box::new(GradientPaint::new(stale))); + assert!(p.map_links(&mut |_, _, _| false)); + let Paint::Gradient(pp) = &p else { panic!("a gradient") }; + assert!(pp.gradient.stops.iter().all(|s| s.plates.is_none())); + } + #[test] fn lab_colours_serialize_with_their_tag_and_keep_their_model() { let c = Color::lab(52.5, 70.0, -30.0); diff --git a/crates/doc/src/appearance.rs b/crates/doc/src/appearance.rs index ba0f5fc013..3bfba32f6a 100644 --- a/crates/doc/src/appearance.rs +++ b/crates/doc/src/appearance.rs @@ -271,6 +271,16 @@ impl Appearance { _ => None, }) } + /// Does any fill draw: one that is shown, has paint and has an opacity above 0, wherever it + /// sits in the stack? + pub fn has_drawn_fill(&self) -> bool { + self.items.iter().any(|i| matches!(i, AppearanceItem::Fill(f) if f.visible && !f.paint.is_none() && f.opacity > 0.0)) + } + /// Does any stroke draw: one that is shown, has paint, a weight above 0 and an opacity above + /// 0, wherever it sits in the stack? + pub fn has_drawn_stroke(&self) -> bool { + self.painted_strokes().any(|s| s.width > 0.0 && s.opacity > 0.0) + } /// Largest distance the painted area can extend beyond any geometry (see /// [`StrokeLayer::reach`]); paths measure their own with [`Self::stroked_bounds`]. pub fn outset(&self) -> f64 { diff --git a/crates/doc/src/appearance/tests.rs b/crates/doc/src/appearance/tests.rs index 22e5659051..cb5f8fed66 100644 --- a/crates/doc/src/appearance/tests.rs +++ b/crates/doc/src/appearance/tests.rs @@ -79,6 +79,28 @@ fn basic_means_one_plain_fill_and_stroke() { assert!(!e.is_basic(), "an effect"); } +#[test] +fn drawn_fills_and_strokes_count_every_row() { + let fill = |p: Paint| AppearanceItem::Fill(FillLayer::new(p)); + let stroke = |p: Paint, w: f64| AppearanceItem::Stroke(StrokeLayer::new(p, w)); + let black = || Paint::solid(Color::BLACK); + assert!(!Appearance::default().has_drawn_fill() && !Appearance::default().has_drawn_stroke()); + // A painted lower row draws under an unpainted top row. + let a = Appearance { items: vec![fill(black()), stroke(black(), 2.0), fill(Paint::None), stroke(Paint::None, 1.0)], ..Appearance::default() }; + assert!(a.has_drawn_fill() && a.has_drawn_stroke()); + // A hidden painted row, a zero opacity or a zero weight draws nothing. + let mut b = Appearance { items: vec![fill(black()), stroke(black(), 2.0)], ..Appearance::default() }; + b.fill_mut().unwrap().visible = false; + b.stroke_mut().unwrap().visible = false; + assert!(!b.has_drawn_fill() && !b.has_drawn_stroke()); + let mut c = Appearance::default_art(); + c.fill_mut().unwrap().opacity = 0.0; + c.stroke_mut().unwrap().opacity = 0.0; + assert!(!c.has_drawn_fill() && !c.has_drawn_stroke()); + let d = Appearance::basic(Paint::None, black(), 0.0); + assert!(!d.has_drawn_fill() && !d.has_drawn_stroke()); +} + #[test] fn set_creates_missing() { let mut a = Appearance::default(); diff --git a/crates/doc/src/blend.rs b/crates/doc/src/blend.rs index b84de1cac3..f36993a18c 100644 --- a/crates/doc/src/blend.rs +++ b/crates/doc/src/blend.rs @@ -45,7 +45,24 @@ fn lerp_f64(x: f64, y: f64, t: f64) -> f64 { x + (y - x) * t } -/// `like` with every stop painting `c`, linked as the solid is (`swatch` at `tint`). +/// The process plates between two stops linked to one spot swatch: each of C, M, Y and K in turn, +/// a stop without plates counting as none of each. The ends keep their own plates. +fn lerp_plates(a: Option<[f32; 4]>, b: Option<[f32; 4]>, t: f32) -> Option<[f32; 4]> { + if t <= 0.0 { + return a; + } + if t >= 1.0 { + return b; + } + if a.is_none() && b.is_none() { + return None; + } + let (a, b) = (a.unwrap_or_default(), b.unwrap_or_default()); + Some(std::array::from_fn(|i| lerp_f32(a[i], b[i], t))) +} + +/// `like` with every stop painting `c`, linked as the solid is (`swatch` at `tint`), with no +/// process plates (a solid has none). fn solid_gradient(c: Color, swatch: Option<&str>, tint: f32, like: &Gradient) -> Gradient { let mut g = like.clone(); for s in &mut g.stops { @@ -53,16 +70,18 @@ fn solid_gradient(c: Color, swatch: Option<&str>, tint: f32, like: &Gradient) -> s.opacity = 1.0; s.swatch = swatch.map(str::to_string); s.tint = tint; + s.plates = None; } g } -/// The swatch and tint `g` paints at `t`: a stop's own link, or the shared swatch of the two stops -/// around `t` at the tint between theirs (unlinked when they differ), as [`Gradient::sample_with`] walks. -fn link_at(g: &Gradient, t: f32) -> (Option, f32) { +/// The swatch, tint and process plates `g` paints at `t`: a stop's own link, or the shared swatch +/// of the two stops around `t` at the tint and plates between theirs (unlinked when they differ), +/// as [`Gradient::sample_with`] walks. +fn link_at(g: &Gradient, t: f32) -> (Option, f32, Option<[f32; 4]>) { let stops = &g.stops; - let link = |s: &GradientStop| (s.swatch.clone(), s.tint); - let Some(first) = stops.first() else { return (None, 1.0) }; + let link = |s: &GradientStop| (s.swatch.clone(), s.tint, s.plates); + let Some(first) = stops.first() else { return (None, 1.0, None) }; if t <= first.offset { return link(first); } @@ -74,14 +93,14 @@ fn link_at(g: &Gradient, t: f32) -> (Option, f32) { let m = a.midpoint.clamp(0.01, 0.99); let v = if u < m { 0.5 * u / m } else { 0.5 + 0.5 * (u - m) / (1.0 - m) }; return match (&a.swatch, &b.swatch) { - (Some(x), Some(y)) if x == y => (Some(x.clone()), lerp_f32(a.tint, b.tint, v)), _ if v <= 0.0 => link(a), _ if v >= 1.0 => link(b), - _ => (None, 1.0), + (Some(x), Some(y)) if x == y => (Some(x.clone()), lerp_f32(a.tint, b.tint, v), lerp_plates(a.plates, b.plates, v)), + _ => (None, 1.0, None), }; } } - stops.last().map_or((None, 1.0), link) + stops.last().map_or((None, 1.0, None), link) } /// `g` with its stops at `offsets`, each painting what `g` paints there (midpoints centred). @@ -91,8 +110,8 @@ fn resample_stops(g: &Gradient, offsets: &[f32]) -> Gradient { .iter() .map(|&o| { let (color, opacity) = g.sample_keep_model(o); - let (swatch, tint) = link_at(g, o); - GradientStop { opacity, swatch, tint, ..GradientStop::new(o, color) } + let (swatch, tint, plates) = link_at(g, o); + GradientStop { opacity, swatch, tint, plates, ..GradientStop::new(o, color) } }) .collect(); out @@ -139,16 +158,18 @@ fn lerp_gradient(a: &GradientPaint, b: &GradientPaint, t: f32) -> Option (Some(x.clone()), lerp_f32(sa.tint, sb.tint, t)), - _ => (None, 1.0), + // Stops on two tints of one swatch stay linked to it, as solids do (#3234), and keep + // the process plates printed with it. + let (swatch, tint, plates) = match (&sa.swatch, &sb.swatch) { + (Some(x), Some(y)) if x == y => (Some(x.clone()), lerp_f32(sa.tint, sb.tint, t), lerp_plates(sa.plates, sb.plates, t)), + _ => (None, 1.0, None), }; GradientStop { opacity: lerp_f32(sa.opacity, sb.opacity, t), midpoint: lerp_f32(sa.midpoint, sb.midpoint, t), swatch, tint, + plates, ..GradientStop::new(lerp_f32(sa.offset, sb.offset, t), lerp_color(&sa.color, &sb.color, t)) } }) @@ -2462,6 +2483,112 @@ mod tests { assert!(m.gradient.stops.iter().any(|s| s.swatch.is_none()), "{:?}", m.gradient.stops); } + /// A stop linked to the spot swatch "Spot" at `tint`, printed with process `plates`. + fn spot_stop(offset: f32, tint: f32, plates: Option<[f32; 4]>) -> GradientStop { + let mut stop = GradientStop::new(offset, Color::cmyk(1.0, 0.7, 0.0, 0.4).tinted(tint)); + stop.swatch = Some("Spot".into()); + stop.tint = tint; + stop.plates = plates; + stop + } + + fn gradient_paint(stops: Vec) -> Paint { + Paint::Gradient(Box::new(GradientPaint::new(Gradient { stops, ..Gradient::default() }))) + } + + fn assert_plates(got: Option<[f32; 4]>, want: [f32; 4]) { + let got = got.unwrap_or_else(|| panic!("plates {want:?}, not none")); + assert!(got.iter().zip(&want).all(|(g, w)| (g - w).abs() < 1e-5), "{got:?} != {want:?}"); + } + + #[test] + fn blend_gradient_spot_process_plates_interpolate() { + let (p, q) = ([0.2, 0.4, 0.0, 0.0], [0.6, 0.0, 0.8, 1.0]); + let a = gradient_paint(vec![spot_stop(0.0, 0.2, Some(p)), spot_stop(1.0, 0.2, Some(p))]); + let b = gradient_paint(vec![spot_stop(0.0, 1.0, Some(q)), spot_stop(1.0, 1.0, Some(q))]); + let Paint::Gradient(m) = lerp_paint(&a, &b, 0.25) else { panic!() }; + for s in &m.gradient.stops { + assert_eq!(s.swatch.as_deref(), Some("Spot")); + assert!((s.tint - 0.4).abs() < 1e-6, "{}", s.tint); + assert_plates(s.plates, [0.3, 0.3, 0.2, 0.25]); + } + // Without plates on either side the steps print the spot ink alone, as before. + let bare = |tint| gradient_paint(vec![spot_stop(0.0, tint, None), spot_stop(1.0, tint, None)]); + let Paint::Gradient(m) = lerp_paint(&bare(0.2), &bare(1.0), 0.5) else { panic!() }; + assert!(m.gradient.stops.iter().all(|s| s.plates.is_none()), "{:?}", m.gradient.stops); + } + + #[test] + fn resampled_gradient_spot_process_plates_interpolate() { + let (p, q, r) = ([0.0, 0.4, 0.0, 0.0], [0.6, 0.4, 0.3, 0.0], [0.2, 0.2, 0.2, 0.2]); + let mut first = spot_stop(0.0, 0.2, Some(p)); + first.midpoint = 0.25; + let two = Gradient { stops: vec![first, spot_stop(1.0, 0.8, Some(q))], ..Gradient::default() }; + let three = + Gradient { stops: vec![spot_stop(0.0, 1.0, Some(r)), spot_stop(0.5, 1.0, Some(r)), spot_stop(1.0, 1.0, Some(r))], ..Gradient::default() }; + let Some((ra, rb)) = common_stops(&two, &three) else { panic!() }; + let offsets: Vec = ra.stops.iter().map(|s| s.offset).collect(); + assert_eq!(offsets, [0.0, 0.25, 0.5, 1.0]); + // The original stops keep their plates; between them, the midpoint at 0.25 puts 0.5 two + // thirds of the way along the inks. + assert_eq!((ra.stops[0].plates, ra.stops[3].plates), (Some(p), Some(q))); + assert_plates(ra.stops[1].plates, [0.3, 0.4, 0.15, 0.0]); + assert_plates(ra.stops[2].plates, [0.4, 0.4, 0.2, 0.0]); + assert!((ra.stops[2].tint - 0.6).abs() < 1e-5, "{}", ra.stops[2].tint); + assert!(rb.stops.iter().all(|s| s.plates == Some(r)), "{:?}", rb.stops); + + let Paint::Gradient(m) = lerp_paint(&gradient_paint(two.stops), &gradient_paint(three.stops), 0.5) else { panic!() }; + assert_eq!(m.gradient.stops.len(), 4); + assert!(m.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Spot")), "{:?}", m.gradient.stops); + assert_plates(m.gradient.stops[2].plates, [0.3, 0.3, 0.2, 0.1]); + } + + #[test] + fn blend_gradient_missing_plates_mean_zero() { + let p = [0.4, 0.8, 0.0, 0.2]; + let with = gradient_paint(vec![spot_stop(0.0, 1.0, Some(p)), spot_stop(1.0, 1.0, Some(p))]); + let without = gradient_paint(vec![spot_stop(0.0, 1.0, None), spot_stop(1.0, 1.0, None)]); + let Paint::Gradient(m) = lerp_paint(&without, &with, 0.25) else { panic!() }; + assert!(m.gradient.stops.iter().all(|s| s.swatch.as_deref() == Some("Spot")), "{:?}", m.gradient.stops); + m.gradient.stops.iter().for_each(|s| assert_plates(s.plates, [0.1, 0.2, 0.0, 0.05])); + // The ends keep their own plates. + let Paint::Gradient(m) = lerp_paint(&without, &with, 0.0) else { panic!() }; + assert!(m.gradient.stops.iter().all(|s| s.plates.is_none()), "{:?}", m.gradient.stops); + + // Another swatch, or an unlinked stop: process steps with no plates, as before. + let mut other = spot_stop(0.0, 1.0, Some(p)); + other.swatch = Some("Other".into()); + let other = gradient_paint(vec![other.clone(), GradientStop { offset: 1.0, ..other }]); + let mut plain = spot_stop(0.0, 1.0, None); + plain.swatch = None; + let plain = gradient_paint(vec![plain.clone(), GradientStop { offset: 1.0, ..plain }]); + for b in [&other, &plain] { + let Paint::Gradient(m) = lerp_paint(&with, b, 0.5) else { panic!() }; + assert!(m.gradient.stops.iter().all(|s| s.swatch.is_none() && s.plates.is_none()), "{:?}", m.gradient.stops); + } + } + + #[test] + fn blend_solid_to_spot_gradient_does_not_copy_plates() { + let p = [0.4, 0.8, 0.0, 0.2]; + let gradient = gradient_paint(vec![spot_stop(0.0, 1.0, Some(p)), spot_stop(1.0, 1.0, Some(p))]); + let Paint::Gradient(g) = &gradient else { panic!() }; + assert!(solid_gradient(Color::BLACK, Some("Spot"), 0.2, &g.gradient).stops.iter().all(|s| s.plates.is_none())); + let solid = Paint::Solid { color: Color::cmyk(1.0, 0.7, 0.0, 0.4).tinted(0.2), swatch: Some("Spot".into()), tint: 0.2 }; + // The solid's end has no plates: they grow from none toward the gradient's, both ways round. + for (a, b, t) in [(&solid, &gradient, 0.25), (&gradient, &solid, 0.75)] { + let Paint::Gradient(m) = lerp_paint(a, b, t) else { panic!() }; + for s in &m.gradient.stops { + assert_eq!(s.swatch.as_deref(), Some("Spot")); + assert!((s.tint - 0.4).abs() < 1e-6, "{}", s.tint); + assert_plates(s.plates, [0.1, 0.2, 0.0, 0.05]); + } + } + // A process solid unlinks the steps, and they take no plates. + let Paint::Gradient(m) = lerp_paint(&Paint::solid(Color::BLACK), &gradient, 0.5) else { panic!() }; + assert!(m.gradient.stops.iter().all(|s| s.swatch.is_none() && s.plates.is_none()), "{:?}", m.gradient.stops); + } + #[test] fn gradients_with_different_stop_counts_interpolate() { let g = |stops: &[(f32, Color)]| { diff --git a/crates/doc/src/cmyk.rs b/crates/doc/src/cmyk.rs index e89d63cb54..8cd3f85a4f 100644 --- a/crates/doc/src/cmyk.rs +++ b/crates/doc/src/cmyk.rs @@ -386,6 +386,21 @@ impl ImageBlob { if bytes.starts_with(&[0xFF, 0xD8]) { jpeg_inks(bytes) } else { tiff_inks(bytes) } } + /// The CMYK ICC profile a CMYK image carries: a four-component JPEG's `ICC_PROFILE` APP2 + /// segments put together, or a CMYK TIFF's tag 34675. `None` for other images, and for a + /// profile that isn't one of CMYK colors. Reads only the file's headers and tags. + pub fn cmyk_icc_profile(&self) -> Option> { + let bytes = self.bytes.as_slice(); + if jpeg_components(bytes) == Some(4) { + return cmyk_icc(jpeg_icc(bytes)); + } + let (kind, mut d) = tiff(bytes)?; + if !matches!(kind, tiff::ColorType::CMYK(8 | 16)) { + return None; + } + cmyk_icc(tiff_icc(&mut d)) + } + /// The ink amounts around pixel (`x`, `y`) of a CMYK image, in the pixel space of an image /// object of `object` (width, height) pixels: the average of the `size` × `size` pixels centered /// on it, clipped to the image, as C, M, Y and K bytes. `None` outside the image and for images @@ -515,9 +530,10 @@ pub fn turned_cmyk(bytes: &[u8], orientation: image::metadata::Orientation, ppi: /// all, as RGBA pixels: CMYK with an alpha channel (5 samples), each colour converted by `rgb` (ink /// amounts 0..1 → sRGB 0..1; the inks can't be kept with the transparency, so they show as RGB), /// and grayscale with extra samples, of which the first is the alpha when the file says so (other -/// channels are left out). Associated (premultiplied) alpha is divided back out. The samples may be -/// stored together or one plane per channel. `None` for other images and ones larger than -/// [`MAX_CMYK_PIXELS`]. +/// channels are left out). Associated (premultiplied) alpha is divided back out, and a pixel with +/// no associated alpha has no color. 16-bit samples are converted at 16 bits, and only the result +/// is rounded to 8 bits. The samples may be stored together or one plane per channel. `None` for +/// other images and ones larger than [`MAX_CMYK_PIXELS`]. pub fn extra_samples_tiff_rgba(bytes: &[u8], rgb: impl Fn([f32; 4]) -> [f32; 3]) -> Option { use tiff::tags::Tag; let (kind, mut d) = tiff(bytes)?; @@ -535,20 +551,33 @@ pub fn extra_samples_tiff_rgba(bytes: &[u8], rgb: impl Fn([f32; 4]) -> [f32; 3]) _ => return None, }; let n = usize::try_from(pixels(w, h)?).ok()?; - let data = read_samples(&mut d, n, samples)?; - let mut out = Vec::with_capacity(n * 4); - for p in data.chunks_exact(samples) { - let opacity = if alpha { p.get(colour).copied().unwrap_or(u8::MAX) } else { u8::MAX }; - let a = f32::from(opacity) / 255.0; - let level = |v: u8| { - let v = f32::from(v) / 255.0; - if extra == Some(1) && a > 0.0 { (v / a).min(1.0) } else { v } + let data = read_samples_at_depth(&mut d, n, samples)?; + // Sample `i` of the image, 0..1. + let level_at = |i: usize| match &data { + Samples::Eight(v) => v.get(i).map(|&s| f32::from(s) / 255.0), + Samples::Sixteen(v) => v.get(i).map(|&s| f32::from(s) / 65535.0), + }; + // Sample `i` of the image as 8 bits, a 16-bit sample rounded to the nearest. + let byte_at = |i: usize| match &data { + Samples::Eight(v) => v.get(i).copied(), + Samples::Sixteen(v) => v.get(i).map(|&s| u8::try_from((u32::from(s) + 128) / 257).unwrap_or(u8::MAX)), + }; + let mut out = Vec::with_capacity(n.checked_mul(4)?); + for first in (0..n).map(|p| p * samples) { + let (opacity, a) = if alpha { (byte_at(first + colour).unwrap_or(u8::MAX), level_at(first + colour).unwrap_or(1.0)) } else { (u8::MAX, 1.0) }; + let level = |s: usize| { + let v = level_at(first + s).unwrap_or(0.0); + match extra { + Some(1) if a > 0.0 => (v / a).min(1.0), + // No associated alpha: the color is zero (TIFF 6.0, Associated Alpha Handling). + Some(1) if alpha => 0.0, + _ => v, + } }; - let [r, g, b] = match *p { - [c, m, y, k, ..] if colour == 4 => rgb([level(c), level(m), level(y), level(k)]), - [v, ..] if photometric == Some(0) => [1.0 - level(v); 3], - [v, ..] => [level(v); 3], - [] => continue, + let [r, g, b] = match colour { + 4 => rgb([level(0), level(1), level(2), level(3)]), + _ if photometric == Some(0) => [1.0 - level(0); 3], + _ => [level(0); 3], }; out.extend([r, g, b].map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8)); out.push(opacity); @@ -767,6 +796,85 @@ mod tests { assert_eq!(gray(0), [255, 255, 255, 255, 51, 51, 51, 255, 0, 0, 0, 255], "a channel that isn't alpha: opaque"); } + /// Five 16-bit samples a pixel: the four inks and one extra sample, which the file's + /// `ExtraSamples` names. + struct Cmyka16; + impl tiff::encoder::colortype::ColorType for Cmyka16 { + type Inner = u16; + const TIFF_VALUE: tiff::tags::PhotometricInterpretation = tiff::tags::PhotometricInterpretation::CMYK; + const BITS_PER_SAMPLE: &'static [u16] = &[16; 5]; + const SAMPLE_FORMAT: &'static [tiff::tags::SampleFormat] = &[tiff::tags::SampleFormat::Uint; 5]; + fn horizontal_predict(row: &[u16], result: &mut Vec) { + result.extend_from_slice(row); + } + } + + /// Two 16-bit samples a pixel: gray and one extra sample. + struct GrayExtra16; + impl tiff::encoder::colortype::ColorType for GrayExtra16 { + type Inner = u16; + const TIFF_VALUE: tiff::tags::PhotometricInterpretation = tiff::tags::PhotometricInterpretation::BlackIsZero; + const BITS_PER_SAMPLE: &'static [u16] = &[16, 16]; + const SAMPLE_FORMAT: &'static [tiff::tags::SampleFormat] = &[tiff::tags::SampleFormat::Uint; 2]; + fn horizontal_predict(row: &[u16], result: &mut Vec) { + result.extend_from_slice(row); + } + } + + /// A one-row TIFF of `C`'s pixels `data`, with the ExtraSamples value `extra`. + fn extra_tiff>(extra: u16, data: &[u16]) -> Vec { + let samples = C::BITS_PER_SAMPLE.len(); + let mut file = Cursor::new(Vec::new()); + let mut enc = tiff::encoder::TiffEncoder::new(&mut file).unwrap(); + let mut img = enc.new_image::(u32::try_from(data.len() / samples).unwrap(), 1).unwrap(); + img.encoder().write_tag(tiff::tags::Tag::ExtraSamples, &[extra][..]).unwrap(); + img.write_data(data).unwrap(); + file.into_inner() + } + + /// 16-bit CMYK with alpha converts its 16-bit inks and alpha, and rounds only the result to 8 + /// bits; the high byte of each sample alone would give other pixels. + #[test] + fn a_16_bit_cmyk_tiff_with_alpha_converts_at_16_bits() { + let naive = |[c, m, y, k]: [f32; 4]| [(1.0 - c) * (1.0 - k), (1.0 - m) * (1.0 - k), (1.0 - y) * (1.0 - k)]; + let read = |extra: u16, data: &[u16]| extra_samples_tiff_rgba(&extra_tiff::(extra, data), naive).expect("CMYKA reads").into_raw(); + // Unassociated: 129 of cyan, opaque; no ink at an alpha of 129; no ink at an alpha of 386. + let straight = [129, 0, 0, 0, 65535, 0, 0, 0, 0, 129, 0, 0, 0, 0, 386]; + assert_eq!(read(2, &straight), [254, 255, 255, 255, 255, 255, 255, 1, 255, 255, 255, 2]); + // Associated: cyan 128 at an alpha of 256 (half cyan); K 255 at an alpha of 511 (about half K). + let premultiplied = [128, 0, 0, 0, 256, 0, 0, 0, 255, 511]; + assert_eq!(read(1, &premultiplied), [128, 255, 255, 1, 128, 128, 128, 2], "divided by the 16-bit alpha"); + } + + /// 16-bit gray with alpha converts at 16 bits as well. + #[test] + fn a_16_bit_grayscale_tiff_with_alpha_converts_at_16_bits() { + let read = |extra: u16| { + // A gray of 129, opaque, then 128 at an alpha of 256. + let bytes = extra_tiff::(extra, &[129, 65535, 128, 256]); + extra_samples_tiff_rgba(&bytes, |_| [0.0; 3]).expect("gray with alpha reads").into_raw() + }; + assert_eq!(read(2), [1, 1, 1, 255, 0, 0, 0, 1], "unassociated"); + assert_eq!(read(1), [1, 1, 1, 255, 128, 128, 128, 1], "associated, divided by the 16-bit alpha"); + } + + /// With associated alpha, a pixel whose alpha is zero has no color (TIFF 6.0, Associated + /// Alpha Handling), whatever its color samples hold. + #[test] + fn a_pixel_with_no_associated_alpha_has_no_color() { + use tiff::encoder::{TiffEncoder, colortype::CMYKA8}; + let naive = |[c, m, y, k]: [f32; 4]| [(1.0 - c) * (1.0 - k), (1.0 - m) * (1.0 - k), (1.0 - y) * (1.0 - k)]; + let mut file = Cursor::new(Vec::new()); + let mut enc = TiffEncoder::new(&mut file).unwrap(); + let mut img = enc.new_image::(1, 1).unwrap(); + img.encoder().write_tag(tiff::tags::Tag::ExtraSamples, &[1u16][..]).unwrap(); + img.write_data(&[255, 0, 0, 0, 0]).unwrap(); + let cmyk = extra_samples_tiff_rgba(&file.into_inner(), naive).expect("CMYKA reads"); + assert_eq!(cmyk.into_raw(), [255, 255, 255, 0], "no ink"); + let gray = extra_samples_tiff_rgba(&extra_tiff::(1, &[50_000, 0]), |_| [0.0; 3]).expect("gray reads"); + assert_eq!(gray.into_raw(), [0, 0, 0, 0], "a gray of zero"); + } + /// A header claiming more tiles than can be counted: (2^32 − 1)² pixels in tiles of one pixel, /// times 2 planes. #[test] diff --git a/crates/doc/src/dimension.rs b/crates/doc/src/dimension.rs index 89df899743..e803d867fc 100644 --- a/crates/doc/src/dimension.rs +++ b/crates/doc/src/dimension.rs @@ -815,6 +815,10 @@ impl Dimension { if self.line_between_points() && !old.line_between_points() { self.keep_gap(&old); } + } else if self.mode == DimensionMode::Linear && xf.determinant() < 0.0 && (self.b - self.a).hypot() > 1e-9 { + // A reflection turns the left normal of a → b to the other side, so an aligned + // dimension's line stays on the reflected side of its points. + self.offset = -self.offset; } if self.mode == DimensionMode::Linear { self.length = self.measured(); diff --git a/crates/doc/src/document.rs b/crates/doc/src/document.rs index 418e454b92..54130788e1 100644 --- a/crates/doc/src/document.rs +++ b/crates/doc/src/document.rs @@ -79,6 +79,7 @@ impl Document { index: _, guide_cache: _, inline_cycles: _, + mounted_art: _, } = self; *version == other.version && *title == other.title @@ -264,6 +265,7 @@ impl Document { index: Default::default(), guide_cache: Default::default(), inline_cycles: Default::default(), + mounted_art: vec![], }; let id = d.alloc_id(); d.layers.push(Arc::new(Node::layer(id, "Layer 1", LayerColor::Preset(0)))); diff --git a/crates/doc/src/document_ext.rs b/crates/doc/src/document_ext.rs index 0f1ec463c4..c29e8464ea 100644 --- a/crates/doc/src/document_ext.rs +++ b/crates/doc/src/document_ext.rs @@ -128,8 +128,8 @@ impl Document { } /// The roots of every tree of the document's art: the layers, symbol definitions, graph designs, - /// pattern swatches and the original of the pattern being edited. Opacity masks hang off nodes - /// in these trees. + /// pattern swatches, the original of the pattern being edited and [`Self::mounted_art`]. + /// Opacity masks hang off nodes in these trees. pub fn art_roots(&self) -> impl Iterator> { self.layers .iter() @@ -137,6 +137,7 @@ impl Document { .chain(self.graph_designs.iter().map(|g| &g.art)) .chain(self.patterns.iter().flat_map(|p| p.art.iter())) .chain(self.pattern_edit.iter().filter_map(|pe| pe.original.as_ref()).flat_map(|p| p.art.iter())) + .chain(self.mounted_art.iter().map(|(n, _)| n)) } /// [`Self::art_roots`], to change. @@ -147,6 +148,7 @@ impl Document { .chain(self.graph_designs.iter_mut().map(|g| &mut g.art)) .chain(self.patterns.iter_mut().flat_map(|p| p.art.iter_mut())) .chain(self.pattern_edit.iter_mut().filter_map(|pe| pe.original.as_mut()).flat_map(|p| p.art.iter_mut())) + .chain(self.mounted_art.iter_mut().map(|(n, _)| n)) } /// Does `wants` hold for a node anywhere in the document's art ([`Self::art_roots`]) or its diff --git a/crates/doc/src/document_guides.rs b/crates/doc/src/document_guides.rs index df336fe09e..ba6e4dc428 100644 --- a/crates/doc/src/document_guides.rs +++ b/crates/doc/src/document_guides.rs @@ -1,6 +1,7 @@ use super::document_ext::free_id; use super::guides::Guide; use super::limits::MAX_NEXT_ID; +use super::node::{held_guides, map_held, strip_held}; use super::{Affine, Arc, Document, Node, NodeId, NodeKind, PatternDef, Point, Rect, Selection, SymbolBoxes, Vec2, artboard_holds}; use std::collections::{BTreeMap, HashSet}; @@ -272,8 +273,8 @@ impl Document { return; } for l in &mut self.layers { - if let Some(held) = picked_in_layers(l, &Node::is_ruler_guide) { - drop_picked(l, held); + if let Some(held) = held_guides(l, &Node::is_ruler_guide) { + strip_held(Arc::make_mut(l), held); } } self.saved_guides.extend(guides); @@ -347,14 +348,14 @@ impl Document { /// saved guide whose layer is gone opens. Returns the removed node, without the guides. pub fn remove_edit_layer(&mut self, id: NodeId) -> Result, crate::DocError> { let mut layer = self.remove(id)?; - let Some(held) = picked_in_layers(&layer, &Node::is_ruler_guide) else { return Ok(layer) }; + let Some(held) = held_guides(&layer, &Node::is_ruler_guide) else { return Ok(layer) }; let mut guides = vec![]; layer.walk(&mut |c| { if c.is_ruler_guide() { guides.push(Arc::new(c.clone())); } }); - drop_picked(&mut layer, held); + strip_held(Arc::make_mut(&mut layer), held); let home = self.default_layer().unwrap_or_else(|| self.add_layer(None)); self.children_mut(Some(home))?.extend(guides); Ok(layer) @@ -418,8 +419,8 @@ impl Document { } let pick = |n: &Node| n.is_ruler_guide() && gone.contains(&n.id); for l in &mut self.layers { - if let Some(held) = picked_in_layers(l, &pick) { - drop_picked(l, held); + if let Some(held) = held_guides(l, &pick) { + strip_held(Arc::make_mut(l), held); } } sel.guides.retain(|id| !gone.contains(id)); @@ -434,8 +435,8 @@ impl Document { fn edit_artboard_guides(&mut self, id: u32, f: &mut impl FnMut(bool, &mut f64)) { let pick = |n: &Node| matches!(n.kind, NodeKind::RulerGuide { artboard: Some(a), .. } if a == id); for l in &mut self.layers { - if let Some(held) = picked_in_layers(l, &pick) { - edit_picked(l, held, f); + if let Some(held) = held_guides(l, &pick) { + map_held(Arc::make_mut(l), held, f); } } } @@ -569,57 +570,6 @@ impl Picked { } } -/// The children of `n`, if it is a layer, that `pick` picks (with nothing inside), and its -/// sublayers holding one (with what they hold), or `None` when it holds none. `pick` looks at -/// each child of the layers once. -fn picked_in_layers(n: &Node, pick: &impl Fn(&Node) -> bool) -> Option { - if !n.is_layer() { - return None; - } - let children = n - .children() - .into_iter() - .flatten() - .enumerate() - .filter_map(|(i, c)| if pick(c) { Some((i, Picked::default())) } else { picked_in_layers(c, pick).map(|p| (i, p)) }) - .collect(); - Picked { children, mask: None }.some() -} - -/// Remove the children of `layer` and of its sublayers that [`picked_in_layers`] picked (`held`). -/// Only the layers holding one are copied, and only those are visited. -fn drop_picked(layer: &mut Arc, held: Picked) { - let Some(ch) = Arc::make_mut(layer).children_mut() else { return }; - let mut held = held.children.into_iter().peekable(); - let mut next = 0; - ch.retain_mut(|c| { - let at = next; - next += 1; - let Some((_, inner)) = held.next_if(|(i, _)| *i == at) else { return true }; - // A sublayer holds something; a child picked itself has nothing inside. - if inner.is_empty() { - return false; - } - drop_picked(c, inner); - true - }); -} - -/// Change with `f` (whether it is vertical, its position) the line of each ruler guide of `layer` -/// and of its sublayers that [`picked_in_layers`] picked (`held`), in the order they lie in. Only -/// the layers holding one, and the guides, are copied, and only those layers are visited. -fn edit_picked(layer: &mut Arc, held: Picked, f: &mut impl FnMut(bool, &mut f64)) { - let Some(ch) = Arc::make_mut(layer).children_mut() else { return }; - for (i, inner) in held.children { - let Some(c) = ch.get_mut(i) else { continue }; - if !inner.is_empty() { - edit_picked(c, inner, f); - } else if let NodeKind::RulerGuide { vertical, pos, .. } = &mut Arc::make_mut(c).kind { - f(*vertical, pos); - } - } -} - /// `n` picked itself when it is a ruler guide by `is_guide`, else the ruler guides below it /// ([`guides_below`]). fn guide_or_below(n: &Node, is_guide: &impl Fn(&Node) -> bool) -> Option { @@ -872,9 +822,9 @@ mod tests { looked.set(looked.get() + 1); on_artboard_7(n) }; - let held = picked_in_layers(&d.layers[0], &pick).unwrap(); + let held = held_guides(&d.layers[0], &pick).unwrap(); assert_eq!(looked.get(), NESTED_CHILDREN, "each child of the layers is looked at once"); - drop_picked(&mut d.layers[0], held); + strip_held(Arc::make_mut(&mut d.layers[0]), held); assert_eq!(looked.get(), NESTED_CHILDREN, "removing looks at nothing again"); assert!(d.layers[0].children().is_some_and(|c| Arc::ptr_eq(&c[1], &still)), "a sublayer with nothing to remove is not copied"); @@ -932,10 +882,10 @@ mod tests { looked.set(looked.get() + 1); on_artboard_7(n) }; - let held = picked_in_layers(&d.layers[0], &pick).unwrap(); + let held = held_guides(&d.layers[0], &pick).unwrap(); assert_eq!(looked.get(), NESTED_CHILDREN, "each child of the layers is looked at once"); let mut seen = vec![]; - edit_picked(&mut d.layers[0], held, &mut |vertical, pos: &mut f64| { + map_held(Arc::make_mut(&mut d.layers[0]), held, &mut |vertical, pos: &mut f64| { seen.push((vertical, *pos)); *pos += 9.0; }); diff --git a/crates/doc/src/graph.rs b/crates/doc/src/graph.rs index 43074a4e80..d561663524 100644 --- a/crates/doc/src/graph.rs +++ b/crates/doc/src/graph.rs @@ -363,6 +363,14 @@ pub struct SeriesPaint { /// Object blend mode of each path directly in the series group, as [`Self::opacity`]. Absent: Normal. #[serde(skip_serializing_if = "Option::is_none")] pub blend: Option, + /// A gradient in [`Self::fill`] is placed relative to the unit box (0, 0)–(1, 1), and each mark takes it on its own + /// geometric bounds. False: the gradient is in document coordinates, and every mark takes it unchanged. + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub fill_unit_box: bool, + /// A gradient in [`Self::stroke`] is placed relative to the unit box, as [`Self::fill_unit_box`], and each mark takes + /// it on its stroke's box (the geometric bounds grown by half the weight). + #[serde(skip_serializing_if = "std::ops::Not::not")] + pub stroke_unit_box: bool, } /// The object rows one kind of graph label keeps ([`LabelStyles::values_rows`]): the paint, weight, opacity and blend mode diff --git a/crates/doc/src/inks.rs b/crates/doc/src/inks.rs index e10c424ee9..a9fa5f3f80 100644 --- a/crates/doc/src/inks.rs +++ b/crates/doc/src/inks.rs @@ -94,25 +94,45 @@ pub fn inks(doc: &Document, c: &Cms, color: &Color, link: Link, intent: Intent) Inks { cmyk: c.to_cmyk(color, intent), spot: None, registration: false } } -/// Visits one colour: the colour, its swatch link and its tint, all of which it may change. -pub type ColorVisitor<'a> = dyn FnMut(&mut Color, &mut Option, &mut f32) + 'a; +/// Process plates a colour prints together with its spot tint (C, M, Y, K, 0..1): a gradient +/// stop's [`vectorcraft_color::GradientStop::plates`]; `None` for every other colour. +pub type StopPlates = Option<[f32; 4]>; + +/// [`inks`] of a colour that may print process plates `plates` with its spot tint. The plates +/// print only beside a spot ink: a colour without a valid spot link, or linked to Registration, +/// prints as [`inks`] separates it. A plate amount that is not a finite number prints no ink. +pub fn stop_inks(doc: &Document, c: &Cms, color: &Color, link: Link, plates: StopPlates, intent: Intent) -> Inks { + let mut ink = inks(doc, c, color, link, intent); + if let (Some(p), Some(_)) = (plates, &ink.spot) { + ink.cmyk = p.map(|v| if v.is_finite() { v.clamp(0.0, 1.0) } else { 0.0 }); + } + ink +} + +/// Visits one colour: the colour, its swatch link, its tint and its process plates +/// ([`StopPlates`]), all of which it may change. +pub type ColorVisitor<'a> = dyn FnMut(&mut Color, &mut Option, &mut f32, &mut StopPlates) + 'a; fn visit_paint(p: &mut Paint, f: &mut ColorVisitor) { match p { - Paint::Solid { color, swatch, tint } => f(color, swatch, tint), + Paint::Solid { color, swatch, tint } => f(color, swatch, tint, &mut None), Paint::Gradient(g) => { for s in &mut g.gradient.stops { - f(&mut s.color, &mut s.swatch, &mut s.tint); + f(&mut s.color, &mut s.swatch, &mut s.tint, &mut s.plates); + } + for p in g.freeform.iter_mut().flat_map(|ff| ff.points.iter_mut()) { + f(&mut p.color, &mut None, &mut 1.0, &mut None); } } _ => {} } } -/// Visit every colour of a node tree (fills, strokes, gradient stops, text runs, mesh points, an -/// image's colorize color, the fills and strokes a dynamic symbol instance keeps for objects of its -/// art, not opacity masks) with its swatch link and tint. Mesh points have no link: changes to it -/// are dropped. +/// Visit every colour of a node tree (fills, strokes, gradient stops, a freeform gradient's +/// points, text runs, mesh points, an image's colorize color, the fills and strokes a dynamic +/// symbol instance keeps for objects of its art, not opacity masks) with its swatch link, tint and +/// process plates. Freeform and mesh points have no link or plates: a link or plates `f` gives +/// them are dropped. pub fn visit_node_colors(n: &mut Node, f: &mut ColorVisitor) { for it in &mut n.appearance.items { match it { @@ -137,7 +157,7 @@ pub fn visit_node_colors(n: &mut Node, f: &mut ColorVisitor) { } NodeKind::Mesh(m) => { for p in &mut m.points { - f(&mut p.color, &mut None, &mut 1.0); + f(&mut p.color, &mut None, &mut 1.0, &mut None); } } _ => {} @@ -149,11 +169,16 @@ pub fn visit_node_colors(n: &mut Node, f: &mut ColorVisitor) { } } -/// Apply `f` to every colour of a node tree (fills, strokes, gradient stops, text runs, mesh -/// points, a dynamic symbol instance's own fills and strokes) given its swatch link and tint, -/// keeping the links. +/// Apply `f` to every colour of a node tree (fills, strokes, gradient stops, a freeform +/// gradient's points, text runs, mesh points, a dynamic symbol instance's own fills and strokes) +/// given its swatch link and tint, keeping the links and process plates. pub fn map_node_colors(n: &mut Node, f: &mut dyn FnMut(&Color, Link) -> Color) { - visit_node_colors(n, &mut |c, swatch, tint| *c = f(c, swatch.as_deref().map(|s| (s, *tint)))); + map_node_inks(n, &mut |c, link, _| f(c, link)); +} + +/// [`map_node_colors`], with each colour's process plates ([`StopPlates`]) passed to `f` too. +pub fn map_node_inks(n: &mut Node, f: &mut dyn FnMut(&Color, Link, StopPlates) -> Color) { + visit_node_colors(n, &mut |c, swatch, tint, plates| *c = f(c, swatch.as_deref().map(|s| (s, *tint)), *plates)); } /// Apply `f` to every colour in the document's art and symbol definitions. @@ -170,8 +195,70 @@ pub fn map_document_colors(doc: &mut Document, f: &mut dyn FnMut(&Color, Link) - mod tests { use super::*; use crate::{NodeId, SymbolOverride}; + use vectorcraft_color::{Freeform, FreeformPoint, Gradient, GradientKind, GradientPaint, GradientStop, Swatch}; use vectorcraft_geom::Affine; + /// A document with spot swatch `Gold` and process swatch `Teal`. + fn gold_doc() -> Document { + let mut d = Document::new(100.0, 100.0); + d.swatches.push(Swatch { name: "Gold".into(), paint: Paint::solid(Color::cmyk(0.0, 0.2, 0.8, 0.1)), global: true, spot: true }); + d.swatches.push(Swatch { name: "Teal".into(), paint: Paint::solid(Color::cmyk(0.8, 0.0, 0.3, 0.0)), global: true, spot: false }); + d + } + + #[test] + fn a_spot_stops_process_plates_print_with_its_tint() { + let d = gold_doc(); + let c = vectorcraft_color::cms::active(); + let look = Color::cmyk(0.25, 0.1, 0.8, 0.05); + let ink = |link: Link, plates: StopPlates| stop_inks(&d, &c, &look, link, plates, Intent::RelativeColorimetric); + let mixed = ink(Some(("Gold", 0.5)), Some([0.25, 0.0, 0.4, 0.0])); + assert_eq!(mixed, Inks { cmyk: [0.25, 0.0, 0.4, 0.0], spot: Some(("Gold".into(), 0.5)), registration: false }); + assert_eq!((mixed.on_plate("Cyan"), mixed.on_plate("Gold")), (0.25, 0.5)); + // Amounts outside 0..1 are clamped; one that is not a number prints no ink. + let odd = ink(Some(("Gold", 1.0)), Some([f32::NAN, 2.0, -1.0, f32::INFINITY])); + assert_eq!(odd.cmyk, [0.0, 1.0, 0.0, 0.0]); + // Without plates the spot ink prints alone, as `inks` separates it. + assert_eq!(ink(Some(("Gold", 0.5)), None), inks(&d, &c, &look, Some(("Gold", 0.5)), Intent::RelativeColorimetric)); + // Plates beside no spot ink print nothing of their own: a process swatch, an unknown + // swatch, no link and Registration separate as `inks` does. + for link in [Some(("Teal", 1.0)), Some(("Missing", 1.0)), None, Some((REGISTRATION, 0.5))] { + assert_eq!(ink(link, Some([0.25, 0.0, 0.4, 0.0])), inks(&d, &c, &look, link, Intent::RelativeColorimetric), "{link:?}"); + } + } + + #[test] + fn gradient_stops_pass_their_plates_and_freeform_points_are_visited() { + let mut stop = GradientStop::new(0.0, Color::cmyk(0.25, 0.1, 0.8, 0.05)); + (stop.swatch, stop.tint, stop.plates) = (Some("Gold".into()), 0.5, Some([0.25, 0.0, 0.4, 0.0])); + let mut g = GradientPaint::new(Gradient::new(GradientKind::Linear, vec![stop, GradientStop::new(1.0, Color::rgb(1.0, 1.0, 1.0))])); + let point = FreeformPoint::new(kurbo::Point::new(10.0, 10.0), Color::rgb(0.0, 1.0, 0.0)); + g.freeform = Some(Freeform { points: vec![point], ..Default::default() }); + let mut n = Node::path( + NodeId(1), + vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(0.0, 0.0, 10.0, 10.0)), + crate::Appearance::basic(Paint::Gradient(Box::new(g)), Paint::None, 0.0), + ); + let mut seen = vec![]; + let gray = Color::Gray { k: 0.5 }; + map_node_inks(&mut n, &mut |c, link, plates| { + seen.push((*c, link.map(|(s, t)| (s.to_string(), t)), plates)); + gray + }); + assert_eq!( + seen, + vec![ + (Color::cmyk(0.25, 0.1, 0.8, 0.05), Some(("Gold".to_string(), 0.5)), Some([0.25, 0.0, 0.4, 0.0])), + (Color::rgb(1.0, 1.0, 1.0), None, None), + (Color::rgb(0.0, 1.0, 0.0), None, None), + ] + ); + let Some(Paint::Gradient(g)) = n.appearance.fill().map(|f| f.paint.clone()) else { panic!("no gradient fill") }; + assert_eq!(g.gradient.stops[0].plates, Some([0.25, 0.0, 0.4, 0.0]), "mapping a colour keeps its plates"); + assert!(g.gradient.stops.iter().all(|s| s.color == gray)); + assert_eq!(g.freeform.map(|f| f.points[0].color), Some(gray), "the freeform point is mapped too"); + } + #[test] fn a_dynamic_instances_own_fills_and_strokes_are_visited() { let red = Color::rgb(1.0, 0.0, 0.0); diff --git a/crates/doc/src/inline.rs b/crates/doc/src/inline.rs index a8e3955015..86c26e14f4 100644 --- a/crates/doc/src/inline.rs +++ b/crates/doc/src/inline.rs @@ -8,13 +8,20 @@ use std::sync::{Arc, RwLock, Weak}; use vectorcraft_geom::{Affine, Rect}; -use crate::{Document, Node, NodeId, NodeKind, Symbol, TextObject}; +use crate::symbols::SymbolNames; +use crate::{Document, Node, NodeId, NodeKind, Symbol, SymbolBoxes, TextObject}; /// The document key under which the app records each symbol's natural size (`{name: [w, h]}`). pub const SYMBOL_SIZES: &str = "symbolSizes"; /// Half the side of the square symbol art is normalised to. pub const SYMBOL_HALF: f64 = 10.0; +/// The box symbol art `art` is measured by in [`Document::symbol_art_bounds`]: its visual bounds, +/// or its geometric bounds when it has no visual bounds. +fn art_extent(art: &Node, boxes: &SymbolBoxes) -> Option { + art.visual_bounds_with(boxes).or_else(|| art.geometric_bounds_with(boxes)) +} + /// Usable art bounds: finite, non-degenerate. fn usable(r: Option) -> Option { r.filter(|r| [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()) && r.width() >= 0.0 && r.height() > 1e-9) @@ -35,27 +42,38 @@ impl Document { } /// Visual bounds of the art of the symbol named `name` at its natural size (see - /// [`Self::symbol_natural_xf`]), if it exists and has a usable extent. + /// [`Self::symbol_natural_xf`]), if it exists and has a usable extent. The symbol instances in + /// the art are measured by their own symbols' art ([`Node::visual_bounds_with`]), or by the + /// 20 × 20 square where [`crate::SymbolBoxes`] measures them by it. pub fn symbol_art_bounds(&self, name: &str) -> Option { - let s = self.symbols.iter().find(|s| s.name == name)?; - let b = usable(s.art.visual_bounds().or_else(|| s.art.geometric_bounds()))?; + self.symbol_art_bounds_in(name, &self.symbol_boxes()) + } + + /// [`Self::symbol_art_bounds`], with the symbols found and the instances measured by `boxes` + /// (new boxes of this document). + fn symbol_art_bounds_in(&self, name: &str, boxes: &SymbolBoxes) -> Option { + let b = usable(art_extent(boxes.symbol_art(name)?, boxes))?; usable(Some(self.symbol_natural_xf(name).transform_rect_bbox(b))) } /// The art bounds an inline graphic of the symbol named `name` takes: [`Self::symbol_art_bounds`], /// or `None` (an empty slot) when the symbol's art shows the symbol itself inline, directly or - /// through the inline graphics in other symbols' art, so that its size would depend on itself. + /// through the inline graphics and symbol instances in other symbols' art, so that its size + /// would depend on itself. pub fn inline_art_bounds(&self, name: &str) -> Option { - if self.inline_cycles().contains(name) { None } else { self.symbol_art_bounds(name) } + let (cyclic, names) = self.inline_cycles(); + if cyclic.contains(name) { None } else { self.symbol_art_bounds_in(name, &self.symbol_boxes().with_names(&names)) } } - /// The names of the symbols that reach themselves through the inline graphics in symbol art, - /// found once while the symbols stay as they are. - fn inline_cycles(&self) -> Arc> { + /// The names of the symbols that reach themselves through the inline graphics in symbol art + /// ([`InlineGraph`]), with each symbol name → the index of the first symbol of that name, found + /// once while the symbols stay as they are. + fn inline_cycles(&self) -> (Arc>, Arc) { if let Some(found) = self.inline_cycles.get(&self.symbols) { return found; } - let found = Arc::new(InlineGraph::of(self).cyclic); + let graph = InlineGraph::of(self); + let found = (Arc::new(graph.cyclic), graph.names); self.inline_cycles.set(&self.symbols, &found); found } @@ -94,7 +112,8 @@ impl Document { /// of symbols, graph designs and pattern tiles, and the opacity masks and live objects in /// them. Each text whose inline graphics changed has its cached layout cleared and is passed /// to `layout` to be laid out again. The symbols are resolved first, each after the symbols its - /// inline graphics show, so a symbol's art is measured with its type already laid out; a + /// inline graphics and symbol instances show, so a symbol's art is measured with its type, and + /// the type in the art of the symbols its instances show, already laid out; a /// symbol that shows itself inline ([`Self::inline_art_bounds`]) is shown as an empty slot. /// Returns the ids of the texts in the layers that changed. pub fn resolve_inline_art_with(&mut self, layout: &mut dyn FnMut(&mut TextObject)) -> Vec { @@ -241,34 +260,48 @@ fn inline_symbols(n: &Node) -> Vec { out } -/// Each symbol name of `d` → the index of the first symbol of that name (the one a name finds). -fn symbol_index(d: &Document) -> HashMap<&str, usize> { - let mut index = HashMap::with_capacity(d.symbols.len()); - for (i, s) in d.symbols.iter().enumerate() { - index.entry(s.name.as_str()).or_insert(i); - } - index -} - -/// The symbols of a document as their inline graphics depend on each other. +/// The symbols of a document as their sizes depend on each other: a symbol's art depends on the +/// symbols its type shows inline, and on the symbols its instances show when those instances are +/// measured by their symbols' art ([`crate::SymbolBoxes`]). struct InlineGraph { - /// Every symbol index, each after the symbols its art shows inline (except along a cycle). + /// Every symbol index, each after the symbols its art depends on (except along a cycle). order: Vec, - /// The names of the symbols that reach themselves through inline graphics. + /// The names of the symbols that reach themselves through inline graphics. Instances alone make + /// no cycle: an instance of a symbol that holds an instance of itself is measured by the + /// 20 × 20 square, so every cycle passes through an inline graphic. cyclic: HashSet, + /// Each symbol name → the index of the first symbol of that name, which stay the same while + /// [`Document::resolve_inline_art_with`] changes the symbols' art. + names: Arc, } impl InlineGraph { - /// The graph of `d`'s symbols: each symbol's art is walked once, and the order and cycles are - /// found in time linear in the symbols and their inline references (Tarjan's strongly - /// connected components, without recursion). + /// The graph of `d`'s symbols: each symbol's art is walked once, and, when the art of any + /// symbol holds an inline graphic, measured once with the art boxes of the symbols its + /// instances show measured once in all ([`SymbolBoxes::consulted`]: an instance that does not + /// size the art, such as one a clipping path hides, adds nothing). The order and cycles are + /// found in time linear in the symbols and their inline references and instances (Tarjan's + /// strongly connected components, without recursion). fn of(d: &Document) -> Self { - let index = symbol_index(d); + let names = Arc::new(d.symbol_names()); + let boxes = d.symbol_boxes().quick().with_names(&names); + let inline: Vec> = d.symbols.iter().map(|s| inline_symbols(&s.art)).collect(); + // Without inline graphics in symbol art, no symbol's type depends on another symbol. + let any_inline = inline.iter().any(|v| !v.is_empty()); let edges: Vec> = d .symbols .iter() - .map(|s| { - let mut e: Vec = inline_symbols(&s.art).iter().filter_map(|n| index.get(n.as_str()).copied()).collect(); + .zip(inline) + .map(|(s, inline)| { + let measured = if any_inline { + boxes.consulted(|| { + art_extent(&s.art, &boxes); + }) + } else { + HashSet::new() + }; + let shows = inline.into_iter().chain(measured); + let mut e: Vec = shows.filter_map(|n| names.get(n.as_str()).copied()).collect(); e.sort_unstable(); e.dedup(); e @@ -276,12 +309,13 @@ impl InlineGraph { .collect(); let (order, cyclic) = components(&edges); let cyclic = order.iter().filter(|&&i| cyclic[i]).map(|&i| d.symbols[i].name.clone()).collect(); - Self { order, cyclic } + Self { order, cyclic, names } } - /// [`Document::inline_art_bounds`] with the cycles found in this graph. + /// [`Document::inline_art_bounds`] with the cycles found in this graph, for `d` with the + /// symbols' names and order the graph was made with. fn bounds(&self, d: &Document, name: &str) -> Option { - if self.cyclic.contains(name) { None } else { d.symbol_art_bounds(name) } + if self.cyclic.contains(name) { None } else { d.symbol_art_bounds_in(name, &d.symbol_boxes().with_names(&self.names)) } } } @@ -354,12 +388,16 @@ fn components(edges: &[Vec]) -> (Vec, Vec) { #[derive(Default)] pub(crate) struct InlineCycles(RwLock>>); -/// The name and art of each symbol the cycles were found in, and the names of the symbols on one. -type Found = (Vec<(String, Weak)>, Arc>); +/// The names of the symbols on a cycle, and each symbol name → the index of the first symbol of that +/// name. +type Cycles = (Arc>, Arc); + +/// The name and art of each symbol the cycles were found in, and what was found. +type Found = (Vec<(String, Weak)>, Cycles); impl InlineCycles { /// The cached names, when they were found in `symbols`. - fn get(&self, symbols: &[Symbol]) -> Option>> { + fn get(&self, symbols: &[Symbol]) -> Option { let g = self.0.read().ok()?; let (from, found) = &**g.as_ref()?; let same = from.len() == symbols.len() @@ -368,7 +406,7 @@ impl InlineCycles { } /// Keep `found`, found in `symbols`. - fn set(&self, symbols: &[Symbol], found: &Arc>) { + fn set(&self, symbols: &[Symbol], found: &Cycles) { if let Ok(mut g) = self.0.write() { *g = Some(Arc::new((symbols.iter().map(|s| (s.name.clone(), Arc::downgrade(&s.art))).collect(), found.clone()))); } @@ -485,6 +523,109 @@ mod tests { assert_eq!(count.get(), 2); } + /// A rectangle `r` filled black, with a 2 pt black stroke. + fn stroked(d: &mut Document, r: Rect) -> Arc { + use vectorcraft_color::{Color, Paint}; + let look = crate::Appearance::basic(Paint::solid(Color::BLACK), Paint::solid(Color::BLACK), 2.0); + Arc::new(Node::path(d.alloc_id(), vectorcraft_geom::shapes::rectangle(r), look)) + } + + fn instance(d: &mut Document, symbol: &str, xf: Affine) -> Arc { + Arc::new(Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: symbol.into(), xf })) + } + + /// Symbol `name` holding `art` in a group. + fn symbol(d: &mut Document, name: &str, art: Vec>) { + let group = Node::group(d.alloc_id(), art); + d.symbols.push(Symbol { dynamic: false, name: name.into(), art: Arc::new(group) }); + } + + #[test] + fn a_symbol_nested_in_symbol_art_is_measured_by_its_own_art() { + // `Far` is a rectangle from (200, 100) to (240, 130) with a 2 pt stroke, far from the + // 20 × 20 square around the origin. + let mut d = Document::new(500.0, 500.0); + let far = stroked(&mut d, Rect::new(200.0, 100.0, 240.0, 130.0)); + symbol(&mut d, "Far", vec![far]); + let moved = instance(&mut d, "Far", Affine::translate((-100.0, 0.0))); + symbol(&mut d, "Moved", vec![moved.clone()]); + let scaled = instance(&mut d, "Far", Affine::scale(2.0)); + symbol(&mut d, "Scaled", vec![scaled]); + symbol(&mut d, "Sized", vec![moved]); + d.unknown.insert(SYMBOL_SIZES.into(), serde_json::json!({ "Sized": [40.0, 20.0] })); + assert_eq!(d.symbol_art_bounds("Far"), Some(Rect::new(199.0, 99.0, 241.0, 131.0))); + // The stroke paints 1 pt around the moved rectangle. + assert_eq!(d.symbol_art_bounds("Moved"), Some(Rect::new(99.0, 99.0, 141.0, 131.0))); + // Scaled 2 times, the stroke keeps its weight. + assert_eq!(d.symbol_art_bounds("Scaled"), Some(Rect::new(399.0, 199.0, 481.0, 261.0))); + // At its natural size, 40 × 20 for the 20 × 20 square: 2 times across. + assert_eq!(d.symbol_art_bounds("Sized"), Some(Rect::new(198.0, 99.0, 282.0, 131.0))); + assert_eq!(d.inline_art_bounds("Moved"), d.symbol_art_bounds("Moved")); + } + + #[test] + fn nested_instances_without_art_of_their_own_are_measured_by_the_square() { + let mut d = Document::new(500.0, 500.0); + let r = Rect::new(0.0, 0.0, 10.0, 10.0); + // An instance of a missing symbol and one of a symbol with no art, beside a rectangle. + symbol(&mut d, "Empty", vec![]); + let pieces = vec![stroked(&mut d, r), instance(&mut d, "Nowhere", Affine::translate((100.0, 0.0)))]; + symbol(&mut d, "Missing", pieces); + let pieces = vec![stroked(&mut d, r), instance(&mut d, "Empty", Affine::translate((100.0, 0.0)))]; + symbol(&mut d, "Holds empty", pieces); + let with_square = Some(Rect::new(-1.0, -10.0, 110.0, 11.0)); + assert_eq!(d.symbol_art_bounds("Empty"), None); + assert_eq!(d.symbol_art_bounds("Missing"), with_square); + assert_eq!(d.symbol_art_bounds("Holds empty"), with_square); + // A symbol that holds an instance of itself: the instance is measured by the square, and + // an inline graphic of it is not an empty slot. + let pieces = vec![stroked(&mut d, r), instance(&mut d, "Loop", Affine::translate((100.0, 0.0)))]; + symbol(&mut d, "Loop", pieces); + assert_eq!(d.symbol_art_bounds("Loop"), with_square); + assert_eq!(d.inline_art_bounds("Loop"), with_square); + // A chain of 40 symbols, each holding a rectangle and an instance of the next one 1 pt to + // the right: symbols nest 39 deep in Link 0's art, past the limit of 32, so its instance of + // Link 1 is measured by the square. + for i in 0..40 { + let unit = stroked(&mut d, Rect::new(0.0, 0.0, 1.0, 1.0)); + let next = instance(&mut d, &format!("Link {}", i + 1), Affine::translate((1.0, 0.0))); + symbol(&mut d, &format!("Link {i}"), if i < 39 { vec![unit, next] } else { vec![unit] }); + } + assert_eq!(d.symbol_art_bounds("Link 0"), Some(Rect::new(-9.0, -10.0, 11.0, 10.0))); + // Link 8's art nests 31 deep: measured by the art of the links after it. + assert_eq!(d.symbol_art_bounds("Link 8"), Some(Rect::new(-1.0, -1.0, 33.0, 2.0))); + } + + /// Type showing the symbol named `symbol` inline. + fn showing(d: &mut Document, symbol: &str) -> Arc { + let style = crate::CharStyle::default(); + let mut t = TextObject::point(vectorcraft_geom::Point::ZERO, "Type", style.clone()); + t.runs.push(crate::TextRun::new("", style)); + t.runs[1].inline = Some(crate::InlineArt { symbol: symbol.into(), scale: 1.0, baseline_shift: 0.0, bounds: None }); + Arc::new(Node::new(d.alloc_id(), NodeKind::Text(Box::new(t)))) + } + + #[test] + fn only_instances_that_size_a_symbols_art_make_it_depend_on_their_symbol() { + // B's type shows A inline. A's art is a clip group: a clipping rectangle, then an instance + // of B that the rectangle clips, so A's size does not depend on B's. + let mut d = Document::new(500.0, 500.0); + let text = showing(&mut d, "A"); + symbol(&mut d, "B", vec![text]); + let clip = stroked(&mut d, Rect::new(0.0, 0.0, 10.0, 10.0)); + let inner = instance(&mut d, "B", Affine::IDENTITY); + let group = Arc::new(Node::new(d.alloc_id(), NodeKind::Group { children: vec![clip, inner.clone()], clip: true })); + symbol(&mut d, "A", vec![group]); + assert_eq!(d.inline_art_bounds("A"), Some(Rect::new(-1.0, -1.0, 11.0, 11.0))); + // Without the clip, A's size depends on B's and B's on A's: both are empty slots. + let art = Arc::new(Node::group(d.alloc_id(), vec![inner])); + if let Some(a) = d.symbols.iter_mut().find(|s| s.name == "A") { + a.art = art; + } + assert_eq!(d.inline_art_bounds("A"), None); + assert_eq!(d.inline_art_bounds("B"), None); + } + #[test] fn components_handle_a_long_chain_without_recursion() { let n = 200_000; diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index c51e099840..cb78d96ba9 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -367,6 +367,12 @@ pub struct Document { /// saved. #[serde(skip)] inline_cycles: inline::InlineCycles, + /// Art kept elsewhere in the document's data (the art of the stored brushes, which + /// `vectorcraft-brush` reads from [`Self::unknown`]) while it is set here, each root with the + /// `owner` the Links panel names for it, so the stored-art lookups ([`StoredRoot::Mounted`]) + /// find its objects too. Empty otherwise; never saved. + #[serde(skip)] + pub mounted_art: Vec<(Arc, serde_json::Value)>, } fn ppi72() -> f64 { diff --git a/crates/doc/src/links.rs b/crates/doc/src/links.rs index ffa9eac0cd..b2f46700eb 100644 --- a/crates/doc/src/links.rs +++ b/crates/doc/src/links.rs @@ -248,14 +248,15 @@ fn walk_all<'a>(n: &'a Node, f: &mut impl FnMut(&'a Node)) { impl Document { /// Visit every image object: in the layers, then in symbol definitions and pattern swatches, - /// opacity-mask art included. + /// then in [`Document::mounted_art`], opacity-mask art included. pub fn visit_images<'a>(&'a self, mut f: impl FnMut(&'a Node, &'a ImageObject)) { let roots = self .layers .iter() .chain(self.symbols.iter().map(|s| &s.art)) .chain(self.graph_designs.iter().map(|g| &g.art)) - .chain(self.patterns.iter().flat_map(|p| &p.art)); + .chain(self.patterns.iter().flat_map(|p| &p.art)) + .chain(self.mounted_art.iter().map(|(n, _)| n)); for root in roots { walk_all(root, &mut |n| { if let NodeKind::Image(im) = &n.kind { @@ -384,7 +385,8 @@ impl Align { impl Document { /// Rewrite linked file locations in both raster images and placed VectorCraft documents, - /// including those inside symbols, patterns and opacity masks. Used to make packages portable. + /// including those inside symbols, patterns, opacity masks and [`Document::mounted_art`]. Used to + /// make packages portable. pub fn update_links(&mut self, mut f: impl FnMut(&mut LinkInfo)) { fn walk(n: &mut Arc, f: &mut dyn FnMut(&mut LinkInfo)) { let n = Arc::make_mut(n); @@ -409,7 +411,8 @@ impl Document { .iter_mut() .chain(self.symbols.iter_mut().map(|s| &mut s.art)) .chain(self.graph_designs.iter_mut().map(|g| &mut g.art)) - .chain(self.patterns.iter_mut().flat_map(|p| &mut p.art)); + .chain(self.patterns.iter_mut().flat_map(|p| &mut p.art)) + .chain(self.mounted_art.iter_mut().map(|(n, _)| n)); for root in roots { walk(root, &mut f); } @@ -471,7 +474,8 @@ impl Document { .iter_mut() .chain(self.symbols.iter_mut().map(|s| &mut s.art)) .chain(self.graph_designs.iter_mut().map(|g| &mut g.art)) - .chain(self.patterns.iter_mut().flat_map(|p| &mut p.art)); + .chain(self.patterns.iter_mut().flat_map(|p| &mut p.art)) + .chain(self.mounted_art.iter_mut().map(|(n, _)| n)); for root in roots { update(root, &pick, &mut f); } diff --git a/crates/doc/src/node.rs b/crates/doc/src/node.rs index eeec6ab162..79ce594212 100644 --- a/crates/doc/src/node.rs +++ b/crates/doc/src/node.rs @@ -32,6 +32,7 @@ pub use kind::{ImageObject, MAX_BUFFERED_VALUES, NodeKind, with_buffered_value_b pub use live_shape::{LiveShape, Scaling}; pub use opacity::{Knockout, OpacityMask, whiten}; pub use ops::{flattens, keeps_gradient_fit}; +pub(crate) use ops::{held_guides, map_held, strip_held}; use wire::NodeWire; pub(crate) use wire::counted_list; pub use wire::{MAX_READ_NODES, with_node_budget}; diff --git a/crates/doc/src/node/ops.rs b/crates/doc/src/node/ops.rs index fb6e8de8d9..efb006afed 100644 --- a/crates/doc/src/node/ops.rs +++ b/crates/doc/src/node/ops.rs @@ -823,11 +823,11 @@ impl Node { /// The ruler guides a layer holds: its children that are one, by index in order (each with /// nothing inside), and its sublayers holding one (with what they hold). #[derive(Debug, Default)] -pub(super) struct HeldGuides(Vec<(usize, HeldGuides)>); +pub(crate) struct HeldGuides(Vec<(usize, HeldGuides)>); /// The ruler guides, by `is_guide`, that `n` holds if it is a layer, or `None` when it holds /// none. `is_guide` looks at each child of `n` and of its sublayers once. -pub(super) fn held_guides(n: &Node, is_guide: &impl Fn(&Node) -> bool) -> Option { +pub(crate) fn held_guides(n: &Node, is_guide: &impl Fn(&Node) -> bool) -> Option { if !n.is_layer() { return None; } @@ -843,7 +843,7 @@ pub(super) fn held_guides(n: &Node, is_guide: &impl Fn(&Node) -> bool) -> Option /// Remove the ruler guides of `layer` and of its sublayers that [`held_guides`] found (`held`). /// Only the sublayers holding one are copied, and only those are visited. -pub(super) fn strip_held(layer: &mut Node, held: HeldGuides) { +pub(crate) fn strip_held(layer: &mut Node, held: HeldGuides) { let Some(ch) = layer.children_mut() else { return }; let mut held = held.0.into_iter().peekable(); let mut next = 0; @@ -863,7 +863,7 @@ pub(super) fn strip_held(layer: &mut Node, held: HeldGuides) { /// Call `f` (whether it is vertical, its position) on each ruler guide of `layer` and of its /// sublayers that [`held_guides`] found (`held`), in the order they lie in. Only the sublayers /// holding one, and the guides, are copied, and only those sublayers are visited. -pub(super) fn map_held(layer: &mut Node, held: HeldGuides, f: &mut impl FnMut(bool, &mut f64)) { +pub(crate) fn map_held(layer: &mut Node, held: HeldGuides, f: &mut impl FnMut(bool, &mut f64)) { let Some(ch) = layer.children_mut() else { return }; for (i, inner) in held.0 { let Some(c) = ch.get_mut(i) else { continue }; diff --git a/crates/doc/src/orient.rs b/crates/doc/src/orient.rs index e524d6ca37..a2ff76d83f 100644 --- a/crates/doc/src/orient.rs +++ b/crates/doc/src/orient.rs @@ -3,6 +3,8 @@ //! square to it: scaling by a side handle stretches it along its own width or height. Path //! geometry is still baked; Object ▸ Transform ▸ Reset Bounding Box sets the angle back to 0. +use std::sync::Arc; + use vectorcraft_geom::{Affine, Point, Rect, Vec2, normalize_deg, union_opt}; use crate::{Document, Node, NodeId, NodeKind, SymbolBoxes}; @@ -84,7 +86,35 @@ pub fn transformed_angle(angle: f64, a: Affine) -> f64 { } } +/// The turn (counter-clockwise degrees) from the boxes of art placed by a symbol instance's +/// transform `xf` to the instance's own box at `angle`: 0 while the box turns with the transform, +/// otherwise the change Reset Bounding Box made to it. Under a mirroring `xf` the instance's box can +/// stand 180° from the one `xf` gives in one step ([`transformed_angle`] keeps the angle nearer the +/// one before at each step); the turn is then 180°, so the art's boxes match the instance's. +pub fn placed_turn(angle: f64, xf: Affine) -> f64 { + let turn = normalize_deg(angle - transformed_angle(0.0, xf)); + if turn.is_finite() && turn.abs() > EPS_DEG { turn } else { 0.0 } +} + impl Node { + /// Turns the box of this object, and of every object that turns with it ([`Node::transform`]: + /// its children and the art of a linked opacity mask), by `by` degrees counter-clockwise. + /// Layers have no box. + pub fn turn_boxes(&mut self, by: f64) { + if !self.is_layer() { + let a = normalize_deg(self.bbox_angle + by); + self.bbox_angle = if a.abs() <= EPS_DEG { 0.0 } else { a }; + } + for c in self.children_mut().into_iter().flatten() { + Arc::make_mut(c).turn_boxes(by); + } + if let Some(m) = self.extras_if_any().and_then(|e| e.mask.as_mut()) + && m.linked + { + Arc::make_mut(&mut m.art).turn_boxes(by); + } + } + /// Bounds of this object as `a` would place it (geometric, or `visual` with its strokes), /// without changing it, symbol instances measured by their art from `symbols` /// ([`Node::geometric_bounds_with`]). @@ -185,6 +215,44 @@ mod tests { assert_eq!(transformed_angle(30.0, Affine::scale(0.0)), 30.0); } + #[test] + fn placed_turn_is_what_reset_bounding_box_took_off_the_instance() { + let xf = Affine::translate((40.0, 10.0)) * rot(20.0) * Affine::scale_non_uniform(2.0, 0.5); + // The box turns with the transform: no turn. + assert_eq!(placed_turn(transformed_angle(0.0, xf), xf), 0.0); + assert_eq!(placed_turn(0.0, Affine::scale(3.0)), 0.0); + // Reset to 0: the placed art turns back by the 20°. + assert!(close(placed_turn(0.0, xf), -20.0)); + // Mirrored: turned 170° and then flipped, the instance's box stands 180° from the box the + // whole transform gives in one step, and the art turns the half turn to match it. + let flip = Affine::scale_non_uniform(1.0, -1.0); + let flipped = flip * rot(170.0); + let stepwise = transformed_angle(transformed_angle(0.0, rot(170.0)), flip); + assert!(close(stepwise, -170.0) && close(transformed_angle(0.0, flipped), 10.0)); + assert!(close(placed_turn(stepwise, flipped).abs(), 180.0)); + assert!(close(normalize_deg(placed_turn(0.0, flipped) + transformed_angle(0.0, flipped)), 0.0)); + // Degenerate and non-finite transforms turn nothing. + assert_eq!(placed_turn(0.0, Affine::scale(0.0)), 0.0); + assert_eq!(placed_turn(f64::NAN, xf), 0.0); + } + + #[test] + fn turn_boxes_turns_children_and_linked_mask_art_but_not_layers() { + let mut d = Document::new(500.0, 500.0); + let a = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::default_art()); + let mut g = Node::group(d.alloc_id(), vec![Arc::new(a.clone())]); + g.bbox_angle = 170.0; + g.extras_mut().mask = Some(Box::new(crate::OpacityMask::new(a.clone(), true))); + let mut layer = (*d.layers[0]).clone(); + layer.children_mut().unwrap().push(Arc::new(g)); + layer.turn_boxes(20.0); + assert_eq!(layer.bbox_angle, 0.0); + let g = &layer.children().unwrap()[0]; + assert!(close(g.bbox_angle, -170.0), "wraps to (-180, 180]"); + assert!(close(g.children().unwrap()[0].bbox_angle, 20.0)); + assert!(close(g.extras().mask.as_ref().unwrap().art.bbox_angle, 20.0)); + } + #[test] fn oriented_bounds_hug_a_rotated_rectangle() { let mut d = Document::new(500.0, 500.0); diff --git a/crates/doc/src/placed_document.rs b/crates/doc/src/placed_document.rs index 86f7f6134c..cd423658d7 100644 --- a/crates/doc/src/placed_document.rs +++ b/crates/doc/src/placed_document.rs @@ -166,13 +166,15 @@ fn walk_all<'a>(n: &'a Node, f: &mut impl FnMut(&'a Node)) { } } -/// The roots of `d`'s art: layers, symbol definitions and pattern swatches. +/// The roots of `d`'s art: layers, symbol definitions, pattern swatches and +/// [`Document::mounted_art`]. fn roots(d: &Document) -> impl Iterator> { d.layers .iter() .chain(d.symbols.iter().map(|s| &s.art)) .chain(d.graph_designs.iter().map(|g| &g.art)) .chain(d.patterns.iter().flat_map(|p| &p.art)) + .chain(d.mounted_art.iter().map(|(n, _)| n)) } fn roots_mut(d: &mut Document) -> impl Iterator> { @@ -181,6 +183,7 @@ fn roots_mut(d: &mut Document) -> impl Iterator> { .chain(d.symbols.iter_mut().map(|s| &mut s.art)) .chain(d.graph_designs.iter_mut().map(|g| &mut g.art)) .chain(d.patterns.iter_mut().flat_map(|p| &mut p.art)) + .chain(d.mounted_art.iter_mut().map(|(n, _)| n)) } impl Document { diff --git a/crates/doc/src/stored_art.rs b/crates/doc/src/stored_art.rs index e623e0ed0e..cc0832b733 100644 --- a/crates/doc/src/stored_art.rs +++ b/crates/doc/src/stored_art.rs @@ -20,6 +20,8 @@ pub enum StoredRoot { GraphDesign(usize), /// Object `art` of pattern swatch `pattern` of [`Document::patterns`]. Pattern { pattern: usize, art: usize }, + /// Root `index` of [`Document::mounted_art`]. + Mounted(usize), } /// Where a stored object is: its root and, inside opacity-mask art, the object that mask belongs @@ -170,10 +172,12 @@ impl Document { .iter() .enumerate() .flat_map(|(p, def)| def.art.iter().enumerate().map(move |(a, n)| (n, StoredRoot::Pattern { pattern: p, art: a }))); - symbols.chain(designs).chain(patterns) + let mounted = self.mounted_art.iter().enumerate().map(|(i, (n, _))| (n, StoredRoot::Mounted(i))); + symbols.chain(designs).chain(patterns).chain(mounted) } - /// Every root of stored art: the layers, then the art of symbols, graph designs and patterns. + /// Every root of stored art: the layers, then the art of symbols, graph designs and patterns, + /// then [`Document::mounted_art`]. fn stored_roots(&self) -> impl Iterator, StoredRoot)> { self.layers.iter().enumerate().map(|(i, l)| (l, StoredRoot::Layer(i))).chain(self.definition_roots()) } @@ -185,12 +189,13 @@ impl Document { StoredRoot::Symbol(i) => self.symbols.get_mut(i).map(|s| &mut s.art), StoredRoot::GraphDesign(i) => self.graph_designs.get_mut(i).map(|g| &mut g.art), StoredRoot::Pattern { pattern, art } => self.patterns.get_mut(pattern)?.art.get_mut(art), + StoredRoot::Mounted(i) => self.mounted_art.get_mut(i).map(|(n, _)| n), } } /// Visit every stored object with its place: the layer tree with the opacity-mask art of its /// objects, then the art of symbols, graph designs and pattern swatches (their definitions, - /// once each, never the copies instances and tiles draw). + /// once each, never the copies instances and tiles draw), then [`Document::mounted_art`]. pub fn visit_stored<'a>(&'a self, mut f: impl FnMut(&'a Node, StoredPlace)) { self.visit_stored_arcs(|n, place| f(n, place)); } @@ -238,6 +243,29 @@ impl Document { /// visited before them (the layer tree's own objects first) a new id, so every stored object /// can be named by its id. Returns how many changed; the id counter then stands above them. pub(crate) fn renumber_stored_duplicates(&mut self) -> usize { + self.renumber_duplicates_in(|_| true) + } + + /// Raises the id counter above the ids of [`Document::mounted_art`]'s objects, then gives those + /// objects whose id is 0, past the id range, or already taken by an object visited before them + /// (every other stored object first) a new id, as [`Self::renumber_stored_duplicates`] gives + /// them. Returns how many changed. + pub fn number_mounted_art(&mut self) -> usize { + let mut max = 0; + for (i, (root, _)) in self.mounted_art.iter().enumerate() { + visit(root, StoredPlace { root: StoredRoot::Mounted(i), mask_of: None }, &mut |n, _| { + if n.id.0 < MAX_NEXT_ID { + max = max.max(n.id.0); + } + }); + } + self.raise_next_id(max.saturating_add(1)); + self.renumber_duplicates_in(|r| matches!(r, StoredRoot::Mounted(_))) + } + + /// [`Self::renumber_stored_duplicates`] for the roots `pick` holds for only; the objects of the + /// others still count as taken. + fn renumber_duplicates_in(&mut self, pick: impl Fn(StoredRoot) -> bool) -> usize { let mut seen: HashSet = HashSet::new(); for l in &self.layers { l.walk(&mut |n| { @@ -250,9 +278,9 @@ impl Document { // Per root, the visiting indices of the nodes that take a new id. let mut fresh: Vec<(StoredRoot, HashSet)> = vec![]; for (root, r) in self.stored_roots() { - let (mut i, mut here) = (0, HashSet::new()); + let (mut i, mut here, take) = (0, HashSet::new(), pick(r)); visit(root, StoredPlace { root: r, mask_of: None }, &mut |n, place| { - if !place.in_layers() && (n.id.0 == 0 || n.id.0 >= MAX_NEXT_ID || !seen.insert(n.id)) { + if !place.in_layers() && (n.id.0 == 0 || n.id.0 >= MAX_NEXT_ID || !seen.insert(n.id)) && take { here.insert(i); } i += 1; @@ -355,6 +383,30 @@ mod tests { assert_eq!(d, again); } + /// Mounted art is found and changed by id after the other stored art, and numbering it gives + /// its objects that repeat another stored object's id, or have none, new ids above the counter, + /// leaving every other object's id and its own unique ones as they are. + #[test] + fn mounted_art_is_found_and_numbered_after_the_rest() { + let mut d = doc([12, 13, 14]); + let owner = serde_json::json!({ "kind": "brush" }); + d.mounted_art = vec![(Arc::new(masked(10, rect(0))), owner.clone()), (Arc::new(rect(15)), owner)]; + assert_eq!(d.stored_node(NodeId(15)).map(|(_, p)| p.root), Some(StoredRoot::Mounted(1))); + let before = d.clone(); + assert_eq!(d.number_mounted_art(), 2); + let mut ids = vec![]; + d.visit_stored(|n, _| ids.push(n.id.0)); + let unique: HashSet = ids.iter().copied().collect(); + assert_eq!(unique.len(), ids.len(), "{ids:?}"); + assert_eq!(&ids[..6], &[d.layers[0].id.0, 10, 11, 12, 13, 14], "the other art keeps its ids"); + assert_eq!(ids[8], 15, "a unique id is kept"); + assert!(ids.iter().all(|id| *id < d.peek_next_id()), "{ids:?} {}", d.peek_next_id()); + assert!(Arc::ptr_eq(&d.symbols[0].art, &before.symbols[0].art) && Arc::ptr_eq(&d.mounted_art[1].0, &before.mounted_art[1].0)); + d.stored_node_mut(NodeId(15)).unwrap().name = Some("changed".into()); + assert_eq!(d.mounted_art[1].0.name.as_deref(), Some("changed")); + assert_eq!(d.number_mounted_art(), 0, "a second pass changes nothing"); + } + #[test] fn renumbered_objects_on_path_keep_their_path_and_members() { // A symbol's Objects on Path group whose path repeats the layer's object 10 and whose diff --git a/crates/doc/src/symbol_nine_slice.rs b/crates/doc/src/symbol_nine_slice.rs index 53f84e869c..3c8c1b324d 100644 --- a/crates/doc/src/symbol_nine_slice.rs +++ b/crates/doc/src/symbol_nine_slice.rs @@ -614,6 +614,8 @@ impl NineSliceMap { /// `n`, whose box at the natural size is `b`, drawn in each cell it reaches: a clip group of /// the cell around a copy placed by the cell's map, all in a group with `n`'s id. `n` placed /// by `center` when it draws symbol art ([`draws_symbol_art`]), and in [`Self::place_unclipped`]. + /// The clip groups and clip paths take the angle of the cell map that places them. The group + /// and each copy keep `n`'s box angle, turned by the map that places them. /// /// The drop shadows, outer glows and blurs ([`PAINTED_EFFECTS`]) at the end of `n`'s own /// effects, after its last other visible effect, go on that group with its opacity, blending @@ -647,11 +649,15 @@ impl NineSliceMap { area.transform(local); let mut clip = Node::new(NodeId(0), NodeKind::Path { path: area, rule: FillRule::NonZero, live: None, clipping: true, guide: false }); clip.appearance = Appearance::default().into(); + clip.bbox_angle = crate::orient::transformed_angle(0.0, local); let copy = transformed(n, local * self.natural); - cells.push(Arc::new(Node::new(NodeId(0), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(copy)], clip: true }))); + let mut cell = Node::new(NodeId(0), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(copy)], clip: true }); + cell.bbox_angle = crate::orient::transformed_angle(0.0, local); + cells.push(Arc::new(cell)); } } let mut out = Node::group(n.id, cells); + out.bbox_angle = crate::orient::transformed_angle(n.bbox_angle, center); out.visible = n.visible; out.locked = n.locked; out.name = n.name.clone(); diff --git a/crates/doc/src/symbol_overrides.rs b/crates/doc/src/symbol_overrides.rs index 33f0fd7695..241c61fba8 100644 --- a/crates/doc/src/symbol_overrides.rs +++ b/crates/doc/src/symbol_overrides.rs @@ -2,14 +2,15 @@ //! symbol keeps appearance changes of its own to objects in the symbol's art, while the art stays //! the symbol's. Editing the symbol reshapes every instance and each keeps its changes; Reset drops //! them. The changes are stored on the instance ([`crate::node::NodeExtras::symbol_overrides`]) and -//! applied wherever an instance is drawn or exported ([`dynamic_art`]). +//! applied wherever an instance is drawn or exported ([`dynamic_art`]), and an instance's fill +//! stains the art after them ([`instance_art`]). use std::sync::Arc; use serde::{Deserialize, Serialize}; -use vectorcraft_color::{BlendMode, Paint}; +use vectorcraft_color::{BlendMode, Color, Paint}; -use crate::{Node, NodeKind}; +use crate::{AppearanceItem, Node, NodeKind}; /// Deepest object an override may name: groups nested this deep in the symbol's art. pub const MAX_PATH_DEPTH: usize = 64; @@ -150,6 +151,52 @@ pub fn dynamic_art(art: &Node, inst: &Node) -> Node { a } +/// Mix every solid paint under `n` towards `color` by `amount` (0..1): the Symbol Stainer. +pub fn tint_node(n: &mut Node, color: &Color, amount: f32) { + let amount = amount.clamp(0.0, 1.0); + for it in &mut n.appearance.items { + let p = match it { + AppearanceItem::Fill(f) => &mut f.paint, + AppearanceItem::Stroke(s) => &mut s.paint, + }; + if let Paint::Solid { color: c, .. } = p { + *p = Paint::solid(c.lerp(color, amount)); + } + } + if let NodeKind::Text(t) = &mut n.kind { + for r in &mut t.runs { + for p in [&mut r.style.fill, &mut r.style.stroke] { + if let Paint::Solid { color: c, .. } = p { + *p = Paint::solid(c.lerp(color, amount)); + } + } + } + } + if let Some(ch) = n.children_mut() { + for c in ch.iter_mut() { + tint_node(Arc::make_mut(c), color, amount); + } + } +} + +/// The stain instance `inst` puts on its symbol's art: its visible fill color and that fill's +/// opacity (how far the art mixes towards it). `None` for an unstained instance, including one +/// whose fill has an opacity of 0, so its art keeps its paints and their swatch links. +pub fn stain(inst: &Node) -> Option<(Color, f32)> { + let f = inst.appearance.fill().filter(|f| f.visible && f.opacity > 0.0)?; + Some((f.paint.color()?, f.opacity)) +} + +/// A symbol's art for instance `inst`, as the canvas draws it: with the instance's own appearance +/// changes to it ([`dynamic_art`]), stained by the instance's fill ([`stain`]). +pub fn instance_art(art: &Node, inst: &Node) -> Node { + let mut a = dynamic_art(art, inst); + if let Some((c, amount)) = stain(inst) { + tint_node(&mut a, &c, amount); + } + a +} + /// Keep the overrides that name an object of `art` (a symbol's new art), dropping the rest. pub fn retain_parts(overrides: &mut Vec, art: &Node) { overrides.retain(|o| part(art, &o.path).is_some()); @@ -159,7 +206,6 @@ pub fn retain_parts(overrides: &mut Vec, art: &Node) { mod tests { use super::*; use crate::{Appearance, NodeId}; - use vectorcraft_color::Color; use vectorcraft_geom::{Rect, shapes}; fn square(id: u64) -> Arc { diff --git a/crates/doc/src/symbols.rs b/crates/doc/src/symbols.rs index dde6621993..822dce49ea 100644 --- a/crates/doc/src/symbols.rs +++ b/crates/doc/src/symbols.rs @@ -2,7 +2,7 @@ //! the document and measures it once, and an instance's bounds are its art's box placed by the //! instance's transform ([`Node::geometric_bounds_with`]). -use std::cell::{Cell, RefCell}; +use std::cell::{Cell, OnceCell, RefCell}; use std::collections::{HashMap, HashSet}; use std::sync::Arc; @@ -26,6 +26,9 @@ const MAX_REACHES: usize = 4096; /// A symbol's name and the bits of the linear part of a transform that places its art. type Placing = (String, [u64; 4]); +/// Each symbol name of a document → the index of the first symbol of that name. +pub(crate) type SymbolNames = HashMap; + /// A symbol's art measured in symbol space. #[derive(Clone, Copy, Debug, PartialEq)] pub(crate) struct ArtBox { @@ -51,6 +54,10 @@ pub(crate) struct ArtBox { /// symbols change. pub struct SymbolBoxes<'a> { doc: &'a Document, + /// Each symbol name of the document → the index of the first symbol of that name (the one a + /// name finds), made the first time a name is looked up ([`Self::symbol_art`]) or given by + /// [`Self::with_names`]. + names: OnceCell>, /// The art boxes measured so far, by symbol name (`None` for a symbol whose instances are /// measured by [`SYMBOL_SQUARE`]). measured: RefCell>>, @@ -89,6 +96,9 @@ pub struct SymbolBoxes<'a> { sliced_most: u64, /// The widths [`Self::measured_width`] has measured, by kind and symbol name. widths: RefCell>>, + /// While [`Self::consulted`] runs: the symbols whose art boxes [`Self::art`] has given outside + /// the measuring of symbol art. + consulted: RefCell>>, } impl Document { @@ -96,6 +106,7 @@ impl Document { pub fn symbol_boxes(&self) -> SymbolBoxes<'_> { SymbolBoxes { doc: self, + names: OnceCell::new(), measured: RefCell::default(), depths: RefCell::default(), quick: Cell::new(false), @@ -110,8 +121,19 @@ impl Document { sliced_placed: Cell::new(0), sliced_most: MAX_SYMBOL_NODES, widths: RefCell::default(), + consulted: RefCell::default(), } } + + /// Each symbol name of this document → the index of the first symbol of that name (the one a + /// name finds). + pub(crate) fn symbol_names(&self) -> SymbolNames { + let mut names = HashMap::with_capacity(self.symbols.len()); + for (i, s) in self.symbols.iter().enumerate() { + names.entry(s.name.clone()).or_insert(i); + } + names + } } impl<'a> SymbolBoxes<'a> { @@ -120,6 +142,26 @@ impl<'a> SymbolBoxes<'a> { self.doc } + /// Makes these boxes find symbols by `names` ([`Document::symbol_names`]), made from the + /// document's symbols while they had the names and order they have now. + pub(crate) fn with_names(self, names: &Arc) -> Self { + let _ = self.names.set(names.clone()); + self + } + + /// The art of the first symbol of the document named `name`, found in time independent of the + /// number of symbols after the first lookup. + pub(crate) fn symbol_art(&self, name: &str) -> Option<&'a Arc> { + let doc: &'a Document = self.doc; + let names = self.names.get_or_init(|| Arc::new(doc.symbol_names())); + let i = *names.get(name)?; + match doc.symbols.get(i) { + Some(s) if s.name == name => Some(&s.art), + // Names that no longer match the symbols: the first symbol of that name. + _ => doc.symbols.iter().find(|s| s.name == name).map(|s| &s.art), + } + } + /// Makes these boxes measure every symbol instance as [`Node::reach_bounds_with`] does, by its /// art box alone. An instance that scales or turns stroked art then measures a little larger /// than with [`Node::visual_bounds_with`], and its art is not transformed to measure it. The @@ -160,21 +202,37 @@ impl<'a> SymbolBoxes<'a> { /// art boxes. Returns `None` when [`Self::depth`] is `None` and when the art has no finite /// bounds: instances of the symbol are then measured by [`SYMBOL_SQUARE`]. pub(crate) fn art(&self, name: &str) -> Option { - if let Some(b) = self.measured.borrow().get(name) { - return *b; + let cached = self.measured.borrow().get(name).copied(); + let b = cached.unwrap_or_else(|| { + let b = self.measure_art(name, |art| self.in_art(|| art_box(art, self))).flatten(); + self.measured.borrow_mut().insert(name.to_string(), b); + b + }); + if b.is_some() + && let Some(seen) = self.consulted.borrow_mut().as_mut() + && !seen.contains(name) + { + seen.insert(name.to_string()); } - let b = self.measure_art(name, |art| self.in_art(|| art_box(art, self))).flatten(); - self.measured.borrow_mut().insert(name.to_string(), b); b } + /// Runs `measure`, and returns the names of the symbols whose art boxes it took from these + /// boxes, the art of symbols it measured left out: the symbols whose art the instances it + /// measured are measured by. + pub(crate) fn consulted(&self, measure: impl FnOnce()) -> HashSet { + let was = self.consulted.replace(Some(HashSet::new())); + measure(); + self.consulted.replace(was).unwrap_or_default() + } + /// Runs `measure` on the art of the symbol named `name`. Returns `None` when [`Self::depth`] /// is `None`, without running it. pub fn measure_art(&self, name: &str, measure: impl FnOnce(&Arc) -> R) -> Option { self.depth(name)?; - let sym = self.doc.symbols.iter().find(|s| s.name == name)?; + let art = self.symbol_art(name)?; self.runs.set(self.runs.get() + 1); - Some(measure(&sym.art)) + Some(measure(art)) } /// How many times [`Self::measure_art`] has run a measure on symbol art for these boxes, the @@ -297,10 +355,9 @@ impl<'a> SymbolBoxes<'a> { /// other symbols it reaches: the depth of each one it walks to the end, and `None` for those on /// the way down to a symbol that holds an instance of itself or nests too deep. fn find_depth(&self, name: &str, learned: &mut HashMap>) -> Option { - let art = |n: &str| self.doc.symbols.iter().find(|s| s.name == n).map(|s| &s.art); // The symbols on the way down from `name`: each with the symbols its art shows that are // still to be walked, and the deepest nesting found under it so far. - let mut path: Vec<(String, Vec, usize)> = vec![(name.to_string(), shown(self.doc, art(name)?), 0)]; + let mut path: Vec<(String, Vec, usize)> = vec![(name.to_string(), self.shown(self.symbol_art(name)?), 0)]; loop { let (_, todo, _) = path.last_mut()?; let Some(next) = todo.pop() else { @@ -330,8 +387,8 @@ impl<'a> SymbolBoxes<'a> { // Symbols nested MAX_DEPTH deep under `name`. None if path.len() >= MAX_DEPTH => return None, None => { - if let Some(a) = art(&next) { - let todo = shown(self.doc, a); + if let Some(a) = self.symbol_art(&next) { + let todo = self.shown(a); path.push((next, todo, 0)); } } @@ -379,7 +436,7 @@ impl<'a> SymbolBoxes<'a> { None => { // The most objects placing makes, the art of opacity masks included, is set aside // while the art is placed and measured, and what placing did not make is given back. - let art = &self.doc.symbols.iter().find(|s| s.name == name)?.art; + let art = self.symbol_art(name)?; let most = match self.doc.symbol_slice_map(name, linear) { Some(m) => m.most_placed(art, self.doc), None => art.count_with_masks() as u64, @@ -431,11 +488,28 @@ impl<'a> SymbolBoxes<'a> { fn in_art(&self, f: impl FnOnce() -> R) -> R { let pad = self.brush_art.replace(false); let strokes = self.art_strokes.replace(true); + let consulted = self.consulted.take(); let r = self.quickly(f); self.brush_art.set(pad); self.art_strokes.set(strokes); + *self.consulted.borrow_mut() = consulted; r } + + /// The names of the symbols of the document that the instances in `art` show, each once. + fn shown(&self, art: &Node) -> Vec { + let mut seen = HashSet::new(); + let mut names = vec![]; + art.walk(&mut |n| { + if let NodeKind::SymbolInstance { symbol, .. } = &n.kind + && seen.insert(symbol.as_str()) + && self.symbol_art(symbol).is_some() + { + names.push(symbol.clone()); + } + }); + names + } } /// Records every symbol on `path` in `learned` as one whose instances are measured by @@ -447,21 +521,6 @@ fn give_up(path: &[(String, Vec, usize)], learned: &mut HashMap Vec { - let mut seen = HashSet::new(); - let mut names = vec![]; - art.walk(&mut |n| { - if let NodeKind::SymbolInstance { symbol, .. } = &n.kind - && seen.insert(symbol.as_str()) - && doc.symbols.iter().any(|s| s.name == *symbol) - { - names.push(symbol.clone()); - } - }); - names -} - /// Measures symbol art `art`, with the instances in it measured by `symbols`. fn art_box(art: &Arc, symbols: &SymbolBoxes) -> Option { let finite = |r: &Rect| [r.x0, r.y0, r.x1, r.y1].iter().all(|v| v.is_finite()); diff --git a/crates/doc/src/text.rs b/crates/doc/src/text.rs index 440c379283..c3c1464cfc 100644 --- a/crates/doc/src/text.rs +++ b/crates/doc/src/text.rs @@ -18,7 +18,7 @@ mod wrap; pub use area::{AreaFit, AreaOptions, PathAlign, PathEffect, TextFlow, TextWrap, VerticalAlign, WrapShape}; use char_style::yes; pub use char_style::{ - CharAlign, CharPosition, CharStyle, Digits, FontHeightReference, GlyphChoice, MAX_AKI, MAX_WARICHU_GAP, ScriptMetrics, WARICHU_LINES, + CharAlign, CharPosition, CharStyle, Digits, FontHeightReference, GlyphChoice, MAX_AKI, MAX_TSUME, MAX_WARICHU_GAP, ScriptMetrics, WARICHU_LINES, WARICHU_SCALE, WarichuAlign, }; pub use composite::{ diff --git a/crates/doc/src/text/char_style.rs b/crates/doc/src/text/char_style.rs index 16b63e0809..ef3cf29dc9 100644 --- a/crates/doc/src/text/char_style.rs +++ b/crates/doc/src/text/char_style.rs @@ -44,6 +44,14 @@ pub struct CharStyle { /// Insert Aki Right: space added after the character in reading order, as [`Self::aki_left`]. #[serde(default, rename = "akiRight", skip_serializing_if = "crate::skip::is_default")] pub aki_right: f64, + /// Tsume (Character panel, East Asian options): the percentage of the blank space on each side + /// of the character's ink, inside its own width, that is taken away, 0 to [`MAX_TSUME`]. 50 + /// halves that space and 100 sets the ink edge to edge; the glyph itself is not scaled. A + /// cluster takes the value of its first character. Tracking, kerning and Insert Aki are added + /// after it. Horizontal type only. + /// + #[serde(default, skip_serializing_if = "crate::skip::is_default")] + pub tsume: f64, /// Use glyph shapes for automatic pair spacing; false uses font metrics. #[serde(default, rename = "opticalKerning", skip_serializing_if = "crate::skip::is_default")] pub optical_kerning: bool, @@ -440,6 +448,9 @@ fn hundred() -> f64 { /// The largest Insert Aki Left or Right ([`CharStyle::aki_left`]), in 1/1000 em: one em. pub const MAX_AKI: f64 = 1000.0; +/// The largest Tsume ([`CharStyle::tsume`]), in percent: all the blank space beside the ink. +pub const MAX_TSUME: f64 = 100.0; + /// The number of lines a warichu block may be stacked on ([`CharStyle::warichu_lines`]). pub const WARICHU_LINES: std::ops::RangeInclusive = 1..=6; @@ -534,6 +545,7 @@ impl Default for CharStyle { kerning_before: 0.0, aki_left: 0.0, aki_right: 0.0, + tsume: 0.0, optical_kerning: false, baseline_shift: 0.0, h_scale: 100.0, @@ -588,7 +600,8 @@ impl CharStyle { /// becomes the nearer end. A leading of 0, which legacy `.ai` import stores, stays, and a /// baseline shift that is not a number becomes 0. The Tate-chu-yoko Up/Down and Left/Right /// offsets are kept as the baseline shift is. Insert Aki Left and Right are kept from 0 to - /// [`MAX_AKI`], and one that is not a number becomes 0. The Warichu Settings Lines and Scale + /// [`MAX_AKI`], and one that is not a number becomes 0; Tsume is kept from 0 to [`MAX_TSUME`] the + /// same way. The Warichu Settings Lines and Scale /// are kept to [`WARICHU_LINES`] and [`WARICHU_SCALE`]; a gap or scale that is not a number becomes its default. The gap is kept to 0 to /// [`crate::MAX_COORD`], as the baseline shift is, since a scaled type object holds it in its /// own units. @@ -606,6 +619,7 @@ impl CharStyle { let aki = |v: f64| if v.is_nan() { 0.0 } else { v.clamp(0.0, MAX_AKI) }; self.aki_left = aki(self.aki_left); self.aki_right = aki(self.aki_right); + self.tsume = if self.tsume.is_nan() { 0.0 } else { self.tsume.clamp(0.0, MAX_TSUME) }; self.warichu_lines = self.warichu_lines.clamp(*WARICHU_LINES.start(), *WARICHU_LINES.end()); self.warichu_gap = if self.warichu_gap.is_nan() { default.warichu_gap } else { self.warichu_gap.clamp(0.0, crate::MAX_COORD) }; self.warichu_scale = diff --git a/crates/doc/src/text/object.rs b/crates/doc/src/text/object.rs index dd4002dd60..9af4d9c5dc 100644 --- a/crates/doc/src/text/object.rs +++ b/crates/doc/src/text/object.rs @@ -507,6 +507,7 @@ impl crate::Document { st.tcy_left_right = num("tcyLeftRight").unwrap_or(st.tcy_left_right); st.aki_left = num("akiLeft").unwrap_or(st.aki_left); st.aki_right = num("akiRight").unwrap_or(st.aki_right); + st.tsume = num("tsume").unwrap_or(st.tsume); st.warichu_gap = num("warichuGap").unwrap_or(st.warichu_gap); st.warichu_scale = num("warichuScale").unwrap_or(st.warichu_scale); st.keep_dimensions_in_range(); @@ -532,6 +533,7 @@ impl crate::Document { ("tcyLeftRight", Some(st.tcy_left_right)), ("akiLeft", Some(st.aki_left)), ("akiRight", Some(st.aki_right)), + ("tsume", Some(st.tsume)), ("leading", st.leading), ]; for (k, v) in kept { diff --git a/crates/doc/src/text/tabs_lists.rs b/crates/doc/src/text/tabs_lists.rs index b8531b402d..26622fa115 100644 --- a/crates/doc/src/text/tabs_lists.rs +++ b/crates/doc/src/text/tabs_lists.rs @@ -357,7 +357,7 @@ impl ParaList { /// The style the marker is set in: `first` (the style of the paragraph's first character) /// without its baseline shift, rotation, superscript or subscript, tracking, manual kerning, - /// Insert Aki, tate-chu-yoko, warichu, underline and strikethrough. + /// Insert Aki, Tsume, tate-chu-yoko, warichu, underline and strikethrough. pub fn marker_style(first: &CharStyle) -> CharStyle { CharStyle { baseline_shift: 0.0, @@ -368,6 +368,7 @@ impl ParaList { kerning_before: 0.0, aki_left: 0.0, aki_right: 0.0, + tsume: 0.0, optical_kerning: first.optical_kerning, tate_chu_yoko: false, warichu: false, diff --git a/crates/doc/src/text/tests.rs b/crates/doc/src/text/tests.rs index 0f474d2ed8..c3afafb6e1 100644 --- a/crates/doc/src/text/tests.rs +++ b/crates/doc/src/text/tests.rs @@ -129,6 +129,34 @@ fn insert_aki_is_saved_only_when_set() { assert_eq!((d.char_styles[0].attrs["akiLeft"].as_f64(), d.char_styles[0].attrs["akiRight"].as_f64()), (Some(MAX_AKI), Some(0.0))); } +/// Tsume is 0 by default and saved only when not 0; styles written before it read as 0, and a +/// value out of range from a file, in a run or a character style, is kept from 0 to 100. +#[test] +fn tsume_is_saved_only_when_set_and_kept_in_range() { + let st = CharStyle::default(); + assert_eq!(st.tsume, 0.0); + let saved = serde_json::to_value(&st).unwrap(); + assert!(saved.get("tsume").is_none()); + let read = serde_json::from_value::(saved).unwrap(); + assert_eq!(read.tsume, 0.0); + let set = CharStyle { tsume: 37.5, ..CharStyle::default() }; + let saved = serde_json::to_value(&set).unwrap(); + assert_eq!(saved.get("tsume").and_then(serde_json::Value::as_f64), Some(37.5)); + assert_eq!(serde_json::from_value::(saved).unwrap(), set); + for (stored, kept) in [(-5.0, 0.0), (250.0, MAX_TSUME), (f64::NAN, 0.0), (f64::INFINITY, MAX_TSUME), (50.0, 50.0)] { + let mut damaged = CharStyle { tsume: stored, ..CharStyle::default() }; + damaged.keep_dimensions_in_range(); + assert_eq!(damaged.tsume, kept, "{stored}"); + } + let mut d = crate::Document::new(100.0, 100.0); + for tsume in [500, -1] { + let attrs = serde_json::json!({ "tsume": tsume }); + d.char_styles.push(TextStyleDef { name: format!("Tight {tsume}"), attrs: attrs.as_object().cloned().unwrap_or_default() }); + } + d.keep_type_values_in_range(); + assert_eq!((d.char_styles[0].attrs["tsume"].as_f64(), d.char_styles[1].attrs["tsume"].as_f64()), (Some(MAX_TSUME), Some(0.0))); +} + /// Each Indic numeral system draws 0–9 (and the Arabic-Indic sets) as the ten digits of its /// script's block; every system saves under its id, which reads back, and other names are refused. #[test] diff --git a/crates/effects/src/adjust.rs b/crates/effects/src/adjust.rs index 4193b085ef..1b9ac80452 100644 --- a/crates/effects/src/adjust.rs +++ b/crates/effects/src/adjust.rs @@ -523,13 +523,14 @@ fn color_mask_keys<'a>(n: &'a Node, out: &mut Vec<&'a str>) { /// [`adjust`] for export and Expand Appearance: recoloured embedded images become new images in /// `d` (named by their content), and a symbol instance stands for its symbol's art: `symbol_art` -/// when given, otherwise the symbol's art with the instance's own appearance changes. +/// when given, otherwise the symbol's art with the instance's own appearance changes, stained by +/// the instance's fill ([`vectorcraft_doc::symbol_overrides::instance_art`]). pub fn adjust_in_document(d: &mut Document, n: &Node, symbol_art: Option) -> Option { let art; let src = match &n.kind { NodeKind::SymbolInstance { symbol, .. } if has_adjustment(n) => { let symbol = symbol_art - .or_else(|| d.symbols.iter().find(|s| s.name == *symbol).map(|s| vectorcraft_doc::symbol_overrides::dynamic_art(&s.art, n))); + .or_else(|| d.symbols.iter().find(|s| s.name == *symbol).map(|s| vectorcraft_doc::symbol_overrides::instance_art(&s.art, n))); art = crate::reshape::as_art(Some(d), n, symbol.as_ref())?; &art } diff --git a/crates/effects/src/bake.rs b/crates/effects/src/bake.rs index 7e42147443..f75490557d 100644 --- a/crates/effects/src/bake.rs +++ b/crates/effects/src/bake.rs @@ -26,20 +26,20 @@ use vectorcraft_geom::{Affine, FillRule, PathData, Rect, Vec2}; use crate::distort::{transform_move, transform_offsets}; use crate::group::{has_own_paint, paints}; -use crate::reshape::{as_art, geometry_effects, glyph_outlines, outline_nested_text, reshape_leaves}; +use crate::reshape::{as_art, clipping_text_outline, geometry_effects, glyph_outlines, outline_nested_text, reshape_leaves}; use crate::{ GeomContext, adjust_in_document, apply_geometry_carrying, crop_marks_art, evaluate_container, has_adjustment, has_crop_marks, has_geometry, - has_item_geometry, has_pathfinder, is_pathfinder, merged_params, needs_outline, outline_text, reshape, + has_instance_row_raster, has_item_geometry, has_pathfinder, is_pathfinder, merged_params, needs_outline, reshape, }; -fn item_effects(item: &AppearanceItem) -> &[vectorcraft_doc::Effect] { +pub(crate) fn item_effects(item: &AppearanceItem) -> &[vectorcraft_doc::Effect] { match item { AppearanceItem::Fill(f) => &f.effects, AppearanceItem::Stroke(s) => &s.effects, } } -fn clear_item_effects(item: &mut AppearanceItem) { +pub(crate) fn clear_item_effects(item: &mut AppearanceItem) { match item { AppearanceItem::Fill(f) => f.effects = crate::raster::without_geometry(&f.effects), AppearanceItem::Stroke(s) => s.effects = crate::raster::without_geometry(&s.effects), @@ -58,6 +58,7 @@ pub fn needs_bake(n: &Node) -> bool { || has_geometry(&n.appearance.effects) || n.projection().is_some() || n.appearance.items.iter().any(|i| has_geometry(item_effects(i))) + || has_instance_row_raster(n) || n.children().is_some_and(|ch| ch.iter().any(|c| needs_bake(c))) } @@ -73,7 +74,7 @@ fn geometry(n: &Node) -> Option<(PathData, FillRule)> { /// `path` with the geometry effects of `effects` applied, and how gradients follow them /// ([`crate::Carry`]). -fn apply(effects: &[vectorcraft_doc::Effect], path: &PathData, ctx: &GeomContext) -> (PathData, crate::Carry) { +pub(crate) fn apply(effects: &[vectorcraft_doc::Effect], path: &PathData, ctx: &GeomContext) -> (PathData, crate::Carry) { if !has_geometry(effects) || path.is_empty() { return (path.clone(), crate::Carry::default()); } @@ -85,7 +86,7 @@ fn apply(effects: &[vectorcraft_doc::Effect], path: &PathData, ctx: &GeomContext /// context of) applied, and `carried` (`item` as the object's effects left it) with its gradient /// moved along with them and the Transform effects the geometry pass left out hidden /// ([`crate::Carry::hide_skipped`]). -fn apply_item(item: &AppearanceItem, carried: &AppearanceItem, g: &PathData, ctx: &GeomContext) -> (PathData, AppearanceItem) { +pub(crate) fn apply_item(item: &AppearanceItem, carried: &AppearanceItem, g: &PathData, ctx: &GeomContext) -> (PathData, AppearanceItem) { let (ig, carry) = apply(item_effects(item), g, &ctx.item(item)); let mut ap = Appearance { items: vec![carried.clone()], ..Default::default() }; if carry.moves(&ap) { @@ -142,15 +143,19 @@ fn bake_node(d: &mut Document, n: &Node) -> Option { } // Type, images, symbol instances and live objects: reshaped through their outlines, and so are // type whose own fills or strokes have geometry effects and images whose own fills or strokes - // paint a shape ([`has_item_geometry`]). Type that Transform effects only move and copy stays - // type, moved to each place. - if needs_outline(n) && (has_geometry(&n.appearance.effects) || n.projection().is_some() || has_item_geometry(n)) { + // paint a shape ([`has_item_geometry`]), and symbol instances whose active fill or stroke has a + // raster effect, which the fills and strokes of their art then carry + // ([`has_instance_row_raster`]). Type that Transform effects only move and copy stays type, + // moved to each place. + if needs_outline(n) && (has_geometry(&n.appearance.effects) || n.projection().is_some() || has_item_geometry(n) || has_instance_row_raster(n)) { if let Some(m) = moved_type_group(n) { return Some(bake_pieces(d, m)); } + // A symbol instance's art as the canvas draws it: with its own appearance changes, stained + // by its fill. let symbol = match &n.kind { NodeKind::SymbolInstance { symbol, .. } => { - d.symbols.iter().find(|s| s.name == *symbol).map(|s| vectorcraft_doc::symbol_overrides::dynamic_art(&s.art, n)) + d.symbols.iter().find(|s| s.name == *symbol).map(|s| vectorcraft_doc::symbol_overrides::instance_art(&s.art, n)) } _ => None, }; @@ -196,8 +201,26 @@ fn bake_node(d: &mut Document, n: &Node) -> Option { { return bake_leaf(d, n); } + if let Some(m) = clip_group_with_type_clip(d, n) { + return Some(m); + } let mut m = n.clone(); - let baked: Vec> = ch.iter().map(|c| bake_node(d, c).map(Arc::new).unwrap_or_else(|| c.clone())).collect(); + // A clipping path takes the geometry effects in it as the canvas clips by it, those of a + // compound path's paths before the compound path's own ([`crate::clip::with_clip_effects_applied`]); + // the pieces it is made of then get ids of their own. + let clip = usize::from(n.clips()); + let baked: Vec> = ch + .iter() + .enumerate() + .map(|(i, c)| match (i < clip).then(|| crate::clip::with_clip_effects_applied(c)).flatten() { + Some(a) => { + let mut a = bake_node(d, &a).unwrap_or(a); + fresh_ids(d, &mut a, &mut std::collections::HashSet::new()); + Arc::new(a) + } + None => bake_node(d, c).map(Arc::new).unwrap_or_else(|| c.clone()), + }) + .collect(); if let Some(ch) = m.children_mut() { *ch = baked; } @@ -206,6 +229,62 @@ fn bake_node(d: &mut Document, n: &Node) -> Option { bake_leaf(d, n) } +/// Clip group or clipping layer `n` whose clipping path is type with geometry effects (its own, its +/// fills' or strokes', or a perspective), baked as the canvas draws it: the type becomes a +/// clipping path of the region the canvas clips to ([`crate::clip_outline`]), its fills (with their +/// effects baked) paint behind the clipped art inside the clip, and its strokes paint over it +/// outside the clip, in a group that `n` becomes with its clip group inside ([`Node::clip_paint`]). +/// The other members are baked as usual. `None` for other objects and when the type has nothing to +/// clip by. +fn clip_group_with_type_clip(d: &mut Document, n: &Node) -> Option { + let (first, rest) = n.children()?.split_first()?; + if !n.clips() + || !matches!(first.kind, NodeKind::Text(_)) + || !(has_geometry(&first.appearance.effects) || first.projection().is_some() || has_item_geometry(first)) + { + return None; + } + let (bp, rule) = crate::clip_outline(first)?; + let mut clip = Node::path(first.id, PathData::from_bezpath(&bp), Appearance::default()); + if let NodeKind::Path { rule: r, clipping, .. } = &mut clip.kind { + (*r, *clipping) = (rule, true); + } + clip.name = first.name.clone(); + clip.visible = first.visible; + let paint = first.clip_paint(); + // The type's fills and strokes as art: baked with the type's id, as the renderer draws them, + // then given ids of their own. + let mut seen = std::collections::HashSet::from([n.id, first.id]); + let mut art = |d: &mut Document, part: Option| { + part.map(|p| { + let mut a = bake_node(d, &p).unwrap_or(p); + fresh_ids(d, &mut a, &mut seen); + Arc::new(a) + }) + }; + let fill = art(d, paint.fill); + let stroke = art(d, paint.stroke); + let members: Vec> = + std::iter::once(Arc::new(clip)).chain(fill).chain(rest.iter().map(|c| bake_node(d, c).map(Arc::new).unwrap_or_else(|| c.clone()))).collect(); + let mut m = n.clone(); + let Some(stroke) = stroke else { + if let Some(ch) = m.children_mut() { + *ch = members; + } + return Some(m); + }; + // `n` keeps its id, name and transparency, and holds the clip group and the strokes over it. + let inner = Node::new(d.alloc_id(), NodeKind::Group { children: members, clip: true }); + match &mut m.kind { + NodeKind::Group { children, clip } | NodeKind::Layer { children, clip, .. } => { + *children = vec![Arc::new(inner), stroke]; + *clip = false; + } + _ => return None, + } + Some(m) +} + /// `m`, art evaluated from an object, with its children baked and then given ids of their own (the /// pieces copied from the source keep the source's ids until then). The pieces are baked with the /// ids the renderer draws them with: Random in a Transform effect takes its seed from the id. @@ -402,7 +481,7 @@ fn container_keeping_type(d: &Document, n: &Node) -> Option { last => Some(Node::group(c.id, copies.into_iter().chain(last).map(Arc::new).collect())), } } - None if clipping => outline_text(c).map(|o| Node { visible: c.visible, ..o }), + None if clipping => clipping_text_outline(c), None => as_art(Some(d), c, None), }; if let Some(o) = art { @@ -464,7 +543,7 @@ fn piece(d: &mut Document, n: &Node, path: PathData, rule: FillRule, item: Appea /// `n`'s geometry with its object-level geometry effects applied, its fill rule, the context of /// its effects, and `n` without those effects, its gradients moved along with them. -fn leaf_base(n: &Node) -> Option<(PathData, FillRule, GeomContext<'_>, Node)> { +pub(crate) fn leaf_base(n: &Node) -> Option<(PathData, FillRule, GeomContext<'_>, Node)> { let (base, rule) = geometry(n)?; let ctx = GeomContext::of(n); let mut m = n.clone(); diff --git a/crates/effects/src/bake/tests.rs b/crates/effects/src/bake/tests.rs index 2bcc026340..8181f0e02e 100644 --- a/crates/effects/src/bake/tests.rs +++ b/crates/effects/src/bake/tests.rs @@ -2,7 +2,7 @@ use super::*; use serde_json::json; use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::{CharStyle, Effect, NodeId, TextObject}; -use vectorcraft_geom::{Point, Rect, shapes}; +use vectorcraft_geom::{Point, Rect, Shape, shapes}; /// Type tests need glyph outlines, which only the optional craft-fonts build input provides. fn skip_without_craft_fonts() -> bool { @@ -59,6 +59,46 @@ fn object_effects_become_geometry_and_raster_effects_stay() { assert_eq!(m.appearance.effects[0].id, "stylize.dropShadow"); } +/// The fill colors of the paths under the layers of `d`, in paint order. +fn path_fills(d: &Document) -> Vec { + let mut out = vec![]; + d.walk(|n| { + if matches!(n.kind, NodeKind::Path { .. }) + && let Some(c) = n.appearance.fill_paint().color() + { + out.push(c); + } + }); + out +} + +/// A symbol instance half stained red is baked in its stained colors, as the canvas draws it: +/// moved by a Transform effect, and recolored by a color adjustment (Invert Colors) after the +/// stain. +#[test] +fn a_stained_instance_is_baked_in_its_stained_colors() { + let blue = Color::rgb8(30, 90, 220); + let art = Node::path(NodeId(2), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::basic(Paint::solid(blue), Paint::None, 0.0)); + let mut inst = Node::new(NodeId(50), NodeKind::SymbolInstance { symbol: "Mark".into(), xf: vectorcraft_geom::Affine::translate((20.0, 20.0)) }); + inst.appearance = Appearance::basic(Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0).into(); + inst.appearance.items.retain(|i| i.is_fill()); + if let vectorcraft_doc::AppearanceItem::Fill(f) = &mut inst.appearance.items[0] { + f.opacity = 0.5; + } + let stained = vectorcraft_doc::symbol_overrides::instance_art(&art, &inst).appearance.fill_paint().color().unwrap(); + assert_ne!(stained.to_hex(), blue.to_hex()); + let [r, g, b] = stained.to_rgb(); + let inverted = Color::rgb(1.0 - r, 1.0 - g, 1.0 - b); + for (id, params, want) in [("distort.transform", json!({"moveH": 30.0}), stained), (crate::addons::color::INVERT, json!({}), inverted)] { + let mut n = inst.clone(); + n.appearance.effects.push(fx(id, params)); + let mut d = doc_with(n); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Mark".into(), art: Arc::new(art.clone()) }); + let fills = path_fills(&bake_document(&d).unwrap()); + assert_eq!(fills.iter().map(Color::to_hex).collect::>(), [want.to_hex()], "{id}"); + } +} + #[test] fn a_baked_transform_moves_a_placed_gradient_with_the_path() { use vectorcraft_color::{Gradient, GradientGeom, GradientKind, GradientPaint, GradientStop}; @@ -753,7 +793,7 @@ fn type_outlined_next_to_type_that_stays_type_keeps_its_look() { } #[test] -fn type_in_a_clipping_group_with_a_fill_of_its_own_is_outlined_plain() { +fn type_in_a_clipping_group_with_a_fill_of_its_own_keeps_its_effect() { if skip_without_craft_fonts() { return; } @@ -768,9 +808,59 @@ fn type_in_a_clipping_group_with_a_fill_of_its_own_is_outlined_plain() { g.children_mut().unwrap().push(Arc::new(clip)); let d = bake_document(&doc_with(g)).unwrap(); assert_eq!(type_origins(&d), [(20.0, 60.0), (220.0, 60.0)]); - // The type clips by its plain outlines, as the canvas clips by them: its own effect is left out. + // The type clips by its outlines moved by its own effect, as the canvas clips by them. let b = d.node(NodeId(59)).and_then(|n| n.geometric_bounds()).unwrap(); - assert!(b.y0 > 30.0 && b.y1 < 70.0, "{b:?}"); + assert!(b.y0 > 330.0 && b.y1 < 370.0, "{b:?}"); +} + +#[test] +fn clipping_type_whose_fill_has_a_geometry_effect_clips_by_its_plain_outlines() { + if skip_without_craft_fonts() { + return; + } + let near = |a: Rect, b: Rect, tol: f64| [a.x0 - b.x0, a.y0 - b.y0, a.x1 - b.x1, a.y1 - b.y1].iter().all(|v| v.abs() < tol); + for stroke in [Paint::None, Paint::solid(Color::rgb(1.0, 0.0, 0.0))] { + // Type that clips a square, with a Transform effect on its own fill. + let mut t = type_node(60); + t.appearance = Appearance::basic(Paint::solid(Color::BLACK), stroke.clone(), 1.0).into(); + for item in &mut t.appearance.items { + if let AppearanceItem::Fill(f) = item { + f.effects.push(fx("distort.transform", json!({"moveH": 300}))); + } + } + let square = Node::path(NodeId(61), shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 100.0)), Appearance::default_art()); + let clip = Node::new(NodeId(62), NodeKind::Group { children: vec![Arc::new(t.clone()), Arc::new(square)], clip: true }); + let canvas = crate::clip_outline(&t).map(|(bp, _)| bp.bounding_box()).unwrap(); + assert!(canvas.x1 < 100.0, "the canvas clips by the plain outlines: {canvas:?}"); + let d = bake_document(&doc_with(clip)).unwrap(); + let baked = d.node(NodeId(62)).unwrap(); + // With a stroke, the clip group sits in a group with the stroke over it, outside the clip. + let group = match baked.kind { + NodeKind::Group { clip: true, .. } => { + assert!(stroke.is_none(), "{baked:?}"); + baked + } + _ => { + let ch = baked.children().unwrap(); + assert_eq!(ch.len(), 2, "{baked:?}"); + let strokes = ch[1].appearance.items.iter().all(|i| matches!(i, AppearanceItem::Stroke(_))); + assert!(matches!(ch[1].kind, NodeKind::Text(_)) && strokes, "the type with only its stroke: {:?}", ch[1]); + &ch[0] + } + }; + let ch = group.children().unwrap(); + assert!(matches!(group.kind, NodeKind::Group { clip: true, .. }) && ch.len() == 3, "{group:?}"); + // The export clips by the outlines the canvas clips by. + assert!(matches!(ch[0].kind, NodeKind::Path { clipping: true, .. }), "{:?}", ch[0]); + let b = crate::clip_outline(&ch[0]).map(|(bp, _)| bp.bounding_box()).unwrap(); + assert!(near(b, canvas, 1e-6), "canvas {canvas:?}, export {b:?}"); + // The fills (the characters' and the moved one) paint behind the square, inside the clip. + let fill = ch[1].geometric_bounds().unwrap(); + assert!((fill.x0 - canvas.x0).abs() < 1e-6 && fill.x1 > canvas.x1 + 250.0, "{fill:?}"); + assert_eq!(ch[2].id, NodeId(61)); + let mut ids = std::collections::HashSet::new(); + baked.walk(&mut |n| assert!(ids.insert(n.id), "duplicate id {}", n.id)); + } } #[test] diff --git a/crates/effects/src/clip.rs b/crates/effects/src/clip.rs index a3e31f1842..60cc3f2845 100644 --- a/crates/effects/src/clip.rs +++ b/crates/effects/src/clip.rs @@ -7,9 +7,124 @@ use vectorcraft_geom::{BezPath, FillRule, PathData}; /// The clipping path `clip` of a clip group as one path and fill rule: compound paths keep their /// holes, even-odd paths their rule, text clips by its glyph outlines and a group by the union of -/// its members. `None` when there is nothing to clip by (the clipped art is then hidden). +/// its members. The live geometry effects of the clipping path (and of the members it clips by) +/// reshape the region, as they reshape what it paints, and so do the geometry effects of a path's +/// fills and strokes: the region is then the union of the paths they give, as an export bakes them. +/// `None` when there is nothing to clip by (the clipped art is then hidden). pub fn clip_outline(clip: &Node) -> Option<(BezPath, FillRule)> { - clip.clip_outline(Some(&outline_text), &unite) + match clip_effects_applied(clip, true) { + Some(m) => m.clip_outline(Some(&outline_text), &unite), + None => clip.clip_outline(Some(&outline_text), &unite), + } +} + +/// `n`, the clipping path of a clip group, with the live geometry effects of everything it clips by +/// applied, innermost first, and removed: a path or compound path with effects becomes a path of +/// its reshaped geometry that keeps its fills, strokes and other effects (its gradients follow the +/// effects, as an export bakes it), the paths of a compound path and the visible members of a group +/// are reshaped by their own effects before the effects around them, a group's or layer's own +/// effects reshape its members as an export evaluates them, and other objects with effects (type) +/// become a path of their reshaped region. A path or compound path whose fills or strokes have +/// geometry effects becomes a group of one path per fill and stroke, reshaped by the path's effects +/// and then by that fill's or stroke's, as an export bakes it; [`clip_outline`] clips by their +/// union. A clipping path that paints ([`Node::clip_paint`], which a group does not) keeps the +/// geometry effects of its own fills and strokes live instead. `None` when nothing in it has a +/// geometry effect. Effects on the clip group or around it then reshape the result, after its own. +pub(crate) fn with_clip_effects_applied(n: &Node) -> Option { + let paint = n.clip_paint(); + clip_effects_applied(n, paint.fill.is_none() && paint.stroke.is_none()) +} + +/// [`with_clip_effects_applied`]; with `items` unset (a clipping path that paints, and the paths of +/// a compound path, which draw with the compound path's fills and strokes), the geometry effects of +/// `n`'s own fills and strokes are left out. +fn clip_effects_applied(n: &Node, items: bool) -> Option { + let mut m: Option = None; + let members: &[std::sync::Arc] = match &n.kind { + NodeKind::Group { children, clip: true } => children.get(..1).unwrap_or_default(), + NodeKind::Group { children, .. } | NodeKind::Layer { children, .. } | NodeKind::Compound { children, .. } => children, + _ => &[], + }; + // A group or layer clips by its visible members after its shaper; a compound path by all of + // its paths, and a nested clip group by its clipping path, shown or hidden + // ([`Node::clip_shapes`]). + let all = matches!(n.kind, NodeKind::Compound { .. } | NodeKind::Group { clip: true, .. }); + let skip = usize::from(matches!(n.kind, NodeKind::Group { clip: false, .. } | NodeKind::Layer { .. }) && n.extras().shaper.is_some()); + // The paths of a compound path draw with the compound path's fills and strokes, and stay paths. + let compound = matches!(n.kind, NodeKind::Compound { .. }); + for (i, c) in members.iter().enumerate().skip(skip).filter(|(_, c)| all || c.visible) { + if let Some(r) = clip_effects_applied(c, items && !compound) + && let Some(slot) = m.get_or_insert_with(|| n.clone()).children_mut().and_then(|ch| ch.get_mut(i)) + { + *slot = std::sync::Arc::new(r); + } + } + let items = items + && matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) + && n.appearance.items.iter().any(|i| crate::has_geometry(crate::bake::item_effects(i))); + if items && let Some((g, rule, ctx, mut p)) = crate::bake::leaf_base(m.as_ref().unwrap_or(n)) { + let children = n + .appearance + .items + .iter() + .zip(&p.appearance.items) + .map(|(item, carried)| { + let (ig, mut it) = crate::bake::apply_item(item, carried, &g, &ctx); + crate::bake::clear_item_effects(&mut it); + let mut piece = Node::path(n.id, ig, Appearance { items: vec![it], ..Default::default() }); + if let NodeKind::Path { rule: r, .. } = &mut piece.kind { + *r = rule; + } + std::sync::Arc::new(piece) + }) + .collect(); + // The path's transparency and raster effects stay on the group of its pieces. + p.appearance.items.clear(); + p.kind = NodeKind::Group { children, clip: false }; + return Some(p); + } + if !crate::has_geometry(&n.appearance.effects) { + return m; + } + let cur = m.as_ref().unwrap_or(n); + // A group's or layer's effects reshape each of its members (a clip group's its clipping + // path), as an export evaluates them; otherwise they reshape its region, below. + if matches!(cur.kind, NodeKind::Group { .. } | NodeKind::Layer { .. }) + && let Some(e) = crate::group::evaluate_container(None, cur) + { + return Some(e); + } + // A path or compound path, as an export bakes it. + if let Some((g, rule, _, mut p)) = crate::bake::leaf_base(cur) { + let clipping = match &cur.kind { + NodeKind::Path { clipping, .. } => *clipping, + NodeKind::Compound { children, .. } => children.iter().any(|c| matches!(c.kind, NodeKind::Path { clipping: true, .. })), + _ => false, + }; + p.kind = Node::path(n.id, g, Appearance::default()).kind; + if let NodeKind::Path { rule: r, clipping: c, .. } = &mut p.kind { + (*r, *c) = (rule, clipping); + } + return Some(p); + } + // Type, as its painted outlines that its effects reshape as an export evaluates them. + if matches!(cur.kind, NodeKind::Text(_)) + && let Some(mut o) = crate::outline_text(cur) + { + o.visible = n.visible; + o.appearance.effects = n.appearance.effects.clone(); + if let Some(e) = crate::group::evaluate_container(None, &o) { + return Some(e); + } + } + let (bp, rule) = cur.clip_outline(Some(&outline_text), &unite)?; + let (g, _) = crate::bake::apply(&n.appearance.effects, &PathData::from_bezpath(&bp), &crate::GeomContext::of(n)); + let mut p = Node::path(n.id, g, Appearance::default()); + if let NodeKind::Path { rule: r, .. } = &mut p.kind { + *r = rule; + } + p.visible = n.visible; + Some(p) } /// The knockout shape of a piece of a mesh-warped image ([`Node::knockout_outline`]) painted opaque diff --git a/crates/effects/src/group.rs b/crates/effects/src/group.rs index bb2f605a91..20b4f982a3 100644 --- a/crates/effects/src/group.rs +++ b/crates/effects/src/group.rs @@ -661,8 +661,9 @@ pub fn has_container_appearance(n: &Node) -> bool { /// The regions a group's or layer's own fills and strokes paint, in document space, each with its /// fill rule: every visible member path and compound path, type as its glyph outlines and live /// objects evaluated; a compound shape as its area, with the symbol instances among its members -/// as their symbols' art from `doc`; the members of a clip group or clipping layer without its -/// clipping path. Images, other symbol instances and guides add nothing. A Repeat counts the +/// as their symbols' art from `doc`; a clip group or clipping layer (`n` itself or one among its +/// members) as the region its clipping path clips to ([`crate::clip::clip_outline`]), so members +/// it hides add nothing. Images, other symbol instances and guides add nothing. A Repeat counts the /// Repeats in the art of `doc`'s symbols that its instances show toward its instance budget. pub fn member_shapes(doc: Option<&Document>, n: &Node) -> Vec<(PathData, FillRule)> { fn push(doc: Option<&Document>, n: &Node, out: &mut Vec<(PathData, FillRule)>) { @@ -690,8 +691,14 @@ pub fn member_shapes(doc: Option<&Document>, n: &Node) -> Vec<(PathData, FillRul } } fn members(doc: Option<&Document>, n: &Node, out: &mut Vec<(PathData, FillRule)>) { - let clip = usize::from(n.clips()); - for c in n.children().into_iter().flatten().skip(clip) { + // A clip group shows its members only inside its clipping path: its outline is that + // region, not the clipped members' own shapes, which may reach far outside it (#7289). + if n.clips() { + let clip = n.children().and_then(|ch| ch.first()); + out.extend(clip.and_then(|c| crate::clip::clip_outline(c)).map(|(bp, rule)| (PathData::from_bezpath(&bp), rule))); + return; + } + for c in n.children().into_iter().flatten() { push(doc, c, out); } } @@ -734,35 +741,93 @@ fn item_art(id: NodeId, item: &AppearanceItem, shapes: &[(PathData, FillRule)], Some(g) } -/// Whether a sublayer among the members of `n`, or among its groups' members, holds a ruler guide. -fn sublayer_guides(n: &Node) -> bool { - n.children().is_some_and(|ch| ch.iter().any(|c| c.holds_ruler_guides() || (!c.is_layer() && sublayer_guides(c)))) +/// The members of a container that [`take_held_guides`] visits, by index, each with the same for +/// its own members. A ruler guide's entry is empty; a container's is not. +#[derive(Default)] +struct HeldGuides(Vec<(usize, HeldGuides)>); + +/// The members of `n` holding or leading to the ruler guides of sublayers, found by looking at each +/// member at every depth once: the ruler guides (`is_guide`) of `n` when it is a layer, each +/// sublayer holding one directly or in its sublayers, and each member of another kind with such a +/// sublayer among its members or its groups' members. With them, whether `n` is a layer holding a +/// ruler guide directly or in its sublayers. The other members of a layer holding none are not +/// looked into, unless the layer is the one whose sublayers are gathered (`top`). +fn held_guides(n: &Node, top: bool, is_guide: &impl Fn(&Node) -> bool) -> (bool, HeldGuides) { + let layer = n.is_layer(); + let (mut holds, mut held, mut other) = (false, vec![], vec![]); + for (i, c) in n.children().into_iter().flatten().enumerate() { + if is_guide(c) { + if layer { + holds = true; + held.push((i, HeldGuides::default())); + } + } else if c.is_layer() { + let (sub_holds, inner) = held_guides(c, false, is_guide); + if sub_holds { + holds = true; + held.push((i, inner)); + } + } else { + other.push((i, c)); + } + } + if !layer || holds || top { + for (i, c) in other { + let (_, inner) = held_guides(c, false, is_guide); + if !inner.0.is_empty() { + held.push((i, inner)); + } + } + held.sort_unstable_by_key(|(i, _)| *i); + } + (layer && holds, HeldGuides(held)) +} + +/// Move the ruler guides of `n` and of its members that [`held_guides`] found (`held`) to `out`: +/// those of `n` first, in order, then those of each member in turn. A guide taken from a hidden or +/// locked container, or from one inside such a container, is hidden or locked itself. Only the +/// containers in `held` are copied, and only those are visited. +fn take_held_guides(n: &mut Node, held: HeldGuides, out: &mut Vec>, hidden: bool, locked: bool) { + let Some(ch) = n.children_mut() else { return }; + let (mut own, mut deeper) = (vec![], vec![]); + for (i, inner) in held.0 { + if inner.0.is_empty() { + own.push(i); + continue; + } + let Some(c) = ch.get_mut(i) else { continue }; + let c = Arc::make_mut(c); + let (hidden, locked) = (hidden || !c.visible, locked || c.locked); + take_held_guides(c, inner, &mut deeper, hidden, locked); + } + if !own.is_empty() { + let mut own = own.into_iter().peekable(); + for (i, mut c) in std::mem::take(ch).into_iter().enumerate() { + if own.next_if_eq(&i).is_none() { + ch.push(c); + continue; + } + if hidden || locked { + let g = Arc::make_mut(&mut c); + g.visible &= !hidden; + g.locked |= locked; + } + out.push(c); + } + } + out.append(&mut deeper); } /// Move the ruler guides of the sublayers among the members of `n`, and among its groups' -/// members, to `out`, in order. A guide taken from a hidden or locked sublayer, or from one inside -/// such a sublayer or group, is hidden or locked itself. Only containers holding one are copied. -fn take_sublayer_guides(n: &mut Node, out: &mut Vec>, hidden: bool, locked: bool) { - let Some(ch) = n.children_mut() else { return }; - for c in ch.iter_mut().filter(|c| c.holds_ruler_guides() || (!c.is_layer() && sublayer_guides(c))) { - let c = Arc::make_mut(c); - let (hidden, locked) = (hidden || !c.visible, locked || c.locked); - if c.is_layer() - && let Some(lc) = c.children_mut() - { - let (taken, art): (Vec<_>, Vec<_>) = std::mem::take(lc).into_iter().partition(|g| g.is_ruler_guide()); - *lc = art; - out.extend(taken.into_iter().map(|mut g| { - if hidden || locked { - let g = Arc::make_mut(&mut g); - g.visible &= !hidden; - g.locked |= locked; - } - g - })); - } - take_sublayer_guides(c, out, hidden, locked); - } +/// members, to `out`, in order: a sublayer's own guides, then those of its members. A guide taken +/// from a hidden or locked sublayer, or from one inside such a sublayer or group, is hidden or +/// locked itself. Each member at every depth is looked at once at most (`is_guide`), and only +/// containers holding one are copied. +fn take_sublayer_guides(n: &mut Node, out: &mut Vec>, is_guide: &impl Fn(&Node) -> bool) { + let (_, mut held) = held_guides(n, true, is_guide); + // The ruler guides of `n` itself stay where they are. + held.0.retain(|(_, inner)| !inner.0.is_empty()); + take_held_guides(n, held, out, false, false); } /// `n`, a group or layer, as plain art: its Pathfinder effects evaluated, its geometry effects @@ -790,7 +855,7 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { // So do its sublayers' guides, which would otherwise go with the art the effects replace or // copy: they stay on this layer, hidden and locked as their sublayers were. if m.is_layer() && (pathfinder || !fx.is_empty()) { - take_sublayer_guides(&mut m, &mut guides, false, false); + take_sublayer_guides(&mut m, &mut guides, &Node::is_ruler_guide); } if pathfinder { let hook = |c: &Node| crate::outline_object(doc, c); @@ -838,9 +903,10 @@ pub fn evaluate_container(doc: Option<&Document>, n: &Node) -> Option { /// Replace each visible member of `n` with geometry or Pathfinder effects of its own, at every /// depth of its groups and layers, by the art it draws ([`evaluate_container`], /// [`crate::reshape::own_effects_art`]), so the geometry effects of `n` reshape what its members -/// draw. A clip group's clipping path stays as it is, and so do images, symbol instances and the -/// other objects that `own_effects_art` leaves alone, and a group or layer with a 3D effect with -/// everything in it. Calls nested in one another, through the +/// draw. A clip group's clipping path only takes the geometry effects in it into its geometry +/// ([`crate::clip::with_clip_effects_applied`]). Images, symbol instances and the other objects +/// that `own_effects_art` leaves alone stay as they are, and so does a group or layer with a 3D +/// effect with everything in it. Calls nested in one another, through the /// groups and layers it walks and the art it evaluates (symbol art and Pathfinder members /// included), stop at [`vectorcraft_doc::depth::MAX_DEPTH`] deep, and together they replace at /// most [`crate::SYMBOL_ART_MAX_NODES`] members: past either limit, members stay as they are. @@ -848,6 +914,13 @@ pub(crate) fn members_as_drawn(doc: Option<&Document>, n: &mut Node) { let Some(_frame) = DrawnFrame::enter() else { return }; let clip = usize::from(n.clips()); let Some(ch) = n.children_mut() else { return }; + // The clipping path's own geometry effects shape it before the effects around it do. + if clip == 1 + && let Some(first) = ch.first_mut() + && let Some(applied) = crate::clip::with_clip_effects_applied(first) + { + *first = Arc::new(applied); + } for c in ch.iter_mut().skip(clip).filter(|c| c.visible) { if !DrawnFrame::take_member() { return; diff --git a/crates/effects/src/group/tests.rs b/crates/effects/src/group/tests.rs index c6e2a78c73..877528d0bb 100644 --- a/crates/effects/src/group/tests.rs +++ b/crates/effects/src/group/tests.rs @@ -747,9 +747,9 @@ fn a_baked_group_that_keeps_its_type_applies_its_members_effects_first() { assert!((w - 250.0).abs() < 1e-6, "{w}"); } -/// A clip group's clipping path keeps its own effects; the clipped members take theirs first. +/// A clip group's clipping path and the clipped members take their own effects first. #[test] -fn a_clipping_path_keeps_its_own_effects_under_a_groups_effects() { +fn a_clipping_path_takes_its_own_effects_before_a_groups_effects() { let mut clip = with_effect(square_at_100(), offset_10()); clip.id = NodeId(2); if let NodeKind::Path { clipping, .. } = &mut clip.kind { @@ -762,7 +762,9 @@ fn a_clipping_path_keeps_its_own_effects_under_a_groups_effects() { let clip_group = art.children().unwrap()[0].clone(); let ch = clip_group.children().unwrap(); assert!(matches!(ch[0].kind, NodeKind::Path { clipping: true, .. }), "{:?}", ch[0].kind); - assert_eq!(crate::reshape::geometry_effects(&ch[0]).len(), 1, "the clipping path keeps its Offset Path"); + assert!(crate::reshape::geometry_effects(&ch[0]).is_empty(), "the clipping path's Offset Path is applied"); + let w = ch[0].geometric_bounds().unwrap().width(); + assert!((w - 60.0).abs() < 0.5, "grown by 10 on each side, then scaled to 50 %: {w}"); assert!(matches!(ch[1].kind, NodeKind::Group { .. }) && crate::reshape::geometry_effects(&ch[1]).is_empty(), "the member is drawn as its art"); } @@ -1757,3 +1759,123 @@ fn a_sublayers_ruler_guide_in_a_hidden_or_locked_group_stays_hidden_or_locked() assert_eq!(guides, [(NodeId(20), !hidden, locked)], "hidden {hidden}, locked {locked}"); } } + +/// Gathering the ruler guides of nested sublayers, and of a sublayer inside nested groups, looks +/// at each member at every depth once at most, and takes the same guides, in the same order and +/// state, as a layer's effects keep. +#[test] +fn gathering_sublayer_ruler_guides_looks_at_each_member_once() { + use std::cell::Cell; + use vectorcraft_doc::LayerColor; + const CHAIN: u64 = 6; + let guide = |id| Arc::new(Node::new(NodeId(id), NodeKind::RulerGuide { vertical: true, pos: id as f64, artboard: None })); + let layer = |id, children: Vec>| { + let mut l = Node::layer(NodeId(id), "Sub", LayerColor::Preset(1)); + if let Some(ch) = l.children_mut() { + *ch = children; + } + l + }; + // Sublayers nested CHAIN deep, each holding the next before its own art and guide. The second + // is hidden and the fourth locked. + let first_guide = guide(201); + let mut chain = layer(100 + CHAIN, vec![sq(300 + CHAIN, 0.0, Color::BLACK), guide(200 + CHAIN)]); + for depth in (1..CHAIN).rev() { + let own = if depth == 1 { first_guide.clone() } else { guide(200 + depth) }; + chain = layer(100 + depth, vec![Arc::new(chain), sq(300 + depth, 0.0, Color::BLACK), own]); + (chain.visible, chain.locked) = (depth != 2, depth == 4); + } + let second_guide = chain.children().and_then(|c| c[0].children()).map(|c| c[2].clone()).unwrap(); + // A sublayer inside five nested groups, the third of them locked. + let mut groups = layer(450, vec![guide(250), sq(350, 0.0, Color::BLACK)]); + for depth in (1..=5).rev() { + groups = Node::group(NodeId(400 + depth), vec![Arc::new(groups)]); + groups.locked = depth == 3; + } + let free = Arc::new(Node::group(NodeId(500), vec![sq(501, 0.0, Color::BLACK), sq(502, 5.0, Color::BLACK)])); + // A sublayer with no guide: the art in its group is not looked at. + let quiet = Node::group(NodeId(601), vec![sq(602, 0.0, Color::BLACK), sq(603, 5.0, Color::BLACK)]); + let quiet = Arc::new(layer(600, vec![Arc::new(quiet)])); + let mut root = layer(10, vec![sq(1, 0.0, Color::rgb(1.0, 0.0, 0.0)), Arc::new(chain), Arc::new(groups), free.clone(), quiet.clone(), guide(20)]); + fn members(n: &Node) -> usize { + n.children().into_iter().flatten().map(|c| 1 + members(c)).sum() + } + let expected: Vec<_> = (1..=CHAIN).map(|depth| (NodeId(200 + depth), depth < 2, depth >= 4)).chain([(NodeId(250), true, true)]).collect(); + let state = |g: &[Arc]| g.iter().map(|g| (g.id, g.visible, g.locked)).collect::>(); + + let mut m = root.clone(); + let looked = Cell::new(0_usize); + let is_guide = |n: &Node| { + looked.set(looked.get() + 1); + n.is_ruler_guide() + }; + let mut taken = vec![]; + take_sublayer_guides(&mut m, &mut taken, &is_guide); + assert_eq!(looked.get(), members(&root) - 2, "each member is looked at once, none in the quiet sublayer's group"); + assert_eq!(state(&taken), expected, "a sublayer's own guides, then its sublayers', each once"); + assert!(Arc::ptr_eq(&taken[0], &first_guide), "a guide with nothing to change is not copied"); + assert!(!Arc::ptr_eq(&taken[1], &second_guide), "a guide made hidden is copied"); + assert!(second_guide.visible, "the guide as it was stays as it was"); + let ch = m.children().unwrap(); + assert!(Arc::ptr_eq(&ch[3], &free), "a member with no sublayer guide is not copied"); + assert!(Arc::ptr_eq(&ch[4], &quiet), "a sublayer with no guide is not copied"); + assert!(ch[5].is_ruler_guide(), "the layer's own guide stays where it is"); + let ids = |n: &Node| n.children().into_iter().flatten().map(|c| c.id).collect::>(); + assert_eq!(ids(&ch[1]), [NodeId(102), NodeId(301)], "the sublayer's art stays, in order"); + assert_eq!(ids(&root.children().unwrap()[1]), [NodeId(102), NodeId(301), NodeId(201)], "the source keeps its guides"); + + fn found(n: &Node, out: &mut Vec) { + for c in n.children().into_iter().flatten() { + if c.is_ruler_guide() { + out.push(c.id); + } + found(c, out); + } + } + for (effect, params) in [("pathfinder.add", serde_json::json!({})), ("distort.transform", serde_json::json!({"moveH": 30, "copies": 2}))] { + root.appearance.effects = vec![Effect { id: effect.into(), params, visible: true }]; + let art = evaluate_container(None, &root).unwrap(); + let ch = art.children().unwrap(); + let tail = &ch[ch.len() - expected.len() - 1..]; + assert_eq!(tail[0].id, NodeId(20), "{effect}: the layer's own guide comes first"); + assert_eq!(state(&tail[1..]), expected, "{effect}: then the sublayers' guides"); + let mut all = vec![]; + found(&art, &mut all); + assert_eq!(all.len(), expected.len() + 1, "{effect}: each guide once"); + } +} + +/// A group's own Fill + Offset Path below its contents follows the outline of a clip group among +/// its members, its clipping path, not the clipped art it hides outside that path (#7289). +#[test] +fn a_groups_own_fill_follows_a_clip_groups_clipping_path_not_its_hidden_art() { + let mut clip = square_at_100(); + clip.id = NodeId(2); + if let NodeKind::Path { clipping, .. } = &mut clip.kind { + *clipping = true; + } + // The clipped art reaches 100 pt past the clipping path on either side. + let hidden = Node::path(NodeId(3), shapes::rectangle(Rect::new(0.0, 100.0, 300.0, 200.0)), black()); + let clipped = Node::new(NodeId(5), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(hidden)], clip: true }); + let mut g = Node::group(NodeId(10), vec![Arc::new(clipped.clone())]); + let mut fill = vectorcraft_doc::FillLayer::new(Paint::solid(Color::rgb(1.0, 0.0, 0.0))); + fill.effects.push(offset_10()); + g.appearance.items = vec![AppearanceItem::Fill(fill)]; + g.appearance.set_contents_at(1); + let near = |a: Rect, b: Rect| (a.x0 - b.x0).abs() < 0.5 && (a.y0 - b.y0).abs() < 0.5 && (a.x1 - b.x1).abs() < 0.5 && (a.y1 - b.y1).abs() < 0.5; + let expected = Rect::new(90.0, 90.0, 210.0, 210.0); + + let art = evaluate_container(None, &g).unwrap(); + let ch = art.children().unwrap(); + assert_eq!(ch.len(), 2, "the fill's art below the clip group"); + assert_eq!(ch[0].id, NodeId(10)); + let b = drawn_bounds(&ch[0]).unwrap(); + assert!(near(b, expected), "the offset fill hugs the clipping path: {b:?}"); + + // The clip group itself with that fill: the same outline. + let mut own = clipped; + own.appearance = g.appearance.clone(); + assert_eq!(member_shapes(None, &own).len(), 1); + let b = member_shapes(None, &own)[0].0.bounds().unwrap(); + assert!(near(b, Rect::new(100.0, 100.0, 200.0, 200.0)), "the clipping path's region: {b:?}"); +} diff --git a/crates/effects/src/lib.rs b/crates/effects/src/lib.rs index 6316a7a273..c18a31d842 100644 --- a/crates/effects/src/lib.rs +++ b/crates/effects/src/lib.rs @@ -80,8 +80,9 @@ pub use marks::{CROP_MARKS, crop_marks_art, has_crop_marks}; pub use pixel::{PIXEL_EFFECTS, PixelFx, PixelSpace}; pub use raster::{RASTERIZE, RasterFx, Rasterize, color_param, follow_items, item_effects_in, outset, raster_effects, without_geometry}; pub use reshape::{ - SYMBOL_ART_MAX_NODES, expand_outlined, follows_image_pixels, gives_image_shape, has_gradient_copies, has_item_geometry, has_painted_effects, - has_transform_art, has_transform_copies, has_transform_options, image_paint, needs_outline, outline_art, outline_text, reshape, + SYMBOL_ART_MAX_NODES, expand_outlined, follows_image_pixels, gives_image_shape, has_gradient_copies, has_instance_row_raster, has_item_geometry, + has_painted_effects, has_transform_art, has_transform_copies, has_transform_options, image_paint, needs_outline, outline_art, outline_text, + reshape, }; pub use revolve::{ CLASSIC_REVOLVE, REVOLVE, has_revolve, is_revolve, revolve_art, revolve_art_in, revolve_options, validate_revolve, validate_revolve_in, diff --git a/crates/effects/src/live.rs b/crates/effects/src/live.rs index 2c02f886c0..5a878d42d3 100644 --- a/crates/effects/src/live.rs +++ b/crates/effects/src/live.rs @@ -23,15 +23,22 @@ pub fn text_outliner() -> Outliner<'static> { /// Type outlined, or a symbol instance as its symbol's art (from `doc`) placed by the instance, /// through the symbol's 9-slice guides when it has them ([`Document::place_symbol_art`], `None` /// past its object limit). As an [`OutlineHook`](crate::OutlineHook), it gives compound shapes and -/// Pathfinder operations the symbol instances among their members. +/// Pathfinder operations the symbol instances among their members. The group around the art takes +/// the instance's box angle, and the art's boxes turn with it, as Break Link turns them. pub fn outline_object(doc: Option<&Document>, n: &Node) -> Option { match &n.kind { NodeKind::SymbolInstance { symbol, xf } => { let doc = doc?; let sym = doc.symbols.iter().find(|s| s.name == *symbol)?; let art = vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n); - let art = doc.place_symbol_art(symbol, &art, *xf)?; - Some(Node::group(n.id, vec![Arc::new(art)])) + let mut art = doc.place_symbol_art(symbol, &art, *xf)?; + let turn = vectorcraft_doc::orient::placed_turn(n.bbox_angle, *xf); + if turn != 0.0 { + art.turn_boxes(turn); + } + let mut out = Node::group(n.id, vec![Arc::new(art)]); + out.bbox_angle = n.bbox_angle; + Some(out) } _ => outline_text(n), } diff --git a/crates/effects/src/reshape.rs b/crates/effects/src/reshape.rs index 8c829d9e0b..ee7d3f8322 100644 --- a/crates/effects/src/reshape.rs +++ b/crates/effects/src/reshape.rs @@ -162,15 +162,26 @@ fn active_stroke(n: &Node) -> Option<&vectorcraft_doc::StrokeLayer> { n.appearance.stroke().filter(|s| s.visible && s.opacity > 0.0) } -/// The visible geometry effects in `fx`, in order. -fn geometry_of(fx: &[Effect]) -> Vec { - fx.iter().filter(|e| e.visible && is_geometry(&e.id)).cloned().collect() +/// Is `n` a symbol instance whose active fill or stroke has a visible raster effect (a shadow, glow, +/// blur, feather or other painted effect, [`crate::is_raster`])? Its art takes that effect on each +/// fill or stroke in it that paints ([`add_instance_row_effects`]), and draws it there. +pub fn has_instance_row_raster(n: &Node) -> bool { + let raster = |fx: &[Effect]| fx.iter().any(|e| e.visible && crate::is_raster(&e.id)); + matches!(n.kind, NodeKind::SymbolInstance { .. }) + && (active_fill(n).is_some_and(|f| raster(&f.effects)) || active_stroke(n).is_some_and(|s| raster(&s.effects))) } -/// `art`, the art symbol instance `n` places, with the visible geometry effects of `n`'s active -/// fill added after the effects of every fill in it that paints, and those of its active stroke -/// after the effects of every stroke in it that paints ([`active_fill`], [`active_stroke`]). Each -/// fill or stroke keeps its paint, and the others keep their shapes. Live objects in it that are +/// The visible geometry and raster effects in `fx`, in order: those a symbol instance's active fill +/// or stroke passes on to its art. +fn row_effects_of(fx: &[Effect]) -> Vec { + fx.iter().filter(|e| e.visible && (is_geometry(&e.id) || crate::is_raster(&e.id))).cloned().collect() +} + +/// `art`, the art symbol instance `n` places, with the visible geometry and raster effects of +/// `n`'s active fill added after the effects of every fill in it that paints, and those of its +/// active stroke after the effects of every stroke in it that paints ([`active_fill`], +/// [`active_stroke`]): a Drop Shadow on the instance's fill shadows each filled shape in the art. +/// Each fill or stroke keeps its paint, and the others keep their shapes. Live objects in it that are /// reached are evaluated first (with the symbols of `doc`), so the effects reshape what they draw. /// Clip groups' clipping paths, guides and the art of opacity masks keep their shapes. A symbol /// instance in the art takes the effects on its own active fill or stroke, or on a new fill or @@ -180,8 +191,8 @@ fn geometry_of(fx: &[Effect]) -> Vec { /// instance in the art takes them. fn add_instance_row_effects(doc: Option<&Document>, n: &Node, art: &mut Node) { let NodeKind::SymbolInstance { symbol, .. } = &n.kind else { return }; - let fill = active_fill(n).map_or(vec![], |f| geometry_of(&f.effects)); - let stroke = active_stroke(n).map_or(vec![], |s| geometry_of(&s.effects)); + let fill = active_fill(n).map_or(vec![], |f| row_effects_of(&f.effects)); + let stroke = active_stroke(n).map_or(vec![], |s| row_effects_of(&s.effects)); if !fill.is_empty() || !stroke.is_empty() { add_row_effects(doc, symbol, art, &fill, &stroke); } @@ -526,8 +537,8 @@ fn with_id(art: &Node, id: NodeId) -> Node { /// a symbol instance as `symbol_art` (the symbol's art, stained as the caller draws it) placed by /// the instance's transform (through the symbol's 9-slice guides in `doc`, when it has them), as /// the art its members draw when the instance has geometry effects of its own -/// ([`crate::group::members_as_drawn`]), its fills and strokes carrying the geometry effects of the -/// instance's active fill and stroke ([`add_instance_row_effects`]). +/// ([`crate::group::members_as_drawn`]), its fills and strokes carrying the geometry and raster +/// effects of the instance's active fill and stroke ([`add_instance_row_effects`]). /// `None` for other kinds (images, paths, containers), and for an instance whose art placed /// through the guides could hold more than [`vectorcraft_doc::MAX_SYMBOL_NODES`] objects. A Repeat counts the Repeats in the art of /// `doc`'s symbols that its instances show toward its instance budget. @@ -678,18 +689,28 @@ fn instances_as_art(doc: Option<&Document>, n: &mut Node, outline: OutlineHook, } } +/// Type `t` in a clip group's clipping path as its outlines ([`outline_text`]) with its +/// visibility, or with geometry effects as a path of the region they give it, which is what +/// [`crate::clip_outline`] clips by. +pub(crate) fn clipping_text_outline(t: &Node) -> Option { + if let Some(p) = crate::clip::with_clip_effects_applied(t) { + return Some(p); + } + let o = outline_text(t)?; + Some(Node { visible: t.visible, ..o }) +} + /// Replace type anywhere inside `n` by its outlines, as art that keeps the type's look /// ([`as_art`]). Type in a clip group's clipping path (all of `n` when `clipping` is set) becomes -/// its plain outlines ([`outline_text`]) with its visibility, which is what -/// [`crate::clip_outline`] clips by. The swatches and patterns that live-effect plug-ins painting -/// their pieces name are looked up in `doc`. +/// its outlines with its visibility and effects ([`clipping_text_outline`]). The swatches and +/// patterns that live-effect plug-ins painting their pieces name are looked up in `doc`. pub(crate) fn outline_nested_text(doc: Option<&Document>, n: &mut Node, clipping: bool) { let clips = n.clips(); let Some(ch) = n.children_mut() else { return }; for (i, c) in ch.iter_mut().enumerate() { let clipping = clipping || (clips && i == 0); let art = match &c.kind { - NodeKind::Text(_) if clipping => outline_text(c).map(|o| Node { visible: c.visible, ..o }), + NodeKind::Text(_) if clipping => clipping_text_outline(c), NodeKind::Text(_) => as_art(doc, c, None), _ => None, }; @@ -709,12 +730,14 @@ pub(crate) fn outline_nested_text(doc: Option<&Document>, n: &mut Node, clipping /// reshaped with it, and keep their effects from their first Convert to Shape or Outline Object /// on. The result is a group with `n`'s id, name, visibility, transparency, opacity mask /// and remaining (raster) effects; `None` when `n` has no visible geometry effect, no perspective -/// and is not type or an image with a fill or stroke of its own that [`has_item_geometry`] counts, -/// or has no art (a symbol instance without `symbol_art`). A path with [`has_transform_art`] is -/// always reshaped. The fills and strokes in the art whose own Transform effects reach their -/// appearance become objects of their own ([`transform_items`]). +/// and is not type or an image with a fill or stroke of its own that [`has_item_geometry`] counts +/// or a symbol instance whose active fill or stroke has a raster effect +/// ([`has_instance_row_raster`]), or has no art (a symbol instance without `symbol_art`). A path +/// with [`has_transform_art`] is always reshaped. The fills and strokes in the art whose own +/// Transform effects reach their appearance become objects of their own ([`transform_items`]). pub fn reshape(doc: Option<&Document>, n: &Node, symbol_art: Option<&Node>) -> Option { - if !has_transform_art(n) && ((geometry_effects(n).is_empty() && n.projection().is_none() && !has_item_geometry(n)) || !needs_outline(n)) { + let own = !geometry_effects(n).is_empty() || n.projection().is_some() || has_item_geometry(n) || has_instance_row_raster(n); + if !has_transform_art(n) && (!own || !needs_outline(n)) { return None; } as_art(doc, n, symbol_art) diff --git a/crates/effects/src/revolve.rs b/crates/effects/src/revolve.rs index 74b23340cd..92057f1c7f 100644 --- a/crates/effects/src/revolve.rs +++ b/crates/effects/src/revolve.rs @@ -8,6 +8,7 @@ use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, FillLayer, N use vectorcraft_geom::{PathData, PathEl, Point, Rect, Vec2}; use vectorcraft_three_d::{Edge, Revolve}; +use crate::solids::wireframe::WireFace; use crate::solids::{ Profile, Scope, is_container, members, object_profile, past_effect, profile, reshape_members, resolve_for, solid_paints, union_bounds, }; @@ -370,7 +371,9 @@ fn group_shadow(id: NodeId, fx: &Effect, shapes: &[Profile], b: Rect, options: R Ok(crate::solids::shadow::scoped_art(id, &caster, settings, cast, crate::solids::has_masks(shapes))) } -/// One object's surface of revolution about the axis of `b`, and each face's depth. `copies` counts +/// One object's surface of revolution about the axis of `b`, and each face it draws ([`Drawn`]), +/// back to front: by depth, and where two faces overlap, by their depths there +/// ([`crate::solids::surface_order`]). `copies` counts /// the bytes of the paint copies of every surface and graphic of the object. Revolve (Classic) draws every face /// with its classic surface, as Extrude & Bevel (Classic) does. Revolve's graphics, with the /// symbols of `doc`, are drawn on the faces of the side ([`crate::solids::graphics::surface_parts`]): @@ -388,7 +391,7 @@ fn surface( blend: vectorcraft_doc::color::BlendMode, expand: bool, copies: &mut Copies, -) -> Option<(Vec, Node)> { +) -> Option<(Vec, Node)> { // A loaded file or a profile edited past the limits keeps drawing its source path instead // of crashing the frame. Commands validate the same evaluator and report its errors. if fx.id == CLASSIC_REVOLVE { @@ -397,9 +400,12 @@ fn surface( if copies.surfaces > MAX_PAINT_COPIES { return None; } - let depths = facets.iter().map(|f| f.depth).collect(); + let order = crate::solids::surface_order(facets.iter().map(|f| (f.contours.first().map_or(&[][..], Vec::as_slice), f.plane, f.depth))); + let facets = in_order(facets, &order); + let drawn = + facets.iter().map(|f| Drawn { depth: f.depth, points: f.contours.first().cloned().unwrap_or_default(), plane: f.plane }).collect(); let p = merged_params(&fx.id, &fx.params); - return Some((depths, crate::solids::classic::surface(n, facets, &paint, opacity, blend, &p))); + return Some((drawn, crate::solids::classic::surface(n, facets, &paint, opacity, blend, &p))); } let colored = options.light_color != [1.0; 3] || options.lights.is_some(); let faces = vectorcraft_three_d::revolve(path, b, options).ok()?; @@ -407,6 +413,8 @@ fn surface( if copies.surfaces > MAX_PAINT_COPIES { return None; } + let order = crate::solids::surface_order(faces.iter().map(|f| (f.points.as_slice(), f.plane, f.depth))); + let faces = in_order(faces, &order); let graphics = crate::solids::mapped_graphics(&merged_params(&fx.id, &fx.params)); let shade = |face: &vectorcraft_three_d::Face, c: Color| graphic_paint(face, c, colored); // Graphics past the limits are left out, and the surface draws without them and their paints' @@ -437,21 +445,28 @@ fn surface( && n.has_default_transparency()) .then(|| vectorcraft_three_d::visible_faces(&faces).ok()) .flatten(); - let faces = visible.unwrap_or_else(|| { - faces - .into_iter() - .map(|f| vectorcraft_three_d::VisibleFace { - path: f.path(), - brightness: f.brightness, - depth: f.depth, - gradient: f.gradient, - illumination: f.illumination, - light_gradient: f.light_gradient, - rgb_gradient: f.rgb_gradient, - }) - .collect() - }); - let depths: Vec = faces.iter().map(|f: &vectorcraft_three_d::VisibleFace| f.depth).collect(); + let (faces, keys): (Vec, Vec) = match visible { + Some(visible) => { + let keys = visible.iter().map(|f| Drawn { depth: f.depth, points: vec![], plane: None }).collect(); + (visible, keys) + } + None => { + let keys = faces.iter().map(|f| Drawn { depth: f.depth, points: f.points.clone(), plane: f.plane }).collect(); + let faces = faces + .into_iter() + .map(|f| vectorcraft_three_d::VisibleFace { + path: f.path(), + brightness: f.brightness, + depth: f.depth, + gradient: f.gradient, + illumination: f.illumination, + light_gradient: f.light_gradient, + rgb_gradient: f.rgb_gradient, + }) + .collect(); + (faces, keys) + } + }; let children = faces .into_iter() .map(|face| { @@ -517,7 +532,21 @@ fn surface( let mut group = Node::group(n.id, children); group.opacity = opacity; group.blend = blend; - Some((depths, group)) + Some((keys, group)) +} + +/// A face [`surface`] draws: its depth and, for [`crate::solids::surface_order`], its polygon on the +/// drawing and its plane (none for a face trimmed to the part of it that shows). +struct Drawn { + depth: f64, + points: Vec, + plane: Option, +} + +/// `items` in `order`, a permutation of their indices. +fn in_order(items: Vec, order: &[usize]) -> Vec { + let mut slots: Vec> = items.into_iter().map(Some).collect(); + order.iter().filter_map(|&k| slots.get_mut(k).and_then(Option::take)).collect() } /// A surface of one object about the bounds of `path`, built with options derived from `fx`. @@ -635,10 +664,16 @@ pub(crate) fn revolve_meshes(n: &Node, total: &mut usize, limit: usize) -> Resul /// effect on the object, the surface in its top visible fill (else its stroke); with it on fills and strokes, one surface for each of /// them, reshaped by the geometry effects after each one's Revolve; on a group or layer, one for /// each member, about one shared axis. The swatches and patterns named by a live-effect plug-in -/// after a fill's or stroke's Revolve are looked up in `doc`. -pub(crate) fn revolve_face_paths(doc: Option<&Document>, n: &Node) -> Result, String> { - let faces = |path: &PathData, b: Rect, options: Revolve| -> Result, String> { - Ok(vectorcraft_three_d::revolve(path, b, options)?.iter().map(vectorcraft_three_d::Face::path).collect()) +/// after a fill's or stroke's Revolve are looked up in `doc`. Each face carries the width of the +/// stroke the canvas draws around it ([`surface`]). +pub(crate) fn revolve_face_paths(doc: Option<&Document>, n: &Node) -> Result, String> { + let faces = |path: &PathData, b: Rect, fx: &Effect, options: Revolve| -> Result, String> { + if fx.id == CLASSIC_REVOLVE { + let p = merged_params(&fx.id, &fx.params); + let facets = vectorcraft_three_d::revolve_facets(path, b, options)?; + return Ok(facets.iter().map(|f| WireFace { path: f.path(), stroke: crate::solids::classic::stroke_width(f, &p) }).collect()); + } + Ok(vectorcraft_three_d::revolve(path, b, options)?.iter().map(|f| WireFace { path: f.path(), stroke: SEAM_WIDTH }).collect()) }; if is_container(n) { let index = n @@ -654,7 +689,7 @@ pub(crate) fn revolve_face_paths(doc: Option<&Document>, n: &Node) -> Result, n: &Node) -> Result, n: &Node) -> Result, n: &Node, expand: bool) -> Option { } else { let count = surfaces.len(); let mut faces = vec![]; - for (member, (depths, s, scopes)) in surfaces.into_iter().enumerate() { + for (member, (drawn, s, scopes)) in surfaces.into_iter().enumerate() { let (opacity, blend) = (s.opacity, s.blend); if let NodeKind::Group { children, .. } = s.kind { - faces.extend(depths.into_iter().zip(children).map(|(depth, face)| (depth, member, opacity, blend, scopes, face))); + faces.extend(drawn.into_iter().zip(children).map(|(drawn, face)| (drawn, member, opacity, blend, scopes, face))); } } - // A stable sort: faces at the same depth keep the members' order. - faces.sort_by(|a, b| a.0.total_cmp(&b.0)); + // A stable sort: faces at the same depth keep the members' order. Overlapping faces, of one + // member or of two, then go in the order of their depths where they overlap. + faces.sort_by(|a, b| a.0.depth.total_cmp(&b.0.depth)); + let order = crate::solids::surface_order(faces.iter().map(|(d, ..)| (d.points.as_slice(), d.plane, d.depth))); + let faces = in_order(faces, &order); if opaque { vec![Arc::new(Node::group(n.id, faces.into_iter().map(|(.., face)| face).collect()))] } else { diff --git a/crates/effects/src/solids.rs b/crates/effects/src/solids.rs index 7500af0617..1536f33bb3 100644 --- a/crates/effects/src/solids.rs +++ b/crates/effects/src/solids.rs @@ -7,7 +7,7 @@ use vectorcraft_doc::color::{BlendMode, Paint}; use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, Node, NodeId, NodeKind, OpacityMask}; use vectorcraft_geom::{BezPath, FillRule, PathData, Point, Rect, Vec2}; use vectorcraft_pathops::BoolOp; -use vectorcraft_three_d::{Bevel, BevelShape, DepthPlane, Extrude, Facet, Inflate, MAX_OBJECT_FACES, Mesh, PlanarFace, View}; +use vectorcraft_three_d::{Bevel, BevelShape, DepthPlane, Extrude, Facet, Inflate, MAX_OBJECT_FACES, Mesh, MeshedSolid, PlanarFace, View}; #[cfg(test)] use vectorcraft_doc::color::Color; @@ -223,6 +223,10 @@ pub(crate) fn solid_paint_sources(n: &Node) -> (Vec>, Ve } fn facets(id: &str, path: &PathData, rule: FillRule, bounds: Rect, p: &Value) -> Result, String> { + #[cfg(test)] + if !is_plane(id) { + SOLID_GEOMETRY_BUILT.with(|n| n.set(n.get() + 1)); + } let view = view_options(p); match id { EXTRUDE => vectorcraft_three_d::extrude(path, rule, bounds, extrude_options(p), view), @@ -292,7 +296,7 @@ fn validate_solid_for(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: let mut shapes = members(n, label)?; reshape_members(n, before, &mut shapes); let b = union_bounds(&shapes).ok_or_else(|| format!("{label} requires a group holding a shape with at least two anchors"))?; - shapes.iter().try_for_each(|s| facets(id, &s.path, s.rule, b, p).map(|_| ()))?; + check_profiles(id, p, &shapes, b)?; check_solids(id, p, &shapes)?; return cast_shadow(id, p, &shapes).map(|_| ()); } @@ -309,12 +313,24 @@ fn validate_solid_for(doc: Option<&Document>, n: &Node, id: &str, p: &Value, at: None => (geometry(&path, before, &ctx), solid_paints(n)), }; let b = path.bounds().ok_or_else(anchors)?; - facets(id, &path, rule, b, p)?; let shapes = [Profile { path, rule, items, opacity: 1.0, scopes: vec![] }]; + check_profiles(id, p, &shapes, b)?; check_solids(id, p, &shapes)?; cast_shadow(id, p, &shapes).map(|_| ()) } +/// Do the solids 3D effect `id` with parameters `p` builds from the profiles of `shapes` about `b` +/// build? Only the profiles no solid of [`check_solids`] is built from are built here: every +/// shape's for Rotate, and for Extrude & Bevel and Inflate the profile of a shape with no fill, +/// whose solids are its strokes' outlines or none. A filled shape's profile is its fill's solid, +/// which [`check_solids`] builds once, about the bounds the effect draws it about. +fn check_profiles(id: &str, p: &Value, shapes: &[Profile], b: Rect) -> Result<(), String> { + shapes + .iter() + .filter(|s| is_plane(id) || !s.items.iter().any(|i| matches!(i, AppearanceItem::Fill(_)))) + .try_for_each(|s| facets(id, &s.path, s.rule, b, p).map(|_| ())) +} + /// Do the solids 3D effect `id` with parameters `p` builds from the fills and strokes of `shapes` /// fit, each on its own and all of them together ([`built_solids`])? Rotate's planes are not /// counted. @@ -559,10 +575,8 @@ fn surface(n: &Node, facets: Vec, paint: &Paint, opacity: f32, blend: Ble .into_iter() .map(|face| { // Adjacent facets, antialiased on their own, would leave hairline seams: a narrow - // stroke of the same paint closes them. No wider than the facet is thick, though: seen - // at a grazing angle a facet can be thinner than the stroke, and its stroke would then - // paint over its neighbours. - let seam = (face.thickness() / 2.0).clamp(0.05, 0.75); + // stroke of the same paint closes them ([`seam_width`]). + let seam = seam_width(&face); if let Some(g) = face.rgb_gradient && (paint.color().is_some() || matches!(paint, Paint::Gradient(_))) { @@ -592,6 +606,13 @@ fn surface(n: &Node, facets: Vec, paint: &Paint, opacity: f32, blend: Ble group } +/// The width of the stroke of a facet's own paint that closes the seams between `face` and its +/// neighbors. No wider than the facet is thick: seen at a grazing angle a facet can be thinner than +/// the stroke, and its stroke would then paint over its neighbors. +pub(crate) fn seam_width(face: &Facet) -> f64 { + (face.thickness() / 2.0).clamp(0.05, 0.75) +} + /// Is a surface of `facets` in `paint` one composite of all its facets when [`surface`] draws it /// whole: a solid color under colored lights with smooth shading? fn composites_facets(facets: &[Facet], paint: &Paint, colored: bool) -> bool { @@ -656,8 +677,11 @@ fn solid_parts(shapes: &[Profile], fallback: Rect) -> (Vec>, Rect) { #[cfg(test)] thread_local! { - /// How many solids [`built_solids`] has built on this thread, for the tests. + /// How many solids [`built_solids`] and [`meshes_for`] have built on this thread, for the tests. static SOLIDS_BUILT: std::cell::Cell = const { std::cell::Cell::new(0) }; + /// How many Extrude & Bevel (Classic included) and Inflate solids [`facets`] and + /// [`built_solids`] have built on this thread, for the tests. + static SOLID_GEOMETRY_BUILT: std::cell::Cell = const { std::cell::Cell::new(0) }; } /// The solids Extrude & Bevel (Classic included) or Inflate `id` with parameters `p` builds from @@ -687,7 +711,11 @@ fn built_solids<'a>( #[cfg(test)] SOLIDS_BUILT.with(|n| n.set(n.get() + 1)); let built = match inflated.as_mut() { - Some(each) => each.next().unwrap_or_else(|| Ok(vec![])), + Some(each) => { + #[cfg(test)] + SOLID_GEOMETRY_BUILT.with(|n| n.set(n.get() + 1)); + each.next().unwrap_or_else(|| Ok(vec![])) + } None => facets(id, area, *rule, bounds, p), }; let result = match built { @@ -1261,6 +1289,35 @@ fn draw_order(faces: &[Placed], sealed: bool) -> Vec { local_order(faces, order) } +/// The order, back to front, of the faces of one or more Revolve surfaces `faces`, given back to +/// front by depth: each face's polygon on the drawing, its plane and its depth. When two +/// overlapping faces are drawn the wrong way round for their depths where they overlap, every pair +/// of overlapping faces with a convex polygon and a plane goes in the order of its depths there, +/// the face nearer the viewer after the other ([`local_order`]), and each step draws the face that +/// comes first in the given order of those whose faces before are drawn, so a face without a plane +/// or a convex polygon can also move. Otherwise the order given. +pub(crate) fn surface_order<'a>(faces: impl IntoIterator, f64)>) -> Vec { + let placed: Vec = faces + .into_iter() + .map(|(points, plane, depth)| { + let local = plane.is_some() && convex(points).is_some(); + // Every face counts as one of a stroke's on one shape, so each overlapping pair is compared. + Placed { + depth, + side: true, + away: false, + bounds: polygon_bounds(points), + member: 0, + paints: Paints::Other, + outline: if local { points.to_vec() } else { vec![] }, + plane: plane.filter(|_| local), + } + }) + .collect(); + let order = (0..placed.len()).collect(); + local_order(&placed, order) +} + /// `shapes`, the members of group or layer `n`, reshaped by the visible geometry effects `before` /// its 3D effect, about the bounds of all of them. pub(crate) fn reshape_members(n: &Node, before: &[Effect], shapes: &mut [Profile]) { @@ -2039,31 +2096,35 @@ fn meshes_for(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) return Ok(out); } let (parts, bounds) = solid_parts(shapes, b); - // The solids the art draws, past the limits of the object's solids together as it is - // ([`built_solids`]), each built and its faces counted as the loop reaches it, then dropped. - let drawn = built_solids(&fx.id, &p, &parts, bounds, MAX_OBJECT_FACES).map(|r| r.map(|f| f.is_some())); - // Inflate lays out every puff at once (they share one eye); each Inflate and Extrude & Bevel - // solid and its mesh are built as the loop reaches them. + // Inflate lays out every puff at once (they share one eye). Each Inflate and Extrude & Bevel + // solid is built once, as the loop reaches it: its facets decide whether the art draws it, as + // [`built_solids`] does, and its faces before projection make its mesh. let mut inflated = (fx.id == INFLATE).then(|| { let shapes: Vec<(&PathData, FillRule)> = parts.iter().map(|(_, _, area, rule, _, _)| (area, *rule)).collect(); - vectorcraft_three_d::inflate_meshes(&shapes, bounds, inflate_options(&p), view) + vectorcraft_three_d::inflate_meshed(&shapes, bounds, inflate_options(&p), view) }); let extrude = if fx.id == CLASSIC_EXTRUDE { classic_extrude_options(&p) } else { extrude_options(&p) }; - for ((item, member, area, rule, _, _), drawn) in parts.iter().zip(drawn) { + let mut kept = 0usize; + for (item, member, area, rule, _, _) in &parts { let item: &AppearanceItem = item; - if !drawn? { - // A stroke the art leaves out is left out of the meshes too; Inflate's next puff - // still belongs to the next part. - if let Some(built) = inflated.as_mut() { - built.next(); - } - continue; - } - let mesh = match inflated.as_mut() { - Some(built) => built.next().unwrap_or_else(|| Ok(Mesh::default())), - None => vectorcraft_three_d::extrude_mesh(area, *rule, bounds, extrude, view), + #[cfg(test)] + SOLIDS_BUILT.with(|n| n.set(n.get() + 1)); + let built = match inflated.as_mut() { + Some(each) => each.next().unwrap_or_else(|| Ok(MeshedSolid::default())), + None => vectorcraft_three_d::extrude_meshed(area, *rule, bounds, extrude, view), }; - match mesh { + // A stroke the art leaves out is left out of the meshes too. The faces of the solids kept + // count together against the object's limit. + let solid = match built { + Ok(solid) => solid, + Err(_) if matches!(item, AppearanceItem::Stroke(_)) => continue, + Err(e) => return Err(e), + }; + kept = kept.saturating_add(solid.facets.len()); + if kept > MAX_OBJECT_FACES { + return Err(vectorcraft_three_d::TOO_COMPLEX_SOLID.to_string()); + } + match solid.mesh() { Ok(mesh) => { let (paint, opacity, _) = paint_of(item, *member); keep(&mut out, mesh, mesh_color(&paint, opacity))?; @@ -2174,3 +2235,6 @@ mod tests_sources; #[cfg(test)] mod tests_shadow; + +#[cfg(test)] +mod tests_revolve_order; diff --git a/crates/effects/src/solids/classic.rs b/crates/effects/src/solids/classic.rs index 23d8d0ffad..29c05406a2 100644 --- a/crates/effects/src/solids/classic.rs +++ b/crates/effects/src/solids/classic.rs @@ -192,6 +192,12 @@ fn shaded(c: Color, tone: f64, spec: f64, shade: Option) -> Color { Color::rgb(r, g, b) } +/// The width of the stroke [`surface`] draws around `face` with parameters `p`: a wire edge on +/// Wireframe, else the seam between faces. +pub(crate) fn stroke_width(face: &Facet, p: &Value) -> f64 { + if classic_shading(p).surface == ClassicSurface::Wireframe { WIRE } else { super::seam_width(face) } +} + /// One solid's faces in paint `paint`, as a group with the paint's opacity and blend mode, one child /// for each facet: the edges of the faces on Wireframe, else each face filled in its paint shaded by /// its tone and highlight. A gradient with transparent stops is shaded opaque and then masked by @@ -213,7 +219,7 @@ pub(crate) fn surface(n: &Node, facets: Vec, source: &Paint, opacity: f32 } let (tone, spec) = shading.tone(face.normal, &lights); // A narrow stroke of the face's own paint closes the hairline seams between faces. - let seam = (face.thickness() / 2.0).clamp(0.05, 0.75); + let seam = super::seam_width(&face); let items = match paint.color() { // Unshaded (No Shading, no shading color, or a face in full light) with no // highlight: the paint itself, its color space and swatch kept. diff --git a/crates/effects/src/solids/tests.rs b/crates/effects/src/solids/tests.rs index eb9e81bbc0..8222484c20 100644 --- a/crates/effects/src/solids/tests.rs +++ b/crates/effects/src/solids/tests.rs @@ -953,6 +953,48 @@ fn an_objects_solids_count_their_faces_together() { } } +/// How many Extrude & Bevel and Inflate solids `check` builds, and its result. +fn geometry_builds(check: impl FnOnce() -> Result<(), String>) -> (usize, Result<(), String>) { + SOLID_GEOMETRY_BUILT.with(|b| b.set(0)); + let result = check(); + (SOLID_GEOMETRY_BUILT.with(std::cell::Cell::get), result) +} + +/// The check builds each solid the effect draws once, about the bounds it draws it about: one for +/// a fill and one for each stroke, on an object, on a group's members and on an appearance item, +/// with the shadow on or off. +#[test] +fn the_check_builds_each_drawn_solid_once() { + for id in [EXTRUDE, CLASSIC_EXTRUDE, INFLATE] { + let n = square_node(); + assert_eq!(geometry_builds(|| validate_solid(&n, id, &json!({}))), (2, Ok(())), "{id}: a fill and a stroke"); + let mut other = square_node(); + other.id = NodeId(2); + let g = Node::group(NodeId(9999), vec![Arc::new(square_node()), Arc::new(other)]); + assert_eq!(geometry_builds(|| validate_solid(&g, id, &json!({}))), (4, Ok(())), "{id}: two members' fills and strokes"); + } + for id in [EXTRUDE, INFLATE] { + let n = square_node(); + assert_eq!(geometry_builds(|| validate_three_d_at(&n, id, &json!({}), (Some(0), 0))), (1, Ok(())), "{id}: on the fill"); + let shadow = json!({"shadow": true}); + assert_eq!(geometry_builds(|| validate_solid(&n, id, &shadow)), (2, Ok(())), "{id}: with the shadow on"); + } +} + +/// A shape with no fill draws no solid of its profile, so the check builds the profile on its own +/// as well as the strokes' solids, and an unpainted shape's profile alone. +#[test] +fn the_check_builds_the_profile_of_a_shape_with_no_fill() { + for id in [EXTRUDE, CLASSIC_EXTRUDE, INFLATE] { + let mut stroked = square_node(); + stroked.appearance.items.retain(|i| matches!(i, AppearanceItem::Stroke(_))); + assert_eq!(geometry_builds(|| validate_solid(&stroked, id, &json!({}))), (2, Ok(())), "{id}: a stroke alone"); + let mut bare = square_node(); + bare.appearance.items.clear(); + assert_eq!(geometry_builds(|| validate_solid(&bare, id, &json!({}))), (1, Ok(())), "{id}: no paint"); + } +} + /// A convex polygon of `corners` corners about (20,000, 20,000), filled red, with no stroke. fn polygon_node(id: u64, corners: usize) -> Node { let points: Vec = (0..corners) diff --git a/crates/effects/src/solids/tests_mesh.rs b/crates/effects/src/solids/tests_mesh.rs index aeefafbc77..a9de7cd7f9 100644 --- a/crates/effects/src/solids/tests_mesh.rs +++ b/crates/effects/src/solids/tests_mesh.rs @@ -208,3 +208,151 @@ fn a_gradient_takes_the_average_of_its_stops() { let pattern = Paint::Pattern { pattern: "x".into(), xf: vectorcraft_geom::Affine::IDENTITY }; assert!(close(mesh_color(&pattern, 0.5), [0.5, 0.5, 0.5, 0.5])); } + +/// The meshes of Extrude & Bevel or Inflate `fx` on `shapes`, each built apart from the facets that +/// decide which solids are drawn ([`built_solids`], then [`vectorcraft_three_d::extrude_mesh`] or +/// [`vectorcraft_three_d::inflate_meshes`]), for comparing with [`meshes_for`]. +fn meshes_built_apart(fx: &Effect, shapes: &[Profile], total: &mut usize, limit: usize) -> Result, String> { + let p = crate::merged_params(&fx.id, &fx.params); + let view = view_options(&p); + let (parts, bounds) = solid_parts(shapes, union_bounds(shapes).unwrap()); + let drawn = built_solids(&fx.id, &p, &parts, bounds, MAX_OBJECT_FACES).map(|r| r.map(|f| f.is_some())); + let mut inflated = (fx.id == INFLATE).then(|| { + let shapes: Vec<(&PathData, FillRule)> = parts.iter().map(|(_, _, area, rule, _, _)| (area, *rule)).collect(); + vectorcraft_three_d::inflate_meshes(&shapes, bounds, inflate_options(&p), view) + }); + let extrude = if fx.id == CLASSIC_EXTRUDE { classic_extrude_options(&p) } else { extrude_options(&p) }; + let mut out = vec![]; + for ((item, opacity, area, rule, _, _), drawn) in parts.iter().zip(drawn) { + let item: &AppearanceItem = item; + if !drawn? { + if let Some(built) = inflated.as_mut() { + built.next(); + } + continue; + } + let mesh = match inflated.as_mut() { + Some(built) => built.next().unwrap_or_else(|| Ok(Mesh::default())), + None => vectorcraft_three_d::extrude_mesh(area, *rule, bounds, extrude, view), + }; + match mesh { + Ok(mesh) => { + let (paint, opacity, _) = paint_of(item, *opacity); + keep_mesh(&mut out, total, SolidMesh { mesh, color: mesh_color(&paint, opacity) }, limit)?; + } + Err(_) if matches!(item, AppearanceItem::Stroke(_)) => {} + Err(e) => return Err(e), + } + } + Ok(out) +} + +/// The bits of every number in `meshes`, for comparing two exports exactly. +type MeshBits = Vec<([u32; 4], Vec<[u64; 3]>, Vec<[u64; 3]>, Vec<[u32; 3]>)>; + +fn mesh_bits(meshes: &[SolidMesh]) -> MeshBits { + meshes + .iter() + .map(|m| { + let (positions, normals) = (&m.mesh.positions, &m.mesh.normals); + ( + m.color.map(f32::to_bits), + positions.iter().map(|p| p.map(f64::to_bits)).collect(), + normals.iter().map(|n| n.map(f64::to_bits)).collect(), + m.mesh.triangles.clone(), + ) + }) + .collect() +} + +/// A five-pointed star about `(x, 150)` with curved edges, filled red and stroked black. +fn star_node(id: u64, x: f64) -> Node { + let mut b = BezPath::new(); + for k in 0..10 { + let (s, c) = (k as f64 * std::f64::consts::PI / 5.0).sin_cos(); + let r = if k % 2 == 0 { 60.0 } else { 25.0 }; + let p = (x + r * c, 150.0 + r * s); + if k == 0 { b.move_to(p) } else { b.curve_to((p.0 + 4.0, p.1), (p.0, p.1 + 4.0), p) } + } + b.close_path(); + Node::path(NodeId(id), PathData::from_bezpath(&b), Appearance::basic(Paint::solid(RED), Paint::solid(Color::BLACK), 6.0)) +} + +/// The shapes `meshes_for` builds from: one node's, or each of several. +fn shapes_of(nodes: &[&Node]) -> Vec { + nodes + .iter() + .map(|n| Profile { path: profile(n).unwrap().0, rule: FillRule::NonZero, items: solid_paints(n), opacity: 1.0, scopes: vec![] }) + .collect() +} + +/// Building each Extrude & Bevel and Inflate solid once exports the same meshes, to the bit, as +/// building its facets and its mesh apart, within and past the triangle budget. +#[test] +fn one_build_exports_the_meshes_built_apart() { + let mut second_stroke = square_node(3, 400.0); + if let Some(stroke) = second_stroke.appearance.items.get(1).cloned() { + second_stroke.appearance.items.push(stroke); + } + let (star, square, other) = (star_node(1, 100.0), square_node(2, 250.0), star_node(4, 600.0)); + let cases = [ + (EXTRUDE, json!({})), + (EXTRUDE, json!({ "bevel": "rounded", "bevelWidth": 6.0, "bevelHeight": 5.0, "twist": 60.0, "taper": 70.0 })), + (EXTRUDE, json!({ "bevel": "cove", "bevelInside": true, "bevelBothSides": true, "cap": false, "perspectiveAngle": 50.0 })), + (EXTRUDE, json!({ "depth": 0.0 })), + (CLASSIC_EXTRUDE, json!({ "bevel": "classic", "bevelHeight": 8.0 })), + (INFLATE, json!({})), + (INFLATE, json!({ "depth": 30.0, "bothSides": true, "volume": 80.0 })), + (INFLATE, json!({ "depth": 40.0, "twist": 360.0, "taper": 70.0, "cap": false })), + (INFLATE, json!({ "depth": 0.1, "twist": 0.1, "bothSides": true })), + ]; + let sets: [Vec<&Node>; 3] = [vec![&star], vec![&second_stroke], vec![&star, &square, &other]]; + for (id, params) in cases { + let effect = fx(id, params.clone()); + for nodes in &sets { + let shapes = shapes_of(nodes); + let (mut once, mut apart) = (0, 0); + let built = meshes_for(&effect, &shapes, &mut once, MAX_MESH_TRIANGLES).unwrap_or_else(|e| panic!("{id} {params}: {e}")); + let reference = meshes_built_apart(&effect, &shapes, &mut apart, MAX_MESH_TRIANGLES).unwrap(); + assert!(!reference.is_empty()); + assert_eq!(mesh_bits(&built), mesh_bits(&reference), "{id} {params}"); + assert_eq!(once, apart); + // Past the budget, at the same mesh, with the same count. + let limit = once - 1; + let (mut once, mut apart) = (0, 0); + let built = meshes_for(&effect, &shapes, &mut once, limit); + assert!(built.is_err(), "{id} {params}"); + assert_eq!(built.err(), meshes_built_apart(&effect, &shapes, &mut apart, limit).err(), "{id} {params}"); + assert_eq!(once, apart, "{id} {params}"); + } + } +} + +/// A stroke whose solid is past the limits is left out of the export and the fill's mesh exports, +/// as when the facets and the mesh are built apart. +#[test] +fn a_stroke_past_the_limits_is_left_out_of_the_export() { + // 40,000 corners: within the 65,536 points of the fill's solid, but not the stroke's outline. + let points: Vec = (0..40_000) + .map(|k| { + let (s, c) = (k as f64 * std::f64::consts::TAU / 40_000.0).sin_cos(); + let r = if k % 2 == 0 { 10_000.0 } else { 9_999.0 }; + Point::new(20_000.0 + r * c, 20_000.0 + r * s) + }) + .collect(); + let path = PathData::single(vectorcraft_geom::SubPath::polyline(&points, true)); + let n = Node::path(NodeId(1), path, Appearance::basic(Paint::solid(RED), Paint::solid(Color::BLACK), 2.0)); + for id in [EXTRUDE, INFLATE] { + // Without caps: a cap of 40,000 corners takes more work to cut into triangles than an + // export allows. + let effect = fx(id, json!({ "cap": false })); + let shapes = shapes_of(&[&n]); + // The fill's mesh alone has more triangles than an export takes. + let (mut once, mut apart) = (0, 0); + let built = meshes_for(&effect, &shapes, &mut once, usize::MAX).unwrap_or_else(|e| panic!("{id}: {e}")); + assert_eq!(built.len(), 1, "{id}: the fill's mesh alone"); + assert!(close(built[0].color, [0.8, 0.2, 0.1, 1.0]), "{id}"); + let reference = meshes_built_apart(&effect, &shapes, &mut apart, usize::MAX).unwrap(); + assert_eq!(mesh_bits(&built), mesh_bits(&reference), "{id}"); + } +} diff --git a/crates/effects/src/solids/tests_revolve_order.rs b/crates/effects/src/solids/tests_revolve_order.rs new file mode 100644 index 0000000000..96650cf2f8 --- /dev/null +++ b/crates/effects/src/solids/tests_revolve_order.rs @@ -0,0 +1,183 @@ +use serde_json::json; + +use super::*; +use crate::revolve::{CLASSIC_REVOLVE, REVOLVE, revolve_art, revolve_options}; + +/// The first pair of faces `(polygon, plane)`, in the order given, drawn the wrong way round where +/// their polygons overlap: the earlier one nearer the viewer at the middle of the overlap. +fn misordered(faces: &[(Vec, Option)]) -> Option<(usize, usize)> { + for (i, (a, pa)) in faces.iter().enumerate() { + let Some(pa) = pa.filter(|_| convex(a).is_some()) else { continue }; + for (j, (b, pb)) in faces.iter().enumerate().skip(i + 1) { + let Some(pb) = pb else { continue }; + let Some(turn) = convex(b) else { continue }; + if !rects_overlap(polygon_bounds(a), polygon_bounds(b)) { + continue; + } + let Some(mid) = centroid(&clip_convex(a, b, turn)) else { continue }; + let (Some(da), Some(db)) = (pa.depth_at(mid), pb.depth_at(mid)) else { continue }; + if da - db > 1e-6 * (1.0 + da.abs().max(db.abs())) { + return Some((i, j)); + } + } + } + None +} + +/// An open, vase-like profile of straight edges. +fn vase() -> PathData { + let mut b = BezPath::new(); + b.move_to((30.0, 20.0)); + for p in [(90.0, 20.0), (55.0, 65.0), (95.0, 110.0), (30.0, 145.0)] { + b.line_to(p); + } + PathData::from_bezpath(&b) +} + +/// The `k`th of five closed 14 × 20 pt rectangles stepping down and away from the axis, as the +/// dashes of a dashed line's outline do. +fn dash(k: usize) -> PathData { + let (x, y) = (30.0 + 12.0 * k as f64, 20.0 + 26.0 * k as f64); + let mut b = BezPath::new(); + b.move_to((x, y)); + b.line_to((x + 14.0, y)); + b.line_to((x + 14.0, y + 20.0)); + b.line_to((x, y + 20.0)); + b.close_path(); + PathData::from_bezpath(&b) +} + +/// The five [`dash`]es as one compound path. +fn dashes() -> PathData { + PathData::new((0..5).flat_map(|k| dash(k).subpaths).collect()) +} + +/// A tilted three-quarter turn of [`vase`], whose faces sorted by their middles' depths draw a +/// nearer face under a farther one where the two overlap. +fn params() -> Value { + json!({"angle": 270, "offset": 12, "rotationX": -30, "rotationY": 0, "perspectiveAngle": 0, "segments": 24, "cap": true}) +} + +/// A three-quarter turn of [`dashes`], steeply tilted and in wide perspective, whose classic facets +/// sorted by their middles' depths draw a nearer facet under a farther one where the two overlap. +fn classic_params() -> Value { + json!({"angle": 270, "offset": 12, "rotationX": -60, "rotationY": 0, "perspectiveAngle": 80, "cap": true}) +} + +fn node(path: PathData) -> Node { + Node::path(NodeId(1), path, Appearance::basic(Paint::solid(Color::rgb(0.1, 0.7, 0.8)), Paint::None, 0.0)) +} + +/// The faces of `faces` (polygon, plane and outline) in the order `art` draws their outlines. +fn drawn_order(art: &Node, faces: &[(Vec, Option, PathData)]) -> Vec<(Vec, Option)> { + let mut out = vec![]; + art.walk(&mut |n| { + if let Some(path) = n.path_data() + && let Some((points, plane, _)) = faces.iter().find(|(.., outline)| outline == path) + { + out.push((points.clone(), *plane)); + } + }); + out +} + +/// Of a tilted, revolved vase, a face sorted by the depth of its middle goes under a farther face +/// that it is in front of where the two overlap. The surface draws the nearer face last there, on +/// its own and as a member of a revolved group. +#[test] +fn a_revolved_surface_draws_the_nearer_of_two_overlapping_faces_last() { + let path = vase(); + let faces = vectorcraft_three_d::revolve(&path, path.bounds().unwrap(), revolve_options(¶ms())).unwrap(); + let by_depth: Vec<_> = faces.iter().map(|f| (f.points.clone(), f.plane)).collect(); + assert!(misordered(&by_depth).is_some(), "the faces by depth are drawn the wrong way round somewhere"); + let keyed: Vec<_> = faces.iter().map(|f| (f.points.clone(), f.plane, f.path())).collect(); + let mut n = node(path.clone()); + n.appearance.effects.push(crate::new_effect(REVOLVE, ¶ms()).unwrap()); + let drawn = drawn_order(&revolve_art(&n).unwrap(), &keyed); + assert_eq!(drawn.len(), faces.len()); + assert_eq!(misordered(&drawn), None, "an object"); + let mut g = Node::group(NodeId(9), vec![Arc::new(node(path))]); + g.appearance.effects.push(crate::new_effect(REVOLVE, ¶ms()).unwrap()); + let drawn = drawn_order(&revolve_art(&g).unwrap(), &keyed); + assert_eq!(drawn.len(), faces.len()); + assert_eq!(misordered(&drawn), None, "a group's member"); +} + +/// The faces of a group's members, sorted together by the depths of their middles, go in the order +/// of their depths where they overlap, those of two members as well as those of one. +#[test] +fn a_revolved_groups_members_draw_the_nearer_of_two_overlapping_faces_last() { + let p = json!({"angle": 270, "offset": 12, "rotationX": -30, "rotationY": 0, "perspectiveAngle": 0, "segments": 16, "cap": true}); + let members: Vec = (0..5).map(dash).collect(); + let b = dashes().bounds().unwrap(); + let mut faces: Vec<_> = members.iter().flat_map(|m| vectorcraft_three_d::revolve(m, b, revolve_options(&p)).unwrap()).collect(); + faces.sort_by(|a, b| a.depth.total_cmp(&b.depth)); + let by_depth: Vec<_> = faces.iter().map(|f| (f.points.clone(), f.plane)).collect(); + assert!(misordered(&by_depth).is_some(), "the faces by depth are drawn the wrong way round somewhere"); + let keyed: Vec<_> = faces.iter().map(|f| (f.points.clone(), f.plane, f.path())).collect(); + let mut g = Node::group(NodeId(9), members.into_iter().map(|m| Arc::new(node(m))).collect()); + g.appearance.effects.push(crate::new_effect(REVOLVE, &p).unwrap()); + let drawn = drawn_order(&revolve_art(&g).unwrap(), &keyed); + assert_eq!(drawn.len(), faces.len()); + assert_eq!(misordered(&drawn), None); +} + +/// Revolve (Classic) draws the nearer of two overlapping facets last where they overlap, too. +#[test] +fn a_classic_revolved_surface_draws_the_nearer_of_two_overlapping_facets_last() { + let path = dashes(); + // Revolve (Classic) sweeps its surface unshaded, with one facet for each cell. + let classic = vectorcraft_three_d::Revolve { + shade: false, + smooth_shading: false, + lights: None, + light_color: [1.0; 3], + ..revolve_options(&crate::merged_params(CLASSIC_REVOLVE, &classic_params())) + }; + let facets = vectorcraft_three_d::revolve_facets(&path, path.bounds().unwrap(), classic).unwrap(); + let by_depth: Vec<_> = facets.iter().map(|f| (f.contours[0].clone(), f.plane)).collect(); + assert!(misordered(&by_depth).is_some(), "the facets by depth are drawn the wrong way round somewhere"); + let keyed: Vec<_> = facets.iter().map(|f| (f.contours[0].clone(), f.plane, f.path())).collect(); + let mut n = node(path); + n.appearance.effects.push(crate::new_effect(CLASSIC_REVOLVE, &classic_params()).unwrap()); + let drawn = drawn_order(&revolve_art(&n).unwrap(), &keyed); + assert_eq!(drawn.len(), facets.len()); + assert_eq!(misordered(&drawn), None); +} + +/// A surface whose faces by depth are already drawn the right way round wherever they overlap keeps +/// that order. +#[test] +fn a_surface_already_in_order_keeps_it() { + let path = vase(); + let p = json!({"angle": 360, "offset": 12, "rotationX": 0, "rotationY": 0, "segments": 24, "cap": true}); + let faces = vectorcraft_three_d::revolve(&path, path.bounds().unwrap(), revolve_options(&p)).unwrap(); + let by_depth: Vec<_> = faces.iter().map(|f| (f.points.clone(), f.plane)).collect(); + assert_eq!(misordered(&by_depth), None); + let order = surface_order(faces.iter().map(|f| (f.points.as_slice(), f.plane, f.depth))); + assert_eq!(order, (0..faces.len()).collect::>()); +} + +/// Of two overlapping faces, the one nearer the viewer where they overlap goes after the other, +/// whatever their depths; a face without a plane, and one that overlaps neither, keep their places. +/// Two faces at the same depth there keep their order. +#[test] +fn surface_order_puts_the_nearer_face_where_they_overlap_last() { + let square = |x: f64| vec![Point::new(x, 0.0), Point::new(x + 10.0, 0.0), Point::new(x + 10.0, 10.0), Point::new(x, 10.0)]; + // z = 10 - x: at the middle of its overlap with the next square (x 7.5) it is at z 2.5. + let r = std::f64::consts::FRAC_1_SQRT_2; + let sloped = Some(DepthPlane { normal: [r, 0.0, r], offset: 10.0 * r, center: Point::ZERO, eye: None }); + let flat = |z: f64| Some(DepthPlane { normal: [0.0, 0.0, 1.0], offset: z, center: Point::ZERO, eye: None }); + let (a, b, apart) = (square(0.0), square(5.0), square(40.0)); + let faces = [(&a[..], sloped, 5.0), (&apart[..], flat(0.0), 1.0), (&b[..], flat(3.0), 3.0)]; + assert_eq!(surface_order(faces), vec![0, 1, 2], "the flat face, nearer at the overlap, is already last"); + let faces = [(&b[..], flat(2.0), 2.0), (&apart[..], flat(0.0), 3.0), (&a[..], sloped, 5.0)]; + assert_eq!(surface_order(faces), vec![0, 1, 2], "the sloped face, nearer at the overlap, is already last"); + // The sloped face's middle (x 5) is at z 5, but the flat face at z 3 is nearer at the overlap. + let faces = [(&b[..], flat(3.0), 3.0), (&apart[..], flat(0.0), 4.0), (&a[..], sloped, 5.0)]; + assert_eq!(surface_order(faces), vec![1, 2, 0], "the flat face is nearer at the overlap"); + let faces = [(&b[..], None, 3.0), (&apart[..], flat(0.0), 4.0), (&a[..], sloped, 5.0)]; + assert_eq!(surface_order(faces), vec![0, 1, 2], "no plane"); + let faces = [(&b[..], flat(2.5), 3.0), (&a[..], sloped, 5.0)]; + assert_eq!(surface_order(faces), vec![0, 1], "the same depth there"); +} diff --git a/crates/effects/src/solids/wireframe.rs b/crates/effects/src/solids/wireframe.rs index e6e7d89ab5..1e19a21c15 100644 --- a/crates/effects/src/solids/wireframe.rs +++ b/crates/effects/src/solids/wireframe.rs @@ -4,13 +4,13 @@ use std::collections::{HashMap, HashSet, VecDeque}; use std::sync::Arc; use vectorcraft_doc::color::{Color, Paint}; -use vectorcraft_doc::{Appearance, Document, Effect, Node, NodeId}; +use vectorcraft_doc::{Appearance, AppearanceItem, Document, Effect, FillLayer, Node, NodeId}; use vectorcraft_geom::{Anchor, CubicBez, PathData, Point, SubPath}; use vectorcraft_three_d::Facet; use super::{ - Profile, ROTATE, built_solids, facets, geometry, has_solid, is_container, is_plane, is_three_d, label_of, members, object_profile, region, - reshape_members, resolve, resolve_for, solid, solid_paint_sources, solid_parts, union_bounds, + CLASSIC_EXTRUDE, CLASSIC_ROTATE, Profile, ROTATE, built_solids, facets, geometry, has_solid, is_container, is_plane, is_three_d, label_of, + members, object_profile, region, reshape_members, resolve, resolve_for, solid, solid_paint_sources, solid_parts, union_bounds, }; use crate::{GeomContext, is_geometry}; @@ -54,7 +54,7 @@ pub fn three_d_wireframe_in(doc: Option<&Document>, n: &Node) -> Result = after_geometry(doc, n, faces, revolve).into_iter().map(|f| f.path).collect(); let wire = edges(&faces)?; if wire.is_empty() { return Err(format!("{label} draws no faces for this object")); @@ -65,29 +65,46 @@ pub fn three_d_wireframe_in(doc: Option<&Document>, n: &Node) -> Result, n: &Node, faces: Vec, revolve: bool) -> Vec { +fn after_geometry(doc: Option<&Document>, n: &Node, faces: Vec, revolve: bool) -> Vec { let fx = &n.appearance.effects; let drawn = if revolve { fx.iter().position(|e| e.visible && crate::revolve::is_revolve(&e.id)) } else { solid(fx).map(|(i, _)| i) }; let Some(index) = drawn else { return faces }; reshaped(faces, fx.get(index + 1..).unwrap_or_default(), &GeomContext { doc, ..GeomContext::of(n) }) } +/// One face of a drawn 3D surface: its outline and the width of the stroke the canvas draws around +/// it (the seam between faces, or a wire edge), which a later Outline Stroke outlines. +pub(crate) struct WireFace { + pub(crate) path: PathData, + pub(crate) stroke: f64, +} + /// `faces` reshaped by the visible geometry effects in `later` (the effects after a 3D effect), as /// they reshape the faces of the drawn surface ([`crate::reshape::reshape_leaves`]): each effect /// reshapes each face on its own, about the bounds all the faces have before it, and the faces keep -/// to one budget of anchors together. `ctx` gives the object's id, the seed of a random Transform, -/// and the document. -pub(crate) fn reshaped(faces: Vec, later: &[Effect], ctx: &GeomContext) -> Vec { +/// to one budget of anchors together. Each face is filled and carries its round-joined stroke, as on +/// the canvas, so an Outline Stroke outlines that stroke. `ctx` gives the object's id, the seed of a +/// random Transform, and the document. +pub(crate) fn reshaped(faces: Vec, later: &[Effect], ctx: &GeomContext) -> Vec { let after: Vec<&Effect> = later.iter().filter(|e| e.visible && is_geometry(&e.id)).collect(); if after.is_empty() { return faces; } let id = NodeId(ctx.seed); - let fill = Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0); - let mut art = Node::group(id, faces.into_iter().map(|f| Arc::new(Node::path(id, f, fill.clone()))).collect()); + let paint = Paint::solid(Color::BLACK); + let face = |f: WireFace| { + let items = + vec![AppearanceItem::Fill(FillLayer::new(paint.clone())), AppearanceItem::Stroke(crate::lighting::seam_stroke(paint.clone(), f.stroke))]; + Arc::new(Node::path(id, f.path, Appearance { items, ..Default::default() })) + }; + let mut art = Node::group(id, faces.into_iter().map(face).collect()); crate::reshape::reshape_leaves(&mut art, &after, later, ctx.doc); let mut out = vec![]; - art.walk(&mut |c| out.extend(c.path_data().cloned())); + art.walk(&mut |c| { + if let Some(path) = c.path_data() { + out.push(WireFace { path: path.clone(), stroke: c.appearance.stroke().map_or(0.0, |s| s.width) }); + } + }); out } @@ -95,7 +112,7 @@ pub(crate) fn reshaped(faces: Vec, later: &[Effect], ctx: &GeomContext /// on the object, its solids; with it on fills and strokes, the solid of each; on a group or layer, /// the solids of its members, about one shared axis. The swatches and patterns named by a live-effect /// plug-in after a fill's or stroke's 3D effect are looked up in `doc`. -fn solid_face_paths(doc: Option<&Document>, n: &Node) -> Result, String> { +fn solid_face_paths(doc: Option<&Document>, n: &Node) -> Result, String> { if is_container(n) { let (index, fx) = solid(&n.appearance.effects).ok_or("a 3D effect on a group's fill or stroke draws nothing")?; let mut shapes = members(n, label_of(&fx.id))?; @@ -126,17 +143,20 @@ fn solid_face_paths(doc: Option<&Document>, n: &Node) -> Result, S /// Rotate (Classic) turn every fill and stroke; Extrude & Bevel and Inflate build a solid from each shape's /// top fill and from the outline of each stroke. A stroke whose solid is past the limits is left out, /// as it is left out of the drawn art; past the limits of the object's solids together, the result -/// is an error, as the canvas draws the source art. -fn facet_paths(fx: &Effect, shapes: &[Profile]) -> Result, String> { +/// is an error, as the canvas draws the source art. Each facet carries the width of the stroke the +/// canvas draws around it. +fn facet_paths(fx: &Effect, shapes: &[Profile]) -> Result, String> { let label = label_of(&fx.id); let b = union_bounds(shapes).ok_or_else(|| format!("{label} requires a shape with at least two anchors"))?; let p = crate::merged_params(&fx.id, &fx.params); + let classic = fx.id == CLASSIC_EXTRUDE || fx.id == CLASSIC_ROTATE; + let face = |f: &Facet| WireFace { path: f.path(), stroke: if classic { super::classic::stroke_width(f, &p) } else { super::seam_width(f) } }; let mut out = vec![]; if is_plane(&fx.id) { for s in shapes { for item in &s.items { let (area, rule) = region(&s.path, s.rule, item); - out.extend(facets(ROTATE, &area, rule, b, &p)?.iter().map(Facet::path)); + out.extend(facets(ROTATE, &area, rule, b, &p)?.iter().map(face)); } } return Ok(out); @@ -144,7 +164,7 @@ fn facet_paths(fx: &Effect, shapes: &[Profile]) -> Result, String> let (parts, bounds) = solid_parts(shapes, b); // The solids the art draws, each past the limits of the object's solids together as it is. for f in built_solids(&fx.id, &p, &parts, bounds, vectorcraft_three_d::MAX_OBJECT_FACES) { - out.extend(f?.iter().flatten().map(Facet::path)); + out.extend(f?.iter().flatten().map(face)); } Ok(out) } diff --git a/crates/effects/src/solids/wireframe/tests.rs b/crates/effects/src/solids/wireframe/tests.rs index 792fbdb28a..3d92d3d277 100644 --- a/crates/effects/src/solids/wireframe/tests.rs +++ b/crates/effects/src/solids/wireframe/tests.rs @@ -163,13 +163,43 @@ fn revolve_classic_and_rotate_classic_expand_too() { fn later_geometry_effects_reshape_each_face_on_its_own() { let n = solid_square(super::super::EXTRUDE, json!({})); let fx = [crate::new_effect("path.offsetPath", &json!({"offset": 1.0})).unwrap()]; - let out = reshaped(vec![square(0.0, 0.0, 10.0), square(10.0, 0.0, 10.0)], &fx, &GeomContext::of(&n)); - assert_eq!(out.len(), 2, "{out:?}"); - let (a, b) = (out[0].bounds().unwrap(), out[1].bounds().unwrap()); + let faces = [square(0.0, 0.0, 10.0), square(10.0, 0.0, 10.0)].map(|path| WireFace { path, stroke: 0.75 }); + let out = reshaped(faces.into(), &fx, &GeomContext::of(&n)); + assert_eq!(out.len(), 2); + let (a, b) = (out[0].path.bounds().unwrap(), out[1].path.bounds().unwrap()); assert!((a.x0 + 1.0).abs() < 1e-3 && (a.x1 - 11.0).abs() < 1e-3, "{a:?}"); assert!((b.x0 - 9.0).abs() < 1e-3 && (b.x1 - 21.0).abs() < 1e-3, "{b:?}"); } +/// An Outline Stroke after a 3D effect outlines the stroke each face is drawn with (the seam between +/// faces, or a Classic wire edge), not a plain 1 pt stroke: the wireframe covers the outlined faces +/// the canvas draws, in the same place. +#[test] +fn a_later_outline_stroke_outlines_the_stroke_each_face_is_drawn_with() { + let outline = || crate::new_effect("path.outlineStroke", &json!({})).unwrap(); + let cases = [ + (super::super::EXTRUDE, json!({})), + (super::super::CLASSIC_EXTRUDE, json!({})), + (super::super::CLASSIC_EXTRUDE, json!({"surface": "wireframe"})), + (super::super::INFLATE, json!({})), + (ROTATE, json!({})), + (crate::REVOLVE, json!({})), + (crate::CLASSIC_REVOLVE, json!({})), + (crate::CLASSIC_REVOLVE, json!({"surface": "wireframe"})), + ]; + for (id, params) in cases { + let mut n = solid_square(id, params.clone()); + n.appearance.effects.push(outline()); + let wire = three_d_wireframe_in(None, &n).unwrap_or_else(|e| panic!("{id} {params}: {e}")); + let art = if crate::revolve::is_revolve(id) { crate::revolve_art(&n) } else { super::super::solid_art(&n) }.unwrap(); + let drawn = crate::group::shape_art(None, &art, None).unwrap(); + let (w, a) = (bounds(&wire), bounds(&face_paths(&drawn))); + for (x, y) in [(w.x0, a.x0), (w.y0, a.y0), (w.x1, a.x1), (w.y1, a.y1)] { + assert!((x - y).abs() < 1e-6, "{id} {params}: {w:?} {a:?}"); + } + } +} + /// A geometry effect after a fill's 3D effect moves that fill's edges, as it moves its drawn surface. #[test] fn a_geometry_effect_after_a_fill_s_3d_effect_reshapes_its_edges() { diff --git a/crates/effects/src/tests.rs b/crates/effects/src/tests.rs index 627cc1be03..c43d383c19 100644 --- a/crates/effects/src/tests.rs +++ b/crates/effects/src/tests.rs @@ -4,6 +4,7 @@ use vectorcraft_geom::{Affine, PathData, Point, Rect, Shape, SubPath, shapes}; use super::*; +mod clipfx; mod imageoutline; mod painted; mod rasterfollow; @@ -1570,6 +1571,27 @@ fn outline_object_is_a_geometry_effect_that_keeps_the_path() { assert_eq!(apply_geometry(&[fx("path.outlineObject", json!({})), offset.clone()], &square(), b), apply_geometry(&[offset], &square(), b)); } +/// A symbol instance given to Pathfinder and compound shapes as its art: the group takes the +/// instance's box angle and the art turns with it, turned with the instance or reset to 0. +#[test] +fn outline_object_turns_an_instances_art_with_its_box() { + use std::sync::Arc; + + use vectorcraft_doc::orient::transformed_angle; + use vectorcraft_doc::{Appearance, Document, NodeId, Symbol}; + let mut d = Document::new(500.0, 500.0); + d.symbols.push(Symbol { dynamic: false, name: "s".into(), art: Arc::new(Node::path(NodeId(0), square(), Appearance::default())) }); + let xf = Affine::translate((200.0, 100.0)) * Affine::rotate(0.35); + for box_angle in [transformed_angle(0.0, xf), 0.0] { + let mut inst = Node::new(NodeId(3), NodeKind::SymbolInstance { symbol: "s".into(), xf }); + inst.bbox_angle = box_angle; + let out = outline_object(Some(&d), &inst).unwrap(); + let mut angles = vec![]; + out.walk(&mut |c| angles.push(c.bbox_angle)); + assert!(angles.len() == 2 && angles.iter().all(|a| close(*a, box_angle, 1e-9)), "{box_angle}: {angles:?}"); + } +} + #[test] fn convert_to_shape_sizes() { let r = run("convertToShape.rectangle", json!({"extraW": 20, "extraH": 10}), &square()).bounds().unwrap(); diff --git a/crates/effects/src/tests/clipfx.rs b/crates/effects/src/tests/clipfx.rs new file mode 100644 index 0000000000..370f32fa81 --- /dev/null +++ b/crates/effects/src/tests/clipfx.rs @@ -0,0 +1,401 @@ +//! Live effects on the clipping path of a clip group: the region it clips to takes the shape its +//! geometry effects give it, on the canvas as in an export. + +use std::sync::Arc; + +use serde_json::{Value, json}; +use vectorcraft_color::{Color, Paint}; +use vectorcraft_doc::{Appearance, Document, Effect, Node, NodeId, NodeKind}; +use vectorcraft_geom::{Rect, Shape, shapes}; + +use crate::{bake_document, clip_outline}; + +fn fx(id: &str, params: Value) -> Effect { + Effect { id: id.into(), params, visible: true } +} + +/// A 100 pt square clipping path at (50, 50) with `effects`. +fn clipping_path(id: u64, effects: Vec) -> Node { + let mut p = Node::path(NodeId(id), shapes::rectangle(Rect::new(50.0, 50.0, 150.0, 150.0)), Appearance::default()); + if let NodeKind::Path { clipping, .. } = &mut p.kind { + *clipping = true; + } + p.appearance.effects = effects; + p +} + +/// A clip group: `clip` clipping a red 200 pt square at the origin. +fn clip_group(id: u64, clip: Node) -> Node { + let art = Node::path( + NodeId(id + 100), + shapes::rectangle(Rect::new(0.0, 0.0, 200.0, 200.0)), + Appearance::basic(Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0), + ); + Node::new(NodeId(id), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(art)], clip: true }) +} + +fn bounds(n: &Node) -> Rect { + clip_outline(n).map(|(bp, _)| bp.bounding_box()).unwrap() +} + +/// The clipping path of the first clip group in `doc` after an export bakes it. +fn baked_clip(doc: &Document) -> Arc { + fn first(n: &Arc) -> Option> { + match &n.kind { + NodeKind::Group { children, clip: true } => children.first().cloned(), + _ => n.children()?.iter().find_map(first), + } + } + let baked = bake_document(doc).unwrap(); + baked.layers.iter().find_map(first).unwrap() +} + +#[test] +fn transform_moves_the_clip() { + let clip = clipping_path(1, vec![fx("distort.transform", json!({"moveH": 60}))]); + let b = bounds(&clip); + assert!((b.x0 - 110.0).abs() < 1e-6 && (b.x1 - 210.0).abs() < 1e-6, "the clip moves with the clipping path: {b:?}"); + assert!((b.y0 - 50.0).abs() < 1e-6 && (b.y1 - 150.0).abs() < 1e-6, "{b:?}"); +} + +#[test] +fn roughen_clips_as_an_export_does() { + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + let group = clip_group(1, clipping_path(2, vec![fx("distort.roughen", json!({"size": 10, "detail": 10, "relative": false}))])); + d.insert(Some(layer), 0, group.clone()).unwrap(); + let NodeKind::Group { children, .. } = &group.kind else { panic!("not a group") }; + let live = clip_outline(&children[0]).unwrap(); + let exported = clip_outline(&baked_clip(&d)).unwrap(); + assert_eq!(live.1, exported.1); + assert_eq!(live.0, exported.0, "the canvas clips by the outline the export writes"); + assert_ne!(live.0.bounding_box(), Rect::new(50.0, 50.0, 150.0, 150.0), "the roughened outline, not the plain square"); +} + +#[test] +fn nested_members_keep_their_effects() { + // A group as the clipping path: its member's Transform effect moves its part of the region. + let moved = clipping_path(2, vec![fx("distort.transform", json!({"moveV": 60}))]); + let group = Node::group(NodeId(1), vec![Arc::new(moved)]); + let b = bounds(&group); + assert!((b.y0 - 110.0).abs() < 1e-6 && (b.y1 - 210.0).abs() < 1e-6, "{b:?}"); + // A clip group as the clipping path clips by its own clipping path, effects and all. + let nested = clip_group(3, clipping_path(4, vec![fx("distort.transform", json!({"moveH": -30}))])); + let b = bounds(&nested); + assert!((b.x0 - 20.0).abs() < 1e-6 && (b.x1 - 120.0).abs() < 1e-6, "{b:?}"); + // So does the nested clip group's own effect. + let mut nested = clip_group(7, clipping_path(8, vec![])); + nested.appearance.effects.push(fx("distort.transform", json!({"moveH": 30}))); + let b = bounds(&nested); + assert!((b.x0 - 80.0).abs() < 1e-6 && (b.x1 - 180.0).abs() < 1e-6, "{b:?}"); + // The group's own Transform effect applies on top of its members'. + let mut group = Node::group(NodeId(5), vec![Arc::new(clipping_path(6, vec![fx("distort.transform", json!({"moveV": 60}))]))]); + group.appearance.effects.push(fx("distort.transform", json!({"moveH": 10}))); + let b = bounds(&group); + assert!((b.x0 - 60.0).abs() < 1e-6 && (b.y0 - 110.0).abs() < 1e-6, "{b:?}"); +} + +#[test] +fn a_roughened_group_clips_as_an_export_does() { + // Two members side by side, Roughen on the group: each member is roughened, as in the export. + let member = |id: u64, x: f64| { + Arc::new(Node::path( + NodeId(id), + shapes::rectangle(Rect::new(x, 50.0, x + 40.0, 150.0)), + Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0), + )) + }; + let mut clip = Node::group(NodeId(2), vec![member(3, 50.0), member(4, 110.0)]); + clip.appearance.effects.push(fx("distort.roughen", json!({"size": 10, "detail": 10, "relative": false}))); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, clip_group(1, clip.clone())).unwrap(); + let live = clip_outline(&clip).unwrap(); + assert_eq!(live.0, clip_outline(&baked_clip(&d)).unwrap().0, "the canvas clips by the outline the export writes"); + assert_ne!(live.0.bounding_box(), Rect::new(50.0, 50.0, 150.0, 150.0)); +} + +#[test] +fn a_compound_paths_member_keeps_its_effect() { + // A ring whose hole a Transform effect moves 20 pt right, as the export bakes it. + let ring = |effects: Vec| { + let outer = Node::path(NodeId(3), shapes::rectangle(Rect::new(50.0, 50.0, 150.0, 150.0)), Appearance::default()); + let mut hole = Node::path(NodeId(4), shapes::rectangle(Rect::new(75.0, 75.0, 125.0, 125.0)), Appearance::default()); + hole.appearance.effects = effects; + Node::new(NodeId(2), NodeKind::Compound { children: vec![Arc::new(outer), Arc::new(hole)], rule: vectorcraft_geom::FillRule::EvenOdd }) + }; + let moved = ring(vec![fx("distort.transform", json!({"moveH": 20}))]); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, clip_group(1, moved.clone())).unwrap(); + let live = clip_outline(&moved).unwrap(); + assert_eq!(live, clip_outline(&baked_clip(&d)).unwrap(), "the canvas clips by the outline the export writes"); + assert_ne!(live, clip_outline(&ring(vec![])).unwrap(), "the hole moves"); + // With a Transform of the compound path's own moving the whole ring 10 pt down after it. + let mut both = moved.clone(); + both.appearance.effects.push(fx("distort.transform", json!({"moveV": 10}))); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, clip_group(1, both.clone())).unwrap(); + let live = clip_outline(&both).unwrap(); + assert_eq!(live, clip_outline(&baked_clip(&d)).unwrap(), "the canvas clips by the outline the export writes"); + assert_ne!(live.0.bounding_box(), clip_outline(&moved).unwrap().0.bounding_box(), "the ring moves down"); +} + +#[test] +fn the_clipping_paths_effects_apply_before_the_clip_groups() { + // Scale 50 % on the clipping path, then Offset Path 10 on its clip group: the region is the + // half-size square grown by 10, as if the clipping path had been drawn at half size. + let group = |clip: Node| { + let mut g = clip_group(1, clip); + g.appearance.effects.push(fx("path.offsetPath", json!({"offset": 10}))); + g + }; + let scaled = group(clipping_path(2, vec![fx("distort.transform", json!({"scaleH": 50, "scaleV": 50}))])); + let mut half = clipping_path(2, vec![]); + if let NodeKind::Path { path, .. } = &mut half.kind { + *path = shapes::rectangle(Rect::new(75.0, 75.0, 125.0, 125.0)); + } + let want = bounds(&group(half)); + let got = bounds(&scaled); + assert!((got.x0 - want.x0).abs() < 0.5 && (got.x1 - want.x1).abs() < 0.5, "{got:?} against {want:?}"); + assert!((want.x0 - 65.0).abs() < 0.5, "{want:?}"); + // The clip group as the canvas evaluates it for its effect, and as an export bakes it. + let evaluated = crate::evaluate_container(None, &scaled).unwrap(); + let NodeKind::Group { children, clip: true } = &evaluated.kind else { panic!("not a clip group") }; + let b = clip_outline(&children[0]).unwrap().0.bounding_box(); + assert!((b.x0 - want.x0).abs() < 0.5 && (b.x1 - want.x1).abs() < 0.5, "evaluated: {b:?} against {want:?}"); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, scaled).unwrap(); + let b = clip_outline(&baked_clip(&d)).unwrap().0.bounding_box(); + assert!((b.x0 - want.x0).abs() < 0.5 && (b.x1 - want.x1).abs() < 0.5, "exported: {b:?} against {want:?}"); +} + +#[test] +fn nested_effects_apply_before_the_clip_groups() { + // The clip group grows its clipping path by 10 (Offset Path). Inside the clipping path a + // Transform moves a member 60 pt right: the region grows from the moved member. + let evaluated = |clip: Node| { + let mut g = clip_group(1, clip); + g.appearance.effects.push(fx("path.offsetPath", json!({"offset": 10}))); + let e = crate::evaluate_container(None, &g).unwrap(); + let NodeKind::Group { children, clip: true } = &e.kind else { panic!("not a clip group") }; + clip_outline(&children[0]).unwrap().0.bounding_box() + }; + let moved = || clipping_path(3, vec![fx("distort.transform", json!({"moveH": 60}))]); + let close = |a: Rect, b: Rect| (a.x0 - b.x0).abs() < 0.5 && (a.x1 - b.x1).abs() < 0.5 && (a.y0 - b.y0).abs() < 0.5; + let want = Rect::new(100.0, 40.0, 220.0, 160.0); + // A group holding the member. + let b = evaluated(Node::group(NodeId(2), vec![Arc::new(moved())])); + assert!(close(b, want), "group: {b:?}"); + // A compound path of the member, with a Transform of its own moving it 10 pt down. + let mut compound = Node::new(NodeId(2), NodeKind::Compound { children: vec![Arc::new(moved())], rule: vectorcraft_geom::FillRule::NonZero }); + compound.appearance.effects.push(fx("distort.transform", json!({"moveV": 10}))); + let b = evaluated(compound); + assert!(close(b, Rect::new(100.0, 50.0, 220.0, 170.0)), "compound: {b:?}"); +} + +#[test] +fn clipping_type_keeps_its_effect_where_other_type_stays_type() { + // Type moved 30 pt right by its Transform clips a red square, beside other type, in a group + // that a Transform moves 10 pt down: the export keeps the other type as type and outlines the + // clipping type, which still clips where the canvas clips. + use vectorcraft_doc::text::{CharStyle, TextObject}; + let text = |id: u64, effects: Vec| { + let style = CharStyle { size: 40.0, fill: Paint::solid(Color::BLACK), ..Default::default() }; + let mut t = Node::new(NodeId(id), NodeKind::Text(Box::new(TextObject::point(vectorcraft_geom::Point::new(5.0, 60.0), "IIII", style)))); + t.appearance.effects = effects; + t + }; + let clipped = clip_group(2, text(3, vec![fx("distort.transform", json!({"moveH": 30}))])); + let mut outer = Node::group(NodeId(1), vec![Arc::new(clipped), Arc::new(text(5, vec![]))]); + outer.appearance.effects.push(fx("distort.transform", json!({"moveV": 10}))); + fn clip_of(n: &Node) -> Option { + match &n.kind { + NodeKind::Group { children, clip: true } => Some(clip_outline(children.first()?)?.0.bounding_box()), + _ => n.children()?.iter().find_map(|c| clip_of(c)), + } + } + if vectorcraft_text::CRAFT_FONTS.is_empty() { + eprintln!("skipped: built without craft-fonts (set CRAFT_FONTS_DIR to a craft-fonts checkout to run it)"); + return; + } + let plain = clip_outline(&text(3, vec![])).unwrap().0.bounding_box(); + let canvas = clip_of(&crate::evaluate_container(None, &outer).unwrap()).unwrap(); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, outer).unwrap(); + let baked = bake_document(&d).unwrap(); + let mut exported = None; + for l in &baked.layers { + exported = exported.or_else(|| clip_of(l)); + } + let exported = exported.unwrap(); + assert!((canvas.x0 - plain.x0 - 30.0).abs() < 0.5 && (canvas.y0 - plain.y0 - 10.0).abs() < 0.5, "{canvas:?} from {plain:?}"); + assert!((exported.x0 - canvas.x0).abs() < 0.5 && (exported.y0 - canvas.y0).abs() < 0.5, "exported {exported:?}, canvas {canvas:?}"); + // The outlined clipping type keeps its black fill, which paints behind the clipped art. + let outlined = crate::reshape::clipping_text_outline(&text(3, vec![fx("distort.transform", json!({"moveH": 30}))])).unwrap(); + fn fills(n: &Node) -> usize { + n.appearance.items.iter().filter(|i| matches!(i, vectorcraft_doc::AppearanceItem::Fill(f) if f.paint != Paint::None)).count() + + n.children().into_iter().flatten().map(|c| fills(c)).sum::() + } + assert!(fills(&outlined) > 0, "{outlined:?}"); +} + +#[test] +fn a_painted_clipping_paths_gradient_follows_its_effect() { + // A clipping path filled with a gradient placed across it, moved 60 pt right by its Transform + // effect, in a clip group with an effect of its own: the gradient moves with the path. + use vectorcraft_color::{Gradient, GradientGeom, GradientKind, GradientPaint, GradientStop}; + let stops = vec![GradientStop::new(0.0, Color::BLACK), GradientStop::new(1.0, Color::WHITE)]; + let geom = GradientGeom { start: (50.0, 100.0).into(), end: (150.0, 100.0).into(), aspect: 1.0, focal: None }; + let placed = Paint::Gradient(Box::new(GradientPaint { geom: Some(geom), ..GradientPaint::new(Gradient::new(GradientKind::Linear, stops)) })); + let mut clip = clipping_path(2, vec![fx("distort.transform", json!({"moveH": 60}))]); + clip.appearance = Appearance { effects: clip.appearance.effects.clone(), ..Appearance::basic(placed, Paint::None, 0.0) }.into(); + let mut group = clip_group(1, clip); + group.appearance.effects.push(fx("path.offsetPath", json!({"offset": 0}))); + let evaluated = crate::evaluate_container(None, &group).unwrap(); + let NodeKind::Group { children, clip: true } = &evaluated.kind else { panic!("not a clip group") }; + let Paint::Gradient(g) = children[0].appearance.fill_paint() else { panic!("no gradient") }; + let start = g.geom.unwrap().start; + assert!((start.x - 110.0).abs() < 1e-6, "the gradient starts at the moved path's left edge: {start:?}"); +} + +#[test] +fn a_nested_clip_groups_hidden_clipping_path_keeps_its_effect() { + // A clip group used as a clipping path clips by its clipping path whether it is shown or not. + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + let mut hidden = clipping_path(4, vec![fx("distort.transform", json!({"moveH": -30}))]); + hidden.visible = false; + let outer = clip_group(1, clip_group(3, hidden)); + d.insert(Some(layer), 0, outer.clone()).unwrap(); + let NodeKind::Group { children, .. } = &outer.kind else { panic!("not a group") }; + let b = bounds(&children[0]); + assert!((b.x0 - 20.0).abs() < 1e-6 && (b.x1 - 120.0).abs() < 1e-6, "{b:?}"); + assert_eq!(clip_outline(&children[0]), clip_outline(&baked_clip(&d)), "the canvas clips by the outline the export writes"); +} + +#[test] +fn a_fills_geometry_effect_shapes_the_clip_as_an_export_does() { + // The clipping path's fill has a Transform effect moving it 60 pt right; the path has none. + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + let mut clip = clipping_path(2, vec![]); + clip.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 0.0)), Paint::None, 0.0).into(); + for item in &mut clip.appearance.items { + if let vectorcraft_doc::AppearanceItem::Fill(f) = item { + f.effects.push(fx("distort.transform", json!({"moveH": 60}))); + } + } + let group = clip_group(1, clip); + d.insert(Some(layer), 0, group.clone()).unwrap(); + let NodeKind::Group { children, .. } = &group.kind else { panic!("not a group") }; + let live = clip_outline(&children[0]).unwrap(); + let exported = clip_outline(&baked_clip(&d)).unwrap(); + assert_eq!(live.0.bounding_box(), exported.0.bounding_box(), "the canvas clips by the outline the export writes"); + assert!((live.0.bounding_box().x1 - 210.0).abs() < 1e-6, "the moved fill reaches 210: {:?}", live.0.bounding_box()); + // A path of a compound clipping path with a fill effect of its own stays part of the region. + let mut member = clipping_path(4, vec![]); + member.appearance = children[0].appearance.clone(); + let other = Node::path(NodeId(5), shapes::rectangle(Rect::new(0.0, 0.0, 20.0, 20.0)), Appearance::default()); + let compound = + Node::new(NodeId(3), NodeKind::Compound { children: vec![Arc::new(member), Arc::new(other)], rule: vectorcraft_geom::FillRule::NonZero }); + assert_eq!(bounds(&compound), Rect::new(0.0, 0.0, 150.0, 150.0)); +} + +#[test] +fn a_fills_geometry_effect_shapes_the_clip_before_the_effects_around_it() { + // Offset Path 10 on the fill of an unpainted clipping path, in a group that its Transform + // scales to 50 %: the region is the grown square at half size, 60 pt across, as it is when the + // clipping path is the member of a group that clips by its members. + let clip_with = |fill: Paint| { + let mut clip = clipping_path(3, vec![]); + clip.appearance = Appearance::basic(fill, Paint::None, 0.0).into(); + for item in &mut clip.appearance.items { + if let vectorcraft_doc::AppearanceItem::Fill(f) = item { + f.effects.push(fx("path.offsetPath", json!({"offset": 10}))); + } + } + clip + }; + let scaled = |clip: Node| { + let mut outer = Node::group(NodeId(1), vec![Arc::new(clip_group(2, clip))]); + outer.appearance.effects.push(fx("distort.transform", json!({"scaleH": 50, "scaleV": 50}))); + outer + }; + fn first_clip(n: &Node) -> Option> { + match &n.kind { + NodeKind::Group { children, clip: true } => children.first().cloned(), + _ => n.children()?.iter().find_map(|c| first_clip(c)), + } + } + let clip_of = |n: &Node| clip_outline(&first_clip(n).unwrap()).unwrap().0.bounding_box(); + let close = |r: Rect| (r.width() - 60.0).abs() < 0.5 && (r.height() - 60.0).abs() < 0.5; + let nested = clip_of(&crate::evaluate_container(None, &scaled(Node::group(NodeId(4), vec![Arc::new(clip_with(Paint::None))]))).unwrap()); + assert!(close(nested), "nested: {nested:?}"); + let outer = scaled(clip_with(Paint::None)); + let canvas = clip_of(&crate::evaluate_container(None, &outer).unwrap()); + assert!(close(canvas), "canvas: {canvas:?}"); + let mut d = Document::new(400.0, 400.0); + let layer = d.layers[0].id; + d.insert(Some(layer), 0, outer).unwrap(); + let baked = bake_document(&d).unwrap(); + let exported = baked.layers.iter().find_map(|l| first_clip(l)).map(|c| clip_outline(&c).unwrap().0.bounding_box()).unwrap(); + assert!(close(exported), "exported: {exported:?}"); + // A clipping path that paints its fill keeps it, a path with the fill's effect live. + let painted = first_clip(&crate::evaluate_container(None, &scaled(clip_with(Paint::solid(Color::BLACK)))).unwrap()).unwrap(); + assert!(painted.clip_paint().fill.is_some(), "{painted:?}"); +} + +#[test] +fn a_baked_clipping_path_gives_its_pieces_ids_of_their_own() { + // An unpainted clipping path whose fill and stroke have Transform effects, in a clip group + // without effects: the export bakes it into a piece for each, every object with its own id. + let mut d = Document::new(400.0, 400.0); + let (group, path) = (d.alloc_id(), d.alloc_id()); + let mut clip = clipping_path(path.0, vec![]); + clip.appearance = Appearance::basic(Paint::None, Paint::None, 1.0).into(); + for item in &mut clip.appearance.items { + match item { + vectorcraft_doc::AppearanceItem::Fill(f) => f.effects.push(fx("distort.transform", json!({"moveH": 60}))), + vectorcraft_doc::AppearanceItem::Stroke(s) => s.effects.push(fx("distort.transform", json!({"moveV": 60}))), + } + } + let layer = d.layers[0].id; + d.insert(Some(layer), 0, clip_group(group.0, clip)).unwrap(); + let baked = bake_document(&d).unwrap(); + let clip = baked_clip(&d); + assert_eq!(clip.children().map(|c| c.len()), Some(2), "{clip:?}"); + fn ids(n: &Node, out: &mut Vec) { + out.push(n.id); + for c in n.children().into_iter().flatten() { + ids(c, out); + } + } + let mut all = vec![]; + for l in &baked.layers { + ids(l, &mut all); + } + let unique: std::collections::HashSet<_> = all.iter().collect(); + assert_eq!(unique.len(), all.len(), "{all:?}"); +} + +#[test] +fn a_hidden_member_with_an_effect_adds_nothing() { + let shown = Node::path(NodeId(3), shapes::rectangle(Rect::new(50.0, 50.0, 100.0, 100.0)), Appearance::default()); + let mut hidden = clipping_path(4, vec![fx("distort.transform", json!({"moveH": 200}))]); + hidden.visible = false; + let group = Node::group(NodeId(2), vec![Arc::new(shown), Arc::new(hidden)]); + assert_eq!(bounds(&group), Rect::new(50.0, 50.0, 100.0, 100.0)); +} + +#[test] +fn raster_and_hidden_effects_leave_the_clip_as_it_is() { + let mut hidden = fx("distort.transform", json!({"moveH": 60})); + hidden.visible = false; + for effects in [vec![], vec![fx("blur.gaussian", json!({"radius": 10}))], vec![hidden]] { + assert_eq!(bounds(&clipping_path(1, effects)), Rect::new(50.0, 50.0, 150.0, 150.0)); + } +} diff --git a/crates/engine/src/cmd.rs b/crates/engine/src/cmd.rs index e43c1b55b1..b32932b1e5 100644 --- a/crates/engine/src/cmd.rs +++ b/crates/engine/src/cmd.rs @@ -440,6 +440,15 @@ pub(crate) fn f64_req(p: &Value, key: &str, cmd: &str) -> Result { Some(v) => v.as_f64().ok_or_else(|| bad(cmd, format!("`{key}` must be a number, not {v}"))), } } +/// The whole number of 0 or more that `p` gives for `key`. A missing key or null is "missing integer +/// `{key}`"; any other value, such as `"3"`, `2.5`, `-1` or `true`, is "`{key}` must be a whole +/// number", as [`object_param`] words it. +pub(crate) fn u64_req(p: &Value, key: &str, cmd: &str) -> Result { + match p.get(key) { + None | Some(Value::Null) => Err(bad(cmd, format!("missing integer `{key}`"))), + Some(v) => v.as_u64().ok_or_else(|| bad(cmd, format!("`{key}` must be a whole number"))), + } +} /// The number `p` gives for `key`, or `default` when `p` leaves it out or gives null. Any other /// value, such as `"40"`, is an error: "`{key}` must be a number, not {v}". pub(crate) fn number_or(p: &Value, key: &str, default: f64, cmd: &str) -> Result { @@ -550,6 +559,15 @@ pub(crate) fn given_object_ids(p: &Value, command: &str) -> Result usize { usize::try_from(v).unwrap_or(usize::MAX) } +/// The whole number of 0 or more that `p` gives for `key`, read with [`index`], or `None` when `p` +/// leaves it out or gives null. Any other value, such as `"3"`, `2.5`, `-1` or `true`, is an error +/// under `cmd`: "`{key}` must be a whole number". +pub(crate) fn index_opt(p: &Value, key: &str, cmd: &str) -> Result> { + match p.get(key) { + None | Some(Value::Null) => Ok(None), + Some(v) => v.as_u64().map(|n| Some(index(n))).ok_or_else(|| bad(cmd, format!("`{key}` must be a whole number"))), + } +} /// Validate all explicit targets before a command changes the document or selection. pub(crate) fn checked_ids_param(s: &Session, p: &Value, key: &str, command: &str) -> Result> { checked_nodes_param(s, p, key, command, false) diff --git a/crates/engine/src/cmd/addons/arrange.rs b/crates/engine/src/cmd/addons/arrange.rs index d7cae868ed..3dd2e0e43b 100644 --- a/crates/engine/src/cmd/addons/arrange.rs +++ b/crates/engine/src/cmd/addons/arrange.rs @@ -21,6 +21,7 @@ use vectorcraft_geom::{Affine, Point, Rect}; use vectorcraft_render::effects; use super::super::appearance::series_children_in_paint_order; +use super::super::colorcmds::edit_if_changed; use super::super::edit::selected_roots; use super::super::graph::capture_series_object_opacity; use super::super::menucmds::whole_or; @@ -92,7 +93,7 @@ pub fn specs() -> Vec { "Randomize Opacity", ["Object", "Plug-ins", "Arrange Tools"], None, - "{min?: % 0..100 (30), max?: % 0..100 (100; not less than min), seed?: whole number (0; the same seed, objects and range give the same opacities), ids?: [id…] (default: the selection)} give each selected object (the top-level ones) its own opacity, picked at random and evenly from min to max, as one undo step; it is the object's opacity, as the Transparency panel sets it. On paths directly in a graph series whose opacity changes, the graph stores the opacity and blend mode of the frontmost of them for its next redraw (docs/mcp.md) → {count}", + "{min?: % 0..100 (30), max?: % 0..100 (100; not less than min), seed?: whole number (0; the same seed, objects and range give the same opacities), ids?: [id…] (default: the selection)} give each selected object (the top-level ones) its own opacity, picked at random and evenly from min to max, as one undo step (none when no opacity changes); it is the object's opacity, as the Transparency panel sets it. On paths directly in a graph series whose opacity changes, the graph stores the opacity and blend mode of the frontmost of them for its next redraw (docs/mcp.md) → {count}", has_selection, randomize_opacity ), @@ -397,7 +398,8 @@ fn randomize_opacity(s: &mut Session, p: &Value) -> Result { return Ok(json!({ "count": 0 })); } let (lo, hi) = ((min / 100.0) as f32, (max / 100.0) as f32); - s.edit("Randomize Opacity", |d, _| { + // A run that gives every object the opacity it has records no undo step. + edit_if_changed(s, "Randomize Opacity", |_, d| { let mut changed = vec![]; for id in &ids { let o = rng.range(lo, hi); @@ -409,7 +411,7 @@ fn randomize_opacity(s: &mut Session, p: &Value) -> Result { } } keep_series_opacity(d, &changed); - Ok(()) + Ok(((), !changed.is_empty())) })?; Ok(json!({ "count": ids.len() })) } diff --git a/crates/engine/src/cmd/addons/arrange/tests.rs b/crates/engine/src/cmd/addons/arrange/tests.rs index 85191935b2..759f6f321e 100644 --- a/crates/engine/src/cmd/addons/arrange/tests.rs +++ b/crates/engine/src/cmd/addons/arrange/tests.rs @@ -393,6 +393,25 @@ fn randomize_opacity_takes_ids_and_leaves_the_rest() { assert_eq!((opacity(&s, g), opacity(&s, a), opacity(&s, b)), (0.2, 1.0, 1.0)); } +#[test] +fn randomize_opacity_records_no_undo_step_when_no_opacity_changes() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 5.0, 5.0); + let b = rect(&mut s, 10.0, 0.0, 5.0, 5.0); + select(&mut s, &[a, b]); + let n = steps(&s); + // Every object already has the one opacity the range allows. + let r = s.execute("addon.arrange.randomizeOpacity", &json!({"min": 100, "max": 100})).unwrap(); + assert_eq!(r["count"], json!(2)); + assert_eq!(steps(&s), n); + assert_eq!((opacity(&s, a), opacity(&s, b)), (1.0, 1.0)); + s.execute("addon.arrange.randomizeOpacity", &json!({"min": 40, "max": 40})).unwrap(); + assert_eq!(steps(&s), n + 1); + s.execute("addon.arrange.randomizeOpacity", &json!({"min": 40, "max": 40})).unwrap(); + assert_eq!(steps(&s), n + 1, "the same opacities again"); + assert_eq!((opacity(&s, a), opacity(&s, b)), (0.4, 0.4)); +} + #[test] fn randomize_opacity_refuses_bad_params() { let mut s = session(); diff --git a/crates/engine/src/cmd/addons/cleanup/text.rs b/crates/engine/src/cmd/addons/cleanup/text.rs index 052ba901ed..00d75e9888 100644 --- a/crates/engine/src/cmd/addons/cleanup/text.rs +++ b/crates/engine/src/cmd/addons/cleanup/text.rs @@ -45,7 +45,7 @@ pub fn specs() -> Vec { "Break Text", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{by?: \"lines\"|\"paragraphs\"|\"words\"|\"glyphs\" (lines), ids?: [id…] (default: the selection)} each horizontal point or area type object becomes point type objects, one per line, paragraph, word or glyph, each where its characters were and with their character styles, as one undo step; spaces between pieces go, a paragraph's lines stay lines (a wrapped line ends in a line break), justified lines close up, and a paragraph broken out whole keeps its bullet (not its number; other pieces have no list markers). Type on a path, vertical type, threaded type and area type whose text doesn't fit stay as they are → {ids (the pieces, selected), skipped}", + "{by?: \"lines\"|\"paragraphs\"|\"words\"|\"glyphs\" (lines), ids?: [id…] (default: the selection; the type they name is taken locked or hidden too)} each horizontal point or area type object becomes point type objects, one per line, paragraph, word or glyph, each where its characters were and with their character styles, as one undo step; spaces between pieces go, a paragraph's lines stay lines (a wrapped line ends in a line break), justified lines close up, and a paragraph broken out whole keeps its bullet (not its number; other pieces have no list markers). Type on a path, vertical type, threaded type and area type whose text doesn't fit stay as they are → {ids (the pieces, selected), skipped}", has_selection, break_text ), @@ -54,7 +54,7 @@ pub fn specs() -> Vec { "Combine Point Text", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{ids?: [id…] (default: the selection)} merge one-line horizontal point type into as few objects as it can, every glyph staying where it was: pieces turned and sheared alike whose baselines line up (within 0.4 em; the difference becomes baseline shift) join left to right, a space goes between pieces at least half a space apart, and tracking on the character before each piece keeps the spacing; each object keeps its character styles, and the leftmost piece of each run its place and paint, as one undo step → {ids (the objects made, selected), combined (pieces merged into them)}", + "{ids?: [id…] (default: the selection; the type they name is taken locked or hidden too)} merge one-line horizontal point type into as few objects as it can, every glyph staying where it was: pieces turned and sheared alike, as visible and as locked (their groups and layers included), whose baselines line up (within 0.4 em; the difference becomes baseline shift) join left to right, a space goes between pieces at least half a space apart, and tracking on the character before each piece keeps the spacing; each object keeps its character styles, and the leftmost piece of each run its place and paint, as one undo step → {ids (the objects made, selected), combined (pieces merged into them)}", has_selection, combine_text ), @@ -63,7 +63,7 @@ pub fn specs() -> Vec { "Join Point Text", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{ids?: [id…] (default: the selection)} join one-line horizontal point type into one point type object, as one undo step: pieces turned and sheared like the top-left one are read as lines (baselines within 0.4 em of each other), top to bottom, each line's pieces left to right with a space between them; each line becomes a paragraph, left aligned, and keeps the distance between baselines as its leading. The text keeps its character styles; the object takes the top-left piece's place and paint, and the other pieces go → {id (selected), joined (pieces merged into it), lines}", + "{ids?: [id…] (default: the selection; the type they name is taken locked or hidden too)} join one-line horizontal point type into one point type object, as one undo step: pieces turned and sheared like the top-left one, and as visible and as locked (their groups and layers included), are read as lines (baselines within 0.4 em of each other), top to bottom, each line's pieces left to right with a space between them; each line becomes a paragraph, left aligned, and keeps the distance between baselines as its leading. The text keeps its character styles; the object takes the top-left piece's place and paint, and the other pieces go → {id (selected), joined (pieces merged into it), lines}", has_selection, join_text ), @@ -72,7 +72,7 @@ pub fn specs() -> Vec { "Remove Breaks", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{kind: \"line\"|\"paragraph\", ids?: [id…]} remove the forced line breaks (line) or paragraph returns (paragraph) in the characters selected with a Type tool (after Select All in a frame of threaded text, in the text of every frame of the story), else in all the text of the selected type, as one undo step; a break between two words becomes a space, the frames of a threaded story selected all together being read as one text → {ids, removed}", + "{kind: \"line\"|\"paragraph\", ids?: [id…] (the type they name is taken locked or hidden too)} remove the forced line breaks (line) or paragraph returns (paragraph) in the characters selected with a Type tool (after Select All in a frame of threaded text, in the text of every frame of the story), else in all the text of the selected type, as one undo step; a break between two words becomes a space, the frames of a threaded story selected all together being read as one text → {ids, removed}", has_selection, remove_breaks ), @@ -90,7 +90,7 @@ pub fn specs() -> Vec { "Set Alignment, Keep Position", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{align: \"left\"|\"center\"|\"right\", ids?: [id…] (default: the selection)} align every paragraph of each horizontal point type object so, moving the object so its longest line stays where it is (one line: the text doesn't move), as one undo step → {ids (the objects changed)}", + "{align: \"left\"|\"center\"|\"right\", ids?: [id…] (default: the selection; the type they name is taken locked or hidden too)} align every paragraph of each horizontal point type object so, moving the object so its longest line stays where it is (one line: the text doesn't move), as one undo step → {ids (the objects changed)}", has_selection, align_in_place ), @@ -99,7 +99,7 @@ pub fn specs() -> Vec { "Reset Text Transform", ["Object", "Plug-ins", "Artwork Cleanup"], None, - "{scale?: bool (false: the horizontal scale stays; true: it goes too, the object's and every character's), ids?: [id…] (default: the selection)} take the rotation, shear and reflection off each point type object, its size and the centre of its text staying, as one undo step → {ids (the objects changed)}", + "{scale?: bool (false: the horizontal scale stays; true: it goes too, the object's and every character's), ids?: [id…] (default: the selection; the type they name is taken locked or hidden too)} take the rotation, shear and reflection off each point type object, its size and the centre of its text staying, as one undo step → {ids (the objects changed)}", has_selection, reset_transform ), @@ -123,8 +123,17 @@ fn editing_text(s: &Session) -> std::result::Result<(), String> { } } -/// The type objects under `roots` (inside groups and layers, not live art) that can be edited. -fn texts_under(d: &Document, roots: &[NodeId]) -> Result> { +/// The type objects a command acts on: those under the objects `ids` names, locked and hidden ones +/// included, else those under the selection that can be edited ([`texts_under`]). +fn target_texts(s: &Session, p: &Value, command: &str) -> Result> { + let named = p.get("ids").is_some_and(|v| !v.is_null()); + texts_under(&s.doc()?.doc, &checked_ids_or_selection(s, p, command)?, named) +} + +/// The type objects under `roots` (inside groups and layers, not live art). When `named`, every one +/// not on a locked artboard, locked and hidden ones (and ones in a locked or hidden group or layer) +/// included; else only those that can be edited. +fn texts_under(d: &Document, roots: &[NodeId], named: bool) -> Result> { fn visit(n: &Node, out: &mut Vec) { match &n.kind { NodeKind::Text(_) => out.push(n.id), @@ -134,8 +143,13 @@ fn texts_under(d: &Document, roots: &[NodeId]) -> Result> { } let mut out = vec![]; roots.iter().filter_map(|id| d.node(*id)).for_each(|n| visit(n, &mut out)); - let editable = d.editable(); - out.retain(|id| editable(*id)); + if named { + let locks = d.locked_artboards(); + out.retain(|id| !locks.holds_id(*id)); + } else { + let editable = d.editable(); + out.retain(|id| editable(*id)); + } out.dedup(); if out.len() > MAX_TEXTS { return Err(EngineError::Other("Too many type objects to change at once".into())); @@ -376,7 +390,9 @@ fn replace_with_pieces(s: &mut Session, label: &str, items: Vec<(NodeId, Node, V places.push((id, nodes)); } d.insert_beside(places, true)?; - sel.set(made.iter().copied()); + // Pieces of locked or hidden type stay unselected. + let editable = d.editable(); + sel.set(made.iter().copied().filter(|id| editable(*id))); Ok(made.iter().map(|i| i.0).collect()) }) } @@ -396,7 +412,7 @@ fn break_text(s: &mut Session, p: &Value) -> Result { }; let d = &s.doc()?.doc; let (mut items, mut skipped, mut count) = (vec![], vec![], 0); - let ids = texts_under(d, &checked_ids_or_selection(s, p, C)?)?; + let ids = target_texts(s, p, C)?; let threads = thread_index(d); for id in ids { let (Some(src), Some(node)) = (Source::of(d, id, threads.contains_key(&id)), d.node(id)) else { @@ -450,6 +466,9 @@ fn split_text(s: &mut Session, _: &Value) -> Result { struct Piece { id: NodeId, t: TextObject, + /// Whether the object and every group and layer above it are visible, and whether they are all + /// unlocked. + state: (bool, bool), /// The object's turn and shear (`xf` without its move). turn: [f64; 4], /// Where its first character's glyph starts on its baseline, in that frame. @@ -487,13 +506,19 @@ impl Piece { if !(at.x.is_finite() && at.y.is_finite() && size > 0.0) { return None; } - Some((Self { id, t, turn: [a, b, c, dd], at, end: at.x + end, size, pens }, node)) + let state = d.ancestry(id)?.iter().filter_map(|i| d.node(*i)).fold((true, true), |(v, u), n| (v && n.visible, u && !n.locked)); + Some((Self { id, t, state, turn: [a, b, c, dd], at, end: at.x + end, size, pens }, node)) } /// Whether `o` is turned and sheared alike. fn turned_like(&self, o: &Piece) -> bool { self.turn.iter().zip(&o.turn).all(|(x, y)| (x - y).abs() <= 1e-6 * x.abs().max(y.abs()).max(1.0)) } + + /// Whether `o` is turned and sheared alike and has the same `state`. + fn joins(&self, o: &Piece) -> bool { + self.turned_like(o) && self.state == o.state + } } /// Whether two objects look alike apart from their text (paint, opacity, blending, effects). @@ -595,15 +620,14 @@ fn merge(chain: &[&Piece]) -> std::result::Result { fn combine_text(s: &mut Session, p: &Value) -> Result { const C: &str = "addon.cleanup.combineText"; let d = &s.doc()?.doc; - let mut pieces: Vec<(Piece, &Node)> = - texts_under(d, &checked_ids_or_selection(s, p, C)?)?.into_iter().filter_map(|id| Piece::of(d, id)).collect(); - // Lines: pieces turned alike and looking alike, by baseline, then left to right. + let mut pieces: Vec<(Piece, &Node)> = target_texts(s, p, C)?.into_iter().filter_map(|id| Piece::of(d, id)).collect(); + // Lines: pieces turned alike, as visible and as locked and looking alike, by baseline, then left + // to right. pieces.sort_by(|x, y| x.0.at.y.total_cmp(&y.0.at.y).then(x.0.at.x.total_cmp(&y.0.at.x))); let mut lines: Vec> = vec![]; for (piece, node) in &pieces { let fits = |l: &Vec<(&Piece, &Node)>| { - l.first() - .is_some_and(|(f, n)| f.turned_like(piece) && same_look(n, node) && (f.at.y - piece.at.y).abs() <= SAME_LINE * f.size.min(piece.size)) + l.first().is_some_and(|(f, n)| f.joins(piece) && same_look(n, node) && (f.at.y - piece.at.y).abs() <= SAME_LINE * f.size.min(piece.size)) }; match lines.iter_mut().find(|l| fits(l)) { Some(l) => l.push((piece, node)), @@ -672,7 +696,8 @@ fn combine_text(s: &mut Session, p: &Value) -> Result { gone.extend(others); } d.remove_many(&gone)?; - sel.set(ids.iter().map(|i| NodeId(*i))); + let editable = d.editable(); + sel.set(ids.iter().map(|i| NodeId(*i)).filter(|id| editable(*id))); Ok(()) })?; Ok(json!({ "ids": ids, "combined": combined })) @@ -681,15 +706,15 @@ fn combine_text(s: &mut Session, p: &Value) -> Result { fn join_text(s: &mut Session, p: &Value) -> Result { const C: &str = "addon.cleanup.joinText"; let d = &s.doc()?.doc; - let pieces: Vec = - texts_under(d, &checked_ids_or_selection(s, p, C)?)?.into_iter().filter_map(|id| Piece::of(d, id).map(|p| p.0)).collect(); - // The piece top-left on the page sets the turn; the others turned like it are read in that frame. + let pieces: Vec = target_texts(s, p, C)?.into_iter().filter_map(|id| Piece::of(d, id).map(|p| p.0)).collect(); + // The piece top-left on the page sets the turn; the others turned like it, and as visible and as + // locked, are read in that frame. let on_page = |p: &Piece| Affine::new([p.turn[0], p.turn[1], p.turn[2], p.turn[3], 0.0, 0.0]) * p.at; let first = pieces.iter().min_by(|x, y| { let (a, b) = (on_page(x), on_page(y)); a.y.total_cmp(&b.y).then(a.x.total_cmp(&b.x)) }); - let mut kept: Vec<&Piece> = first.map(|f| pieces.iter().filter(|p| p.turned_like(f)).collect()).unwrap_or_default(); + let mut kept: Vec<&Piece> = first.map(|f| pieces.iter().filter(|p| f.joins(p)).collect()).unwrap_or_default(); kept.sort_by(|x, y| x.at.y.total_cmp(&y.at.y).then(x.at.x.total_cmp(&y.at.x))); // Lines, top to bottom, by baseline; each line's pieces left to right. let mut lines: Vec> = vec![]; @@ -751,7 +776,7 @@ fn join_text(s: &mut Session, p: &Value) -> Result { n.kind = NodeKind::Text(Box::new(m)); } d.remove_many(&gone)?; - sel.set([id]); + sel.set([id].into_iter().filter(|id| d.is_editable(*id))); Ok(()) })?; Ok(json!({ "id": id.0, "joined": joined, "lines": count })) @@ -797,8 +822,8 @@ fn apply_cuts(t: &mut TextObject, cuts: &[(usize, bool)], brk: char) -> usize { /// The breaks `brk` in the text of the frames of `story`, read as one text: a break at the end or /// start of a frame between words of the frames on either side becomes a space. Each editable frame -/// comes with its own breaks, at its own bytes. -fn story_cuts(d: &Document, story: &[NodeId], brk: char) -> Vec<(NodeId, Vec<(usize, bool)>)> { +/// (each frame when `all`) comes with its own breaks, at its own bytes. +fn story_cuts(d: &Document, story: &[NodeId], brk: char, all: bool) -> Vec<(NodeId, Vec<(usize, bool)>)> { let texts: Vec<(NodeId, String)> = story.iter().filter_map(|id| Some((*id, text_of(d, *id)?.plain_text()))).collect(); let joined: String = texts.iter().map(|(_, t)| t.as_str()).collect(); // The breaks in story order, handed to the frames in one pass. @@ -811,7 +836,7 @@ fn story_cuts(d: &Document, story: &[NodeId], brk: char) -> Vec<(NodeId, Vec<(us while let Some((at, space)) = cuts.next_if(|(at, _)| *at < end) { own.push((at - start, space)); } - if d.is_editable(id) { + if all || d.is_editable(id) { out.push((id, own)); } start = end; @@ -834,14 +859,14 @@ fn remove_breaks(s: &mut Session, p: &Value) -> Result { let d = &s.doc()?.doc; // Each type object with the breaks that go from it. let targets: Vec<(NodeId, Vec<(usize, bool)>)> = match editing { - Some(_) if !story.is_empty() => story_cuts(d, &story, brk), + Some(_) if !story.is_empty() => story_cuts(d, &story, brk, false), Some((id, a, b)) => vec![(id, a.min(b), a.max(b))] .into_iter() .filter(|(id, ..)| d.is_editable(*id)) .filter_map(|(id, a, b)| Some((id, break_cuts(&text_of(d, id)?.plain_text(), a, b, brk)))) .collect(), None => { - let ids = texts_under(d, &checked_ids_or_selection(s, p, C)?)?; + let ids = target_texts(s, p, C)?; // A threaded story whose frames are all among them is read as one text, once. let named: std::collections::HashSet = ids.iter().copied().collect(); let threads = thread_index(d); @@ -857,7 +882,8 @@ fn remove_breaks(s: &mut Session, p: &Value) -> Result { }; if !story.is_empty() && story.iter().all(|f| named.contains(f)) { done.extend(story.iter().copied()); - out.extend(story_cuts(d, &story, brk)); + // Every frame is among them, so each one keeps its breaks. + out.extend(story_cuts(d, &story, brk, true)); } else if let Some(t) = text_of(d, id) { out.push((id, break_cuts(&t.plain_text(), 0, usize::MAX, brk))); } @@ -891,10 +917,8 @@ fn remove_breaks(s: &mut Session, p: &Value) -> Result { /// Horizontal point type among the objects `p` names. fn point_texts(s: &Session, p: &Value, cmd: &str) -> Result> { let d = &s.doc()?.doc; - let ids: Vec = texts_under(d, &checked_ids_or_selection(s, p, cmd)?)? - .into_iter() - .filter(|id| text_of(d, *id).is_some_and(|t| matches!(t.kind, TextKind::Point))) - .collect(); + let ids: Vec = + target_texts(s, p, cmd)?.into_iter().filter(|id| text_of(d, *id).is_some_and(|t| matches!(t.kind, TextKind::Point))).collect(); if ids.is_empty() { return Err(EngineError::Other("Select point type".into())); } diff --git a/crates/engine/src/cmd/addons/cleanup/text/tests.rs b/crates/engine/src/cmd/addons/cleanup/text/tests.rs index cfa78a5ce5..c9ed79122c 100644 --- a/crates/engine/src/cmd/addons/cleanup/text/tests.rs +++ b/crates/engine/src/cmd/addons/cleanup/text/tests.rs @@ -379,6 +379,196 @@ fn remove_breaks_reads_the_threads_once() { } } +/// Lock `id` (`locked`), else hide it, as an undo step of its own. +fn lock_or_hide(s: &mut Session, id: NodeId, locked: bool) { + s.edit("Lock or Hide", |d, _| { + let n = d.node_mut(id).unwrap(); + if locked { + n.locked = true; + } else { + n.visible = false; + } + Ok(()) + }) + .unwrap(); +} + +/// Remove Breaks takes the locked and hidden type that `ids` names, and the locked member of a +/// group it names, as one undo step; from the selection it takes only type that can be edited, and +/// nothing changed makes no undo step. +#[test] +fn remove_breaks_named_locked_and_hidden_type() { + let mut s = session(); + let locked = text(&mut s, json!({"x": 40, "y": 60, "text": "a\nb", "size": 12})); + let hidden = text(&mut s, json!({"x": 40, "y": 120, "text": "c\nd", "size": 12})); + let grouped = text(&mut s, json!({"x": 40, "y": 180, "text": "e\nf", "size": 12})); + let free = text(&mut s, json!({"x": 40, "y": 240, "text": "g\nh", "size": 12})); + select(&mut s, &[grouped, free]); + let group = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + lock_or_hide(&mut s, locked, true); + lock_or_hide(&mut s, hidden, false); + lock_or_hide(&mut s, grouped, true); + select(&mut s, &[locked, hidden]); + let steps = undo_steps(&s); + assert_eq!(other(s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph"}))), "No paragraph breaks to remove"); + assert_eq!(undo_steps(&s), steps, "the selected locked and hidden type stays as it is"); + let r = s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph", "ids": [locked.0, hidden.0, group.0]})).unwrap(); + assert_eq!(undo_steps(&s), steps + 1); + assert_eq!(r["removed"], 4); + for (id, now) in [(locked, "a b"), (hidden, "c d"), (grouped, "e f"), (free, "g h")] { + assert_eq!(obj(&s, id).plain_text(), now); + } + assert_eq!(other(s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph", "ids": [locked.0]}))), "No paragraph breaks to remove"); + assert_eq!(undo_steps(&s), steps + 1, "nothing changed, no undo step"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(obj(&s, locked).plain_text(), "a\nb"); +} + +/// A threaded story whose frames `ids` all names is read as one text even when a frame is locked. +#[test] +fn remove_breaks_named_story_with_a_locked_frame() { + let mut s = session(); + let (a, b) = threaded(&mut s, "one\ntwo"); + lock_or_hide(&mut s, a, true); + let r = s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph", "ids": [a.0, b.0]})).unwrap(); + assert_eq!(r["removed"], 1); + assert_eq!(obj(&s, a).plain_text(), "one two"); +} + +/// Type on a locked artboard stays as it is even when `ids` names it, with no undo step. +#[test] +fn remove_breaks_named_type_on_a_locked_artboard() { + let mut s = session(); + let on_board = text(&mut s, json!({"x": 40, "y": 60, "text": "a\nb", "size": 12})); + s.edit("Lock Artboard", |d, _| { + d.artboards[0].locked = true; + Ok(()) + }) + .unwrap(); + let steps = undo_steps(&s); + let r = s.execute("addon.cleanup.removeBreaks", &json!({"kind": "paragraph", "ids": [on_board.0]})); + assert_eq!(other(r), "No paragraph breaks to remove"); + assert_eq!(undo_steps(&s), steps); + assert_eq!(obj(&s, on_board).plain_text(), "a\nb"); +} + +/// Break Text, Combine and Join Point Text, Set Alignment, Keep Position and Reset Text Transform +/// act on the locked and hidden type that `ids` names (type in a locked layer included), each as +/// one undo step, and leave it as it is when it is only selected. +#[test] +fn named_locked_and_hidden_type() { + let mut s = session(); + let words = text(&mut s, json!({"x": 40, "y": 100, "text": "Two words", "size": 14})); + lock_or_hide(&mut s, words, true); + select(&mut s, &[words]); + assert!(s.execute("addon.cleanup.breakText", &json!({"by": "words"})).is_err()); + let steps = undo_steps(&s); + let r = s.execute("addon.cleanup.breakText", &json!({"by": "words", "ids": [words.0]})).unwrap(); + assert_eq!((ids(&r).len(), undo_steps(&s)), (2, steps + 1)); + assert!(s.doc().unwrap().selection.objects.is_empty(), "the locked pieces stay unselected"); + + let mut s = session(); + let a = text(&mut s, json!({"x": 50, "y": 100, "text": "Left", "size": 20})); + let b = text(&mut s, json!({"x": 110, "y": 100, "text": "Right", "size": 20})); + lock_or_hide(&mut s, a, false); + lock_or_hide(&mut s, b, false); + select(&mut s, &[a, b]); + assert!(s.execute("addon.cleanup.combineText", &json!({})).is_err()); + let r = s.execute("addon.cleanup.combineText", &json!({"ids": [a.0, b.0]})).unwrap(); + assert_eq!(ids(&r), [a]); + assert_eq!(obj(&s, a).plain_text(), "Left Right"); + assert!(s.doc().unwrap().selection.objects.is_empty(), "the hidden object stays unselected"); + + let mut s = session(); + let first = text(&mut s, json!({"x": 50, "y": 100, "text": "First", "size": 20})); + let second = text(&mut s, json!({"x": 50, "y": 130, "text": "Second", "size": 20})); + let layer = s.doc().unwrap().doc.layers[0].id; + lock_or_hide(&mut s, layer, true); + select(&mut s, &[first, second]); + assert!(s.execute("addon.cleanup.joinText", &json!({})).is_err()); + let r = s.execute("addon.cleanup.joinText", &json!({"ids": [first.0, second.0]})).unwrap(); + assert_eq!(r["id"].as_u64(), Some(first.0)); + assert_eq!(obj(&s, first).plain_text(), "First\nSecond"); + assert!(s.doc().unwrap().selection.objects.is_empty(), "the object in the locked layer stays unselected"); + + let mut s = session(); + let lines = text(&mut s, json!({"x": 50, "y": 100, "text": "a\nlonger line", "size": 20})); + lock_or_hide(&mut s, lines, false); + select(&mut s, &[lines]); + assert!(s.execute("addon.cleanup.alignInPlace", &json!({"align": "center"})).is_err()); + s.execute("addon.cleanup.alignInPlace", &json!({"align": "center", "ids": [lines.0]})).unwrap(); + assert!(obj(&s, lines).para_styles().all(|p| p.justify == Justify::Center)); + + let mut s = session(); + let turned = text(&mut s, json!({"x": 300, "y": 200, "text": "Turned", "size": 18, "rotation": 30})); + lock_or_hide(&mut s, turned, true); + select(&mut s, &[turned]); + assert!(s.execute("addon.cleanup.resetTextTransform", &json!({})).is_err()); + let steps = undo_steps(&s); + s.execute("addon.cleanup.resetTextTransform", &json!({"ids": [turned.0]})).unwrap(); + assert_eq!(undo_steps(&s), steps + 1); + let [_, b, c, _, _, _] = obj(&s, turned).xf.as_coeffs(); + assert!(b.abs() < 1e-9 && c.abs() < 1e-9, "the rotation is gone"); +} + +/// Combine Point Text joins named pieces only with pieces as visible and as locked, a group's lock +/// included: a visible piece and a hidden one beside it, or a free piece and one in a locked group, +/// stay as they are, with no undo step. +#[test] +fn combine_keeps_hidden_and_locked_pieces_apart() { + let mut s = session(); + let a = text(&mut s, json!({"x": 50, "y": 100, "text": "Left", "size": 20})); + let b = text(&mut s, json!({"x": 110, "y": 100, "text": "Right", "size": 20})); + lock_or_hide(&mut s, b, false); + let steps = undo_steps(&s); + assert!(s.execute("addon.cleanup.combineText", &json!({"ids": [a.0, b.0]})).is_err()); + assert_eq!(undo_steps(&s), steps); + assert_eq!((obj(&s, a).plain_text(), obj(&s, b).plain_text()), ("Left".into(), "Right".into())); + let d = &s.doc().unwrap().doc; + assert!(d.is_visible(a) && !d.is_visible(b), "the visible text stays shown and the hidden text stays hidden"); + + let mut s = session(); + let a = text(&mut s, json!({"x": 50, "y": 100, "text": "Left", "size": 20})); + let b = text(&mut s, json!({"x": 110, "y": 100, "text": "Right", "size": 20})); + select(&mut s, &[b]); + let group = NodeId(s.execute("object.group", &json!({})).unwrap()["id"].as_u64().unwrap()); + lock_or_hide(&mut s, group, true); + let steps = undo_steps(&s); + assert!(s.execute("addon.cleanup.combineText", &json!({"ids": [a.0, group.0]})).is_err()); + assert_eq!(undo_steps(&s), steps); + assert_eq!((obj(&s, a).plain_text(), obj(&s, b).plain_text()), ("Left".into(), "Right".into())); +} + +/// Join Point Text joins only the named pieces as visible and as locked as the top-left one: a +/// hidden piece between two visible lines stays as it is, hidden, and a hidden top-left piece +/// with only a visible one below it joins nothing, with no undo step. +#[test] +fn join_keeps_a_hidden_piece_apart() { + let mut s = session(); + let first = text(&mut s, json!({"x": 50, "y": 100, "text": "First", "size": 20})); + let hidden = text(&mut s, json!({"x": 50, "y": 130, "text": "Hidden", "size": 20})); + let third = text(&mut s, json!({"x": 50, "y": 160, "text": "Third", "size": 20})); + lock_or_hide(&mut s, hidden, false); + let steps = undo_steps(&s); + let r = s.execute("addon.cleanup.joinText", &json!({"ids": [first.0, hidden.0, third.0]})).unwrap(); + assert_eq!((r["id"].as_u64(), r["joined"].as_u64(), undo_steps(&s)), (Some(first.0), Some(2), steps + 1)); + assert_eq!(obj(&s, first).plain_text(), "First\nThird"); + assert_eq!(obj(&s, hidden).plain_text(), "Hidden"); + let d = &s.doc().unwrap().doc; + assert!(d.is_visible(first) && !d.is_visible(hidden), "the visible text stays shown and the hidden text stays hidden"); + assert!(d.node(third).is_none()); + + let mut s = session(); + let top = text(&mut s, json!({"x": 50, "y": 100, "text": "Top", "size": 20})); + let below = text(&mut s, json!({"x": 50, "y": 130, "text": "Below", "size": 20})); + lock_or_hide(&mut s, top, false); + let steps = undo_steps(&s); + assert!(s.execute("addon.cleanup.joinText", &json!({"ids": [top.0, below.0]})).is_err()); + assert_eq!(undo_steps(&s), steps); + assert_eq!((obj(&s, top).plain_text(), obj(&s, below).plain_text()), ("Top".into(), "Below".into())); + assert!(s.doc().unwrap().doc.is_visible(below)); +} + #[test] fn split_at_the_cursor_and_around_a_selection() { for (anchor, caret, want) in [(6, 6, &["Split", "here please"][..]), (6, 10, &["Split", "here", "please"][..])] { diff --git a/crates/engine/src/cmd/addons/color.rs b/crates/engine/src/cmd/addons/color.rs index 2fe9c77a36..6eb21c9a63 100644 --- a/crates/engine/src/cmd/addons/color.rs +++ b/crates/engine/src/cmd/addons/color.rs @@ -43,7 +43,7 @@ pub fn specs() -> Vec { "Apply as Filter", ["Object", "Plug-ins", "Color Effects"], None, - "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate, addon.color.duotone or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step (none when nothing changes); their effects stay. Duotone links a colour to its one tone's swatch as the live effect does. On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke (docs/mcp.md) → {changed}", + "{effect: a colour adjustment's effect id (adjust.brightnessContrast, adjust.curves, adjust.hueSaturation, adjust.levels, adjust.shiftToColor, adjust.temperatureTint, addon.color.exposure, addon.color.desaturate, addon.color.duotone or addon.color.invert), params?: {…} (as effect.apply; missing keys take the dialog defaults), fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?: [id…] (default: the selection)} recolour the objects and everything inside them as the live effect would draw them, but in their colours, as edit.colors.invert does (fills, strokes, type, gradient meshes, embedded images and pattern tiles), as one undo step (none when nothing changes); their effects stay. Duotone links a colour to its one tone's swatch as the live effect does. On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind (docs/mcp.md) → {changed}", has_selection, filter ), @@ -52,7 +52,7 @@ pub fn specs() -> Vec { "Print Ink Fixes", ["Object", "Plug-ins", "Color Effects"], None, - "{scope?: \"selection\" (the selection, or `ids`; by default, the document while nothing is selected) | \"document\" (every layer), inkLimit?: total ink % 1..400 (0 or left out: off), excludePureBlack?: true (black-only and grey colours keep their ink), removeWhiteOverprint?: false (white fills and strokes stop overprinting), overprintBlack?: black % 1..100 (black-only and grey fills and strokes this dark or darker overprint, as edit.colors.overprintBlack; 0 or left out: off), textOnly?: false (Overprint Black on type only), fill?: true, stroke?: true, ids?: [id…]} prepare a CMYK document's inks for print as one undo step: CMYK colours (solid, gradient stops, gradient meshes) with more total ink than inkLimit are scaled down to it (colours of spot swatches and Registration stay), white overprint is removed and black overprint set. Refused in RGB documents (File › Document Color Mode › CMYK Color first). On a path directly in a graph series, the graph also stores a paint the ink limit changes on the topmost visible fill or stroke (docs/mcp.md) → {changed, inkLimited: paints and meshes scaled, whiteOverprintRemoved: objects, blackOverprinted: objects}", + "{scope?: \"selection\" (the selection, or `ids`; by default, the document while nothing is selected) | \"document\" (every layer), inkLimit?: total ink % 1..400 (0 or left out: off), excludePureBlack?: true (black-only and grey colours keep their ink), removeWhiteOverprint?: false (white fills and strokes stop overprinting), overprintBlack?: black % 1..100 (black-only and grey fills and strokes this dark or darker overprint, as edit.colors.overprintBlack; 0 or left out: off), textOnly?: false (Overprint Black on type only), fill?: true, stroke?: true, ids?: [id…]} prepare a CMYK document's inks for print as one undo step: CMYK colours (solid, gradient stops, gradient meshes) with more total ink than inkLimit are scaled down to it (colours of spot swatches and Registration stay), white overprint is removed and black overprint set. Refused in RGB documents (File › Document Color Mode › CMYK Color first). On a path directly in a graph series, the graph also stores a paint the ink limit changes on the topmost visible fill or stroke, and on a graph label the new paint of its characters and rows for every label of its kind (docs/mcp.md) → {changed, inkLimited: paints and meshes scaled, whiteOverprintRemoved: objects, blackOverprinted: objects}", has_doc, print_fixes::run ), @@ -70,7 +70,7 @@ pub fn specs() -> Vec { "Apply Nearest Swatch", ["Object", "Plug-ins", "Color Effects"], None, - "{library?: as addon.color.nearestSwatch (default: \"document\"), fill?: true, stroke?: true, ids?: [id…] (default: the selection)} give each solid colour and gradient stop of the selected objects' fills and strokes (their type's and those of the objects inside them; gradient meshes too) the colour of its nearest swatch in the library, as addon.color.nearestSwatch finds it, as one undo step (none when nothing changes): a global or spot swatch's colour links to it. A library's swatches the colours take are added to the document's first, as swatch.library.add adds them (a spot colour stays spot); images and patterns keep their colours. On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke (docs/mcp.md) → {changed: paints changed, swatches: [the document swatches the colours took], added: [swatches added to the document]}", + "{library?: as addon.color.nearestSwatch (default: \"document\"), fill?: true, stroke?: true, ids?: [id…] (default: the selection)} give each solid colour and gradient stop of the selected objects' fills and strokes (their type's and those of the objects inside them; gradient meshes too) the colour of its nearest swatch in the library, as addon.color.nearestSwatch finds it, as one undo step (none when nothing changes): a global or spot swatch's colour links to it. A library's swatches the colours take are added to the document's first, as swatch.library.add adds them (a spot colour stays spot); images and patterns keep their colours. On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind (docs/mcp.md) → {changed: paints changed, swatches: [the document swatches the colours took], added: [swatches added to the document]}", has_selection, nearest::apply ), diff --git a/crates/engine/src/cmd/addons/image/mask.rs b/crates/engine/src/cmd/addons/image/mask.rs index 786effbd2e..0dd8fabe3c 100644 --- a/crates/engine/src/cmd/addons/image/mask.rs +++ b/crates/engine/src/cmd/addons/image/mask.rs @@ -320,7 +320,8 @@ fn fresh(doc: &Document, n: &Node, cmd: &str) -> Option, doc: &mut Document) { diff --git a/crates/engine/src/cmd/addons/shapes.rs b/crates/engine/src/cmd/addons/shapes.rs index 87549e3694..7fc935546e 100644 --- a/crates/engine/src/cmd/addons/shapes.rs +++ b/crates/engine/src/cmd/addons/shapes.rs @@ -9,6 +9,8 @@ #[cfg(test)] mod tests; +use std::ops::RangeInclusive; + use serde_json::{Value, json}; use vectorcraft_doc::{LiveShape, NodeId, NodeKind}; use vectorcraft_geom::{Affine, FillRule, Point, Rect, shapes}; @@ -16,9 +18,25 @@ use vectorcraft_tools::addons::box3d::CustomShape; use super::super::create::insert_look; use super::super::{ - CommandSpec, Result, Session, bool_or, check_numbers, check_switches, cmd, f64_or, f64_req, has_doc, has_selection, str_param, targets, + CommandSpec, Result, Session, bad, bool_or, check_numbers, check_switches, cmd, f64_or, f64_req, has_doc, has_selection, number_or, str_param, + targets, }; +/// The sides of a polygon and the points of a star: whole numbers in this range. +const COUNTS: RangeInclusive = 3.0..=1000.0; +/// `rounded` and `randomized` of a polygon or star. +const ROUNDING: RangeInclusive = -10.0..=10.0; +/// A star's inner radius as a fraction of its outer radius. +const SPOKE_RATIO: RangeInclusive = 0.01..=1.0; +/// A spiral's `turns`. +const TURNS: RangeInclusive = 0.01..=1024.0; +/// A spiral's `divergence`. +const DIVERGENCE: RangeInclusive = 0.0..=1000.0; +/// A spiral's `innerRadius`, as a fraction of its radius. +const INNER_RADIUS: RangeInclusive = 0.0..=0.999; +/// The `arcMode` names; `slice` and `open` are also read as `pie` and `arc`. +const ARC_MODES: [&str; 4] = ["whole", "pie", "chord", "arc"]; + pub fn specs() -> Vec { vec![ cmd!( @@ -26,7 +44,7 @@ pub fn specs() -> Vec { "Rectangle", [], None, - "{x, y, width, height, radius?: pt, radii?: [tl,tr,br,bl], startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top-left corner; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise about the centre (0: upright)} → {id}", + "{x, y, width, height: pt (0 or more), radius?: pt (0 or more), radii?: [tl,tr,br,bl] (each 0 or more), startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top-left corner; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise about the centre (0: upright)} → {id}", has_doc, rectangle ), @@ -35,7 +53,7 @@ pub fn specs() -> Vec { "Ellipse", [], None, - "{x, y, width, height, startAngle?, endAngle?: degrees (counter-clockwise from 3 o'clock, as object.setLiveShape's pieStart and pieEnd; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise about the centre (0: upright)} → {id}", + "{x, y, width, height: pt (0 or more), startAngle?, endAngle?: degrees (counter-clockwise from 3 o'clock, as object.setLiveShape's pieStart and pieEnd; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise about the centre (0: upright)} → {id}", has_doc, ellipse ), @@ -44,7 +62,7 @@ pub fn specs() -> Vec { "Polygon", [], None, - "{cx, cy, radius, sides=6, rounded=0, randomized=0, startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top corner; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise (0: a corner straight up)} → {id}", + "{cx, cy, radius: pt (0 or more), sides=6: a whole number 3 to 1000, rounded=0, randomized=0: -10 to 10, startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top corner; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise (0: a corner straight up)} → {id}", has_doc, polygon ), @@ -53,7 +71,7 @@ pub fn specs() -> Vec { "Star", [], None, - "{cx, cy, radius1, radius2?, points=5, rounded=0, randomized=0, startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top point; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise (0: a point straight up)} → {id}", + "{cx, cy, radius1: pt (0 or more), radius2?: pt (0.01 to 1 times radius1; default half of it), points=5: a whole number 3 to 1000, rounded=0, randomized=0: -10 to 10, startAngle?, endAngle?: degrees (the part of the outline kept, clockwise from its first anchor, the top point; each side an equal share of 360; default 0 and 360), arcMode?: whole|pie|chord|arc, rotation?: deg clockwise (0: a point straight up)} → {id}", has_doc, star ), @@ -62,7 +80,7 @@ pub fn specs() -> Vec { "Spiral", [], None, - "{cx, cy, radius, turns=3, divergence=1, innerRadius=0, clockwise=true} → {id}", + "{cx, cy, radius: pt (0 or more), turns=3: 0.01 to 1024, divergence=1: 0 to 1000, innerRadius=0: 0 to 0.999 of radius, clockwise=true} → {id}", has_doc, spiral ), @@ -71,7 +89,7 @@ pub fn specs() -> Vec { "3D Box", [], None, - "{x, y, width, height, angleX=30 (degrees about the level axis: positive tips the top away from you), angleY=30 (degrees about the upright axis: positive turns the right side away from you), angleZ=0 (degrees clockwise in the page), parallelX=false, parallelY=true, parallelZ=false} → {id}", + "{x, y, width, height: pt (0 or more), angleX=30 (degrees about the level axis: positive tips the top away from you), angleY=30 (degrees about the upright axis: positive turns the right side away from you), angleZ=0 (degrees clockwise in the page), parallelX=false, parallelY=true, parallelZ=false} → {id}", has_doc, box3d ), @@ -80,33 +98,96 @@ pub fn specs() -> Vec { "Configure Shape", [], None, - "{ids?, radius?, radii?: [tl,tr,br,bl], startAngle?, endAngle?: degrees (as addon.shapes.rectangle, ellipse, polygon and star take them: an ellipse's counter-clockwise from 3 o'clock, the others' clockwise along the outline), arcMode?: whole|pie|chord|arc, sides?, isStar?, spokeRatio?, rounded?, randomized?, turns?, divergence?, innerRadius?, angleX?, angleY?: degrees (as addon.shapes.box3d: positive tips the top, or turns the right side, away from you), angleZ?: degrees clockwise in the page, parallelX?, parallelY?, parallelZ?, reset?: bool} → {updated}", + "{ids?, radius?: pt (0 or more; fitted to half each rectangle's shorter side), radii?: [tl,tr,br,bl] (each 0 or more), startAngle?, endAngle?: degrees (as addon.shapes.rectangle, ellipse, polygon and star take them: an ellipse's counter-clockwise from 3 o'clock, the others' clockwise along the outline), arcMode?: whole|pie|chord|arc, sides?: a whole number 3 to 1000, isStar?, spokeRatio?: 0.01 to 1, rounded?, randomized?: -10 to 10, turns?: 0.01 to 1024, divergence?: 0 to 1000, innerRadius?: 0 to 0.999, angleX?, angleY?: degrees (as addon.shapes.box3d: positive tips the top, or turns the right side, away from you), angleZ?: degrees clockwise in the page, parallelX?, parallelY?, parallelZ?, reset?: bool} an omitted or null value keeps each shape's setting → {updated}", has_selection, configure ), ] } -fn parse_arc_params(p: &Value) -> ((f64, f64), shapes::EllipseMode) { +/// The number `p` gives for `key`, or `default` when `p` leaves it out or gives null. A number +/// outside `range` is an error that names `key` and the range. +fn ranged(p: &Value, key: &str, default: f64, range: &RangeInclusive, cmd: &str) -> Result { + let x = number_or(p, key, default, cmd)?; + if !range.contains(&x) { + let (min, max) = (range.start(), range.end()); + return Err(bad(cmd, format!("`{key}` must be between {min} and {max} (got {x})"))); + } + Ok(x) +} + +/// The number of sides or points `p` gives for `key`, or `default` when `p` leaves it out or gives +/// null. A fraction or a number outside [`COUNTS`] is an error. +fn count(p: &Value, key: &str, default: u32, cmd: &str) -> Result { + let x = number_or(p, key, f64::from(default), cmd)?; + if x.fract() != 0.0 || !COUNTS.contains(&x) { + let (min, max) = (COUNTS.start(), COUNTS.end()); + return Err(bad(cmd, format!("`{key}` must be a whole number between {min} and {max} (got {x})"))); + } + Ok(x as u32) +} + +/// The size `p` gives for `key`: a number that is not negative. +fn size(p: &Value, key: &str, cmd: &str) -> Result { + not_negative(f64_req(p, key, cmd)?, key, cmd) +} + +/// The size `p` gives for `key`, or `default` when `p` leaves it out or gives null. +fn size_or(p: &Value, key: &str, default: f64, cmd: &str) -> Result { + not_negative(number_or(p, key, default, cmd)?, key, cmd) +} + +fn not_negative(x: f64, key: &str, cmd: &str) -> Result { + if x < 0.0 { + return Err(bad(cmd, format!("`{key}` must be a number not below 0"))); + } + Ok(x) +} + +/// The four corner radii `p` gives as `radii` ([tl, tr, br, bl]), or `None` when `p` leaves it out +/// or gives null. Anything but four numbers that are not negative is an error. +fn radii_param(p: &Value, cmd: &str) -> Result> { + let key = "radii"; + match p.get(key) { + None | Some(Value::Null) => Ok(None), + Some(v) => { + let four = v.as_array().filter(|a| a.len() == 4).and_then(|a| { + let mut out = [0.0; 4]; + for (slot, item) in out.iter_mut().zip(a) { + *slot = item.as_f64().filter(|r| *r >= 0.0)?; + } + Some(out) + }); + four.map(Some).ok_or_else(|| bad(cmd, format!("`{key}` must be four numbers not below 0: [tl, tr, br, bl]"))) + } + } +} + +/// The mode `p` gives as `arcMode`, or `None` when `p` leaves it out or gives null. Any other +/// value than one of [`ARC_MODES`] (or `slice` or `open`) is an error. +fn arc_mode(p: &Value, cmd: &str) -> Result> { + let key = "arcMode"; + match p.get(key) { + None | Some(Value::Null) => Ok(None), + Some(v) => v.as_str().and_then(parse_mode).map(Some).ok_or_else(|| bad(cmd, format!("`{key}` must be one of {}", ARC_MODES.join(", ")))), + } +} + +fn parse_arc_params(p: &Value, cmd: &str) -> Result<((f64, f64), shapes::EllipseMode)> { let start = f64_or(p, "startAngle", 0.0); let end = f64_or(p, "endAngle", 360.0); - let mode = match str_param(p, "arcMode") { - Some("pie" | "slice") => shapes::EllipseMode::Slice, - Some("chord") => shapes::EllipseMode::Chord, - Some("arc" | "open") => shapes::EllipseMode::Arc, - _ => shapes::EllipseMode::Whole, - }; + let mode = arc_mode(p, cmd)?.unwrap_or(shapes::EllipseMode::Whole); let span = (end - start).rem_euclid(360.0); let pie = if mode == shapes::EllipseMode::Whole && (span < 1e-6 || (span - 360.0).abs() < 1e-6) { (0.0, 360.0) } else { (start, end) }; - (pie, mode) + Ok((pie, mode)) } fn rect_of(p: &Value, c: &str) -> Result { let x = f64_req(p, "x", c)?; let y = f64_req(p, "y", c)?; - let w = f64_req(p, "width", c)?; - let h = f64_req(p, "height", c)?; - Ok(Rect::new(x, y, x + w.abs(), y + h.abs()).abs()) + let w = size(p, "width", c)?; + let h = size(p, "height", c)?; + Ok(Rect::new(x, y, x + w, y + h)) } fn rect_xf(r: Rect, rot: f64) -> Affine { @@ -141,18 +222,9 @@ fn rectangle(s: &mut Session, p: &Value) -> Result { let c = "addon.shapes.rectangle"; check_numbers(p, &["radius", "startAngle", "endAngle", "rotation"], c)?; let r = rect_of(p, c)?; - let radius = f64_or(p, "radius", 0.0).max(0.0); - let mut radii = [radius; 4]; - if let Some(arr) = p.get("radii").and_then(Value::as_array) - && arr.len() == 4 - { - for (i, item) in arr.iter().enumerate() { - if let Some(val) = item.as_f64().filter(|n| n.is_finite()) { - radii[i] = val.max(0.0); - } - } - } - let (pie, arc_mode) = parse_arc_params(p); + let radius = size_or(p, "radius", 0.0, c)?; + let radii = radii_param(p, c)?.unwrap_or([radius; 4]); + let (pie, arc_mode) = parse_arc_params(p, c)?; let xf = rect_xf(r, f64_or(p, "rotation", 0.0)); let live = LiveShape::Rectangle { w: r.width(), h: r.height(), radii, kinds: Default::default(), radii_relative: false, xf }; let cs = CustomShape::Rectangle { w: r.width(), h: r.height(), radii, kinds: Default::default(), radii_relative: false, xf, pie, arc_mode }; @@ -164,7 +236,7 @@ fn ellipse(s: &mut Session, p: &Value) -> Result { let c = "addon.shapes.ellipse"; check_numbers(p, &["startAngle", "endAngle", "rotation"], c)?; let r = rect_of(p, c)?; - let (pie, arc_mode) = parse_arc_params(p); + let (pie, arc_mode) = parse_arc_params(p, c)?; let xf = rect_xf(r, f64_or(p, "rotation", 0.0)); let live = LiveShape::Ellipse { w: r.width(), h: r.height(), pie, xf }; let cs = CustomShape::Ellipse { w: r.width(), h: r.height(), pie, arc_mode, xf }; @@ -174,13 +246,13 @@ fn ellipse(s: &mut Session, p: &Value) -> Result { fn polygon(s: &mut Session, p: &Value) -> Result { let c = "addon.shapes.polygon"; let center = Point::new(f64_req(p, "cx", c)?, f64_req(p, "cy", c)?); - let r = f64_req(p, "radius", c)?.abs(); + let r = size(p, "radius", c)?; check_numbers(p, &["sides", "rotation", "rounded", "randomized", "startAngle", "endAngle"], c)?; - let sides = (f64_or(p, "sides", 6.0).round() as i64).clamp(3, 1000) as u32; + let sides = count(p, "sides", 6, c)?; let rot = f64_or(p, "rotation", 0.0); - let rounded = f64_or(p, "rounded", 0.0).clamp(-10.0, 10.0); - let randomized = f64_or(p, "randomized", 0.0).clamp(-10.0, 10.0); - let (pie, arc_mode) = parse_arc_params(p); + let rounded = ranged(p, "rounded", 0.0, &ROUNDING, c)?; + let randomized = ranged(p, "randomized", 0.0, &ROUNDING, c)?; + let (pie, arc_mode) = parse_arc_params(p, c)?; let xf = Affine::translate(center.to_vec2()) * vectorcraft_geom::rotate_deg(rot); let live = LiveShape::Polygon { radius: r, sides, xf, radii: vec![], kinds: vec![], radii_relative: false }; let cs = CustomShape::Polygon { @@ -202,16 +274,17 @@ fn polygon(s: &mut Session, p: &Value) -> Result { fn star(s: &mut Session, p: &Value) -> Result { let c = "addon.shapes.star"; let center = Point::new(f64_req(p, "cx", c)?, f64_req(p, "cy", c)?); - let r1 = f64_req(p, "radius1", c)?.abs(); + let r1 = size(p, "radius1", c)?; check_numbers(p, &["radius2", "points", "rotation", "rounded", "randomized", "startAngle", "endAngle"], c)?; - let r2 = f64_or(p, "radius2", r1 / 2.0).abs(); - let points = (f64_or(p, "points", 5.0).round() as i64).clamp(3, 1000) as u32; + // The inner radius is a fraction of the outer one, in `SPOKE_RATIO`. + let r2 = ranged(p, "radius2", r1 / 2.0, &(r1 * SPOKE_RATIO.start()..=r1 * SPOKE_RATIO.end()), c)?; + let points = count(p, "points", 5, c)?; let rot = f64_or(p, "rotation", 0.0); - let rounded = f64_or(p, "rounded", 0.0).clamp(-10.0, 10.0); - let randomized = f64_or(p, "randomized", 0.0).clamp(-10.0, 10.0); - let (pie, arc_mode) = parse_arc_params(p); + let rounded = ranged(p, "rounded", 0.0, &ROUNDING, c)?; + let randomized = ranged(p, "randomized", 0.0, &ROUNDING, c)?; + let (pie, arc_mode) = parse_arc_params(p, c)?; let xf = Affine::translate(center.to_vec2()) * vectorcraft_geom::rotate_deg(rot); - let ratio = if r1 > 1e-9 { (r2 / r1).clamp(0.01, 1.0) } else { 0.5 }; + let ratio = if r1 > 1e-9 { (r2 / r1).clamp(*SPOKE_RATIO.start(), *SPOKE_RATIO.end()) } else { 0.5 }; let cs = CustomShape::Polygon { radius: r1, sides: points, @@ -231,12 +304,12 @@ fn star(s: &mut Session, p: &Value) -> Result { fn spiral(s: &mut Session, p: &Value) -> Result { let c = "addon.shapes.spiral"; let center = Point::new(f64_req(p, "cx", c)?, f64_req(p, "cy", c)?); - let r = f64_req(p, "radius", c)?.abs(); + let r = size(p, "radius", c)?; check_numbers(p, &["turns", "divergence", "innerRadius"], c)?; check_switches(p, &["clockwise"], c)?; - let turns = f64_or(p, "turns", 3.0).clamp(0.01, 1024.0); - let divergence = f64_or(p, "divergence", 1.0).clamp(0.0, 1000.0); - let inner_radius = f64_or(p, "innerRadius", 0.0).clamp(0.0, 0.999); + let turns = ranged(p, "turns", 3.0, &TURNS, c)?; + let divergence = ranged(p, "divergence", 1.0, &DIVERGENCE, c)?; + let inner_radius = ranged(p, "innerRadius", 0.0, &INNER_RADIUS, c)?; let clockwise = bool_or(p, "clockwise", true); let cs = CustomShape::Spiral { center, radius: r, turns, divergence, inner_radius, clockwise }; insert_custom(s, "Spiral", None, cs) @@ -299,24 +372,54 @@ fn configure(s: &mut Session, p: &Value) -> Result { c, )?; check_switches(p, &["isStar", "parallelX", "parallelY", "parallelZ", "reset"], c)?; + check_configure(p, c)?; let ids = targets(s, p)?; let reset = bool_or(p, "reset", false); let spiral_hint = p.get("turns").is_some() || p.get("divergence").is_some() || p.get("innerRadius").is_some(); + // The shapes the params change, worked out first so that a call that changes nothing records + // no undo step. + let changes: Vec<(NodeId, CustomShape)> = { + let doc = &s.doc()?.doc; + ids.into_iter() + .filter_map(|id| { + let n = doc.node(id)?; + let before = CustomShape::read_for_update(n, spiral_hint)?; + let mut cs = before.clone(); + let stored = CustomShape::read(n).is_some(); + (apply_shape_params(&mut cs, p, reset) && (cs != before || !stored)).then_some((id, cs)) + }) + .collect() + }; + if changes.is_empty() { + return Ok(json!({ "updated": 0 })); + } let updated = s.edit("Live Shape", |d, _| { let mut count = 0usize; - for id in ids { - let Some(n) = d.node_mut(id) else { continue }; - let Some(mut cs) = CustomShape::read_for_update(n, spiral_hint) else { continue }; - if apply_shape_params(&mut cs, p, reset) { - cs.write_to_node(n); - count += 1; - } + for (id, cs) in &changes { + let Some(n) = d.node_mut(*id) else { continue }; + cs.write_to_node(n); + count += 1; } Ok(count) })?; Ok(json!({ "updated": updated })) } +/// Error unless every bounded value `p` gives is in its range, before any shape changes. +fn check_configure(p: &Value, c: &str) -> Result<()> { + size_or(p, "radius", 0.0, c)?; + radii_param(p, c)?; + arc_mode(p, c)?; + count(p, "sides", 6, c)?; + ranged(p, "spokeRatio", 0.5, &SPOKE_RATIO, c)?; + ranged(p, "rounded", 0.0, &ROUNDING, c)?; + ranged(p, "randomized", 0.0, &ROUNDING, c)?; + ranged(p, "turns", 3.0, &TURNS, c)?; + ranged(p, "divergence", 1.0, &DIVERGENCE, c)?; + ranged(p, "innerRadius", 0.0, &INNER_RADIUS, c)?; + Ok(()) +} + fn num_param(p: &Value, k: &str) -> Option { p.get(k).and_then(Value::as_f64).filter(|v| v.is_finite()) } @@ -331,8 +434,8 @@ fn apply_arc_params(p: &Value, pie: &mut (f64, f64), arc_mode: &mut shapes::Elli pie.1 = a1.rem_euclid(360.0); changed = true; } - if let Some(m) = str_param(p, "arcMode") { - *arc_mode = parse_mode(m); + if let Some(m) = str_param(p, "arcMode").and_then(parse_mode) { + *arc_mode = m; if *arc_mode == shapes::EllipseMode::Whole { *pie = (0.0, 360.0); } else if (pie.1 - pie.0).abs() < 1e-6 || ((pie.1 - pie.0).abs() - 360.0).abs() < 1e-6 { @@ -351,19 +454,14 @@ fn apply_rect_params(p: &Value, reset: bool, max_r: f64, radii: &mut [f64; 4], p *arc_mode = shapes::EllipseMode::Whole; changed = true; } + // A radius larger than half the rectangle's shorter side is fitted to that size. if let Some(r) = num_param(p, "radius") { *radii = [r.clamp(0.0, max_r); 4]; changed = true; } - if let Some(arr) = p.get("radii").and_then(Value::as_array) - && arr.len() == 4 - { - for (i, v) in arr.iter().enumerate() { - if let Some(r) = v.as_f64().filter(|x| x.is_finite()) { - radii[i] = r.clamp(0.0, max_r); - changed = true; - } - } + if let Ok(Some(four)) = radii_param(p, "addon.shapes.configure") { + *radii = four.map(|r| r.clamp(0.0, max_r)); + changed = true; } changed | apply_arc_params(p, pie, arc_mode) } @@ -378,8 +476,9 @@ fn apply_poly_params(p: &Value, reset: bool, sides: &mut u32, spoke_ratio: &mut } changed = true; } - if let Some(n_sides) = p.get("sides").and_then(Value::as_u64) { - *sides = (n_sides as u32).clamp(3, 1000); + // `check_configure` has refused values outside their ranges. + if let Some(n_sides) = num_param(p, "sides") { + *sides = n_sides as u32; changed = true; } if let Some(star) = p.get("isStar").and_then(Value::as_bool) { @@ -387,15 +486,15 @@ fn apply_poly_params(p: &Value, reset: bool, sides: &mut u32, spoke_ratio: &mut changed = true; } if let Some(sr) = num_param(p, "spokeRatio") { - *spoke_ratio = Some(sr.clamp(0.01, 1.0)); + *spoke_ratio = Some(sr); changed = true; } if let Some(rnd) = num_param(p, "rounded") { - *rounded = rnd.clamp(-10.0, 10.0); + *rounded = rnd; changed = true; } if let Some(rand) = num_param(p, "randomized") { - *randomized = rand.clamp(-10.0, 10.0); + *randomized = rand; changed = true; } changed @@ -429,15 +528,15 @@ fn apply_shape_params(cs: &mut CustomShape, p: &Value, reset: bool) -> bool { changed = true; } if let Some(t) = num_param(p, "turns") { - *turns = t.clamp(0.01, 1024.0); + *turns = t; changed = true; } if let Some(div) = num_param(p, "divergence") { - *divergence = div.clamp(0.0, 1000.0); + *divergence = div; changed = true; } if let Some(ir) = num_param(p, "innerRadius") { - *inner_radius = ir.clamp(0.0, 0.999); + *inner_radius = ir; changed = true; } changed @@ -470,11 +569,12 @@ fn apply_shape_params(cs: &mut CustomShape, p: &Value, reset: bool) -> bool { } } -fn parse_mode(m: &str) -> shapes::EllipseMode { +fn parse_mode(m: &str) -> Option { match m { - "pie" | "slice" => shapes::EllipseMode::Slice, - "chord" => shapes::EllipseMode::Chord, - "arc" | "open" => shapes::EllipseMode::Arc, - _ => shapes::EllipseMode::Whole, + "whole" => Some(shapes::EllipseMode::Whole), + "pie" | "slice" => Some(shapes::EllipseMode::Slice), + "chord" => Some(shapes::EllipseMode::Chord), + "arc" | "open" => Some(shapes::EllipseMode::Arc), + _ => None, } } diff --git a/crates/engine/src/cmd/addons/shapes/tests.rs b/crates/engine/src/cmd/addons/shapes/tests.rs index 793ae6074c..bc5f1359e2 100644 --- a/crates/engine/src/cmd/addons/shapes/tests.rs +++ b/crates/engine/src/cmd/addons/shapes/tests.rs @@ -135,3 +135,169 @@ fn addon_shapes_commands_and_format_roundtrip_preserve_paths() { assert_eq!(CustomShape::read(a), CustomShape::read(b)); } } + +fn id_of(s: &mut Session, cmd: &str, p: serde_json::Value) -> NodeId { + NodeId(s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd} {p}: {e}"))["id"].as_u64().unwrap()) +} + +fn shape_of(s: &Session, id: NodeId) -> CustomShape { + CustomShape::read(s.doc().unwrap().doc.node(id).unwrap()).unwrap() +} + +/// Runs `cmd` with `p`, which must fail with `msg` and leave the document and its history as they +/// were. +fn refused(s: &mut Session, cmd: &str, p: serde_json::Value, msg: &str) { + let saved = vectorcraft_format::save(&s.doc().unwrap().doc, false); + let undo = s.doc().unwrap().history.undo.len(); + let e = s.execute(cmd, &p).map(|v| v.to_string()).unwrap_err().to_string(); + assert!(e.contains(msg), "{cmd} {p}: {e}"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{cmd} {p}"); + assert_eq!(vectorcraft_format::save(&s.doc().unwrap().doc, false), saved, "{cmd} {p}"); +} + +#[test] +fn polygon_and_star_refuse_counts_that_are_not_whole_numbers_from_3_to_1000() { + let mut s = new_session(); + for n in [json!(2.5), json!(2), json!(0), json!(-6), json!(1000.5), json!(5000), json!(4_294_967_299u64)] { + let x = n.as_f64().unwrap(); + let p = json!({"cx": 0.0, "cy": 0.0, "radius": 10.0, "sides": n}); + refused(&mut s, "addon.shapes.polygon", p, &format!("`sides` must be a whole number between 3 and 1000 (got {x})")); + let p = json!({"cx": 0.0, "cy": 0.0, "radius1": 10.0, "points": n}); + refused(&mut s, "addon.shapes.star", p, &format!("`points` must be a whole number between 3 and 1000 (got {x})")); + } + refused(&mut s, "addon.shapes.polygon", json!({"cx": 0.0, "cy": 0.0, "radius": 10.0, "sides": "6"}), "`sides` must be a number"); + refused(&mut s, "addon.shapes.star", json!({"cx": 0.0, "cy": 0.0, "radius1": 10.0, "points": [5]}), "`points` must be a number"); + + // The ends of the range are taken as given, and an omitted or null count is the default. + for (n, want) in [(json!(3), 3), (json!(1000), 1000), (json!(7.0), 7), (json!(null), 6)] { + let id = id_of(&mut s, "addon.shapes.polygon", json!({"cx": 0.0, "cy": 0.0, "radius": 10.0, "sides": n})); + assert!(matches!(shape_of(&s, id), CustomShape::Polygon { sides, spoke_ratio: None, .. } if sides == want), "{n}"); + } + let id = id_of(&mut s, "addon.shapes.polygon", json!({"cx": 0.0, "cy": 0.0, "radius": 10.0})); + assert!(matches!(shape_of(&s, id), CustomShape::Polygon { sides: 6, .. })); + for (n, want) in [(json!(3), 3), (json!(1000), 1000), (json!(null), 5)] { + let id = id_of(&mut s, "addon.shapes.star", json!({"cx": 0.0, "cy": 0.0, "radius1": 10.0, "points": n})); + assert!(matches!(shape_of(&s, id), CustomShape::Polygon { sides, spoke_ratio: Some(_), .. } if sides == want), "{n}"); + } +} + +#[test] +fn shapes_refuse_numbers_outside_their_ranges() { + let mut s = new_session(); + let poly = json!({"cx": 0.0, "cy": 0.0, "radius": 10.0}); + let star = json!({"cx": 0.0, "cy": 0.0, "radius1": 10.0}); + let spiral = json!({"cx": 0.0, "cy": 0.0, "radius": 10.0}); + let with = |base: &serde_json::Value, key: &str, v: f64| { + let mut p = base.clone(); + p[key] = json!(v); + p + }; + for (cmd, base, key, bad, good) in [ + ("addon.shapes.polygon", &poly, "rounded", [-10.5, 10.5], [-10.0, 10.0]), + ("addon.shapes.polygon", &poly, "randomized", [-11.0, 10.01], [-10.0, 10.0]), + ("addon.shapes.star", &star, "rounded", [-10.5, 10.5], [-10.0, 10.0]), + ("addon.shapes.star", &star, "randomized", [-11.0, 10.01], [-10.0, 10.0]), + ("addon.shapes.star", &star, "radius2", [0.05, 11.0], [0.1, 10.0]), + ("addon.shapes.spiral", &spiral, "turns", [0.0, 1024.5], [0.01, 1024.0]), + ("addon.shapes.spiral", &spiral, "divergence", [-0.1, 1000.5], [0.0, 1000.0]), + ("addon.shapes.spiral", &spiral, "innerRadius", [-0.1, 1.0], [0.0, 0.999]), + ] { + let (min, max) = (good[0], good[1]); + for x in bad { + refused(&mut s, cmd, with(base, key, x), &format!("`{key}` must be between {min} and {max} (got {x})")); + } + for x in good { + s.execute(cmd, &with(base, key, x)).unwrap_or_else(|e| panic!("{cmd} {key} {x}: {e}")); + } + } + + // Sizes are not negative. + for (cmd, p, key) in [ + ("addon.shapes.polygon", json!({"cx": 0.0, "cy": 0.0, "radius": -10.0}), "radius"), + ("addon.shapes.star", json!({"cx": 0.0, "cy": 0.0, "radius1": -10.0}), "radius1"), + ("addon.shapes.spiral", json!({"cx": 0.0, "cy": 0.0, "radius": -10.0}), "radius"), + ("addon.shapes.rectangle", json!({"x": 0.0, "y": 0.0, "width": -10.0, "height": 10.0}), "width"), + ("addon.shapes.rectangle", json!({"x": 0.0, "y": 0.0, "width": 10.0, "height": 10.0, "radius": -1.0}), "radius"), + ("addon.shapes.ellipse", json!({"x": 0.0, "y": 0.0, "width": 10.0, "height": -10.0}), "height"), + ("addon.shapes.box3d", json!({"x": 0.0, "y": 0.0, "width": -10.0, "height": 10.0}), "width"), + ] { + refused(&mut s, cmd, p, &format!("`{key}` must be a number not below 0")); + } + + // Corner radii are four numbers that are not negative. + for radii in [json!([1.0, 2.0, 3.0]), json!([1.0, 2.0, 3.0, -4.0]), json!([1.0, 2.0, 3.0, "4"]), json!(4.0)] { + let p = json!({"x": 0.0, "y": 0.0, "width": 100.0, "height": 80.0, "radii": radii}); + refused(&mut s, "addon.shapes.rectangle", p, "`radii` must be four numbers not below 0: [tl, tr, br, bl]"); + } + + // An arc mode is one of the names the commands take. + for mode in [json!("slices"), json!(""), json!(3)] { + let p = json!({"x": 0.0, "y": 0.0, "width": 100.0, "height": 80.0, "arcMode": mode}); + refused(&mut s, "addon.shapes.rectangle", p.clone(), "`arcMode` must be one of whole, pie, chord, arc"); + refused(&mut s, "addon.shapes.ellipse", p, "`arcMode` must be one of whole, pie, chord, arc"); + } + for mode in ["whole", "pie", "slice", "chord", "arc", "open"] { + s.execute("addon.shapes.ellipse", &json!({"x": 0.0, "y": 0.0, "width": 100.0, "height": 80.0, "arcMode": mode})).unwrap(); + } +} + +#[test] +fn configure_refuses_values_outside_their_ranges_before_changing_any_shape() { + let mut s = new_session(); + let rect = id_of(&mut s, "addon.shapes.rectangle", json!({"x": 0.0, "y": 0.0, "width": 100.0, "height": 80.0, "radius": 4.0})); + let poly = id_of(&mut s, "addon.shapes.polygon", json!({"cx": 50.0, "cy": 50.0, "radius": 40.0, "sides": 5})); + let spiral = id_of(&mut s, "addon.shapes.spiral", json!({"cx": 60.0, "cy": 60.0, "radius": 45.0})); + let ids = json!([rect.0, poly.0, spiral.0]); + let cfg = |key: &str, v: serde_json::Value| json!({"ids": ids.clone(), key: v}); + let c = "addon.shapes.configure"; + for n in [json!(2.5), json!(2), json!(-1), json!(5000), json!(4_294_967_299u64)] { + let x = n.as_f64().unwrap(); + refused(&mut s, c, cfg("sides", n), &format!("`sides` must be a whole number between 3 and 1000 (got {x})")); + } + for (key, bad, min, max) in [ + ("spokeRatio", [0.0, 1.5], 0.01, 1.0), + ("rounded", [-10.5, 11.0], -10.0, 10.0), + ("randomized", [-11.0, 10.5], -10.0, 10.0), + ("turns", [0.0, 2000.0], 0.01, 1024.0), + ("divergence", [-1.0, 1000.5], 0.0, 1000.0), + ("innerRadius", [-0.5, 1.0], 0.0, 0.999), + ] { + for x in bad { + refused(&mut s, c, cfg(key, json!(x)), &format!("`{key}` must be between {min} and {max} (got {x})")); + } + } + refused(&mut s, c, cfg("radius", json!(-1.0)), "`radius` must be a number not below 0"); + for radii in [json!([1.0, 2.0]), json!([1.0, 2.0, 3.0, -1.0]), json!("4")] { + refused(&mut s, c, cfg("radii", radii), "`radii` must be four numbers not below 0: [tl, tr, br, bl]"); + } + refused(&mut s, c, cfg("arcMode", json!("bogus")), "`arcMode` must be one of whole, pie, chord, arc"); + // A valid value next to a refused one changes no shape either. + refused(&mut s, c, json!({"ids": ids.clone(), "sides": 8, "turns": 0.0}), "`turns` must be between 0.01 and 1024 (got 0)"); + + // In range, the values are taken as given; a radius larger than the rectangle takes is fitted to it. + s.execute(c, &json!({"ids": [poly.0], "sides": 1000, "rounded": -10.0, "randomized": 10.0})).unwrap(); + assert!(matches!(shape_of(&s, poly), CustomShape::Polygon { sides: 1000, rounded, randomized, .. } if rounded == -10.0 && randomized == 10.0)); + s.execute(c, &json!({"ids": [poly.0], "sides": 3})).unwrap(); + assert!(matches!(shape_of(&s, poly), CustomShape::Polygon { sides: 3, .. })); + s.execute(c, &json!({"ids": [spiral.0], "turns": 1024.0, "divergence": 0.0, "innerRadius": 0.999})).unwrap(); + assert!( + matches!(shape_of(&s, spiral), CustomShape::Spiral { turns, divergence, inner_radius, .. } if turns == 1024.0 && divergence == 0.0 && inner_radius == 0.999) + ); + s.execute(c, &json!({"ids": [rect.0], "radius": 1000.0})).unwrap(); + assert!(matches!(shape_of(&s, rect), CustomShape::Rectangle { radii, .. } if radii == [40.0; 4])); +} + +#[test] +fn configure_records_no_undo_step_when_nothing_changes() { + let mut s = new_session(); + let poly = id_of(&mut s, "addon.shapes.polygon", json!({"cx": 50.0, "cy": 50.0, "radius": 40.0, "sides": 5, "rounded": 0.5})); + let undo = s.doc().unwrap().history.undo.len(); + let r = s.execute("addon.shapes.configure", &json!({"ids": [poly.0], "sides": 5, "rounded": 0.5})).unwrap(); + assert_eq!(r["updated"], 0); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + + let r = s.execute("addon.shapes.configure", &json!({"ids": [poly.0], "sides": 6})).unwrap(); + assert_eq!(r["updated"], 1); + assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1); + assert!(matches!(shape_of(&s, poly), CustomShape::Polygon { sides: 6, .. })); +} diff --git a/crates/engine/src/cmd/appearance.rs b/crates/engine/src/cmd/appearance.rs index 02bc111746..97230cec0e 100644 --- a/crates/engine/src/cmd/appearance.rs +++ b/crates/engine/src/cmd/appearance.rs @@ -36,7 +36,7 @@ use super::paint::paint_from; use super::{AppearanceAttrs, EyedropperAttrs, FillAttrs, StrokeAttrs}; use super::{ CommandSpec, NodeId, Result, Session, bad, check_numbers, check_switches, cmd, has_doc, has_selection, ids_param, index, leaf_targets, - object_param, ok, paint_targets, str_param, switch_or, targets, + object_param, ok, paint_targets, str_param, switch_or, targets, u64_req, }; use crate::EngineError; @@ -529,9 +529,11 @@ fn require_targets(s: &Session, p: &Value, cmd: &str) -> Result> { /// One undo step (`label`) running `f` on each of `ids` with the item a fill (`fill`) or stroke /// edit aimed at `item` changes there (`None`: the topmost one; text then edits its characters). -/// What the edit changes on the topmost visible fill and stroke of graph series marks is stored on -/// their graphs in the same step ([`capture_series_changes`]). Nothing targeted is not an edit, and -/// when `f` leaves every target as it was, the document and its undo history stay as they are. +/// What the edit changes on the topmost visible fill and stroke of graph series marks, and on the +/// rows and characters of graph labels, is stored on their graphs in the same step +/// ([`capture_series_changes`], [`super::graph::capture_label_changes`]). Nothing targeted is not +/// an edit, and when `f` leaves every target as it was, the document and its undo history stay as +/// they are. pub(crate) fn edit_items( s: &mut Session, ids: &[NodeId], @@ -541,7 +543,12 @@ pub(crate) fn edit_items( fill: bool, f: impl FnMut(&mut Node, Option) -> Result<()>, ) -> Result<()> { - edit_items_then(s, ids, item, cmd, label, fill, f, |before, d, edited| Ok(capture_series_changes(before, d, edited))) + edit_items_then(s, ids, item, cmd, label, fill, f, |before, d, edited| { + let series = capture_series_changes(before, d, edited); + // The rows `f` edited are kept by `edit_items_then`. + let labels = super::graph::capture_label_changes(before, d, edited, false); + Ok(series || labels) + }) } /// [`edit_items`], then `after` on the document as it was before the edit, the edited document and @@ -604,9 +611,9 @@ pub(crate) fn edits_stroke(s: &Session, p: &Value, item: ItemTarget, default: bo Ok(ids.get(item.anchor(s, &ids)).and_then(|id| d.node(*id)?.appearance.items.get(index)).map_or(default, |it| !it.is_fill())) } -/// The whole number of 0 or more that `key` holds, read with [`index`]. +/// The whole number of 0 or more that `key` holds, read with [`u64_req`] and [`index`]. pub(crate) fn index_param(p: &Value, key: &str, cmd: &str) -> Result { - p.get(key).and_then(Value::as_u64).map(index).ok_or_else(|| bad(cmd, format!("missing integer `{key}`"))) + u64_req(p, key, cmd).map(index) } fn set_active_item(s: &mut Session, p: &Value) -> Result { diff --git a/crates/engine/src/cmd/assets.rs b/crates/engine/src/cmd/assets.rs index 1ebde5c026..e30e6efcdc 100644 --- a/crates/engine/src/cmd/assets.rs +++ b/crates/engine/src/cmd/assets.rs @@ -53,7 +53,7 @@ pub fn specs() -> Vec { "Export Assets", [], None, - "{assets?: [asset id…] (default all but the 3D assets, which assets.export3D writes), folder?, zip?, openLocation?, formats?, preset?, settings?, prefix?, subfolders?, antiAlias?} each asset's art alone, cropped to it, in every format row: document.exportForScreens {assets} at the document's export settings (document.exportSettings) under the ones given; with subfolders false every file goes into the folder itself, mobile and density rows too → what document.exportForScreens returns (no folder: the files, or one zip, as dataBase64). Leaves the remembered settings as they are (assets.settings.set changes them)", + "{assets?: [asset id…] (default all but the 3D assets, which assets.export3D writes), folder?, zip?, openLocation?, formats?, preset?, settings?, prefix?, subfolders?, antiAlias?} each asset's art alone, cropped to it, in every format row: document.exportForScreens {assets} at the document's export settings (document.exportSettings) under the ones given; with subfolders false every file goes into the folder itself, mobile and density rows too → what document.exportForScreens returns (no folder: the files, or one zip, as dataBase64; warnings name a key in the rows or settings given that only another format takes, not one in the remembered settings). Leaves the remembered settings as they are (assets.settings.set changes them)", has_doc, export ), @@ -429,7 +429,7 @@ fn export(s: &mut Session, p: &Value) -> Result { } q.insert("assets".into(), json!(all)); } - export_screens(s, &Value::Object(q)).map_err(|e| of_cmd(C, e)) + export_screens(s, &Value::Object(q), p).map_err(|e| of_cmd(C, e)) } fn settings_set(s: &mut Session, p: &Value) -> Result { diff --git a/crates/engine/src/cmd/brushsym.rs b/crates/engine/src/cmd/brushsym.rs index 50c63b59cd..1046cada1c 100644 --- a/crates/engine/src/cmd/brushsym.rs +++ b/crates/engine/src/cmd/brushsym.rs @@ -180,7 +180,7 @@ pub fn specs() -> Vec { "Paintbrush", [], None, - "{…params as path.freehand, brush} paint a freehand stroke with a brush → {id}", + "{…params as path.freehand, brush?: name} paint a freehand stroke with a brush; without `brush` (or with null) the plain path is drawn; a `brush` that names no brush in the document, or a `style` other than \"pencil\" or \"brush\", is an error and nothing is drawn → {id}", has_doc, brush_freehand ), @@ -226,7 +226,7 @@ pub fn specs() -> Vec { "Break Link to Symbol", [], None, - "{ids?|id?} expand selected instances into plain art (with their appearance changes to a dynamic symbol), placed through the symbol's 9-slice guides when it has them, with the instance's opacity mask; a hidden or locked instance's art stays hidden or locked and is not selected → {ids}", + "{ids?|id?} expand selected instances into plain art (with their appearance changes to a dynamic symbol), placed through the symbol's 9-slice guides when it has them, with the instance's opacity mask and its own bounding box (square after Reset Bounding Box); a hidden or locked instance's art stays hidden or locked and is not selected → {ids}", has_selection, symbol_break_link ), diff --git a/crates/engine/src/cmd/brushsym/brushes.rs b/crates/engine/src/cmd/brushsym/brushes.rs index 1f63076cfd..7fd8c9aa9a 100644 --- a/crates/engine/src/cmd/brushsym/brushes.rs +++ b/crates/engine/src/cmd/brushsym/brushes.rs @@ -729,8 +729,21 @@ pub(super) fn expand_brush(s: &mut Session, p: &Value) -> Result { Ok(json!({ "ids": ids_json(&out) })) } +/// Paints a `path.freehand` stroke with the brush `brush` names. A `brush` left out or null draws +/// the plain path; a `brush` that is not a string or names no brush in the document, and a `style` +/// other than "pencil" or "brush", is an error before anything is drawn. pub(super) fn brush_freehand(s: &mut Session, p: &Value) -> Result { - let name = str_param(p, "brush").map(str::to_string).filter(|n| s.doc().is_ok_and(|st| brush::find(&st.doc, n).is_some())); + const C: &str = "brush.freehand"; + let name = match crate::cmd::text_param(p, "brush", C)? { + None => None, + Some(n) if brush::find(&s.doc()?.doc, n).is_some() => Some(n.to_string()), + Some(n) => return Err(bad(C, format!("no brush named `{n}`"))), + }; + match p.get("style") { + None | Some(Value::Null) => {} + Some(v) if matches!(v.as_str(), Some("pencil" | "brush")) => {} + Some(v) => return Err(bad(C, format!("`style` must be \"pencil\" or \"brush\", not {v}"))), + } let spec = find_command("path.freehand").ok_or_else(|| EngineError::UnknownCommand("path.freehand".into()))?; let r = crate::cmd::run_checked(s, spec, p)?; let (Some(name), Some(id)) = (name, id_param(&r, "id")) else { return Ok(r) }; diff --git a/crates/engine/src/cmd/brushsym/symbols.rs b/crates/engine/src/cmd/brushsym/symbols.rs index 2fb31c5f6b..1bfb8edea7 100644 --- a/crates/engine/src/cmd/brushsym/symbols.rs +++ b/crates/engine/src/cmd/brushsym/symbols.rs @@ -393,8 +393,10 @@ pub(super) fn symbol_place(s: &mut Session, p: &Value) -> Result { /// The plain art of instance `inst` in document space (fresh ids), with the instance's own /// appearance changes to a dynamic symbol's art when `own`, placed through its symbol's 9-slice -/// guides when it has them. The instance's opacity mask goes on the art, or on a group around it -/// when the art has a mask of its own. +/// guides when it has them. The art's bounding boxes turn with the instance's own box, so after +/// Reset Bounding Box they stand as the instance's box does. The instance's opacity mask goes on +/// the art, or on a group around it when the art has a mask of its own; a group added around the +/// art takes the instance's box angle. fn expanded_instance(d: &mut Document, inst: &Node, own: bool) -> Option { let NodeKind::SymbolInstance { symbol, xf } = &inst.kind else { return None }; let sym = d.symbols.iter().find(|s| &s.name == symbol)?; @@ -402,12 +404,17 @@ fn expanded_instance(d: &mut Document, inst: &Node, own: bool) -> Option { if let Some((color, amount)) = brush::stain(inst) { brush::tint_node(&mut art, &color, amount); } - let art = d.place_symbol_art(symbol, &art, *xf)?; + let mut art = d.place_symbol_art(symbol, &art, *xf)?; + let turn = vectorcraft_doc::orient::placed_turn(inst.bbox_angle, *xf); + if turn != 0.0 { + art.turn_boxes(turn); + } let mut art = d.reid(&art); if inst.opacity < 1.0 || inst.blend != vectorcraft_color::BlendMode::Normal { if !matches!(art.kind, NodeKind::Group { .. }) { let id = d.alloc_id(); art = Node::group(id, vec![Arc::new(art)]); + art.bbox_angle = inst.bbox_angle; } art.opacity *= inst.opacity; art.blend = inst.blend; @@ -416,6 +423,7 @@ fn expanded_instance(d: &mut Document, inst: &Node, own: bool) -> Option { if art.extras().mask.is_some() { let id = d.alloc_id(); art = Node::group(id, vec![Arc::new(art)]); + art.bbox_angle = inst.bbox_angle; } art.extras_mut().mask = Some(mask.clone()); } diff --git a/crates/engine/src/cmd/buildcmds.rs b/crates/engine/src/cmd/buildcmds.rs index 3fc5953619..06ec06e348 100644 --- a/crates/engine/src/cmd/buildcmds.rs +++ b/crates/engine/src/cmd/buildcmds.rs @@ -99,7 +99,7 @@ pub fn specs() -> Vec { "Expand", ["Object", "Live Paint"], None, - "{id?, ids?: [id…] (instead of id)} turn Live Paint groups into plain groups of their painted faces and edges → {ids}", + "{id?, ids?: [id…] (instead of id)} turn Live Paint groups into plain groups of the faces and edges that draw, with all their fill and stroke rows: a shown face or edge with an opacity above 0 and a shown fill or stroke row that has paint and an opacity above 0 (a stroke also a weight above 0), whichever row is on top → {ids}", has_selection_or_ids, lp_expand ), diff --git a/crates/engine/src/cmd/buildcmds/live_paint.rs b/crates/engine/src/cmd/buildcmds/live_paint.rs index fb9e6c32ac..9c3c750996 100644 --- a/crates/engine/src/cmd/buildcmds/live_paint.rs +++ b/crates/engine/src/cmd/buildcmds/live_paint.rs @@ -1,7 +1,7 @@ use super::{ - Appearance, Arc, Beside, Document, EDGE_NAME, EngineError, FACE_NAME, GapOptions, GapSize, LIVE_PAINT_NAME, Node, NodeId, Paint, PathData, Point, - Rect, Result, SOURCES_NAME, Selection, Session, SubPath, Value, b, bad, build_children, edge_near, face_at, finite, ids_json, is_live_paint, - json, number_or, object_param, paint_from, po, point_param, repaint_from, replace_roots, root_ids, source_nodes, source_shapes, switch_or, + Appearance, Arc, Beside, Document, EDGE_NAME, EngineError, FACE_NAME, GapOptions, GapSize, LIVE_PAINT_NAME, Node, NodeId, PathData, Point, Rect, + Result, SOURCES_NAME, Selection, Session, SubPath, Value, b, bad, build_children, edge_near, face_at, finite, ids_json, is_live_paint, json, + number_or, object_param, paint_from, po, point_param, repaint_from, replace_roots, root_ids, source_nodes, source_shapes, switch_or, }; /// `options` as stored on a Live Paint group: none for the defaults. @@ -84,6 +84,35 @@ pub(super) fn lp_make(s: &mut Session, p: &Value) -> Result { Ok(json!({ "id": id.0, "faces": faces, "edges": edges })) } +/// What Merge carries from a face or edge to the part it makes again in its place, another path: +/// the appearance, visibility, opacity and blending mode. Gradients fitted to the old outline keep +/// that fit, and the strokes' pen pressure, tilt, bearing and rotation stay behind. +struct Carried { + appearance: Appearance, + visible: bool, + opacity: f32, + blend: vectorcraft_color::BlendMode, +} + +impl Carried { + fn of(n: &Node) -> Self { + let mut appearance = (*n.appearance).clone().without_pressure(); + if appearance.has_unplaced_gradient() + && let Some(bounds) = n.geometric_bounds() + { + appearance.pin_gradients(bounds); + } + Self { appearance, visible: n.visible, opacity: n.opacity, blend: n.blend } + } + + fn onto(self, n: &mut Node) { + n.appearance = self.appearance.into(); + n.visible = self.visible; + n.opacity = self.opacity; + n.blend = self.blend; + } +} + /// Add the other `roots` (back → front) to the first Live Paint group among them, which keeps its /// id, the paint of its faces and edges, and its own properties apart from the Gap Options, which /// are merged; returns (group, faces, edges). @@ -95,18 +124,16 @@ fn merge_live(d: &mut Document, sel: &mut Selection, roots: &[NodeId]) -> Result .ok_or_else(|| EngineError::Other("Live Paint Merge: select a Live Paint group and the paths to add".into()))?; check_live_paint_takes(d, roots)?; let old = d.node(target).cloned().ok_or(EngineError::NoNode(target))?; - // Paint to carry over: (point inside face, fill) and (point on edge, stroke). - let keep_faces: Vec<(Point, Paint)> = b::faces(&old) - .iter() - .filter(|f| !f.appearance.fill_paint().is_none()) - .filter_map(|f| Some((po::interior_point(f.path_data()?)?, f.appearance.fill_paint()))) - .collect(); - let keep_edges: Vec<(Point, Appearance)> = b::edges(&old) + // Paint to carry over: (point inside face, paint) for faces that draw, and (point on edge, + // paint) for every edge. + let keep_faces: Vec<(Point, Carried)> = + b::faces(&old).iter().filter(|f| draws(f)).filter_map(|f| Some((po::interior_point(f.path_data()?)?, Carried::of(f)))).collect(); + let keep_edges: Vec<(Point, Carried)> = b::edges(&old) .iter() .filter_map(|e| { let pd = e.path_data()?; let sp = pd.subpaths.first().filter(|sp| sp.segment_count() > 0)?; - Some((kurbo::ParamCurve::eval(&sp.segment(0), 0.5), (*e.appearance).clone())) + Some((kurbo::ParamCurve::eval(&sp.segment(0), 0.5), Carried::of(e))) }) .collect(); let mut sources = source_nodes(&old); @@ -126,20 +153,20 @@ fn merge_live(d: &mut Document, sel: &mut Selection, roots: &[NodeId]) -> Result *ch = children; } g.extras_mut().live_paint_gaps = stored_gap_options(options); - for (pt, paint) in keep_faces { + for (pt, carried) in keep_faces { if let Some(fid) = face_at(&g, pt).map(|f| f.id) && let Some(ch) = g.children_mut() && let Some(f) = ch.iter_mut().find(|c| c.id == fid) { - Arc::make_mut(f).appearance.set_fill(paint); + carried.onto(Arc::make_mut(f)); } } - for (pt, app) in keep_edges { + for (pt, carried) in keep_edges { if let Some(eid) = edge_near(&g, pt, 0.5).map(|e| e.id) && let Some(ch) = g.children_mut() && let Some(e) = ch.iter_mut().find(|c| c.id == eid) { - Arc::make_mut(e).appearance = app.into(); + carried.onto(Arc::make_mut(e)); } } let mut merged = Beside::replacing(d, roots); @@ -191,6 +218,13 @@ pub(super) fn lp_release(s: &mut Session, p: &Value) -> Result { Ok(json!({ "ids": ids_json(&ids) })) } +/// Does face or edge `n` draw on the canvas: it is shown, its opacity is above 0, and a fill or +/// stroke row of its appearance draws (see [`Appearance::has_drawn_fill`] and +/// [`Appearance::has_drawn_stroke`])? +fn draws(n: &Node) -> bool { + n.visible && n.opacity > 0.0 && (n.appearance.has_drawn_fill() || n.appearance.has_drawn_stroke()) +} + pub(super) fn lp_expand(s: &mut Session, p: &Value) -> Result { let targets = live_targets(s, p)?; s.edit("Expand Live Paint", |d, sel| { @@ -205,8 +239,7 @@ pub(super) fn lp_expand(s: &mut Session, p: &Value) -> Result { if let Some(ch) = n.children_mut() { ch.retain(|c| match c.name.as_deref() { Some(SOURCES_NAME) => false, - Some(FACE_NAME) => !c.appearance.fill_paint().is_none(), - Some(EDGE_NAME) => !c.appearance.stroke_paint().is_none() && c.appearance.stroke_width() > 0.0, + Some(FACE_NAME | EDGE_NAME) => draws(c), _ => true, }); } diff --git a/crates/engine/src/cmd/buildcmds/trace.rs b/crates/engine/src/cmd/buildcmds/trace.rs index 11519b84be..932ef1819a 100644 --- a/crates/engine/src/cmd/buildcmds/trace.rs +++ b/crates/engine/src/cmd/buildcmds/trace.rs @@ -526,12 +526,15 @@ fn color_groups(cmd: &str, d: &mut Document, items: Vec>) -> Result, /// The settings traced with, as JSON. @@ -600,7 +603,7 @@ fn prepare(s: &Session, c: &str, p: &Value) -> Result { let bytes = Arc::clone(&blob.bytes); let library = trace_library(c, s, &mut params)?; let traced_with = serde_json::to_value(¶ms).map_err(|e| EngineError::Other(e.to_string()))?; - let inputs = TraceInputs { target, image, params: traced_with, swatches: params.swatches.clone(), bytes }; + let inputs = TraceInputs { doc: s.doc()?.uid, target, image, params: traced_with, swatches: params.swatches.clone(), bytes }; Ok(Prepared { inputs, trace: params, view, params_json, preset_label, library }) } @@ -612,8 +615,9 @@ pub struct Traced { } impl Traced { - /// Hand it to the next run of its command with the same inputs ([`TraceRun::params`]), which - /// applies it as one undo step instead of tracing again. Any other trace drops it. + /// Hand it to the next run of its command with the same inputs ([`TraceRun::params`]) in the + /// document it was made in, which applies it as one undo step instead of tracing again. Any + /// other trace drops it, a trace in another document included. pub fn hand_in(self, s: &mut Session) { s.trace_hand_off = Some(self); } @@ -686,7 +690,7 @@ impl TraceRun { } /// Does it still apply: would the command trace the same object, image, pixels and settings - /// now? + /// now, in the document it was prepared in? pub fn current(&self, s: &Session) -> bool { prepare(s, self.command, &self.params).is_ok_and(|now| now.inputs == self.prepared.inputs) } diff --git a/crates/engine/src/cmd/clipboard/resources.rs b/crates/engine/src/cmd/clipboard/resources.rs index bdb238ce83..f457712415 100644 --- a/crates/engine/src/cmd/clipboard/resources.rs +++ b/crates/engine/src/cmd/clipboard/resources.rs @@ -127,6 +127,17 @@ fn node_refs(n: &Node, f: Visit) { if let Some(cm) = Document::color_mask_of(m) { f(Ref::Name(Res::Image, &cm.key)); } + // A graph keeps paints and style names for its series and labels, which a redraw gives them. + if let Some(g) = m.extras().graph.as_deref() { + vectorcraft_doc::swatches::graph_paints(m).for_each(|p| paint_refs(p, f)); + let l = &g.label_styles; + for s in [&l.values, &l.categories, &l.legend].into_iter().flatten().filter_map(|st| st.style_name.as_ref()) { + f(Ref::Name(Res::CharStyle, s)); + } + for s in [&l.values_para, &l.categories_para, &l.legend_para].into_iter().flatten().filter_map(|pa| pa.style_name.as_ref()) { + f(Ref::Name(Res::ParaStyle, s)); + } + } match &m.kind { NodeKind::Text(t) => { for r in &t.runs { @@ -671,6 +682,27 @@ impl Relink { self.name(Res::Image, &mut cm.key); self.name(Res::Image, &mut cm.from); } + if let Some(g) = n.extras_if_any().and_then(|e| e.graph.as_deref_mut()) { + for s in &mut g.series_paints { + s.fill.iter_mut().chain(s.stroke.iter_mut()).for_each(|p| self.paint(p)); + } + let l = &mut g.label_styles; + for st in [&mut l.values, &mut l.categories, &mut l.legend].into_iter().flatten() { + self.paint(&mut st.fill); + self.paint(&mut st.stroke); + if let Some(s) = &mut st.style_name { + self.name(Res::CharStyle, s); + } + } + for pa in [&mut l.values_para, &mut l.categories_para, &mut l.legend_para].into_iter().flatten() { + if let Some(s) = &mut pa.style_name { + self.name(Res::ParaStyle, s); + } + } + for r in [&mut l.values_rows, &mut l.categories_rows, &mut l.legend_rows].into_iter().flatten() { + r.paint.fill.iter_mut().chain(r.paint.stroke.iter_mut()).for_each(|p| self.paint(p)); + } + } match &mut n.kind { NodeKind::Text(t) => { for r in &mut t.runs { diff --git a/crates/engine/src/cmd/colorcmds.rs b/crates/engine/src/cmd/colorcmds.rs index 2395c51f8e..8377822094 100644 --- a/crates/engine/src/cmd/colorcmds.rs +++ b/crates/engine/src/cmd/colorcmds.rs @@ -36,7 +36,7 @@ pub fn specs() -> Vec { "Invert Colors", ["Edit", "Edit Colors"], None, - "{fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?} replace each colour by its RGB inverse (keeps the colour model) in fills, strokes, text, gradient meshes (with fills), colorized image fills (their pixels stay unchanged), other embedded images (a recoloured copy) and pattern tiles (a new pattern swatch; the original stays), as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke (docs/mcp.md) → {changed, notChanged: {locked, hidden} (when the selection is everything select.all takes: the locked and hidden objects it left out whose colors would have changed; an object both hidden and locked counts as hidden), warning?: set when notChanged counts any object}", + "{fill?: true, stroke?: true, includeImages?: true, includePatterns?: true, ids?} replace each colour by its RGB inverse (keeps the colour model) in fills, strokes, text, gradient meshes (with fills), colorized image fills (their pixels stay unchanged), other embedded images (a recoloured copy) and pattern tiles (a new pattern swatch; the original stays), as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind (docs/mcp.md) → {changed, notChanged: {locked, hidden} (when the selection is everything select.all takes: the locked and hidden objects it left out whose colors would have changed; an object both hidden and locked counts as hidden), warning?: set when notChanged counts any object}", has_selection, |s, p| recolor(s, p, "edit.colors.invert", "Invert Colors", &invert) ), @@ -513,14 +513,16 @@ pub(crate) fn edit_if_changed(s: &mut Session, label: &str, f: impl FnOnce(&D } /// Run `recolor` on `d` (it returns how many objects it changed) over `roots`, then store on their graphs what it changed -/// on the graph series marks among `roots` and inside them, so the marks keep their new paint when the graph is drawn -/// again. +/// on the graph series marks and graph labels among `roots` and inside them, so the marks and every label of a kind keep +/// their new paint when the graph is drawn again. pub(crate) fn keeping_series_paint(d: &mut Document, roots: &[NodeId], recolor: impl FnOnce(&mut Document) -> Result) -> Result { let marks = super::graph::series_marks_in(d, roots); - let before = (!marks.is_empty()).then(|| d.clone()); + let labels = super::graph::labels_in(d, roots); + let before = (!marks.is_empty() || !labels.is_empty()).then(|| d.clone()); let n = recolor(d)?; if let Some(before) = before.filter(|_| n > 0) { super::appearance::capture_series_changes(&before, d, &marks); + super::graph::capture_label_changes(&before, d, &labels, true); } Ok(n) } diff --git a/crates/engine/src/cmd/colormgmt.rs b/crates/engine/src/cmd/colormgmt.rs index 66295f50f2..4e4da57f9c 100644 --- a/crates/engine/src/cmd/colormgmt.rs +++ b/crates/engine/src/cmd/colormgmt.rs @@ -9,7 +9,8 @@ //! ([`use_front_profiles`]): when they are assigned, when the working settings change, and when the //! document comes to the front or its assignment comes back (an open, a switch, a close, a revert, //! an undo or a rollback, [`Session::sync_front_profiles`]); the working spaces stay as Edit → Color -//! Settings set them. +//! Settings set them. A document drawn while another is in front draws through its own profiles +//! ([`doc_cms`]). use std::collections::BTreeMap; use std::sync::Arc; @@ -236,6 +237,9 @@ fn load_profile(s: &mut Session, p: &Value) -> Result { } else if proof_targets(&info.name) { // A new file of the CMYK profile View → Proof Setup targets: redraw. touch_all(s); + } else { + // Documents behind the front one draw through their own profiles: those assigned it redraw. + touch_assigned(s, &info.name); } Ok(json!({"name": info.name, "kind": info.kind, "remembered": remembered})) } @@ -266,9 +270,21 @@ fn remove_profile(s: &mut Session, p: &Value) -> Result { if proof_targets(&info.name) { touch_all(s); } + // Documents behind the front one draw through their own profiles: those assigned it redraw. + touch_assigned(s, &info.name); Ok(json!({"removed": info.name})) } +/// Redraw the open documents assigned the profile `name`. +fn touch_assigned(s: &mut Session, name: &str) { + for d in &mut s.docs { + let (rgb, cmyk) = doc_profiles(&d.doc); + if [rgb, cmyk].iter().any(|n| n.as_deref() == Some(name)) { + d.revision += 1; + } + } +} + /// Whether View → Proof Setup targets the CMYK profile `name`. fn proof_targets(name: &str) -> bool { matches!(proof::view().setup.target, ProofTarget::Cmyk(t) if t == name) @@ -285,6 +301,14 @@ pub fn doc_profiles(d: &vectorcraft_doc::Document) -> (Option, Option Arc { + let (rgb, cmyk) = doc_profiles(d); + cms::for_document(rgb.as_deref(), cmyk.as_deref()) +} + fn assign_profile(s: &mut Session, p: &Value) -> Result { const C: &str = "edit.assignProfile"; let (mut rgb, mut cmyk) = doc_profiles(&s.doc()?.doc); diff --git a/crates/engine/src/cmd/compositefonts/tests.rs b/crates/engine/src/cmd/compositefonts/tests.rs index 434f2e383a..cac6f4bdcb 100644 --- a/crates/engine/src/cmd/compositefonts/tests.rs +++ b/crates/engine/src/cmd/compositefonts/tests.rs @@ -478,6 +478,75 @@ fn an_opened_file_measures_its_type_in_its_own_composite_fonts() { assert_eq!(actual.cached_bounds, Some(expected)); } +/// The label of dimension `id` in `doc`. +fn label(doc: &vectorcraft_doc::Document, id: u64) -> vectorcraft_doc::TextObject { + let node = doc.node(NodeId(id)).unwrap(); + node.children().unwrap().iter().find_map(|n| if let NodeKind::Text(t) = &n.kind { Some((**t).clone()) } else { None }).unwrap() +} + +/// The center of label `t`'s measured box on the page. +fn label_center(t: &vectorcraft_doc::TextObject) -> vectorcraft_geom::Point { + t.xf * t.cached_bounds.unwrap().center() +} + +/// Whether every character of label `t` is filled in CMYK. +fn label_in_cmyk(t: &vectorcraft_doc::TextObject) -> bool { + !t.runs.is_empty() && t.runs.iter().all(|r| matches!(r.style.fill.color(), Some(vectorcraft_color::Color::Cmyk { .. }))) +} + +/// The native file of a CMYK document whose composite font `name` sets Roman at full size, with a +/// dimension whose label is set in it and whose label's characters are saved in RGB, so opening +/// the file draws the dimension again → (the file, the dimension's id, the center of its label as +/// drawn in the document's own composite font). +fn dimension_file(name: &str) -> (Vec, u64, vectorcraft_geom::Point) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400, "colorMode": "cmyk"})).unwrap(); + let mut full = font(name); + full["parts"]["roman"]["size"] = json!(100); + s.execute("type.compositeFonts.set", &json!({"fonts": [full]})).unwrap(); + let line = s.execute("shape.line", &json!({"x1": 100, "y1": 100, "x2": 172, "y2": 100})).unwrap()["id"].as_u64().unwrap(); + let id = s + .execute( + "dimension.create", + &json!({"source": {"kind": "segment", "edge": {"node": line, "subpath": 0, "segment": 0}}, + "options": {"units": "in", "precision": 2, "fontFamily": name, "fontSize": 20}}), + ) + .unwrap()["id"] + .as_u64() + .unwrap(); + let mut doc = (*s.doc().unwrap().doc).clone(); + let drawn = label(&doc, id); + assert!(label_in_cmyk(&drawn)); + let center = label_center(&drawn); + let mut label_id = None; + doc.node(NodeId(id)).unwrap().walk(&mut |n| { + if matches!(n.kind, NodeKind::Text(_)) { + label_id = Some(n.id); + } + }); + if let Some(NodeKind::Text(t)) = doc.node_mut(label_id.unwrap()).map(|n| &mut n.kind) { + for r in &mut t.runs { + r.style.fill = vectorcraft_color::Paint::solid(vectorcraft_color::Color::rgb8(0, 0, 0)); + } + } + (vectorcraft_format::save_file(&doc), id, center) +} + +/// A file whose dimensions are drawn again when it opens (their art is not in the document's color +/// mode) draws their labels in its own composite fonts, not in those of the front document, which +/// defines the label's font name with Roman at half size: each label stays centered on its anchor. +#[test] +fn an_opened_file_draws_its_dimension_labels_in_its_own_composite_fonts() { + let (bytes, id, center) = dimension_file("CF Dimension"); + let mut s = session(); + s.execute("type.compositeFonts.set", &json!({"fonts": [font("CF Dimension")]})).unwrap(); + let file = crate::cmd::fileio::read_for_open("dimension.vectorcraft", &bytes, None, &json!({}), false, false).unwrap(); + crate::cmd::fileio::open_read(&mut s, file).unwrap(); + let opened = label(&s.doc().unwrap().doc, id); + assert!(label_in_cmyk(&opened)); + assert!((label_center(&opened) - center).hypot() < 1e-6, "{:?} vs {center:?}", label_center(&opened)); +} + /// Threaded type read from a file flows through its frames in the file's own composite fonts, when /// no open document defines them. #[test] @@ -536,6 +605,40 @@ fn a_document_replaced_in_the_back_is_measured_when_the_front_one_closes() { assert_eq!(actual.cached_bounds, Some(expected)); } +/// A document replaced in front (File › Revert) whose dimensions are drawn again draws their labels +/// in its new composite fonts, not in those it had before. +#[test] +fn a_document_replaced_in_front_draws_its_dimension_labels_in_its_own_composite_fonts() { + let (bytes, id, center) = dimension_file("CF Reverted"); + let mut s = session(); + s.execute("type.compositeFonts.set", &json!({"fonts": [font("CF Reverted")]})).unwrap(); + assert!(s.replace_document(0, vectorcraft_format::load(&bytes).unwrap())); + let replaced = label(&s.doc().unwrap().doc, id); + assert!(label_in_cmyk(&replaced)); + assert!((label_center(&replaced) - center).hypot() < 1e-6, "{:?} vs {center:?}", label_center(&replaced)); +} + +/// A document replaced in the back draws its dimension labels in its own composite fonts, while the +/// front document keeps its definition of the same name registered; the labels stay where they are +/// when the document comes to the front. +#[test] +fn a_document_replaced_in_the_back_draws_its_dimension_labels_in_its_own_composite_fonts() { + let (bytes, id, center) = dimension_file("CF Back Dimension"); + let mut s = session(); + s.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); + s.execute("type.compositeFonts.set", &json!({"fonts": [font("CF Back Dimension")]})).unwrap(); + assert!(s.replace_document(0, vectorcraft_format::load(&bytes).unwrap())); + assert_eq!(s.active_index(), Some(1)); + let front = vectorcraft_text::FontDb::global().composite_font("CF Back Dimension").unwrap(); + assert_eq!(front.parts.get(vectorcraft_doc::CharClass::Roman).size, 50.0); + let replaced = label(&s.documents()[0].doc, id); + assert!(label_in_cmyk(&replaced)); + assert!((label_center(&replaced) - center).hypot() < 1e-6, "{:?} vs {center:?}", label_center(&replaced)); + assert!(s.set_active(0)); + let shown = label(&s.doc().unwrap().doc, id); + assert!((label_center(&shown) - center).hypot() < 1e-6, "{:?} vs {center:?}", label_center(&shown)); +} + /// The type of document `index` with id `id`, wherever its tab is. fn text_in(s: &Session, index: usize, id: u64) -> vectorcraft_doc::TextObject { match &s.documents()[index].doc.node(NodeId(id)).unwrap().kind { diff --git a/crates/engine/src/cmd/dimension.rs b/crates/engine/src/cmd/dimension.rs index 44ac08d7ad..183cbd3746 100644 --- a/crates/engine/src/cmd/dimension.rs +++ b/crates/engine/src/cmd/dimension.rs @@ -495,7 +495,8 @@ pub(crate) fn refresh(before: &Document, doc: &mut Document) -> Result { /// Redraw the dimensions of an opened document whose art isn't in its colour mode: files saved /// before dimensions followed the colour mode have RGB dimensions in CMYK documents. A dimension -/// that can't be redrawn keeps the art it has. +/// that can't be redrawn keeps the art it has. The labels are measured in the document's own +/// composite fonts, also when another document's definitions of the same names are registered. pub(crate) fn conform(doc: &mut Document) { if !doc.dimensions { return; @@ -521,6 +522,10 @@ pub(crate) fn conform(doc: &mut Document) { } } }); + if stale.is_empty() { + return; + } + let _lent = vectorcraft_text::FontDb::global().lend_composite_fonts(&doc.composite_fonts); for (id, d) in stale { // An error leaves this dimension as it was; the others are still redrawn. let _ = replace(doc, id, d); diff --git a/crates/engine/src/cmd/distortcmds.rs b/crates/engine/src/cmd/distortcmds.rs index 2dbb7a9a18..8f1b5b97e6 100644 --- a/crates/engine/src/cmd/distortcmds.rs +++ b/crates/engine/src/cmd/distortcmds.rs @@ -26,7 +26,7 @@ pub use perspective::perspective_click; use perspective::{ attach, edit_text, grid_set, grid_show, persp_draw, persp_move, persp_nudge, persp_transform, plane_match, plane_move, plane_set, release, }; -pub(crate) use perspective::{finish_edit_text, grid_of, perspective_rewrite, silent, store_grid, transform_again}; +pub(crate) use perspective::{finish_edit_text, grid_kept, grid_of, perspective_rewrite, silent, store_grid, transform_again}; pub fn specs() -> Vec { vec![ @@ -107,7 +107,7 @@ pub fn specs() -> Vec { "Perspective Grid Preset", [], None, - "{kind: 1|2|3 (its normal view) | name: a preset (see perspective.presets.list)} reset the grid to the preset fitted to the first artboard (and show it; attached objects stay attached)", + "{kind: 1|2|3 (its normal view) | name: a preset (see perspective.presets.list)} reset the grid to the preset fitted to the first artboard (and show it; attached objects stay attached). No undo step when the document already holds that grid; when only whether it shows or its active plane differs, those are set without one", has_doc, super::perspgrid::grid_preset ), diff --git a/crates/engine/src/cmd/distortcmds/perspective.rs b/crates/engine/src/cmd/distortcmds/perspective.rs index 62b72a8e0f..89091248df 100644 --- a/crates/engine/src/cmd/distortcmds/perspective.rs +++ b/crates/engine/src/cmd/distortcmds/perspective.rs @@ -18,7 +18,7 @@ pub(crate) fn store_grid(d: &mut Document, g: &PerspectiveGrid) { /// Whether `d` holds `g` as [`store_grid`] writes it (with `attached` cleared): then storing `g` /// leaves `d` as it is. -fn grid_kept(d: &Document, g: &PerspectiveGrid) -> bool { +pub(crate) fn grid_kept(d: &Document, g: &PerspectiveGrid) -> bool { let mut g = g.clone(); g.attached.clear(); serde_json::to_value(&g).is_ok_and(|v| d.unknown.get(persp::DOC_KEY) == Some(&v)) diff --git a/crates/engine/src/cmd/docinfo.rs b/crates/engine/src/cmd/docinfo.rs index 4068c2506c..b5ac1c13e5 100644 --- a/crates/engine/src/cmd/docinfo.rs +++ b/crates/engine/src/cmd/docinfo.rs @@ -344,44 +344,9 @@ fn spot_swatches(d: &Document) -> HashSet<&str> { first.into_iter().filter(|&(name, spot)| spot && name != vectorcraft_color::swatch::REGISTRATION).map(|(name, _)| name).collect() } -/// Which of gradient `g`'s stops color some part of it that draws, by the stretches -/// [`vectorcraft_color::Gradient::sample`] mixes in, for stops in any order: the pair of stop `k` -/// and stop `k + 1` covers the offsets above every offset of stops `0..=k` up to stop `k + 1`'s, -/// and both its stops count when that stretch has positive width and either stop is above opacity -/// 0. The first stop also counts when it is above opacity 0, since it colors the offsets up to its -/// own, and so does the last stop, since it colors the offsets above every stop's. Any other stop, -/// opaque or not, counts only through a pair: a stop out of order whose pairs have no width -/// (another stop before it reaches past both ends) colors nothing. A freeform gradient draws from -/// its points, so each of its stops counts while any stop is above opacity 0. -fn drawn_stops(g: &vectorcraft_color::Gradient) -> Vec { - let stops = &g.stops; - if g.kind == vectorcraft_color::GradientKind::Freeform { - let any = stops.iter().any(|s| s.opacity > 0.0); - return vec![any; stops.len()]; - } - let mut drawn = vec![false; stops.len()]; - if let (Some(first), Some(d)) = (stops.first(), drawn.first_mut()) { - *d = first.opacity > 0.0; - } - if let (Some(last), Some(d)) = (stops.last(), drawn.last_mut()) { - *d |= last.opacity > 0.0; - } - // `f32::max` skips a NaN offset, which the sampler never picks either. - let mut reach = f32::NEG_INFINITY; - for k in 0..stops.len().saturating_sub(1) { - reach = reach.max(stops[k].offset); - let (a, b) = (&stops[k], &stops[k + 1]); - if b.offset > reach && (a.opacity > 0.0 || b.opacity > 0.0) { - drawn[k] = true; - drawn[k + 1] = true; - } - } - drawn -} - /// The spot colors paint `p` prints (`spots`: [`spot_swatches`]): the spot swatch a solid color is -/// linked to, or those a gradient's drawn stops ([`drawn_stops`]) are linked to, each once, in the -/// order of the stops. A link at a tint of 0 prints no ink, a stop that colors only parts of a +/// linked to, or those a gradient's drawn stops ([`vectorcraft_color::Gradient::drawn_stops`]) are +/// linked to, each once, in the order of the stops. A link at a tint of 0 prints no ink, a stop that colors only parts of a /// gradient at an opacity of 0 prints none, and a color that only looks like a spot color is not /// linked to one. fn spot_labels(spots: &HashSet<&str>, p: &Paint) -> Vec { @@ -398,7 +363,7 @@ fn spot_labels(spots: &HashSet<&str>, p: &Paint) -> Vec { match p { Paint::Solid { swatch, tint, .. } => add(swatch, *tint), Paint::Gradient(g) => { - let drawn = drawn_stops(&g.gradient); + let drawn = g.gradient.drawn_stops(); g.gradient.stops.iter().zip(drawn).filter(|&(_, d)| d).for_each(|(s, _)| add(&s.swatch, s.tint)); } _ => {} @@ -1662,39 +1627,6 @@ mod tests { assert!(!["Far", "Edge", "Seam"].iter().any(|n| text.contains(n)), "{text}"); } - /// A gradient's stops print where they color a stretch that draws, for stops in any order: the - /// sampler mixes stop `k` with stop `k + 1` above every offset of the stops before it, so an - /// out-of-order stop's pair can have no width. - #[test] - fn drawn_stops_follow_the_sampled_stretches() { - use vectorcraft_color::{Color, Gradient, GradientKind, GradientStop}; - let stop = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, Color::BLACK) }; - let g = |stops: Vec| Gradient::new(GradientKind::Linear, stops); - // In order: the clear stop next to the opaque one, not the one after it. - assert_eq!(drawn_stops(&g(vec![stop(0.0, 1.0), stop(0.5, 0.0), stop(1.0, 0.0)])), vec![true, true, false]); - // Out of order: the pair (0.8, 0.3) has no width, so the clear stop at 0.3 mixes only with - // the clear stop at 0.8 before it, and the pair (0.3, 1.0) is sampled above 0.8. - assert_eq!(drawn_stops(&g(vec![stop(0.0, 0.0), stop(0.8, 0.0), stop(0.3, 0.0), stop(1.0, 1.0)])), vec![false, false, true, true]); - // An opaque stop out of order: the pairs (0, 0.8) and (0.7, 1) cover every offset, so the - // pairs next to the stop at 0.3 have no width and it colors nothing. - let out_of_order = |o: f32| g(vec![stop(0.0, 0.0), stop(0.8, o), stop(0.3, 1.0), stop(0.7, 0.0), stop(1.0, 0.0)]); - assert_eq!(drawn_stops(&out_of_order(0.0)), vec![false; 5]); - // With the stop at 0.8 opaque, the pairs next to it with width are drawn. - assert_eq!(drawn_stops(&out_of_order(1.0)), vec![true, true, false, false, false]); - // The last stop colors the offsets above every stop's, even when it is out of order. - assert_eq!(drawn_stops(&g(vec![stop(0.0, 0.0), stop(0.6, 0.0), stop(0.5, 1.0)])), vec![false, false, true]); - // The first stop colors the offsets up to its own. - assert_eq!(drawn_stops(&g(vec![stop(0.0, 1.0), stop(0.0, 0.0), stop(1.0, 0.0)])), vec![true, false, false]); - // One stop, every stop clear, and no stops at all. - assert_eq!(drawn_stops(&g(vec![stop(0.5, 1.0)])), vec![true]); - assert_eq!(drawn_stops(&g(vec![stop(0.0, 0.0), stop(1.0, 0.0)])), vec![false, false]); - assert!(drawn_stops(&g(vec![])).is_empty()); - // A freeform gradient draws from its points: its stops count while any is above opacity 0. - let mut free = g(vec![stop(0.0, 1.0), stop(0.5, 0.0), stop(1.0, 0.0)]); - free.kind = GradientKind::Freeform; - assert_eq!(drawn_stops(&free), vec![true, true, true]); - } - /// Brushes, Spot Color Objects, Pattern Objects and Gradient Objects leave out a hidden object, /// an object at an opacity of 0 and the objects inside a hidden layer or a group at an opacity of /// 0, with Selection Only too: their fills, strokes, characters and colorized pixels paint no diff --git a/crates/engine/src/cmd/draw2/common.rs b/crates/engine/src/cmd/draw2/common.rs index 0ca376b243..fd8967f3fa 100644 --- a/crates/engine/src/cmd/draw2/common.rs +++ b/crates/engine/src/cmd/draw2/common.rs @@ -231,9 +231,9 @@ pub(super) fn within_input_bound(q: Point) -> bool { q.x.is_finite() && q.y.is_finite() && q.x.abs() < MAX_INPUT && q.y.abs() < MAX_INPUT } -/// The whole number of 0 or more that `key` holds, read with [`index`]. +/// The whole number of 0 or more that `key` holds, read with [`u64_req`](crate::cmd::u64_req) and [`index`]. pub(super) fn usize_req(p: &Value, key: &str, cmd: &str) -> Result { - p.get(key).and_then(Value::as_u64).map(index).ok_or_else(|| bad(cmd, format!("missing integer `{key}`"))) + crate::cmd::u64_req(p, key, cmd).map(index) } /// The whole number of 0 or more that `key` holds, or `None` when `key` is absent or null. Any other diff --git a/crates/engine/src/cmd/draw2/freehand.rs b/crates/engine/src/cmd/draw2/freehand.rs index 31e184e195..0439aaa081 100644 --- a/crates/engine/src/cmd/draw2/freehand.rs +++ b/crates/engine/src/cmd/draw2/freehand.rs @@ -11,7 +11,9 @@ use super::{ // ---------- Pencil / Paintbrush ---------- /// Fit a freehand polyline: drop jitter, build a spline through the samples (sharp turns stay -/// corners) and simplify it to `tol`. +/// corners) and simplify it to `tol`. A closed stroke is fitted as the open one is and closed by a +/// straight segment from its end back to its start: fitting round the gap would curve that segment +/// on from both ends, past them and back. fn fit_freehand(pts: &[Point], tol: f64, closed: bool) -> SubPath { let min = (tol * 0.3).max(vectorcraft_tools::draw2::MIN_FIT_TOLERANCE * 0.3); let (Some(&p0), Some(&pn)) = (pts.first(), pts.last()) else { return SubPath::new(vec![], closed) }; @@ -41,15 +43,26 @@ fn fit_freehand(pts: &[Point], tol: f64, closed: bool) -> SubPath { (kept[i], corner) }) .collect(); - let sp = vectorcraft_tools::draw2::catmull_rom(&marked, closed); + let sp = vectorcraft_tools::draw2::catmull_rom(&marked, false); if sp.anchors.len() < 3 { - return sp; + // Two anchors closed would run back over the line itself. + return SubPath::new(sp.anchors, closed && n > 2); } let fitted = po::simplify_with( &PathData::single(sp.clone()), &SimplifyOptions { tolerance: tol, corner_angle_deg: 60.0, straight_lines: false, ..Default::default() }, ); - fitted.subpaths.into_iter().next().filter(|s| s.anchors.len() >= 2).unwrap_or(sp) + let mut anchors = fitted.subpaths.into_iter().next().filter(|s| s.anchors.len() >= 2).unwrap_or(sp).anchors; + if closed { + // No handle on either side of the closing segment. + if let Some(l) = anchors.last_mut() { + l.h_out = l.p; + } + if let Some(f) = anchors.first_mut() { + f.h_in = f.p; + } + } + SubPath::new(anchors, closed) } /// The path of a freehand stroke: fitted at `tol` ([`fit_freehand`]), or with no `tol` the points diff --git a/crates/engine/src/cmd/draw2/smooth.rs b/crates/engine/src/cmd/draw2/smooth.rs index 560990cec1..9f119fca86 100644 --- a/crates/engine/src/cmd/draw2/smooth.rs +++ b/crates/engine/src/cmd/draw2/smooth.rs @@ -49,6 +49,84 @@ fn refit_run(anchors: &[Anchor], tol: f64, sigma: f64, free: [bool; 2]) -> Vec (usize, f64) { + let mut best: Option<(f64, usize, f64)> = None; + for j in 0..orig.anchors.len() { + let hit = orig.segment(j).nearest(p, 1e-9); + if hit.distance_sq.is_finite() && hit.t.is_finite() && best.is_none_or(|(d, ..)| hit.distance_sq < d) { + best = Some((hit.distance_sq, j, hit.t)); + } + } + best.map_or((usize::MAX, f64::INFINITY), |(_, j, t)| (j, t)) +} + +/// The closed `sp` started at the point on it nearest `start`: at the anchor there, or at a new +/// anchor split into the segment there, which leaves the outline as it is. Of points equally near +/// `start`, the one earliest along `orig` (the path before smoothing) from its first anchor is used, +/// then the first in `sp`'s order. An open `sp`, or one with no segment or no finite nearest point, +/// is returned as it is. +fn start_nearest(mut sp: SubPath, start: Point, orig: &SubPath) -> SubPath { + let n = sp.anchors.len(); + if !sp.closed || n < 2 { + return sp; + } + // (distance, place along `orig` once a tie needs it, segment of `sp`, parameter) + type Best = (f64, Option<(usize, f64)>, usize, f64); + let mut best: Option = None; + for i in 0..n { + let c = sp.segment(i); + let hit = c.nearest(start, 1e-9); + if !hit.distance_sq.is_finite() || !hit.t.is_finite() { + continue; + } + let d = hit.distance_sq.sqrt(); + match &mut best { + None => best = Some((d, None, i, hit.t)), + Some((bd, bplace, bi, bt)) if (d - *bd).abs() <= START_TIE => { + let held = *bplace.get_or_insert_with(|| place_along(orig, sp.segment(*bi).eval(*bt))); + let place = place_along(orig, c.eval(hit.t)); + if place.0 < held.0 || (place.0 == held.0 && place.1 < held.1) { + best = Some((d, Some(place), i, hit.t)); + } + } + Some((bd, ..)) if d < *bd => best = Some((d, None, i, hit.t)), + Some(_) => {} + } + } + let Some((_, _, i, t)) = best else { return sp }; + let c = sp.segment(i); + let at = c.eval(t); + let first = if at.distance(c.p0) <= START_SNAP { + i + } else if at.distance(c.p3) <= START_SNAP { + (i + 1) % n + } else { + let mid = if sp.segment_is_line(i) { + Anchor::corner(at) + } else { + let (l, r) = (c.subsegment(0.0..t), c.subsegment(t..1.0)); + sp.anchors[i].h_out = l.p1; + sp.anchors[(i + 1) % n].h_in = r.p2; + Anchor::with_handles(at, l.p2, r.p1) + }; + sp.anchors.insert(i + 1, mid); + i + 1 + }; + sp.anchors.rotate_left(first); + sp +} + /// Pieces of curve that one Smooth drag measures against the drag while it searches the segments /// under it ([`reach_samples`]), shared equally by the curved segments that come within its reach, /// each of which gets at least one: enough to search 300,000 pt of curve within the default reach @@ -226,6 +304,9 @@ fn mark_reached(sp: &SubPath, pts: &[Point], radius: f64, share: usize) -> (SubP (out, marked) } +/// `sp` with the anchors in the drag's reach smoothed and refitted, `None` when none are in reach. +/// A closed path whose first anchor is in reach starts at the point of the refitted path nearest +/// that anchor's place (VectorCraft's own rule). fn smooth_subpath(sp: &SubPath, pts: &[Point], radius: f64, share: usize, tol: f64, sigma: f64) -> Option { if sp.anchors.len() < 2 { return None; @@ -238,10 +319,11 @@ fn smooth_subpath(sp: &SubPath, pts: &[Point], radius: f64, share: usize, tol: f return None; } if sp.closed { + let start = sp.anchors[0].p; let Some(k) = marked.iter().position(|m| !m) else { // Everything is in range: smooth the whole closed path, across its start too. let f = po::simplify_with(&PathData::single(sp.clone()), &refit_options(tol, sigma, [false; 2])); - return f.subpaths.into_iter().next(); + return f.subpaths.into_iter().next().map(|r| start_nearest(r, start, sp)); }; // Rotate so an untouched anchor comes first, duplicate it at the end and treat as open. let mut open = sp.clone(); @@ -256,7 +338,9 @@ fn smooth_subpath(sp: &SubPath, pts: &[Point], radius: f64, share: usize, tol: f if let Some(r0) = res.first_mut() { r0.h_in = l.h_in; } - return Some(SubPath::new(res, true)); + // With k = 0 the first anchor is out of reach and still starts the result. + let res = SubPath::new(res, true); + return Some(if k == 0 { res } else { start_nearest(res, start, sp) }); } Some(SubPath::new(smooth_open(&sp.anchors, &marked, near, tol, sigma, true), false)) } @@ -621,6 +705,89 @@ pub(super) fn join_scrub(s: &mut Session, p: &Value) -> Result { mod tests { use super::*; + /// A closed ring of four smooth anchors round (100, 100) with radius 50. + fn ring() -> SubPath { + let k = 0.5523 * 50.0; + let a = |x: f64, y: f64, dx: f64, dy: f64| Anchor::with_handles(Point::new(x, y), Point::new(x - dx, y - dy), Point::new(x + dx, y + dy)); + SubPath::new(vec![a(150.0, 100.0, 0.0, k), a(100.0, 150.0, -k, 0.0), a(50.0, 100.0, 0.0, -k), a(100.0, 50.0, k, 0.0)], true) + } + + /// A start between two anchors of a curve splits that curve there into two that trace it, and the + /// new anchor comes first. + #[test] + fn start_nearest_splits_a_curve_where_it_passes_the_start() { + let sp = ring(); + let old = sp.segment(0); + let start = old.eval(0.3) + (old.eval(0.3) - Point::new(100.0, 100.0)) * 0.1; + let out = start_nearest(sp.clone(), start, &sp); + assert!(out.closed && out.anchors.len() == 5, "{out:?}"); + let t = old.nearest(start, 1e-9).t; + assert!(out.anchors[0].p.distance(old.eval(t)) < 1e-9, "{out:?}"); + let (head, rest) = (out.segment(4), out.segment(0)); + for k in 0..=8 { + let u = f64::from(k) / 8.0; + assert!(head.eval(u).distance(old.eval(t * u)) < 1e-9); + assert!(rest.eval(u).distance(old.eval(t + (1.0 - t) * u)) < 1e-9); + } + for i in 1..4 { + assert_eq!(out.segment(i), sp.segment(i), "segment {i} stays"); + } + } + + /// A start within [`START_SNAP`] of an anchor starts the ring at that anchor, with no anchor added. + #[test] + fn start_nearest_starts_at_an_anchor_near_the_start() { + let sp = ring(); + let out = start_nearest(sp.clone(), Point::new(50.0, 100.0 + START_SNAP / 2.0), &sp); + let mut want = sp.anchors.clone(); + want.rotate_left(2); + assert_eq!(out.anchors, want); + } + + /// A start on a straight side of a triangle adds a corner point there without handles, and the + /// sides stay straight. + #[test] + fn start_nearest_splits_a_line_with_a_corner_point() { + let sp = SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(100.0, 0.0), Point::new(50.0, 80.0)], true); + let out = start_nearest(sp.clone(), Point::new(40.0, -5.0), &sp); + let want: Vec = [(40.0, 0.0), (100.0, 0.0), (50.0, 80.0), (0.0, 0.0)].map(|(x, y)| Point::new(x, y)).to_vec(); + assert!(out.anchors.len() == 4 && out.anchors.iter().zip(&want).all(|(a, w)| a.p.distance(*w) < 1e-9), "{out:?}"); + assert!((0..4).all(|i| out.segment_is_line(i)), "{out:?}"); + } + + /// A ring whose last anchor lies on its first keeps its first anchor first, and gets no third + /// anchor at that place. + #[test] + fn start_nearest_keeps_the_first_of_two_anchors_on_one_place() { + let p = [(0.0, 0.0), (100.0, 0.0), (50.0, 80.0), (0.0, 0.0)].map(|(x, y)| Point::new(x, y)); + let sp = SubPath::polyline(&p, true); + assert_eq!(start_nearest(sp.clone(), p[0], &sp), sp); + } + + /// Of points equally near the start, the one earliest along the path before smoothing from its + /// first anchor comes first, whatever the smoothed path's order. The center of a square is equally + /// near the middle of each side. The square before smoothing starts at (-50, -50), so the middle + /// of its first side, (0, -50), comes first, though the smoothed copy starts at (50, 50). + #[test] + fn start_nearest_breaks_a_tie_by_the_order_before_smoothing() { + let p = [(-50.0, -50.0), (50.0, -50.0), (50.0, 50.0), (-50.0, 50.0)].map(|(x, y)| Point::new(x, y)); + let orig = SubPath::polyline(&p, true); + let mut sp = orig.clone(); + sp.anchors.rotate_left(2); + let out = start_nearest(sp, Point::new(0.0, 0.0), &orig); + assert!(out.closed && out.anchors.len() == 5, "{out:?}"); + assert!(out.anchors[0].p.distance(Point::new(0.0, -50.0)) < 1e-9, "{out:?}"); + assert!(out.anchors[1].p.distance(p[1]) < 1e-9, "{out:?}"); + } + + /// An open path, and a start that is not a number, leave the path as it is. + #[test] + fn start_nearest_leaves_an_open_path_or_a_start_without_a_place() { + let open = SubPath { closed: false, ..ring() }; + assert_eq!(start_nearest(open.clone(), Point::new(100.0, 50.0), &ring()), open); + assert_eq!(start_nearest(ring(), Point::new(f64::NAN, 0.0), &ring()), ring()); + } + /// Searching a curve 1,000,000 pt long under a drag of 1,000 points along it measures no more /// pieces than the budget it is given, and a search with none left gives one sample. #[test] diff --git a/crates/engine/src/cmd/edit.rs b/crates/engine/src/cmd/edit.rs index 990ac1a1c6..9ecb5c3984 100644 --- a/crates/engine/src/cmd/edit.rs +++ b/crates/engine/src/cmd/edit.rs @@ -11,7 +11,7 @@ use super::clipboard::SwatchChoices; use super::{ CommandSpec, Result, Session, always, bad, can_clear_history, can_redo, can_undo, check_numbers, checked_ids_param, clock_date, cmd, date_param, f64_req, finite_numbers, has_clipboard, has_doc, has_selection, has_selection_guides_or_artboard_tool, has_selection_or_guides, index, number_or, - object_param, ok, point_param, str_param, switch_or, + object_param, ok, point_param, str_param, switch_or, u64_req, }; use crate::{Clipboard, EngineError, SourceLayer, inspect}; @@ -249,7 +249,10 @@ fn file_close(s: &mut Session, p: &Value) -> Result { } fn doc_activate(s: &mut Session, p: &Value) -> Result { - let i = p.get("index").and_then(Value::as_u64).map(index).ok_or_else(|| bad("document.activate", "missing index"))?; + let i = match p.get("index") { + None | Some(Value::Null) => return Err(bad("document.activate", "missing index")), + Some(v) => v.as_u64().map(index).ok_or_else(|| bad("document.activate", "`index` must be a whole number"))?, + }; if s.set_active(i) { ok() } else { Err(bad("document.activate", "no such document")) } } @@ -262,7 +265,10 @@ fn doc_move(s: &mut Session, p: &Value) -> Result { if from >= n { return Err(bad("document.move", "no such document")); } - let to = p.get("to").and_then(Value::as_u64).map(index).ok_or_else(|| bad("document.move", "missing `to`: a non-negative integer"))?; + let to = match p.get("to") { + None | Some(Value::Null) => return Err(bad("document.move", "missing `to`: a non-negative integer")), + Some(v) => v.as_u64().map(index).ok_or_else(|| bad("document.move", "`to` must be a whole number"))?, + }; let to = to.min(n.saturating_sub(1)); if !s.move_document(from, to) { return Err(bad("document.move", "no such document")); @@ -562,12 +568,11 @@ fn switch_units(s: &mut Session, _: &Value) -> Result { Ok(json!({ "units": next.label() })) } -/// The `artboard` param of the ruler origin commands: an artboard index, 0 when not given. +/// The `artboard` param of the ruler origin commands: an artboard index, 0 when left out or null. A +/// value that is not a whole number is "`artboard` must be a whole number"; one past the artboards +/// is "index out of range". fn artboard_param(s: &Session, p: &Value, c: &str) -> Result { - let index = match p.get("artboard") { - None => 0, - Some(v) => v.as_u64().and_then(|n| usize::try_from(n).ok()).ok_or_else(|| bad(c, "index out of range"))?, - }; + let index = super::index_opt(p, "artboard", c)?.unwrap_or(0); if index >= s.doc()?.doc.artboards.len() { return Err(bad(c, "index out of range")); } @@ -577,14 +582,15 @@ fn artboard_param(s: &Session, p: &Value, c: &str) -> Result { fn ruler_origin(s: &mut Session, p: &Value) -> Result { let d = &s.doc()?.doc; // A document without artboards measures from its global zero point. - let index = if d.artboards.is_empty() && p.get("artboard").is_none() { 0 } else { artboard_param(s, p, "document.rulerOrigin")? }; + let index = + if d.artboards.is_empty() && p.get("artboard").is_none_or(Value::is_null) { 0 } else { artboard_param(s, p, "document.rulerOrigin")? }; Ok(json!(s.doc()?.doc.ruler_origin_for(index))) } fn set_ruler_origin(s: &mut Session, p: &Value) -> Result { const C: &str = "document.setRulerOrigin"; let origin = Point::new(f64_req(p, "x", C)?, f64_req(p, "y", C)?); - let index = if s.doc()?.doc.rulers == RulerMode::Global && p.get("artboard").is_none() { 0 } else { artboard_param(s, p, C)? }; + let index = if s.doc()?.doc.rulers == RulerMode::Global && p.get("artboard").is_none_or(Value::is_null) { 0 } else { artboard_param(s, p, C)? }; change_ruler_origin(s, index, Some(origin), "Ruler Origin") } @@ -1190,8 +1196,7 @@ fn clear(s: &mut Session, p: &Value) -> Result { /// Document ids scope node ids: two tabs may contain objects with the same node id. fn drop_selection(s: &mut Session, p: &Value) -> Result { const CMD: &str = "edit.dropSelection"; - let key = "sourceDocument"; - let uid = p[key].as_u64().ok_or_else(|| bad(CMD, format!("missing integer `{key}`")))?; + let uid = u64_req(p, "sourceDocument", CMD)?; let point = |key: &str| finite_numbers::<2>(&p[key]).ok_or_else(|| bad(CMD, format!("{key} must be [x, y] with finite coordinates"))); let grab = point("grab")?; let at = point("at")?; diff --git a/crates/engine/src/cmd/effectcmd.rs b/crates/engine/src/cmd/effectcmd.rs index 6ee3905d95..65672f8b6b 100644 --- a/crates/engine/src/cmd/effectcmd.rs +++ b/crates/engine/src/cmd/effectcmd.rs @@ -865,8 +865,8 @@ fn load_texture(params: &mut Value, cmd: &str) -> Result<()> { /// Has `n` an appearance Expand Appearance turns into objects: a path that isn't basic (several /// fills or strokes, effects, transparency of a fill or stroke, a brush), a group or layer with /// fills, strokes or effects of its own or such members, other objects with effects, type with -/// fills or strokes of its own, or a symbol instance whose active fill or stroke has a geometry -/// effect ([`effects::has_item_geometry`])? +/// fills or strokes of its own, or a symbol instance whose active fill or stroke has a geometry or +/// raster effect ([`effects::has_item_geometry`], [`effects::has_instance_row_raster`])? pub(crate) fn expandable(n: &Node) -> bool { expandable_except(n, &[]) } @@ -883,7 +883,9 @@ pub(crate) fn expandable_except(n: &Node, skip: &[NodeId]) -> bool { !n.appearance.items.is_empty() || !n.appearance.effects.is_empty() || children.iter().any(|c| expandable_except(c, skip)) } NodeKind::Text(_) => !n.appearance.items.is_empty() || !n.appearance.effects.is_empty(), - NodeKind::Image(_) | NodeKind::SymbolInstance { .. } => effects::has_item_geometry(n) || !n.appearance.effects.is_empty(), + NodeKind::Image(_) | NodeKind::SymbolInstance { .. } => { + effects::has_item_geometry(n) || effects::has_instance_row_raster(n) || !n.appearance.effects.is_empty() + } _ => !n.appearance.effects.is_empty(), } } diff --git a/crates/engine/src/cmd/fileio.rs b/crates/engine/src/cmd/fileio.rs index d20c6c46b2..84fb121d0c 100644 --- a/crates/engine/src/cmd/fileio.rs +++ b/crates/engine/src/cmd/fileio.rs @@ -70,7 +70,7 @@ pub use encode::{ARTBOARD_PARAMS, ArtboardPick, Encoded, Note, NoteKind, encode, pub(crate) use encode::{anti_alias, background, with_single_artboard}; pub(crate) use export::with_artboard_fills; pub(crate) use export::{EXPORT_PARAMS, export_crop, isolated}; -pub use export::{export_doc, export_source, unused_option_notes}; +pub use export::{export_doc, export_source, selection_doc, unused_option_notes}; use load::err; pub(crate) use load::import_svg; pub(crate) use load::is_placeholder; @@ -92,7 +92,7 @@ pub use pdfimport::{LoadOptions, page_document}; pub(crate) use save::job_for; pub(crate) use save::save as save_document; pub use save::{ - SAVE_FORMATS, SaveJob, SaveMode, SavePlan, StreamWrite, TEMPLATE_FORMATS, dialog_folder, documents_dialog_folder, export_folder, + SAVE_FORMATS, SaveJob, SaveMode, SavePlan, StreamWrite, TEMPLATE_FORMATS, dialog_folder, documents_dialog_folder, export_folder, file_reads, leave_out_unreadable_save_paths, reads_option as save_reads_option, remembered_save_options, save_filters, save_format, save_job, save_plan, save_with, stamp_save_dates, template_filters, templates_dialog_folder, templates_folder, }; diff --git a/crates/engine/src/cmd/fileio/action_batch.rs b/crates/engine/src/cmd/fileio/action_batch.rs index 232d5ba1f4..4e99f4ee3e 100644 --- a/crates/engine/src/cmd/fileio/action_batch.rs +++ b/crates/engine/src/cmd/fileio/action_batch.rs @@ -12,6 +12,8 @@ use serde_json::json; use super::super::{Result, Session, bad}; #[cfg(not(target_arch = "wasm32"))] use super::super::{check_switches, find_command, switch_or, text_param}; +#[cfg(not(target_arch = "wasm32"))] +use crate::EngineError; #[cfg(target_arch = "wasm32")] pub(super) fn action_batch(_: &mut Session, _: &Value) -> Result { @@ -58,6 +60,10 @@ pub(super) fn action_batch(s: &mut Session, p: &Value) -> Result { if id == "command.batch" || id == "action.batch" { return Err(bad(C, "batches cannot nest")); } + // `command.batch` refuses the batch when it reaches this step, which would fail every file or data set it plays. + if id == "prefs.import" { + return Err(bad(C, format!("commands[{i}]: `prefs.import` runs on its own, not as a batch step"))); + } if find_command(id).is_none() { return Err(bad( C, @@ -213,7 +219,7 @@ fn batch_folder(s: &mut Session, cmd: &str, p: &Value, override_open: bool, run: // open, so its artboard files count ([`dataset_output_paths`]). No output takes the name of a // source file in the destination folder, other than that file's own output, or of a subfolder // of the destination folder that holds source files. - let steps = filter_steps(run.steps, override_open, false); + let (steps, places) = filter_steps(run.steps, override_open, false); let run = Run { steps: &steps, ..*run }; let in_dest: Vec> = files.iter().map(|path| name_in_folder(path, run.dest_folder)).collect(); let mut picker = @@ -228,7 +234,7 @@ fn batch_folder(s: &mut Session, cmd: &str, p: &Value, override_open: bool, run: let outputs = dataset_output_extensions(&run, doc, &ext); picker.pick(&base, |stem| output_names(run.dest_folder, stem, &outputs, doc), own.as_deref()) }; - match process_one_file(s, &run, path, &ext, pick) { + match process_one_file(s, &run, &places, path, &ext, pick) { Ok(row) => processed.push(row), Err(e) => { failed += 1; @@ -266,12 +272,12 @@ fn batch_datasets(s: &mut Session, cmd: &str, run: &Run<'_>) -> Result { } let doc_stem = st.path.as_deref().and_then(|p| std::path::Path::new(p).file_stem().and_then(|s| s.to_str())).unwrap_or("Untitled").to_string(); let stems = dataset_stems(&names, &doc_stem, run.dataset_file_naming, run, &st.doc)?; - let steps = filter_steps(run.steps, true, false); + let (steps, places) = filter_steps(run.steps, true, false); let run = Run { steps: &steps, ..*run }; let mut processed = Vec::new(); let mut failed = 0usize; for (name, stem) in names.iter().zip(&stems) { - match process_one_dataset(s, &run, name, stem) { + match process_one_dataset(s, &run, &places, name, stem) { Ok(row) => processed.push(row), Err(e) => { failed += 1; @@ -347,11 +353,13 @@ impl StemPicker { } } -/// Drop Open (and optionally Close) steps when the batch supplies the file itself. +/// Drop Open (and optionally Close) steps when the batch supplies the file itself → the steps that +/// stay, and the index of each in `cmds`. #[cfg(not(target_arch = "wasm32"))] -fn filter_steps(cmds: &[Value], drop_open: bool, drop_close: bool) -> Vec { +fn filter_steps(cmds: &[Value], drop_open: bool, drop_close: bool) -> (Vec, Vec) { cmds.iter() - .filter(|c| { + .enumerate() + .filter(|(_, c)| { let id = c.get("command").and_then(Value::as_str).unwrap_or(""); if drop_open && matches!(id, "document.open" | "file.open") { return false; @@ -361,14 +369,44 @@ fn filter_steps(cmds: &[Value], drop_open: bool, drop_close: bool) -> Vec } true }) - .cloned() - .collect() + .map(|(i, c)| (c.clone(), i)) + .unzip() +} + +/// Plays `commands`, the steps of `run` with their paths rewritten, as one `command.batch`. When a +/// step fails, the error names it by its place in the caller's `commands`, from 1, counting the Open +/// steps the batch skipped (`places` gives the index there of each step of `run`): +/// ``action step 3 (`object.move`) failed: …``. Any other error, such as one about the whole batch, +/// stays as it is. +#[cfg(not(target_arch = "wasm32"))] +fn play_steps(s: &mut Session, run: &Run<'_>, places: &[usize], commands: Vec) -> Result { + s.execute("command.batch", &json!({"label": run.label, "commands": commands})).map_err(|e| { + let text = e.to_string(); + let Some((n, id, reason)) = batch_step_failure(&text) else { return e }; + let same = run.steps.get(n).and_then(|c| c.get("command")).and_then(Value::as_str) == Some(id); + match places.get(n) { + Some(place) if same => EngineError::Other(format!("action step {} (`{id}`) failed: {reason}", place + 1)), + _ => e, + } + }) +} + +/// The step number, command id and reason in the error `command.batch` gives when one of its steps +/// fails (``batch step 2 (`object.move`) failed: …``); none for any other error. +#[cfg(not(target_arch = "wasm32"))] +fn batch_step_failure(e: &str) -> Option<(usize, &str, &str)> { + let rest = e.strip_prefix("batch step ")?; + let digits = rest.find(|c: char| !c.is_ascii_digit())?; + let n = rest[..digits].parse().ok()?; + let (id, reason) = rest[digits..].strip_prefix(" (`")?.split_once("`) failed: ")?; + Some((n, id, reason)) } #[cfg(not(target_arch = "wasm32"))] fn process_one_file( s: &mut Session, run: &Run<'_>, + places: &[usize], path: &str, ext: &str, stem_for: impl FnOnce(&vectorcraft_doc::Document) -> String, @@ -376,17 +414,17 @@ fn process_one_file( s.execute("document.open", &json!({"path": path}))?; let stem = stem_for(&s.doc()?.doc); let rewritten = rewrite_paths(run.steps, run.override_save, run.override_export, run.dest_folder, &stem, ext); - let batch = s.execute("command.batch", &json!({"label": run.label, "commands": rewritten}))?; + let batch = play_steps(s, run, places, rewritten)?; // Folder sources open a file per pass: close after Save and Close / Folder. finish_destination(s, run, &stem, ext, path, true)?; Ok(json!({"path": path, "result": batch})) } #[cfg(not(target_arch = "wasm32"))] -fn process_one_dataset(s: &mut Session, run: &Run<'_>, name: &str, stem: &str) -> Result { +fn process_one_dataset(s: &mut Session, run: &Run<'_>, places: &[usize], name: &str, stem: &str) -> Result { s.execute("dataset.select", &json!({"name": name}))?; let rewritten = rewrite_paths(run.steps, run.override_save, run.override_export, run.dest_folder, stem, "vectorcraft"); - let batch = s.execute("command.batch", &json!({"label": run.label, "commands": rewritten}))?; + let batch = play_steps(s, run, places, rewritten)?; // Data sets share one open document: write each row out but leave it open for the next. finish_destination(s, run, stem, "vectorcraft", "", false)?; Ok(json!({"dataset": name, "result": batch})) @@ -1454,7 +1492,8 @@ mod tests { assert_eq!((r["failed"].as_u64(), r["processed"].as_array().map(Vec::len)), (Some(rows), Some(rows as usize)), "{r}"); for row in r["processed"].as_array().unwrap() { let e = row["error"].as_str().unwrap_or_default(); - let want = format!("batch step 0 (`document.save`) failed: automation path rejected: outside the write root {root}: doc.vectorcraft"); + let want = + format!("action step 1 (`document.save`) failed: automation path rejected: outside the write root {root}: doc.vectorcraft"); assert_eq!(e, want, "{r}"); } assert!(!r.to_string().contains(&hidden), "{r}"); @@ -2224,4 +2263,144 @@ mod tests { .is_err() ); } + + /// The steps of the step-number tests: an Open the batch skips, a step that works, and one that + /// fails (an Align with nothing selected). + fn open_then_failing_align() -> Value { + json!([ + {"command": "document.open", "params": {"path": "/no/such/file.svg"}}, + {"command": "object.unlockAll", "params": {}}, + {"command": "object.align", "params": {}} + ]) + } + + /// The step a source's error names, after `action step ` and before ` failed: `. + fn named_step(r: &Value, row: usize) -> String { + let e = r["processed"][row]["error"].as_str().unwrap_or_default(); + assert!(!e.contains("batch step"), "{r}"); + e.strip_prefix("action step ").and_then(|e| e.split_once(" failed: ")).map(|(step, _)| step.to_string()).unwrap_or_else(|| e.to_string()) + } + + /// A failed step of a folder batch is named by its place in the `commands` sent, from 1, with the + /// Open step that Override Open skips counted; the reason follows unchanged. + #[test] + fn a_folder_batch_error_names_the_step_in_the_commands_sent() { + let src = tmp("step-number-src"); + write_svg(&src, "a.svg", "#f00"); + write_svg(&src, "b.svg", "#0f0"); + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 100, "height": 80})).unwrap(); + // `command.batch` itself still numbers its steps from 0. + let reason = s + .execute( + "command.batch", + &json!({"commands": [{"command": "object.unlockAll", "params": {}}, {"command": "object.align", "params": {}}]}), + ) + .unwrap_err() + .to_string(); + let reason = reason.strip_prefix("batch step 1 (`object.align`) failed: ").unwrap_or_else(|| panic!("{reason}")).to_string(); + for (stop, rows) in [(true, 1), (false, 2)] { + let r = s + .execute("action.batch", &json!({"folder": src.to_string_lossy(), "stopOnError": stop, "commands": open_then_failing_align()})) + .unwrap(); + assert_eq!(r["failed"], rows, "{r}"); + for row in 0..rows { + assert_eq!(r["processed"][row]["error"], format!("action step 3 (`object.align`) failed: {reason}"), "{r}"); + } + } + } + + /// With Override Open off, a recorded Open step runs, and its failure is named as the first step. + #[test] + fn a_recorded_open_that_fails_is_the_first_step() { + let src = tmp("step-number-open-src"); + write_svg(&src, "a.svg", "#f00"); + let mut s = Session::new(); + let r = s + .execute("action.batch", &json!({"folder": src.to_string_lossy(), "overrideOpen": false, "commands": open_then_failing_align()})) + .unwrap(); + assert_eq!(named_step(&r, 0), "1 (`document.open`)", "{r}"); + } + + /// A data set batch, which always skips Open steps, names a failed step by its place in the + /// `commands` sent for every data set it fails on. + #[test] + fn a_data_set_batch_error_names_the_step_in_the_commands_sent() { + let mut s = with_data_sets(&["Alpha", "Beta"]); + for (stop, rows) in [(true, 1), (false, 2)] { + let r = s.execute("action.batch", &json!({"source": "datasets", "stopOnError": stop, "commands": open_then_failing_align()})).unwrap(); + assert_eq!(r["failed"], rows, "{r}"); + for row in 0..rows { + assert_eq!(named_step(&r, row), "3 (`object.align`)", "{r}"); + } + } + } + + /// A recorded export that Override Export points into the destination folder keeps its place in + /// the `commands` sent when it fails. + #[test] + fn a_redirected_export_that_fails_keeps_its_place() { + let src = tmp("step-number-export-src"); + write_svg(&src, "a.svg", "#f00"); + let dest = tmp("step-number-export-out"); + // A file where the export's folder goes, so the export cannot write its files. + std::fs::write(dest.join("a"), "taken").unwrap(); + let mut s = Session::new(); + let r = s + .execute( + "action.batch", + &json!({ + "folder": src.to_string_lossy(), + "destinationFolder": dest.to_string_lossy(), + "commands": [ + {"command": "document.open", "params": {"path": "/no/such/file.svg"}}, + {"command": "object.unlockAll", "params": {}}, + {"command": "document.exportForScreens", "params": {"formats": [{"format": "svg"}]}} + ] + }), + ) + .unwrap(); + assert_eq!(r["failed"], 1, "{r}"); + assert_eq!(named_step(&r, 0), "3 (`document.exportForScreens`)", "{r}"); + } + + /// A source file that does not open, which the batch opens itself, gives the open's own error + /// with no step number. + #[test] + fn a_source_that_does_not_open_names_no_step() { + let src = tmp("step-number-bad-src"); + std::fs::write(src.join("a.svg"), "not an svg").unwrap(); + let mut s = Session::new(); + let r = s.execute("action.batch", &json!({"folder": src.to_string_lossy(), "commands": open_then_failing_align()})).unwrap(); + assert_eq!(r["failed"], 1, "{r}"); + let e = r["processed"][0]["error"].as_str().unwrap_or_default(); + assert!(!e.is_empty() && !e.contains("action step") && !e.contains("batch step"), "{r}"); + } + + /// A `prefs.import` step, which `command.batch` does not run, is refused before any file opens. + #[test] + fn a_prefs_import_step_is_refused_before_any_file_opens() { + let src = tmp("step-number-prefs-src"); + write_svg(&src, "a.svg", "#f00"); + let mut s = Session::new(); + let p = json!({"folder": src.to_string_lossy(), "commands": [{"command": "object.unlockAll"}, {"command": "prefs.import", "params": {}}]}); + let e = s.execute("action.batch", &p).unwrap_err().to_string(); + assert!(e.contains("commands[1]: `prefs.import` runs on its own, not as a batch step"), "{e}"); + assert!(s.active().is_none(), "no file was opened"); + } + + /// Only the error `command.batch` gives for a failed step is read as one. + #[test] + fn batch_step_failure_reads_only_a_step_error() { + assert_eq!(batch_step_failure("batch step 12 (`object.move`) failed: no selection"), Some((12, "object.move", "no selection"))); + for e in [ + "batch step (`object.move`) failed: no selection", + "batch step 99999999999999999999999 (`object.move`) failed: x", + "batch step 1 `object.move` failed: x", + "invalid parameters for `command.batch`: batches cannot nest", + "batch step 1", + ] { + assert_eq!(batch_step_failure(e), None, "{e}"); + } + } } diff --git a/crates/engine/src/cmd/fileio/commands.rs b/crates/engine/src/cmd/fileio/commands.rs index 28e12c115d..ca74243699 100644 --- a/crates/engine/src/cmd/fileio/commands.rs +++ b/crates/engine/src/cmd/fileio/commands.rs @@ -45,7 +45,7 @@ pub fn specs() -> Vec { "Export Selection…", ["File"], None, - "{path?, format?: png|jpg|webp|svg|svgz|pdf|ai|gif|png8|tiff|bmp|tga|psd|txt|dxf|eps|emf|wmf|hpgl|vectorcraft|template (default: from the extension, else png), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), …the format's options} the selected objects (template layers left out), each in the layers and groups that hold it, whose clipping paths, opacity masks, effects, opacity and blend modes apply as on the canvas (an object of a blend, envelope, repeat or intertwine on its own; txt: the selected type alone), cropped to the bounds the renderer measures for that art (a clip group by its clip) → {path, format, bytes, warnings, bounds} (no path → {dataBase64, format, bytes, warnings, bounds}); warnings say what the format approximated or left out, as for document.export. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz are refused while the document links a JavaScript file outside them, as document.export refuses them", + "{path?, format?: png|jpg|webp|svg|svgz|pdf|ai|gif|png8|tiff|bmp|tga|psd|txt|dxf|eps|emf|wmf|hpgl|vectorcraft|template (default: from the extension, else png), ppi?: number (raster formats: pixels per inch, stored in the file; wins over scale; without either, the document's raster effects resolution), scale?: number (pixels per point), …the format's options} the selected objects (template layers left out), each in the layers and groups that hold it, whose clipping paths, opacity masks, effects, opacity and blend modes apply as on the canvas (an object of a blend, envelope, repeat or intertwine on its own; txt: the selected type alone), cropped to the bounds the renderer measures for that art (a clip group by its clip) → {path, format, bytes, warnings, bounds} (no path → {dataBase64, format, bytes, warnings, bounds}); warnings say what the format approximated or left out, as for document.export. A key no format takes, and an unknown key inside a PDF or EPS option's object, are refused; a key only another format takes is not used, and warnings name it. Under automation read roots, svg and svgz are refused while the document links a JavaScript file outside them, as document.export refuses them. In the app, with no params or {}, the save panel picks the file and its format's options dialog follows (Save PDF, SVG Options, the raster options, EPS Options, DXF Options, Text Export Options or an exporter plug-in's parameters; other formats are written at once), whose OK writes the selection: the call returns null while the dialog is open, and OK returns what file.exportAs returns, without format or bounds (Text Export Options: {path})", has_selection, export::export_selection ), @@ -54,7 +54,7 @@ pub fn specs() -> Vec { "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), 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), 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 for the document, for the artboard, asset, layer or object, from 1, #### for the counter zero-padded to the run of #, , , (else the row's suffix ends the name), YYYYMMDD, YYYY-MM-DD, YYYY, ,
, , and ; a trailing .ext is dropped, as in `COMPANY-Logo--####-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), …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/Icon@2x.png); 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 is refused, before the folder is made or any file is written, while the document links a JavaScript file outside them, as document.export refuses it", has_doc, screens::export_for_screens ), @@ -117,7 +117,7 @@ pub fn specs() -> Vec { "Batch…", [], None, - "{commands: [{command, params}] (the action's steps), source?: folder (default) | datasets, folder? (required for folder: the source folder), includeSubdirs?: false, destination?: none (default: leave each file open) | saveAndClose (save over the source and close; for source datasets, save the open document over its own file after each data set, and refuse a document that was never saved, was converted from an older version or was restored by Data Recovery, unless a recorded Save or Save As step writes a file first; a Save or Save As step that overrideSave points into destinationFolder makes each data set's file the document's own) | folder (save or export into destinationFolder and close), destinationFolder? (required when destination is folder; also the folder Override Save/Export write into), datasetFileNaming?: fileNumber | fileDataSetName (default) | dataSetName (used only for source datasets; ignored for folder), overrideOpen?: true (skip document.open / file.open steps: the batch opens each source file), overrideSave?: true (point document.save / file.save / file.saveAs at destinationFolder/{stem}.{ext}), overrideExport?: true (point document.export / document.exportSelection the same way, and give document.exportForScreens / assets.export the folder destinationFolder/{stem}, one for each source file or data set, in which the export names its files as it does outside Batch), stopOnError?: true, label?} play the commands on every readable file in folder (and its subfolders when includeSubdirs; {stem} is the file's name without its extension and without trailing periods and spaces, with `-2`, `-3`… added to a name an earlier file used or whose file or folder has the name of one an earlier file wrote or of another source file or a folder of source files in destinationFolder), or on every data set of the open document. Data set names use the document stem plus a three-digit ordinal, the document stem and an underscore plus the data set name, or the data set name alone. Invalid file name characters become `-` and trailing periods and spaces are dropped; a name already used in the batch or whose output file or folder already exists in a destination folder the batch may read and write gets the next free `-2`, `-3` suffix before the format-derived extension. Caps: 500 files or data sets, 8 folder levels, 256 steps. Batches cannot nest. A switch (includeSubdirs, overrideOpen, overrideSave, overrideExport, stopOnError) that is not true or false, or a source, folder, destination, destinationFolder, datasetFileNaming or label that is not a string, is an error before any folder is made or file opened; null reads as left out. → {processed: [{path|dataset, result|error}…], count, failed, stopped, warning?} (warning: for source datasets, when Save and Close without such a step, or a Save, Save a Copy, Save as Template or export step (document.export, exportSelection, exportForScreens, exportPdf, exportEps, exportDxf, exportForWeb, exportForOffice) that writes a file and is not pointed into destinationFolder, saves every data set over the same file)", + "{commands: [{command, params}] (the action's steps), source?: folder (default) | datasets, folder? (required for folder: the source folder), includeSubdirs?: false, destination?: none (default: leave each file open) | saveAndClose (save over the source and close; for source datasets, save the open document over its own file after each data set, and refuse a document that was never saved, was converted from an older version or was restored by Data Recovery, unless a recorded Save or Save As step writes a file first; a Save or Save As step that overrideSave points into destinationFolder makes each data set's file the document's own) | folder (save or export into destinationFolder and close), destinationFolder? (required when destination is folder; also the folder Override Save/Export write into), datasetFileNaming?: fileNumber | fileDataSetName (default) | dataSetName (used only for source datasets; ignored for folder), overrideOpen?: true (skip document.open / file.open steps: the batch opens each source file), overrideSave?: true (point document.save / file.save / file.saveAs at destinationFolder/{stem}.{ext}), overrideExport?: true (point document.export / document.exportSelection the same way, and give document.exportForScreens / assets.export the folder destinationFolder/{stem}, one for each source file or data set, in which the export names its files as it does outside Batch), stopOnError?: true, label?} play the commands on every readable file in folder (and its subfolders when includeSubdirs; {stem} is the file's name without its extension and without trailing periods and spaces, with `-2`, `-3`… added to a name an earlier file used or whose file or folder has the name of one an earlier file wrote or of another source file or a folder of source files in destinationFolder), or on every data set of the open document. Data set names use the document stem plus a three-digit ordinal, the document stem and an underscore plus the data set name, or the data set name alone. Invalid file name characters become `-` and trailing periods and spaces are dropped; a name already used in the batch or whose output file or folder already exists in a destination folder the batch may read and write gets the next free `-2`, `-3` suffix before the format-derived extension. Caps: 500 files or data sets, 8 folder levels, 256 steps. Batches cannot nest, and a prefs.import step is refused (commands[i], from 0) before any file is opened. A switch (includeSubdirs, overrideOpen, overrideSave, overrideExport, stopOnError) that is not true or false, or a source, folder, destination, destinationFolder, datasetFileNaming or label that is not a string, is an error before any folder is made or file opened; null reads as left out. A step that fails is named in the error by its place in commands, from 1, counting the Open steps the batch skips (action step 3 (`object.align`) failed: …); the batch's own opening of a file, choosing of a data set and destination save, export or close give their errors without a step number. → {processed: [{path|dataset, result|error}…], count, failed, stopped, warning?} (warning: for source datasets, when Save and Close without such a step, or a Save, Save a Copy, Save as Template or export step (document.export, exportSelection, exportForScreens, exportPdf, exportEps, exportDxf, exportForWeb, exportForOffice) that writes a file and is not pointed into destinationFolder, saves every data set over the same file)", always, action_batch::action_batch ), diff --git a/crates/engine/src/cmd/fileio/export.rs b/crates/engine/src/cmd/fileio/export.rs index d8af86802f..a2e9393ee0 100644 --- a/crates/engine/src/cmd/fileio/export.rs +++ b/crates/engine/src/cmd/fileio/export.rs @@ -32,26 +32,25 @@ pub fn unused_option_notes(cmd: &str, f: &Format, p: &Value) -> Vec { } let listed = |k: &str| super::FORMATS.iter().filter(|f| f.write).flat_map(|f| f.options).any(|o| o.name == k); let written = super::save::written_as(cmd, f, p); - let legacy = f.id == "ai" && super::legacy_ai::wanted(cmd, f, p).unwrap_or(false); - let reads = |k: &str| match (f.id, k) { - // A legacy `.ai` file is not a PDF: it reads its own options only. - ("ai", _) if legacy => super::legacy_ai::reads(k), - // The other `.ai` files don't read the legacy file's options, and `preserveEditing` is - // on for them whatever is given. - ("ai", "preserveEditing") => false, - ("ai", _) if super::legacy_ai::LEGACY_ONLY.contains(&k) => false, - // An export writes one file: only a save writes each artboard to a file of its own, and - // a native file's `range` names those files. - ("vectorcraft" | "template" | "ai", "separateArtboards") | ("vectorcraft" | "template", "range") => false, - _ => super::save::reads_option(f, k), - }; + let legacy = super::save::legacy_file(cmd, f, p); given .iter() - .filter(|(k, v)| !v.is_null() && !EXPORT_PARAMS.contains(&k.as_str()) && listed(k) && !reads(k)) + .filter(|(k, v)| !v.is_null() && !EXPORT_PARAMS.contains(&k.as_str()) && listed(k) && !export_reads(f, legacy, k)) .map(|(k, _)| super::save::unused_option_note(k, &written)) .collect() } +/// Does the file an export writes in `f` read option `key`, `legacy` when it is a legacy `.ai` +/// file? As a save's file does ([`super::save::file_reads`]), except that an export writes one +/// file: only a save writes each artboard to a file of its own, and a native file's `range` names +/// those files. +pub(super) fn export_reads(f: &Format, legacy: bool, key: &str) -> bool { + match (f.id, key) { + ("vectorcraft" | "template" | "ai", "separateArtboards") | ("vectorcraft" | "template", "range") => false, + _ => super::save::file_reads(f, legacy, key), + } +} + pub(super) fn serialize(s: &mut Session, p: &Value) -> Result { let f = writable("document.serialize", Some(text_param(p, "format", "document.serialize")?.unwrap_or("vectorcraft")), None)?; check_linked_scripts("document.serialize", f.id, s.doc()?)?; @@ -296,8 +295,14 @@ fn source<'a>(s: &'a mut Session, f: &Format, p: &Value, cmd: &str) -> Result<(C /// ([`isolated`]), with one artboard: their crop. With `text`, the objects alone on one layer, so a /// text export holds the type of the selected objects and not that of a clipping path around them. fn selection(s: &mut Session, cmd: &str, text: bool) -> Result<(Document, vectorcraft_geom::Rect)> { - let ids = selected_artwork(s)?; - let doc = &s.doc()?.doc; + selection_doc(s.doc()?, cmd, text) +} + +/// The document an Export Selection of `st` writes and its crop, as `document.exportSelection` +/// writes it ([`selection`]); `cmd` names the command in the error when nothing selected draws. +pub fn selection_doc(st: &DocState, cmd: &str, text: bool) -> Result<(Document, vectorcraft_geom::Rect)> { + let ids = artwork_of(st); + let doc = &st.doc; let (mut d, bounds) = isolated(doc, &ids, "Selection").ok_or_else(|| bad(cmd, "select something to export"))?; if text { let mut layer = Node::layer(d.alloc_id(), "Selection", vectorcraft_doc::LayerColor::Preset(0)); @@ -313,12 +318,16 @@ fn selection(s: &mut Session, cmd: &str, text: bool) -> Result<(Document, vector /// layers are guides and are left out. With an object of a dynamic symbol instance's art selected, /// the instance is exported whole. pub(crate) fn selected_artwork(s: &Session) -> Result> { - let st = s.doc()?; + Ok(artwork_of(s.doc()?)) +} + +/// [`selected_artwork`] of document `st`. +fn artwork_of(st: &DocState) -> Vec { let ids = edit::roots_of(&st.doc, st.selection.in_paint_order(&st.doc)); let is_template = |id| st.doc.node(id).is_some_and(|l| matches!(l.kind, NodeKind::Layer { template: true, .. })); // On a template layer or sublayer, at any depth. let on_template = |id| st.doc.ancestry(id).is_some_and(|a| a.into_iter().any(is_template)); - Ok(ids.into_iter().filter(|id| !on_template(*id)).collect()) + ids.into_iter().filter(|id| !on_template(*id)).collect() } /// The crop of an export of objects `ids` of `doc` alone ([`isolated`]): the bounds the renderer diff --git a/crates/engine/src/cmd/fileio/pdf.rs b/crates/engine/src/cmd/fileio/pdf.rs index c834e653e4..a891a81ff2 100644 --- a/crates/engine/src/cmd/fileio/pdf.rs +++ b/crates/engine/src/cmd/fileio/pdf.rs @@ -128,7 +128,7 @@ pub fn specs() -> Vec { "Export PDF", [], None, - "{path?, preset?: \"VectorCraft Default\" (built-in or saved: pdf.preset.list), artboard? | artboards?: [i…] | range?: \"1-3, 5\" (1-based; default all, one page each), useArtboards?: true (false: one page, the bounds of the visible art, as document.export writes it; artboard, artboards and range are then ignored, Preserve Editing is left out (with a warning when it is on), and a document with no visible art is refused), standard?: none|pdfA2b|pdfX1a (CMYK, grey and spot colours only: colours and images converted to output.destination or the CMYK output intent, untagged; transparency flattened with flattenerPreset; PDF 1.3)|pdfX3 (colours ICC-tagged; transparency flattened; PDF 1.3)|pdfX4 (transparency and layers kept; colours ICC-tagged; PDF 1.6 at most) (PDF/X: a /GTS_PDFX output intent, by default the CMYK profile in effect, embedded; TrimBox, Trapped, GTS_PDFXVersion, title and dates; fonts embedded or outlined), compatibility?: 1.3 (no transparency: it is flattened with flattenerPreset, without the layers the file leaves out; images keep no see-through pixels)|1.4|1.5|1.6|1.7 (default)|2.0 (choosing a standard sets its version: 1.7 for pdfA2b, 1.6 for pdfX4, 1.3 for pdfX1a and pdfX3, which write 1.4 as 1.3 too; pdfA2b refuses 1.3; in pdfA2b files, and with longPagesInPoints: false, a page with a side longer than 14,400 pt keeps its size with a UserUnit from 1.6 on: 1.5 is then written as 1.6, with 1.5's encryption, and so is 1.4 in pdfA2b files, with a warning; PDF/X files and other 1.3 and 1.4 files write it in points, and 1.3 and 1.4 (pdfX1a and pdfX3 too) refuse a page past 32,767 pt whose size or art needs a real number past 32,767; a page whose short side is 3 pt or longer but would be under 3 units at that UserUnit gets a smaller one that keeps the short side at 3 units; a warning gives each such page's size), longPagesInPoints?: true (such a page is written at its size in points, without a UserUnit, at every version, and 1.5 stays 1.5, in files without a standard (PDF/A files keep the UserUnit); apps that keep to the limit cut it to 200 in; false: the UserUnit as above, with a warning that names this option), preserveEditing? (on in VectorCraft Default: the native document as an embedded file, which document.open restores; choosing a standard turns it off, a standard refuses it), thumbnails? (each page drawn as a /Thumb image, 106 px on its long side), fastWebView? (a linearised file: the first page shows while the rest downloads; it stays linearised when encrypted), viewAfterSaving? (the app opens the written file), createLayers? (each layer and sublayer but template layers as a PDF layer, an optional content group listed under its layer's: hidden layers off, non-printing ones /PrintState /OFF, locked ones locked; needs 1.5 or later; they reopen as layers; choosing pdfX1a or pdfX3 turns it off; they refuse it), includeNonPrinting? (keep layers whose Print option is off; left out by default unless createLayers), flattenerPreset?: \"\" (High Resolution) | high | medium | low | a saved preset (flattener.presets.list): what PDF 1.3 files flatten transparency with, flattener?: {object.flattenTransparency options over it}, compression?: {color?, gray?: {downsample: none|average|subsample|bicubic, ppi: 300, abovePpi: 450, compression: none|zip|jpeg|jpeg2000|auto, quality: minimum|low|medium|high|maximum}, mono?: {downsample, ppi: 1200, abovePpi: 1800, compression: none|ccittG3|ccittG4|zip|runLength} (black-and-white images), compressText?: true} (images above abovePpi are resampled to ppi; auto keeps JPEGs JPEG, the others lossless; JPEG needs opaque images; none, jpeg2000, CCITT and runLength are written as ZIP with a warning), marks?: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25 (trim marks and targets), offset: 6 (pt from the artboard, at least the bleed)} (printer's marks in [Registration], every plate: trim marks, registration targets mid-side, CMYK/spot/black-tint colour bars on top, page information (title, artboard, date UTC) below), bleed?: {useDocument (the document's bleed, document.setup), top, bottom, left, right} (pt; art in the bleed is kept; a PDF/X file with no bleed on a side where the document's bleed has one comes back with a warning). Each page: TrimBox = artboard, BleedBox = artboard + bleed, MediaBox = that + the marks' room (art clipped to the BleedBox), output?: {conversion: none (default)|destination (every colour into the destination profile's model, CMYK or RGB, also colours of that model in another profile)|preserveNumbers (only colours of the other model and Lab; those in the destination's model keep their numbers) (grey stays grey; images are converted too, printer's marks are not), destination: profile name (edit.colorSettings lists them; default: the document's profile for its colour mode), profiles: none (device colours)|all|destination|taggedSource (documents assigned a profile: edit.assignProfile) (ICC-based colours: CMYK with the destination or document CMYK profile, RGB as sRGB, grey with the sRGB tone curve; PDF/A, pdfX3 and pdfX4 always, whatever profiles says), outputIntent: profile name (embedded as the catalog's /GTS_PDFX output intent; a name that isn't a profile is only named, which pdfX1a and pdfX3 allow only with a registry and pdfX4 refuses; pdfX1a needs a CMYK one), outputCondition, outputConditionId (default: outputIntent), registry, trapped (/Trapped /True; /False when an output intent is written)} (PDF/A files keep their own output intent), advanced?: {fontSubsetPercent: 100 (below 100 is accepted with a warning: fonts are always embedded as subsets), outlineText: false (type as real, selectable and searchable text in embedded subset fonts with a ToUnicode map; fonts whose licence forbids embedding, or allows only whole fonts, stay outlines with a warning; true: every glyph as an outline), overprint: preserve (overprinting fills and strokes set /OP /op true, /OPM 1; white ones knock out with document.setup discardWhiteOverprint)|discard (they knock out)}, security?: {openPassword, permissionsPassword, printing: none|low|high, changes: none|pages|forms|comments|any, copy, screenReader, plaintextMetadata}, acknowledgeLoss?: bool (write over the file the document was read from although reading it left things out), format?: \"pdf\"} → {path, bytes, warnings}; no path → {dataBase64, bytes, warnings}. The options apply over the preset (null keeps its value); options accepted but not applied yet come back as warnings; a standard with a PDF version it doesn't allow and a password with a standard are refused, and so is a PDF/X file that would still break its standard (transparency the flattener left, RGB in pdfX1a, a font not embedded) or a PDF 1.3 file with transparency left. document.export {format: pdf} takes the same options. A key PDF doesn't take, and an unknown key inside one of the option objects, are refused", + "{path?, preset?: \"VectorCraft Default\" (built-in or saved: pdf.preset.list), artboard? | artboards?: [i…] | range?: \"1-3, 5\" (1-based; default all, one page each), useArtboards?: true (false: one page, the bounds of the visible art, as document.export writes it; artboard, artboards and range are then ignored, Preserve Editing is left out (with a warning when it is on), and a document with no visible art is refused), standard?: none|pdfA2b|pdfX1a (CMYK, grey and spot colours only: colours and images converted to output.destination or the CMYK output intent, untagged; transparency flattened with flattenerPreset; PDF 1.3)|pdfX3 (colours ICC-tagged; transparency flattened; PDF 1.3)|pdfX4 (transparency and layers kept; colours ICC-tagged; PDF 1.6 at most) (PDF/X: a /GTS_PDFX output intent, by default the CMYK profile in effect, embedded; TrimBox, Trapped, GTS_PDFXVersion, title and dates; fonts embedded or outlined), compatibility?: 1.3 (no transparency: it is flattened with flattenerPreset, without the layers the file leaves out; images keep no see-through pixels)|1.4|1.5|1.6|1.7 (default)|2.0 (choosing a standard sets its version: 1.7 for pdfA2b, 1.6 for pdfX4, 1.3 for pdfX1a and pdfX3, which write 1.4 as 1.3 too; pdfA2b refuses 1.3; in pdfA2b files, and with longPagesInPoints: false, a page with a side longer than 14,400 pt keeps its size with a UserUnit from 1.6 on: 1.5 is then written as 1.6, with 1.5's encryption, and so is 1.4 in pdfA2b files, with a warning; PDF/X files and other 1.3 and 1.4 files write it in points, and 1.3 and 1.4 (pdfX1a and pdfX3 too) refuse a page past 32,767 pt whose size or art needs a real number past 32,767; a page whose short side is 3 pt or longer but would be under 3 units at that UserUnit gets a smaller one that keeps the short side at 3 units; a warning gives each such page's size), longPagesInPoints?: true (such a page is written at its size in points, without a UserUnit, at every version, and 1.5 stays 1.5, in files without a standard (PDF/A files keep the UserUnit); apps that keep to the limit cut it to 200 in; false: the UserUnit as above, with a warning that names this option), preserveEditing? (on in VectorCraft Default: the native document as an embedded file, which document.open restores; choosing a standard turns it off, a standard refuses it), thumbnails? (each page drawn as a /Thumb image, 106 px on its long side), fastWebView? (a linearised file: the first page shows while the rest downloads; it stays linearised when encrypted), viewAfterSaving? (the app opens the written file), createLayers? (each layer and sublayer but template layers as a PDF layer, an optional content group listed under its layer's: hidden layers off, non-printing ones /PrintState /OFF, locked ones locked; needs 1.5 or later; they reopen as layers; choosing pdfX1a or pdfX3 turns it off; they refuse it), includeNonPrinting? (keep layers whose Print option is off; left out by default unless createLayers), flattenerPreset?: \"\" (High Resolution) | high | medium | low | a saved preset (flattener.presets.list): what PDF 1.3 files flatten transparency with, flattener?: {object.flattenTransparency options over it}, compression?: {color?, gray?: {downsample: none|average|subsample|bicubic, ppi: 300, abovePpi: 450, compression: none|zip|jpeg|jpeg2000|auto, quality: minimum|low|medium|high|maximum}, mono?: {downsample, ppi: 1200, abovePpi: 1800, compression: none|ccittG3|ccittG4|zip|runLength} (black-and-white images), compressText?: true} (images above abovePpi are resampled to ppi; auto keeps JPEGs JPEG, the others lossless; JPEG needs opaque images; none, jpeg2000, CCITT and runLength are written as ZIP with a warning), marks?: {trim, registration, colorBars, pageInfo, kind: roman|japanese, weight: 0.25 (trim marks and targets), offset: 6 (pt from the artboard, at least the bleed)} (printer's marks in [Registration], every plate: trim marks, registration targets mid-side, CMYK/spot/black-tint colour bars on top, page information (title, artboard, date UTC) below), bleed?: {useDocument (the document's bleed, document.setup), top, bottom, left, right} (pt; art in the bleed is kept; a PDF/X file with no bleed on a side where the document's bleed has one comes back with a warning). Each page: TrimBox = artboard, BleedBox = artboard + bleed, MediaBox = that + the marks' room (art clipped to the BleedBox), output?: {conversion: none (default)|destination (every colour into the destination profile's model, CMYK or RGB, also colours of that model in another profile)|preserveNumbers (only colours of the other model and Lab; those in the destination's model keep their numbers) (grey stays grey; images are converted too, printer's marks are not), destination: profile name (edit.colorSettings lists them; default: the document's profile for its colour mode), profiles: none (device colours)|all|destination|taggedSource (documents assigned a profile: edit.assignProfile) (ICC-based colours: CMYK with the destination or document CMYK profile, RGB as sRGB, grey with the sRGB tone curve; PDF/A, pdfX3 and pdfX4 always, whatever profiles says; a CMYK image that keeps its numbers carries the CMYK profile it embeds with all and taggedSource, and in PDF/A, pdfX3 and pdfX4 unless destination, never in pdfX1a), outputIntent: profile name (embedded as the catalog's /GTS_PDFX output intent; a name that isn't a profile is only named, which pdfX1a and pdfX3 allow only with a registry and pdfX4 refuses; pdfX1a needs a CMYK one), outputCondition, outputConditionId (default: outputIntent), registry, trapped (/Trapped /True; /False when an output intent is written)} (PDF/A files keep their own output intent), advanced?: {fontSubsetPercent: 100 (below 100 is accepted with a warning: fonts are always embedded as subsets), outlineText: false (type as real, selectable and searchable text in embedded subset fonts with a ToUnicode map; fonts whose licence forbids embedding, or allows only whole fonts, stay outlines with a warning; true: every glyph as an outline), overprint: preserve (overprinting fills and strokes set /OP /op true, /OPM 1; white ones knock out with document.setup discardWhiteOverprint)|discard (they knock out)}, security?: {openPassword, permissionsPassword, printing: none|low|high, changes: none|pages|forms|comments|any, copy, screenReader, plaintextMetadata}, acknowledgeLoss?: bool (write over the file the document was read from although reading it left things out), format?: \"pdf\"} → {path, bytes, warnings}; no path → {dataBase64, bytes, warnings}. The options apply over the preset (null keeps its value); options accepted but not applied yet come back as warnings; a standard with a PDF version it doesn't allow and a password with a standard are refused, and so is a PDF/X file that would still break its standard (transparency the flattener left, RGB in pdfX1a, a font not embedded) or a PDF 1.3 file with transparency left. document.export {format: pdf} takes the same options. A key PDF doesn't take, and an unknown key inside one of the option objects, are refused", has_doc, export_pdf ), diff --git a/crates/engine/src/cmd/fileio/save.rs b/crates/engine/src/cmd/fileio/save.rs index e56f6467a1..af9ed8e58a 100644 --- a/crates/engine/src/cmd/fileio/save.rs +++ b/crates/engine/src/cmd/fileio/save.rs @@ -95,14 +95,18 @@ pub struct SavePlan { /// The `modified` param (as `date_param` reads it): the File Info date a Save or Save As to a file /// stamps; `None`: the time it is written. pub modified: Option>, - /// Warnings about the params themselves: each native option (`compress`, `version`, - /// `preview`, `precision`) given beside the path, and each key of `options`, that the format - /// doesn't read, naming the file the save writes. + /// Warnings about the params themselves: each option a save format takes given beside the + /// path, and each key of `options`, that the file the save writes doesn't read + /// ([`file_reads`]), naming that file. pub notes: Vec, /// The file the document was read from and what reading it left out, when the save needs /// `acknowledgeLoss` to write over it and was not given it: every file the save writes is /// checked against it before the first is written. pub lossy_source: Option<(String, Vec)>, + /// The `.ai` options the file doesn't read, with the values the document remembers from its + /// last `.ai` save: not in `options`, they go back into the remembered options once the file + /// is the document's own. + pub kept: Map, } impl SavePlan { @@ -279,7 +283,8 @@ pub fn save_plan(s: &Session, mode: SaveMode, p: &Value) -> Result { } } // None given: the ones the document was last saved with in this format. - let mut options = if given.is_empty() && format.id == st.format { remembered_save_options(st) } else { given }; + let from_memory = given.is_empty() && format.id == st.format; + let mut options = if from_memory { remembered_save_options(st) } else { given }; // Remember the effective choice, including the encoder's default, so another document's // later save cannot change what this one writes. Invalid non-null values still reach validation. if matches!(format.id, "vectorcraft" | "template") { @@ -311,21 +316,54 @@ pub fn save_plan(s: &Session, mode: SaveMode, p: &Value) -> Result { let given = str_param(p, "path").is_some_and(|g| !g.is_empty()); super::check_not_lossy_overwrite(st, path, p, cmd).map_err(|e| if given { e } else { super::access::naming_in_error(e, path) })?; } - let written = written_as(cmd, format, &Value::Object(options.clone())); - let top = NATIVE_OPTIONS.iter().filter(|k| p.get(**k).is_some_and(|v| !v.is_null())).map(|k| k.to_string()); + let chosen = Value::Object(options.clone()); + let written = written_as(cmd, format, &chosen); + let legacy = legacy_file(cmd, format, &chosen); + // Beside the path, a key some save format takes; in `options`, any key. + let top = p.as_object().into_iter().flatten().filter(|(k, v)| !v.is_null() && save_listed(k)).map(|(k, _)| k.to_string()); let nested = p.get("options").and_then(Value::as_object).into_iter().flatten().filter(|(_, v)| !v.is_null()).map(|(k, _)| k); let notes = top - .filter(|k| !reads_option(format, k)) - .chain(nested.filter(|k| !reads_option(format, k)).map(|k| format!("options.{k}"))) + .filter(|k| !file_reads(format, legacy, k)) + .chain(nested.filter(|k| !file_reads(format, legacy, k)).map(|k| format!("options.{k}"))) .map(|k| unused_option_note(&k, &written)) .collect(); + // When the document's own file is a `.ai`, the `.ai` options this file doesn't read and the + // request doesn't give keep their remembered values ([`SavePlan::kept`]), so that Save Options + // still shows them (it sends only the ones the file reads). They are neither written nor sent + // again. + let mut kept = Map::new(); + if format.id == "ai" && format.id == st.format { + let last = remembered_save_options(st); + for o in format.options.iter().filter(|o| !file_reads(format, legacy, o.name)) { + let value = if from_memory { + options.remove(o.name) + } else if options.contains_key(o.name) { + None + } else { + last.get(o.name).cloned() + }; + if let Some(v) = value { + kept.insert(o.name.to_string(), v); + } + } + } let lossy_source = super::lossy_source(st, p); - Ok(SavePlan { mode, path, format, options, name, folder, modified, notes, lossy_source }) + Ok(SavePlan { mode, path, format, options, name, folder, modified, notes, lossy_source, kept }) } /// The native save options, which a save also takes beside the path. const NATIVE_OPTIONS: [&str; 4] = ["compress", "version", "preview", "precision"]; +/// Does some save format (or template format) take option `key`? +fn save_listed(key: &str) -> bool { + NATIVE_OPTIONS.contains(&key) + || super::FORMATS + .iter() + .filter(|f| SAVE_FORMATS.contains(&f.id) || TEMPLATE_FORMATS.contains(&f.id)) + .flat_map(|f| f.options) + .any(|o| o.name == key) +} + /// The first option `p` gives both beside the path and in `options` with different values, as /// `(key, top-level value, options value)`. For an SVG save (`svg`), an SVG option's value on /// either side is the one its `svg: {…}` object gives, else the flat one. @@ -467,6 +505,26 @@ pub fn reads_option(f: &Format, key: &str) -> bool { f.options.iter().any(|o| o.name == key) || (is_pdf(f) && (super::pdf::OPTIONS.iter().any(|o| o.name == key) || super::pdf::is_setting(key))) } +/// Does the file a save or an export writes in `f` read option `key`, `legacy` when it is a legacy +/// `.ai` file ([`super::legacy_ai::wanted`])? As [`reads_option`], except for `.ai` and `.ait` +/// files: a legacy file reads its own options only ([`super::legacy_ai::reads`]), and the others +/// don't read the legacy file's options or `preserveEditing`, which is on for them whatever is +/// given. +pub fn file_reads(f: &Format, legacy: bool, key: &str) -> bool { + match (f.id, key) { + ("ai", _) if legacy => super::legacy_ai::reads(key), + ("ai" | "ait", "preserveEditing") => false, + ("ai" | "ait", _) if super::legacy_ai::LEGACY_ONLY.contains(&key) => false, + _ => reads_option(f, key), + } +} + +/// Is a save or an export of `cmd` in `f` with options `p` to write a legacy `.ai` file? An +/// unknown version is not one (the save or export refuses it). +pub(super) fn legacy_file(cmd: &str, f: &Format, p: &Value) -> bool { + f.id == "ai" && super::legacy_ai::wanted(cmd, f, p).unwrap_or(false) +} + /// The note a save or an export gives for option `key`, as the request names it, which the file it /// writes (`written`, see [`written_as`]) doesn't read. pub(super) fn unused_option_note(key: &str, written: &Format) -> String { @@ -1037,6 +1095,7 @@ impl SaveJob { st.path = Some(path); st.format = self.plan.format.id; st.save_options = self.plan.options; + st.save_options.extend(self.plan.kept); // A later save rounds only when it gives `precision` too. st.save_options.remove("precision"); st.save_artboards = self.snapshot.artboards.iter().map(|a| a.id).collect(); @@ -1239,7 +1298,7 @@ pub(super) fn specs() -> Vec { "Save Document", [], None, - "{path?, format?: vectorcraft|template|pdf|svg|svgz|ai|eps (default: the path's extension, else the document's own format), options?: {…the format's options, see file.formatOptions; default: as last saved}, svg?: {…SVG options} (an SVG save keeps hidden layers, display:none, unless hiddenLayers is false), …the SVG and PDF options given flat instead (an option given flat or in svg and in options with different values is an error), compress?: bool (native, also in options: gzip; default: the useCompression preference; warnings say when the format doesn't read compress, version, preview or precision given flat, or a key given in options), version?: 4 (3, 2 or 1: for older VectorCraft versions; 1 and 2 are never compressed), preview?: false (embed a PNG of the first artboard, at most 256 px), precision?: 0..9 (native: round path anchors and handles to this many decimal places, a smaller file; colors, transforms and type stay exact; default: exact, and a later save without it writes exactly again), separateArtboards?: false (native and .ai: also save each artboard of `range` to -. beside the file, holding that artboard and the art touching it; the result's files lists every file written), range?: \"1-3, 5\"|\"all\" (default; with separateArtboards), includeLinked?: false (keep linked files' own pixels, not just their previews; they stay linked), embedProfiles?: true (carry the ICC profiles loaded from files that the document is tagged with; opening the file installs them where missing), pdfCompatible?: true (native: also carry a PDF of every artboard; false omits it) | true for .ai (false: blank pages, only the native document; a .ai file's compress, default true, is its compression.compressText), modified?: Unix seconds|null (the File Info modified date, and created date when there is none, a save to a file stamps; default now, recorded in the journal so a replay matches; null: leave the dates)} → {path, format, bytes, warnings, files?: [path…] (the file and its artboards' files), linked?: [path…] (images an SVG links to)}. Save writes one artboard, except a .ai file and EPS (below): a .ai file is a PDF-compatible file of every artboard carrying the native document (preserveEditing always on; PDF options flat or in options), which document.open restores exactly, on the active artboard (the app's, else the one the document opened on; with editingData: false, the first); separateArtboards writes more files, one per artboard. EPS takes the options of document.exportEps: by default one file whose bounding box fits the visible art (the first artboard when no art shows), carrying the whole editable document; useArtboards: true (also when artboard, artboards or range names artboards; file.formatOptions then reports it true) makes the chosen artboard the page, drawn with its background color (without Use Artboards, only the first artboard's page when no art shows has its color), and with two or more chosen the file at the path is the central file of the visible art (again the first artboard when none shows) and each artboard is also written to _.eps beside it, holding that artboard; selectedOnly is refused; its PostScript appearance flattens transparency, as EPS requires. Without a path it writes the document's own file in its own format: a document opened from or saved as SVG/PDF/EPS saves as that again (warnings name what the format loses). No path known (never saved, converted from an older version, restored by Data Recovery, or another format) → {dataBase64, format, name, folder?, warnings} and the document stays modified. Under automation read roots, a reply leaves out the document's own file outside them when no path is given (files and linked then name the files by their file names), and a suggested folder outside them; an svg or svgz save (a document whose own format is SVG or SVGZ included) is refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), also by file.saveAs and file.saveCopy. A key that no save format takes, beside the path or in options, and an unknown key inside a PDF option's object or svg, are refused. A terminal filesystem permission/read-only refusal returns READ_ONLY_LOCATION: followed by the reason; recovery-copy failures keep their original error. Non-UI callers never open a save panel", + "{path?, format?: vectorcraft|template|pdf|svg|svgz|ai|eps (default: the path's extension, else the document's own format), options?: {…the format's options, see file.formatOptions; default: as last saved}, svg?: {…SVG options} (an SVG save keeps hidden layers, display:none, unless hiddenLayers is false), …the SVG and PDF options given flat instead (an option given flat or in svg and in options with different values is an error), compress?: bool (native, also in options: gzip; default: the useCompression preference; warnings name an option given flat or in options that the file doesn't read: a legacy .ai reads only its own options, and other .ai files don't read outlineText, hiddenObjects, transparentImages or preserveEditing), version?: 4 (3, 2 or 1: for older VectorCraft versions; 1 and 2 are never compressed), preview?: false (embed a PNG of the first artboard, at most 256 px), precision?: 0..9 (native: round path anchors and handles to this many decimal places, a smaller file; colors, transforms and type stay exact; default: exact, and a later save without it writes exactly again), separateArtboards?: false (native and .ai: also save each artboard of `range` to -. beside the file, holding that artboard and the art touching it; the result's files lists every file written), range?: \"1-3, 5\"|\"all\" (default; with separateArtboards), includeLinked?: false (keep linked files' own pixels, not just their previews; they stay linked), embedProfiles?: true (carry the ICC profiles loaded from files that the document is tagged with; opening the file installs them where missing), pdfCompatible?: true (native: also carry a PDF of every artboard; false omits it) | true for .ai (false: blank pages, only the native document; a .ai file's compress, default true, is its compression.compressText), modified?: Unix seconds|null (the File Info modified date, and created date when there is none, a save to a file stamps; default now, recorded in the journal so a replay matches; null: leave the dates)} → {path, format, bytes, warnings, files?: [path…] (the file and its artboards' files), linked?: [path…] (images an SVG links to)}. Save writes one artboard, except a .ai file and EPS (below): a .ai file is a PDF-compatible file of every artboard carrying the native document (preserveEditing always on; PDF options flat or in options), which document.open restores exactly, on the active artboard (the app's, else the one the document opened on; with editingData: false, the first); separateArtboards writes more files, one per artboard. EPS takes the options of document.exportEps: by default one file whose bounding box fits the visible art (the first artboard when no art shows), carrying the whole editable document; useArtboards: true (also when artboard, artboards or range names artboards; file.formatOptions then reports it true) makes the chosen artboard the page, drawn with its background color (without Use Artboards, only the first artboard's page when no art shows has its color), and with two or more chosen the file at the path is the central file of the visible art (again the first artboard when none shows) and each artboard is also written to _.eps beside it, holding that artboard; selectedOnly is refused; its PostScript appearance flattens transparency, as EPS requires. Without a path it writes the document's own file in its own format: a document opened from or saved as SVG/PDF/EPS saves as that again (warnings name what the format loses). No path known (never saved, converted from an older version, restored by Data Recovery, or another format) → {dataBase64, format, name, folder?, warnings} and the document stays modified. Under automation read roots, a reply leaves out the document's own file outside them when no path is given (files and linked then name the files by their file names), and a suggested folder outside them; an svg or svgz save (a document whose own format is SVG or SVGZ included) is refused, before any file is written, while the document links a JavaScript file outside them (svgInteractivity; a URL is not checked), also by file.saveAs and file.saveCopy. A key that no save format takes, beside the path or in options, and an unknown key inside a PDF option's object or svg, are refused. A terminal filesystem permission/read-only refusal returns READ_ONLY_LOCATION: followed by the reason; recovery-copy failures keep their original error. Non-UI callers never open a save panel", has_doc, |s, p| save(s, SaveMode::Save, p) ), diff --git a/crates/engine/src/cmd/fileio/screens.rs b/crates/engine/src/cmd/fileio/screens.rs index dcf3d6c9ae..c07dd8854a 100644 --- a/crates/engine/src/cmd/fileio/screens.rs +++ b/crates/engine/src/cmd/fileio/screens.rs @@ -18,7 +18,7 @@ use vectorcraft_geom::Rect; use super::super::{EngineError, NodeId, Result, Session, bad, bool_or, str_param}; use super::encode::{add_note, single_artboard}; -use super::export::{export_crop, isolated, selected_artwork, without_artboards}; +use super::export::{export_crop, export_reads, isolated, selected_artwork, without_artboards}; use super::naming::{self, NameParts}; use super::{ ARTBOARD_PARAMS, ArtboardPick, Format, Note, artboard_file_names_keeping_dots, create_dir, distinct_names_by, encode_with_notes, merge, @@ -524,6 +524,77 @@ fn rows_of(s: &Session, p: &Value, preset: Option<&str>) -> Result> { Ok(rows) } +/// A note for each option of a format row (`formats`) or of a format's `settings` in the request +/// `asked` that some format takes but the file the row writes, or every row of that format writes, +/// doesn't read (`{format: png, quality: 80}`), in the wording of a save's note and named as the +/// request names it (`formats[0].quality`, `settings.png.quality`). The rows and settings the +/// export writes with are those of `p` (`asked` with a preset or the remembered settings laid +/// under it). A row's own keys (`scale`, `suffix`…), the keys the export reads for every format +/// (`includeArtboardFill`, `richBlack`, `params`) and an artboard choice (the export picks the +/// artboards) get none, and so does an exporter plug-in's format. +pub(crate) fn unused_option_notes(asked: &Value, p: &Value) -> Vec { + let listed = |k: &str| super::FORMATS.iter().filter(|f| f.write).flat_map(|f| f.options).any(|o| o.name == k); + let own = |k: &str| { + ROW_KEYS.contains(&k) || ARTBOARD_PARAMS.contains(&k) || matches!(k, "useArtboards" | "includeArtboardFill" | "richBlack" | "params") + }; + // The keys of `given` that `f`, writing with `options` (the format's settings and the row's + // own), doesn't read. + let unread = |f: &Format, given: &Map, options: &Value| -> Vec { + if vectorcraft_plugins::export::by_format(f.id).is_some() { + return Vec::new(); + } + let legacy = super::save::legacy_file(C, f, options); + given.iter().filter(|(k, v)| !v.is_null() && !own(k) && listed(k) && !export_reads(f, legacy, k)).map(|(k, _)| k.clone()).collect() + }; + let note = |key: String, f: &Format, options: &Value| super::save::unused_option_note(&key, &super::save::written_as(C, f, options)); + let settings = p.get("settings").and_then(Value::as_object); + let of_format = |id: &str| settings.and_then(|s| s.get(id)).and_then(Value::as_object).cloned().unwrap_or_default(); + // A row's format and the options it writes with. + let row_of = |row: &Value| -> Option<(&'static Format, Value)> { + let (Some(row), Ok(f)) = (row.as_object(), writable(C, Some(str_param(row, "format").unwrap_or("png")), None)) else { return None }; + let mut options = of_format(f.id); + options.extend(row.iter().map(|(k, v)| (k.clone(), v.clone()))); + Some((f, Value::Object(options))) + }; + let mut out: Vec = Vec::new(); + if let Some(Value::Array(rows)) = asked.get("formats") { + for (i, row) in rows.iter().enumerate() { + let (Some((f, options)), Some(given)) = (row_of(row), row.as_object()) else { continue }; + out.extend(unread(f, given, &options).into_iter().map(|k| note(format!("formats[{i}].{k}"), f, &options))); + } + } + // The rows written, each with its own keys: a format's settings are read as each of its rows + // writes them (a row may name another `.ai` version), else as they are. + let written: Vec<(&Format, Value, Map)> = match p.get("formats") { + Some(Value::Array(rows)) => { + rows.iter().filter_map(|row| row_of(row).map(|(f, options)| (f, options, row.as_object().cloned().unwrap_or_default()))).collect() + } + _ => Vec::new(), + }; + for (id, given) in asked.get("settings").and_then(Value::as_object).into_iter().flatten() { + let (Some(given), Ok(f)) = (given.as_object(), writable(C, Some(id), None)) else { continue }; + let mut rows: Vec<(&Value, Option<&Map>)> = + written.iter().filter(|(g, ..)| g.id == f.id).map(|(_, o, row)| (o, Some(row))).collect(); + let alone = Value::Object(of_format(f.id)); + if rows.is_empty() { + rows.push((&alone, None)); + } + let unread_by: Vec> = rows.iter().map(|(o, _)| unread(f, given, o)).collect(); + // A setting a row reads and doesn't give itself is used. One no row uses is noted when a + // row doesn't read it, naming the first such row's file. + for (k, v) in given { + // A row's own key, null too, replaces the setting. + let overridden = |row: Option<&Map>| row.is_some_and(|r| r.contains_key(k)); + let used = rows.iter().zip(&unread_by).any(|((_, row), u)| !u.contains(k) && !overridden(*row)); + let unread_row = rows.iter().zip(&unread_by).find(|(_, u)| u.contains(k)); + if let (false, false, Some(((options, _), _))) = (v.is_null(), used, unread_row) { + out.push(note(format!("settings.{id}.{k}"), f, options)); + } + } + } + out +} + /// Check the export settings in `p` (formats, preset, settings…) as an export would read them. pub(crate) fn check_settings(s: &Session, p: &Value) -> Result<()> { rows_of(s, p, ScreenParams::of(p)?.preset.as_deref()).map(|_| ()) @@ -646,9 +717,10 @@ impl Output { pub(super) fn export_for_screens(s: &mut Session, p: &Value) -> Result { // A folder the client gave, as against the one its `exportPreset` keeps. let given = p.get("folder").is_some(); + let asked = p; let p = with_preset(s, p)?; let hidden = if given { None } else { str_param(&p, "folder").filter(|f| !f.is_empty() && !super::access::shown(f)) }; - let mut r = export(s, &p).map_err(|e| match hidden { + let mut r = export(s, &p, asked).map_err(|e| match hidden { Some(folder) => super::access::naming_in_error(e, folder), None => e, })?; @@ -1022,9 +1094,12 @@ pub(crate) fn with_export_preset(s: &Session, cmd: &str, settings: &mut Map Result { +/// first ([`super::note_texts`]), and a note for each option of the request `asked` (`p` before a +/// preset or the remembered settings were laid under it) that the files the rows write don't read +/// ([`unused_option_notes`]). +pub(crate) fn export(s: &mut Session, p: &Value, asked: &Value) -> Result { check_passwords(p)?; + let unused = unused_option_notes(asked, p); let o = ScreenParams::of(p)?; let rows = rows_of(s, p, o.preset.as_deref())?; o.one_source()?; @@ -1054,7 +1129,7 @@ pub(crate) fn export(s: &mut Session, p: &Value) -> Result { // Include Artboard Fill off: the encoders leave the background colors out. let fill = if o.include_artboard_fill == Some(false) { json!({ "includeArtboardFill": false }) } else { json!({}) }; let rows = rows.into_iter().map(|r| Row { options: merge(with_black_output(s, &r.options), fill.clone()), ..r }).collect(); - let export = ScreenExport { cmd: C, o, rows, naming, items, hidden: None }; + let export = ScreenExport { cmd: C, o, rows, naming, items, unused, hidden: None }; match &mut s.screens_hand_off { Some(slot) => { *slot = Some(export); @@ -1075,6 +1150,8 @@ pub struct ScreenExport { rows: Vec, naming: Naming, items: Vec, + /// The notes on options the files don't read ([`unused_option_notes`]). + unused: Vec, /// The export folder and the name the request that prepared the export may see it by, when the /// folder came from the `exportPreset` and is outside that request's read roots: the reply and /// the errors of [`ScreenExport::write`] name it as [`export_for_screens`] does. @@ -1139,14 +1216,17 @@ impl ScreenExport { /// [`ScreenExport::write`]. fn encode_and_write(export: ScreenExport, writer: &mut dyn FnMut(&str, &[u8]) -> Result<()>) -> Result { - let ScreenExport { o, rows, naming, items, .. } = export; + let ScreenExport { o, rows, naming, items, unused, .. } = export; let folder = o.folder.as_deref().filter(|f| !f.is_empty()); if let Some(dir) = folder { create_dir(dir)?; } let mut out = Output::default(); - // The encoders' notes for every file, each once. + // The notes on the options, then the encoders' notes for every file, each once. let mut notes: Vec = Vec::new(); + for text in unused { + add_note(&mut notes, Note::setting(text)); + } // Include Bleed: a grown artboard already holds the bleed. Assets, layers and a selection are // written on a page of their own bounds, which it doesn't grow. let bleed_on_page = o.include_bleed && o.assets.is_none() && o.layers.is_none() && o.selection.is_none(); diff --git a/crates/engine/src/cmd/fileio/tests.rs b/crates/engine/src/cmd/fileio/tests.rs index 71c1bd06e5..7374e26e2b 100644 --- a/crates/engine/src/cmd/fileio/tests.rs +++ b/crates/engine/src/cmd/fileio/tests.rs @@ -186,6 +186,22 @@ fn planar_tiffs_read_as_their_chunky_versions() { } } +/// A 16-bit CMYK TIFF with alpha places with its alpha rounded from 16 bits, planar as chunky. +#[test] +fn a_16_bit_cmyk_tiff_with_alpha_places_at_16_bits() { + let none = vec![0u16; 6]; + let cyan = vec![129u16, 0, 300, 0, 128, 65535]; + let alpha = vec![65535u16, 129, 386, 0, 256, 65535]; + for extra in [1u16, 2] { + let channels = [cyan.clone(), none.clone(), none.clone(), none.clone(), alpha.clone()]; + let chunky = kept(&format!("extra samples {extra}, chunky"), &hand_tiff(5, 16, &[extra], false, &channels)); + let planar = kept(&format!("extra samples {extra}, planar"), &hand_tiff(5, 16, &[extra], true, &channels)); + assert_eq!(planar, chunky, "extra samples {extra}: planar reads as chunky"); + let alphas: Vec = chunky.1.iter().skip(3).step_by(4).copied().collect(); + assert_eq!(alphas, [255, 1, 2, 0, 1, 255], "extra samples {extra}: the alpha, rounded from 16 bits"); + } +} + /// A planar TIFF whose header claims more strips than the decoder can count (here 2^31 + 1 rows /// a strip each, times 5 planes) is refused as too large to draw, without a panic. #[test] @@ -748,8 +764,8 @@ fn a_native_save_streams_the_bytes_the_encoder_makes() { } /// An option given beside the path (an SVG option flat or in `svg`) and in `options` with different -/// values is refused before anything is written; `compress`, `version`, `preview` or `precision` beside the path of a format -/// that doesn't read it is named in the warnings. +/// values is refused before anything is written; a native option beside the path of a format that doesn't read it is named +/// in the warnings. #[test] fn a_save_refuses_disagreeing_options_and_names_unread_native_ones() { let d = tmp_dir("save-options"); diff --git a/crates/engine/src/cmd/fileio/tests_aiimport.rs b/crates/engine/src/cmd/fileio/tests_aiimport.rs index fafcc12215..c48b437b76 100644 --- a/crates/engine/src/cmd/fileio/tests_aiimport.rs +++ b/crates/engine/src/cmd/fileio/tests_aiimport.rs @@ -424,8 +424,8 @@ fn a_graphic_style_library_in_a_ai_file_without_layers_loads_its_styles() { /BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n{xa}0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n;\n" ) }; - // Styles of one paint (`/SimpleStyle`): a red 2 pt stroke and no fill, and a gradient fill, - // which isn't read, so it is left out rather than listed with no paint. + // Styles of one paint (`/SimpleStyle`): a red 2 pt stroke and no fill, and a fill with a gradient + // the file doesn't define, which is left out rather than listed with no paint. let one_paint = |name: &str, paint: &str| format!("/KnownStyle :\n({name}) /Name ,\n/SimpleStyle :\n{paint}/Paint ;\n/Def ;\n"); let styles = format!( "%AI9_BeginArtStyles\n{}{}{}{}{}%AI9_EndArtStyles\n\ @@ -465,6 +465,64 @@ fn a_graphic_style_library_in_a_ai_file_without_layers_loads_its_styles() { assert_eq!(styles, [("Red", 1), ("Green", 2), ("Blue", 3), ("Red outline", 4)], "{r}"); } +/// A `.ai` graphic style library's styles that paint with one of the file's gradients by name (a +/// fill style's, and the fill or stroke of a style of one paint) load with that gradient at the +/// style's angle, fitted to the bounds of each object the style is applied to; one naming a gradient +/// the file doesn't define is left out. +#[test] +fn graphic_styles_in_a_ai_library_that_paint_with_a_named_gradient_load_with_it() { + let gradient = + "%AI5_BeginGradient: (Sky)\n(Sky) 0 2 Bd\n[\n%_0 0 0 0 0 1 0 2 1 6 50 0 Bs\n%_0 0 0 0 1 1 1 2 1 6 50 100 Bs\nBD\n%AI5_EndGradient\n"; + let band = "/KnownStyle :\n(Sky band) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\ + /BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n\ + 0 Bb\n2 (Sky) 0 0 45 100 1 0 0 1 0 0 Bg\n0 BB\n0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n;\n"; + let one_paint = |name: &str, paint: &str| format!("/KnownStyle :\n({name}) /Name ,\n/SimpleStyle :\n{paint}/Paint ;\n/Def ;\n"); + let styles = format!( + "%AI9_BeginArtStyles\n{band}{}{}{}%AI9_EndArtStyles\n\ + %AI9_BeginArtStyleList\n(Sky band)\n(Sky fill)\n(Sky outline)\n(Dusk fill)\n%AI9_EndArtStyleList\n", + one_paint("Sky fill", "0 O\n0 Bb\n2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg\n0 BB\n0 1 Xd\n"), + one_paint("Sky outline", "0 R\n0 J 0 j 2 w 10 M []0 d\n1 Bb\n2 (Sky) 0 0 90 100 1 0 0 1 0 0 1 Bg\n0 BB\n1 0 Xd\n"), + one_paint("Dusk fill", "0 O\n0 Bb\n2 (Dusk) 0 0 0 100 1 0 0 1 0 0 Bg\n0 BB\n0 1 Xd\n") + ); + // A palette with the gradient's swatch, so the document opened from the file shows its gradient. + let palette = INKS_PALETTE.replace("0 0 Pb\n", "0 0 Pb\nBb\n2 (Sky) 0 0 0 1 1 0 0 1 0 0 1 Bg\n0 BB\n(Sky)\nPc\n"); + let data = ai::editing_data(200.0, 100.0, &format!("{gradient}{palette}{styles}")); + let file = ai::ai(&compressed(data.as_bytes()), "1 0 0 rg 10 50 30 40 re f"); + let mut s = Session::new(); + let p = json!({"dataBase64": vectorcraft_format::base64_encode(&file), "name": "skies.ai"}); + let r = s.execute("graphicStyle.loadLibrary", &p).unwrap(); + let library = r["library"].clone(); + let lib = s.execute("graphicStyle.library", &json!({"library": library})).unwrap(); + let names: Vec<&str> = lib["styles"].as_array().unwrap().iter().map(|g| g["name"].as_str().unwrap()).collect(); + assert_eq!(names, ["Sky band", "Sky fill", "Sky outline"], "{lib}"); + // The file's gradient, as the document opened from it has its swatch. + open(&mut s, "skies.ai", &file, json!({})).unwrap(); + let sky = match s.doc().unwrap().doc.swatch("Sky").map(|w| w.paint.clone()) { + Some(vectorcraft_color::Paint::Gradient(g)) => g.gradient, + other => panic!("{other:?}"), + }; + // Applied to a small and a large rectangle, each gradient is fitted to the rectangle it paints. + s.execute("file.new", &json!({"width": 300, "height": 300})).unwrap(); + for (style, (x, size)) in [("Sky band", (10, 20)), ("Sky fill", (40, 200)), ("Sky outline", (10, 120))] { + let rect = json!({"x": x, "y": x, "width": size, "height": size / 2}); + let id = NodeId(s.execute("shape.rectangle", &rect).unwrap()["id"].as_u64().unwrap()); + let r = s.execute("graphicStyle.addFromLibrary", &json!({"library": library, "names": [style], "apply": true, "ids": [id.0]})).unwrap(); + assert_eq!(r["added"], json!([style]), "{r}"); + let look = &s.doc().unwrap().doc.node(id).unwrap().appearance; + let (paint, angle, stroked) = match style { + "Sky outline" => (look.stroke().map(|st| &st.paint), 90.0, true), + "Sky band" => (look.fill().map(|f| &f.paint), 45.0, false), + _ => (look.fill().map(|f| &f.paint), 0.0, false), + }; + let Some(vectorcraft_color::Paint::Gradient(g)) = paint else { panic!("{style}: {look:?}") }; + assert_eq!((&g.gradient, g.geom, g.angle), (&sky, None, angle), "{style}"); + assert_eq!(look.stroke().is_some(), stroked, "{style}: {look:?}"); + if stroked { + assert!(look.fill().is_none() && look.stroke().is_some_and(|st| st.width == 2.0), "{look:?}"); + } + } +} + /// A `.ai` symbol library (symbols and their list, no layers) opens with its symbols, and Other /// Library… in the Symbols panel lists them in the list's order. #[test] diff --git a/crates/engine/src/cmd/fileio/tests_exportas.rs b/crates/engine/src/cmd/fileio/tests_exportas.rs index cc1345060d..1908c39685 100644 --- a/crates/engine/src/cmd/fileio/tests_exportas.rs +++ b/crates/engine/src/cmd/fileio/tests_exportas.rs @@ -280,3 +280,102 @@ fn note_texts_give_the_losses_first_each_kind_in_order() { assert_eq!(note_texts(&[Note::setting("s1"), Note::setting("s2")]), ["s1", "s2"]); assert!(note_texts(&[]).is_empty()); } + +/// A save notes the `.ai` options its file doesn't read as an export does: a PDF-compatible file +/// doesn't read the legacy file's options or `preserveEditing`, and a legacy file reads its own +/// options only. The notes cover the options beside the path and in `options`. +#[test] +fn a_save_notes_the_ai_options_its_file_does_not_read() { + let (mut s, notes) = (with_art(), unused); + let r = s + .execute("file.saveCopy", &json!({"format": "ai", "outlineText": true, "preserveEditing": false, "options": {"hiddenObjects": "omit"}})) + .unwrap(); + assert_eq!( + notes(&r), + [ + "`outlineText` was not used: PDF-compatible .ai files don't read it", + "`preserveEditing` was not used: PDF-compatible .ai files don't read it", + "`options.hiddenObjects` was not used: PDF-compatible .ai files don't read it" + ], + "{r}" + ); + let p = json!({"format": "ai", "aiVersion": "7", "compress": true, "marks": {"trim": true}, "options": {"pdfCompatible": false}}); + let r = s.execute("file.saveCopy", &p).unwrap(); + assert_eq!( + notes(&r), + [ + "`compress` was not used: legacy .ai (version 7) files don't read it", + "`marks` was not used: legacy .ai (version 7) files don't read it", + "`options.pdfCompatible` was not used: legacy .ai (version 7) files don't read it" + ], + "{r}" + ); + // The file's own options get none. + for p in [ + json!({"format": "ai", "aiVersion": "7", "outlineText": true, "options": {"hiddenObjects": "omit", "range": "1"}}), + json!({"format": "ai", "compress": true, "marks": {"trim": true}, "options": {"editingData": false}}), + json!({"format": "pdf", "marks": {"trim": true}, "preserveEditing": false}), + ] { + let r = s.execute("file.saveCopy", &p).unwrap(); + assert!(notes(&r).is_empty(), "{p}: {r}"); + } +} + +/// A save notes an option beside the path that only another save format takes, as it notes one in +/// `options`. +#[test] +fn a_save_notes_an_option_beside_the_path_that_only_another_save_format_takes() { + let (mut s, notes) = (with_art(), unused); + let r = s.execute("file.saveCopy", &json!({"format": "vectorcraft", "marks": {"trim": true}, "svg": {"minify": true}})).unwrap(); + assert_eq!(notes(&r), ["`marks` was not used: VectorCraft files don't read it", "`svg` was not used: VectorCraft files don't read it"], "{r}"); +} + +/// The `.ai` options a save's file doesn't read keep the values the document's last save in that +/// format gave them, so a save from Save Options, which sends only the options the file reads, +/// leaves the other version's choices as they were. +#[test] +fn a_save_keeps_the_ai_options_its_file_does_not_read_from_the_last_save() { + let mut s = with_art(); + let dir = tmp_dir("ai-kept"); + let path = dir.join("kept.ai").to_string_lossy().to_string(); + let value = |s: &mut Session, key: &str| s.execute("file.formatOptions", &json!({"format": "ai"})).unwrap()["options"][key]["value"].clone(); + s.execute("file.saveAs", &json!({"path": path, "format": "ai", "options": {"aiVersion": "7", "outlineText": true}})).unwrap(); + s.execute("file.saveAs", &json!({"path": path, "format": "ai", "options": {"aiVersion": "pdf", "editingData": false}})).unwrap(); + assert_eq!(value(&mut s, "outlineText"), json!(true)); + assert_eq!(value(&mut s, "editingData"), json!(false)); + s.execute("file.saveAs", &json!({"path": path, "format": "ai", "options": {"aiVersion": "7", "hiddenObjects": "omit"}})).unwrap(); + assert_eq!(value(&mut s, "editingData"), json!(false)); + // An option the request gives is the one saved. + s.execute("file.saveAs", &json!({"path": path, "format": "ai", "options": {"aiVersion": "7", "outlineText": false}})).unwrap(); + assert_eq!(value(&mut s, "outlineText"), json!(false)); + // The kept options are neither written nor sent again: a plain save's options (which a retry + // in another folder sends to Save As) hold only what the legacy file reads. + for p in [json!({}), json!({"options": {"aiVersion": "7"}})] { + let plan = save_plan(&s, SaveMode::Save, &p).unwrap(); + assert!(!plan.options.contains_key("editingData") && !plan.options.contains_key("compress"), "{:?}", plan.options); + assert_eq!(plan.kept.get("editingData"), Some(&json!(false))); + assert!(plan.notes.is_empty(), "{:?}", plan.notes); + let retry = json!({"path": path, "format": "ai", "options": plan.options}); + let r = s.execute("file.saveAs", &retry).unwrap(); + assert!(!r["warnings"].to_string().contains("was not used"), "{r}"); + assert_eq!(value(&mut s, "editingData"), json!(false)); + } + std::fs::remove_dir_all(&dir).unwrap(); +} + +/// The first `.ai` save of a document whose own file is another format remembers only the options +/// it was given: nothing from that format's options is kept. +#[test] +fn a_first_ai_save_keeps_only_the_options_it_is_given() { + let mut s = with_art(); + let dir = tmp_dir("ai-first"); + let native = dir.join("first.vectorcraft").to_string_lossy().to_string(); + let path = dir.join("first.ai").to_string_lossy().to_string(); + s.execute("file.saveAs", &json!({"path": native, "options": {"compress": false}})).unwrap(); + let plan = save_plan(&s, SaveMode::SaveAs, &json!({"path": path, "format": "ai", "options": {"aiVersion": "7"}})).unwrap(); + assert!(plan.kept.is_empty(), "{:?}", plan.kept); + s.execute("file.saveAs", &json!({"path": path, "format": "ai", "options": {"aiVersion": "7"}})).unwrap(); + let o = s.execute("file.formatOptions", &json!({"format": "ai"})).unwrap(); + assert_eq!(o["options"]["compress"]["value"], json!(true), "{o}"); + std::fs::remove_dir_all(&dir).unwrap(); +} diff --git a/crates/engine/src/cmd/fileio/tests_pdf.rs b/crates/engine/src/cmd/fileio/tests_pdf.rs index bd52fe71c7..f57e02fc2d 100644 --- a/crates/engine/src/cmd/fileio/tests_pdf.rs +++ b/crates/engine/src/cmd/fileio/tests_pdf.rs @@ -304,11 +304,22 @@ fn options_not_applied_yet_and_document_features_warn() { let frame = s.execute("shape.rectangle", &json!({"x": 20, "y": 20, "width": 50, "height": 40})).unwrap()["id"].as_u64().unwrap(); s.execute("paint.setStroke", &json!({"ids": [frame], "swatch": "Dots"})).unwrap(); assert_eq!(warnings(&export(&mut s, json!({}))).len(), 0); - // A knockout group is approximated: its warning comes back from every PDF path. + // A knockout group is written as a PDF knockout group: nothing to report. s.execute("select.set", &json!({"ids": [frame]})).unwrap(); s.execute("object.group", &json!({})).unwrap(); s.execute("transparency.set", &json!({"knockout": "on"})).unwrap(); let knockout = |w: Vec| w.iter().any(|w| w.contains("knockout groups")); + assert!(!knockout(warnings(&export(&mut s, json!({}))))); + // One whose soft masks would draw a brushed stroke is approximated: its warning comes back + // from every PDF path. + let rect = + |s: &mut Session, x: i32| s.execute("shape.rectangle", &json!({"x": x, "y": 45, "width": 40, "height": 30})).unwrap()["id"].as_u64().unwrap(); + let (lower, upper) = (rect(&mut s, 20), rect(&mut s, 40)); + s.execute("brush.apply", &json!({"ids": [upper], "name": "3 pt. Round"})).unwrap(); + s.execute("object.setProps", &json!({"ids": [lower, upper], "opacity": 50, "knockoutShape": true})).unwrap(); + s.execute("select.set", &json!({"ids": [lower, upper]})).unwrap(); + s.execute("object.group", &json!({})).unwrap(); + s.execute("transparency.set", &json!({"knockout": "on"})).unwrap(); assert!(knockout(warnings(&export(&mut s, json!({}))))); assert!(knockout(warnings(&s.execute("document.export", &as_export(&json!({}))).unwrap()))); // Other formats have none. @@ -432,6 +443,17 @@ fn pdf_settings_summarise_changes_and_warnings() { s.execute("effect.apply", &json!({"effect": "stylize.dropShadow", "ids": [g]})).unwrap(); assert_eq!(s.execute("document.pdfSettings", &json!({"includeDocument": true})).unwrap()["warnings"], json!([])); s.execute("transparency.set", &json!({"knockout": "on"})).unwrap(); + // A knockout group is written as a PDF knockout group: nothing to report. + assert_eq!(s.execute("document.pdfSettings", &json!({"includeDocument": true})).unwrap()["warnings"], json!([])); + // One whose soft masks would draw a brushed stroke is approximated. + let rect = + |s: &mut Session, x: i32| s.execute("shape.rectangle", &json!({"x": x, "y": 45, "width": 40, "height": 30})).unwrap()["id"].as_u64().unwrap(); + let (lower, upper) = (rect(&mut s, 20), rect(&mut s, 40)); + s.execute("brush.apply", &json!({"ids": [upper], "name": "3 pt. Round"})).unwrap(); + s.execute("object.setProps", &json!({"ids": [lower, upper], "opacity": 50, "knockoutShape": true})).unwrap(); + s.execute("select.set", &json!({"ids": [lower, upper]})).unwrap(); + s.execute("object.group", &json!({})).unwrap(); + s.execute("transparency.set", &json!({"knockout": "on"})).unwrap(); assert_eq!(s.execute("document.pdfSettings", &json!({})).unwrap()["warnings"], json!([])); let full = s.execute("document.pdfSettings", &json!({"includeDocument": true})).unwrap(); assert!(warnings(&full).iter().any(|w| w.contains("knockout groups")), "{}", full["warnings"]); diff --git a/crates/engine/src/cmd/fileio/tests_screens.rs b/crates/engine/src/cmd/fileio/tests_screens.rs index 51954d8da3..1746be6c97 100644 --- a/crates/engine/src/cmd/fileio/tests_screens.rs +++ b/crates/engine/src/cmd/fileio/tests_screens.rs @@ -1163,3 +1163,93 @@ fn single_file_pdfs_hold_every_chosen_artboard() { assert_eq!(names(&r), ["Artboard-1.pdf", "Artboard-2.pdf"]); assert!(s.execute("document.exportForScreens", &json!({"pdfs": "both", "formats": [{"format": "pdf"}]})).is_err()); } + +/// The warnings of reply `r` that name an option the file doesn't read. +fn unused(r: &Value) -> Vec { + r["warnings"].as_array().unwrap().iter().filter_map(Value::as_str).filter(|w| w.contains("was not used")).map(str::to_string).collect() +} + +/// An option of a format row, or of a format's settings, that only another format reads is +/// accepted, and the reply's warnings name it as the request does, in the words of a save's note. +#[test] +fn a_row_option_only_another_format_reads_gets_a_note() { + let mut s = session(1); + let p = json!({ + "formats": [{"format": "png", "quality": 80}, {"format": "jpg", "quality": 80}, {"format": "ai", "aiVersion": "7", "compress": true}], + "settings": {"png": {"quality": 50, "interlaced": true}, "svg": {"interlaced": true}}, + }); + let r = export(&mut s, p); + assert_eq!( + unused(&r), + [ + "`formats[0].quality` was not used: PNG files don't read it", + "`formats[2].compress` was not used: legacy .ai (version 7) files don't read it", + "`settings.png.quality` was not used: PNG files don't read it", + "`settings.svg.interlaced` was not used: SVG files don't read it" + ], + "{r}" + ); + // A row's own keys, the keys every row takes and the artboard choices get none. + let p = json!({"formats": [ + {"format": "png", "scale": "2x", "suffix": "@2x", "folder": "x", "includeArtboardFill": false, "artboard": 0, "useArtboards": true}, + {"format": "pdf", "marks": {"trim": true}, "preset": "High Quality Print"}, + {"format": "vectorcraft", "compress": true, "range": "1"}, + ]}); + let r = export(&mut s, p); + assert!(unused(&r).is_empty(), "{r}"); + // A format's settings are read as each row of that format writes them: a row can name another + // `.ai` version than the settings do. + let r = export(&mut s, json!({"formats": [{"format": "ai", "aiVersion": "7"}], "settings": {"ai": {"marks": {"trim": true}}}})); + assert_eq!(unused(&r), ["`settings.ai.marks` was not used: legacy .ai (version 7) files don't read it"], "{r}"); + let r = export(&mut s, json!({"formats": [{"format": "ai", "aiVersion": "pdf"}], "settings": {"ai": {"aiVersion": "7", "compress": true}}})); + assert!(unused(&r).is_empty(), "{r}"); + // A setting another row of the format reads gets none; one no row reads names the first row's + // file. + let rows = json!([{"format": "ai", "aiVersion": "7"}, {"format": "ai"}]); + let r = export(&mut s, json!({"formats": rows, "settings": {"ai": {"editingData": false}}})); + assert!(unused(&r).is_empty(), "{r}"); + let r = export(&mut s, json!({"formats": rows, "settings": {"ai": {"quality": 80}}})); + assert_eq!(unused(&r), ["`settings.ai.quality` was not used: legacy .ai (version 7) files don't read it"], "{r}"); + // A row that gives the key itself doesn't use the setting. + let rows = json!([{"format": "ai", "aiVersion": "7"}, {"format": "ai", "editingData": true}]); + let r = export(&mut s, json!({"formats": rows, "settings": {"ai": {"editingData": false}}})); + assert_eq!(unused(&r), ["`settings.ai.editingData` was not used: legacy .ai (version 7) files don't read it"], "{r}"); + let rows = json!([{"format": "ai", "aiVersion": "7"}, {"format": "ai", "editingData": null}]); + let r = export(&mut s, json!({"formats": rows, "settings": {"ai": {"editingData": false}}})); + assert_eq!(unused(&r), ["`settings.ai.editingData` was not used: legacy .ai (version 7) files don't read it"], "{r}"); + // An export writes one file per row and item: a native row doesn't read `separateArtboards`. + let r = export(&mut s, json!({"formats": [{"format": "vectorcraft", "separateArtboards": true}]})); + assert_eq!(unused(&r), ["`formats[0].separateArtboards` was not used: VectorCraft files don't read it"], "{r}"); +} + +/// The Asset Export panel's export notes the options of its request, not those of the settings +/// the document remembers. +#[test] +fn an_asset_export_notes_the_options_it_is_given() { + let mut s = session(1); + s.execute("select.all", &json!({})).unwrap(); + s.execute("assets.add", &json!({"multiple": false})).unwrap(); + s.execute("assets.settings.set", &json!({"formats": [{"format": "png", "quality": 80}]})).unwrap(); + let r = s.execute("assets.export", &json!({})).unwrap(); + assert!(unused(&r).is_empty(), "{r}"); + let r = s.execute("assets.export", &json!({"formats": [{"format": "svg", "quality": 80}]})).unwrap(); + assert_eq!(unused(&r), ["`formats[0].quality` was not used: SVG files don't read it"], "{r}"); + // Settings given are read as the remembered rows write them. + s.execute("assets.settings.set", &json!({"formats": [{"format": "ai", "aiVersion": "7"}]})).unwrap(); + let r = s.execute("assets.export", &json!({"settings": {"ai": {"editingData": false}}})).unwrap(); + assert_eq!(unused(&r), ["`settings.ai.editingData` was not used: legacy .ai (version 7) files don't read it"], "{r}"); + s.execute("assets.settings.set", &json!({"formats": [{"format": "png", "quality": 80}]})).unwrap(); + // So does the export a client prepares. + let p = json!({"formats": [{"format": "svg", "quality": 80}]}); + let r = s.prepare_screen_export("assets.export", &p).unwrap().write(&mut |_: &str, _: &[u8]| Ok(())).unwrap(); + assert_eq!(unused(&r), ["`formats[0].quality` was not used: SVG files don't read it"], "{r}"); +} + +/// A preset's options add no notes: Export for Screens notes the options of its request. +#[test] +fn an_export_preset_adds_no_notes() { + let mut s = session(1); + s.execute("document.exportPresets.save", &json!({"name": "Mixed", "settings": {"formats": [{"format": "png", "quality": 80}]}})).unwrap(); + let r = export(&mut s, json!({"exportPreset": "Mixed"})); + assert!(unused(&r).is_empty(), "{r}"); +} diff --git a/crates/engine/src/cmd/flatten/analysis.rs b/crates/engine/src/cmd/flatten/analysis.rs index 0adb06132a..37adcf438d 100644 --- a/crates/engine/src/cmd/flatten/analysis.rs +++ b/crates/engine/src/cmd/flatten/analysis.rs @@ -184,15 +184,17 @@ impl Sets { /// boxes it overlaps, not every open one (many objects stacked in a column, sharing their /// horizontal extent, would otherwise compare every pair). An open box inside a later box of /// its group, ending no further right, is closed early, and a box inside an open box of its group, -/// ending no further right, isn't opened: whatever overlaps it overlaps that box. Fails only when -/// cancelled ([`vectorcraft_doc::cancel`]). +/// ending no further right, isn't opened: whatever overlaps it overlaps that box. An open box that +/// a later box of its group overlaps, starting lower and ending no further right or lower, keeps +/// only its part above the later box's top, so boxes staggered right and down each meet only the +/// one before. Fails only when cancelled ([`vectorcraft_doc::cancel`]). pub(super) fn overlapping(bounds: &[Option]) -> Result>, Cancelled> { Ok(sweep(bounds, None)?.groups()) } /// [`overlapping`]'s sweep. With `see_through`, two boxes are joined only when one of them is -/// see-through, and an open box is closed early, or a box isn't opened, only inside a see-through -/// box. The open +/// see-through, an open box is closed early, or a box isn't opened, only inside a see-through box, +/// and an open box is cut short only by a see-through box that is opened. The open /// see-through boxes and the open boxes without transparency are then in trees of their own, and /// a box without transparency meets only the see-through ones. fn sweep(bounds: &[Option], see_through: Option<&[bool]>) -> Result { @@ -285,12 +287,20 @@ fn sweep(bounds: &[Option], see_through: Option<&[bool]>) -> Result], joins: impl Fn(usize, usize) -> bool) -> Vec> { + let bounds: Vec> = bounds.iter().map(|b| b.filter(finite)).collect(); let n = bounds.len(); let mut group: Vec = (0..n).collect(); let hit = |a: &Rect, b: &Rect| a.x0 <= b.x1 && b.x0 <= a.x1 && a.y0 <= b.y1 && b.y0 <= a.y1; @@ -731,9 +743,9 @@ mod tests { ]; let see = [false, true, true, false]; let mut sets = sweep(&bounds, Some(&see)).unwrap(); - // The second box meets the first; the third meets the second; the fourth meets the second - // and the third. - assert_eq!(sets.meets, 4); + // The second box meets the first; the third meets the second, which keeps only its part + // above the third's top; the fourth meets the third. + assert_eq!(sets.meets, 3); assert_eq!(sets.groups(), vec![vec![0, 1, 2, 3]]); // Opaque boxes alone meet nothing. let mut sets = sweep(&bounds, Some(&[false; 4])).unwrap(); @@ -741,6 +753,86 @@ mod tests { assert_eq!(sets.groups().len(), 4); } + /// `n` boxes of one size, each a little right of and below the one before, all overlapping and + /// none inside another. + fn staggered(n: usize) -> Vec> { + let w = 2.0 * n as f64; + (0..n).map(|i| Some(Rect::new(i as f64, i as f64, w + i as f64, w + i as f64))).collect() + } + + /// Each box of a stagger right and down meets only the box before it, which keeps only its + /// part above the new box's top, not every box still open. + #[test] + fn staggered_boxes_meet_only_the_box_before() { + let n = 512; + let bounds = staggered(n); + let mut sets = sweep(&bounds, None).unwrap(); + assert_eq!(sets.meets, n - 1); + assert_eq!(sets.groups(), vec![(0..n).collect::>()]); + // See-through boxes do the same with transparency. + let mut sets = sweep(&bounds, Some(&vec![true; n])).unwrap(); + assert_eq!(sets.meets, n - 1); + assert_eq!(sets.groups(), vec![(0..n).collect::>()]); + } + + /// An open box keeps the part a later box would meet without meeting the box that cut it short: + /// a part lower than that box, a part further right, or any part when that box is opaque. + #[test] + fn a_box_is_cut_short_only_where_the_later_box_covers_it() { + let k = Rect::new(5.0, 5.0, 15.0, 15.0); + // Lower than `k`: the last box overlaps only the bottom of the first. + let lower = [Some(Rect::new(0.0, 0.0, 10.0, 20.0)), Some(k), Some(Rect::new(8.0, 17.0, 9.0, 25.0))]; + assert_eq!(overlapping(&lower).unwrap(), vec![vec![0, 1, 2]]); + // Further right than `k`: the last box starts right of it and overlaps the first. + let right = [Some(Rect::new(0.0, 0.0, 20.0, 10.0)), Some(k), Some(Rect::new(17.0, 7.0, 25.0, 9.0))]; + assert_eq!(overlapping(&right).unwrap(), vec![vec![0, 1, 2]]); + // An opaque `k` doesn't join the opaque last box, which joins the see-through first one. + let opaque = [Some(Rect::new(0.0, 0.0, 10.0, 10.0)), Some(k), Some(Rect::new(6.0, 8.0, 7.0, 20.0))]; + let mut sets = sweep(&opaque, Some(&[true, false, false])).unwrap(); + assert_eq!(sets.groups(), vec![vec![0, 1, 2]]); + // A see-through `k` held by a see-through box around it isn't opened and cuts nothing short. + let held = [Some(Rect::new(0.0, 2.0, 30.0, 30.0)), Some(Rect::new(1.0, 0.0, 10.0, 10.0)), Some(k), Some(Rect::new(6.0, 8.0, 7.0, 20.0))]; + let see = [true, false, true, false]; + let mut sets = sweep(&held, Some(&see)).unwrap(); + assert_eq!(sets.groups(), vec![vec![0, 1, 2, 3]]); + assert_eq!(sets.groups(), every_pair_joining(&held, |i, j| see[i] || see[j])); + } + + /// Staggers in all four directions, of mixed sizes (empty ones included) with gaps and shared + /// edges, in either order, with signed zeros and boxes that aren't finite, some see-through, + /// group as comparing every pair groups them. + #[test] + fn staggered_boxes_group_as_comparing_every_pair() { + let mut seed = 0x3c6e_f372_fe94_f82bu64; + let mut next = |m: f64| { + seed ^= seed << 13; + seed ^= seed >> 7; + seed ^= seed << 17; + (seed % 1000) as f64 / 1000.0 * m + }; + for round in 0..48 { + let n = 8 + round * 2; + let (sx, sy) = (if round % 2 == 0 { 1.0 } else { -1.0 }, if round / 2 % 2 == 0 { 1.0 } else { -1.0 }); + let mut bounds: Vec> = (0..n) + .map(|i| { + let step = next(4.0).floor(); + let (x, y) = (sx * (i as f64 * 2.0 + step), sy * (i as f64 * 2.0 + next(4.0).floor())); + let (w, h) = (next(8.0).floor() * 2.0, next(8.0).floor() * 2.0); + Some(Rect::new(x, y, x + w, y + h)) + }) + .collect(); + bounds[0] = Some(Rect::new(-0.0, -0.0, 0.0, 6.0)); + bounds[n / 2] = Some(Rect::new(0.0, sy * 6.0, f64::INFINITY, sy * 6.0 + 4.0)); + if round / 4 % 2 == 1 { + bounds.reverse(); + } + assert_eq!(overlapping(&bounds).unwrap(), every_pair(&bounds), "round {round}"); + let see: Vec = (0..n).map(|_| next(1.0) < 0.5).collect(); + let mut sets = sweep(&bounds, Some(&see)).unwrap(); + assert_eq!(sets.groups(), every_pair_joining(&bounds, |i, j| see[i] || see[j]), "round {round}, with transparency"); + } + } + /// An opaque box between a member and its group's top that paints over the member joins, and /// so on along a chain; one under the member stays, but for one within the fringe. #[test] diff --git a/crates/engine/src/cmd/freeform.rs b/crates/engine/src/cmd/freeform.rs index bdba729211..5f2a5e4070 100644 --- a/crates/engine/src/cmd/freeform.rs +++ b/crates/engine/src/cmd/freeform.rs @@ -19,7 +19,7 @@ pub fn specs() -> Vec { "Add Freeform Point", [], None, - "{at: [x,y] (document coordinates), color? (default: the gradient's colour there; #rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), opacity?: 0..1 (or 0..100), spread?: 0..1 (or 0..100 %; the radius of pure colour around the point, a fraction of half the object's larger side; default 0), line?: true (join it to the selected point: extends the line ending there, else starts one), ids?|id?, stroke?: bool (default: the targeted item's kind, else the active proxy), item?: fill/stroke item index|null (omitted: the Appearance panel's active item when it is of the edited kind), target?: \"object\"|\"contents\"} add a point to the freeform gradient (an unplaced one keeps its automatic points first) and select it. On a path directly in a graph series, the graph also stores the edited gradient when it is on the topmost visible fill or stroke, as for the other paint.freeform edits (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind → {index}", + "{at: [x,y] (document coordinates), color? (default: the gradient's colour there; #rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill), opacity?: 0..1 (or 0..100), spread?: 0..1 (or 0..100 %; the radius of pure colour around the point, a fraction of half the object's larger side; default 0), line?: true (join it to the selected point: extends the line ending there, else starts one), ids?|id?, stroke?: bool (default: the targeted item's kind, else the active proxy), item?: fill/stroke item index|null (omitted: the Appearance panel's active item when it is of the edited kind), target?: \"object\"|\"contents\"} add a point to the freeform gradient (an unplaced one keeps its automatic points first) and select it. On a path directly in a graph series, the graph also stores the edited gradient when it is on the topmost visible fill or stroke, as for the other paint.freeform edits (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind; the points on a label's characters are not stored → {index}", has_doc, add_point ), diff --git a/crates/engine/src/cmd/gradient.rs b/crates/engine/src/cmd/gradient.rs index 54ca07da7e..2fee4186cc 100644 --- a/crates/engine/src/cmd/gradient.rs +++ b/crates/engine/src/cmd/gradient.rs @@ -24,7 +24,7 @@ pub fn specs() -> Vec { "Gradient", ["Window", "Gradient"], None, - "{stroke?: bool (default: the targeted item's kind, else the active proxy), kind?: linear|radial|conic|diamond|freeform (conic, also accepted as angle or conical, sweeps the stops once around the center, clockwise from the vector, with a seam where the last stop meets the first; diamond runs the stops from the center out to a square with a corner at the end of the vector; freeform places points on each object, coloured along the stops), mode?: points|lines (freeform: how the Gradient tool adds points), method?: classic|perceptual|hue-clockwise|hue-counterclockwise (how the colours between the stops mix: in display RGB, perceptually (OKLab) so the steps look even, or around the hue wheel: hue, saturation and brightness each change evenly from one stop to the next, the hue angle falling with hue-clockwise (red, magenta, blue, cyan, green, yellow) and rising with hue-counterclockwise; two stops whose hues are less than half a color level apart keep that hue; a stop whose RGB numbers are less than half a color level apart is gray and takes the hue of the stop it mixes with, and black that stop's saturation too; these two methods are VectorCraft's own, and SVG and PDF exports draw their gradients as RGB images, CMYK and spot color stops included; SVG exports draw a Perceptual gradient as an image, and PDF exports do too unless it is linear, radial, conic or diamond, has spot color stops, every other stop is paper white or written in CMYK or gray (an export that converts colors to a CMYK destination profile writes RGB and Lab stops in CMYK, and so does a CMYK document unless the export converts colors to an RGB destination profile), it is not a dithered fill and its curve does not have too many stops: then PDF writes tints of one spot ink as a Separation shading in that ink, and spot inks mixed with other spot, CMYK or gray inks as a DeviceN shading; freeform gradients mix their own way), spread?: pad|repeat|reflect (linear, radial, conic and diamond: what the gradient paints past the ends of its stops: pad carries the end colors on; repeat and reflect run the stops `repeats` times along the vector (around the circle, for a conic) and on past both ends, reflect mirroring every other run; an error on a freeform gradient), repeats?: 1..100 (a whole number: how many times repeat and reflect run the stops along the vector; VectorCraft's own limit; pad keeps it unused), stops?: [{offset 0..1, color? (needed without swatch; #rrggbbaa and #rgba are refused), opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: colour swatch name (a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour), tint?: 0..100 (% of the linked swatch; default 100, or a tint swatch's own)}] (at least 2; a freeform gradient's points are recoloured along them), keepModel?: bool (as paint.setFill; a stop color the gradient already has keeps its model), angle?: deg counter-clockwise (0: the gradient runs left to right; radial, conic and diamond: the vector turns about the center), aspect?: % (radial, conic and diamond; a negative one mirrors a conic's sweep and is an error for the other kinds), reverse?: bool (the same ramp the other way round: the stops in reverse order, and a hue method turned the other way unless `method` is given too), dither?: bool (fills only: a linear, radial, conic or diamond gradient fill is drawn with fine noise that hides banding, and as pixels in SVG and PDF exports), item?: fill/stroke item index|null (omitted: the Appearance panel's active item when it is of the edited kind), ids?|id?, strokeMode?: within|along|across (strokes only: the gradient lies on the page and shows through the stroke, runs from the start of each subpath to its end, or runs from the stroke's left edge to its right all along it; with nothing selected, for the next object drawn; type characters' own strokes always paint within), target?: \"object\"|\"contents\"} edit the gradient in place (keeps its placement); solid/none paints become the default gradient. On a path directly in a graph series, the graph also stores the gradient when it is on the topmost visible fill or stroke (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind", + "{stroke?: bool (default: the targeted item's kind, else the active proxy), kind?: linear|radial|conic|diamond|freeform (conic, also accepted as angle or conical, sweeps the stops once around the center, clockwise from the vector, with a seam where the last stop meets the first; diamond runs the stops from the center out to a square with a corner at the end of the vector; freeform places points on each object, coloured along the stops), mode?: points|lines (freeform: how the Gradient tool adds points), method?: classic|perceptual|hue-clockwise|hue-counterclockwise (how the colours between the stops mix: in display RGB, perceptually (OKLab) so the steps look even, or around the hue wheel: hue, saturation and brightness each change evenly from one stop to the next, the hue angle falling with hue-clockwise (red, magenta, blue, cyan, green, yellow) and rising with hue-counterclockwise; two stops whose hues are less than half a color level apart keep that hue; a stop whose RGB numbers are less than half a color level apart is gray and takes the hue of the stop it mixes with, and black that stop's saturation too; these two methods are VectorCraft's own, and SVG and PDF exports draw their gradients as RGB images, CMYK and spot color stops included; SVG exports draw a Perceptual gradient as an image, and PDF exports do too unless it is linear, radial, conic or diamond, has spot color stops, every other stop is paper white or written in CMYK or gray (an export that converts colors to a CMYK destination profile writes RGB and Lab stops in CMYK, and so does a CMYK document unless the export converts colors to an RGB destination profile), it is not a dithered fill and its curve does not have too many stops: then PDF writes tints of one spot ink as a Separation shading in that ink, and spot inks mixed with other spot, CMYK or gray inks as a DeviceN shading; freeform gradients mix their own way), spread?: pad|repeat|reflect (linear, radial, conic and diamond: what the gradient paints past the ends of its stops: pad carries the end colors on; repeat and reflect run the stops `repeats` times along the vector (around the circle, for a conic) and on past both ends, reflect mirroring every other run; an error on a freeform gradient), repeats?: 1..100 (a whole number: how many times repeat and reflect run the stops along the vector; VectorCraft's own limit; pad keeps it unused), stops?: [{offset 0..1, color? (needed without swatch; #rrggbbaa and #rgba are refused), opacity? 0..1 (or 0..100), midpoint? 0.13..0.87, swatch?: colour swatch name (a global or spot colour or tint swatch links the stop, so swatch edits recolour it and a spot stop prints on its plate; a process colour just gives its colour), tint?: 0..100 (% of the linked swatch; default 100, or a tint swatch's own)}] (at least 2; a freeform gradient's points are recoloured along them), keepModel?: bool (as paint.setFill; a stop color the gradient already has keeps its model), angle?: deg counter-clockwise (0: the gradient runs left to right; radial, conic and diamond: the vector turns about the center), aspect?: % (radial, conic and diamond; a negative one mirrors a conic's sweep and is an error for the other kinds), reverse?: bool (the same ramp the other way round: the stops in reverse order, and a hue method turned the other way unless `method` is given too), dither?: bool (fills only: a linear, radial, conic or diamond gradient fill is drawn with fine noise that hides banding, and as pixels in SVG and PDF exports), item?: fill/stroke item index|null (omitted: the Appearance panel's active item when it is of the edited kind), ids?|id?, strokeMode?: within|along|across (strokes only: the gradient lies on the page and shows through the stroke, runs from the start of each subpath to its end, or runs from the stroke's left edge to its right all along it; with nothing selected, for the next object drawn; type characters' own strokes always paint within), target?: \"object\"|\"contents\"} edit the gradient in place (keeps its placement); solid/none paints become the default gradient. On a path directly in a graph series, the graph also stores the gradient when it is on the topmost visible fill or stroke (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, and on its characters their gradient without its placement, fitted to each label", has_doc, edit_gradient ), @@ -33,7 +33,7 @@ pub fn specs() -> Vec { "Gradient Vector", [], None, - "{start?: [x,y], end?: [x,y] (document coordinates; both or neither: omitted, the vector stays), aspect?: % (radial, conic and diamond: the extent's height / width across the vector, a negative one mirroring a conic's sweep and an error for the other kinds; default: kept), focal?: [x,y] (document coordinates) | null (radial: the focal point, where the first stop sits, pulled inside the extent ellipse; null centres it; default: it keeps its place in the ellipse; an error on a conic or diamond gradient), ids?|id?, stroke?: bool (default: the targeted item's kind, else the active proxy), item?: fill/stroke item index|null (alias: index; omitted: the Appearance panel's active item when it is of the edited kind), target?: \"object\"|\"contents\", index?: appearance item index (as item)} set the gradient vector, aspect ratio and focal point (solid paints become the default gradient; type objects set it on their runs, in text space). On a path directly in a graph series, the graph also stores the gradient with its placement when it is on the topmost visible fill or stroke (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, with the gradient fitted to each label", + "{start?: [x,y], end?: [x,y] (document coordinates; both or neither: omitted, the vector stays), aspect?: % (radial, conic and diamond: the extent's height / width across the vector, a negative one mirroring a conic's sweep and an error for the other kinds; default: kept), focal?: [x,y] (document coordinates) | null (radial: the focal point, where the first stop sits, pulled inside the extent ellipse; null centres it; default: it keeps its place in the ellipse; an error on a conic or diamond gradient), ids?|id?, stroke?: bool (default: the targeted item's kind, else the active proxy), item?: fill/stroke item index|null (alias: index; omitted: the Appearance panel's active item when it is of the edited kind), target?: \"object\"|\"contents\", index?: appearance item index (as item)} set the gradient vector, aspect ratio and focal point (solid paints become the default gradient; type objects set it on their runs, in text space). On a path directly in a graph series, the graph also stores the gradient with its placement relative to the path's box when it is on the topmost visible fill or stroke, and every path of the series takes it at the same place on its own box (docs/mcp.md); on a graph label's row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, and on its characters their gradient without the placement this command sets, fitted to each label", has_doc, set_gradient_geom ), diff --git a/crates/engine/src/cmd/graph.rs b/crates/engine/src/cmd/graph.rs index 20332742bd..da23bd4f04 100644 --- a/crates/engine/src/cmd/graph.rs +++ b/crates/engine/src/cmd/graph.rs @@ -45,10 +45,10 @@ use generate::generate; #[cfg(test)] use series::default_series_color; pub(crate) use series::{ - LabelTextChange, capture_label_anti_alias, capture_label_object_opacity, capture_label_paragraphs, capture_label_rows, capture_label_styles, - capture_label_text, capture_series_object_opacity, capture_series_opacity, capture_series_top_paints, is_design_art, - label_object_opacity_differs, paint_targets, series_group_marks, series_group_marks_where, series_marks_in, series_object_opacity_differs, - shown_paint, + LabelTextChange, capture_label_anti_alias, capture_label_changes, capture_label_object_opacity, capture_label_paragraphs, capture_label_rows, + capture_label_styles, capture_label_text, capture_series_object_opacity, capture_series_opacity, capture_series_top_paints, is_design_art, + label_object_opacity_differs, labels_in, paint_targets, series_group_marks, series_group_marks_where, series_marks_in, + series_object_opacity_differs, shown_paint, }; #[cfg(test)] diff --git a/crates/engine/src/cmd/graph/generate.rs b/crates/engine/src/cmd/graph/generate.rs index a789304b24..fe8ffb98f8 100644 --- a/crates/engine/src/cmd/graph/generate.rs +++ b/crates/engine/src/cmd/graph/generate.rs @@ -6,7 +6,7 @@ use super::labels::{ recolour_text, runs, shadow_of, }; use super::markers::{MARKER_BUDGET, marker_cost, marker_designs}; -use super::series::{series_marks, with_series_opacity}; +use super::series::{picks_legend_fill, series_marks, with_series_gradients, with_series_opacity}; use super::{ Arc, BezPath, Color, Document, GraphKind, GraphSpec, Justify, Node, NodeKind, Paint, PathData, Point, Rect, TickLength, ValueAxisSide, shapes, }; @@ -397,8 +397,7 @@ impl<'a> Plot<'a> { let at = ring.centre + dir(mid) * (ring.hole + (ring.rad - ring.hole) * 0.62); let t = self.b.label(Role::Legend, Point::new(at.x, at.y + self.ls * 0.35), &label, Justify::Center, true); // White on a dark wedge, unless the legend labels were given a colour of their own. - let own_colour = self.g.label_styles.legend.as_ref().is_some_and(|st| st.fill != Paint::solid(Color::BLACK)); - self.wedge_labels.push(if dark && !own_colour { recolour_text(&t, Color::WHITE) } else { t }); + self.wedge_labels.push(if dark && picks_legend_fill(self.g) { recolour_text(&t, Color::WHITE) } else { t }); } /// The pie's category name. @@ -1006,7 +1005,7 @@ impl<'a> Plot<'a> { } } let name = g.series.get(s).cloned().filter(|n| !n.is_empty()).unwrap_or_else(|| format!("Series {}", s + 1)); - let grp = self.b.series(&name, s, with_series_opacity(g, s, items)); + let grp = self.b.series(&name, s, with_series_opacity(g, s, with_series_gradients(g, s, items))); self.b.out.push(grp); } self.b.out.append(&mut self.on_top); diff --git a/crates/engine/src/cmd/graph/series.rs b/crates/engine/src/cmd/graph/series.rs index 51a7ead550..b5acb1ba66 100644 --- a/crates/engine/src/cmd/graph/series.rs +++ b/crates/engine/src/cmd/graph/series.rs @@ -2,7 +2,7 @@ use vectorcraft_color::BlendMode; use super::axis::radar_axis; use super::labels::{Role, filled_lines_on, label_para, label_style}; -use super::{Arc, CharStyle, Color, Document, GraphKind, GraphSpec, HashMap, Node, NodeId, NodeKind, Paint, Result, Session, Value, bad}; +use super::{Arc, CharStyle, Color, Document, GraphKind, GraphSpec, HashMap, Node, NodeId, NodeKind, Paint, Rect, Result, Session, Value, bad}; // ---------- generation ---------- @@ -229,7 +229,8 @@ pub(crate) fn capture_series_top_paints(doc: &mut Document, edited: &[(NodeId, b continue; } let (paint, width) = shown_paint(node, *fill); - captures.push((r.graph, r.index, *fill, paint, (!*fill).then_some(width))); + let width = (!*fill).then_some(width); + captures.push((r.graph, r.index, *fill, paint, width, paint_box(node, width))); } store_series_paints(doc, captures) } @@ -281,11 +282,129 @@ fn settle_series_paints(doc: &mut Document, before: SeriesPaintsBefore) -> bool changed } -/// Store each capture (graph, series index, fill or stroke, paint, stroke weight) in its series. Returns whether a +/// The box a series keeps a gradient relative to: (0, 0)–(1, 1), as graphic styles keep theirs. +const UNIT_BOX: Rect = vectorcraft_doc::GraphicStyle::UNIT_BOX; + +/// The gradient `slot` keeps for its fill (`fill`) or stroke as the graph draws it on box `on`: one kept relative to the +/// unit box placed on `on`, also when `on` has no width or no height, and one kept in document coordinates as it is kept. +/// None when the slot keeps no gradient, or keeps one relative to the unit box and there is no box. +fn kept_on(slot: &vectorcraft_doc::SeriesPaint, fill: bool, on: Option) -> Option { + let (kept, unit) = if fill { (&slot.fill, slot.fill_unit_box) } else { (&slot.stroke, slot.stroke_unit_box) }; + let Some(Paint::Gradient(g)) = kept else { return None }; + if !unit { + return Some(Paint::Gradient(g.clone())); + } + let on = on?; + let mut g = g.clone(); + g.rebase(UNIT_BOX, on); + Some(Paint::Gradient(g)) +} + +/// Whether `a` and `b` are the same paint, a gradient's vector, focal point and freeform points each within 1e-6 pt (the +/// rounding a move or a placement on another box leaves). +fn same_paint_placed(a: &Paint, b: &Paint) -> bool { + let (Paint::Gradient(a), Paint::Gradient(b)) = (a, b) else { return a == b }; + let near = |p: vectorcraft_geom::Point, q: vectorcraft_geom::Point| (p - q).hypot() <= 1e-6; + let mut a = (**a).clone(); + match (&mut a.geom, &b.geom) { + (Some(ag), Some(bg)) => { + let focal = match (ag.focal, bg.focal) { + (Some(p), Some(q)) => near(p, q), + (p, q) => p.is_none() && q.is_none(), + }; + if !(near(ag.start, bg.start) && near(ag.end, bg.end) && focal) { + return false; + } + (ag.start, ag.end, ag.focal) = (bg.start, bg.end, bg.focal); + } + (None, None) => {} + _ => return false, + } + match (&mut a.freeform, &b.freeform) { + (Some(af), Some(bf)) => { + if af.points.len() != bf.points.len() || !af.points.iter().zip(&bf.points).all(|(p, q)| near(p.at, q.at)) { + return false; + } + for (p, q) in af.points.iter_mut().zip(&bf.points) { + p.at = q.at; + } + } + (None, None) => {} + _ => return false, + } + a == **b +} + +/// The box a gradient on `node`'s fill (`width` None) or on its stroke of `width` is placed on: the geometric bounds, grown +/// by half the weight for a stroke. The box can have no width or no height. +fn paint_box(node: &Node, width: Option) -> Option { + let b = node.geometric_bounds()?; + Some(width.map_or(b, |w| vectorcraft_doc::appearance::stroke_paint_bounds(b, w))) +} + +/// `paint` as a series keeps it: a gradient placed on `from` (the edited mark's [`paint_box`]) is moved to the same place +/// relative to [`UNIT_BOX`], so each mark takes it on its own box. A box with no width or no height, which a gradient's +/// place cannot be kept relative to, leaves the paint in document coordinates. Returns the paint and whether it was moved. +fn unit_box_paint(paint: Paint, from: Option) -> (Paint, bool) { + match (paint, from.filter(|b| b.width() > 1e-9 && b.height() > 1e-9)) { + (Paint::Gradient(mut g), Some(from)) => { + g.rebase(from, UNIT_BOX); + (Paint::Gradient(g), true) + } + (paint, _) => (paint, false), + } +} + +/// The paths directly inside series `i`'s group (`items`) with the series' kept gradients, which are kept relative to the +/// unit box, placed on each path's own box: a fill on its geometric bounds, a stroke on its stroke's box. Paints kept in +/// document coordinates (from files saved before the unit box) are left as they are. +pub(super) fn with_series_gradients(g: &GraphSpec, i: usize, mut items: Vec>) -> Vec> { + let Some(slot) = g.series_paints.get(i) else { return items }; + fn kept(p: &Option, unit: bool) -> Option<&Paint> { + p.as_ref().filter(|p| unit && matches!(p, Paint::Gradient(_))) + } + let (fill, stroke) = (kept(&slot.fill, slot.fill_unit_box), kept(&slot.stroke, slot.stroke_unit_box)); + if fill.is_none() && stroke.is_none() { + return items; + } + // A Filled Lines band takes the kept stroke as its fill when no fill is kept. + let band_fill = if slot.fill.is_none() { stroke } else { None }; + let fill_from_store = |p: &Paint| fill == Some(p) || band_fill == Some(p); + let stroke_from_store = |p: &Paint| stroke == Some(p); + for item in &mut items { + if !matches!(item.kind, NodeKind::Path { .. }) { + continue; + } + let Some(b) = item.geometric_bounds() else { continue }; + let ap = &item.appearance; + if !ap.fill().is_some_and(|f| fill_from_store(&f.paint)) && !ap.stroke().is_some_and(|st| stroke_from_store(&st.paint)) { + continue; + } + let ap = &mut Arc::make_mut(item).appearance; + if let Some(f) = ap.fill_mut().filter(|f| fill_from_store(&f.paint)) + && let Paint::Gradient(gp) = &mut f.paint + { + gp.rebase(UNIT_BOX, b); + } + if let Some(st) = ap.stroke_mut().filter(|st| stroke_from_store(&st.paint)) { + let to = st.paint_bounds(b); + if let Paint::Gradient(gp) = &mut st.paint { + gp.rebase(UNIT_BOX, to); + } + } + } + items +} + +/// A paint taken from a series mark: graph, series index, fill or stroke, paint, stroke weight and the mark's +/// [`paint_box`]. +type Capture = (NodeId, usize, bool, Paint, Option, Option); + +/// Store each capture in its series; a gradient is kept relative to the unit box ([`unit_box_paint`]). Returns whether a /// series' captured fill or stroke differs from what the graph stored before the first capture. -fn store_series_paints(doc: &mut Document, captures: Vec<(NodeId, usize, bool, Paint, Option)>) -> bool { +fn store_series_paints(doc: &mut Document, captures: Vec) -> bool { let mut before = SeriesPaintsBefore::new(); - for (graph, index, fill, paint, width) in captures { + for (graph, index, fill, paint, width, from) in captures { let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { continue }; before.entry(graph).or_insert_with(|| spec.series_paints.clone()); // `index` is below the graph's series count (`series_members`). @@ -293,10 +412,17 @@ fn store_series_paints(doc: &mut Document, captures: Vec<(NodeId, usize, bool, P spec.series_paints.resize(index + 1, vectorcraft_doc::SeriesPaint::default()); } let Some(slot) = spec.series_paints.get_mut(index) else { continue }; + // A mark that shows the kept gradient as it was drawn leaves the kept gradient as it is. + let drawn = kept_on(slot, fill, from).is_some_and(|kept| same_paint_placed(&kept, &paint)); + let (paint, unit) = unit_box_paint(paint, from); if fill { - slot.fill = Some(paint); + if !drawn { + (slot.fill, slot.fill_unit_box) = (Some(paint), unit); + } } else { - slot.stroke = Some(paint); + if !drawn { + (slot.stroke, slot.stroke_unit_box) = (Some(paint), unit); + } slot.stroke_width = width; } } @@ -500,20 +626,27 @@ pub(crate) fn capture_label_anti_alias(doc: &mut Document, ids: &[NodeId], metho pub(crate) fn capture_label_styles(doc: &mut Document, ids: &[NodeId], change: &dyn Fn(&mut CharStyle)) -> bool { let mut changed = false; for (graph, role) in label_kinds(doc, ids) { - let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { continue }; - let mut style = label_style(&spec.label_styles, role); - change(&mut style); - let slot = match role { - Role::Value => &mut spec.label_styles.values, - Role::Category => &mut spec.label_styles.categories, - Role::Legend => &mut spec.label_styles.legend, - }; - changed |= slot.as_ref() != Some(&style); - *slot = Some(style); + changed |= store_label_style(doc, graph, role, change); } changed } +/// Apply `change` to the style graph `graph` keeps for its labels of kind `role` (or the default one). Returns whether +/// the kept style changed. +fn store_label_style(doc: &mut Document, graph: NodeId, role: Role, change: &dyn Fn(&mut CharStyle)) -> bool { + let Some(spec) = doc.node_mut(graph).and_then(|n| n.extras_if_any().and_then(|e| e.graph.as_deref_mut())) else { return false }; + let mut style = label_style(&spec.label_styles, role); + change(&mut style); + let slot = match role { + Role::Value => &mut spec.label_styles.values, + Role::Category => &mut spec.label_styles.categories, + Role::Legend => &mut spec.label_styles.legend, + }; + let changed = slot.as_ref() != Some(&style); + *slot = Some(style); + changed +} + /// Keep a paragraph change made to all of the text of graph labels `ids` (Paragraph, on the whole graph or on labels /// picked with Group Selection) for every label of their kind, as [`capture_label_styles`] does for character /// formats. Returns whether kept attributes changed, or the error `change` returns for the kept attributes. @@ -681,6 +814,144 @@ pub(crate) fn capture_label_text( Ok(changed) } +/// The character fill and stroke attributes a kind of graph label keeps when a recolor, or a stroke or gradient edit +/// aimed at the characters, changes them on its labels ([`capture_label_changes`]). Each entry copies one attribute +/// from the first style to the second and returns whether they differed. +const RUN_PAINT: [fn(&CharStyle, &mut CharStyle) -> bool; 8] = [ + |a, b| keep(&a.fill, &mut b.fill), + |a, b| keep(&a.stroke, &mut b.stroke), + |a, b| keep(&a.stroke_width, &mut b.stroke_width), + |a, b| keep(&a.stroke_cap, &mut b.stroke_cap), + |a, b| keep(&a.stroke_join, &mut b.stroke_join), + |a, b| keep(&a.stroke_miter_limit, &mut b.stroke_miter_limit), + |a, b| keep(&a.stroke_dash, &mut b.stroke_dash), + |a, b| keep(&a.stroke_align, &mut b.stroke_align), +]; + +/// Copy `from` to `to`. Returns whether they differed. +fn keep(from: &T, to: &mut T) -> bool { + let differs = from != to; + if differs { + to.clone_from(from); + } + differs +} + +/// The [`RUN_PAINT`] attributes an edit changed on the characters of graph label `now` (`was`: the label before the +/// edit), as the label's style and the indexes of the changed entries. An attribute counts only when every character +/// of the label shows it alike, and the fill only when `fill` is set. A placed gradient is kept without its placement, +/// so it fits each label it lands on. The stroke weight and dashes are kept as the label shows them: the graph draws its +/// labels again without the label's own scale. +fn run_paint_change(was: &Node, now: &Node, fill: bool) -> Option<(CharStyle, Vec)> { + let (NodeKind::Text(was), NodeKind::Text(now)) = (&was.kind, &now.kind) else { return None }; + let first_now = &now.runs.first()?.style; + // Changed: some character showed something else before the edit, whichever run it is in. + let changed: Vec = RUN_PAINT + .iter() + .enumerate() + .filter(|(i, copy)| { + (fill || *i != 0) + && now.runs.iter().all(|r| !copy(first_now, &mut r.style.clone())) + && was.runs.iter().any(|r| copy(first_now, &mut r.style.clone())) + }) + .map(|(i, _)| i) + .collect(); + if changed.is_empty() { + return None; + } + let unplaced = crate::cmd::gradient::unplaced; + let mut style = first_now.clone(); + (style.fill, style.stroke) = (unplaced(&style.fill), unplaced(&style.stroke)); + // Character strokes are drawn in text space, scaled by the type's transform. + if let Some(k) = vectorcraft_doc::Scaling::factor(now.xf).filter(|k| k.is_finite() && *k > 1e-12) { + let mut st = style.stroke_layer(); + crate::inspect::scale_layer(&mut st, k); + style.set_stroke_layer(&st); + } + Some((style, changed)) +} + +/// Does graph `g` pick the fill of its legend labels itself, white on a dark wedge and black on the others: a pie with +/// Legends in Wedges whose legend labels keep no fill of their own? +pub(super) fn picks_legend_fill(g: &GraphSpec) -> bool { + g.kind == GraphKind::Pie + && g.legend + && g.pie_legend_in_wedges + && !g.label_styles.legend.as_ref().is_some_and(|st| st.fill != Paint::solid(Color::BLACK)) +} + +/// The graph labels among `roots` and inside them, for an edit that reaches graph labels without naming them. +pub(crate) fn labels_in(doc: &Document, roots: &[NodeId]) -> Vec { + let mut texts = Vec::new(); + for id in roots { + let Some(root) = doc.node(*id) else { continue }; + root.walk(&mut |n| { + if matches!(n.kind, NodeKind::Text(_)) { + texts.push(n.id); + } + }); + } + // Graph labels are type: without type among `roots`, the graph's labels are not looked up. + if texts.is_empty() { + return texts; + } + let labels = graph_labels(doc); + texts.retain(|id| labels.contains_key(id)); + // Nested roots (a graph and one of its labels) reach a label twice. + texts.sort_unstable(); + texts.dedup(); + texts +} + +/// Keep for every label of their kind what an edit changed on graph labels `ids` (`before`: the document before the +/// edit): with `rows`, the object rows ([`capture_label_rows`]) of the labels whose rows changed, and the character fill +/// and stroke attributes ([`RUN_PAINT`]) that changed on all of a label's characters, on the kind's kept style. The +/// frontmost label of a kind sets what that kind keeps, whatever order `ids` are in. On a graph that colors its legend +/// labels itself ([`picks_legend_fill`]), their fill is kept only when the legend labels among `ids` end up with one +/// fill. Called inside the same edit, so they undo together. Returns whether what a graph keeps changed. +pub(crate) fn capture_label_changes(before: &Document, doc: &mut Document, ids: &[NodeId], rows: bool) -> bool { + if !ids.iter().any(|id| doc.node(*id).is_some_and(|n| matches!(n.kind, NodeKind::Text(_)))) { + return false; + } + let labels = graph_labels(doc); + let mut picked: Vec = ids.iter().copied().filter(|id| labels.contains_key(id)).collect(); + // A later label's capture replaces an earlier one's: take them in paint order, each once. + picked.sort_by_cached_key(|id| doc.index_path(*id)); + picked.dedup(); + let picks_fill = |graph: NodeId| doc.node(graph).and_then(|n| n.extras().graph.as_deref()).is_some_and(picks_legend_fill); + // On a pie that colors its legend labels black or white by their wedge, a recolor of the whole pie flips them both + // ways: their fill is kept only when every legend label the edit reached ends up with the same one. + let mut wedge_fills: HashMap> = HashMap::new(); + for id in &picked { + let (Some(&(graph, Role::Legend)), Some(NodeKind::Text(t))) = (labels.get(id), doc.node(*id).map(|n| &n.kind)) else { continue }; + if picks_fill(graph) { + wedge_fills.entry(graph).or_default().extend(t.runs.iter().map(|r| r.style.fill.clone())); + } + } + let one_fill = |graph: NodeId| wedge_fills.get(&graph).is_none_or(|f| f.windows(2).all(|w| w[0] == w[1])); + let mut changed_rows = Vec::new(); + let mut characters = Vec::new(); + for (id, kind) in picked.iter().filter_map(|id| Some((*id, *labels.get(id)?))) { + let (Some(was), Some(now)) = (before.node(id), doc.node(id)) else { continue }; + if rows && label_rows(was) != label_rows(now) { + changed_rows.push(id); + } + let fill = kind.1 != Role::Legend || one_fill(kind.0); + characters.extend(run_paint_change(was, now, fill).map(|change| (kind, change))); + } + let mut changed = capture_label_rows(doc, &changed_rows); + for ((graph, role), (style, entries)) in &characters { + changed |= store_label_style(doc, *graph, *role, &|st| { + for i in entries { + if let Some(copy) = RUN_PAINT.get(*i) { + copy(style, st); + } + } + }); + } + changed +} + /// The graphs and kinds of label among `ids`, each once. fn label_kinds(doc: &Document, ids: &[NodeId]) -> Vec<(NodeId, Role)> { if ids.is_empty() { diff --git a/crates/engine/src/cmd/graph/tests.rs b/crates/engine/src/cmd/graph/tests.rs index c997e803d5..0a788c4330 100644 --- a/crates/engine/src/cmd/graph/tests.rs +++ b/crates/engine/src/cmd/graph/tests.rs @@ -508,6 +508,89 @@ fn paint_targets_leave_a_graph_designs_copy_out() { assert_eq!(super::paint_targets(d, &[copy, art, mark]), [mark]); } +/// The art of a marker design in series 1 of a line graph: the design's copy and a path inside it. +fn marker_design_art() -> (Session, NodeId, NodeId) { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + save_design(&mut s, "Pill"); + let id = graph(&mut s, "line"); + s.execute("graph.marker", &json!({"id": id.0, "seriesIndexes": [1], "design": "Pill"})).unwrap(); + let marker = series(s.doc().unwrap().doc.node(id).unwrap(), 1).children().unwrap()[1].clone(); + assert!(matches!(marker.kind, NodeKind::Group { .. }), "the design's art"); + let mut art = vec![]; + marker.walk(&mut |m| { + if matches!(m.kind, NodeKind::Path { .. }) { + art.push(m.id); + } + }); + (s, marker.id, art[0]) +} + +/// The ids `graphicStyle.list` reports as linked to style `name`. +fn linked_to(s: &mut Session, name: &str) -> Vec { + let list = s.execute("graphicStyle.list", &json!({})).unwrap(); + let style = list["styles"].as_array().unwrap().iter().find(|g| g["name"] == name).unwrap().clone(); + let mut ids: Vec = style["linked"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + ids.sort_unstable(); + ids +} + +/// Graphic styles and the art of a column or marker design in a series (the design's copy and a path inside it): +/// `graphicStyle.new` makes a style from the art without linking it; `graphicStyle.redefine` leaves the art's look as +/// it was and unlinks it, whether the art is linked (as in a document saved before) or the source, while the other +/// linked objects follow the new look. +#[test] +fn graphic_styles_leave_a_graph_designs_art_unlinked() { + let make = |marker: bool| { + if marker { + marker_design_art() + } else { + let (s, _, copy, art, _) = design_art(); + (s, copy, art) + } + }; + let rows = |s: &Session, id: NodeId| s.doc().unwrap().doc.node(id).unwrap().appearance.clone(); + let link = |s: &Session, id: NodeId| s.doc().unwrap().doc.node(id).unwrap().extras().graphic_style; + let link_directly = |s: &mut Session, ids: &[NodeId], style: u32| { + let d = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + for id in ids { + d.node_mut(*id).unwrap().extras_mut().graphic_style = Some(style); + } + }; + let rect = |s: &mut Session| { + NodeId(s.execute("shape.rectangle", &json!({"x": 700, "y": 700, "width": 10, "height": 10})).unwrap()["id"].as_u64().unwrap()) + }; + for marker in [false, true] { + for source in [0, 1] { + let at = format!("marker {marker}, source {source}"); + // New: the style is made from the art, which stays unlinked. + let (mut s, copy, art) = make(marker); + let source = [copy, art][source]; + s.execute("graphicStyle.new", &json!({"id": source.0, "name": "Art"})).unwrap(); + assert_eq!(link(&s, source), None, "{at}"); + assert_eq!(linked_to(&mut s, "Art"), Vec::::new(), "{at}"); + // Redefine from another object: linked art keeps its look and is unlinked; a linked rectangle follows. + let follower = rect(&mut s); + s.execute("graphicStyle.apply", &json!({"name": "Art", "ids": [follower.0]})).unwrap(); + let style = link(&s, follower).unwrap(); + link_directly(&mut s, &[copy, art], style); + let (copy_was, art_was) = (rows(&s, copy), rows(&s, art)); + let (blue_rect, blue) = blue_style(&mut s, "Blue", false); + s.execute("graphicStyle.redefine", &json!({"name": "Art", "id": blue_rect.0})).unwrap(); + assert_eq!((rows(&s, copy), rows(&s, art)), (copy_was.clone(), art_was.clone()), "{at}"); + assert_eq!((link(&s, copy), link(&s, art)), (None, None), "{at}"); + assert_eq!(rows(&s, follower).fill_paint(), blue, "{at}"); + assert_eq!(linked_to(&mut s, "Art"), [follower.0.min(blue_rect.0), follower.0.max(blue_rect.0)], "{at}"); + // Redefine from the art itself: the art is unlinked and the linked rectangle takes the art's look. + link_directly(&mut s, &[copy, art], style); + s.execute("graphicStyle.redefine", &json!({"name": "Art", "id": source.0})).unwrap(); + assert_eq!((rows(&s, copy), rows(&s, art)), (copy_was, art_was), "{at}"); + assert_eq!((link(&s, copy), link(&s, art)), (None, None), "{at}"); + assert_eq!(linked_to(&mut s, "Art"), [follower.0.min(blue_rect.0), follower.0.max(blue_rect.0)], "{at}"); + } + } +} + /// The art of a marker design in a series is refused too. #[test] fn effect_commands_refuse_a_marker_designs_art() { @@ -2754,10 +2837,39 @@ fn a_gradient_edit_on_a_series_mark_is_kept() { series_0_is(&mut s, id, (&fill, 0.4, &red, 2.0), &was); } -/// A gradient placed on a series mark's fill with `paint.setGradientGeom` is stored on the graph as it is placed, and -/// every mark of the series has that fill, placement included, after the graph is drawn again. +/// Where gradient `paint` sits on box `b`: its vector's start and end, then each freeform point, as fractions of the box. +fn gradient_place(paint: &Paint, b: vectorcraft_geom::Rect) -> Vec { + let Paint::Gradient(g) = paint else { panic!("not a gradient: {paint:?}") }; + let points = g.geom.iter().flat_map(|geom| [geom.start, geom.end]).chain(g.freeform.iter().flat_map(|f| f.points.iter().map(|p| p.at))); + points.flat_map(|p| [(p.x - b.x0) / b.width(), (p.y - b.y0) / b.height()]).collect() +} + +/// The box a gradient on `mark`'s fill (`stroke` false) or stroke is placed on. +fn paint_box_of(mark: &vectorcraft_doc::Node, stroke: bool) -> vectorcraft_geom::Rect { + let b = mark.geometric_bounds().unwrap(); + if stroke { vectorcraft_doc::appearance::stroke_paint_bounds(b, mark.appearance.stroke_width()) } else { b } +} + +/// The fill (`stroke` false) or stroke of every path of series 0, the legend swatch included, has a gradient at `place` on +/// its own box, and the gradients are not all at one place in the document. Returns how many paths were checked. +fn series_0_gradients_at(s: &Session, id: NodeId, stroke: bool, place: &[f64]) -> usize { + let n = s.doc().unwrap().doc.node(id).unwrap().clone(); + let paths: Vec<_> = series(&n, 0).children().unwrap().iter().filter(|m| matches!(m.kind, NodeKind::Path { .. })).cloned().collect(); + let paints: Vec = paths.iter().map(|m| if stroke { m.appearance.stroke_paint() } else { m.appearance.fill_paint() }).collect(); + for (m, paint) in paths.iter().zip(&paints) { + let at = gradient_place(paint, paint_box_of(m, stroke)); + assert_eq!(at.len(), place.len(), "{at:?}"); + assert!(at.iter().zip(place).all(|(a, b)| (a - b).abs() < 1e-9), "{at:?} is not {place:?}"); + } + assert!(paints.windows(2).any(|w| w[0] != w[1]), "every mark has the gradient at one place: {paints:?}"); + paths.len() +} + +/// A gradient placed on a series mark's fill with `paint.setGradientGeom` is stored relative to the mark's box, and every +/// mark of the series has it at the same place on its own box after the graph is drawn again, also after a data change +/// moves and resizes the marks and after the graph is moved. #[test] -fn a_gradient_placed_on_a_series_mark_is_kept_with_its_placement() { +fn a_gradient_placed_on_a_series_mark_takes_the_same_place_on_every_mark() { let (mut s, id, _, marks) = column_marks(); // `paint.setFill` stores the gradient before it is placed. s.execute("paint.setFill", &json!({"ids": [marks[0].0], "gradient": {"kind": "linear"}})).unwrap(); @@ -2766,26 +2878,258 @@ fn a_gradient_placed_on_a_series_mark_is_kept_with_its_placement() { s.execute("paint.setGradientGeom", &json!({"ids": [marks[0].0], "start": [0, 0], "end": [10, 40]})).unwrap(); let placed = fill_of(&s, marks[0]); assert_ne!(placed, fill, "the command places the gradient"); - assert_eq!(spec(&s, id).series_paints[0].fill, Some(placed.clone())); - s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4]]})).unwrap(); - assert!(marks_of(&s, id, 0).iter().all(|m| m.0 == placed), "{:?}", marks_of(&s, id, 0)); + let mark = s.doc().unwrap().doc.node(marks[0]).unwrap().clone(); + let place = gradient_place(&placed, paint_box_of(&mark, false)); + let kept = spec(&s, id).series_paints[0].clone(); + assert!(kept.fill_unit_box); + assert_eq!(gradient_place(kept.fill.as_ref().unwrap(), vectorcraft_doc::GraphicStyle::UNIT_BOX), place); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4], [6, 1]]})).unwrap(); + assert!(series_0_gradients_at(&s, id, false, &place) >= 4); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + s.execute("object.move", &json!({"dx": 50, "dy": 30})).unwrap(); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[2, 2], [5, 4], [1, 1]]})).unwrap(); + series_0_gradients_at(&s, id, false, &place); } -/// A point recolored with `paint.freeform.setPoint` in a freeform gradient on a series mark's fill is stored on the graph. +/// A gradient placed on a series mark's stroke is kept relative to the mark's stroke box, and every mark of the series has +/// it at the same place on its own stroke box after the graph is drawn again. +#[test] +fn a_gradient_placed_on_a_series_marks_stroke_takes_the_same_place_on_every_mark() { + let (mut s, id, _, marks) = column_marks(); + s.execute("paint.setStroke", &json!({"ids": [marks[1].0], "gradient": {"kind": "radial"}})).unwrap(); + s.execute("stroke.set", &json!({"ids": [marks[1].0], "weight": 4})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [marks[1].0], "stroke": true, "start": [150, 200], "end": [170, 260]})).unwrap(); + let mark = s.doc().unwrap().doc.node(marks[1]).unwrap().clone(); + let place = gradient_place(&mark.appearance.stroke_paint(), paint_box_of(&mark, true)); + assert!(spec(&s, id).series_paints[0].stroke_unit_box); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4], [6, 1]]})).unwrap(); + series_0_gradients_at(&s, id, true, &place); +} + +/// A placed gradient picked up with the Eyedropper from art outside the graph is kept relative to the series mark it is +/// dropped on, and every mark of the series has it at the same place on its own box. +#[test] +fn a_placed_gradient_dropped_on_a_series_mark_takes_the_same_place_on_every_mark() { + let (mut s, id, _, marks) = column_marks(); + let r = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [r.0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [r.0], "start": [610, 600], "end": [630, 620]})).unwrap(); + s.execute("appearance.copyFrom", &json!({"source": r.0, "ids": [marks[2].0]})).unwrap(); + let mark = s.doc().unwrap().doc.node(marks[2]).unwrap().clone(); + let place = gradient_place(&mark.appearance.fill_paint(), paint_box_of(&mark, false)); + assert!(spec(&s, id).series_paints[0].fill_unit_box); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4], [6, 1]]})).unwrap(); + series_0_gradients_at(&s, id, false, &place); +} + +/// A graphic style with a placed gradient applied to a series mark is kept relative to that mark's box, and every mark of +/// the series has the gradient at the same place on its own box. +#[test] +fn a_graphic_style_gradient_applied_to_a_series_mark_takes_the_same_place_on_every_mark() { + let (mut s, id, _, marks) = column_marks(); + let r = NodeId(s.execute("shape.rectangle", &json!({"x": 600, "y": 600, "width": 40, "height": 20})).unwrap()["id"].as_u64().unwrap()); + s.execute("paint.setFill", &json!({"ids": [r.0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [r.0], "start": [610, 600], "end": [630, 620]})).unwrap(); + s.execute("graphicStyle.new", &json!({"id": r.0, "name": "Placed"})).unwrap(); + s.execute("graphicStyle.apply", &json!({"name": "Placed", "ids": [marks[2].0]})).unwrap(); + let mark = s.doc().unwrap().doc.node(marks[2]).unwrap().clone(); + let place = gradient_place(&mark.appearance.fill_paint(), paint_box_of(&mark, false)); + assert!(spec(&s, id).series_paints[0].fill_unit_box); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4], [6, 1]]})).unwrap(); + series_0_gradients_at(&s, id, false, &place); +} + +/// A point recolored with `paint.freeform.setPoint` in a freeform gradient on a series mark's fill is stored on the graph, +/// and every mark of the series has the gradient's points at the same place on its own box after the graph is drawn again. #[test] fn a_freeform_gradient_edit_on_a_series_mark_is_kept() { let (mut s, id, _, marks) = column_marks(); let points = json!([{"at": [20, 20], "color": "#53aadf"}, {"at": [50, 50], "color": "#ff8000"}]); // `paint.setFill` stores the gradient before its point is recolored. s.execute("paint.setFill", &json!({"ids": [marks[0].0], "gradient": {"kind": "freeform", "freeform": {"points": points}}})).unwrap(); - let fill = fill_of(&s, marks[0]); - assert_eq!(spec(&s, id).series_paints[0].fill, Some(fill.clone())); s.execute("paint.freeform.setPoint", &json!({"ids": [marks[0].0], "index": 1, "color": "#00ff00"})).unwrap(); let edited = fill_of(&s, marks[0]); - assert_ne!(edited, fill, "the command recolors the point"); - assert_eq!(spec(&s, id).series_paints[0].fill, Some(edited.clone())); + let Paint::Gradient(g) = &edited else { panic!("{edited:?}") }; + assert_eq!(g.freeform.as_ref().unwrap().points[1].color.to_hex(), "#00ff00"); + let mark = s.doc().unwrap().doc.node(marks[0]).unwrap().clone(); + let place = gradient_place(&edited, paint_box_of(&mark, false)); + let kept = spec(&s, id).series_paints[0].clone(); + assert!(kept.fill_unit_box); + assert_eq!(gradient_place(kept.fill.as_ref().unwrap(), vectorcraft_doc::GraphicStyle::UNIT_BOX), place); s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4]]})).unwrap(); - assert!(marks_of(&s, id, 0).iter().all(|m| m.0 == edited), "{:?}", marks_of(&s, id, 0)); + series_0_gradients_at(&s, id, false, &place); +} + +/// A gradient a graph kept in document coordinates (a file saved before gradients were kept relative to the unit box) is +/// drawn on every mark as it was kept. +#[test] +fn a_gradient_kept_in_document_coordinates_is_drawn_as_kept() { + let (mut s, id, _, marks) = column_marks(); + s.execute("paint.setFill", &json!({"ids": [marks[0].0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [marks[0].0], "start": [0, 0], "end": [10, 40]})).unwrap(); + let placed = fill_of(&s, marks[0]); + s.edit("Kept in document coordinates", |d, _| { + let mut extras = d.node_mut(id).unwrap().extras_mut(); + let slot = &mut extras.graph.as_mut().unwrap().series_paints[0]; + (slot.fill, slot.fill_unit_box) = (Some(placed.clone()), false); + Ok(()) + }) + .unwrap(); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4]]})).unwrap(); + assert!(marks_of(&s, id, 0).iter().all(|m| m.0 == placed), "{:?}", marks_of(&s, id, 0)); + // The same gradient kept for the fill relative to the unit box leaves the stroke kept in document coordinates as it is. + s.edit("Kept fill and stroke", |d, _| { + let mut extras = d.node_mut(id).unwrap().extras_mut(); + let slot = &mut extras.graph.as_mut().unwrap().series_paints[0]; + (slot.fill, slot.fill_unit_box) = (Some(placed.clone()), true); + (slot.stroke, slot.stroke_unit_box, slot.stroke_width) = (Some(placed.clone()), false, Some(2.0)); + Ok(()) + }) + .unwrap(); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[2, 2], [3, 4]]})).unwrap(); + let drawn = marks_of(&s, id, 0); + assert!(drawn.iter().all(|m| m.1 == placed), "{drawn:?}"); + series_0_gradients_at(&s, id, false, &gradient_place(&placed, vectorcraft_doc::GraphicStyle::UNIT_BOX)); +} + +/// A gradient placed on a series path with no height (a flat line's fill) is kept in document coordinates, and every +/// path of the series that takes the kept fill has it at that place in the document. +#[test] +fn a_gradient_placed_on_a_series_path_with_no_height_is_kept_in_document_coordinates() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "line"); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[3, 2], [3, 4], [3, 6]]})).unwrap(); + let flat = |s: &Session| { + let parts = series_parts(s, id, 0); + parts.into_iter().find(|m| m.appearance.fill_paint().is_none() && m.geometric_bounds().is_some_and(|b| b.height() < 1e-9)).unwrap().id + }; + let line = flat(&s); + s.execute("paint.setFill", &json!({"ids": [line.0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [line.0], "start": [150, 120], "end": [300, 280]})).unwrap(); + let placed = fill_of(&s, line); + let kept = spec(&s, id).series_paints[0].clone(); + assert!(!kept.fill_unit_box); + assert_eq!(kept.fill, Some(placed.clone())); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[3, 1], [3, 5], [3, 2]]})).unwrap(); + let fills: Vec = series_parts(&s, id, 0).iter().map(|m| m.appearance.fill_paint()).filter(|p| matches!(p, Paint::Gradient(_))).collect(); + assert!(fills.len() >= 2 && fills.iter().all(|p| *p == placed), "{fills:?}"); +} + +/// Writing a series mark's stroke weight as it is, after the graph drew the mark's stroke from a gradient the series +/// keeps relative to the unit box, leaves the kept gradient, the document and its undo history as they are, on every mark. +#[test] +fn rewriting_a_series_marks_drawn_gradient_stroke_records_no_undo_step() { + let (mut s, id, _, marks) = column_marks(); + s.execute("paint.setStroke", &json!({"ids": [marks[1].0], "gradient": {"kind": "radial"}})).unwrap(); + s.execute("stroke.set", &json!({"ids": [marks[1].0], "weight": 4})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [marks[1].0], "stroke": true, "start": [150, 200], "end": [170, 260]})).unwrap(); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1.3, 2], [3.7, 4], [6.1, 1]]})).unwrap(); + let was = s.doc().unwrap().doc.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let drawn: Vec<_> = series_parts(&s, id, 0).into_iter().filter(|m| matches!(m.appearance.stroke_paint(), Paint::Gradient(_))).collect(); + assert!(drawn.len() >= 4, "{}", drawn.len()); + for mark in drawn { + let row = top_row(&s, mark.id, false); + s.execute("appearance.setItem", &json!({"ids": [mark.id.0], "index": row, "weight": mark.appearance.stroke_width()})).unwrap(); + assert!(s.doc().unwrap().doc == was, "writing mark {:?} changed the document", mark.id); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + } + // A mark moved with its gradient shows the kept gradient on its moved box, up to rounding. + let kept = spec(&s, id).series_paints[0].clone(); + for (i, mark) in series_parts(&s, id, 0).into_iter().filter(|m| matches!(m.appearance.stroke_paint(), Paint::Gradient(_))).enumerate() { + s.execute("select.set", &json!({"ids": [mark.id.0]})).unwrap(); + s.execute("object.move", &json!({"dx": 13.37 + i as f64 * 0.731, "dy": -7.19})).unwrap(); + let moved = s.doc().unwrap().doc.node(mark.id).unwrap().geometric_bounds().unwrap(); + assert!((moved.x0 - mark.geometric_bounds().unwrap().x0 - 13.37 - i as f64 * 0.731).abs() < 1e-9, "mark {:?} did not move", mark.id); + let undo = s.doc().unwrap().history.undo.len(); + let row = top_row(&s, mark.id, false); + s.execute("appearance.setItem", &json!({"ids": [mark.id.0], "index": row, "weight": mark.appearance.stroke_width()})).unwrap(); + assert_eq!(spec(&s, id).series_paints[0], kept, "writing moved mark {:?} changed the kept stroke", mark.id); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + } +} + +/// Writing the fill of a series mark with no height (a column for a value of 0) as it is, after the graph drew the mark's +/// fill from a gradient the series keeps relative to the unit box, leaves the kept gradient and its unit-box flag as they +/// are. +#[test] +fn rewriting_a_drawn_gradient_fill_on_a_series_mark_with_no_height_keeps_the_kept_gradient() { + let (mut s, id, _, marks) = column_marks(); + s.execute("paint.setFill", &json!({"ids": [marks[0].0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [marks[0].0], "start": [0, 0], "end": [10, 40]})).unwrap(); + let kept = spec(&s, id).series_paints[0].clone(); + assert!(kept.fill_unit_box); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[0, 2], [3, 4], [6, 1]]})).unwrap(); + let flat = series_parts(&s, id, 0) + .into_iter() + .find(|m| matches!(m.appearance.fill_paint(), Paint::Gradient(_)) && m.geometric_bounds().is_some_and(|b| b.height() < 1e-9)) + .unwrap() + .id; + let changed = s.edit("Write the fill as it is", |d, _| Ok(super::capture_series_top_paints(d, &[(flat, true)]))).unwrap(); + assert!(!changed); + assert_eq!(spec(&s, id).series_paints[0], kept); +} + +/// Writing a series mark's stroke weight as it is, after the graph drew the mark's stroke from a gradient the series keeps +/// in document coordinates (a file saved before the unit box), leaves the kept gradient and its unit-box flag as they are +/// and records no undo step. +#[test] +fn rewriting_a_series_marks_stroke_drawn_from_a_gradient_kept_in_document_coordinates_keeps_it() { + let (mut s, id, _, marks) = column_marks(); + s.execute("paint.setStroke", &json!({"ids": [marks[1].0], "gradient": {"kind": "radial"}})).unwrap(); + s.execute("stroke.set", &json!({"ids": [marks[1].0], "weight": 2})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [marks[1].0], "stroke": true, "start": [150, 200], "end": [170, 260]})).unwrap(); + let placed = s.doc().unwrap().doc.node(marks[1]).unwrap().appearance.stroke_paint(); + s.edit("Kept in document coordinates", |d, _| { + let mut extras = d.node_mut(id).unwrap().extras_mut(); + let slot = &mut extras.graph.as_mut().unwrap().series_paints[0]; + (slot.stroke, slot.stroke_unit_box, slot.stroke_width) = (Some(placed.clone()), false, Some(2.0)); + Ok(()) + }) + .unwrap(); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2], [3, 4], [6, 1]]})).unwrap(); + let kept = spec(&s, id).series_paints[0].clone(); + let undo = s.doc().unwrap().history.undo.len(); + let drawn: Vec<_> = series_parts(&s, id, 0).into_iter().filter(|m| m.appearance.stroke_paint() == placed).collect(); + assert!(drawn.len() >= 3, "{}", drawn.len()); + for mark in drawn { + let row = top_row(&s, mark.id, false); + s.execute("appearance.setItem", &json!({"ids": [mark.id.0], "index": row, "weight": mark.appearance.stroke_width()})).unwrap(); + assert_eq!(spec(&s, id).series_paints[0], kept, "writing mark {:?} changed the kept stroke", mark.id); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + } +} + +/// A gradient placed on a line series' stroke is kept relative to the line's stroke box, and with Draw Filled Lines the +/// band, which takes the kept stroke as its fill, has it at the same place on its own box. +#[test] +fn a_gradient_kept_for_a_lines_stroke_takes_the_same_place_on_its_filled_line() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "line"); + let line = series_parts(&s, id, 0).into_iter().find(|m| m.appearance.fill_paint().is_none()).unwrap().id; + s.execute("paint.setStroke", &json!({"ids": [line.0], "gradient": {"kind": "linear"}})).unwrap(); + s.execute("paint.setGradientGeom", &json!({"ids": [line.0], "stroke": true, "start": [150, 120], "end": [300, 280]})).unwrap(); + let kept = spec(&s, id).series_paints[0].clone(); + assert!(kept.stroke_unit_box && kept.fill.is_none()); + let place = gradient_place(kept.stroke.as_ref().unwrap(), vectorcraft_doc::GraphicStyle::UNIT_BOX); + s.execute("graph.setType", &json!({"id": id.0, "filledLines": true})).unwrap(); + let band = series_parts(&s, id, 0).into_iter().find(|m| matches!(m.appearance.fill_paint(), Paint::Gradient(_))).unwrap(); + let at = gradient_place(&band.appearance.fill_paint(), band.geometric_bounds().unwrap()); + assert!(at.iter().zip(&place).all(|(a, b)| (a - b).abs() < 1e-9), "{at:?} is not {place:?}"); +} + +/// A series' kept unit-box flags are read from and written to a file, and a file without them reads as document +/// coordinates. +#[test] +fn a_series_paints_unit_box_flags_round_trip() { + let kept = vectorcraft_doc::SeriesPaint { fill_unit_box: true, stroke_unit_box: true, ..Default::default() }; + let text = serde_json::to_string(&kept).unwrap(); + assert_eq!(text, r#"{"fillUnitBox":true,"strokeUnitBox":true}"#); + assert_eq!(serde_json::from_str::(&text).unwrap(), kept); + let old: vectorcraft_doc::SeriesPaint = serde_json::from_str("{}").unwrap(); + assert!(!old.fill_unit_box && !old.stroke_unit_box); } /// A series mark's fill recolored with Invert or Complement (the proxy, or one appearance row), an Edit Colors command, @@ -5730,6 +6074,247 @@ fn a_graphic_style_on_a_label_is_kept_for_its_kind() { assert!(rows_of(&looks, "0").0.iter().any(|(fill, hex, _, _)| *fill && hex == "#0080ff"), "{looks:?}"); } +/// The character style of the first run of label `text` in group `grp`. +fn label_run_style(s: &Session, id: NodeId, grp: &str, text: &str) -> CharStyle { + let NodeKind::Text(t) = label_node(s, id, grp, text).kind else { panic!("{text} is not type") }; + t.runs[0].style.clone() +} + +/// A recolor of the whole graph (Invert or Complement on the proxy, an Edit Colors command, a color filter or Recolor +/// Artwork) is kept for the characters and the rows of every kind of label when the graph is drawn again, and undo takes +/// it back with its edit. +#[test] +fn recoloring_a_graph_keeps_its_labels_paint_for_every_kind() { + let cases = [ + ("paint.invert", json!({})), + ("paint.complement", json!({})), + ("edit.colors.invert", json!({})), + ("edit.colors.toGrayscale", json!({})), + ("addon.color.filter", json!({"effect": "addon.color.invert"})), + ("recolor.apply", json!({"map": {"#3366cc": "#00ff00", "#ff8000": "#8000ff"}})), + ]; + every_case(cases, |(cmd, params)| { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + // Characters of every label in a color that every case changes, and an orange fill row on the category labels. + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#3366cc"})).unwrap(); + let c = text_id(&s, id, "Axes", "Q2"); + s.execute("appearance.addFill", &json!({"ids": [c.0]})).unwrap(); + s.execute("appearance.setItem", &json!({"ids": [c.0], "index": 0, "color": "#ff8000"})).unwrap(); + let was = spec(&s, id).label_styles; + let mut p = params.clone(); + if *cmd == "recolor.apply" { + // Recolor Artwork works on the selection. + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + } else { + p["ids"] = json!([id.0]); + } + s.execute(cmd, &p).unwrap(); + let hex = |p: &Paint| p.color().map(|c| c.to_hex()).unwrap_or_default(); + let characters = hex(&label_run_style(&s, id, "Axes", "4").fill); + assert_ne!(characters, "#3366cc", "{cmd} recolors the characters"); + let row = label_node(&s, id, "Axes", "Q2").appearance.items[0].paint().clone(); + assert_ne!(hex(&row), "#ff8000", "{cmd} recolors the row"); + let looks = label_looks(&mut s, id); + for t in ["0", "Q1", "2024"] { + assert!(looks.iter().any(|(x, _, fill)| x == t && *fill == characters), "{cmd}: {t}: {looks:?}"); + } + let rows = redrawn_label_rows(&mut s, id); + assert_eq!(rows_of(&rows, "Q1").0.first().map(|r| r.1.clone()), Some(hex(&row)), "{cmd}: {rows:?}"); + // Undo takes back the recolor and what the graph keeps (the two redraws are undone first). + for _ in 0..3 { + s.execute("edit.undo", &json!({})).unwrap(); + } + assert_eq!(spec(&s, id).label_styles, was, "{cmd}"); + }); +} + +/// A recolor of one label changes what the graph keeps for that kind of label only. +#[test] +fn recoloring_one_label_keeps_its_paint_for_its_kind_only() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + let v = text_id(&s, id, "Axes", "4"); + s.execute("edit.colors.invert", &json!({"ids": [v.0]})).unwrap(); + let looks = label_looks(&mut s, id); + assert!(looks.iter().any(|(t, _, fill)| t == "0" && fill == "#ffffff"), "{looks:?}"); + assert!(looks.iter().any(|(t, _, fill)| t == "Q1" && fill == "#000000"), "{looks:?}"); + assert!(looks.iter().any(|(t, _, fill)| t == "2024" && fill == "#000000"), "{looks:?}"); + let g = spec(&s, id).label_styles; + assert!(g.categories.is_none() && g.legend.is_none(), "{g:?}"); +} + +/// A recolor that leaves a label's first characters as they were and gives the rest the same fill is kept for its kind. +#[test] +fn a_recolor_that_evens_out_a_labels_characters_is_kept_for_its_kind() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + let q2 = text_id(&s, id, "Axes", "Q2"); + s.select_tool("type", crate::ViewInfo::default()).unwrap(); + for (start, end, hex) in [(0, 1, "#ff0000"), (1, 2, "#0000ff")] { + s.set_tool_option("textSelection", &json!({"id": q2.0, "start": start, "end": end})); + s.execute("paint.setFill", &json!({"color": hex})).unwrap(); + } + s.select_tool("selection", crate::ViewInfo::default()).unwrap(); + assert_eq!(spec(&s, id).label_styles.categories, None, "part of a label's text is not kept"); + s.execute("select.set", &json!({"ids": [q2.0]})).unwrap(); + s.execute("recolor.apply", &json!({"map": {"#0000ff": "#ff0000"}})).unwrap(); + let looks = label_looks(&mut s, id); + assert!(looks.iter().any(|(t, _, fill)| t == "Q1" && fill == "#ff0000"), "{looks:?}"); + assert!(looks.iter().any(|(t, _, fill)| t == "0" && fill == "#000000"), "{looks:?}"); +} + +/// Stroke options set with `stroke.set` and a gradient made with `paint.editGradient` and placed with +/// `paint.setGradientGeom` on a label's characters are kept for every label of its kind, the gradient without its +/// placement. +#[test] +fn stroke_and_gradient_edits_on_a_labels_characters_are_kept_for_its_kind() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + let category = label_run_style(&s, id, "Axes", "Q1"); + let v = text_id(&s, id, "Axes", "4"); + s.execute("paint.setStroke", &json!({"ids": [v.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [v.0], "weight": 3, "cap": "round"})).unwrap(); + s.execute("paint.editGradient", &json!({"ids": [v.0], "kind": "linear", "stroke": false})).unwrap(); + let placement = json!({"ids": [v.0], "stroke": false, "start": [100, 100], "end": [200, 100], "aspect": 50}); + s.execute("paint.setGradientGeom", &placement).unwrap(); + let fill = label_run_style(&s, id, "Axes", "4").fill; + assert!(matches!(&fill, Paint::Gradient(g) if g.geom.is_some()), "the edited label's gradient is placed: {fill:?}"); + label_looks(&mut s, id); + let st = label_run_style(&s, id, "Axes", "0"); + assert_eq!((st.stroke_width, st.stroke_cap), (3.0, vectorcraft_doc::LineCap::Round)); + assert!(matches!(&st.fill, Paint::Gradient(g) if g.geom.is_none()), "{:?}", st.fill); + assert_eq!(label_run_style(&s, id, "Axes", "Q1"), category, "the category labels are left as they were"); +} + +/// `stroke.set`, `stroke.weightUp` and `stroke.weightDown` given the whole graph are kept for every kind of label. +#[test] +fn stroke_weights_set_on_the_whole_graph_are_kept_for_its_labels() { + let cases = [("stroke.set", json!({"weight": 2}), 2.0), ("stroke.weightUp", json!({}), 2.0), ("stroke.weightDown", json!({}), 0.75)]; + every_case(cases, |(cmd, params, weight)| { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + s.execute("paint.setStroke", &json!({"ids": [id.0], "color": "#ff0000"})).unwrap(); + let mut p = params.clone(); + p["ids"] = json!([id.0]); + s.execute(cmd, &p).unwrap(); + assert_eq!(label_run_style(&s, id, "Axes", "4").stroke_width, *weight, "{cmd}"); + label_looks(&mut s, id); + for (grp, t) in [("Axes", "0"), ("Axes", "Q1"), ("Legend", "2024")] { + assert_eq!(label_run_style(&s, id, grp, t).stroke_width, *weight, "{cmd}: {t}"); + } + }); +} + +/// A stroke weight set on a scaled label is kept as the label shows it, since the graph draws its labels unscaled. +#[test] +fn a_stroke_weight_on_a_scaled_label_is_kept_as_it_shows() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + let v = text_id(&s, id, "Axes", "4"); + s.execute("select.set", &json!({"ids": [v.0]})).unwrap(); + s.execute("object.scale", &json!({"sx": 200, "sy": 200})).unwrap(); + s.execute("paint.setStroke", &json!({"ids": [v.0], "color": "#ff0000"})).unwrap(); + s.execute("stroke.set", &json!({"ids": [v.0], "weight": 3})).unwrap(); + assert_eq!(label_run_style(&s, id, "Axes", "4").stroke_width, 1.5, "drawn at twice its size"); + label_looks(&mut s, id); + assert_eq!(label_run_style(&s, id, "Axes", "0").stroke_width, 3.0); +} + +/// When the characters of two labels of one kind are recolored differently, the frontmost one sets what the kind +/// keeps, whatever order `ids` are in. +#[test] +fn the_frontmost_label_of_a_kind_sets_what_its_recolor_keeps() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + // Legend labels: the axes tell value and category labels apart by their order, so these are moved instead. + let (a, b) = (text_id(&s, id, "Legend", "2024"), text_id(&s, id, "Legend", "2025")); + s.execute("paint.setFill", &json!({"ids": [a.0], "color": "#ff0000"})).unwrap(); + s.execute("paint.setFill", &json!({"ids": [b.0], "color": "#0000ff"})).unwrap(); + // The label made first goes in front, so neither the order of `ids` nor the order the labels were made in decides. + let (front, back) = if a < b { (a, b) } else { (b, a) }; + s.execute("select.set", &json!({"ids": [front.0]})).unwrap(); + s.execute("object.arrange.bringToFront", &json!({})).unwrap(); + let path = |n: NodeId| s.doc().unwrap().doc.index_path(n); + assert!(path(front) > path(back), "{:?} {:?}", path(front), path(back)); + let front_fill = if front == a { "#00ffff" } else { "#ffff00" }; + s.execute("edit.colors.invert", &json!({"ids": [front.0, back.0]})).unwrap(); + let kept = spec(&s, id).label_styles.legend.unwrap().fill; + assert_eq!(kept.color().map(|c| c.to_hex()).as_deref(), Some(front_fill)); +} + +/// Apply Nearest Swatch and the ink limit of Print Ink Fixes on a label are kept for its kind. +#[test] +fn nearest_swatch_and_ink_limit_on_a_label_are_kept_for_its_kind() { + let cases = [ + ("addon.color.applyNearestSwatch", json!({"library": "web-safe-216"})), + ("addon.color.printFixes", json!({"scope": "selection", "inkLimit": 200})), + ]; + every_case(cases, |(cmd, params)| { + let mut s = Session::new(); + // Print Ink Fixes works on CMYK documents. + s.execute("file.new", &json!({"width": 800, "height": 800, "colorMode": "cmyk"})).unwrap(); + let id = graph(&mut s, "column"); + let v = text_id(&s, id, "Axes", "4"); + s.execute("paint.setFill", &json!({"ids": [v.0], "color": {"c": 90, "m": 80, "y": 70, "k": 60}})).unwrap(); + let was = label_run_style(&s, id, "Axes", "4").fill; + let mut p = params.clone(); + p["ids"] = json!([v.0]); + s.execute(cmd, &p).unwrap(); + let now = label_run_style(&s, id, "Axes", "4").fill; + assert_ne!(now, was, "{cmd} changes the fill"); + label_looks(&mut s, id); + assert_eq!(label_run_style(&s, id, "Axes", "0").fill, now, "{cmd}"); + }); +} + +/// Swap Fill and Stroke and Default Fill and Stroke on a label are kept for its kind. +#[test] +fn swap_and_default_fill_and_stroke_on_a_label_are_kept_for_its_kind() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = graph(&mut s, "column"); + let v = text_id(&s, id, "Axes", "4"); + s.execute("paint.setStroke", &json!({"ids": [v.0], "color": "#ff0000"})).unwrap(); + s.execute("paint.swap", &json!({"ids": [v.0]})).unwrap(); + let swapped = label_run_style(&s, id, "Axes", "4"); + label_looks(&mut s, id); + let st = label_run_style(&s, id, "Axes", "0"); + assert_eq!((&st.fill, &st.stroke), (&swapped.fill, &swapped.stroke)); + assert_eq!(st.fill.color().map(|c| c.to_hex()).as_deref(), Some("#ff0000")); + s.execute("paint.default", &json!({"ids": [text_id(&s, id, "Axes", "4").0]})).unwrap(); + label_looks(&mut s, id); + let st = label_run_style(&s, id, "Axes", "0"); + assert_eq!((st.fill.color().map(|c| c.to_hex()).as_deref(), st.stroke.is_none()), (Some("#000000"), true)); +} + +/// On a pie with Legends in Wedges, a recolor of the whole graph leaves the legend labels to the graph's black or white. +#[test] +fn a_recolor_leaves_wedge_legend_labels_their_contrast() { + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 800, "height": 800})).unwrap(); + let id = make(&mut s, "pie", ",a,b\nP1,1,2"); + s.execute("graph.setType", &json!({"id": id.0, "pieLegend": "wedges"})).unwrap(); + s.execute("edit.colors.invert", &json!({"ids": [id.0]})).unwrap(); + assert_eq!(spec(&s, id).label_styles.legend, None); + s.execute("graph.setData", &json!({"id": id.0, "rows": [[1, 2]]})).unwrap(); + // The first series' black wedge is white now, so its label is black. + let NodeKind::Text(t) = label_node(&s, id, "Legend", "a").kind else { panic!("a is not type") }; + assert_eq!(t.runs[0].style.fill.color().map(|c| c.to_hex()).as_deref(), Some("#000000")); + // A recolor of one legend label gives the kind that label's fill. + s.execute("edit.colors.invert", &json!({"ids": [text_id(&s, id, "Legend", "a").0]})).unwrap(); + let kept = spec(&s, id).label_styles.legend.map(|st| st.fill); + assert_eq!(kept.and_then(|f| f.color()).map(|c| c.to_hex()).as_deref(), Some("#ffffff")); +} + #[test] fn pie_names_and_wedge_labels_keep_their_style() { let mut s = Session::new(); diff --git a/crates/engine/src/cmd/library.rs b/crates/engine/src/cmd/library.rs index ae8a7ef6b2..4d562a76e7 100644 --- a/crates/engine/src/cmd/library.rs +++ b/crates/engine/src/cmd/library.rs @@ -21,7 +21,7 @@ use vectorcraft_color::{Color, GradientPaint, Paint}; use vectorcraft_doc::{Appearance, Node, NodeId, TextStyleDef}; use super::clipboard::SwatchChoices; -use super::{CommandSpec, EngineError, Result, Session, always, bad, cmd, color_value, has_doc, ids_param, index, ok, point_param, str_param}; +use super::{CommandSpec, EngineError, Result, Session, always, bad, cmd, color_value, has_doc, ids_param, index_opt, ok, point_param, str_param}; use crate::Clipboard; /// The extension of a library file. @@ -470,8 +470,8 @@ impl Library { } } -/// Make `g` a library gradient: no placement, freeform points or swatch links (a linked stop keeps -/// the color it shows), the angle its placement showed (a finite one), and stops in order with +/// Make `g` a library gradient: no placement, freeform points, swatch links or process plates (a +/// linked stop keeps the color it shows), the angle its placement showed (a finite one), and stops in order with /// offsets, opacities and midpoints in range. False when it has fewer than 2 or more than /// [`MAX_STOPS`] stops. fn clean_gradient(g: &mut GradientPaint) -> bool { @@ -490,8 +490,8 @@ fn clean_gradient(g: &mut GradientPaint) -> bool { st.offset = within(st.offset, 0.0, 1.0, 0.0); st.opacity = within(st.opacity, 0.0, 1.0, 1.0); st.midpoint = within(st.midpoint, 0.13, 0.87, 0.5); - st.swatch = None; - st.tint = 1.0; + let color = st.color; + st.set_color(color, None); } g.gradient.stops.sort_by(|a, b| a.offset.total_cmp(&b.offset)); true @@ -1488,29 +1488,15 @@ fn add_to_char_styles(s: &mut Session, p: &Value) -> Result { /// Unlink a library character style's `fill` and `stroke` colors (solid, and each gradient stop) /// from swatches that are not global or spot swatches of `doc`: an unlinked color keeps the color -/// it shows at full tint, as [`clean_gradient`] keeps a library gradient's stops. A link to a +/// it shows at full tint, and an unlinked stop has no process plates, as [`clean_gradient`] keeps +/// a library gradient's stops. A link to a /// global or spot swatch `doc` has stays, and takes that swatch's color. fn unlink_missing_swatches(doc: &vectorcraft_doc::Document, attrs: &mut Map) { let keep = |name: &str| doc.global_color(name).is_some(); for key in ["fill", "stroke"] { let Some(mut paint) = attrs.get(key).and_then(|v| serde_json::from_value::(v.clone()).ok()) else { continue }; - let mut changed = false; - let mut unlink = |swatch: &mut Option, tint: &mut f32| { - if swatch.as_deref().is_some_and(|n| !keep(n)) { - *swatch = None; - *tint = 1.0; - changed = true; - } - }; - match &mut paint { - Paint::Solid { swatch, tint, .. } => unlink(swatch, tint), - Paint::Gradient(g) => { - for st in &mut g.gradient.stops { - unlink(&mut st.swatch, &mut st.tint); - } - } - _ => {} - } + // `map_links` gives an unlinked color full tint, and an unlinked stop no process plates. + let changed = paint.map_links(&mut |_, swatch, _| swatch.take_if(|n| !keep(n.as_str())).is_some()); if changed && let Ok(v) = serde_json::to_value(&paint) { attrs.insert(key.to_string(), v); } @@ -1649,11 +1635,11 @@ fn move_group(s: &mut Session, p: &Value) -> Result { const C: &str = "library.moveGroup"; let id = library_id(s, p, C)?; let group = group_param(p, C)?; - let to = p.get("to").and_then(Value::as_u64).ok_or_else(|| bad(C, "missing `to` (an index)"))?; + let to = index_opt(p, "to", C)?.ok_or_else(|| bad(C, "missing `to` (an index)"))?; let (name, at) = s.libraries.change(&id, |lib| { let i = group_at(lib, group, C)?; let g = lib.groups.remove(i); - let at = index(to).min(lib.groups.len()); + let at = to.min(lib.groups.len()); let name = g.name.clone(); lib.groups.insert(at, g); Ok((name, at)) diff --git a/crates/engine/src/cmd/linkfiles.rs b/crates/engine/src/cmd/linkfiles.rs index 99295e5c79..fa8ef06856 100644 --- a/crates/engine/src/cmd/linkfiles.rs +++ b/crates/engine/src/cmd/linkfiles.rs @@ -144,9 +144,10 @@ fn find(s: &mut Session, p: &Value) -> Result { None | Some(Value::Null) => None, Some(_) => { // Images and placed documents in opacity-mask art and in the art of symbols, graph - // designs and patterns are named by their ids too (`links.list`). + // designs, patterns and stored brushes are named by their ids too (`links.list`). let ids = ids_param(p, "ids", C)?.unwrap_or_default(); - let kind = |id: &NodeId| st.doc.stored_node(*id).map(|(n, _)| &n.kind); + let doc = super::links::with_brush_art(&st.doc); + let kind = |id: &NodeId| doc.stored_node(*id).map(|(n, _)| &n.kind); if let Some(value) = ids.iter().find(|id| kind(id).is_none()).map(|id| id.0) { return Err(bad(C, format!("no such object id {value}"))); } diff --git a/crates/engine/src/cmd/links.rs b/crates/engine/src/cmd/links.rs index 3e1bc8b2ef..9a026598e8 100644 --- a/crates/engine/src/cmd/links.rs +++ b/crates/engine/src/cmd/links.rs @@ -27,6 +27,7 @@ use std::path::{Component, Path, PathBuf}; use std::sync::Arc; use serde_json::{Value, json}; +use vectorcraft_brush::stored_art::StoredArt; use vectorcraft_doc::links::{Align, Preserve, hash_bytes}; use vectorcraft_doc::{ Appearance, DataValue, Document, ImageBlob, ImageObject, LinkInfo, Node, NodeId, NodeKind, PageBox, PlacedDocument, PlacementOptions, @@ -44,7 +45,7 @@ pub fn specs() -> Vec { "Check Links", [], None, - "{ids?: [image or placed document ids] (default: every linked image and placed document, in the layers and in opacity-mask art, symbols, graph designs and patterns)} where each linked file is and whether it changed since it was read → {links: [{name, path?, status: ok|modified|missing, ids, found?: path (found away from its path: relative to the document, or by name in its folder), preview: true (showing the low-resolution preview, not the file), refused?: why the path is not followed (another computer, a device or a URL: it counts as missing)}], missing, modified}; under automation read roots, path and found are left out when the file they name is outside the roots", + "{ids?: [image or placed document ids] (default: every linked image and placed document, in the layers and in opacity-mask art, symbols, graph designs, patterns and the art of stored brushes)} where each linked file is and whether it changed since it was read → {links: [{name, path?, status: ok|modified|missing, ids, found?: path (found away from its path: relative to the document, or by name in its folder), preview: true (showing the low-resolution preview, not the file), refused?: why the path is not followed (another computer, a device or a URL: it counts as missing)}], missing, modified}; under automation read roots, path and found are left out when the file they name is outside the roots", has_doc, check ), @@ -53,7 +54,7 @@ pub fn specs() -> Vec { "Update Links", [], None, - "{ids?: [image or placed document ids] (default: the linked images whose file was modified or is showing its preview, and placed documents whose file was modified)} read their linked files again; each keeps its bounds. Images and placed documents inside symbols, graph designs, patterns and opacity masks have ids of their own, as links.list gives them; those that show the same content as one read again are read again too. One undo step → {updated: [ids], missing: [ids], warnings?: [a DCS file's spot plate whose ink a swatch of the document already names, as file.place warns]}", + "{ids?: [image or placed document ids] (default: the linked images whose file was modified or is showing its preview, and placed documents whose file was modified)} read their linked files again; each keeps its bounds. Images and placed documents inside symbols, graph designs, patterns, opacity masks and the art of stored brushes have ids of their own, as links.list gives them; those that show the same content as one read again are read again too. One undo step → {updated: [ids], missing: [ids], warnings?: [a DCS file's spot plate whose ink a swatch of the document already names, as file.place warns]}", has_doc, update ), @@ -71,7 +72,7 @@ pub fn specs() -> Vec { "Relink", [], None, - "{ids?: [image or placed document ids] (default: the selected ones; with folder and nothing selected, every missing link), path | folder, scope?: selected (default: ids) | all (ids and every other object linked to the same file as one of them, in the layers, opacity-mask art, symbols, graph designs and patterns) | missingInFolder (with path: ids, then every other missing link whose file name is in path's folder, each to the file of its name there; names not there are in notFound; with copy, only images are looked for) | each (with paths), paths?: [{ids, path}] (with scope each, in place of ids, path and folder: each link to its own file; an id in two entries is an error), copy?: false (with path or paths, for images of a saved document: copy the file into the document's folder and link to the copy; the names Name.png, Name 2.png … Name 99.png are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is used; an error for a DCS file that reads plate files of its own), preserve?: transforms|bounds|fileDimensions|fit|fill (how the new file takes each image's place this time, as links.placementOptions describes; default: each image's Placement Options; fit keeps the new file's aspect ratio inside the old bounds: Replace)} link images (or placed documents, each showing the same artboard or page of the new file) to the file at path, or each to the file of its link's name in folder; embedded images become linked; each keeps its bounds. One undo step → {relinked: [ids], notFound: [file names], copied?: [{from, to}], kept?: [{from, to}] (with copy; to is the file name alone when the document's folder is outside the automation read roots), warnings?: (as links.update's)}", + "{ids?: [image or placed document ids] (default: the selected ones; with folder and nothing selected, every missing link), path | folder, scope?: selected (default: ids) | all (ids and every other object linked to the same file as one of them, in the layers, opacity-mask art, symbols, graph designs, patterns and the art of stored brushes) | missingInFolder (with path: ids, then every other missing link whose file name is in path's folder, each to the file of its name there; names not there are in notFound; with copy, only images are looked for) | each (with paths), paths?: [{ids, path}] (with scope each, in place of ids, path and folder: each link to its own file; an id in two entries is an error), copy?: false (with path or paths, for images of a saved document: copy the file into the document's folder and link to the copy; the names Name.png, Name 2.png … Name 99.png are tried in turn until one is free, which gets the copy, or is a file with the same contents, which is used; an error for a DCS file that reads plate files of its own), preserve?: transforms|bounds|fileDimensions|fit|fill (how the new file takes each image's place this time, as links.placementOptions describes; default: each image's Placement Options; fit keeps the new file's aspect ratio inside the old bounds: Replace)} link images (or placed documents, each showing the same artboard or page of the new file) to the file at path, or each to the file of its link's name in folder; embedded images become linked; each keeps its bounds. One undo step → {relinked: [ids], notFound: [file names], copied?: [{from, to}], kept?: [{from, to}] (with copy; to is the file name alone when the document's folder is outside the automation read roots), warnings?: (as links.update's)}", has_doc, relink ), @@ -80,7 +81,7 @@ pub fn specs() -> Vec { "Links", [], None, - "{show?: all (default)|missing|modified|embedded, sort?: name|kind (file format)|status (missing, modified, ok, embedded); default: stacking order; top first, dcsTransparency?: false (Show DCS Transparency Interactions: mark the images placed from DCS files that are transparent, themselves or a group or layer holding them, or that overlap a visible object with its own transparency; it looks at every object, so it takes longer)} every image object and placed document the document stores, as the Links panel lists them: those in the layers, then those in opacity-mask art and in the art of symbols, graph designs and patterns (one row per stored object, never one per symbol instance or pattern tile) → {links: [{id, name, linked, status: ok|modified|missing|embedded, format (DCS for an image placed from a DCS file), pixelWidth, pixelHeight, path?, found?: path (found away from its path), page?, preview?: true (showing the saved preview), note?: said of an image past the decode allowance (shown at reduced size, or too large to draw), document?: true (a placed document: pageWidth and pageHeight in pt instead of pixels), dcsTransparency?: true (with dcsTransparency), owner?: {kind: layers|symbol|graphDesign|pattern, name? (of the symbol, graph design or pattern), maskOf?: id (in the opacity-mask art of that object)} (an object outside the layer tree)}], missing, modified, embedded}; under automation read roots, path and found are left out when the file they name is outside the roots", + "{show?: all (default)|missing|modified|embedded, sort?: name|kind (file format)|status (missing, modified, ok, embedded); default: stacking order; top first, dcsTransparency?: false (Show DCS Transparency Interactions: mark the images placed from DCS files that are transparent, themselves or a group or layer holding them, or that overlap a visible object with its own transparency; it looks at every object, so it takes longer)} every image object and placed document the document stores, as the Links panel lists them: those in the layers, then those in opacity-mask art and in the art of symbols, graph designs, patterns and stored brushes (one row per stored object, never one per symbol instance, pattern tile or brushed stroke) → {links: [{id, name, linked, status: ok|modified|missing|embedded, format (DCS for an image placed from a DCS file), pixelWidth, pixelHeight, path?, found?: path (found away from its path), page?, preview?: true (showing the saved preview), note?: said of an image past the decode allowance (shown at reduced size, or too large to draw), document?: true (a placed document: pageWidth and pageHeight in pt instead of pixels), dcsTransparency?: true (with dcsTransparency), owner?: {kind: layers|symbol|graphDesign|pattern|brush, name? (of the symbol, graph design, pattern or brush), index? (a brush's place in the Brushes panel, from 0), tile?: side|outerCorner|innerCorner|start|end (a pattern brush's tile), maskOf?: id (in the opacity-mask art of that object)} (an object outside the layer tree)}], missing, modified, embedded}; under automation read roots, path and found are left out when the file they name is outside the roots", has_doc, list ), @@ -89,7 +90,7 @@ pub fn specs() -> Vec { "Go To Link", [], None, - "{id?} select image or placed document `id` (default: the first selected one); the Links panel scrolls it into view → {id, bounds: [x0, y0, x1, y1], onCanvas: true}; one in opacity-mask art or in the art of a symbol, graph design or pattern has no place of its own on the canvas: the selection is cleared → {id, onCanvas: false, owner} (owner as links.list gives it)", + "{id?} select image or placed document `id` (default: the first selected one); the Links panel scrolls it into view → {id, bounds: [x0, y0, x1, y1], onCanvas: true}; one in opacity-mask art or in the art of a symbol, graph design, pattern or stored brush has no place of its own on the canvas: the selection is cleared → {id, onCanvas: false, owner} (owner as links.list gives it)", has_doc, go_to ), @@ -198,6 +199,8 @@ pub(crate) fn linked_groups(d: &Document) -> Vec<(String, Vec)> { /// visited before it has (art being edited on a layer and its definition) counts once, by its /// first place; without `ids` its content is still grouped. fn groups(d: &Document, ids: Option<&[NodeId]>) -> Vec { + let view = with_brush_art(d); + let d = &*view; let mut out: Vec = vec![]; let mut index: BTreeMap<(String, String, bool), usize> = BTreeMap::new(); // Looked up for every linked node: a set, not the list (which may repeat an id many times). @@ -234,13 +237,52 @@ fn stored(d: &Document, id: NodeId) -> Option<&Node> { d.stored_node(id).map(|(n, _)| &**n) } +/// `d` with the art of its stored brushes set on it ([`vectorcraft_brush::stored_art`]), so that +/// the images and placed documents in that art are visited and found by their ids as stored art; +/// `d` itself when no stored brush's art holds one or the art is set on it already. +pub(crate) fn with_brush_art(d: &Document) -> Cow<'_, Document> { + if !d.mounted_art.is_empty() { + return Cow::Borrowed(d); + } + let art = StoredArt::read(d); + if art.is_empty() { + return Cow::Borrowed(d); + } + let mut d = d.clone(); + art.mount(&mut d); + Cow::Owned(d) +} + +/// `f` run on `d` with the art of its stored brushes set on it as [`with_brush_art`] sets it; the +/// brushes whose art `f` changed are then written back into the library, the color masks of its +/// images made for their pixels first. The ids it gives that art are the ones [`with_brush_art`] +/// gives it in the same document. +pub(crate) fn editing_brush_art(d: &mut Document, f: impl FnOnce(&mut Document) -> T) -> T { + if !d.mounted_art.is_empty() { + return f(d); + } + let art = StoredArt::read(d); + if art.is_empty() { + return f(d); + } + art.mount(d); + let before: Vec> = d.mounted_art.iter().map(|(n, _)| n.clone()).collect(); + let out = f(d); + if d.mounted_art.len() != before.len() || d.mounted_art.iter().zip(&before).any(|((n, _), b)| !Arc::ptr_eq(n, b)) { + super::refresh_color_masks(None, d); + } + art.write_back(d); + out +} + /// Of `ids`, the objects of `d` outside the layer tree (where [`Document::node`] finds none). fn nested_ids(d: &Document, ids: &[NodeId]) -> std::collections::HashSet { ids.iter().copied().filter(|id| d.node(*id).is_none()).collect() } /// `links.list`'s `owner` of an object stored at `place` of `d`, when it is not in the layer tree -/// itself: `{kind: layers|symbol|graphDesign|pattern, name?, maskOf?}`. +/// itself: `{kind: layers|symbol|graphDesign|pattern, name?, maskOf?}`, or for one in the art of a +/// stored brush, `{kind: brush, name, index, tile?, maskOf?}`. fn owner_json(d: &Document, place: StoredPlace) -> Option { if place.in_layers() { return None; @@ -250,6 +292,7 @@ fn owner_json(d: &Document, place: StoredPlace) -> Option { StoredRoot::Symbol(i) => json!({ "kind": "symbol", "name": d.symbols.get(i).map(|s| s.name.as_str()) }), StoredRoot::GraphDesign(i) => json!({ "kind": "graphDesign", "name": d.graph_designs.get(i).map(|g| g.name.as_str()) }), StoredRoot::Pattern { pattern, .. } => json!({ "kind": "pattern", "name": d.patterns.get(pattern).map(|p| p.name.as_str()) }), + StoredRoot::Mounted(i) => d.mounted_art.get(i).map_or_else(|| json!({}), |(_, owner)| owner.clone()), }; if let Some(m) = place.mask_of { owner["maskOf"] = json!(m.0); @@ -479,7 +522,8 @@ pub(crate) fn linked_files(d: &Document, base: LinkBase) -> Vec { /// again (Preferences › Use Low Resolution Proxy for Linked EPS keeps the preview on screen only). pub(crate) fn full_linked_images<'a>(d: &'a Document, base: LinkBase) -> (Cow<'a, Document>, Vec) { let mut keys = BTreeSet::new(); - d.visit_images(|_, im| { + // The art of the stored brushes draws its images too. + with_brush_art(d).visit_images(|_, im| { if im.link.is_some() && d.images.get(&im.key).is_some_and(ImageBlob::is_proxy) { keys.insert(im.key.clone()); } @@ -667,6 +711,16 @@ enum ClipTo { File(PathData), /// It goes into a new clip group of this path, inside the clip group that holds it. Nest(PathData), + /// Placement Options clip it to `placement` while its DCS file draws it through `file`: it is + /// clipped to `file` as [`ClipTo::File`] clips it, and the clip group holding it is clipped to + /// `placement` as [`ClipTo::Path`] clips an object. With no `file` (the new file lacks the + /// clipping path of the clip group holding it), that group stays as [`ClipTo::Off`] leaves it, + /// clipped to `placement`. + Both { file: Option, placement: PathData }, + /// Placement Options clip it to `placement` while its DCS file draws it through `file`, and the + /// clip group holding just it is not its old file's: that clip group's clipping path becomes + /// `placement`, and it goes into a new clip group of `file` inside it. + BothInside { file: PathData, placement: PathData }, /// The clipping path of the clip group holding just it goes (a DCS file's clipping path that /// its new file lacks): the group stays as a plain group of it, with its id, name, visibility /// and transparency. @@ -702,10 +756,10 @@ fn same_path(a: &PathData, b: &PathData) -> bool { } /// The clip an image placed with `old_xf` takes when it shows `img`, read from a file, placed with -/// `new_xf`: Placement Options' clip `clip` when they clip it, else the clipping path a DCS file -/// draws `img` through. When neither clips it, a clip group holding just it whose clipping path -/// `held` is its old DCS file's (`old_clip`, in the old pixels, under the nonzero rule its clip -/// groups get) goes. +/// `new_xf`: Placement Options' clip `clip` when they clip it, and the clipping path a DCS file +/// draws `img` through, the file's clip group inside the placement's. When neither clips it, a clip +/// group holding just it whose clipping path `held` is its old DCS file's (`old_clip`, in the old +/// pixels, under the nonzero rule its clip groups get) goes. fn clip_to( old_xf: Affine, old_clip: Option<&PathData>, @@ -714,16 +768,22 @@ fn clip_to( new_xf: Affine, held: Option<(&PathData, FillRule)>, ) -> ClipTo { - if let Some(clip) = clip { - return ClipTo::Path(clip_shape(clip)); - } // Whether the clip group holding just the image is the old DCS file's: a clipping path whose // fill rule was changed in the document is not. let file_held = match (old_clip, held) { (Some(old), Some((held, rule))) => rule == FillRule::NonZero && same_path(&old.transformed(old_xf), held), _ => false, }; - match img.clip.as_ref().map(|path| path.transformed(new_xf)) { + let file = img.clip.as_ref().map(|path| path.transformed(new_xf)); + if let Some(clip) = clip { + let placement = clip_shape(clip); + return match file { + Some(file) if held.is_some() && !file_held => ClipTo::BothInside { file, placement }, + file if file.is_some() || file_held => ClipTo::Both { file, placement }, + _ => ClipTo::Path(placement), + }; + } + match file { // A clipping mask made in the document stays, with the file's clip group inside it. Some(path) if held.is_some() && !file_held => ClipTo::Nest(path), Some(path) => ClipTo::File(path), @@ -747,17 +807,18 @@ struct Nested<'a> { impl Nested<'_> { /// Every root of `d`: the layers (whose own objects are left alone), then the art of symbols, - /// graph designs and patterns. + /// graph designs and patterns, then [`Document::mounted_art`]. fn run(mut self, d: &mut Document) { let first = d.peek_next_id(); self.next = first; for l in d.layers.iter_mut() { - self.update(l, false); + // Nothing is picked in the layers themselves, so no layer is clipped. + let _ = self.update(l, false); } for root in d.symbols.iter_mut().map(|s| &mut s.art).chain(d.graph_designs.iter_mut().map(|g| &mut g.art)) { self.root(root); } - for root in d.patterns.iter_mut().flat_map(|p| &mut p.art) { + for root in d.patterns.iter_mut().flat_map(|p| &mut p.art).chain(d.mounted_art.iter_mut().map(|(n, _)| n)) { self.root(root); } for _ in first..self.next { @@ -769,20 +830,30 @@ impl Nested<'_> { /// mask art). fn root(&mut self, n: &mut Arc) { if !(self.pick)(n) { - return self.update(n, true); + if let Some(placement) = self.update(n, true) { + *n = Arc::new(self.clip_group(Arc::clone(n), placement)); + } + return; } let (new, clip) = (self.make)(n, None); let mut new = Arc::new(new); - self.update(&mut new, true); + let _ = self.update(&mut new, true); *n = match clip { ClipTo::Path(path) | ClipTo::File(path) | ClipTo::Nest(path) => Arc::new(self.clip_group(new, path)), + ClipTo::Both { file, placement } => self.clip_both(new, file, placement), + ClipTo::BothInside { file, placement } => self.clip_both(new, Some(file), placement), ClipTo::Keep | ClipTo::Off => new, }; } /// `n` (outside the layer tree when `nested`) with the picked objects under it remade; it stays - /// the same node when none is there, and only the nodes on the way to one are copied. - fn update(&mut self, n: &mut Arc, nested: bool) { + /// the same node when none is there, and only the nodes on the way to one are copied. The + /// result is Placement Options' clip that `n` itself, now the clip group of a DCS file's + /// clipping path holding a picked object (or the plain group [`ClipTo::Off`] leaves), takes: + /// the clipping path of the clip group holding just `n` becomes it, else `n` goes into a new + /// clip group of it. + #[must_use] + fn update(&mut self, n: &mut Arc, nested: bool) -> Option { let mask = n.extras().mask.as_ref().and_then(|m| { let mut art = Arc::clone(&m.art); self.root(&mut art); @@ -794,6 +865,8 @@ impl Nested<'_> { // The clipping path and object of a plain group holding just the object, which becomes a // clip group again. let mut reclipped = None; + // Placement Options' clip for `n` itself. + let mut around = None; if let Some(children) = n.children() { // A clip group holding just the object: its clipping path changes. let clip_path = match (&n.kind, &children[..]) { @@ -804,9 +877,11 @@ impl Nested<'_> { for (i, c) in children.iter().enumerate() { if !(nested && (self.pick)(c)) { let mut new = Arc::clone(c); - self.update(&mut new, nested); - if !Arc::ptr_eq(&new, c) { - slots.push((i, new)); + match (self.update(&mut new, nested), clip_path) { + (None, _) if Arc::ptr_eq(&new, c) => {} + (None, _) => slots.push((i, new)), + (Some(placement), Some(path)) if i == 1 => slots.extend([(0, with_clip(path, placement)), (1, new)]), + (Some(placement), _) => slots.push((i, Arc::new(self.clip_group(new, placement)))), } continue; } @@ -816,16 +891,10 @@ impl Nested<'_> { }); let (new, clip) = (self.make)(c, held); let mut new = Arc::new(new); - self.update(&mut new, true); + let _ = self.update(&mut new, true); match (clip, clip_path) { (ClipTo::Keep, _) => slots.push((i, new)), - (ClipTo::Path(clip) | ClipTo::File(clip), Some(path)) if i == 1 => { - let mut path = Node::clone(path); - if let NodeKind::Path { path: p, .. } = &mut path.kind { - *p = clip; - } - slots.extend([(0, Arc::new(path)), (1, new)]); - } + (ClipTo::Path(clip) | ClipTo::File(clip), Some(path)) if i == 1 => slots.extend([(0, with_clip(path, clip)), (1, new)]), (ClipTo::File(clip), None) if plain => reclipped = Some((clip, new)), (ClipTo::Path(clip) | ClipTo::File(clip) | ClipTo::Nest(clip), _) => { let group = self.clip_group(new, clip); @@ -833,11 +902,30 @@ impl Nested<'_> { } (ClipTo::Off, Some(_)) if i == 1 => declipped = Some(new), (ClipTo::Off, _) => slots.push((i, new)), + // The file's clip group stays `n`, and the placement's clip goes around it. + (ClipTo::Both { file: Some(file), placement }, Some(path)) if i == 1 => { + slots.extend([(0, with_clip(path, file)), (1, new)]); + around = Some(placement); + } + (ClipTo::Both { file: Some(file), placement }, None) if plain => { + reclipped = Some((file, new)); + around = Some(placement); + } + (ClipTo::Both { file: None, placement }, Some(_)) if i == 1 => { + declipped = Some(new); + around = Some(placement); + } + (ClipTo::BothInside { file, placement }, Some(path)) if i == 1 => { + let group = self.clip_group(new, file); + slots.extend([(0, with_clip(path, placement)), (1, Arc::new(group))]); + } + (ClipTo::Both { file, placement }, _) => slots.push((i, self.clip_both(new, file, placement))), + (ClipTo::BothInside { file, placement }, _) => slots.push((i, self.clip_both(new, Some(file), placement))), } } } if mask.is_none() && slots.is_empty() && declipped.is_none() && reclipped.is_none() { - return; + return None; } let reclipped = reclipped.map(|(clip, object)| (Arc::new(self.clipping_path(clip)), object)); let n = Arc::make_mut(n); @@ -849,14 +937,14 @@ impl Nested<'_> { if let NodeKind::Group { children, clip } = &mut n.kind { (*children, *clip) = (vec![path, object], true); } - return; + return around; } // A clip group that stays as a plain group of just the object. if let Some(object) = declipped { if let NodeKind::Group { children, clip } = &mut n.kind { (*children, *clip) = (vec![object], false); } - return; + return around; } if let Some(children) = n.children_mut() { for (i, c) in slots { @@ -865,6 +953,17 @@ impl Nested<'_> { } } } + around + } + + /// A clip group of `placement` holding `object`, inside a clip group of `file` when there is a + /// `file` ([`ClipTo::Both`] for an object no clip group holds yet). + fn clip_both(&mut self, object: Arc, file: Option, placement: PathData) -> Arc { + let object = match file { + Some(file) => Arc::new(self.clip_group(object, file)), + None => object, + }; + Arc::new(self.clip_group(object, placement)) } /// A clip group of `object` clipped to `clip`, as [`clip_image_to`] makes one in the layers. @@ -1035,6 +1134,15 @@ fn clip_file_to(d: &mut Document, id: NodeId, path: PathData) -> Result<()> { Ok(()) } +/// Clipping path `path` (a node) with its path changed to `clip`. +fn with_clip(path: &Node, clip: PathData) -> Arc { + let mut path = Node::clone(path); + if let NodeKind::Path { path: p, .. } = &mut path.kind { + *p = clip; + } + Arc::new(path) +} + /// A clipping path `id` of `path`, unpainted. fn clipping_path(id: NodeId, path: PathData) -> Node { let none = vectorcraft_color::Paint::None; @@ -1130,6 +1238,19 @@ fn install(d: &mut Document, ids: &[NodeId], (link, img): FileRead, force: Optio ClipTo::File(path) => clip_file_to(d, id, path), ClipTo::Nest(path) => new_clip_group(d, id, path), ClipTo::Off => unclip(d, id), + ClipTo::Both { file, placement } => { + match file { + Some(file) => clip_file_to(d, id, file)?, + None => unclip(d, id)?, + } + // The file's clip group (or the plain group left of it) takes the placement's clip. + let group = d.parent_of(id).ok_or(EngineError::NoNode(id))?; + clip_image_to(d, group, placement) + } + ClipTo::BothInside { file, placement } => { + clip_image_to(d, id, placement)?; + new_clip_group(d, id, file) + } }) } @@ -1229,8 +1350,14 @@ impl Resolved { /// found away from their path take the new path. A link nothing is known of whose image, or placed /// document, shows a preview (a file another app wrote kept only that) was never read: its file is /// read now, into the object's bounds, which isn't a change to report. A placed document whose -/// file's bytes are gone isn't showing a preview. Nothing here is an undo step. +/// file's bytes are gone isn't showing a preview. Links in the art of the stored brushes count too, +/// and that art keeps the ids they are listed by. Nothing here is an undo step. pub fn resolve(d: &mut Document, base: LinkBase, update: bool, low_res_proxy_eps: bool) -> Resolved { + editing_brush_art(d, |d| resolve_links(d, base, update, low_res_proxy_eps)) +} + +/// [`resolve`] in the art `d` stores. +fn resolve_links(d: &mut Document, base: LinkBase, update: bool, low_res_proxy_eps: bool) -> Resolved { let mut out = Resolved::default(); // The image (with its preview) and hash of each file read for a preview here, by path: images // of other keys linking to the same file share them, rather than each reading, decoding and @@ -1381,8 +1508,8 @@ fn set_links(d: &mut Document, ids: &[NodeId], link: &LinkInfo) { } /// Placed documents of the document saved at `path` (document `saved` of `s`) in the other open -/// documents, in the layers, symbols, graph designs, patterns and opacity masks: read again from -/// the new file, each as one Update Links step of its document. +/// documents, in the layers, symbols, graph designs, patterns, opacity masks and the art of the +/// stored brushes: read again from the new file, each as one Update Links step of its document. pub(crate) fn refresh_placed(s: &mut Session, saved: u64, path: &str) { let path = absolute_path(path); let targets: Vec = s @@ -1392,7 +1519,7 @@ pub(crate) fn refresh_placed(s: &mut Session, saved: u64, path: &str) { .filter(|(_, st)| st.uid != saved) .filter(|(_, st)| { let mut placed = false; - st.doc.visit_placed(|_, p| placed |= p.link.path == path); + with_brush_art(&st.doc).visit_placed(|_, p| placed |= p.link.path == path); placed }) .map(|(i, _)| i) @@ -1449,7 +1576,7 @@ fn link_target(link: &LinkInfo, base: LinkBase) -> PathBuf { /// `d` (looking from `base`) as saved to `dest`: the links' paths relative to its folder written /// in; `None` when they are already. A link whose file is not at its path is written relative to /// where its file is found, else to the place its relative path names. Links in the layers, -/// symbols, graph designs, patterns and opacity masks are all set. +/// symbols, graph designs, patterns, opacity masks and the art of the stored brushes are all set. pub fn with_relative_paths(d: &Document, base: LinkBase, dest: &str) -> Option { let dest = absolute_path(dest); let dir = Path::new(&dest).parent()?; @@ -1458,23 +1585,29 @@ pub fn with_relative_paths(d: &Document, base: LinkBase, dest: &str) -> Option); @@ -1629,7 +1762,9 @@ fn update_where(s: &mut Session, ids: Option>, path: Option<&str>) - let updated: Vec = reads.iter().flat_map(|(g, _)| ids_json(&g.ids)).collect(); let warnings = spot_swatch_notes(&st.doc, reads.iter().map(|(_, read)| read)); if !reads.is_empty() { - s.edit("Update Links", |d, _| reads.into_iter().try_for_each(|(g, read)| install_read(d, &g.ids, read, None, Some(&g))))?; + s.edit("Update Links", |d, _| { + editing_brush_art(d, |d| reads.into_iter().try_for_each(|(g, read)| install_read(d, &g.ids, read, None, Some(&g)))) + })?; } let mut out = json!({ "updated": updated, "missing": missing }); if !warnings.is_empty() { @@ -1756,9 +1891,10 @@ fn relink(s: &mut Session, p: &Value) -> Result { Some(Path::new(&doc).parent().map(Path::to_path_buf).ok_or_else(no_folder)?) } }; + let doc = with_brush_art(&st.doc); // An image or a placed document, with its link. let image = |id: &NodeId| { - stored(&st.doc, *id).and_then(|n| match &n.kind { + stored(&doc, *id).and_then(|n| match &n.kind { NodeKind::Image(im) => Some(im.link.as_ref()), NodeKind::PlacedDocument(p) => Some(Some(&p.link)), _ => None, @@ -1788,7 +1924,7 @@ fn relink(s: &mut Session, p: &Value) -> Result { let paths: BTreeSet<&str> = ids.iter().filter_map(|id| image(id).flatten()).map(|l| l.path.as_str()).collect(); let mut given: BTreeSet = ids.iter().copied().collect(); let mut more = vec![]; - st.doc.visit_stored(|n, _| { + doc.visit_stored(|n, _| { if let Some((l, _, _)) = linked(n) && paths.contains(l.path.as_str()) && n.id.0 != 0 @@ -1799,7 +1935,7 @@ fn relink(s: &mut Session, p: &Value) -> Result { }); ids.extend(more); } - if copy_to.is_some() && ids.iter().any(|id| matches!(stored(&st.doc, *id).map(|n| &n.kind), Some(NodeKind::PlacedDocument(_)))) { + if copy_to.is_some() && ids.iter().any(|id| matches!(stored(&doc, *id).map(|n| &n.kind), Some(NodeKind::PlacedDocument(_)))) { return Err(bad(C, "copy takes images only: relink placed documents where their files are")); } // (ids, the file) per file to read. @@ -1835,7 +1971,7 @@ fn relink(s: &mut Session, p: &Value) -> Result { let mut images = vec![]; let mut documents: Vec<((u32, bool, PageBox), Vec)> = vec![]; for id in ids { - match stored(&st.doc, id).map(|n| &n.kind) { + match stored(&doc, id).map(|n| &n.kind) { Some(NodeKind::PlacedDocument(pl)) => { let k = (pl.page(), pl.bounding, pl.page_box); match documents.iter_mut().find(|(e, _)| *e == k) { @@ -1886,9 +2022,10 @@ fn relink(s: &mut Session, p: &Value) -> Result { } } let relinked: Vec = reads.iter().flat_map(|(ids, _)| ids_json(ids)).collect(); + drop(doc); let warnings = spot_swatch_notes(&s.doc()?.doc, reads.iter().map(|(_, read)| read)); if !reads.is_empty() { - s.edit("Relink", |d, _| reads.into_iter().try_for_each(|(ids, read)| install_read(d, &ids, read, preserve, None)))?; + s.edit("Relink", |d, _| editing_brush_art(d, |d| reads.into_iter().try_for_each(|(ids, read)| install_read(d, &ids, read, preserve, None))))?; } not_found.sort(); not_found.dedup(); @@ -1998,14 +2135,15 @@ fn selected_images(st: &crate::DocState, keep: impl Fn(&ImageObject) -> bool) -> st.selection.objects.iter().copied().filter(|id| image_of(&st.doc, *id).is_some_and(&keep)).collect() } -/// `id`, else the first selected image. -fn image_param(st: &crate::DocState, p: &Value, cmd: &str) -> Result { +/// `id` (looked up in `doc`, the document of `st` as [`with_brush_art`] gives it), else the first +/// selected image. +fn image_param(st: &crate::DocState, doc: &Document, p: &Value, cmd: &str) -> Result { let id = object_param(p, "id", cmd)? .or_else(|| selected_images(st, |_| true).first().copied()) .ok_or_else(|| bad(cmd, "select an image, or pass id"))?; - match image_of(&st.doc, id) { + match image_of(doc, id) { Some(_) => Ok(id), - None if stored(&st.doc, id).is_none() => Err(crate::EngineError::NoNode(id)), + None if stored(doc, id).is_none() => Err(crate::EngineError::NoNode(id)), None => Err(bad(cmd, format!("object {} is not an image", id.0))), } } @@ -2028,13 +2166,14 @@ fn placement_of(d: &Document, id: NodeId) -> Option { } } -/// `id`, else the first selected image or placed document. -fn linked_param(st: &crate::DocState, p: &Value, cmd: &str) -> Result { - let first = || st.selection.objects.iter().copied().find(|id| placement_of(&st.doc, *id).is_some()); +/// `id` (looked up in `doc`, the document of `st` as [`with_brush_art`] gives it), else the first +/// selected image or placed document. +fn linked_param(st: &crate::DocState, doc: &Document, p: &Value, cmd: &str) -> Result { + let first = || st.selection.objects.iter().copied().find(|id| placement_of(doc, *id).is_some()); let id = object_param(p, "id", cmd)?.or_else(first).ok_or_else(|| bad(cmd, "select an image, or pass id"))?; - match placement_of(&st.doc, id) { + match placement_of(doc, id) { Some(_) => Ok(id), - None if stored(&st.doc, id).is_none() => Err(crate::EngineError::NoNode(id)), + None if stored(doc, id).is_none() => Err(crate::EngineError::NoNode(id)), None => Err(bad(cmd, format!("object {} is not an image or a linked file", id.0))), } } @@ -2141,10 +2280,12 @@ fn list(s: &mut Session, p: &Value) -> Result { let interactions = if switch_or(p, "dcsTransparency", false, C)? { dcs_transparency(&st.doc) } else { BTreeSet::new() }; let statuses = statuses(st); // The layer tree's objects, top first as the Layers panel lists them, then the others in the - // order they are stored (opacity-mask art, symbols, graph designs, patterns), each once. + // order they are stored (opacity-mask art, symbols, graph designs, patterns, the art of the + // stored brushes), each once. + let doc = with_brush_art(&st.doc); let (mut objects, mut nested) = (vec![], vec![]); let mut seen = std::collections::HashSet::new(); - st.doc.visit_stored(|n, place| { + doc.visit_stored(|n, place| { if matches!(n.kind, NodeKind::Image(_) | NodeKind::PlacedDocument(_)) && n.id.0 != 0 && seen.insert(n.id) { if place.in_layers() { objects.push((n, place)) } else { nested.push((n, place)) } } @@ -2196,7 +2337,7 @@ fn list(s: &mut Session, p: &Value) -> Result { if preview { row["preview"] = json!(true); } - if let Some(owner) = owner_json(&st.doc, place) { + if let Some(owner) = owner_json(&doc, place) { row["owner"] = owner; } if interactions.contains(&n.id) { @@ -2218,10 +2359,13 @@ fn list(s: &mut Session, p: &Value) -> Result { fn go_to(s: &mut Session, p: &Value) -> Result { let st = s.doc()?; - let id = linked_param(st, p, "links.goTo")?; - // An object in mask art or a definition has no place of its own on the canvas: the selection - // is cleared, and the reply names what holds it. - if let Some(owner) = st.doc.stored_node(id).and_then(|(_, place)| owner_json(&st.doc, place)) { + let doc = with_brush_art(&st.doc); + let id = linked_param(st, &doc, p, "links.goTo")?; + // An object in mask art, a definition or a stored brush's art has no place of its own on the + // canvas: the selection is cleared, and the reply names what holds it. + let owner = doc.stored_node(id).and_then(|(_, place)| owner_json(&doc, place)); + drop(doc); + if let Some(owner) = owner { s.select(|_, sel| sel.set([]))?; return Ok(json!({ "id": id.0, "onCanvas": false, "owner": owner })); } @@ -2233,7 +2377,8 @@ fn go_to(s: &mut Session, p: &Value) -> Result { fn embed(s: &mut Session, p: &Value) -> Result { const C: &str = "links.embed"; let st = s.doc()?; - let kind = |id: &NodeId| stored(&st.doc, *id).map(|n| &n.kind); + let doc = with_brush_art(&st.doc); + let kind = |id: &NodeId| stored(&doc, *id).map(|n| &n.kind); let linked = |id: &NodeId| match kind(id) { Some(NodeKind::Image(im)) => im.link.is_some(), Some(NodeKind::PlacedDocument(_)) => true, @@ -2285,17 +2430,20 @@ fn embed(s: &mut Session, p: &Value) -> Result { _ => missing.extend(g.ids), } } + drop(doc); if !done.is_empty() || !documents.is_empty() { s.edit("Embed", |d, _| { - for (ids, read) in reads { - install(d, &ids, read, Some(Preserve::Bounds), None)?; - } - for id in &done { - if let Some(Node { kind: NodeKind::Image(im), .. }) = d.stored_node_mut(*id) { - im.link = None; + editing_brush_art(d, |d| { + for (ids, read) in reads { + install(d, &ids, read, Some(Preserve::Bounds), None)?; } - } - documents.iter().try_for_each(|id| super::place::document::expand(d, *id, C)) + for id in &done { + if let Some(Node { kind: NodeKind::Image(im), .. }) = d.stored_node_mut(*id) { + im.link = None; + } + } + documents.iter().try_for_each(|id| super::place::document::expand(d, *id, C)) + }) })?; } done.extend(documents); @@ -2318,9 +2466,10 @@ fn convert_image(bytes: &[u8], ext: &str) -> std::result::Result, String fn unembed(s: &mut Session, p: &Value) -> Result { const C: &str = "links.unembed"; let st = s.doc()?; - let id = image_param(st, p, C)?; - let n = stored(&st.doc, id).ok_or(crate::EngineError::NoNode(id))?; - let im = image_of(&st.doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; + let doc = with_brush_art(&st.doc); + let id = image_param(st, &doc, p, C)?; + let n = stored(&doc, id).ok_or(crate::EngineError::NoNode(id))?; + let im = image_of(&doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; if im.link.is_some() { return Err(bad(C, format!("image {} is linked already", id.0))); } @@ -2345,7 +2494,8 @@ fn unembed(s: &mut Session, p: &Value) -> Result { let img = linked_image(&bytes, Some(&path))?; write_file(&path, &bytes)?; let read = (link_info(&path, &bytes), img); - s.edit("Unembed", |d, _| install(d, &[id], read, Some(Preserve::Bounds), None))?; + drop(doc); + s.edit("Unembed", |d, _| editing_brush_art(d, |d| install(d, &[id], read, Some(Preserve::Bounds), None)))?; Ok(json!({ "id": id.0, "path": path })) } @@ -2403,9 +2553,10 @@ fn scale_rotation(xf: Affine, (px, py): (f64, f64)) -> (Value, Value) { (json!([a.hypot(b) / px * 100.0, c.hypot(d) / py * 100.0]), json!((-b).atan2(a).to_degrees() + 0.0)) } -/// Link Info of placed document `id`. -fn placed_info(st: &crate::DocState, id: NodeId) -> Result { - let n = stored(&st.doc, id).ok_or(crate::EngineError::NoNode(id))?; +/// Link Info of placed document `id` (looked up in `doc`, the document of `st` as +/// [`with_brush_art`] gives it). +fn placed_info(st: &crate::DocState, doc: &Document, id: NodeId) -> Result { + let n = stored(doc, id).ok_or(crate::EngineError::NoNode(id))?; let NodeKind::PlacedDocument(pl) = &n.kind else { return Err(bad("links.info", format!("object {} is not a placed document", id.0))) }; let size = n.geometric_bounds().unwrap_or_default(); let (scale, rotation) = scale_rotation(pl.xf, (1.0, 1.0)); @@ -2430,13 +2581,19 @@ fn placed_info(st: &crate::DocState, id: NodeId) -> Result { fn info(s: &mut Session, p: &Value) -> Result { const C: &str = "links.info"; - let id = linked_param(s.doc()?, p, C)?; - if image_of(&s.doc()?.doc, id).is_none() { - return placed_info(s.doc()?, id); - } + let id = { + let st = s.doc()?; + let doc = with_brush_art(&st.doc); + let id = linked_param(st, &doc, p, C)?; + if image_of(&doc, id).is_none() { + return placed_info(st, &doc, id); + } + id + }; let mut out = super::place::image_info(s, &json!({ "id": id.0 }))?; let st = s.doc()?; - let im = image_of(&st.doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; + let doc = with_brush_art(&st.doc); + let im = image_of(&doc, id).ok_or_else(|| bad(C, format!("object {} is not an image", id.0)))?; let (px, py) = file_pt(&st.doc, &im.key); out["effectivePpi"] = out["ppi"].take(); out["ppi"] = json!([72.0 / px, 72.0 / py]); @@ -2453,9 +2610,10 @@ fn info(s: &mut Session, p: &Value) -> Result { fn placement_options(s: &mut Session, p: &Value) -> Result { const C: &str = "links.placementOptions"; let st = s.doc()?; + let doc = with_brush_art(&st.doc); let ids = - ids_param(p, "ids", C)?.unwrap_or_else(|| st.selection.objects.iter().copied().filter(|id| placement_of(&st.doc, *id).is_some()).collect()); - if let Some(id) = ids.iter().find(|id| placement_of(&st.doc, **id).is_none()) { + ids_param(p, "ids", C)?.unwrap_or_else(|| st.selection.objects.iter().copied().filter(|id| placement_of(&doc, *id).is_some()).collect()); + if let Some(id) = ids.iter().find(|id| placement_of(&doc, **id).is_none()) { return Err(bad(C, format!("object {} is not an image or a linked file", id.0))); } if ids.is_empty() { @@ -2474,7 +2632,8 @@ fn placement_options(s: &mut Session, p: &Value) -> Result { None | Some(Value::Null) => None, Some(v) => Some(v.as_bool().ok_or_else(|| bad(C, "clip must be true or false"))?), }; - let first = ids.first().and_then(|id| placement_of(&st.doc, *id)).unwrap_or_default(); + let first = ids.first().and_then(|id| placement_of(&doc, *id)).unwrap_or_default(); + drop(doc); if preserve.is_none() && align.is_none() && clip.is_none() { return Ok(json!({ "placement": placement_json(first) })); } @@ -2484,11 +2643,13 @@ fn placement_options(s: &mut Session, p: &Value) -> Result { o.clip = clip.unwrap_or(o.clip); }; s.edit("Placement Options", |d, _| { - for id in &ids { - if let Some(o) = d.stored_node_mut(*id).and_then(placement_mut) { - set(o); + editing_brush_art(d, |d| { + for id in &ids { + if let Some(o) = d.stored_node_mut(*id).and_then(placement_mut) { + set(o); + } } - } + }); Ok(()) })?; let mut shown = first; diff --git a/crates/engine/src/cmd/object/shape.rs b/crates/engine/src/cmd/object/shape.rs index e3909c5935..b30959de99 100644 --- a/crates/engine/src/cmd/object/shape.rs +++ b/crates/engine/src/cmd/object/shape.rs @@ -149,9 +149,22 @@ pub(super) fn set_live_shape(s: &mut Session, p: &Value) -> Result { }; let angle = |k: &str| Ok::<_, EngineError>(number(k, |_| true, "an angle in degrees")?.map(|a| a.rem_euclid(360.0))); let length = |k: &str| number(k, |x| x > 0.0 && x <= crate::MAX_COORD, "a length in points above 0"); - let radius = number("radius", |r| r >= 0.0, "a radius of 0 or more")?; + // Saved steps ([`Session::replay`]) can hold values a direct call refuses, recorded before these + // checks: a negative radius is 0, a whole side count of 0 or more is brought into 3 to 1000, and + // a fractional or negative one is ignored. A whole number written as 5.0 counts as 5, as in a + // direct call. + let replaying = s.replaying(); + let radius = if replaying { + number("radius", |_| true, "a number")?.map(|r| r.max(0.0)) + } else { + number("radius", |r| r >= 0.0, "a radius of 0 or more")? + }; // A polygon's side count: a whole number from 3 to 1000. - let sides = number("sides", |n| n.fract() == 0.0 && (3.0..=1000.0).contains(&n), "a whole number from 3 to 1000")?.map(|n| n as u64); + let sides = if replaying { + number("sides", |_| true, "a number")?.filter(|n| n.fract() == 0.0 && *n >= 0.0).map(|n| n.min(1000.0) as u64) + } else { + number("sides", |n| n.fract() == 0.0 && (3.0..=1000.0).contains(&n), "a whole number from 3 to 1000")?.map(|n| n as u64) + }; // An ellipse's pie (Ellipse Properties: Pie Start and End Angle, degrees; Invert Pie swaps them). let (pie_start, pie_end) = (angle("pieStart")?, angle("pieEnd")?); let invert = p.get("invertPie").and_then(Value::as_bool) == Some(true); diff --git a/crates/engine/src/cmd/package.rs b/crates/engine/src/cmd/package.rs index 8d6f53d55b..315a737c59 100644 --- a/crates/engine/src/cmd/package.rs +++ b/crates/engine/src/cmd/package.rs @@ -229,7 +229,7 @@ impl<'a> Collector<'a> { Some((d, base)) => super::links::linked_files(d, base), None => super::links::linked_files(doc, LinkBase::file(Some(source))), }; - doc.visit_placed(|_, p| { + super::links::with_brush_art(doc).visit_placed(|_, p| { let page = (p.link.page.unwrap_or(1), p.bounding, p.page_box); let pages = placed.entry(p.link.path.clone()).or_default(); if !pages.contains(&page) { @@ -389,16 +389,20 @@ impl<'a> Collector<'a> { } if self.opts.relink { // The child files have already been rewritten; the hash and size of each - // target must reflect the *packaged* bytes rather than the original. - doc.update_links(|link: &mut LinkInfo| { - if let Some(copy) = local.get(&link.path) { - let relative = relative_in_package(destination, ©.name); - link.path = self.root.as_ref().map_or_else(|| copy.name.clone(), |r| r.join(©.name).to_string_lossy().into_owned()); - link.relative = Some(relative); - link.size = copy.size; - link.hash = copy.hash.clone(); - link.modified = None; - } + // target must reflect the *packaged* bytes rather than the original. The links in the + // art of the stored brushes are written back into the brush library. + let root = &self.root; + super::links::editing_brush_art(doc, |doc| { + doc.update_links(|link: &mut LinkInfo| { + if let Some(copy) = local.get(&link.path) { + let relative = relative_in_package(destination, ©.name); + link.path = root.as_ref().map_or_else(|| copy.name.clone(), |r| r.join(©.name).to_string_lossy().into_owned()); + link.relative = Some(relative); + link.size = copy.size; + link.hash = copy.hash.clone(); + link.modified = None; + } + }) }); } if let Some(s) = self.sections.get_mut(section) { diff --git a/crates/engine/src/cmd/paint.rs b/crates/engine/src/cmd/paint.rs index 3ec28e7ce7..e7b89ade16 100644 --- a/crates/engine/src/cmd/paint.rs +++ b/crates/engine/src/cmd/paint.rs @@ -39,7 +39,7 @@ pub fn specs() -> Vec { "Swap Fill and Stroke", [], Some("Shift+X"), - "{ids?|id?} swap the fill and stroke of the selection (type too) and of the defaults. On a path directly in a graph series, the graph also stores the swapped paints and the stroke weight (exceptions: docs/mcp.md)", + "{ids?|id?} swap the fill and stroke of the selection (type too) and of the defaults. On a path directly in a graph series, the graph also stores the swapped paints and the stroke weight, and on a graph label the swapped paints of its characters for every label of its kind (exceptions: docs/mcp.md)", has_doc, swap ), @@ -48,7 +48,7 @@ pub fn specs() -> Vec { "Default Fill and Stroke", [], Some("D"), - "{ids?|id?} white fill and 1 pt black stroke for the selection and the defaults; type gets black fill and no stroke. On a path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke (exceptions: docs/mcp.md)", + "{ids?|id?} white fill and 1 pt black stroke for the selection and the defaults; type gets black fill and no stroke. On a path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke, and on a graph label the black fill and no stroke of its characters for every label of its kind (exceptions: docs/mcp.md)", has_doc, default_paint ), @@ -96,7 +96,7 @@ pub fn proxy_specs() -> Vec { "Invert", [], None, - "{stroke?: bool (default: the active proxy), ids?|id?, item?: appearance item index|null, target?: \"object\"|\"contents\"} invert the active proxy's colours of the selection (or ids; groups recolour their contents) keeping each colour's model, as edit.colors.invert does; the Appearance panel's active fill/stroke item (appearance.setActiveItem) is inverted instead when it is of that kind and no ids are given; with an object of a dynamic symbol instance selected by Direct Selection and no ids, id or item, that object's solid color changes for this instance only, and a gradient or pattern, or type whose characters differ in color, is refused; with nothing selected, invert the default. On a path directly in a graph series, the graph also stores the new color of the topmost visible fill or stroke (docs/mcp.md); no undo step when no color changes → {changed}", + "{stroke?: bool (default: the active proxy), ids?|id?, item?: appearance item index|null, target?: \"object\"|\"contents\"} invert the active proxy's colours of the selection (or ids; groups recolour their contents) keeping each colour's model, as edit.colors.invert does; the Appearance panel's active fill/stroke item (appearance.setActiveItem) is inverted instead when it is of that kind and no ids are given; with an object of a dynamic symbol instance selected by Direct Selection and no ids, id or item, that object's solid color changes for this instance only, and a gradient or pattern, or type whose characters differ in color, is refused; with nothing selected, invert the default. On a path directly in a graph series, the graph also stores the new color of the topmost visible fill or stroke, and on a graph label the new color of its characters and rows for every label of its kind (docs/mcp.md); no undo step when no color changes → {changed}", has_doc, |s, p| proxy_recolor(s, p, "paint.invert", "Invert", &super::colorcmds::invert) ), @@ -925,7 +925,8 @@ fn swap(s: &mut Session, p: &Value) -> Result { } // The swap writes the paint of the topmost fill and stroke, not their opacity. let kept = super::appearance::capture_series_writes(&before, d, &ids, (true, true), (false, false), true, false); - Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept)) + let labels = super::graph::capture_label_changes(&before, d, &ids, false); + Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels)) })?; } if s.paint.stroke.is_none() && !s.paint.fill.is_none() && s.paint.stroke_width == 0.0 { @@ -954,7 +955,8 @@ fn default_paint(s: &mut Session, p: &Value) -> Result { } } let kept = super::appearance::capture_series_writes(&before, d, &ids, (true, true), (true, true), false, false); - Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept)) + let labels = super::graph::capture_label_changes(&before, d, &ids, false); + Ok(super::appearance::count_changed(d, &before, &ids) + usize::from(kept || labels)) })?; } super::newart::reset(s); diff --git a/crates/engine/src/cmd/panelcmds.rs b/crates/engine/src/cmd/panelcmds.rs index f9c4b10049..2383d05a3a 100644 --- a/crates/engine/src/cmd/panelcmds.rs +++ b/crates/engine/src/cmd/panelcmds.rs @@ -67,7 +67,7 @@ pub fn specs() -> Vec { "Character / Paragraph", [], None, - "{ids?|id?, kerning?: 1/1000 em|\"auto\"|\"optical\", baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), underline?, strikethrough?, allCaps?, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), antiAlias?: \"none\"|\"sharp\"|\"crisp\"|\"strong\" (Character panel › Anti-aliasing Method, how the type's edges are drawn as pixels; it sets each targeted type object, with or without a range; each frame of a thread keeps its own method; graph labels keep it for every label of their kind when the graph is drawn again; new type: \"sharp\"), leftIndent?, rightIndent?, firstLineIndent?, spaceBefore?, spaceAfter?: pt (±1296), list?: \"none\"|\"bullet\"|\"number\", bullet?: \"none\"|\"dot\"|\"dash\"|\"circle\"|\"square\", number?: \"none\"|\"arabic\"|\"upperLetters\"|\"lowerLetters\"|\"upperRoman\"|\"lowerRoman\"|\"twoDigits\"|\"threeDigits\", listAlign?: \"left\"|\"right\", listLevel?: 1..9 (Paragraph panel › Bullets and Numbered List: each paragraph of a list starts with its marker, drawn in the font, size and color of the paragraph's first character, and its text starts at the next tab stop after the marker, the left indent counting as a stop; a bulleted list's marker is its bullet, and a numbered list's is the paragraph's number and a period: 1, 2, 3; A to Z, then AA, BB; a to z, then aa, bb; I, II, III; i, ii, iii; 01 to 99, then 100; 001 to 999, then 1000; letters and roman numerals past 3999 in Arabic digits; the numbers count the story's numbered paragraphs, its threaded frames included, from 1 after a paragraph in no list, and an empty or bulleted paragraph is not counted; list \"bullet\" keeps a list's bullet, else a dot, and list \"number\" keeps a numbered list's style, else arabic; without list, a number style makes a numbered list and a bullet makes a bulleted one; \"none\" in any of the three turns the list off; a paragraph that joins a list with left and first-line indents of 0 gets 18 and -18 unless the call sets an indent; a horizontal right-to-left list paragraph has its indents mirrored, measured from the right; listAlign \"right\" (Bullets and Numbering…'s Alignment) puts the marker against the text, and \"left\" (the default) puts it at the first line's start, the text starting at the same place with either; it sets the paragraphs that are in a list or that the call puts in one, and a list keeps it when it changes between bullets and numbers; listLevel (Tab and Shift+Tab at the start of a list paragraph, Bullets and Numbering…'s Level) is a whole number from 1 to 9 that sets the paragraphs in a list or that the call puts in one, a list keeping it when it changes between bullets and numbers, and a list turned on without listLevel starting at level 1; each level past the first sets the paragraph 18 pt further in than its left indent, and each level counts its own numbers: a list paragraph with text sets the counts of the levels deeper than its own back to 0, so a deeper numbered paragraph after it counts from 1, and a paragraph back at a shallower level goes on with that level's count), hyphenate?: bool, wordsLongerThan?: letters 1..25 (5), afterFirst?, beforeLast?: letters 1..15 (3), hyphenLimit?: lines 0..25 (0: no limit), hyphenationZone?: pt 0..1296 (0; Single-line Composer only), hyphenateCapitalized?: bool (true) (Paragraph panel menu › Hyphenation…: only words longer than wordsLongerThan break, keeping afterFirst letters before the hyphen and beforeLast after it; at most hyphenLimit lines in a row end with a hyphen; a line whose text already ends within hyphenationZone of its right edge breaks before the next word instead of hyphenating it; the counts are rounded, and every value is clamped to its range), wordSpacing?: % 0..1000 (80, 100, 133), letterSpacing?: % of a word space -100..500 (0, 0, 0), glyphScaling?: % 50..200 (100, 100, 100): each [min, desired, max] or {min?, desired?, max?} (Paragraph panel menu › Justification…: Desired applies to every line, Minimum and Maximum bound what justified lines may use; values are clamped to their range, and Minimum ≤ Desired ≤ Maximum must hold afterwards or nothing changes), autoLeading?: % of the size 0..500 (120; the leading of characters whose leading is Auto), singleWordJustification?: \"fullJustify\"|\"alignLeft\"|\"alignCenter\"|\"alignRight\" (a justified line holding one word), mojikumi?: \"none\"|\"yakumonoHankaku\"|\"gyomatsuYakumonoHankaku\"|\"gyomatsuYakumonoZenkaku\"|\"yakumonoZenkaku\"|\"lineEndHalf\" (Mojikumi Set: Japanese punctuation spacing), kinsoku?: \"none\"|\"hard\"|\"soft\" (Kinsoku Set: Soft lets 々, ー and small kana start a line), kinsokuType?: \"pushInFirst\"|\"pushOutFirst\"|\"pushOutOnly\" (Paragraph panel menu › Kinsoku Shori Type: how area type keeps those characters off a line's ends; pushInFirst sets them on the line when its gaps next to CJK characters can close up enough, by at most a tenth of an em each, pushOutFirst does so only when moving the character before them to the next line would leave the line more than an em short, and pushOutOnly, the default, moves it unless Burasagari hangs an overflowing comma or full stop; no effect with kinsoku \"none\"), bunriKinshi?: bool (Paragraph panel menu › Bunri-Kinshi: a line never breaks inside an inseparable pair, two em dashes, two horizontal ellipses, two two-dot leaders or the two halves of a vertical kana repeat mark, and justification adds no space inside one; kept but without effect with kinsoku \"none\"; off by default), direction?: \"auto\"|\"leftToRight\"|\"rightToLeft\" (paragraph direction; auto: from each paragraph's first strong character), leadingModel?: \"romanBaseline\"|\"emBoxTop\" (leading measured baseline to baseline, or em box top to top), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (where characters smaller than the largest on their line line up with it), proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings, as text.setRangeStyle: a tate-chu-yoko block moves up or down, right or left, and on a vertical path toward or away from the path's start, to its left or right), warichu?: bool, warichuLines?: 1..6, warichuGap?: pt 0..100, warichuScale?: % 10..100, warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Character panel menu › Warichu and Warichu Settings, as text.setRangeStyle: the characters set smaller and stacked on lines inside their line), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options, as text.setRangeStyle: space before and after each character in reading order), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, as text.setRangeStyle), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference, as text.setRangeStyle: the height of the font that the size measures), language?: name|tag (Character panel › Language, as text.setRangeStyle), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font, as text.setRangeStyle: each axis named set in its units and clamped to its range, null back to the style's own setting), burasagari?: \"none\"|\"standard\"|\"forced\" (Paragraph panel menu › Burasagari None/Regular/Force: an East Asian comma or full stop ending an area type line hangs outside it: when it doesn't fit, or always; new type: \"standard\"), romanHangingPunctuation?: bool (Paragraph panel menu › Roman Hanging Punctuation: quotation marks, hyphens, full stops and commas starting or ending a line hang outside the margin, asterisks, tildes, ellipses, dashes, colons and semicolons by half; off by default), koreanLineBreakAnywhere?: bool (Paragraph panel menu › Korean Line Break Anywhere: a line may break between any two Hangul syllables; off, a word with Hangul in it breaks only at its spaces and punctuation, or where it is wider than the line; new type: false, paragraphs saved before the option: true), kashida?: \"none\"|\"short\"|\"medium\"|\"long\"|\"stylistic\" (Paragraph panel › Insert Kashidas: justified lines of horizontal area type lengthen each Arabic word with a kashida between its last pair of joined letters, at most a quarter, half or whole em long, or whole tatweels up to an em for stylistic, before they widen their word spaces; none by default), composer?: \"singleLine\"|\"everyLine\" (line breaking, Every-line by default), start?: byte, end?: byte} (baselineShift is in document points and hScale includes the object transform; groups include their text descendants; with a range: the character attributes style that range and the paragraph attributes apply to the paragraphs it touches; without: all the text, and graph labels keep the character and paragraph attributes for every label of their kind when the graph is drawn again, the graph still setting each label's alignment; a number or switch given as another type fails the call, and a null value leaves its attribute as it is, so a call with only null values fails with nothing to change; a call that gives the values the text already has records no undo step). Or {paragraphIndents: [{id, start: byte where the paragraph starts, leftIndent?, firstLineIndent?: pt -1296..1296}…]} alone (Tabs panel indent markers over paragraphs with indents of their own): each entry sets one paragraph of a type object, at least one indent each, at most 100000 entries; every entry is checked before anything changes, and an unknown key, a value out of range, an object that is not type, a byte where no paragraph starts or two entries for one paragraph with other values fail the call; all of it is one edit, a threaded story flowing again once, and when no paragraph's indents change nothing is recorded → {ids}", + "{ids?|id?, kerning?: 1/1000 em|\"auto\"|\"optical\", baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), underline?, strikethrough?, allCaps?, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), antiAlias?: \"none\"|\"sharp\"|\"crisp\"|\"strong\" (Character panel › Anti-aliasing Method, how the type's edges are drawn as pixels; it sets each targeted type object, with or without a range; each frame of a thread keeps its own method; graph labels keep it for every label of their kind when the graph is drawn again; new type: \"sharp\"), leftIndent?, rightIndent?, firstLineIndent?, spaceBefore?, spaceAfter?: pt (±1296), list?: \"none\"|\"bullet\"|\"number\", bullet?: \"none\"|\"dot\"|\"dash\"|\"circle\"|\"square\", number?: \"none\"|\"arabic\"|\"upperLetters\"|\"lowerLetters\"|\"upperRoman\"|\"lowerRoman\"|\"twoDigits\"|\"threeDigits\", listAlign?: \"left\"|\"right\", listLevel?: 1..9 (Paragraph panel › Bullets and Numbered List: each paragraph of a list starts with its marker, drawn in the font, size and color of the paragraph's first character, and its text starts at the next tab stop after the marker, the left indent counting as a stop; a bulleted list's marker is its bullet, and a numbered list's is the paragraph's number and a period: 1, 2, 3; A to Z, then AA, BB; a to z, then aa, bb; I, II, III; i, ii, iii; 01 to 99, then 100; 001 to 999, then 1000; letters and roman numerals past 3999 in Arabic digits; the numbers count the story's numbered paragraphs, its threaded frames included, from 1 after a paragraph in no list, and an empty or bulleted paragraph is not counted; list \"bullet\" keeps a list's bullet, else a dot, and list \"number\" keeps a numbered list's style, else arabic; without list, a number style makes a numbered list and a bullet makes a bulleted one; \"none\" in any of the three turns the list off; a paragraph that joins a list with left and first-line indents of 0 gets 18 and -18 unless the call sets an indent; a horizontal right-to-left list paragraph has its indents mirrored, measured from the right; listAlign \"right\" (Bullets and Numbering…'s Alignment) puts the marker against the text, and \"left\" (the default) puts it at the first line's start, the text starting at the same place with either; it sets the paragraphs that are in a list or that the call puts in one, and a list keeps it when it changes between bullets and numbers; listLevel (Tab and Shift+Tab at the start of a list paragraph, Bullets and Numbering…'s Level) is a whole number from 1 to 9 that sets the paragraphs in a list or that the call puts in one, a list keeping it when it changes between bullets and numbers, and a list turned on without listLevel starting at level 1; each level past the first sets the paragraph 18 pt further in than its left indent, and each level counts its own numbers: a list paragraph with text sets the counts of the levels deeper than its own back to 0, so a deeper numbered paragraph after it counts from 1, and a paragraph back at a shallower level goes on with that level's count), hyphenate?: bool, wordsLongerThan?: letters 1..25 (5), afterFirst?, beforeLast?: letters 1..15 (3), hyphenLimit?: lines 0..25 (0: no limit), hyphenationZone?: pt 0..1296 (0; Single-line Composer only), hyphenateCapitalized?: bool (true) (Paragraph panel menu › Hyphenation…: only words longer than wordsLongerThan break, keeping afterFirst letters before the hyphen and beforeLast after it; at most hyphenLimit lines in a row end with a hyphen; a line whose text already ends within hyphenationZone of its right edge breaks before the next word instead of hyphenating it; the counts are rounded, and every value is clamped to its range), wordSpacing?: % 0..1000 (80, 100, 133), letterSpacing?: % of a word space -100..500 (0, 0, 0), glyphScaling?: % 50..200 (100, 100, 100): each [min, desired, max] or {min?, desired?, max?} (Paragraph panel menu › Justification…: Desired applies to every line, Minimum and Maximum bound what justified lines may use; values are clamped to their range, and Minimum ≤ Desired ≤ Maximum must hold afterwards or nothing changes), autoLeading?: % of the size 0..500 (120; the leading of characters whose leading is Auto), singleWordJustification?: \"fullJustify\"|\"alignLeft\"|\"alignCenter\"|\"alignRight\" (a justified line holding one word), mojikumi?: \"none\"|\"yakumonoHankaku\"|\"gyomatsuYakumonoHankaku\"|\"gyomatsuYakumonoZenkaku\"|\"yakumonoZenkaku\"|\"lineEndHalf\" (Mojikumi Set: Japanese punctuation spacing), kinsoku?: \"none\"|\"hard\"|\"soft\" (Kinsoku Set: Soft lets 々, ー and small kana start a line), kinsokuType?: \"pushInFirst\"|\"pushOutFirst\"|\"pushOutOnly\" (Paragraph panel menu › Kinsoku Shori Type: how area type keeps those characters off a line's ends; pushInFirst sets them on the line when its gaps next to CJK characters can close up enough, by at most a tenth of an em each, pushOutFirst does so only when moving the character before them to the next line would leave the line more than an em short, and pushOutOnly, the default, moves it unless Burasagari hangs an overflowing comma or full stop; no effect with kinsoku \"none\"), bunriKinshi?: bool (Paragraph panel menu › Bunri-Kinshi: a line never breaks inside an inseparable pair, two em dashes, two horizontal ellipses, two two-dot leaders or the two halves of a vertical kana repeat mark, and justification adds no space inside one; kept but without effect with kinsoku \"none\"; off by default), direction?: \"auto\"|\"leftToRight\"|\"rightToLeft\" (paragraph direction; auto: from each paragraph's first strong character), leadingModel?: \"romanBaseline\"|\"emBoxTop\" (leading measured baseline to baseline, or em box top to top), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\" (where characters smaller than the largest on their line line up with it), proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings, as text.setRangeStyle: a tate-chu-yoko block moves up or down, right or left, and on a vertical path toward or away from the path's start, to its left or right), warichu?: bool, warichuLines?: 1..6, warichuGap?: pt 0..100, warichuScale?: % 10..100, warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Character panel menu › Warichu and Warichu Settings, as text.setRangeStyle: the characters set smaller and stacked on lines inside their line), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options, as text.setRangeStyle: space before and after each character in reading order), tsume?: % 0..100 (Character panel › Tsume, with Show East Asian Options, as text.setRangeStyle: the share of the blank space beside each character's ink taken away in horizontal type), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, as text.setRangeStyle), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference, as text.setRangeStyle: the height of the font that the size measures), language?: name|tag (Character panel › Language, as text.setRangeStyle), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font, as text.setRangeStyle: each axis named set in its units and clamped to its range, null back to the style's own setting), burasagari?: \"none\"|\"standard\"|\"forced\" (Paragraph panel menu › Burasagari None/Regular/Force: an East Asian comma or full stop ending an area type line hangs outside it: when it doesn't fit, or always; new type: \"standard\"), romanHangingPunctuation?: bool (Paragraph panel menu › Roman Hanging Punctuation: quotation marks, hyphens, full stops and commas starting or ending a line hang outside the margin, asterisks, tildes, ellipses, dashes, colons and semicolons by half; off by default), koreanLineBreakAnywhere?: bool (Paragraph panel menu › Korean Line Break Anywhere: a line may break between any two Hangul syllables; off, a word with Hangul in it breaks only at its spaces and punctuation, or where it is wider than the line; new type: false, paragraphs saved before the option: true), kashida?: \"none\"|\"short\"|\"medium\"|\"long\"|\"stylistic\" (Paragraph panel › Insert Kashidas: justified lines of horizontal area type lengthen each Arabic word with a kashida between its last pair of joined letters, at most a quarter, half or whole em long, or whole tatweels up to an em for stylistic, before they widen their word spaces; none by default), composer?: \"singleLine\"|\"everyLine\" (line breaking, Every-line by default), start?: byte, end?: byte} (baselineShift is in document points and hScale includes the object transform; groups include their text descendants; with a range: the character attributes style that range and the paragraph attributes apply to the paragraphs it touches; without: all the text, and graph labels keep the character and paragraph attributes for every label of their kind when the graph is drawn again, the graph still setting each label's alignment; a number or switch given as another type fails the call, and a null value leaves its attribute as it is, so a call with only null values fails with nothing to change; a call that gives the values the text already has records no undo step). Or {paragraphIndents: [{id, start: byte where the paragraph starts, leftIndent?, firstLineIndent?: pt -1296..1296}…]} alone (Tabs panel indent markers over paragraphs with indents of their own): each entry sets one paragraph of a type object, at least one indent each, at most 100000 entries; every entry is checked before anything changes, and an unknown key, a value out of range, an object that is not type, a byte where no paragraph starts or two entries for one paragraph with other values fail the call; all of it is one edit, a threaded story flowing again once, and when no paragraph's indents change nothing is recorded → {ids}", has_doc, set_format ), @@ -88,7 +88,7 @@ pub fn specs() -> Vec { fn artboard_reorder(s: &mut Session, p: &Value) -> Result { const C: &str = "artboard.reorder"; let i = artboard_index(&s.doc()?.doc, p, C)?; - let to = p.get("to").and_then(Value::as_u64).map(index).ok_or_else(|| bad(C, "missing to"))?; + let to = super::index_opt(p, "to", C)?.ok_or_else(|| bad(C, "missing to"))?; s.edit("Reorder Artboards", |d, _| { if i >= d.artboards.len() { return Err(EngineError::Other("no such artboard".into())); @@ -588,6 +588,7 @@ fn set_format(s: &mut Session, p: &Value) -> Result { "warichuAlign", "akiLeft", "akiRight", + "tsume", "standardVerticalRoman", "noBreak", "digits", @@ -632,6 +633,7 @@ fn set_format(s: &mut Session, p: &Value) -> Result { let tcy_left_right = super::textedit::tcy_offset_param(p, "tcyLeftRight", C)?; let aki_left = super::textedit::aki_param(p, "akiLeft", C)?; let aki_right = super::textedit::aki_param(p, "akiRight", C)?; + let tsume = super::textedit::tsume_param(p, C)?; let warichu_lines = super::textedit::warichu_lines_param(p, C)?; let warichu_gap = super::textedit::warichu_number_param(p, "warichuGap", C)?; let warichu_scale = super::textedit::warichu_number_param(p, "warichuScale", C)?; @@ -816,6 +818,9 @@ fn set_format(s: &mut Session, p: &Value) -> Result { if let Some(v) = aki_right { st.aki_right = v; } + if let Some(v) = tsume { + st.tsume = v; + } if let Some(v) = flag("standardVerticalRoman") { st.standard_vertical_roman = v; } diff --git a/crates/engine/src/cmd/path.rs b/crates/engine/src/cmd/path.rs index 33bde936bf..b497a9f096 100644 --- a/crates/engine/src/cmd/path.rs +++ b/crates/engine/src/cmd/path.rs @@ -12,7 +12,7 @@ use super::draw2::usize_opt; use super::pathops::Beside; use super::{ CommandSpec, Result, Session, bad, check_numbers, check_switches, cmd, f64_or, f64_req, finite_numbers, has_anchors, has_doc, has_selected_path, - has_selection, ids_param, index, number_or, object_param, ok, str_param, switch_or, targets, + has_selection, ids_param, index_opt, number_or, object_param, ok, str_param, switch_or, targets, }; use crate::EngineError; @@ -170,7 +170,7 @@ pub(super) fn path_mut(d: &mut vectorcraft_doc::Document, id: NodeId) -> Result< fn append_anchor(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "path.appendAnchor")?.ok_or_else(|| bad("path.appendAnchor", "missing id"))?; let a = anchor_from_json(p, "path.appendAnchor")?; - let subpath = p.get("subpath").and_then(Value::as_u64).map(|u| u as usize); + let subpath = index_opt(p, "subpath", "path.appendAnchor")?; s.edit("Pen", |d, sel| { let path = path_mut(d, id)?; let si = match subpath { @@ -208,7 +208,7 @@ fn append_anchor(s: &mut Session, p: &Value) -> Result { /// `at` first moves the anchor, its handles with it (the Pen's closing drag with Space held). fn close(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "path.close")?.ok_or_else(|| bad("path.close", "missing id"))?; - let subpath = p.get("subpath").and_then(Value::as_u64).map(|u| u as usize); + let subpath = index_opt(p, "subpath", "path.close")?; let handle = |key: &str| match p.get(key).filter(|h| !h.is_null()) { None => Ok(None), Some(h) => finite_numbers(h).map(|[x, y]| Some(Point::new(x, y))).ok_or_else(|| bad("path.close", format!("`{key}` must be [x, y]"))), @@ -310,18 +310,18 @@ pub(crate) fn transform_anchors(s: &mut Session, label: &str, xf: vectorcraft_ge fn set_handle(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "path.setHandle")?.ok_or_else(|| bad("path.setHandle", "missing id"))?; let si = usize_opt(p, "subpath", "path.setHandle")?.unwrap_or(0); - let ai = p.get("anchor").and_then(Value::as_u64).map(index).ok_or_else(|| bad("path.setHandle", "missing anchor"))?; + let ai = index_opt(p, "anchor", "path.setHandle")?.ok_or_else(|| bad("path.setHandle", "missing anchor"))?; let out = str_param(p, "which") != Some("in"); let pos = Point::new(f64_req(p, "x", "path.setHandle")?, f64_req(p, "y", "path.setHandle")?); let independent = switch_or(p, "independent", false, "path.setHandle")?; // A handle already there, on an anchor already of the kind it would get, changes nothing and - // records no undo step. - if let Some(a) = anchor_of(s, id, si, ai)? { - let mut b = a; - b.set_handle(out, pos, independent); - if b == a { - return ok(); - } + // records no undo step. The handle is compared directly: `set_handle` would recompute the + // other handle of a smooth anchor, which need not give back the same value. + if let Some(a) = anchor_of(s, id, si, ai)? + && (if out { a.h_out } else { a.h_in }) == pos + && !(independent && a.kind != AnchorKind::Corner) + { + return ok(); } s.edit("Reshape", |d, _| { let path = path_mut(d, id)?; @@ -337,7 +337,7 @@ fn set_handle(s: &mut Session, p: &Value) -> Result { fn move_anchor(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "path.moveAnchor")?.ok_or_else(|| bad("path.moveAnchor", "missing id"))?; let si = usize_opt(p, "subpath", "path.moveAnchor")?.unwrap_or(0); - let ai = p.get("anchor").and_then(Value::as_u64).map(index).ok_or_else(|| bad("path.moveAnchor", "missing anchor"))?; + let ai = index_opt(p, "anchor", "path.moveAnchor")?.ok_or_else(|| bad("path.moveAnchor", "missing anchor"))?; let pos = Point::new(f64_req(p, "x", "path.moveAnchor")?, f64_req(p, "y", "path.moveAnchor")?); // An anchor already at (x, y) changes nothing and records no undo step. if let Some(a) = anchor_of(s, id, si, ai)? @@ -453,7 +453,7 @@ pub(super) fn paths_in(d: &vectorcraft_doc::Document, ids: &[NodeId]) -> Vec Result { const C: &str = "path.reverse"; let want = p.get("reversed").map(|v| v.as_bool().ok_or_else(|| bad(C, "`reversed` must be true or false"))).transpose()?; - let subpath = p.get("subpath").and_then(Value::as_u64).map(|u| u as usize); + let subpath = index_opt(p, "subpath", C)?; let ids = paths_in(&s.doc()?.doc, &targets(s, p)?); if ids.is_empty() { return Err(bad(C, "select paths")); @@ -1784,7 +1784,7 @@ fn reshape(s: &mut Session, p: &Value) -> Result { fn insert_anchor(s: &mut Session, p: &Value) -> Result { let id = object_param(p, "id", "path.insertAnchor")?.ok_or_else(|| bad("path.insertAnchor", "missing id"))?; let si = usize_opt(p, "subpath", "path.insertAnchor")?.unwrap_or(0); - let seg = p.get("segment").and_then(Value::as_u64).map(index).ok_or_else(|| bad("path.insertAnchor", "missing segment"))?; + let seg = index_opt(p, "segment", "path.insertAnchor")?.ok_or_else(|| bad("path.insertAnchor", "missing segment"))?; let t = number_or(p, "t", 0.5, "path.insertAnchor")?.clamp(0.0, 1.0); let idx = s.edit("Add Anchor Point", |d, sel| { let path = path_mut(d, id)?; diff --git a/crates/engine/src/cmd/perspgrid.rs b/crates/engine/src/cmd/perspgrid.rs index d13e7d8c52..aaeee36d80 100644 --- a/crates/engine/src/cmd/perspgrid.rs +++ b/crates/engine/src/cmd/perspgrid.rs @@ -19,7 +19,7 @@ use vectorcraft_tools::distort::perspective::widget::{WidgetCorner, WidgetPlace} use vectorcraft_tools::distort::perspective::{GridDefinition, PerspectiveGrid}; use vectorcraft_tools::{PointerEvent, PointerKind, ToolKey}; -use super::distortcmds::{grid_of, silent, store_grid}; +use super::distortcmds::{grid_kept, grid_of, silent, store_grid}; use super::{CommandSpec, EngineError, Result, Session, always, bad, bool_or, cmd, has_doc, str_param, switch_or, unique_name}; pub fn specs() -> Vec { @@ -261,10 +261,21 @@ pub(crate) fn grid_preset(s: &mut Session, p: &Value) -> Result { let g = s.perspective_preset_grid(&name, ab).ok_or_else(|| bad(C, format!("no perspective grid preset named `{name}`")))?; // The objects stay attached and the view options stay as they were. let g = PerspectiveGrid { attached: old.attached, locked: old.locked, lock_station: old.lock_station, snap: old.snap, rulers: old.rulers, ..g }; - s.edit("Perspective Grid Preset", |d, _| { - store_grid(d, &g); - Ok(()) - })?; + // When the document holds this grid already, apart from whether it shows and its active plane, + // the preset only sets those two, without an undo step (as perspective.grid.show and + // perspective.plane.set do). + let view = PerspectiveGrid { visible: old.visible, plane: old.plane, ..g.clone() }; + if !grid_kept(&s.doc()?.doc, &view) { + s.edit("Perspective Grid Preset", |d, _| { + store_grid(d, &g); + Ok(()) + })?; + } else if (old.visible, old.plane) != (g.visible, g.plane) { + silent(s, |cur| { + cur.visible = g.visible; + cur.plane = g.plane; + })?; + } Ok(g.definition_json()) } diff --git a/crates/engine/src/cmd/place.rs b/crates/engine/src/cmd/place.rs index 20f19ef803..a558545e4e 100644 --- a/crates/engine/src/cmd/place.rs +++ b/crates/engine/src/cmd/place.rs @@ -962,8 +962,10 @@ pub(crate) fn image_info(s: &mut Session, p: &Value) -> Result { (None, [id]) => *id, _ => return Err(bad(C, "select one image or pass id")), }; - // An image in opacity-mask art or a definition's art is found by its id too (`links.list`). - let n = st.doc.stored_node(id).map(|(n, _)| &**n).ok_or(EngineError::NoNode(id))?; + // An image in opacity-mask art, a definition's art or a stored brush's art is found by its id + // too (`links.list`). + let doc = super::links::with_brush_art(&st.doc); + let n = doc.stored_node(id).map(|(n, _)| &**n).ok_or(EngineError::NoNode(id))?; let NodeKind::Image(im) = &n.kind else { return Err(bad(C, format!("object {} is not an image", id.0))) }; // Effective resolution: 72 pt per inch over the points one pixel spans along each axis. let [a, b, c, d, ..] = im.xf.as_coeffs(); diff --git a/crates/engine/src/cmd/place/document.rs b/crates/engine/src/cmd/place/document.rs index 8e4afaa295..8b00e95152 100644 --- a/crates/engine/src/cmd/place/document.rs +++ b/crates/engine/src/cmd/place/document.rs @@ -330,7 +330,8 @@ pub(crate) fn node(d: &mut Document, s: &Source, link: LinkInfo, bounding: bool) } /// `d` for output: linked images and placed documents that keep only their previews get their -/// files back, else output as their previews, with a warning. +/// files back, else output as their previews, with a warning. The art of the stored brushes counts +/// too. pub(crate) fn full_documents(d: &Document) -> (Cow<'_, Document>, Vec) { let (d, mut warnings) = super::super::links::full_linked_images(d, Default::default()); let doc = match &d { @@ -339,7 +340,7 @@ pub(crate) fn full_documents(d: &Document) -> (Cow<'_, Document>, Vec) { }; let mut need: Vec = vec![]; let mut seen = std::collections::HashSet::new(); - doc.visit_placed(|_, p| { + super::super::links::with_brush_art(doc).visit_placed(|_, p| { if doc.images.get(&p.key).is_some_and(ImageBlob::is_proxy) && seen.insert(p.key.clone()) { need.push(p.clone()); } @@ -370,7 +371,7 @@ pub(crate) fn full_documents(d: &Document) -> (Cow<'_, Document>, Vec) { "{n} placed documents output as their previews: their files can't be found, or changed since they were read (relink or update them)" ), }); - out.placed_as_previews(&previews); + super::super::links::editing_brush_art(&mut out, |out| out.placed_as_previews(&previews)); } (Cow::Owned(out), warnings) } diff --git a/crates/engine/src/cmd/plugin.rs b/crates/engine/src/cmd/plugin.rs index 3fa082bdb0..867f256b4c 100644 --- a/crates/engine/src/cmd/plugin.rs +++ b/crates/engine/src/cmd/plugin.rs @@ -51,6 +51,7 @@ use vectorcraft_doc::{Effect, Node}; use vectorcraft_plugins::{Budget, Command, Kind, Plugin, effect, export, objects, registry, safe_mode}; use super::{CommandSpec, EngineError, NodeId, Result, Session, always, bad, cmd, has_doc, ids_param, str_param, switch_or}; +use crate::store::StoreTurn; use vectorcraft_plugins::permissions::{self, Grant, GrantToken, Permission}; @@ -683,6 +684,9 @@ thread_local! { /// Tests: runs once in the next `plugin.install` on this thread after it installs and before it /// writes the store. pub(crate) static BEFORE_STORE: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; + /// Tests: runs once on this thread when [`keep_installed`] has written the module to the store + /// and before it writes the grant. + pub(crate) static BEFORE_GRANT_STORED: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; /// Tests: runs once on this thread when [`hold_plugin_changes`] finds the lock held and waits. pub(crate) static WHILE_WAITING: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; } @@ -718,7 +722,9 @@ pub(crate) fn hold_plugin_changes() -> std::sync::MutexGuard<'static, ()> { /// the next start → its `plugin.list` entry. A refused install changes neither the plug-in store /// nor the plug-ins and grants of the process. A module that lists no permissions ends any grant /// held for its id. A `plugin.remove` in another session waits until the install has written the -/// store. +/// store. With a plug-in store, all of it happens in a turn on the store ([`StoreTurn`]), so another +/// process using the same folder changes it before or after; when the store can't be locked, nothing +/// is installed. fn install(s: &mut Session, p: &Value) -> Result { const C: &str = "plugin.install"; // One use: spent whatever this install does. @@ -736,8 +742,11 @@ fn install(s: &mut Session, p: &Value) -> Result { { return Err(bad(C, "the module doesn't have the SHA-256 `hash` gives: nothing was installed")); } - // A removal in another session waits until the store holds what this install wrote. + // A removal in another session waits until the store holds what this install wrote, and so + // does a change of the store by another process. let _held = hold_plugin_changes(); + let turn = + s.plugin_store_turn().map_err(|e| EngineError::Other(format!("{C}: {}: {e}: nothing was installed", crate::store::STORE_NOT_LOCKED)))?; // The grant the checks below count on, the approval included. The install checks it again, // with the plug-in installed under the id, before anything is stored: another session may // change either in between. @@ -844,41 +853,12 @@ fn install(s: &mut Session, p: &Value) -> Result { } // The plug-in gets the settings and cache kept for its id. A module without permissions takes // the id over, so nothing the user approved for the id applies any more. - let installed = registry::install_checked(plugin, update, check, || s.attach_plugin_storage(&id), err)?; + let installed = registry::install_checked(plugin, update, check, || s.attach_plugin_storage(&turn, &id), err)?; #[cfg(test)] if let Some(between) = BEFORE_STORE.take() { between(); } - // Installed plug-ins stay installed after a restart (#2541). The module is written first and its - // grant only once it is there; when the grant can't be written, the store gets the module it - // held back. A failed write of that module is only logged: the store then holds the new module, - // which the grant doesn't cover. A write that reports a failure may still have put the old - // module back, so the store is read again to tell which module it holds. A stored module that - // can't be read back isn't replaced by one that needs a grant. - let previous = s.stored_plugin_bytes(&id); - let mut stored = (previous.is_ok() || !asks) && s.store_plugin(&id, &bytes); - let holds_new = |s: &Session| s.stored_plugin_bytes(&id).is_ok_and(|held| held.as_deref() == Some(&bytes[..])); - if asks { - if stored && !s.store_grant(&id, Some(g)) { - stored = !s.put_back_plugin(&id, previous.ok().flatten().as_deref()) && holds_new(s); - } - } else { - // When the write failed, the old stored module stays in the folder and needs its grant at - // the next launch. A grant that can't be removed still approves the old bytes, so the store - // gets the module it held back. When that module can't be read or written back, or there - // was none, no module goes with the grant, and the grant stops counting for every session in - // the process attached to the folder. A grants file that is too large or doesn't hold a list - // approves nothing, and the new module stays; one that can't be opened or read may approve - // the old bytes once it reads again. - let writes = s.grant_writes(); - if stored && !s.store_grant(&id, None) && s.holds_plugin_grant(&id) { - let back = previous.as_ref().is_ok_and(|held| s.put_back_plugin(&id, held.as_deref())); - stored = !back && holds_new(s); - if !back || matches!(previous, Ok(None)) { - s.ignore_stored_grant(&id, writes); - } - } - } + let stored = keep_installed(s, &turn, &id, &bytes, asks.then_some(g)); // Installing a disabled plug-in again (an updated version) turns it on for the next launch too, // also when it is disabled by its stored file alone (it stopped a launch while loading). When // the new version could not replace the stored file, the old one stays disabled. @@ -891,8 +871,9 @@ fn install(s: &mut Session, p: &Value) -> Result { } } if changed { - s.store_disabled_plugins(); + s.store_disabled_plugins_in(&turn); } + drop(turn); let mut v = describe_installed(&installed); if !unknown.is_empty() { v["unknownCommands"] = json!(unknown); @@ -900,6 +881,53 @@ fn install(s: &mut Session, p: &Value) -> Result { Ok(v) } +/// Keeps the plug-in `id` that `plugin.install` installed, its module `bytes`, in the plug-in store, +/// in `turn`, with `grant` when its module lists permissions (`None`: it lists none, and the grant +/// held for the id is removed) → whether the store now holds the new module (`false` without a +/// store). +/// +/// Installed plug-ins stay installed after a restart (#2541). The module is written first and its +/// grant only once it is there; when the grant can't be written, the store gets the module it held +/// back. A failed write of that module is only logged: the store then holds the new module, which +/// the grant doesn't cover. A write that reports a failure may still have put the old module back, +/// so the store is read again to tell which module it holds. A stored module that can't be read back +/// isn't replaced by one that needs a grant. +pub(crate) fn keep_installed(s: &Session, turn: &StoreTurn, id: &str, bytes: &[u8], grant: Option) -> bool { + let asks = grant.is_some(); + let previous = s.stored_plugin_bytes(id); + let mut stored = (previous.is_ok() || !asks) && s.store_plugin(turn, id, bytes); + #[cfg(test)] + if let Some(between) = BEFORE_GRANT_STORED.take() { + between(); + } + let holds_new = |s: &Session| s.stored_plugin_bytes(id).is_ok_and(|held| held.as_deref() == Some(bytes)); + match grant { + Some(g) => { + if stored && !s.store_grant_in(turn, id, Some(g)) { + stored = !s.put_back_plugin(turn, id, previous.ok().flatten().as_deref()) && holds_new(s); + } + } + None => { + // When the write failed, the old stored module stays in the folder and needs its grant + // at the next launch. A grant that can't be removed still approves the old bytes, so the + // store gets the module it held back. When that module can't be read or written back, or + // there was none, no module goes with the grant, and the grant stops counting for every + // session in the process attached to the folder. A grants file that is too large or + // doesn't hold a list approves nothing, and the new module stays; one that can't be + // opened or read may approve the old bytes once it reads again. + let writes = s.grant_writes(); + if stored && !s.store_grant_in(turn, id, None) && s.holds_plugin_grant(id) { + let back = previous.as_ref().is_ok_and(|held| s.put_back_plugin(turn, id, held.as_deref())); + stored = !back && holds_new(s); + if !back || matches!(previous, Ok(None)) { + s.ignore_stored_grant(id, writes); + } + } + } + } + stored +} + /// `plugin.inspect`: what installing the module would install, without installing it, whether that /// needs the user to grant its permissions first (`needsApproval`) and whether it would take /// another module's place (`needsReplace`). @@ -992,15 +1020,17 @@ fn load_folder(s: &Session, folder: &str) -> Value { None if crate::file_access::current().is_none() => Ok(()), None => Err(format!("automation path rejected: {} isn't valid text", f.display())), }; - // A `plugin.install` in another session finishes writing the store first. + // A `plugin.install` in another session or process finishes writing the store first. When the + // store can't be locked, the folder still loads, and the store isn't written. let _held = hold_plugin_changes(); + let turn = s.plugin_store_turn().unwrap_or_else(|_| StoreTurn::unheld()); match registry::load_folder_where(std::path::Path::new(folder), allow, s.plugin_folder_approver()) { Ok(r) => { for id in &r.loaded { - s.attach_plugin_storage(id); + s.attach_plugin_storage(&turn, id); } if r.disabled_changed { - s.store_disabled_plugins(); + s.store_disabled_plugins_in(&turn); } json!({"folder": folder, "loaded": r.loaded, "failed": r.failed.iter().map(|(f, e)| json!({"file": f, "error": e})).collect::>()}) } @@ -1140,6 +1170,9 @@ fn set_enabled(s: &mut Session, p: &Value) -> Result { (None, None) => return Err(bad(C, "give `id` or `file` (see plugin.safeMode)")), }; let items: Vec<&safe_mode::Item> = std::iter::once(&item).chain(stored.as_ref()).collect(); + // The list is changed and saved in one turn on the plug-in store, so that an install in another + // process doesn't change the store in between. + let turn = s.plugin_store_turn().ok(); if enabled && !safe_mode::disabled().iter().any(|i| items.iter().any(|item| i.same(item))) { return Err(bad(C, "that plug-in isn't disabled (see plugin.safeMode)")); } @@ -1149,7 +1182,7 @@ fn set_enabled(s: &mut Session, p: &Value) -> Result { } // Without a plug-in folder (a session confined to automation roots), or when the list there // can't take the change, the change stays in this process and goes with the next change that saves. - let saved = !changed || s.store_disabled_plugins(); + let saved = !changed || turn.as_ref().is_some_and(|turn| s.store_disabled_plugins_in(turn)); Ok(json!({"changed": changed, "saved": saved, "disabled": safe_mode::disabled().iter().map(shown_item).collect::>()})) } @@ -1164,31 +1197,35 @@ fn info(_: &mut Session, p: &Value) -> Result { fn remove(s: &mut Session, p: &Value) -> Result { let id = str_param(p, "id").ok_or_else(|| bad("plugin.remove", "missing `id`"))?; - // An install in another session finishes its store writes first. + // An install in another session or process finishes its store writes first. When the store + // can't be locked, nothing is removed. let _held = hold_plugin_changes(); + let turn = s + .plugin_store_turn() + .map_err(|e| EngineError::Other(format!("plugin.remove: {}: {e}: nothing was removed", crate::store::STORE_NOT_LOCKED)))?; let installed = registry::get(id).is_some(); // Settings and cache the store keeps for an id that isn't installed are deleted too. let stored = !installed && vectorcraft_plugins::manifest::valid_id(id) && s.has_plugin_storage(id); // Installed again, it asks again. A grant that can't be removed still approves the module, and // so may a grants file that can't be opened or read. One that is too large or doesn't hold a // list approves nothing and doesn't stop the removal. - let forget = || s.store_grant(id, None) || !s.holds_plugin_grant(id); + let forget = || s.store_grant_in(&turn, id, None) || !s.holds_plugin_grant(id); // Its settings and cache are moved aside and its grant removed before anything is deleted: when // either can't be done, the plug-in stays installed, as it was, and a second `plugin.remove` // tries again. let failed = if installed || stored { - s.remove_plugin_storage(id, forget).err().map(|e| e.to_string()) + s.remove_plugin_storage(&turn, id, forget).err().map(|e| e.to_string()) } else { (!forget()).then(|| crate::store::GRANT_NOT_REMOVED.to_string()) }; if let Some(e) = failed { if installed { - s.attach_plugin_storage(id); + s.attach_plugin_storage(&turn, id); } return Err(EngineError::Other(e)); } registry::revoke(id); - s.unstore_plugin(id); + s.unstore_plugin(&turn, id); if !stored && (!installed || !registry::remove(id)) { return Err(err(vectorcraft_plugins::Error::NotFound(id.into()))); } @@ -1248,7 +1285,7 @@ pub fn specs() -> Vec { "Install Plug-in", [], None, - "{path: a .wasm file (desktop) | dataBase64: the module (+ name?: shown as its source), replace?: bool (true once the user agreed: a module with other bytes than the plug-in installed with its id, or with none installed, one whose id has settings or a cache in the plug-in store, installs only with it, takes that plug-in's place and gets its settings and cache; false: one whose id is installed is refused; left out, the same module installs again), name?: file name (with dataBase64), allowHeavy?: bool (a filter whose manifest asks for a heavy budget, budget \"heavy\" in plugin.inspect, installs only with it), grant?: [permission] (a plug-in whose manifest lists permissions, needsApproval in plugin.inspect, installs only when grant holds every one of them; the grant is recorded with the module's hash and covers only that module, so a module with other bytes needs a new grant even when it lists the same permissions; installing a module that lists no permissions forgets the grant held for its id; a refused install keeps the grant, a failed write of the module to the plug-in store leaves the grant in the store, and a stored module that is disabled or not read in Safe Mode keeps the grant for its id; with a plug-in store attached, only the grants kept there count; a request's allowHeavy and grant are refused unless the session was started with vectorcraft-cli --allow-plugin-grants: in the desktop app a person approves the install, see ui.installPlugin, and a module whose hash is already recorded, by a person's approval or by a grant accepted under that flag, needs no grant), hash?: string (the module's SHA-256 as plugin.inspect gave it: a module with other bytes is refused)} validate and install a WebAssembly plug-in for this session (a module whose commandAllowlist names a command no plug-in may call, such as one that reads or writes files, is refused) → its plugin.list entry, plus unknownCommands?: [id] (commandAllowlist ids no command has; a call of one fails)", + "{path: a .wasm file (desktop) | dataBase64: the module (+ name?: shown as its source), replace?: bool (true once the user agreed: a module with other bytes than the plug-in installed with its id, or with none installed, one whose id has settings or a cache in the plug-in store, installs only with it, takes that plug-in's place and gets its settings and cache; false: one whose id is installed is refused; left out, the same module installs again), name?: file name (with dataBase64), allowHeavy?: bool (a filter whose manifest asks for a heavy budget, budget \"heavy\" in plugin.inspect, installs only with it), grant?: [permission] (a plug-in whose manifest lists permissions, needsApproval in plugin.inspect, installs only when grant holds every one of them; the grant is recorded with the module's hash and covers only that module, so a module with other bytes needs a new grant even when it lists the same permissions; installing a module that lists no permissions forgets the grant held for its id; a refused install keeps the grant, a failed write of the module to the plug-in store leaves the grant in the store, and a stored module that is disabled or not read in Safe Mode keeps the grant for its id; with a plug-in store attached, only the grants kept there count; a request's allowHeavy and grant are refused unless the session was started with vectorcraft-cli --allow-plugin-grants: in the desktop app a person approves the install, see ui.installPlugin, and a module whose hash is already recorded, by a person's approval or by a grant accepted under that flag, needs no grant), hash?: string (the module's SHA-256 as plugin.inspect gave it: a module with other bytes is refused)} validate and install a WebAssembly plug-in for this session (with a plug-in store, the install waits while another window or process changes the store and writes the module and its grant before that window or process changes it again; when the store's disabled.lock can't be locked, nothing is installed) (a module whose commandAllowlist names a command no plug-in may call, such as one that reads or writes files, is refused) → its plugin.list entry, plus unknownCommands?: [id] (commandAllowlist ids no command has; a call of one fails)", always, install ), @@ -1266,7 +1303,7 @@ pub fn specs() -> Vec { "Remove Plug-in", [], None, - "{id} uninstall a plug-in (its live effects then leave the geometry as it is) and delete the settings and cache it kept (when their folder can't be moved aside, or its grant can't be removed from the plug-in store, the command fails and the plug-in stays installed; when the settings can't be moved back either, the error names the folder they stay in, and the next load, install or removal of the plug-in moves them back); for an id that isn't installed, deletes the settings and cache the plug-in store still keeps for it → {removed}", + "{id} uninstall a plug-in (its live effects then leave the geometry as it is) and delete the settings and cache it kept (when their folder can't be moved aside, or its grant can't be removed from the plug-in store, the command fails and the plug-in stays installed; when the settings can't be moved back either, the error names the folder they stay in, and the next load, install or removal of the plug-in moves them back); for an id that isn't installed, deletes the settings and cache the plug-in store still keeps for it; it waits while another window or process changes the plug-in store, and when the store's disabled.lock can't be locked, the command fails and nothing is removed → {removed}", always, remove ), diff --git a/crates/engine/src/cmd/recolor.rs b/crates/engine/src/cmd/recolor.rs index ede74545b6..11c4744f47 100644 --- a/crates/engine/src/cmd/recolor.rs +++ b/crates/engine/src/cmd/recolor.rs @@ -34,7 +34,7 @@ pub fn specs() -> Vec { "Recolor Artwork", ["Edit", "Edit Colors"], None, - "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex)], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour] (what `group` is rewritten with; default: the rows' new colours, in order, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", + "{map: rows [{from: [colour keys (recolor.colors) or \"#rrggbb\" (every colour shown as that hex)], to: colour (hex, key, {c,m,y,k} or {l,a,b}) | null (in from, to and groupColors, #rrggbbaa and #rgba are refused), exclude?: false (the row's colours are kept), tint?: 100 (percent; with limitTo, art linked to the global or spot swatch the new color is takes this share of its tint)}] | {\"key or #rrggbb\": colour, …} (one row per colour), method?: \"exact\" (default)|\"preserveTints\"|\"scaleTints\"|\"tintsShades\"|\"hueShift\" (how a row's colours take its new colour, relative to the row's darkest, average or most saturated colour), limitTo?: swatch library id or name; or \"document\" (the document's swatches): new colours snap to its nearest colour, group?: colour group to rewrite, groupColors?: [colour] (what `group` is rewritten with; default: the rows' new colours, in order, excluded rows left out), rename?: the group's new name, includeImages?: true, includePatterns?: true, globalAdjust?: {saturation?: 0, brightness?: 0, temperature?: 0, luminosity?: 0} (Global Adjust: percent from -100 to 100, 0 changes nothing; every colour a row that isn't excluded recolours, and the group's new colours, take the same change after the row's new colour: saturation scales HSB saturation by 1 + saturation/100, brightness moves HSB brightness that share of the way to full or to black, temperature adds 0.2 × temperature/100 to red and takes it from blue, luminosity moves Lab lightness that share of the way to 100 or 0 keeping a and b; with limitTo each row's new colour takes the change before it snaps to the library)} recolour the selection (gradients, text, meshes, image pixels and pattern tiles included; each new colour keeps the model of the one it replaces (model?: \"keep\" default | \"new\" (the new colour's own model, so a CMYK colour replacing RGB art gives CMYK art) | \"document\" (the document's colour mode)), except a library swatch's with limitTo: art takes the swatch itself, linked to a global or spot colour at its tints, and the swatch joins the document's swatches; art linked to a global swatch of `group` that is rewritten with its row's new color stays linked to it, at its tint, unless the row converts the color into the art's model; other recolored art, and art in a row linked to a global swatch of `group` that is rewritten with another color, keeps its row's new color and loses its swatch link) and the group, as one undo step (none when nothing changes). On a path directly in a graph series, the graph also stores the new paint of the topmost visible fill and stroke, and on a graph label the new paint of its characters and rows for every label of its kind (docs/mcp.md) → {changed, swatches: [names added to the document's swatches], relinked?: with group, the other paints linked to its global swatches that took their new colors, note?: set when a colour kept a model other than its new colour's (see model), notChanged: {locked, hidden} (as edit.colors.invert), warning?: set when notChanged counts any object}", has_doc, apply ), @@ -1724,7 +1724,7 @@ fn apply(s: &mut Session, p: &Value) -> Result { let mut out = json!({ "changed": changed, "swatches": added }); not_changed.report(&mut out); if let Some(e) = edit { - e.defaults(s); + e.defaults(s)?; out["relinked"] = json!(e.relinked()); } if converted { diff --git a/crates/engine/src/cmd/recovery.rs b/crates/engine/src/cmd/recovery.rs index de4d145840..e5107c247b 100644 --- a/crates/engine/src/cmd/recovery.rs +++ b/crates/engine/src/cmd/recovery.rs @@ -1176,6 +1176,7 @@ pub fn jobs(s: &mut Session, store: &Arc) -> Result<(Vec Vec { "Run Script", [], None, - "{path?: a .js or .jsx file | source?: the script's text (exactly one of the two), name?: the name errors and the report use (default: the script's #script line, else the path's file name, or \"script\"), args?: {…} (at most 1 MiB as JSON; vc.args in the script), answers?: [{kind: alert|confirm|prompt, value: \"ok\" (alert) | true or false (confirm) | text or null (prompt)}] (for a run with nobody to ask: the answers to its dialogs, in order; at most 10000 and 1 MiB as JSON; refused in the app, where the person answers; an empty object is an empty list), maxFuel?: whole number from 1 to 100000000000 (instructions in all; default 1000000000)} run a JavaScript file against the open documents, through the vc object: vc.run(id, params) runs a command and returns its result, a failed command throws an error the script can catch and puts back the documents and the session state it changed, while any file it wrote stays written and is named; vc.document is a snapshot of the active document or null; vc.commands lists the commands a script may run; vc.log(value) adds to the report and the Script Console (script.console); $.write(...values) writes the values to the Script Console as String(value) gives them, and $.writeln(...values) does the same and ends the line; $.evalFile(path, timeout?) runs a file with the same globals and returns its last value (timeout, in milliseconds from 0, is taken and not waited on), $.fileName is the file being run (empty for text), $.includePath the #includepath list and $.engineName the engine's name (VectorCraft without #targetengine); alert(message[, title, errorIcon]), confirm(message[, noAsDflt, title]) and prompt(message, preset[, title]) open a dialog with a Stop button (default title \"Script Alert\"; message and preset as String(value) gives them; errorIcon and noAsDflt as Boolean(value) gives them; No is the default with noAsDflt): alert returns undefined, confirm true for Yes and false for No, prompt the field's text for OK and null for Cancel; in the app the run waits at the call for the person's answer and Stop ends it as script.stop does, a dialog cannot open inside a callback of a built-in, a getter, a conversion or a file $.evalFile runs and throws there (an #include file's code is the script's own and can), and a run with nobody to ask takes the next of answers, and ends when none is left or the next is for another kind of dialog, or when the script ends with answers unused; vc.args is args. Before anything runs, the script's preprocessor lines (# or //@ at the start of a line, outside strings and comments) are read: #include \"file\" and //@include put that file's text in place of the line, looked for beside the file that includes it, then in each #includepath folder in turn (separated by ;, relative to that file's folder; a later #includepath replaces the list), then in each JSINCLUDE folder; #script names the run; #target takes any value and changes nothing; #strict on makes an assignment to a read-only or getter-only property, or a new property on an object that is not extensible (preventExtensions, seal, freeze, vc, $), throw a TypeError, without the rest of ES5 strict mode, and #strict off turns that off (the last #strict line of the script and its includes sets the run; off without one; a $.evalFile file's own line holds for its code); #targetengine name runs the script in the named engine, whose globals and functions stay for the next run that names it until script.engine.drop drops it or the session ends (script.engines lists them; a name of letters, digits and _ not starting with a digit, or a quoted one of 1 to 64 bytes without control characters, matched as written; only in the script itself, once, before its code and #include lines; main, and a script without the line, get a new engine each run; a session keeps 8 named engines, a ninth name is refused, each has 64 MiB of heap, and an uncaught error, a limit or script.stop keeps the globals the run set while the documents go back; host functions kept in a global act for the run that calls them; an error in code an earlier run compiled is at that run's file, line and column, within 8 MiB of source maps kept for each engine, the oldest going first; not on the web); #engine is refused as unsupported, any other #name as unknown, and another //@name is a comment. A script run from a file reads its includes and $.evalFile's files only in that file's folder and the folders below it, refusing a path with a .. name or a link that leads out (a JSINCLUDE folder outside is passed over); a script given as text reads none. File(path) and Folder(path) name files and folders and read them in the same folders, and inside the automation read roots when they are set: exists, length, created, modified, getFiles(mask or function; at most 2048 entries), resolve, and open('r') with read, readln, readch, seek, tell and close; a path outside, a network or device path and a link that leads out give false or null with error \"Script file access denied\", a file is read whole at most 8 MiB (checked from its size first) and a run reads at most 32 MiB, and writing, the file dialogs and execute return false or null with error set. An error in another file is at that file's line and column; vc.api.version and vc.api.has(feature) describe the API. The run is one transaction: on success each changed document gets one undo step, Run Script, and each preference it changed keeps its value, and on an uncaught error, a limit or script.stop every open document and the session go back as they were; files a command wrote before that stay written and are named. While it runs, other commands that change anything end with a busy error. Commands that change anything outside the documents (script.*, except script.check, plugin.*, prefs.*, actionSet.*, shortcutSet.*, help.*, print.*, library.*, importMatches.*, edit.undoGroup.*, file.recovery.*, stroke.widthProfile.*, saving, importing or deleting a preset, text.addFontFiles, text.findFontFiles, text.rescanFonts, links.findFiles, file.place.queue, color.loadProfile, color.removeProfile, file.print, view.proofSetup, view.proofColors, view.overprintPreview, view.separationsPreview) throw. VectorCraft's own limits: 8 MiB of source a file and 32 MiB in all, 64 included or evaluated files 16 deep, 1024 paths looked up for them, 256 MiB of heap (128 MiB on the web), 2000000 host calls, 200000000 instructions without a pause, 64 levels, 16 MiB and 1048576 entries for a value crossing to or from a command, 10000 log entries and 4 MiB of log, 16 KiB of a dialog's message, 256 bytes of its title and 16 KiB of a prompt's preset (past these a RangeError), and 100000 objects and 512 MiB of new document data, past which a person is asked to continue or stop and a run with nobody to ask ends → {ok: true, name, changed: [document names], written: [paths], log: [values], fuelUsed, hostCalls, runTimeMs (the time the script ran, its commands included, waits between frames and for a person's answer left out; 0 without a clock), timingAvailable (false on the web), hostCallCounts: {vcRun, documentReads, commandListReads, vcLog, consoleWrites, fileCalls, fileExecutes}, slowestCommands: [{id, calls, totalMs, maxMs}] (at most 5, the longest in all first, then by id), console: {lines: [text], droppedLines, truncatedLines} (the run's own output, vc.log lines and error), dialogs: [{kind, message, title, errorIcon (alert), noAsDefault (confirm), preset (prompt), answer: \"ok\" | true | false | text | null | \"stop\" | \"missing\"}] (in the order they opened, at most 10000 and 1 MiB), dialogCount, dialogsTruncated}, or, in the app, {running: true, name} and the report later in ui.inspect's scriptReport; a run that fails ends with its error, and its report there also has kind, message, line, column, file (when the error is in another file than the script, or in code an earlier run of its engine compiled), fuelLeft, fuelUsed, hostCalls and the fields above", + "{path?: a .js or .jsx file | source?: the script's text (exactly one of the two), name?: the name errors and the report use (default: the script's #script line, else the path's file name, or \"script\"), args?: {…} (at most 1 MiB as JSON; vc.args in the script), answers?: [{kind: alert|confirm|prompt, value: \"ok\" (alert) | true or false (confirm) | text or null (prompt)}] (for a run with nobody to ask: the answers to its dialogs, in order; at most 10000 and 1 MiB as JSON; refused in the app, where the person answers; an empty object is an empty list), maxFuel?: whole number from 1 to 100000000000 (instructions in all; default 1000000000)} run a JavaScript file against the open documents, through the vc object: vc.run(id, params) runs a command and returns its result, a failed command throws an error the script can catch and puts back the documents and the session state it changed, while any file it wrote stays written and is named; vc.document is a snapshot of the active document or null; vc.commands lists the commands a script may run; vc.log(value) adds to the report and the Script Console (script.console); $.write(...values) writes the values to the Script Console as String(value) gives them, and $.writeln(...values) does the same and ends the line; $.evalFile(path, timeout?) runs a file with the same globals and returns its last value (timeout, in milliseconds from 0, is taken and not waited on), $.fileName is the file of the code that reads it (the file being run for code that eval or Function compiled; empty for code compiled from a script given as text), $.includePath the #includepath list and $.engineName the engine's name (VectorCraft without #targetengine); alert(message[, title, errorIcon]), confirm(message[, noAsDflt, title]) and prompt(message, preset[, title]) open a dialog with a Stop button (default title \"Script Alert\"; message and preset as String(value) gives them; errorIcon and noAsDflt as Boolean(value) gives them; No is the default with noAsDflt): alert returns undefined, confirm true for Yes and false for No, prompt the field's text for OK and null for Cancel; in the app the run waits at the call for the person's answer and Stop ends it as script.stop does, a dialog cannot open inside a callback of a built-in, a getter, a conversion or a file $.evalFile runs and throws there (an #include file's code is the script's own and can), and a run with nobody to ask takes the next of answers, and ends when none is left or the next is for another kind of dialog, or when the script ends with answers unused; vc.args is args. Before anything runs, the script's preprocessor lines (# or //@ at the start of a line, outside strings and comments) are read: #include \"file\" and //@include put that file's text in place of the line, looked for beside the file that includes it, then in each #includepath folder in turn (separated by ;, relative to that file's folder; a later #includepath replaces the list), then in each JSINCLUDE folder; #script names the run; #target takes any value and changes nothing; #strict on makes an assignment to a read-only or getter-only property, or a new property on an object that is not extensible (preventExtensions, seal, freeze, vc, $), throw a TypeError, without the rest of ES5 strict mode, and #strict off turns that off (the last #strict line of the script and its includes sets the run; off without one; a $.evalFile file's own line holds for its code); #targetengine name runs the script in the named engine, whose globals and functions stay for the next run that names it until script.engine.drop drops it or the session ends (script.engines lists them; a name of letters, digits and _ not starting with a digit, or a quoted one of 1 to 64 bytes without control characters, matched as written; only in the script itself, once, before its code and #include lines; main, and a script without the line, get a new engine each run; a session keeps 8 named engines, a ninth name is refused, each has 64 MiB of heap, and an uncaught error, a limit or script.stop keeps the globals the run set while the documents go back; host functions kept in a global act for the run that calls them; an error in code an earlier run compiled is at that run's file, line and column, within 8 MiB of source maps kept for each engine, the oldest going first; not on the web); #engine is refused as unsupported, any other #name as unknown, and another //@name is a comment. A script run from a file reads its includes and $.evalFile's files only in that file's folder and the folders below it, refusing a path with a .. name or a link that leads out (a JSINCLUDE folder outside is passed over); a script given as text reads none. File(path) and Folder(path) name files and folders and read them in the same folders, and inside the automation read roots when they are set: exists, length, created, modified, getFiles(mask or function; at most 2048 entries), resolve, and open('r') with read, readln, readch, seek, tell and close; a path outside, a network or device path and a link that leads out give false or null with error \"Script file access denied\", a file is read whole at most 8 MiB (checked from its size first) and a run reads at most 32 MiB, and writing, the file dialogs and execute return false or null with error set. An error in another file is at that file's line and column; vc.api.version and vc.api.has(feature) describe the API. The run is one transaction: on success each changed document gets one undo step, Run Script, and each preference it changed keeps its value, and on an uncaught error, a limit or script.stop every open document and the session go back as they were; files a command wrote before that stay written and are named. While it runs, other commands that change anything end with a busy error. Commands that change anything outside the documents (script.*, except script.check, plugin.*, prefs.*, actionSet.*, shortcutSet.*, help.*, print.*, library.*, importMatches.*, edit.undoGroup.*, file.recovery.*, stroke.widthProfile.*, saving, importing or deleting a preset, text.addFontFiles, text.findFontFiles, text.rescanFonts, links.findFiles, file.place.queue, color.loadProfile, color.removeProfile, file.print, view.proofSetup, view.proofColors, view.overprintPreview, view.separationsPreview) throw. VectorCraft's own limits: 8 MiB of source a file and 32 MiB in all, 64 included or evaluated files 16 deep, 1024 paths looked up for them, 256 MiB of heap (128 MiB on the web), 2000000 host calls, 200000000 instructions without a pause, 64 levels, 16 MiB and 1048576 entries for a value crossing to or from a command, 10000 log entries and 4 MiB of log, 16 KiB of a dialog's message, 256 bytes of its title and 16 KiB of a prompt's preset (past these a RangeError), and 100000 objects and 512 MiB of new document data, past which a person is asked to continue or stop and a run with nobody to ask ends → {ok: true, name, changed: [document names], written: [paths], log: [values], fuelUsed, hostCalls, runTimeMs (the time the script ran, its commands included, waits between frames and for a person's answer left out; 0 without a clock), timingAvailable (false on the web), hostCallCounts: {vcRun, documentReads, commandListReads, vcLog, consoleWrites, fileCalls, fileExecutes}, slowestCommands: [{id, calls, totalMs, maxMs}] (at most 5, the longest in all first, then by id), console: {lines: [text], droppedLines, truncatedLines} (the run's own output, vc.log lines and error), dialogs: [{kind, message, title, errorIcon (alert), noAsDefault (confirm), preset (prompt), answer: \"ok\" | true | false | text | null | \"stop\" | \"missing\"}] (in the order they opened, at most 10000 and 1 MiB), dialogCount, dialogsTruncated}, or, in the app, {running: true, name} and the report later in ui.inspect's scriptReport; a run that fails ends with its error, and its report there also has kind, message, line, column, file (when the error is in another file than the script, or in code an earlier run of its engine compiled), fuelLeft, fuelUsed, hostCalls and the fields above", always, run ), diff --git a/crates/engine/src/cmd/stroke.rs b/crates/engine/src/cmd/stroke.rs index c5e5ba2a5c..14282c5112 100644 --- a/crates/engine/src/cmd/stroke.rs +++ b/crates/engine/src/cmd/stroke.rs @@ -22,7 +22,7 @@ pub fn specs() -> Vec { "Stroke Options", ["Window", "Stroke"], None, - "{weight?: pt, cap?: butt|round|square, join?: miter|round|bevel, miterLimit?, align?: center|inside|outside, dash?: [d,g,…]|null (a 0 dash with a round or projecting cap draws dots or squares; a new pattern keeps the current offset and alignment), dashOffset? (exact dashes only), alignDashes?: bool (true: dashes fitted to corners and path ends, every run between them holding whole periods with a dash centred on each corner and end; false, the default for a new pattern: exact lengths), startArrow?, endArrow?: Arrow|ArrowOpen|LineArrow|Barbed|Concave|DoubleArrow|HalfArrowLeft|HalfArrowRight|Chevron|Feather|Swallowtail|Triangle|TriangleOpen|TriangleReverse|TriangleBar|Kite|Leaf|Drop|Circle|CircleOpen|HalfCircle|Oval|Target|Square|SquareOpen|Tag|TagOpen|Diamond|DiamondOpen|Hexagon|HexagonOpen|Star|Cross|Plus|Bar|DoubleBar|DotOnBar|Slash|DoubleSlash|Bracket|Fork|null|{custom: name} (a custom arrowhead of the arrowheads file, stroke.arrowheads.list)|{Custom: {name, path}} (a custom head with its art, as document.inspect reports one; refused when the path fills no area, parts thinner than a millionth of a head unit counting as none, or has more than 4096 anchors, more than 4096 subpaths or a point more than 64 head units from the tip) (HalfArrowLeft/Right: one barb, left or right of the direction the head points), arrowAlign?: \"extend\" (tip past the end point, default)|\"tip\" (tip on the end point; the stroke is shortened), profile?: \"uniform\"|\"lens\"|\"taperStart\"|\"taperEnd\"|\"pinch\"|\"teardrop\"|\"wave\"|a saved profile's name (stroke.widthProfile.list), widthPoints?, gradientMode? (as document.inspect reports them in strokeOptions, so those read back unchanged; ignored here: a custom profile is set with the Width tool, gradientMode with paint.editGradient), item?: stroke item index|null (omitted: the Appearance panel's active item if it is a stroke, else the top stroke, created when missing), ids?|id?, target?: \"object\"|\"contents\", aligned?: bool (index and item are rows of the first target's stack: each other target edits its equal one, as the Appearance panel does for a mixed selection)} Without a stroke item, type takes weight, cap, join, miterLimit, align (around its glyph outlines; the type stays live) and the dash options as its characters' stroke (every run; text.setRangeStyle `strokeOptions` styles a range), and images and symbol instances (also in groups) are left alone. With nothing selected (and no ids) they set up the next object drawn (appearance.newArt; weight always does). On a path directly in a graph series, the graph also stores a weight it changes on the topmost visible stroke (docs/mcp.md); on a graph label's stroke row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind → {objects: how many objects took the stroke options}", + "{weight?: pt, cap?: butt|round|square, join?: miter|round|bevel, miterLimit?, align?: center|inside|outside, dash?: [d,g,…]|null (a 0 dash with a round or projecting cap draws dots or squares; a new pattern keeps the current offset and alignment), dashOffset? (exact dashes only), alignDashes?: bool (true: dashes fitted to corners and path ends, every run between them holding whole periods with a dash centred on each corner and end; false, the default for a new pattern: exact lengths), startArrow?, endArrow?: Arrow|ArrowOpen|LineArrow|Barbed|Concave|DoubleArrow|HalfArrowLeft|HalfArrowRight|Chevron|Feather|Swallowtail|Triangle|TriangleOpen|TriangleReverse|TriangleBar|Kite|Leaf|Drop|Circle|CircleOpen|HalfCircle|Oval|Target|Square|SquareOpen|Tag|TagOpen|Diamond|DiamondOpen|Hexagon|HexagonOpen|Star|Cross|Plus|Bar|DoubleBar|DotOnBar|Slash|DoubleSlash|Bracket|Fork|null|{custom: name} (a custom arrowhead of the arrowheads file, stroke.arrowheads.list)|{Custom: {name, path}} (a custom head with its art, as document.inspect reports one; refused when the path fills no area, parts thinner than a millionth of a head unit counting as none, or has more than 4096 anchors, more than 4096 subpaths or a point more than 64 head units from the tip) (HalfArrowLeft/Right: one barb, left or right of the direction the head points), arrowAlign?: \"extend\" (tip past the end point, default)|\"tip\" (tip on the end point; the stroke is shortened), profile?: \"uniform\"|\"lens\"|\"taperStart\"|\"taperEnd\"|\"pinch\"|\"teardrop\"|\"wave\"|a saved profile's name (stroke.widthProfile.list), widthPoints?, gradientMode? (as document.inspect reports them in strokeOptions, so those read back unchanged; ignored here: a custom profile is set with the Width tool, gradientMode with paint.editGradient), item?: stroke item index|null (omitted: the Appearance panel's active item if it is a stroke, else the top stroke, created when missing), ids?|id?, target?: \"object\"|\"contents\", aligned?: bool (index and item are rows of the first target's stack: each other target edits its equal one, as the Appearance panel does for a mixed selection)} Without a stroke item, type takes weight, cap, join, miterLimit, align (around its glyph outlines; the type stays live) and the dash options as its characters' stroke (every run; text.setRangeStyle `strokeOptions` styles a range), and images and symbol instances (also in groups) are left alone. With nothing selected (and no ids) they set up the next object drawn (appearance.newArt; weight always does). On a path directly in a graph series, the graph also stores a weight it changes on the topmost visible stroke (docs/mcp.md); on a graph label's stroke row, the graph stores the label's topmost visible fill and stroke rows for every label of its kind, and on its characters the stroke options they take → {objects: how many objects took the stroke options}", has_doc, stroke_set ), @@ -31,7 +31,7 @@ pub fn specs() -> Vec { "Stroke Weight Up", [], Some("Cmd+Alt+."), - "{ids?|id?} raise each selected stroke's weight by one step of Units › Stroke (a quarter unit below one unit, then whole units; up to 1000 pt), each from its own weight: the selected objects' active or top stroke, type's stroked characters; objects without a stroke are left alone. With nothing selected (and no ids), the weight of the next object drawn. On a path directly in a graph series, the graph also stores the new weight of the topmost visible stroke (docs/mcp.md) → {objects}", + "{ids?|id?} raise each selected stroke's weight by one step of Units › Stroke (a quarter unit below one unit, then whole units; up to 1000 pt), each from its own weight: the selected objects' active or top stroke, type's stroked characters; objects without a stroke are left alone. With nothing selected (and no ids), the weight of the next object drawn. On a path directly in a graph series, the graph also stores the new weight of the topmost visible stroke, and on a graph label the new weight of its characters' stroke or its stroke row for every label of its kind (docs/mcp.md) → {objects}", has_doc, |s, p| stroke_step(s, p, true) ), diff --git a/crates/engine/src/cmd/style.rs b/crates/engine/src/cmd/style.rs index 370664f795..e58f109d20 100644 --- a/crates/engine/src/cmd/style.rs +++ b/crates/engine/src/cmd/style.rs @@ -21,7 +21,7 @@ use vectorcraft_color::Paint; use vectorcraft_doc::{Appearance, DEFAULT_GRAPHIC_STYLE, Document, GraphicStyle, Node, NodeId, NodeKind, Shared}; use vectorcraft_geom::Rect; -use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, index, object_param, ok, str_param, unique_name}; +use super::{CommandSpec, Result, Session, always, bad, bool_or, cmd, has_doc, index_opt, object_param, ok, str_param, unique_name}; use crate::EngineError; pub fn specs() -> Vec { @@ -40,7 +40,7 @@ pub fn specs() -> Vec { "New Graphic Style", ["Window", "Graphic Styles"], None, - "{name?, id?} a style from object `id` or the first selected object: its appearance, opacity, blend mode, isolate and knockout (a group without fills or strokes of its own lends its topmost object's, type its characters'; a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own stands for the topmost path directly in it; placed gradients are kept relative to its bounds); links the object. Names are made unique → {name}", + "{name?, id?} a style from object `id` or the first selected object: its appearance, opacity, blend mode, isolate and knockout (a group without fills or strokes of its own lends its topmost object's, type its characters'; a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own stands for the topmost path directly in it; placed gradients are kept relative to its bounds); links the object, unless it is the art of a graph design in a series. Names are made unique → {name}", has_doc, style_new ), @@ -68,7 +68,7 @@ pub fn specs() -> Vec { "Redefine Graphic Style", ["Window", "Appearance"], None, - "{name?, id?} replace the style (default: the one the object was last linked to) with the look of object `id` or the first selected object (a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own: the topmost path directly in it); the objects still linked to it update, and that object becomes linked. A linked graph series group passes the style to the paths directly in it, other than the source and paths linked to the style whose look was edited, and is left cleared (as appearance.clear) and unlinked. On a linked path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, the graph stores the label's topmost visible fill and stroke rows and object opacity and blend mode for every label of its kind → {name}", + "{name?, id?} replace the style (default: the one the object was last linked to) with the look of object `id` or the first selected object (a graph series group with no fill, stroke, effect, opacity, blend mode, isolation, knockout or style link of its own: the topmost path directly in it); the objects still linked to it update, and that object becomes linked. The art of a graph design in a series keeps its look and is unlinked, as the source or as a linked object. A linked graph series group passes the style to the paths directly in it, other than the source and paths linked to the style whose look was edited, and is left cleared (as appearance.clear) and unlinked. On a linked path directly in a graph series, the graph also stores the paint, weight, opacity and blend mode of the topmost visible fill and stroke and the object's opacity and blend mode (exceptions: docs/mcp.md); on a graph label, the graph stores the label's topmost visible fill and stroke rows and object opacity and blend mode for every label of its kind → {name}", has_doc, style_redefine ), @@ -392,8 +392,10 @@ fn style_new(s: &mut Session, p: &Value) -> Result { None => d.new_graphic_style_name(), }; let g = GraphicStyle { id: d.next_graphic_style_id(), ..GraphicStyle::of(name.clone(), captured(n), n) }; + // The art of a graph design in a series is not linked: the graph draws it again from the design. + let link = (!super::graph::is_design_art(d, src)).then_some(g.id); s.edit("New Graphic Style", |d, _| { - set_link(d, &[src], Some(g.id)); + set_link(d, &[src], link); d.graphic_styles.push(g); Ok(()) })?; @@ -491,10 +493,12 @@ fn style_redefine(s: &mut Session, p: &Value) -> Result { s.edit_named("Redefine Graphic Style “{name}”", &name, false, |d, _| { let id = d.graphic_style_id(i); let old = std::mem::replace(&mut d.graphic_styles[i], GraphicStyle { name: name.clone(), id, ..look }); - // Objects still linked follow the new definition; edited ones are unlinked (they keep - // their look), and the source keeps its own. + // Objects still linked follow the new definition; edited ones are unlinked (they keep their look), and the + // source keeps its own. The art of a graph design in a series is unlinked and keeps its look too, as the + // source or as a linked object: the graph draws it again from the design. let linked = objects_where(d, |n| n.extras().graphic_style == Some(id) && n.id != src); - let (follow, edited): (Vec, Vec) = linked.into_iter().partition(|nid| d.node(*nid).is_some_and(|n| in_sync(n, &old))); + let (follow, edited): (Vec, Vec) = + linked.into_iter().partition(|nid| !super::graph::is_design_art(d, *nid) && d.node(*nid).is_some_and(|n| in_sync(n, &old))); set_link(d, &edited, None); // A linked graph series group passes the style to the paths directly inside it, so the graph stores it, and // goes back to the empty appearance the graph draws it with. The source and the edited paths keep their look. @@ -509,7 +513,8 @@ fn style_redefine(s: &mut Session, p: &Value) -> Result { } super::appearance::capture_series_writes(&before, d, &follow_marks, (true, true), (true, true), false, true); super::graph::capture_label_rows(d, &follow_marks); - set_link(d, &[src], Some(id)); + let link = (!super::graph::is_design_art(d, src)).then_some(id); + set_link(d, &[src], link); Ok(()) })?; Ok(json!({ "name": name })) @@ -585,10 +590,10 @@ fn style_merge(s: &mut Session, p: &Value) -> Result { fn style_move(s: &mut Session, p: &Value) -> Result { let cmd = "graphicStyle.move"; let name = str_param(p, "name").ok_or_else(|| bad(cmd, "missing name"))?; - let to = p.get("to").and_then(Value::as_u64).ok_or_else(|| bad(cmd, "missing `to` (an index)"))?; + let to = index_opt(p, "to", cmd)?.ok_or_else(|| bad(cmd, "missing `to` (an index)"))?; let d = &s.doc()?.doc; let from = style_index(d, name)?; - let to = index(to).min(d.graphic_styles.len() - 1); + let to = to.min(d.graphic_styles.len() - 1); if from == to { return ok(); } diff --git a/crates/engine/src/cmd/stylelib.rs b/crates/engine/src/cmd/stylelib.rs index 09b478e8c7..bc06f197e5 100644 --- a/crates/engine/src/cmd/stylelib.rs +++ b/crates/engine/src/cmd/stylelib.rs @@ -62,7 +62,7 @@ pub fn specs() -> Vec { "Other Library…", ["Window", "Graphic Style Libraries"], None, - "{path? | data?: file text | dataBase64?, name?: file name (default: the path's)} load a .vcstyles library, or the graphic styles of any document VectorCraft opens (see document.formats), for the library panel (Window → Graphic Style Libraries lists it until the app quits; a file of the user library folder, or a file with the same extension and bytes as one there, opens as that User Defined library) → {library: id, name, count}", + "{path? | data?: file text | dataBase64?, name?: file name (default: the path's)} load a .vcstyles library, or the graphic styles of any document VectorCraft opens (see document.formats), for the library panel (Window → Graphic Style Libraries lists it until the app quits; a file of the user library folder, or a file with the same extension and bytes as one there, opens as that User Defined library; a .ai or EPS style painting with one of the file's gradients by name takes it at the style's angle, fitted to each object it is applied to, VectorCraft's own placement) → {library: id, name, count}", always, load ), diff --git a/crates/engine/src/cmd/swatch.rs b/crates/engine/src/cmd/swatch.rs index d0713a243a..3388b8344b 100644 --- a/crates/engine/src/cmd/swatch.rs +++ b/crates/engine/src/cmd/swatch.rs @@ -19,7 +19,7 @@ pub fn specs() -> Vec { "New Swatch", ["Window", "Swatches"], None, - "{name?, color? | colors?: [colour] (one swatch each, in one undo step; #rrggbbaa and #rgba are refused) | swatch? | gradient? | pattern?: name (default: the current fill), tint?: 0..100 (% of the global or spot `swatch`, or of the one the current fill links to), mode?: \"gray\"|\"rgb\"|\"hsb\"|\"lab\"|\"cmyk\"|\"web\" (convert the colour; lab: CIE L*a*b*, how spot colours are usually defined), global?, spot? (a spot colour, always global), group?: colour group name (solid colours only; default: ungrouped), none?: true (the None paint), paint?: paint.setFill params, keepModel?: bool (as paint.setFill)} save a colour, gradient or pattern as a swatch. A tint of a global or spot colour (below 100%, without mode, global or spot) becomes a tint swatch, \"Name 40%\", linked to its base: it follows edits to the base and applies as that tint of it. A gradient swatch holds no link to the swatch its gradient came from, and a pattern swatch holds the pattern untransformed. Names are unique (\"Sky 2\"); a colour's default name is its values (\"C=10 M=20 Y=30 K=0\", \"R=255 G=128 B=0\", \"Gray K=40\", \"L=55 a=60 b=40\") → {name, names: [every new swatch]}", + "{name?, color? | colors?: [colour] (one swatch each, in one undo step; #rrggbbaa and #rgba are refused) | swatch? | gradient? | pattern?: name (default: the current fill), tint?: 0..100 (% of the global or spot `swatch`, or of the one the current fill links to), mode?: \"gray\"|\"rgb\"|\"hsb\"|\"lab\"|\"cmyk\"|\"web\" (convert the colour; lab: CIE L*a*b*, how spot colours are usually defined), global?, spot? (a spot colour, always global), group?: colour group name (solid colours only; default: ungrouped), none?: true (the None paint), paint?: paint.setFill params, keepModel?: bool (as paint.setFill)} save a colour, gradient or pattern as a swatch. A tint of a global or spot colour (below 100%, without mode, global or spot) becomes a tint swatch, \"Name 40%\", linked to its base: it follows edits to the base and applies as that tint of it. A gradient swatch keeps the gradient's aspect (with or without start/end) and holds no link to the swatch its gradient came from, and a pattern swatch holds the pattern untransformed. Names are unique (\"Sky 2\"); a colour's default name is its values (\"C=10 M=20 Y=30 K=0\", \"R=255 G=128 B=0\", \"Gray K=40\", \"L=55 a=60 b=40\") → {name, names: [every new swatch]}", has_doc, swatch_new ), @@ -48,7 +48,7 @@ pub fn specs() -> Vec { "Swatch Options", ["Window", "Swatches"], None, - "{name, newName?, color? (e.g. {l, a, b} for a Lab colour; #rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill; the swatch's own color and a color given with mode keep their model), mode?: \"gray\"|\"rgb\"|\"hsb\"|\"lab\"|\"cmyk\"|\"web\" (convert the colour), global?, spot? (spot colours are always global), paint?: paint.setFill params ({color}, {gradient}, {swatch} or {pattern}) replacing the swatch's colour; gradient or pattern with one of the same kind} edit a swatch in any colour group, as one undo step. Fills, strokes, text, gradient stops and tint swatches linked to a global swatch take its new colour (at their own tint) and name; turning Global off unlinks them (they keep their colour). Colour, mode and spot apply to solid colours only; a tint swatch only takes a new name (edit its base) → {name, relinked: paints changed}", + "{name, newName?, color? (e.g. {l, a, b} for a Lab colour; #rrggbbaa and #rgba are refused), keepModel?: bool (as paint.setFill; the swatch's own color and a color given with mode keep their model), mode?: \"gray\"|\"rgb\"|\"hsb\"|\"lab\"|\"cmyk\"|\"web\" (convert the colour), global?, spot? (spot colours are always global), paint?: paint.setFill params ({color}, {gradient} or {swatch}) or {pattern: name} replacing the swatch's colour; gradient or pattern with one of the same kind (stored as swatch.new stores it: a gradient keeps its aspect with or without start/end and holds no swatch link; a pattern is untransformed)} edit a swatch in any colour group, as one undo step. Fills, strokes, text, gradient stops and tint swatches linked to a global swatch take its new colour (at their own tint) and name; turning Global off unlinks them (they keep their colour). Colour, mode and spot apply to solid colours only; a tint swatch only takes a new name (edit its base) → {name, relinked: paints changed}", has_doc, swatch_edit ), @@ -187,11 +187,7 @@ fn swatch_new(s: &mut Session, p: &Value) -> Result { })), Paint::None => Err(bad(C, "a swatch needs a colour, gradient or pattern")), _ if spot || mode.is_some() || group.is_some() => Err(bad(C, "spot, mode and group apply to solid colours only")), - // The swatch holds the gradient itself, not a link to the swatch it may have come from. - // It keeps `geom`, which holds the aspect the swatch is applied with. - Paint::Gradient(g) => Ok(Paint::Gradient(Box::new(vectorcraft_color::GradientPaint { swatch: None, ..*g }))), - // The swatch holds the pattern untransformed, not the placement of the art it came from. - Paint::Pattern { pattern, .. } => Ok(pattern_paint(&pattern)), + paint @ (Paint::Gradient(_) | Paint::Pattern { .. }) => Ok(stored_paint(paint, p)), }) .collect::>>()?; // A name applies to a single new swatch. @@ -220,6 +216,27 @@ fn swatch_new(s: &mut Session, p: &Value) -> Result { Ok(json!({ "name": names[0], "names": names })) } +/// A gradient or pattern `paint`, parsed from the paint params `p`, as a new or edited swatch +/// stores it. +fn stored_paint(paint: Paint, p: &Value) -> Paint { + match paint { + // A gradient given an `aspect` but no vector is placed on a box so that the swatch keeps + // the aspect, as `paint.setFill` places it on each object. + Paint::Gradient(ref g) if g.geom.is_none() && g.freeform.is_none() => { + match super::gradient::place_paint(&paint, p, Some(vectorcraft_geom::Rect::new(0.0, 0.0, 100.0, 100.0))) { + Paint::Gradient(g) => Paint::Gradient(Box::new(vectorcraft_color::GradientPaint { swatch: None, ..*g })), + other => other, + } + } + // The swatch holds the gradient itself, not a link to the swatch it may have come from. + // It keeps `geom`, which holds the aspect the swatch is applied with. + Paint::Gradient(g) => Paint::Gradient(Box::new(vectorcraft_color::GradientPaint { swatch: None, ..*g })), + // The swatch holds the pattern untransformed, not the placement of the art it came from. + Paint::Pattern { pattern, .. } => pattern_paint(&pattern), + other => other, + } +} + /// The `names` list and `name` parameters, without repeats; at least one is required. pub(super) fn names_param(p: &Value, cmd: &str) -> Result> { let mut seen: HashSet = HashSet::new(); @@ -322,7 +339,7 @@ fn swatch_delete(s: &mut Session, p: &Value) -> Result { super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(C, e))?; Ok(unlinked) })?; - map_default_paints(s, &mut unlink); + map_default_paints(s, &mut unlink)?; Ok(json!({"deleted": names, "unlinked": unlinked})) } @@ -660,20 +677,41 @@ impl Relink { renamed || recolored } - fn defaults(&self, s: &mut Session) { - map_default_paints(s, &mut |c, l, t| self.apply(c, l, t)); + fn defaults(&self, s: &mut Session) -> Result<()> { + map_default_paints(s, &mut |c, l, t| self.apply(c, l, t)) } } -/// Apply a swatch-link rewrite to the default fill and stroke for new art, except during a live -/// preview (Cancel rolls the document back, not the session). -pub(super) fn map_default_paints(s: &mut Session, f: &mut LinkFn) { - if s.in_interaction() { - return; +/// Apply a swatch-link rewrite to the fill and stroke new art takes and to the paints of its +/// template appearance, except during a live preview (Cancel rolls the document back, not the +/// session). A `command.batch` step rewrites them as the command run on its own does: a failed +/// batch, and a canceled batch preview, put back the paints the batch started with. A change is +/// recorded with the step just made, so Undo and Redo put these paints back with the document. +pub(super) fn map_default_paints(s: &mut Session, f: &mut LinkFn) -> Result<()> { + if s.in_interaction() && s.batch_stash.is_none() { + return Ok(()); } - for p in [&mut s.paint.fill, &mut s.paint.stroke] { - p.map_links(f); + let start = super::colormgmt::new_art_colors_before(s)?; + let pd = &mut s.paint; + let template = pd.appearance.iter_mut().flat_map(|a| a.items.iter_mut()).map(|it| match it { + vectorcraft_doc::AppearanceItem::Fill(f) => &mut f.paint, + vectorcraft_doc::AppearanceItem::Stroke(s) => &mut s.paint, + }); + let mut changed = false; + for p in [&mut pd.fill, &mut pd.stroke].into_iter().chain(template) { + changed |= p.map_links(f); } + if changed { + super::colormgmt::record_new_art_colors(s, start)?; + // The step takes the paints the command finally leaves, after the selection's appearance + // is inherited. + let st = s.doc()?; + if st.interaction.is_none() { + let uid = st.uid; + s.batch_paint_docs.push(uid); + } + } + Ok(()) } /// Apply a swatch-link rewrite to the document ([`Document::map_solid_paints`]) and to the art of @@ -845,12 +883,21 @@ fn swatch_edit(s: &mut Session, p: &Value) -> Result { } // A replacement paint of the swatch's kind (a dropped colour or edited gradient). let paint = match p.get("paint").filter(|v| !v.is_null()) { - Some(v) => match (if given("mode") { paint_from(s, &keeping_model(v))? } else { paint_from(s, v)? }, &sw.paint) { + Some(v) => match ( + // A pattern by name, as `swatch.new` takes it. + match str_param(v, "pattern") { + Some(pat) if d.pattern(pat).is_some() => Some(pattern_paint(pat)), + Some(pat) => return Err(bad(C, format!("no pattern `{pat}`"))), + None if given("mode") => paint_from(s, &keeping_model(v))?, + None => paint_from(s, v)?, + }, + &sw.paint, + ) { (Some(Paint::Solid { color, .. }), Paint::Solid { .. }) => Some(Paint::solid(color)), - (Some(Paint::Gradient(g)), Paint::Gradient(_)) => { - Some(Paint::Gradient(Box::new(vectorcraft_color::GradientPaint { geom: None, swatch: None, ..*g }))) + // Stored as `swatch.new` stores it. + (Some(new @ Paint::Gradient(_)), Paint::Gradient(_)) | (Some(new @ Paint::Pattern { .. }), Paint::Pattern { .. }) => { + Some(stored_paint(new, v)) } - (Some(new @ Paint::Pattern { .. }), Paint::Pattern { .. }) => Some(new), _ => return Err(bad(C, format!("`{name}` takes a paint of its own kind (colour, gradient or pattern)"))), }, None => None, @@ -888,7 +935,7 @@ fn swatch_edit(s: &mut Session, p: &Value) -> Result { super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(C, e))?; Ok(relinked) })?; - relink.defaults(s); + relink.defaults(s)?; Ok(json!({"name": to, "relinked": relinked})) } @@ -1084,7 +1131,7 @@ fn swatch_merge(s: &mut Session, p: &Value) -> Result { super::paint::check_colorized_kept(colorized_ok, d).map_err(|e| bad(C, e))?; Ok(relinked) })?; - map_default_paints(s, &mut relink); + map_default_paints(s, &mut relink)?; Ok(json!({"name": keep, "merged": merged, "relinked": relinked})) } @@ -1141,7 +1188,7 @@ fn swatch_spot_options(s: &mut Session, p: &Value) -> Result { let relinked = map_swatch_links(d, &mut follow_bases(&bases)); Ok((relinked, bases)) })?; - map_default_paints(s, &mut follow_bases(&bases)); + map_default_paints(s, &mut follow_bases(&bases))?; Ok(json!({"useLab": use_lab, "relinked": relinked})) } @@ -1165,8 +1212,11 @@ pub(super) struct GroupEdit { impl GroupEdit { /// Apply the link changes to the default fill and stroke for new art. - pub(super) fn defaults(&self, s: &mut Session) { - self.relinks.iter().for_each(|r| r.defaults(s)); + pub(super) fn defaults(&self, s: &mut Session) -> Result<()> { + if self.relinks.is_empty() { + return Ok(()); + } + map_default_paints(s, &mut |c, l, t| self.relinks.iter().any(|r| r.apply(c, l, t))) } /// How many paints linked to the group's swatches the rewrite changed. @@ -1242,6 +1292,6 @@ fn swatch_edit_group(s: &mut Session, p: &Value) -> Result { colors.into_iter().enumerate().map(|(i, c)| if old.get(i) == Some(&Some(c)) { c } else { super::paint::new_color(s, p, c) }).collect(); let rename = str_param(p, "rename"); let e = s.edit("Edit Color Group", |d, _| rewrite_group(d, group, &colors, rename, C))?; - e.defaults(s); + e.defaults(s)?; Ok(json!({"name": e.name, "swatches": e.swatches, "relinked": e.relinked})) } diff --git a/crates/engine/src/cmd/swatchlib.rs b/crates/engine/src/cmd/swatchlib.rs index 8101cfff97..ed712d8509 100644 --- a/crates/engine/src/cmd/swatchlib.rs +++ b/crates/engine/src/cmd/swatchlib.rs @@ -980,7 +980,7 @@ fn reset_defaults(s: &mut Session, p: &Value) -> Result { Ok(added) })?; if replace { - map_default_paints(s, &mut |_, l, _| unlink_dead(&live, l)); + map_default_paints(s, &mut |_, l, _| unlink_dead(&live, l))?; } Ok(json!({ "added": added })) } diff --git a/crates/engine/src/cmd/symbollib.rs b/crates/engine/src/cmd/symbollib.rs index 98b46a5d1a..7ddc6e4bb2 100644 --- a/crates/engine/src/cmd/symbollib.rs +++ b/crates/engine/src/cmd/symbollib.rs @@ -13,7 +13,7 @@ use std::sync::{Arc, LazyLock}; use serde_json::{Value, json}; use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::{Appearance, Document, Node, NodeId, NodeKind, Symbol, SymbolNineSlice}; -use vectorcraft_geom::{Affine, Point, Rect, shapes}; +use vectorcraft_geom::{Affine, Anchor, AnchorKind, PathData, Point, Rect, SubPath, shapes}; use super::brushsym::{CURRENT_SYMBOL, natural_size, normalize, place_xf, set_natural_size}; use super::clipboard::Clipboard; @@ -160,6 +160,7 @@ pub const BUILTIN: &[BuiltinSymbolLibrary] = &[ BuiltinSymbolLibrary { id: "map-markers", name: "Map Markers", make: map_markers }, BuiltinSymbolLibrary { id: "inventory-icons", name: "Inventory Icons", make: inventory_icons }, BuiltinSymbolLibrary { id: "skill-icons", name: "Skill Icons", make: skill_icons }, + BuiltinSymbolLibrary { id: "weather-icons", name: "Weather Icons", make: weather_icons }, ]; /// Built-in library `id`, made once. @@ -358,6 +359,140 @@ fn skill_icons() -> SymbolLibrary { SymbolLibrary { name: "Skill Icons".into(), doc } } +/// Weather Icons: sun, moon, cloud, rain, thunder and snow for weather/status art (original, no 9-slice). +fn weather_icons() -> SymbolLibrary { + // 1. Sun: Central circular disk with radial rays. + let mut sun_subpaths = Vec::new(); + sun_subpaths.extend(shapes::ellipse(Rect::new(-8.5, -8.5, 8.5, 8.5)).subpaths); + for i in 0..8 { + let angle = (i as f64) * std::f64::consts::PI / 4.0; + let (sin, cos) = angle.sin_cos(); + let r_in = 11.5; + let r_out = 18.5; + let w = 1.5; + let p1 = Point::new(r_in * cos - w * sin, r_in * sin + w * cos); + let tip = Point::new(r_out * cos, r_out * sin); + let p2 = Point::new(r_in * cos + w * sin, r_in * sin - w * cos); + sun_subpaths.push(SubPath::polyline(&[p1, tip, p2], true)); + } + let sun = PathData::new(sun_subpaths); + + // 2. Moon: Crescent moon shape. + let moon_anchors = vec![ + Anchor { p: Point::new(3.0, -17.0), h_in: Point::new(-2.0, -10.0), h_out: Point::new(-8.0, -17.0), kind: AnchorKind::Corner }, + Anchor { p: Point::new(-16.0, 0.0), h_in: Point::new(-16.0, -9.0), h_out: Point::new(-16.0, 9.0), kind: AnchorKind::Smooth }, + Anchor { p: Point::new(5.0, 16.0), h_in: Point::new(-6.0, 16.0), h_out: Point::new(0.0, 8.0), kind: AnchorKind::Corner }, + Anchor { p: Point::new(-4.0, -1.0), h_in: Point::new(-4.0, 6.0), h_out: Point::new(-4.0, -8.0), kind: AnchorKind::Smooth }, + ]; + let moon = PathData::single(SubPath { anchors: moon_anchors, closed: true }); + + // Helper for cloud contour + let cloud_subpath = |offset_y: f64, scale: f64| -> SubPath { + let mut pts = Vec::new(); + let base_y = 8.0 * scale + offset_y; + pts.push(Point::new(9.0 * scale, base_y)); + pts.push(Point::new(-9.0 * scale, base_y)); + + let c1 = Point::new(-9.0 * scale, 2.0 * scale + offset_y); + let r1 = 6.0 * scale; + let steps_lobe = 8; + for i in 1..=steps_lobe { + let a = std::f64::consts::FRAC_PI_2 + (i as f64) * std::f64::consts::PI / (steps_lobe as f64); + pts.push(Point::new(c1.x + r1 * a.cos(), c1.y + r1 * a.sin())); + } + + let c2 = Point::new(0.0, -3.0 * scale + offset_y); + let r2 = 9.0 * scale; + let a_start = -2.973; + let a_end = -0.169; + let steps_top = 10; + for i in 1..=steps_top { + let a = a_start + (i as f64) * (a_end - a_start) / (steps_top as f64); + pts.push(Point::new(c2.x + r2 * a.cos(), c2.y + r2 * a.sin())); + } + + let c3 = Point::new(9.0 * scale, 2.0 * scale + offset_y); + let r3 = 6.0 * scale; + for i in 1..steps_lobe { + let a = -std::f64::consts::FRAC_PI_2 + (i as f64) * std::f64::consts::PI / (steps_lobe as f64); + pts.push(Point::new(c3.x + r3 * a.cos(), c3.y + r3 * a.sin())); + } + + SubPath::polyline(&pts, true) + }; + + // 3. Cloud: Merged circular lobes with a flat base. + let cloud = PathData::single(cloud_subpath(0.0, 1.0)); + + // 4. Rain: Cloud outline with angled falling droplet/dash lines. + let mut rain_subpaths = vec![cloud_subpath(-4.0, 0.9)]; + let drops = [(-6.0, 6.0), (0.0, 8.0), (6.0, 6.0)]; + for &(x0, y0) in &drops { + let (dx, dy) = (-2.0, 6.0); + let w = 1.0; + let d = [Point::new(x0 + w, y0), Point::new(x0 + dx + w, y0 + dy), Point::new(x0 + dx - w, y0 + dy), Point::new(x0 - w, y0)]; + rain_subpaths.push(SubPath::polyline(&d, true)); + } + let rain = PathData::new(rain_subpaths); + + // 5. Thunder: Angular zigzag lightning bolt polygon. + let bolt = [(3.0, -18.0), (-8.0, -1.0), (-1.0, -1.0), (-5.0, 18.0), (8.0, 1.0), (1.0, 1.0)]; + let bolt_pts: Vec = bolt.iter().map(|&(x, y)| Point::new(x, y)).collect(); + let thunder = PathData::single(SubPath::polyline(&bolt_pts, true)); + + // 6. Snow: Symmetrical snowflake with hexagonal cross and branching ticks. + let mut snow_pts = Vec::new(); + let r_hub = 3.5; + for k in 0..6 { + let angle = (k as f64) * std::f64::consts::PI / 3.0; + let (u_sin, u_cos) = angle.sin_cos(); + let u = Point::new(u_cos, u_sin); + let v = Point::new(-u_sin, u_cos); + let to_pt = |du: f64, dv: f64| Point::new(du * u.x + dv * v.x, du * u.y + dv * v.y); + + let valley_angle = angle - std::f64::consts::PI / 6.0; + snow_pts.push(Point::new(r_hub * valley_angle.cos(), r_hub * valley_angle.sin())); + + snow_pts.push(to_pt(5.0, -1.0)); + snow_pts.push(to_pt(8.5, -1.0)); + snow_pts.push(to_pt(10.0, -3.0)); + snow_pts.push(to_pt(11.5, -1.0)); + snow_pts.push(to_pt(15.5, -1.0)); + snow_pts.push(to_pt(15.5, -2.5)); + + snow_pts.push(to_pt(18.0, 0.0)); + + snow_pts.push(to_pt(15.5, 2.5)); + snow_pts.push(to_pt(15.5, 1.0)); + snow_pts.push(to_pt(11.5, 1.0)); + snow_pts.push(to_pt(10.0, 3.0)); + snow_pts.push(to_pt(8.5, 1.0)); + snow_pts.push(to_pt(5.0, 1.0)); + } + let snow = PathData::single(SubPath::polyline(&snow_pts, true)); + + let icons = [ + ("Sun", sun, "#f39c12"), + ("Moon", moon, "#5c6bc0"), + ("Cloud", cloud, "#78909c"), + ("Rain", rain, "#3498db"), + ("Thunder", thunder, "#f1c40f"), + ("Snow", snow, "#29b6f6"), + ]; + let mut doc = Document::new(100.0, 100.0); + for (name, path, hex) in icons { + let fill = Color::from_hex(hex).unwrap_or(Color::BLACK); + let edge = fill.lerp(&Color::BLACK, 0.35); + let id = doc.alloc_id(); + let art = Node::path(id, path, Appearance::basic(Paint::solid(fill), Paint::solid(edge), 1.25)); + let Ok((art, size, _)) = normalize(art) else { continue }; + doc.symbols.push(Symbol { dynamic: false, name: name.into(), art: Arc::new(art) }); + set_natural_size(&mut doc, name, Some(size)); + } + doc.title = "Weather Icons".into(); + SymbolLibrary { name: "Weather Icons".into(), doc } +} + /// An instance of symbol `name` (what the resource gathering follows). fn instance(name: &str) -> Node { Node::new(NodeId(0), NodeKind::SymbolInstance { symbol: name.into(), xf: Affine::IDENTITY }) diff --git a/crates/engine/src/cmd/textedit.rs b/crates/engine/src/cmd/textedit.rs index 0fd7c7d97d..9ed7f3252b 100644 --- a/crates/engine/src/cmd/textedit.rs +++ b/crates/engine/src/cmd/textedit.rs @@ -40,7 +40,7 @@ pub fn specs() -> Vec { "Character", [], None, - "{id? (default: the one selected type object), start?: byte, end?: byte (default: all text), story?: bool = false (all the text of every frame of the threaded story `id` is a frame of, in one undo step; no `start` or `end`), font?, style?, size?: pt 0.1..1296 (outside it: an error), leading?: pt|\"auto\", tracking?, kerning?: 1/1000 em|\"auto\"|\"optical\" (the space after each character), kerningBefore?: 1/1000 em -1000..10000 (the space before a character that starts a line by itself: the first character of the text, of a paragraph or after a forced line break; no effect elsewhere; 0 by default), baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), fill?: colour|\"none\", stroke?: colour|\"none\" (#rrggbbaa and #rgba are refused in both), keepModel?: bool (fill and stroke, as paint.setFill), strokeWidth?: pt, strokeOptions?: {weight?, cap?, join?, miterLimit?, align?, dash?, dashOffset?, alignDashes?} (as stroke.set: the character stroke), underline?, strikethrough?, allCaps?: bool, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), features?: [\"dlig\", \"-liga\", \"salt=2\", …] (swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take the font's alternate number as `tag=N`, N 0–65535: \"salt=2\" draws the second alternate of each glyph that has one, \"salt\" is \"salt=1\", \"-salt\" and \"salt=0\" are off; the range is shaped with its word, so a letter's alternate keeps it joined to its neighbours), featureChanges?: [\"tnum\", \"-onum\", \"salt=2\", …] (OpenType features turned on, or with - off, on top of each character's own, a value replacing the feature's last one; its other features are kept), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\", proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings: in vertical type a block of tate-chu-yoko characters moves up by a positive Up/Down and down by a negative one, right by a positive Left/Right and left by a negative one, as one piece with the values of its first character; on a vertical path a positive Up/Down moves it toward the path's start and a positive Left/Right to the path's left; 0 by default; automatic digit blocks and horizontal type do not move; neither turns tateChuYoko on), warichu?: bool (Character panel menu › Warichu, with Show East Asian Options: the characters are set at warichuScale percent of their size and stacked on warichuLines lines inside their line, one above the other in horizontal type and side by side in vertical type, the first line above or to the right; a stretch of them is one block with the settings of its first character that stays whole on one line and may run past its end; type on a path sets them at their own size), warichuLines?: 1..6 (default 2), warichuGap?: pt 0..100 (the space between the lines, default 0), warichuScale?: % 10..100 (default 50), warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Warichu Settings: how the lines line up along the block, which is as long as its longest line; the justify values spread every line but the last, which is set left, centered or right, or spread with justifyAll; auto, the default, sets them as justifyLeft; left and right are top and bottom in vertical type; none of them turns warichu on), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options: space before and after each character in reading order, on its left and right in left-to-right type, on its right and left in right-to-left type, above and below it in vertical type; a ligature or a letter with its marks takes the values of its first character; line wrapping counts it, alignment keeps it at a line's ends and justification does not stretch or narrow it; 0 by default; a value that is not a number or is outside the range is refused, naming the key), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, with Show East Asian Options: in vertical type those half-width characters, such as Latin letters and digits, stand upright one below the other instead of being rotated; spaces and tate-chu-yoko blocks are not changed; kept on the characters and ignored in horizontal type; off by default), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference: the height of the font that size measures, the em box by default; with a font that has no such height, or one outside 0.1 to 2 em, the em box), language?: name|tag (Character panel › Language: one of Document Setup's languages by name or BCP 47 tag, case-insensitive, such as \"Turkish\" or \"tr\"; the characters are shaped in it, so the font uses that language's forms (OpenType `locl`); saved as the tag, English: USA, the default, as none; new type takes the document's language), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font: the setting of each variation axis named, in the axis's units and clamped to its range; null: back to the style's own setting; other axes keep theirs; tags the font has no axis for are left out; a font or style change clears them; text.fontList {family, style} lists the axes), glyphAlternate?: null (takes away the glyph choice text.setGlyphAlternate made on the characters, in the same undo step as the other attributes; any other value is refused)} style a character range (size/leading/baselineShift are document points and hScale includes the object transform; runs are split at the range ends) → {id, runs, warning?: text (the font or style set isn't available: its type is drawn in the fallback font or the family's closest style)}", + "{id? (default: the one selected type object), start?: byte, end?: byte (default: all text), story?: bool = false (all the text of every frame of the threaded story `id` is a frame of, in one undo step; no `start` or `end`), font?, style?, size?: pt 0.1..1296 (outside it: an error), leading?: pt|\"auto\", tracking?, kerning?: 1/1000 em|\"auto\"|\"optical\" (the space after each character), kerningBefore?: 1/1000 em -1000..10000 (the space before a character that starts a line by itself: the first character of the text, of a paragraph or after a forced line break; no effect elsewhere; 0 by default), baselineShift?: pt, hScale?: %, vScale?: %, rotation?: deg counter-clockwise (0: upright), fill?: colour|\"none\", stroke?: colour|\"none\" (#rrggbbaa and #rgba are refused in both), keepModel?: bool (fill and stroke, as paint.setFill), strokeWidth?: pt, strokeOptions?: {weight?, cap?, join?, miterLimit?, align?, dash?, dashOffset?, alignDashes?} (as stroke.set: the character stroke), underline?, strikethrough?, allCaps?: bool, smallCaps?: bool, position?: \"normal\"|\"superscript\"|\"subscript\" (sizes from Document Setup), features?: [\"dlig\", \"-liga\", \"salt=2\", …] (swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take the font's alternate number as `tag=N`, N 0–65535: \"salt=2\" draws the second alternate of each glyph that has one, \"salt\" is \"salt=1\", \"-salt\" and \"salt=0\" are off; the range is shaped with its word, so a letter's alternate keeps it joined to its neighbours), featureChanges?: [\"tnum\", \"-onum\", \"salt=2\", …] (OpenType features turned on, or with - off, on top of each character's own, a value replacing the feature's last one; its other features are kept), charAlign?: \"romanBaseline\"|\"emBoxTop\"|\"emBoxCenter\"|\"emBoxBottom\"|\"icfTop\"|\"icfBottom\", proportionalMetrics?: bool (full-width glyphs on the font's proportional widths: `palt` in horizontal type, `vpal` in vertical type), tateChuYoko?: bool (Character panel menu › Tate-chu-yoko, with Show East Asian Options: in vertical type those characters stand side by side across one em of the column; kept on the characters and ignored in horizontal type), tcyUpDown?, tcyLeftRight?: pt -1296..1296 (Character panel menu › Tate-chu-yoko Settings: in vertical type a block of tate-chu-yoko characters moves up by a positive Up/Down and down by a negative one, right by a positive Left/Right and left by a negative one, as one piece with the values of its first character; on a vertical path a positive Up/Down moves it toward the path's start and a positive Left/Right to the path's left; 0 by default; automatic digit blocks and horizontal type do not move; neither turns tateChuYoko on), warichu?: bool (Character panel menu › Warichu, with Show East Asian Options: the characters are set at warichuScale percent of their size and stacked on warichuLines lines inside their line, one above the other in horizontal type and side by side in vertical type, the first line above or to the right; a stretch of them is one block with the settings of its first character that stays whole on one line and may run past its end; type on a path sets them at their own size), warichuLines?: 1..6 (default 2), warichuGap?: pt 0..100 (the space between the lines, default 0), warichuScale?: % 10..100 (default 50), warichuAlign?: \"auto\"|\"left\"|\"center\"|\"right\"|\"justifyLeft\"|\"justifyCenter\"|\"justifyRight\"|\"justifyAll\" (Warichu Settings: how the lines line up along the block, which is as long as its longest line; the justify values spread every line but the last, which is set left, centered or right, or spread with justifyAll; auto, the default, sets them as justifyLeft; left and right are top and bottom in vertical type; none of them turns warichu on), akiLeft?, akiRight?: 1/1000 em 0..1000 (Character panel › Insert Aki Left and Right, with Show East Asian Options: space before and after each character in reading order, on its left and right in left-to-right type, on its right and left in right-to-left type, above and below it in vertical type; a ligature or a letter with its marks takes the values of its first character; line wrapping counts it, alignment keeps it at a line's ends and justification does not stretch or narrow it; 0 by default; a value that is not a number or is outside the range is refused, naming the key), tsume?: % 0..100 (Character panel › Tsume, with Show East Asian Options: the share of the blank space on each side of each character's ink, inside its own width, that is taken away in horizontal type, the glyph keeping its shape; 100 sets the ink edge to edge; a character without ink, such as a space, keeps its width; a ligature or a letter with its marks takes the value of its first character; tracking, kerning and Insert Aki are added after it, and justification keeps it; vertical type keeps the characters' spacing; 0 by default; a value that is not a number or is outside the range is refused), standardVerticalRoman?: bool (Character panel menu › Standard Vertical Roman Alignment, with Show East Asian Options: in vertical type those half-width characters, such as Latin letters and digits, stand upright one below the other instead of being rotated; spaces and tate-chu-yoko blocks are not changed; kept on the characters and ignored in horizontal type; off by default), noBreak?: bool (Character panel menu › No Break: these characters stay on one line, including across a space inside the run), kashidas?: bool (Character panel menu › Kashidas: selected characters allow insertion only when both joined neighbors have it on; on by default), charDirection?: \"default\"|\"leftToRight\"|\"rightToLeft\" (Character panel menu › Character Direction: the characters are set left to right or right to left inside their paragraph, as a Unicode bidi embedding; default: as the bidi algorithm sets them), digits?: \"default\"|\"arabic\"|\"hindi\"|\"farsi\"|\"devanagari\"|\"bengali\"|\"gurmukhi\"|\"gujarati\"|\"odia\"|\"tamil\"|\"telugu\"|\"kannada\"|\"malayalam\" (Character panel menu › Digits: the numeral system every digit is drawn in, whatever was typed: Western, Arabic-Indic (hindi), Eastern Arabic-Indic (farsi) or an Indic script's own digits), fontHeightReference?: \"emBox\"|\"capHeight\"|\"xHeight\"|\"icfBox\" (Character panel › Set Font Height Reference: the height of the font that size measures, the em box by default; with a font that has no such height, or one outside 0.1 to 2 em, the em box), language?: name|tag (Character panel › Language: one of Document Setup's languages by name or BCP 47 tag, case-insensitive, such as \"Turkish\" or \"tr\"; the characters are shaped in it, so the font uses that language's forms (OpenType `locl`); saved as the tag, English: USA, the default, as none; new type takes the document's language), fontAxes?: {\"wght\": 650, …} (Character panel › Variable Font: the setting of each variation axis named, in the axis's units and clamped to its range; null: back to the style's own setting; other axes keep theirs; tags the font has no axis for are left out; a font or style change clears them; text.fontList {family, style} lists the axes), glyphAlternate?: null (takes away the glyph choice text.setGlyphAlternate made on the characters, in the same undo step as the other attributes; any other value is refused)} style a character range (size/leading/baselineShift are document points and hScale includes the object transform; runs are split at the range ends) → {id, runs, warning?: text (the font or style set isn't available: its type is drawn in the fallback font or the family's closest style)}", has_doc, set_range_style ), @@ -468,6 +468,8 @@ pub(crate) struct CharChange { /// Insert Aki Left and Right, in 1/1000 em. aki_left: Option, aki_right: Option, + /// Tsume, in percent. + tsume: Option, standard_vertical_roman: Option, no_break: Option, digits: Option, @@ -545,6 +547,16 @@ pub(crate) fn aki_param(p: &Value, key: &str, cmd: &str) -> Result> if (lo..=hi).contains(&v) { Ok(Some(v)) } else { Err(bad(cmd, format!("`{key}` must be from {lo} to {hi}"))) } } +/// `tsume` (Tsume): a percentage from 0 to [`vectorcraft_doc::text::MAX_TSUME`]. Any other value is +/// an error. +pub(crate) fn tsume_param(p: &Value, cmd: &str) -> Result> { + let key = "tsume"; + let Some(v) = p.get(key).filter(|v| !v.is_null()) else { return Ok(None) }; + let v = v.as_f64().filter(|v| v.is_finite()).ok_or_else(|| bad(cmd, format!("`{key}` must be a number")))?; + let (lo, hi) = (0.0, vectorcraft_doc::text::MAX_TSUME); + if (lo..=hi).contains(&v) { Ok(Some(v)) } else { Err(bad(cmd, format!("`{key}` must be from {lo} to {hi}"))) } +} + /// `digits: "default"|"arabic"|"hindi"|"farsi"|"devanagari"|…` ([`Digits::id`]) → the numeral /// system the digits are drawn in. /// @@ -824,6 +836,7 @@ impl CharChange { warichu_align: warichu_align_param(p, cmd)?, aki_left: aki_param(p, "akiLeft", cmd)?, aki_right: aki_param(p, "akiRight", cmd)?, + tsume: tsume_param(p, cmd)?, standard_vertical_roman: flag("standardVerticalRoman"), no_break: flag("noBreak"), digits: digits_param(p, cmd)?, @@ -888,6 +901,7 @@ impl CharChange { && self.warichu_align.is_none() && self.aki_left.is_none() && self.aki_right.is_none() + && self.tsume.is_none() && self.standard_vertical_roman.is_none() && self.no_break.is_none() && self.digits.is_none() @@ -976,6 +990,9 @@ impl CharChange { if let Some(v) = self.aki_right { st.aki_right = v; } + if let Some(v) = self.tsume { + st.tsume = v; + } if let Some(v) = self.standard_vertical_roman { st.standard_vertical_roman = v; } diff --git a/crates/engine/src/cmd/textstyles.rs b/crates/engine/src/cmd/textstyles.rs index ea1a7a22bd..17d453abf4 100644 --- a/crates/engine/src/cmd/textstyles.rs +++ b/crates/engine/src/cmd/textstyles.rs @@ -222,6 +222,7 @@ pub fn char_attrs(v: &CharStyle) -> Map { ("warichuAlign", json!(v.warichu_align)), ("akiLeft", json!(v.aki_left)), ("akiRight", json!(v.aki_right)), + ("tsume", json!(v.tsume)), ("standardVerticalRoman", json!(v.standard_vertical_roman)), ("noBreak", json!(v.no_break)), ("digits", json!(v.digits)), @@ -578,6 +579,10 @@ fn attrs_param(d: &Document, p: &Value, kind: Kind, verb: &str, kept: Option<&Ma return Err(bad(&c, format!("`{key}` must be from {lo} to {hi}"))); } } + let (key, lo, hi) = ("tsume", 0.0, vectorcraft_doc::text::MAX_TSUME); + if changed(key) && !(lo..=hi).contains(&st.tsume) { + return Err(bad(&c, format!("`{key}` must be from {lo} to {hi}"))); + } let lines = vectorcraft_doc::text::WARICHU_LINES; if changed("warichuLines") && !lines.contains(&st.warichu_lines) { return Err(bad(&c, format!("`warichuLines` must be a whole number from {} to {}", lines.start(), lines.end()))); @@ -1075,12 +1080,12 @@ fn unused(s: &mut Session, kind: Kind) -> Result { /// The styles of `kind` in `src` that load, with their source names so that art in the file keeps /// referring to them: not the Normal style, and not one whose attributes don't read, whose sizes, -/// scales, leading, shifts, Insert Aki, Warichu Settings or stroke width are out of the range `charStyle.new` takes, whose +/// scales, leading, shifts, Insert Aki, Tsume, Warichu Settings or stroke width are out of the range `charStyle.new` takes, whose /// indents, spacing, Hyphenation or Justification options or tab stops are out of the range /// `paraStyle.new` takes, or whose name is empty, which are skipped. → (the styles, the names in /// `src` of those skipped) fn loadable(src: &Document, kind: Kind) -> (Vec, Vec) { - const RANGED: [&str; 21] = [ + const RANGED: [&str; 22] = [ "size", "h_scale", "v_scale", @@ -1088,6 +1093,7 @@ fn loadable(src: &Document, kind: Kind) -> (Vec, Vec) { "baseline_shift", "akiLeft", "akiRight", + "tsume", "tcyUpDown", "tcyLeftRight", "warichuLines", diff --git a/crates/engine/src/cmd/textstyles/tests.rs b/crates/engine/src/cmd/textstyles/tests.rs index 3e0727ce4a..c8da4b578c 100644 --- a/crates/engine/src/cmd/textstyles/tests.rs +++ b/crates/engine/src/cmd/textstyles/tests.rs @@ -397,6 +397,8 @@ fn character_style_dimensions_are_checked_before_a_definition_changes() { json!({"tcyLeftRight": -1296.1}), json!({"akiLeft": -0.1}), json!({"akiRight": 1000.1}), + json!({"tsume": -0.1}), + json!({"tsume": 100.1}), ] { let key = attrs.as_object().unwrap().keys().next().unwrap(); for cmd in ["charStyle.edit", "charStyle.setAttrs", "charStyle.new"] { @@ -419,7 +421,8 @@ fn character_style_dimensions_are_checked_before_a_definition_changes() { "h_scale": 1.0, "v_scale": 10000.0, "baseline_shift": -1296.0, "tcyUpDown": 1296.0, "tcyLeftRight": -1296.0, - "akiLeft": 0.0, "akiRight": 1000.0 + "akiLeft": 0.0, "akiRight": 1000.0, + "tsume": 100.0 }}), ) .unwrap(); diff --git a/crates/engine/src/cmd/typecmd.rs b/crates/engine/src/cmd/typecmd.rs index 6b14c98916..73e2a78b31 100644 --- a/crates/engine/src/cmd/typecmd.rs +++ b/crates/engine/src/cmd/typecmd.rs @@ -12,8 +12,8 @@ use vectorcraft_geom::{Affine, PathData, Vec2}; use super::edit::selected_roots; use super::pathops::{length_given, number_given, shape_node}; use super::{ - CommandSpec, EngineError, Result, Session, bad, check_numbers, cmd, color_value, f64_req, has_doc, has_selection, index, number_or, object_param, - ok, str_param, switch_or, targets, text_param, + CommandSpec, EngineError, Result, Session, bad, check_numbers, cmd, color_value, f64_req, has_doc, has_selection, index, index_opt, number_or, + object_param, ok, str_param, switch_or, targets, text_param, }; pub fn specs() -> Vec { @@ -23,7 +23,7 @@ pub fn specs() -> Vec { "Vertical", ["Type", "Orientation"], None, - "{ids?|id?} set vertical writing for the selected type and every frame of its threads → {vertical, ids}", + "{ids?|id?} set vertical writing for the selected type and every frame of its threads; no undo step when every object is already vertical → {vertical, ids}", has_selection, |s, p| orientation(s, p, true) ), @@ -32,7 +32,7 @@ pub fn specs() -> Vec { "Horizontal", ["Type", "Orientation"], None, - "{ids?|id?} set horizontal writing for the selected type and every frame of its threads → {vertical, ids}", + "{ids?|id?} set horizontal writing for the selected type and every frame of its threads; no undo step when every object is already horizontal → {vertical, ids}", has_selection, |s, p| orientation(s, p, false) ), @@ -59,7 +59,7 @@ pub fn specs() -> Vec { "Optical Margin Alignment", ["Type"], None, - "{ids?|id?, on?: bool} turn Optical Margin Alignment on or off for the selected type and every frame of its threads (on omitted: the opposite of the first object's setting): in every paragraph of point and area type, quotation marks, hyphens, full stops and commas at a line's start or end hang wholly outside the margin there; asterisks, tildes, ellipses, en and em dashes, colons and semicolons hang by half; and A, V, W, Y, v, w and y hang by a tenth of their advance; a left-aligned line hangs at its left margin, a right-aligned line hangs at its right margin, and centered and justified lines hang at both; Auto aligns a right-to-left line at its right; type on a path hangs at the start bracket when its line is placed there, hangs at the end bracket when the line is placed there, and hangs at both when it is centered → {on, ids}", + "{ids?|id?, on?: bool} turn Optical Margin Alignment on or off for the selected type and every frame of its threads (on omitted: the opposite of the first object's setting): in every paragraph of point and area type, quotation marks, hyphens, full stops and commas at a line's start or end hang wholly outside the margin there; asterisks, tildes, ellipses, en and em dashes, colons and semicolons hang by half; and A, V, W, Y, v, w and y hang by a tenth of their advance; a left-aligned line hangs at its left margin, a right-aligned line hangs at its right margin, and centered and justified lines hang at both; Auto aligns a right-to-left line at its right; type on a path hangs at the start bracket when its line is placed there, hangs at the end bracket when the line is placed there, and hangs at both when it is centered; no undo step when every object already has the setting → {on, ids}", has_selection, optical_margin_alignment ), @@ -68,7 +68,7 @@ pub fn specs() -> Vec { "System Layout", [], None, - "{on?: bool} turn System Layout on or off for the document (on omitted: the opposite of the document's setting) and every text object in it. On, each character that takes any space advances by a whole number of points, at least one, so small type does not run together; a character with no width stays at none. Off (the default, and what a document from before it reads as), spacing uses fractions of a point. New point, area and path type inherits the document's setting → {on}", + "{on?: bool} turn System Layout on or off for the document (on omitted: the opposite of the document's setting) and every text object in it. On, each character that takes any space advances by a whole number of points, at least one, so small type does not run together; a character with no width stays at none. Off (the default, and what a document from before it reads as), spacing uses fractions of a point. New point, area and path type inherits the document's setting. No undo step when the document and every text object already have the setting → {on}", has_doc, system_layout ), @@ -77,7 +77,7 @@ pub fn specs() -> Vec { "Fractional Widths", [], None, - "{ids?|id?, on?: bool} turn Fractional Widths on or off for the selected type and every frame of its threads (on omitted: the opposite of the first object's setting). On (the default, and what a document from before it reads as), spacing between characters uses fractions of a point. Off, each character that takes any space advances by a whole number of points, at least one, so small type does not run together; a character with no width stays at none. The setting is the whole type object, not a range of characters → {on, ids}", + "{ids?|id?, on?: bool} turn Fractional Widths on or off for the selected type and every frame of its threads (on omitted: the opposite of the first object's setting). On (the default, and what a document from before it reads as), spacing between characters uses fractions of a point. Off, each character that takes any space advances by a whole number of points, at least one, so small type does not run together; a character with no width stays at none. The setting is the whole type object, not a range of characters. No undo step when every object already has the setting → {on, ids}", has_selection, fractional_widths ), @@ -157,24 +157,30 @@ pub fn specs() -> Vec { } /// Type › Type Orientation: set vertical or horizontal writing on every selected text object and -/// every frame of their threads, in one undo step. +/// every frame of their threads, in one undo step (none when nothing changes). fn orientation(s: &mut Session, p: &Value, vertical: bool) -> Result { let ids = super::threads::with_threads(&s.doc()?.doc, &text_targets(s, p, "Text Orientation")?); - s.edit("Text Orientation", |d, _| { + // When every object already has the orientation, the document and its undo history stay as they are. + super::colorcmds::edit_if_changed(s, "Text Orientation", |_, d| { + let mut changed = false; for id in &ids { let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { return Err(EngineError::NoNode(*id)); }; - t.vertical = vertical; - refresh_bounds(t); + if t.vertical != vertical { + t.vertical = vertical; + refresh_bounds(t); + changed = true; + } } - Ok(()) + Ok(((), changed)) })?; Ok(json!({"vertical": vertical, "ids": ids.iter().map(|id| id.0).collect::>()})) } /// Type › Optical Margin Alignment: set `on` (without it, the opposite of the first object's -/// setting) on every selected text object and every frame of their threads, in one undo step. +/// setting) on every selected text object and every frame of their threads, in one undo step +/// (none when nothing changes). fn optical_margin_alignment(s: &mut Session, p: &Value) -> Result { let ids = super::threads::with_threads(&s.doc()?.doc, &text_targets(s, p, "Optical Margin Alignment")?); let first = ids.first().and_then(|id| match s.doc().ok()?.doc.node(*id).map(|n| &n.kind) { @@ -182,29 +188,38 @@ fn optical_margin_alignment(s: &mut Session, p: &Value) -> Result { _ => None, }); let on = switch_or(p, "on", !first.unwrap_or(false), "type.opticalMarginAlignment")?; - s.edit("Optical Margin Alignment", |d, _| { + // When every object already has the setting, the document and its undo history stay as they are. + super::colorcmds::edit_if_changed(s, "Optical Margin Alignment", |_, d| { + let mut changed = false; for id in &ids { let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { return Err(EngineError::NoNode(*id)); }; - t.optical_margin = on; - refresh_bounds(t); + if t.optical_margin != on { + t.optical_margin = on; + refresh_bounds(t); + changed = true; + } } - Ok(()) + Ok(((), changed)) })?; Ok(json!({"on": on, "ids": ids.iter().map(|id| id.0).collect::>()})) } /// Character panel menu › System Layout: set `on` (without it, the opposite of the document's -/// setting) on the document and every text object, in one undo step. Off is the default. +/// setting) on the document and every text object, in one undo step (none when nothing changes). +/// Off is the default. fn system_layout(s: &mut Session, p: &Value) -> Result { let current = s.doc()?.doc.setup.system_layout; let on = switch_or(p, "on", !current, "type.systemLayout")?; - s.edit("System Layout", |d, _| { + // When the document and every text object already have the setting, the document and its undo + // history stay as they are. + super::colorcmds::edit_if_changed(s, "System Layout", |_, d| { + let mut changed = d.setup.system_layout != on; d.setup.system_layout = on; let mut ids = vec![]; d.walk(|n| { - if matches!(n.kind, NodeKind::Text(_)) { + if matches!(&n.kind, NodeKind::Text(t) if t.system_layout != on) { ids.push(n.id); } }); @@ -214,15 +229,16 @@ fn system_layout(s: &mut Session, p: &Value) -> Result { }; t.system_layout = on; refresh_bounds(t); + changed = true; } - Ok(()) + Ok(((), changed)) })?; Ok(json!({ "on": on })) } /// Character panel menu › Fractional Widths: set `on` (without it, the opposite of the first /// object's setting) on every selected text object and every frame of their threads, in one undo -/// step. On is the default. +/// step (none when nothing changes). On is the default. fn fractional_widths(s: &mut Session, p: &Value) -> Result { let ids = super::threads::with_threads(&s.doc()?.doc, &text_targets(s, p, "Fractional Widths")?); let first = ids.first().and_then(|id| match s.doc().ok()?.doc.node(*id).map(|n| &n.kind) { @@ -230,15 +246,20 @@ fn fractional_widths(s: &mut Session, p: &Value) -> Result { _ => None, }); let on = switch_or(p, "on", !first.unwrap_or(true), "type.fractionalWidths")?; - s.edit("Fractional Widths", |d, _| { + // When every object already has the setting, the document and its undo history stay as they are. + super::colorcmds::edit_if_changed(s, "Fractional Widths", |_, d| { + let mut changed = false; for id in &ids { let Some(NodeKind::Text(t)) = d.node_mut(*id).map(|n| &mut n.kind) else { return Err(EngineError::NoNode(*id)); }; - t.fractional_widths = on; - refresh_bounds(t); + if t.fractional_widths != on { + t.fractional_widths = on; + refresh_bounds(t); + changed = true; + } } - Ok(()) + Ok(((), changed)) })?; Ok(json!({"on": on, "ids": ids.iter().map(|id| id.0).collect::>()})) } @@ -1376,7 +1397,7 @@ fn set_path_handle(s: &mut Session, p: &Value) -> Result { const C: &str = "text.setPathHandle"; let id = object_param(p, "id", C)?.ok_or_else(|| bad(C, "missing id"))?; let si = super::draw2::usize_opt(p, "subpath", C)?.unwrap_or(0); - let ai = p.get("anchor").and_then(Value::as_u64).map(index).ok_or_else(|| bad(C, "missing anchor"))?; + let ai = index_opt(p, "anchor", C)?.ok_or_else(|| bad(C, "missing anchor"))?; let out = super::object::choice(p, C, "which", &["in", "out"])? != Some("in"); let pos = vectorcraft_geom::Point::new(f64_req(p, "x", C)?, f64_req(p, "y", C)?); let independent = switch_or(p, "independent", false, C)?; diff --git a/crates/engine/src/cmd/typecmd/area_tests.rs b/crates/engine/src/cmd/typecmd/area_tests.rs index c68334e2c0..36a0f965b7 100644 --- a/crates/engine/src/cmd/typecmd/area_tests.rs +++ b/crates/engine/src/cmd/typecmd/area_tests.rs @@ -199,8 +199,11 @@ fn optical_margin_alignment_is_set_per_object_and_saved_only_when_on() { assert!(left(&s) < inside - 5.0, "{} {inside}", left(&s)); assert_eq!(serde_json::to_value(text(&s)).unwrap()["opticalMarginAlignment"], true); // `on` sets it; without `on` it toggles. + // Setting the value the type already has: no undo step. + let n = s.doc().unwrap().history.undo.len(); assert_eq!(s.execute("type.opticalMarginAlignment", &json!({"on": true})).unwrap()["on"], true); assert!(text(&s).optical_margin); + assert_eq!(s.doc().unwrap().history.undo.len(), n); assert_eq!(s.execute("type.opticalMarginAlignment", &json!({})).unwrap()["on"], false); assert!(!text(&s).optical_margin); assert_eq!(left(&s), inside); @@ -247,6 +250,10 @@ fn system_layout_sets_the_document_and_every_text_object() { assert!(fractional.iter().zip(&whole).any(|(a, b)| (a - b).abs() > 0.05), "{fractional:?} {whole:?}"); assert_eq!(serde_json::to_value(setup(&s)).unwrap()["systemLayout"], true); assert_eq!(serde_json::to_value(text(&s, id)).unwrap()["systemLayout"], true); + // Setting the value the document and its type already have: no undo step. + let n = s.doc().unwrap().history.undo.len(); + assert_eq!(s.execute("type.systemLayout", &json!({"on": true})).unwrap()["on"], true); + assert_eq!(s.doc().unwrap().history.undo.len(), n); // New type inherits the document's setting. let made = s.execute("text.create", &json!({"x": 10, "y": 120, "text": "Z"})).unwrap()["id"].as_u64().unwrap(); assert!(text(&s, made).system_layout); @@ -305,6 +312,10 @@ fn fractional_widths_is_set_per_object_and_saved_only_when_off() { assert!(text(&s).fractional_widths); assert_eq!(s.execute("type.fractionalWidths", &json!({"on": false})).unwrap()["on"], false); assert!(!text(&s).fractional_widths); + // Setting the value the type already has: no undo step. + let n = s.doc().unwrap().history.undo.len(); + assert_eq!(s.execute("type.fractionalWidths", &json!({"on": false})).unwrap()["on"], false); + assert_eq!(s.doc().unwrap().history.undo.len(), n); // One undo step. s.execute("edit.undo", &json!({})).unwrap(); assert!(text(&s).fractional_widths); @@ -1688,10 +1699,9 @@ fn warichu_is_a_character_attribute_set_saved_and_exported() { assert!(["warichu", "warichuLines", "warichuGap", "warichuScale", "warichuAlign"].iter().all(|k| saved.get(*k).is_none()), "{saved}"); let plain_svg = vectorcraft_svg::export(&s.doc().unwrap().doc, &Default::default()); let plain_pdf = vectorcraft_pdf::export(&s.doc().unwrap().doc, &vectorcraft_pdf::PdfOptions::uncompressed()).unwrap(); - let text_ops = |pdf: &[u8]| { - let s = String::from_utf8_lossy(pdf); - s.contains("Tj") || s.contains("TJ") - }; + // Only text objects count: the file ID in the trailer and the XMP is base64 that changes each + // second and now and then spells `Tj` or `TJ`. + let text_ops = |pdf: &[u8]| String::from_utf8_lossy(pdf).lines().any(|l| l.starts_with("BT ") && (l.contains("Tj") || l.contains("TJ"))); assert!(plain_svg.contains(" t.runs.clone(), + _ => panic!("text"), + }; + let tsume = |s: &Session| runs(s).iter().map(|r| (r.text.clone(), r.style.tsume)).collect::>(); + let saved = serde_json::to_value(&runs(&s)[0].style).unwrap(); + assert!(saved.get("tsume").is_none()); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + s.execute("text.setFormat", &json!({"tsume": 50})).unwrap(); + assert_eq!(tsume(&s), [("(日本)".to_string(), 50.0)]); + let undo = s.doc().unwrap().history.undo.len(); + s.execute("text.setFormat", &json!({"tsume": 50})).unwrap(); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "no undo step without a change"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(tsume(&s), [("(日本)".to_string(), 0.0)], "one undo step"); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(tsume(&s), [("(日本)".to_string(), 50.0)]); + + let paren = "(".len(); + s.execute("text.setRangeStyle", &json!({"id": id, "start": 0, "end": paren, "tsume": 100})).unwrap(); + assert_eq!(tsume(&s), [("(".to_string(), 100.0), ("日本)".to_string(), 50.0)]); + let saved = serde_json::to_value(&runs(&s)[0].style).unwrap(); + assert_eq!(saved["tsume"], json!(100.0)); + let back = vectorcraft_format::load(&vectorcraft_format::save(&s.doc().unwrap().doc, false)).unwrap(); + let NodeKind::Text(t) = &back.node(NodeId(id)).unwrap().kind else { panic!("text") }; + let reopened: Vec<_> = t.runs.iter().map(|r| (r.text.clone(), r.style.tsume)).collect(); + assert_eq!(reopened, tsume(&s)); + let attrs = super::super::textstyles::char_attrs(&runs(&s)[0].style); + assert_eq!(attrs["tsume"], json!(100.0)); + + let before = tsume(&s); + let undo = s.doc().unwrap().history.undo.len(); + for (cmd, p, want) in [ + ("text.setFormat", json!({"tsume": "50"}), "`tsume` must be a number"), + ("text.setFormat", json!({"tsume": -1}), "`tsume` must be from 0 to 100"), + ("text.setRangeStyle", json!({"id": id, "tsume": true}), "`tsume` must be a number"), + ("text.setRangeStyle", json!({"id": id, "start": 0, "end": paren, "tsume": 100.5}), "`tsume` must be from 0 to 100"), + ] { + let e = s.execute(cmd, &p).unwrap_err(); + assert!(matches!(&e, EngineError::BadParams { msg, .. } if msg == want), "{cmd} {p}: {e}"); + } + assert_eq!(tsume(&s), before); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "no undo step for a refused call"); +} + /// Standard Vertical Roman Alignment (Character panel menu, East Asian options): a character /// attribute, off by default and saved only when on. Documents written before it read as off; a /// character style captured from the characters carries it. @@ -2277,8 +2342,17 @@ fn vertical_point_type_keeps_its_anchor_on_the_column_centre_line() { let tall = bounds(&s); assert!(tall.height() > tall.width(), "{tall:?}"); assert!((tall.center().x - 100.0).abs() < 6.0, "the anchor stays on the column's centre line: {tall:?}"); + // Vertical type set vertical again: no undo step. + let n = s.doc().unwrap().history.undo.len(); + s.execute("type.orientation.vertical", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().history.undo.len(), n); + assert_eq!(bounds(&s), tall); s.execute("edit.undo", &json!({})).unwrap(); assert_eq!(bounds(&s), wide); + // Horizontal type set horizontal: no undo step either. + let n = s.doc().unwrap().history.undo.len(); + s.execute("type.orientation.horizontal", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().history.undo.len(), n); } #[test] diff --git a/crates/engine/src/cmd/typemenu.rs b/crates/engine/src/cmd/typemenu.rs index 87c16bb9b9..c140ba6572 100644 --- a/crates/engine/src/cmd/typemenu.rs +++ b/crates/engine/src/cmd/typemenu.rs @@ -138,7 +138,7 @@ pub fn specs() -> Vec { "Paste without Formatting", ["Edit"], Some("Cmd+Alt+V"), - "{center?, dx?, dy?, swatchConflict?} paste as edit.paste; pasted text takes the default character style (one run) and leaves its character and paragraph styles behind → {ids, added, merged, renamed}", + "{center?, dx?, dy?, swatchConflict?} paste as edit.paste; pasted text takes the default character style (one run) and leaves its character and paragraph styles behind, as do the labels of pasted graphs → {ids, added, merged, renamed}", has_clipboard, paste_plain ), @@ -1460,6 +1460,16 @@ fn strip_formatting(n: &mut vectorcraft_doc::Node) { t.set_all_paras(Default::default()); refresh_bounds(t); } + // A graph keeps the names of its labels' character and paragraph styles for each redraw. + if let Some(g) = n.extras_if_any().and_then(|e| e.graph.as_deref_mut()) { + let l = &mut g.label_styles; + for st in [&mut l.values, &mut l.categories, &mut l.legend].into_iter().flatten() { + st.style_name = None; + } + for pa in [&mut l.values_para, &mut l.categories_para, &mut l.legend_para].into_iter().flatten() { + pa.style_name = None; + } + } if let Some(ch) = n.children_mut() { for c in ch.iter_mut() { strip_formatting(std::sync::Arc::make_mut(c)); diff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rs index c3722f6ad2..780616c07a 100644 --- a/crates/engine/src/doc_state.rs +++ b/crates/engine/src/doc_state.rs @@ -369,12 +369,13 @@ impl DocState { /// menu asks on every frame it is open, and measuring builds the solids of 3D effects, so the /// answer is kept for this version of the document and those artboards, and a change of the /// selection or the view keeps it. It is measured again when what the measure reads outside the - /// document changes: the installed plug-ins, whose effects draw art, and the installed fonts, - /// which set the bounds of all type. + /// document changes: the installed plug-ins, whose effects draw art, and the installed fonts and + /// the hyphenation exceptions, which set the bounds of all type. pub fn any_art_to_fit(&self, indices: &[usize]) -> bool { - self.any_art_to_fit_with(indices, (vectorcraft_plugins::registry::revision(), vectorcraft_text::FontDb::global().generation())) + self.any_art_to_fit_with(indices, (vectorcraft_plugins::registry::revision(), vectorcraft_text::layout_inputs())) } - /// [`Self::any_art_to_fit`], with `outside` the generations of the plug-ins and the fonts. + /// [`Self::any_art_to_fit`], with `outside` the generations of the plug-ins and the layout inputs + /// ([`vectorcraft_text::layout_inputs`]). pub(crate) fn any_art_to_fit_with(&self, indices: &[usize], outside: (u64, u64)) -> bool { // Measuring runs renderer and plug-in code; should it ever ask again while measuring, it // is measured without being kept rather than borrowed twice. diff --git a/crates/engine/src/script/mod.rs b/crates/engine/src/script/mod.rs index 1edeb84e93..1b95b5fe2a 100644 --- a/crates/engine/src/script/mod.rs +++ b/crates/engine/src/script/mod.rs @@ -26,7 +26,8 @@ //! Before a run starts, its preprocessor lines are read ([`include`]): included files take the //! place of their lines, and an error in one is reported at its own file, line and column. //! `$.evalFile(path)` runs another file in the same global environment and gives its last value, -//! `$.fileName` is the file being run and `$.includePath` the `#includepath` list. +//! `$.fileName` is the file of the code that reads it (the file being run for code that `eval` or +//! `Function` compiled) and `$.includePath` the `#includepath` list. //! //! A run writes to the Script Console with `$.write` and `$.writeln`, and `vc.log` adds a line //! there too. The session's console gets a start line, the run's output, its uncaught error, an end diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 5ceaf86aaf..a87b47be0e 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -25,9 +25,11 @@ impl Session { // Clicks find an image's own fills and strokes where their effects draw them. vectorcraft_doc::hit::set_image_paint(vectorcraft_render::effects::image_paint); // Clicks find a blend's steps and an envelope's distorted art where the canvas draws them, - // evaluated again when the fonts or the plug-ins change. + // evaluated again when the fonts, the hyphenation exceptions or the plug-ins change. vectorcraft_doc::hit::set_live_art(vectorcraft_render::effects::expand_live, || { - vectorcraft_text::FontDb::global().generation().rotate_left(32) ^ vectorcraft_render::effects::plugin_revision() + let mut h = std::hash::DefaultHasher::new(); + std::hash::Hash::hash(&(vectorcraft_text::layout_inputs(), vectorcraft_render::effects::plugin_revision()), &mut h); + std::hash::Hasher::finish(&h) }); // Envelopes map type from the bounds of its glyph outlines, underlines and strikethroughs. vectorcraft_text::register_envelope_ink(); diff --git a/crates/engine/src/store.rs b/crates/engine/src/store.rs index 8a18ce9824..9c555d82f7 100644 --- a/crates/engine/src/store.rs +++ b/crates/engine/src/store.rs @@ -17,9 +17,8 @@ //! * **Plug-ins**: the module of each plug-in `plugin.install` installs, as a `.wasm` file named //! after its id (as Illustrator keeps plug-ins in its Plug-ins folder); `plugin.remove` deletes it. //! Attaching the folder installs them again, except in Safe Mode and except the ones the user -//! disabled, which `disabled.json` in the same folder lists (`plugin.setEnabled`; a window locks -//! `disabled.lock` while it writes the list). The Additional Plug-ins Folder preference is not -//! copied: it is loaded from where it is. `grants.json` holds what the user granted the plug-ins +//! disabled, which `disabled.json` in the same folder lists (`plugin.setEnabled`). The Additional +//! Plug-ins Folder preference is not copied: it is loaded from where it is. `grants.json` holds what the user granted the plug-ins //! stored there that list permissions (id, module hash, permissions); a stored plug-in whose //! permissions it doesn't grant is skipped with a log record, and stays in the folder. //! * **Plug-in settings and caches**: `storage/id-/` in the plug-in store, the id written as @@ -27,6 +26,11 @@ //! keeps with the `settings` and `cache` permissions ([`PluginStorage`]): `settings.json` and a //! `cache` folder with one file per entry. The host names every file; a plug-in only names keys. //! Replacing a plug-in keeps them, and `plugin.remove` deletes them. +//! * **Turns on the plug-in store**: a window or process locks `disabled.lock` in the plug-in folder +//! ([`StoreTurn`]) while it reads and changes the stored plug-ins, `grants.json`, `disabled.json` +//! and the plug-ins' settings and caches, so that two of them using one folder change it one after +//! the other: an install's module and grant are written in one turn, and a grant written for one +//! plug-in doesn't undo another one's. //! //! The files are untrusted input like any other: sizes and counts are capped, a file that does not //! parse is skipped with a log record, and every write is atomic. @@ -62,12 +66,15 @@ pub const MAX_PLUGIN_STORE: u64 = 512 << 20; const PLUGIN_EXT: &str = "wasm"; /// The file in the plug-in folder that lists the plug-ins the user disabled. pub const DISABLED_FILE: &str = "disabled.json"; -/// The file in the plug-in folder that a window locks while it reads and writes [`DISABLED_FILE`]. +/// The file in the plug-in folder that a window locks while it reads and changes the plug-in store +/// ([`StoreTurn`]), [`DISABLED_FILE`] included. pub const DISABLED_LOCK: &str = "disabled.lock"; /// The file in the plug-in store that holds the permissions the user granted. const GRANTS_FILE: &str = "grants.json"; /// The error of a `plugin.remove` that can't remove the plug-in's grant from [`GRANTS_FILE`]. pub(crate) const GRANT_NOT_REMOVED: &str = "the plug-in's grant can't be removed from the plug-in store"; +/// The error of a change to the plug-in store that can't take its turn ([`StoreTurn`]). +pub(crate) const STORE_NOT_LOCKED: &str = "the plug-in store can't be locked"; /// The largest grants file read. const MAX_GRANTS_FILE: u64 = 1 << 20; /// The folder in the plug-in store that holds each plug-in's settings and cache. @@ -84,7 +91,7 @@ const CACHE_EXT: &str = "bin"; /// A write to a folder that holds more is refused as full. pub(crate) const MAX_CACHE_SCAN: usize = storage::MAX_CACHE_ENTRIES * 2; /// Held while a plug-in's settings or cache change, so two runs can't pass a cap together or lose -/// each other's settings. +/// each other's settings. Taken after the plug-in store's turn ([`StoreTurn`]), never before it. static PLUGIN_DATA_LOCK: Mutex<()> = Mutex::new(()); /// The state of each plug-in folder's storage, shared by every storage made for the folder until /// the plug-in is removed, which closes it and drops it. @@ -99,7 +106,7 @@ const MAX_GRANT_WRITES_KEPT: usize = 256; struct IgnoredGrants { /// The grants that should be gone but could not be removed: no session in the process counts /// them ([`Session::ignore_stored_grant`]) until one writes the store's grants for the id - /// ([`Session::store_grant`]). + /// ([`Session::store_grant_in`]). ignored: BTreeSet<(PathBuf, String)>, /// The latest grant writes of the process, at most [`MAX_GRANT_WRITES_KEPT`], each with the /// count of writes it made ([`IgnoredGrants::writes`]). @@ -217,23 +224,53 @@ fn write_atomic(_: &Path, _: &[u8]) -> std::io::Result<()> { Err(std::io::Error::new(std::io::ErrorKind::Unsupported, "no file system")) } -/// [`DISABLED_LOCK`] in `dir`, locked until the file is dropped, waiting while another window holds -/// it; `None` when it can't be opened or locked. +/// [`DISABLED_LOCK`] in the plug-in store `dir`, locked until the file is dropped, waiting while +/// another window or process holds it, or another handle in this process. The file is opened for +/// reading and writing (a handle that only appends can't be locked on Windows) and is never +/// replaced or removed, so that every window locks the same file. #[cfg(not(target_arch = "wasm32"))] -fn lock_disabled(dir: &Path) -> Option { - let opened = std::fs::create_dir_all(dir) - .and_then(|()| std::fs::File::options().create(true).truncate(false).read(true).write(true).open(dir.join(DISABLED_LOCK))); - let file = opened.and_then(|f| f.lock().map(|()| f)); - if let Err(e) = &file { - log::warn!("can't lock {}: {e}", dir.join(DISABLED_LOCK).display()); +fn lock_store(dir: &Path) -> std::io::Result { + std::fs::create_dir_all(dir)?; + let file = std::fs::File::options().create(true).truncate(false).read(true).write(true).open(dir.join(DISABLED_LOCK))?; + match file.try_lock() { + Ok(()) => return Ok(file), + Err(std::fs::TryLockError::WouldBlock) => {} + Err(std::fs::TryLockError::Error(e)) => return Err(e), } - file.ok() + #[cfg(test)] + if let Some(waiting) = WHILE_STORE_LOCKED.take() { + waiting(); + } + file.lock()?; + Ok(file) } /// The browser has no folders to keep anything in. #[cfg(target_arch = "wasm32")] -fn lock_disabled(_: &Path) -> Option { - None +fn lock_store(_: &Path) -> std::io::Result { + Err(std::io::Error::new(std::io::ErrorKind::Unsupported, "no file system")) +} + +/// A turn on a plug-in store ([`Session::plugin_store_turn`]): while it is held, no other window or +/// process that takes one reads and changes the store's plug-ins, grants, disabled list, settings +/// or caches. Dropping it ends the turn. A turn is taken once per operation and handed to the +/// functions it calls, since a second lock of the same file by the same thread waits for ever. +pub(crate) struct StoreTurn { + /// [`DISABLED_LOCK`], locked; `None` without a store, and for a load that goes ahead without + /// a turn ([`Session::plugin_store_turn_for_load`]), which then writes nothing to the store. + lock: Option, +} + +impl StoreTurn { + /// A turn that isn't held, for a load that goes ahead without one: it writes nothing. + pub(crate) fn unheld() -> Self { + StoreTurn { lock: None } + } + + /// Whether the store may be written in this turn. + fn held(&self) -> bool { + self.lock.is_some() + } } #[cfg(test)] @@ -252,6 +289,15 @@ thread_local! { /// Tests: writing the `.delete` file beside a folder about to be deleted ([`delete_aside`]) /// fails on this thread, as on a full volume. pub(crate) static MARKER_WRITE_FAILS: std::cell::Cell = const { std::cell::Cell::new(false) }; + /// Tests: runs once on this thread when locking the plug-in store ([`lock_store`]) finds it + /// locked and waits. + pub(crate) static WHILE_STORE_LOCKED: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; + /// Tests: runs once on this thread when a grant write has read `grants.json` and before it + /// writes the file. + pub(crate) static AFTER_GRANTS_READ: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; + /// Tests: runs once on this thread when a change of a plug-in's settings has read them and + /// before it writes them. + pub(crate) static AFTER_SETTINGS_READ: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; } /// Remove `dir/file` → whether it is gone; a file that isn't there is what was wanted. @@ -401,11 +447,14 @@ impl Session { /// Keep the plug-ins this session installs in `dir`, take the disabled plug-ins saved there /// ([`DISABLED_FILE`]), and install the stored ones ([`Session::load_stored_plugins`]). pub fn attach_plugin_store(&mut self, dir: PathBuf) { - let disabled = - read_capped(&dir.join(DISABLED_FILE), safe_mode::MAX_DISABLED_FILE_BYTES).map(|b| safe_mode::parse_disabled_file(&b)).unwrap_or_default(); - safe_mode::set_disabled(disabled); + let path = dir.join(DISABLED_FILE); self.plugin_dir = Some(dir); - self.load_stored_plugins(); + // A `plugin.install` in another session or process writes the store before this reads it. + let _held = crate::cmd::plugin::hold_plugin_changes(); + let turn = self.plugin_store_turn_for_load(); + let disabled = read_capped(&path, safe_mode::MAX_DISABLED_FILE_BYTES).map(|b| safe_mode::parse_disabled_file(&b)).unwrap_or_default(); + safe_mode::set_disabled(disabled); + self.load_stored_plugins_in(&turn); } /// Install the plug-ins kept in the plug-in folder: none in Safe Mode, and none the user @@ -415,14 +464,25 @@ impl Session { /// stays in the folder with its grant. A grant for an id whose stored module lists no /// permissions is forgotten; one that can't be removed from the grants file doesn't count for /// any session in the process attached to the folder until the file can be written for the id - /// ([`Session::ignore_stored_grant`]). + /// ([`Session::ignore_stored_grant`]). The folder is read and changed in one turn on it + /// ([`Session::plugin_store_turn_for_load`]). pub fn load_stored_plugins(&mut self) { + if self.plugin_dir.is_none() || safe_mode::active() { + return; + } + // A `plugin.install` in another session or process writes the store before this reads it. + let _held = crate::cmd::plugin::hold_plugin_changes(); + let turn = self.plugin_store_turn_for_load(); + self.load_stored_plugins_in(&turn); + } + + /// [`Session::load_stored_plugins`] in `turn`, while [`crate::cmd::plugin::hold_plugin_changes`] + /// is held. + fn load_stored_plugins_in(&mut self, turn: &StoreTurn) { let Some(dir) = self.plugin_dir.clone() else { return }; if safe_mode::active() { return; } - // A `plugin.install` in another session writes the store before this reads it. - let _held = crate::cmd::plugin::hold_plugin_changes(); let grants = self.counted_grants(&dir); let limits = vectorcraft_plugins::Limits::default(); let mut left = MAX_PLUGIN_STORE; @@ -454,7 +514,7 @@ impl Session { Some(g) => { asks_nothing.remove(&m.id); vectorcraft_plugins::registry::grant(GrantToken::from_engine_grants_file(g.clone())); - vectorcraft_plugins::registry::set_storage(&m.id, plugin_storage(Some(&dir), &m.id)); + vectorcraft_plugins::registry::set_storage(&m.id, plugin_storage(Some(&dir), &m.id, turn)); if let Err(e) = vectorcraft_plugins::registry::install(plugin.with_source(path.display().to_string())) { log::warn!("skipping the stored plug-in {}: {e}", path.display()); } @@ -466,7 +526,7 @@ impl Session { } Ok(plugin) => { asks_nothing.insert(plugin.id().to_string()); - vectorcraft_plugins::registry::set_storage(plugin.id(), plugin_storage(Some(&dir), plugin.id())); + vectorcraft_plugins::registry::set_storage(plugin.id(), plugin_storage(Some(&dir), plugin.id(), turn)); if let Err(e) = vectorcraft_plugins::registry::install(plugin.with_source(path.display().to_string())) { log::warn!("skipping the stored plug-in {}: {e}", path.display()); } @@ -483,13 +543,34 @@ impl Session { }; if named { let writes = self.grant_writes(); - if !self.store_grant(id, None) && self.holds_plugin_grant(id) { + if !self.store_grant_in(turn, id, None) && self.holds_plugin_grant(id) { self.ignore_stored_grant(id, writes); } } } } + /// Take a turn on the attached plug-in store ([`StoreTurn`]), waiting while another window or + /// process holds one; without a store, a turn that writes nothing. An error, with a log record, + /// when the lock file can't be made, opened or locked. Taken after + /// [`crate::cmd::plugin::hold_plugin_changes`] when both are needed, and never by a thread that + /// holds a turn already. + pub(crate) fn plugin_store_turn(&self) -> std::io::Result { + let Some(dir) = self.plugin_dir.as_deref() else { return Ok(StoreTurn::unheld()) }; + lock_store(dir) + .map(|file| StoreTurn { lock: Some(file) }) + .inspect_err(|e| log::warn!("can't lock {}: {e}", dir.join(DISABLED_LOCK).display())) + } + + /// [`Session::plugin_store_turn`] for a load, which goes ahead without the turn when the store + /// folder isn't there (nothing is stored) or can't be locked, and then writes nothing to it. + pub(crate) fn plugin_store_turn_for_load(&self) -> StoreTurn { + match self.plugin_dir.as_deref() { + Some(dir) if dir.is_dir() => self.plugin_store_turn().unwrap_or_else(|_| StoreTurn::unheld()), + _ => StoreTurn::unheld(), + } + } + /// Write the disabled plug-ins saved for the next launch to the plug-in folder → whether they /// went there, every change included (`false` without a folder, and when a plug-in turned off /// found the file's list full: [`safe_mode::Merged::complete`]). The changes this launch made are applied to the list @@ -499,8 +580,15 @@ impl Session { /// a file that can't be read (too large, say) or that a later version wrote /// ([`safe_mode::read_disabled_file`]): it is kept as it is. pub fn store_disabled_plugins(&self) -> bool { + self.plugin_store_turn().is_ok_and(|turn| self.store_disabled_plugins_in(&turn)) + } + + /// [`Session::store_disabled_plugins`] in `turn`; `false` when it isn't held. + pub(crate) fn store_disabled_plugins_in(&self, turn: &StoreTurn) -> bool { let Some(dir) = self.plugin_dir.as_deref() else { return false }; - let Some(_turn) = lock_disabled(dir) else { return false }; + if !turn.held() { + return false; + } let path = dir.join(DISABLED_FILE); let theirs = match read_capped(&path, safe_mode::MAX_DISABLED_FILE_BYTES) { Ok(bytes) => match safe_mode::read_disabled_file(&bytes) { @@ -580,10 +668,10 @@ impl Session { grants } - /// Write the module `bytes` of the plug-in `id` to the store → whether they went there (`false` - /// without a folder). - pub(crate) fn store_plugin(&self, id: &str, bytes: &[u8]) -> bool { - self.plugin_dir.as_deref().is_some_and(|dir| put(dir, &format!("{}.{PLUGIN_EXT}", file_stem(id)), bytes)) + /// Write the module `bytes` of the plug-in `id` to the store in `turn` → whether they went there + /// (`false` without a folder, and when `turn` isn't held). + pub(crate) fn store_plugin(&self, turn: &StoreTurn, id: &str, bytes: &[u8]) -> bool { + turn.held() && self.plugin_dir.as_deref().is_some_and(|dir| put(dir, &format!("{}.{PLUGIN_EXT}", file_stem(id)), bytes)) } /// The module the store holds for the plug-in `id`: `None` without a folder or such a file, and @@ -601,14 +689,15 @@ impl Session { /// Return the store's module for the plug-in `id` to `previous`, the bytes it held before a /// write ([`Session::stored_plugin_bytes`]): with `None`, the file is removed. → whether the /// write reported success; a write that reports a failure may still have put `previous` back. - pub(crate) fn put_back_plugin(&self, id: &str, previous: Option<&[u8]>) -> bool { + /// In `turn`, the one the write was made in. + pub(crate) fn put_back_plugin(&self, turn: &StoreTurn, id: &str, previous: Option<&[u8]>) -> bool { #[cfg(test)] if PUT_BACK_FAILS.get() { return false; } let back = match previous { - Some(bytes) => self.store_plugin(id, bytes), - None => self.unstore_plugin(id), + Some(bytes) => self.store_plugin(turn, id, bytes), + None => self.unstore_plugin(turn, id), }; #[cfg(test)] if PUT_BACK_FAILS_AFTER_WRITE.get() { @@ -623,15 +712,23 @@ impl Session { self.plugin_dir.as_ref().map(|dir| dir.join(format!("{}.{PLUGIN_EXT}", file_stem(id))).display().to_string()) } + /// Tests: [`Session::store_grant_in`] in a turn of its own ([`Session::plugin_store_turn`]); + /// `false` when it can't be taken. + #[cfg(test)] + pub(crate) fn store_grant(&self, id: &str, grant: Option) -> bool { + self.plugin_store_turn().is_ok_and(|turn| self.store_grant_in(&turn, id, grant)) + } + /// Record in the store what the user granted plug-in `id` (`None`: nothing), leaving the store's /// other grants as they are; with none left, remove the file. Entries this version can't use /// are written back as they were, except one for `id`. A grants file that is too large, can't /// be read or doesn't hold a list is left as it is, with a log record, and nothing is recorded; - /// so is one whose new content would be larger than `MAX_GRANTS_FILE`. → whether the store now - /// holds what was asked (`false` without a folder). When it does, the grant kept for `id` counts - /// again, for every session in the process attached to the store ([`Session::ignore_stored_grant`]). - pub(crate) fn store_grant(&self, id: &str, grant: Option) -> bool { - let done = self.write_grant(id, grant); + /// so is one whose new content would be larger than `MAX_GRANTS_FILE`. The file is read and + /// written in `turn`. → whether the store now holds what was asked (`false` without a folder, + /// and when `turn` isn't held). When it does, the grant kept for `id` counts again, for every + /// session in the process attached to the store ([`Session::ignore_stored_grant`]). + pub(crate) fn store_grant_in(&self, turn: &StoreTurn, id: &str, grant: Option) -> bool { + let done = turn.held() && self.write_grant(id, grant); if done && let Some(key) = self.plugin_dir.as_deref().map(plugin_store_key) { let mut shared = IGNORED_PLUGIN_GRANTS.lock().unwrap_or_else(|e| e.into_inner()); let entry = (key, id.to_string()); @@ -648,7 +745,7 @@ impl Session { done } - /// How many grant writes the sessions of the process have made ([`Session::store_grant`]). + /// How many grant writes the sessions of the process have made ([`Session::store_grant_in`]). /// Taken before a write that may fail, for [`Session::ignore_stored_grant`]. pub(crate) fn grant_writes(&self) -> u64 { IGNORED_PLUGIN_GRANTS.lock().unwrap_or_else(|e| e.into_inner()).writes @@ -661,7 +758,7 @@ impl Session { } /// Stop counting the attached store's grant for the plug-in `id`, in every session in the - /// process attached to the same folder, until [`Session::store_grant`] next succeeds for it in + /// process attached to the same folder, until [`Session::store_grant_in`] next succeeds for it in /// one of them: for a grant that should be gone and could not be removed, which would otherwise /// approve the bytes it covers. `writes` is [`Session::grant_writes`] from before the failed /// write: when a session has written the store's grants for `id` since, the file holds what that @@ -687,6 +784,10 @@ impl Session { return false; } }; + #[cfg(test)] + if let Some(between) = AFTER_GRANTS_READ.take() { + between(); + } let others = file.other.len(); file.other.retain(|entry| entry.get("id").and_then(serde_json::Value::as_str) != Some(id)); let changed = match grant { @@ -724,16 +825,17 @@ impl Session { }) } - /// Remove the plug-in `id` from the store → whether its file is gone (`false` without a folder). - pub(crate) fn unstore_plugin(&self, id: &str) -> bool { - self.plugin_dir.as_deref().is_some_and(|dir| take(dir, &format!("{}.{PLUGIN_EXT}", file_stem(id)))) + /// Remove the plug-in `id` from the store in `turn` → whether its file is gone (`false` without a + /// folder, and when `turn` isn't held). + pub(crate) fn unstore_plugin(&self, turn: &StoreTurn, id: &str) -> bool { + turn.held() && self.plugin_dir.as_deref().is_some_and(|dir| take(dir, &format!("{}.{PLUGIN_EXT}", file_stem(id)))) } /// Keep the settings and cache of plug-in `id` in the attached plug-in store from now on; without /// one, nowhere (its storage calls then fail as unavailable). Settings and cache that a removal - /// kept are moved back first ([`plugin_storage`]). - pub(crate) fn attach_plugin_storage(&self, id: &str) { - vectorcraft_plugins::registry::set_storage(id, plugin_storage(self.plugin_dir.as_deref(), id)); + /// kept are moved back first, in `turn` ([`plugin_storage`]). + pub(crate) fn attach_plugin_storage(&self, turn: &StoreTurn, id: &str) { + vectorcraft_plugins::registry::set_storage(id, plugin_storage(self.plugin_dir.as_deref(), id, turn)); } /// Does the attached plug-in store have a folder of settings and cache for plug-in `id`, or one @@ -757,9 +859,13 @@ impl Session { /// that rename fails too, the error also names both paths and the reason, and the next attach or /// removal for the id moves the folder back. Once `forget` returns `true`, the folder and the /// kept settings are deleted ([`delete_aside`]); what that deletion leaves stays, with a log - /// record, and a later call for the id tries to delete it again. - pub(crate) fn remove_plugin_storage(&self, id: &str, forget: impl FnOnce() -> bool) -> Result<(), StorageError> { + /// record, and a later call for the id tries to delete it again. All of it happens in `turn`; + /// with a store and a turn that isn't held, nothing changes and this fails. + pub(crate) fn remove_plugin_storage(&self, turn: &StoreTurn, id: &str, forget: impl FnOnce() -> bool) -> Result<(), StorageError> { let not_forgotten = || StorageError::Io(GRANT_NOT_REMOVED.to_string()); + if self.plugin_dir.is_some() && !turn.held() { + return Err(StorageError::Io(STORE_NOT_LOCKED.to_string())); + } vectorcraft_plugins::registry::set_storage(id, None); let Some(dir) = &self.plugin_dir else { return if forget() { Ok(()) } else { Err(not_forgotten()) }; @@ -943,13 +1049,16 @@ fn restore_removed(path: &Path) -> std::io::Result<()> { /// Where plug-in `id` keeps its settings and cache in the plug-in store `dir`. Settings and cache /// that a removal kept are moved back first ([`restore_removed`]); when that fails, the failure is /// logged and there is no storage (its calls fail as unavailable), so that nothing the plug-in -/// writes takes their place. A later attach or load tries again. -fn plugin_storage(dir: Option<&Path>, id: &str) -> Option> { +/// writes takes their place. A later attach or load tries again. They are moved in `turn`; when it +/// isn't held, they stay where they are, as when moving them fails. +fn plugin_storage(dir: Option<&Path>, id: &str, turn: &StoreTurn) -> Option> { let dir = dir?; let data = plugin_data_dir(dir, id); if !is_link(&dir.join(PLUGIN_DATA_DIR)) { let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); - if let Err(e) = restore_removed(&data) { + let kept_aside = || std::fs::symlink_metadata(&data).is_err() && aside_paths(&data).iter().any(|a| is_kept(a)); + let restored = if turn.held() || !kept_aside() { restore_removed(&data) } else { Err(std::io::Error::other(STORE_NOT_LOCKED)) }; + if let Err(e) = restored { log::warn!("can't move the settings and cache of {} back: {e}", data.display()); return None; } @@ -1088,6 +1197,12 @@ impl PluginStorage { Ok(()) } + /// A turn on the plug-in store ([`lock_store`]), taken before [`PLUGIN_DATA_LOCK`], so that a + /// window or process changing the same settings or cache waits for this change. + fn turn(&self) -> Result { + lock_store(&self.root).map_err(|e| StorageError::Io(format!("{STORE_NOT_LOCKED}: {e}"))) + } + fn kept(&self) -> MutexGuard<'_, Kept> { self.state.kept.lock().unwrap_or_else(|e| e.into_inner()) } @@ -1212,6 +1327,8 @@ impl PluginStorage { impl Storage for PluginStorage { fn setting(&self, key: &str, meter: &mut Meter) -> Result>, StorageError> { + // Reading may move a settings file that doesn't read aside. + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let mut kept = self.kept(); @@ -1219,10 +1336,15 @@ impl Storage for PluginStorage { } fn set_setting(&self, key: &str, value: &[u8], meter: &mut Meter) -> Result<(), StorageError> { + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let mut kept = self.kept(); let settings = &mut self.read_settings(&mut kept.settings, meter)?.values; + #[cfg(test)] + if let Some(between) = AFTER_SETTINGS_READ.take() { + between(); + } if value.len() > storage::MAX_SETTING_BYTES || (!settings.contains_key(key) && settings.len() >= storage::MAX_SETTINGS) { return Err(StorageError::Full); } @@ -1234,6 +1356,7 @@ impl Storage for PluginStorage { } fn delete_setting(&self, key: &str, meter: &mut Meter) -> Result { + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let mut kept = self.kept(); @@ -1258,6 +1381,8 @@ impl Storage for PluginStorage { } fn set_cache_entry(&self, name: &str, value: &[u8], meter: &mut Meter) -> Result<(), StorageError> { + // The cache's size and count are added up and the entry written in one turn. + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let path = self.entry_path(name); @@ -1281,6 +1406,7 @@ impl Storage for PluginStorage { } fn remove_cache_entry(&self, name: &str) -> Result { + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let path = self.entry_path(name); @@ -1296,6 +1422,7 @@ impl Storage for PluginStorage { } fn clear_cache(&self) -> Result { + let _turn = self.turn()?; let _held = PLUGIN_DATA_LOCK.lock().unwrap_or_else(|e| e.into_inner()); self.open()?; let dir = self.cache_dir(); diff --git a/crates/engine/src/tests/anchor_edit_work.rs b/crates/engine/src/tests/anchor_edit_work.rs index 7ad50a871d..1055156167 100644 --- a/crates/engine/src/tests/anchor_edit_work.rs +++ b/crates/engine/src/tests/anchor_edit_work.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use serde_json::{Value, json}; use vectorcraft_doc::{Appearance, Document, Node, NodeId}; use vectorcraft_geom::path::measured_segments; -use vectorcraft_geom::{Anchor, PathData, Point, SubPath}; +use vectorcraft_geom::{Anchor, AnchorKind, PathData, Point, SubPath, Vec2}; use crate::*; @@ -109,3 +109,29 @@ fn an_anchor_edit_that_changes_nothing_records_no_undo_step() { s.execute("path.moveAnchor", &json!({"id": id.0, "anchor": 5, "x": a.p.x + 1.0, "y": a.p.y})).unwrap(); assert_eq!(undo_steps(&s), 1); } + +/// `path.setHandle` to where the handle already is, on a smooth anchor whose other handle is not in +/// line with it, leaves both handles as they are and records no undo step. With `independent` it +/// makes the anchor a corner, which records one. +#[test] +fn a_handle_already_in_place_on_a_smooth_anchor_records_no_undo_step() { + let (mut s, id) = long_path(100); + let p = anchor(&s, id, 5).p; + let smooth = Anchor { p, h_in: p + Vec2::new(-3.0, 0.0), h_out: p + Vec2::new(0.0, 4.0), kind: AnchorKind::Smooth }; + let path = Arc::make_mut(&mut s.doc_mut().unwrap().doc).node_mut(id).unwrap().path_data_mut().unwrap(); + path.subpaths[0].anchors[5] = smooth; + for which in ["out", "in"] { + let h = if which == "out" { smooth.h_out } else { smooth.h_in }; + s.execute("path.setHandle", &json!({"id": id.0, "anchor": 5, "which": which, "x": h.x, "y": h.y})).unwrap(); + assert_eq!(undo_steps(&s), 0, "path.setHandle on the {which} handle recorded an undo step"); + assert_eq!(anchor(&s, id, 5), smooth, "path.setHandle on the {which} handle changed the anchor"); + } + s.execute("path.setHandle", &json!({"id": id.0, "anchor": 5, "which": "out", "x": smooth.h_out.x, "y": smooth.h_out.y, "independent": true})) + .unwrap(); + assert_eq!(undo_steps(&s), 1); + assert_eq!(anchor(&s, id, 5).kind, AnchorKind::Corner); + // On a corner, the same independent request changes nothing. + s.execute("path.setHandle", &json!({"id": id.0, "anchor": 5, "which": "out", "x": smooth.h_out.x, "y": smooth.h_out.y, "independent": true})) + .unwrap(); + assert_eq!(undo_steps(&s), 1); +} diff --git a/crates/engine/src/tests/bboxrotate.rs b/crates/engine/src/tests/bboxrotate.rs index aa1c14885c..6dc1c9b410 100644 --- a/crates/engine/src/tests/bboxrotate.rs +++ b/crates/engine/src/tests/bboxrotate.rs @@ -560,6 +560,125 @@ fn reset_bounding_box_then_release_intertwine() { reset_then_release("object.intertwine.make", "object.intertwine.release"); } +/// A symbol of two rectangles, the first turned `inner` degrees before the symbol is made, placed +/// as an instance that is then turned 20°. +fn turned_instance(inner: f64) -> (Session, NodeId) { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + let b = rect(&mut s, 150.0, 220.0, 100.0, 50.0); + if inner != 0.0 { + sel(&mut s, &[a]); + s.execute("object.rotate", &json!({"angle": inner})).unwrap(); + } + sel(&mut s, &[a, b]); + let inst = id_of(&s.execute("symbol.new", &json!({"name": "Pair"})).unwrap()); + sel(&mut s, &[inst]); + s.execute("object.rotate", &json!({"angle": 20})).unwrap(); + assert!(near(angle(&s, inst), 20.0)); + (s, inst) +} + +/// Break Link and Expand with the parameters that turn instance `inst` into its art. +fn expand_instance(s: &mut Session, command: &str, inst: NodeId) { + sel(s, &[inst]); + let params = if command == "symbol.breakLink" { json!({"ids": [inst.0]}) } else { json!({"object": true, "fill": false, "stroke": false}) }; + s.execute(command, ¶ms).unwrap(); + assert!(s.doc().unwrap().doc.node(inst).is_none_or(|n| !matches!(n.kind, vectorcraft_doc::NodeKind::SymbolInstance { .. })), "{command}"); +} + +/// The angles of the objects inside the document's only top-level object, that object included. +fn art_angles(s: &Session) -> Vec { + let d = &s.doc().unwrap().doc; + let layer = d.layers.first().unwrap(); + let top = layer.children().unwrap(); + assert_eq!(top.len(), 1); + let mut out = vec![]; + subtree_angles(&top[0], &mut out); + out +} + +#[test] +fn reset_bounding_box_then_expand_symbol_instance() { + for command in ["symbol.breakLink", "object.expand"] { + let (mut s, inst) = turned_instance(0.0); + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1); + assert_eq!(angle(&s, inst), 0.0); + expand_instance(&mut s, command, inst); + let angles = art_angles(&s); + assert!(angles.len() >= 2 && angles.iter().all(|a| near(*a, 0.0)), "{command}: {angles:?}"); + s.execute("select.all", &json!({})).unwrap(); + assert_eq!(selection_box(&s).angle, 0.0, "{command}"); + } +} + +#[test] +fn expanding_a_turned_symbol_instance_keeps_its_angle() { + for command in ["symbol.breakLink", "object.expand"] { + let (mut s, inst) = turned_instance(0.0); + expand_instance(&mut s, command, inst); + let angles = art_angles(&s); + assert!(angles.len() >= 2 && angles.iter().all(|a| near(*a, 20.0)), "{command}: {angles:?}"); + } +} + +#[test] +fn reset_bounding_box_then_expand_keeps_the_angles_inside_the_symbol() { + for command in ["symbol.breakLink", "object.expand"] { + let (mut s, inst) = turned_instance(30.0); + s.execute("object.resetBoundingBox", &json!({})).unwrap(); + expand_instance(&mut s, command, inst); + // The turned rectangle keeps the 30° it had in the symbol; the rest stand square. + let mut angles = art_angles(&s); + angles.sort_by(f64::total_cmp); + assert!(near(*angles.last().unwrap(), 30.0) && angles[..angles.len() - 1].iter().all(|a| near(*a, 0.0)), "{command}: {angles:?}"); + } +} + +/// The group that an instance's opacity adds around the art of a one-object symbol stands as the +/// instance's box does, turned or reset. +#[test] +fn expanding_a_faded_symbol_instance_gives_its_group_the_instance_box() { + for command in ["symbol.breakLink", "object.expand"] { + for reset in [false, true] { + let mut s = session(); + let a = rect(&mut s, 100.0, 100.0, 100.0, 50.0); + sel(&mut s, &[a]); + let inst = id_of(&s.execute("symbol.new", &json!({"name": "One"})).unwrap()); + sel(&mut s, &[inst]); + s.execute("object.rotate", &json!({"angle": 20})).unwrap(); + s.execute("object.setProps", &json!({"ids": [inst.0], "opacity": 50})).unwrap(); + if reset { + s.execute("object.resetBoundingBox", &json!({})).unwrap(); + } + expand_instance(&mut s, command, inst); + let want = if reset { 0.0 } else { 20.0 }; + let angles = art_angles(&s); + assert!(angles.len() == 2 && angles.iter().all(|a| near(*a, want)), "{command}, reset {reset}: {angles:?}"); + } + } +} + +/// A mirrored instance: turned 170° and then reflected, its box stands 180° from the box its +/// transform gives in one step. The art takes the instance's box, and stands square after a reset. +#[test] +fn expanding_a_reflected_symbol_instance_keeps_its_box() { + for command in ["symbol.breakLink", "object.expand"] { + for reset in [false, true] { + let (mut s, inst) = turned_instance(0.0); + s.execute("object.rotate", &json!({"angle": 150})).unwrap(); + s.execute("object.reflect", &json!({"axis": "horizontal"})).unwrap(); + assert!(near(angle(&s, inst), -170.0), "{}", angle(&s, inst)); + if reset { + s.execute("object.resetBoundingBox", &json!({})).unwrap(); + } + let want = angle(&s, inst); + expand_instance(&mut s, command, inst); + let angles = art_angles(&s); + assert!(angles.len() >= 2 && angles.iter().all(|a| near(*a, want)), "{command}, reset {reset}: {angles:?}"); + } + } +} + #[test] fn reset_bounding_box_then_release_linked_opacity_mask() { let mut s = session(); diff --git a/crates/engine/src/tests/brushsym.rs b/crates/engine/src/tests/brushsym.rs index e961a59e81..bc4ce76c83 100644 --- a/crates/engine/src/tests/brushsym.rs +++ b/crates/engine/src/tests/brushsym.rs @@ -963,6 +963,69 @@ fn brush_freehand_paints_with_a_brush_in_one_step() { assert_eq!(brush_of(&s, id).as_deref(), Some("Charcoal")); } +/// `brush.freehand` refuses a `brush` that is not a string or names no brush in the document, +/// and a `style` other than "pencil" or "brush", before it draws: the document, the selection +/// and the undo history stay as they were. A `brush` left out or null draws the plain path. +#[test] +fn brush_freehand_refuses_a_brush_or_style_it_cannot_use() { + let mut s = session(); + let a = rect(&mut s, 0.0, 0.0, 10.0, 10.0); + select(&mut s, &[a]); + let points = json!([[10, 10], [60, 40], [120, 10]]); + for (extra, words) in [ + (json!({"brush": "Nope"}), "no brush named `Nope`"), + (json!({"brush": ""}), "no brush named ``"), + (json!({"brush": 5}), "`brush` must be a string"), + (json!({"brush": {"name": "Charcoal"}}), "`brush` must be a string"), + (json!({"brush": true}), "`brush` must be a string"), + (json!({"brush": "Charcoal", "style": "marker"}), "`style` must be \"pencil\" or \"brush\", not \"marker\""), + (json!({"brush": "Charcoal", "style": 1}), "`style` must be \"pencil\" or \"brush\", not 1"), + ] { + let mut p = extra.clone(); + p["points"] = points.clone(); + let (before, undo) = (s.doc().unwrap().doc.clone(), s.doc().unwrap().history.undo.len()); + let e = s.execute("brush.freehand", &p).expect_err(&format!("{extra} is refused")); + assert!(e.to_string().contains(words), "{extra}: {e}"); + assert!(*s.doc().unwrap().doc == *before, "{extra} leaves the document"); + assert_eq!(s.doc().unwrap().selection.objects, [a], "{extra} leaves the selection"); + assert_eq!(s.doc().unwrap().history.undo.len(), undo, "{extra} records no undo step"); + } + for extra in [json!({}), json!({"brush": null, "style": null})] { + let mut p = extra.clone(); + p["points"] = points.clone(); + let id = NodeId(s.execute("brush.freehand", &p).unwrap()["id"].as_u64().unwrap()); + assert_eq!(brush_of(&s, id), None, "{extra} draws the plain path"); + } + for style in ["pencil", "brush"] { + let r = s.execute("brush.freehand", &json!({"points": points, "style": style, "brush": "Charcoal"})).unwrap(); + assert!(r["id"].is_u64(), "{style}: {r}"); + } +} + +/// The Paintbrush skips a brush deleted after it was chosen: a deleted tool brush gives way to +/// the document's current brush, and with neither the stroke is drawn without a brush. +#[test] +fn paintbrush_tool_skips_a_deleted_brush() { + let mut s = session(); + s.execute("brush.setCurrent", &json!({"name": "Arrow"})).unwrap(); + let v = ViewInfo::default(); + s.select_tool("paintbrush", v).unwrap(); + s.set_tool_option("brush", &json!("Dots")); + s.execute("brush.delete", &json!({"name": "Dots"})).unwrap(); + let stroke = |s: &mut Session, y: f64| { + for (k, x) in [(PointerKind::Down, 10.0), (PointerKind::Drag, 50.0), (PointerKind::Drag, 90.0), (PointerKind::Up, 130.0)] { + s.pointer(&PointerEvent::new(k, x, y), v).unwrap(); + } + s.doc().unwrap().selection.objects[0] + }; + let id = stroke(&mut s, 10.0); + assert_eq!(brush_of(&s, id).as_deref(), Some("Arrow")); + s.execute("brush.delete", &json!({"name": "Arrow"})).unwrap(); + assert_eq!(s.doc().unwrap().doc.unknown.get("currentBrush"), None); + let id = stroke(&mut s, 110.0); + assert_eq!(brush_of(&s, id), None); +} + #[test] fn paintbrush_tool_uses_the_current_brush() { let mut s = session(); diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 1c3ad5d8b4..e0d68ee949 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -2947,6 +2947,192 @@ fn live_paint_release_and_expand() { assert!((area(&s, a) - 10000.0).abs() < 1.0); } +/// Set the appearance rows of the face of Live Paint group `g` at `face` (or the edge nearest +/// `edge`) to `items`, and give it `opacity`; returns that child's id. +fn set_live_part(s: &mut Session, g: NodeId, face: Option<(f64, f64)>, edge: Option<(f64, f64)>, items: Vec, opacity: f32) -> NodeId { + use vectorcraft_tools::builder::{edge_near, face_at}; + let n = node(s, g); + let part = match (face, edge) { + (Some((x, y)), _) => face_at(&n, Point::new(x, y)), + (_, Some((x, y))) => edge_near(&n, Point::new(x, y), 0.5), + _ => None, + }; + let id = part.unwrap().id; + s.edit("t", |d, _| { + let c = d.node_mut(id).unwrap(); + c.appearance.items = items; + c.opacity = opacity; + Ok(()) + }) + .unwrap(); + id +} + +/// Expand keeps a face or edge when a fill or stroke row draws it, whatever row is on top: a +/// painted lower row under an unpainted top row is kept, and a part whose only painted row is +/// hidden, transparent or 0 pt wide, or whose own opacity is 0, is dropped. +#[test] +fn live_paint_expand_keeps_the_faces_and_edges_that_draw() { + use vectorcraft_doc::{FillLayer, StrokeLayer}; + let fill = |p: Paint| AppearanceItem::Fill(FillLayer::new(p)); + let stroke = |p: Paint, w: f64| AppearanceItem::Stroke(StrokeLayer::new(p, w)); + let red = || Paint::solid(Color::rgb(1.0, 0.0, 0.0)); + let hidden = |mut i: AppearanceItem| { + match &mut i { + AppearanceItem::Fill(f) => f.visible = false, + AppearanceItem::Stroke(st) => st.visible = false, + } + i + }; + let clear = |mut i: AppearanceItem| { + match &mut i { + AppearanceItem::Fill(f) => f.opacity = 0.0, + AppearanceItem::Stroke(st) => st.opacity = 0.0, + } + i + }; + let mut s = session(); + let g = live(&mut s); + let lower_fill = set_live_part(&mut s, g, Some((25.0, 50.0)), None, vec![fill(red()), fill(Paint::None)], 1.0); + let hidden_fill = set_live_part(&mut s, g, Some((125.0, 50.0)), None, vec![hidden(fill(red()))], 1.0); + let clear_fill = set_live_part(&mut s, g, Some((75.0, 50.0)), None, vec![clear(fill(red()))], 1.0); + let lower_stroke = set_live_part(&mut s, g, None, Some((0.0, 50.0)), vec![stroke(red(), 2.0), stroke(Paint::None, 1.0)], 1.0); + let hidden_stroke = set_live_part(&mut s, g, None, Some((150.0, 50.0)), vec![hidden(stroke(red(), 2.0))], 1.0); + let thin_stroke = set_live_part(&mut s, g, None, Some((100.0, 50.0)), vec![stroke(red(), 0.0)], 1.0); + let clear_stroke = set_live_part(&mut s, g, None, Some((50.0, 50.0)), vec![clear(stroke(red(), 2.0))], 1.0); + let clear_edge = set_live_part(&mut s, g, None, Some((75.0, 0.0)), vec![stroke(red(), 2.0)], 0.0); + let parts = [lower_fill, hidden_fill, clear_fill, lower_stroke, hidden_stroke, thin_stroke, clear_stroke, clear_edge]; + assert_eq!(parts.iter().collect::>().len(), parts.len()); + let before = node(&s, g); + s.execute("livePaint.expand", &json!({})).unwrap(); + let n = node(&s, g); + let kept: Vec = n.children().unwrap().iter().map(|c| c.id).collect(); + let has = |id: NodeId| kept.contains(&id); + assert!(has(lower_fill) && has(lower_stroke), "a painted lower row draws: {kept:?}"); + for id in [hidden_fill, clear_fill, hidden_stroke, thin_stroke, clear_stroke, clear_edge] { + assert!(!has(id), "{id:?} draws nothing: {kept:?}"); + } + // The kept parts keep every row. + let rows = |n: &Node, id: NodeId| n.children().unwrap().iter().find(|c| c.id == id).unwrap().appearance.items.clone(); + assert_eq!(rows(&n, lower_fill), rows(&before, lower_fill)); + assert_eq!(rows(&n, lower_stroke), rows(&before, lower_stroke)); +} + +/// Merge carries a face's whole appearance when one of its rows draws, and carries nothing from a +/// face that draws nothing. +#[test] +fn live_paint_merge_carries_the_faces_that_draw() { + use vectorcraft_doc::FillLayer; + use vectorcraft_tools::builder::face_at; + let fill = |p: Paint| AppearanceItem::Fill(FillLayer::new(p)); + let green = || Paint::solid(Color::rgb(0.0, 1.0, 0.0)); + let mut s = session(); + let g = live(&mut s); + let rows = vec![fill(green()), fill(Paint::None)]; + set_live_part(&mut s, g, Some((25.0, 50.0)), None, rows.clone(), 1.0); + let mut only_hidden = fill(green()); + if let AppearanceItem::Fill(f) = &mut only_hidden { + f.visible = false; + } + set_live_part(&mut s, g, Some((125.0, 50.0)), None, vec![only_hidden], 1.0); + let c = rect(&mut s, 120.0, 120.0, 100.0, 20.0); + s.execute("livePaint.merge", &json!({"ids": [g.0, c.0]})).unwrap(); + let n = node(&s, g); + assert_eq!(face_at(&n, Point::new(25.0, 50.0)).unwrap().appearance.items, rows, "the drawn lower fill is carried"); + let b = face_at(&n, Point::new(125.0, 50.0)).unwrap(); + assert_eq!(b.appearance.fill_paint(), Paint::solid(Color::rgb(0.0, 0.0, 1.0)), "the face takes its source's fill again"); + assert!(b.appearance.has_drawn_fill()); +} + +/// Merge rebuilds the faces and edges as other paths, so the appearance it carries to them leaves +/// the strokes' pen pressure behind and keeps the rest. +#[test] +fn live_paint_merge_leaves_pen_pressure_behind() { + use vectorcraft_doc::{FillLayer, PressureProfile, StrokeLayer}; + use vectorcraft_tools::builder::{edge_near, face_at}; + let pressed = || { + let mut st = StrokeLayer::new(Paint::solid(Color::BLACK), 3.0); + st.pressure = PressureProfile::from_samples([(0.0, 0.2), (0.5, 1.0), (1.0, 0.2)]); + assert!(st.pressure.is_some()); + st + }; + let green = AppearanceItem::Fill(FillLayer::new(Paint::solid(Color::rgb(0.0, 1.0, 0.0)))); + let mut s = session(); + let g = live(&mut s); + set_live_part(&mut s, g, Some((75.0, 50.0)), None, vec![green.clone(), AppearanceItem::Stroke(pressed())], 1.0); + set_live_part(&mut s, g, None, Some((0.0, 50.0)), vec![AppearanceItem::Stroke(pressed())], 1.0); + let c = rect(&mut s, 120.0, 120.0, 100.0, 20.0); + s.execute("livePaint.merge", &json!({"ids": [g.0, c.0]})).unwrap(); + let n = node(&s, g); + let mut plain = pressed(); + plain.pressure = None; + let face = &face_at(&n, Point::new(75.0, 50.0)).unwrap().appearance.items; + assert_eq!(face, &vec![green, AppearanceItem::Stroke(plain.clone())]); + assert_eq!(edge_near(&n, Point::new(0.0, 50.0), 0.5).unwrap().appearance.items, vec![AppearanceItem::Stroke(plain)]); +} + +/// The gradients Merge carries to the rebuilt faces and edges keep their fit on the old outline, +/// lower rows included. +#[test] +fn live_paint_merge_keeps_the_fit_of_carried_gradients() { + use vectorcraft_color::{Gradient, GradientKind, GradientPaint, GradientStop}; + use vectorcraft_doc::{FillLayer, StrokeLayer}; + use vectorcraft_tools::builder::{edge_near, face_at}; + let stops = vec![GradientStop::new(0.0, Color::BLACK), GradientStop::new(1.0, Color::WHITE)]; + let unplaced = GradientPaint::new(Gradient::new(GradientKind::Linear, stops)); + let gradient = || Paint::Gradient(Box::new(unplaced.clone())); + let mut s = session(); + let g = live(&mut s); + let rows = vec![AppearanceItem::Fill(FillLayer::new(gradient())), AppearanceItem::Fill(FillLayer::new(Paint::None))]; + let face = set_live_part(&mut s, g, Some((25.0, 50.0)), None, rows, 1.0); + let edge = set_live_part(&mut s, g, None, Some((0.0, 50.0)), vec![AppearanceItem::Stroke(StrokeLayer::new(gradient(), 2.0))], 1.0); + let before = node(&s, g); + let old = |id: NodeId| before.children().unwrap().iter().find(|c| c.id == id).unwrap().clone(); + let (old_face, old_edge) = (old(face), old(edge)); + let c = rect(&mut s, 120.0, 120.0, 100.0, 20.0); + s.execute("livePaint.merge", &json!({"ids": [g.0, c.0]})).unwrap(); + let n = node(&s, g); + let geom = |items: &[AppearanceItem]| match items[0].paint() { + Paint::Gradient(gp) => gp.geom, + p => panic!("a gradient, not {p:?}"), + }; + let face_bounds = old_face.geometric_bounds().unwrap(); + let new_face = face_at(&n, Point::new(25.0, 50.0)).unwrap(); + assert_eq!(geom(&new_face.appearance.items), Some(unplaced.resolve(face_bounds)), "the lower-row fill keeps its fit"); + let AppearanceItem::Stroke(st) = &old_edge.appearance.items[0] else { panic!("a stroke") }; + let edge_box = st.paint_bounds(old_edge.geometric_bounds().unwrap()); + let new_edge = edge_near(&n, Point::new(0.0, 50.0), 0.5).unwrap(); + assert_eq!(geom(&new_edge.appearance.items), Some(unplaced.resolve(edge_box)), "the stroke keeps its fit"); +} + +/// Merge carries a face's or edge's visibility, opacity and blending mode to the rebuilt part with +/// its appearance: a half-transparent face drawn by a stroke alone stays half transparent, and a +/// hidden edge stays hidden. +#[test] +fn live_paint_merge_keeps_the_visibility_opacity_and_blending_of_carried_parts() { + use vectorcraft_color::BlendMode; + use vectorcraft_doc::StrokeLayer; + use vectorcraft_tools::builder::{edge_near, face_at}; + let stroke = || AppearanceItem::Stroke(StrokeLayer::new(Paint::solid(Color::BLACK), 2.0)); + let mut s = session(); + let g = live(&mut s); + let face = set_live_part(&mut s, g, Some((25.0, 50.0)), None, vec![stroke()], 0.5); + let edge = set_live_part(&mut s, g, None, Some((0.0, 50.0)), vec![stroke()], 1.0); + s.edit("t", |d, _| { + d.node_mut(face).unwrap().blend = BlendMode::Multiply; + d.node_mut(edge).unwrap().visible = false; + Ok(()) + }) + .unwrap(); + let c = rect(&mut s, 120.0, 120.0, 100.0, 20.0); + s.execute("livePaint.merge", &json!({"ids": [g.0, c.0]})).unwrap(); + let n = node(&s, g); + let f = face_at(&n, Point::new(25.0, 50.0)).unwrap(); + assert_eq!((f.appearance.items.clone(), f.opacity, f.blend, f.visible), (vec![stroke()], 0.5, BlendMode::Multiply, true)); + let e = edge_near(&n, Point::new(0.0, 50.0), 0.5).unwrap(); + assert_eq!((e.appearance.items.clone(), e.visible), (vec![stroke()], false), "the hidden edge stays hidden"); +} + fn live_group_only(s: &mut Session) -> NodeId { let r = s.execute("livePaint.make", &json!({})).unwrap(); NodeId(r["id"].as_u64().unwrap()) @@ -4229,6 +4415,41 @@ fn a_trace_run_hands_its_trace_to_the_command() { assert!((bb.center().x - 160.0).abs() < 1.5, "traced where the image is now: {bb:?}"); } +/// A trace made in one document applies only there: in another document with the same image, +/// object and settings, the run no longer applies, and both trace commands drop the trace handed +/// in and trace that document's own image, as one undo step. +#[test] +fn a_trace_run_applies_only_in_its_own_document() { + let p = json!({"params": {"ignoreWhite": true}}); + for command in ["imageTrace.make", "imageTrace.makeAndExpand"] { + let mut direct = session(); + image_doc(&mut direct); + let want = direct.execute(command, &p).unwrap(); + let mut s = session(); + let img = image_doc(&mut s); + let a = s.active_index().unwrap(); + let copy = (*s.doc().unwrap().doc).clone(); + let run = cmd::TraceRun::prepare(&s, command, &p).unwrap(); + let traced = run.run(&|_, _| true).unwrap(); + let b = s.add_document(copy, None); + assert_ne!(s.documents()[a].uid, s.documents()[b].uid); + assert!(!run.current(&s), "{command}: another document"); + assert!(s.set_active(a)); + assert!(run.current(&s), "{command}: its own document"); + assert!(s.set_active(b)); + traced.hand_in(&mut s); + let got = s.execute(run.command(), run.params()).unwrap(); + assert!(s.trace_hand_off.is_none(), "{command}: dropped"); + assert_eq!(got, want, "{command}"); + let g = NodeId(got["id"].as_u64().unwrap()); + assert_eq!(node(&s, g), node(&direct, g), "{command}"); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(matches!(node(&s, img).kind, NodeKind::Image(_)), "{command}: one undo step"); + assert!(s.set_active(a)); + assert!(matches!(node(&s, img).kind, NodeKind::Image(_)), "{command}: the first document is untouched"); + } +} + /// A plug-in run that calls Image Trace and then fails leaves a trace handed in for the command in /// place, as it leaves the document. #[test] diff --git a/crates/engine/src/tests/clipboard.rs b/crates/engine/src/tests/clipboard.rs index d0e003ec49..6cbfd909a9 100644 --- a/crates/engine/src/tests/clipboard.rs +++ b/crates/engine/src/tests/clipboard.rs @@ -468,6 +468,72 @@ fn styles_symbols_and_images_of_the_same_name_are_renamed() { assert_eq!(key(&s, img2), src_key); } +/// A graph whose series fill, value labels and legend rows paint with global swatch "Brand" and +/// whose value labels are set in character style "Emphasis" and paragraph style "Body", as a +/// later redraw would give them to its marks and labels. +fn styled_graph(s: &mut Session) -> NodeId { + s.execute("swatch.new", &json!({"name": "Brand", "color": "#ff0000", "global": true})).unwrap(); + s.execute("charStyle.new", &json!({"name": "Emphasis", "attrs": {"size": 24.0}})).unwrap(); + s.execute("paraStyle.new", &json!({"name": "Body", "attrs": {"space_after": 8.0}})).unwrap(); + let v = s.execute("graph.create", &json!({"type": "column", "x": 200, "y": 200, "width": 60, "height": 40, "csv": ",2024\nQ1,3\nQ2,5"})); + let id = id_of(&v.unwrap()); + let brand = linked(hex("#ff0000"), "Brand", 1.0); + let mut extras = doc_mut(s).node_mut(id).unwrap().extras_mut(); + let g = extras.graph.as_mut().unwrap(); + g.series_paints = vec![vectorcraft_doc::SeriesPaint { fill: Some(brand.clone()), ..Default::default() }]; + let l = &mut g.label_styles; + l.values = Some(vectorcraft_doc::CharStyle { fill: brand.clone(), style_name: Some("Emphasis".into()), ..Default::default() }); + l.values_para = Some(vectorcraft_doc::ParaStyle { style_name: Some("Body".into()), ..Default::default() }); + let rows = vectorcraft_doc::SeriesPaint { stroke: Some(brand), ..Default::default() }; + l.legend_rows = Some(vectorcraft_doc::graph::LabelRows { paint: rows, ..Default::default() }); + id +} + +/// The swatch names a graph's stored paints link to, and its value labels' character and +/// paragraph style names. +fn graph_links(s: &Session, id: NodeId) -> (Vec, Option, Option) { + let n = node(s, id); + let swatches = vectorcraft_doc::swatches::graph_paints(&n).filter_map(|p| match p { + Paint::Solid { swatch: Some(w), .. } => Some(w.clone()), + _ => None, + }); + let l = &n.extras().graph.as_deref().unwrap().label_styles; + let values = l.values.as_ref().and_then(|st| st.style_name.clone()); + (swatches.collect(), values, l.values_para.as_ref().and_then(|pa| pa.style_name.clone())) +} + +/// A pasted graph brings the swatches and text styles its series and labels keep, and follows +/// them when they come in under new names. +#[test] +fn a_pasted_graph_brings_and_follows_its_label_styles_and_paints() { + let mut s = session(); + let g = styled_graph(&mut s); + copy(&mut s, &[g]); + + new_doc(&mut s); + let v = s.execute("edit.pasteInPlace", &json!({})).unwrap(); + let d = doc(&s); + assert!(d.swatch("Brand").is_some(), "{v}"); + assert!(d.char_styles.iter().any(|x| x.name == "Emphasis") && d.para_styles.iter().any(|x| x.name == "Body"), "{v}"); + let brand = vec!["Brand".to_string(); 3]; + assert_eq!(graph_links(&s, ids_of(&v)[0]), (brand.clone(), Some("Emphasis".into()), Some("Body".into()))); + + // Into a document that gives each name something else: they come in renamed. + new_doc(&mut s); + s.execute("swatch.new", &json!({"name": "Brand", "color": "#0000ff", "global": true})).unwrap(); + s.execute("charStyle.new", &json!({"name": "Emphasis", "attrs": {"size": 8.0}})).unwrap(); + s.execute("paraStyle.new", &json!({"name": "Body", "attrs": {"space_after": 2.0}})).unwrap(); + let v = s.execute("edit.pasteInPlace", &json!({"swatchConflict": "add"})).unwrap(); + let brand2 = vec!["Brand 2".to_string(); 3]; + assert_eq!(graph_links(&s, ids_of(&v)[0]), (brand2, Some("Emphasis 2".into()), Some("Body 2".into())), "{v}"); + + // Without formatting: the labels' text styles stay behind. + new_doc(&mut s); + let v = s.execute("edit.pasteWithoutFormatting", &json!({})).unwrap(); + assert!(doc(&s).char_styles.is_empty() && doc(&s).para_styles.is_empty(), "{v}"); + assert_eq!(graph_links(&s, ids_of(&v)[0]), (brand, None, None)); +} + #[test] fn pasting_again_reuses_what_an_earlier_paste_added() { let mut s = session(); diff --git a/crates/engine/src/tests/colormgmt.rs b/crates/engine/src/tests/colormgmt.rs index 493f569805..99d099f68d 100644 --- a/crates/engine/src/tests/colormgmt.rs +++ b/crates/engine/src/tests/colormgmt.rs @@ -184,6 +184,26 @@ fn rgb_cmyk_converts_each_gradient_stop() { } } +/// Each point of a freeform gradient converts on its own, as gradient stops do. +#[test] +fn rgb_cmyk_converts_each_freeform_point() { + let _g = GLOBAL.lock().unwrap_or_else(|e| e.into_inner()); + let mut s = session(); + let id = rect(&mut s, 10.0, 10.0, 50.0, 50.0, json!("#000000")); + let stops = json!([{"offset": 0, "color": Color::rgb(0.912_345, 0.1, 0.2)}, {"offset": 1, "color": Color::rgb(0.3, 0.4, 0.654_321)}]); + let points = json!([{"at": [20, 20], "color": Color::rgb(0.2, 0.876_543, 0.3)}, {"at": [50, 50], "color": Color::rgb(0.6, 0.111_111, 0.9)}]); + let gradient = json!({"kind": "freeform", "stops": stops, "freeform": {"points": points}}); + s.execute("paint.setFill", &json!({"ids": [id.0], "gradient": gradient})).unwrap(); + let points = |s: &Session| match fill_of(s, id) { + Paint::Gradient(g) => g.freeform.map(|f| f.points.iter().map(|p| p.color).collect::>()).unwrap_or_default(), + p => panic!("not a gradient: {p:?}"), + }; + let old = points(&s); + assert!(!old.is_empty(), "the freeform fill has points"); + s.execute("object.convertDocumentColorMode", &json!({"mode": "cmyk"})).unwrap(); + assert_eq!(points(&s), old.into_iter().map(to_cmyk).collect::>()); +} + /// A pattern's tile art converts, and the art filled with the pattern keeps it. #[test] fn rgb_cmyk_converts_a_pattern_tile() { diff --git a/crates/engine/src/tests/dcs.rs b/crates/engine/src/tests/dcs.rs index b780f14c09..43bdf180a7 100644 --- a/crates/engine/src/tests/dcs.rs +++ b/crates/engine/src/tests/dcs.rs @@ -490,6 +490,118 @@ fn a_clipping_mask_of_ones_own_stays_when_the_link_is_updated() { assert_eq!(mask_width(&s), Some(4.0), "the mask's path is kept"); } +/// [`two_plates`] on a 20 × 20 pt page, its composite drawn through the left half of it (same +/// length, so the plates stay where the header says). +fn two_plates_square() -> Vec { + let text = String::from_utf8(two_plates()).unwrap(); + let text = text.replace("0 0 20 10", "0 0 20 20").replace("20 10 scale", "20 20 scale"); + text.replacen("10 10 lineto 0 10 lineto", "10 20 lineto 0 20 lineto", 1).into_bytes() +} + +/// The bounds (width, height) of the clipping path of clip group `g`. +fn clip_size(doc: &Document, g: NodeId) -> (f64, f64) { + let NodeKind::Group { children, clip: true } = &doc.node(g).unwrap().kind else { panic!("a clip group: {:?}", doc.node(g).unwrap().kind) }; + let b = children[0].geometric_bounds().expect("a clipping path"); + (b.width(), b.height()) +} + +#[test] +fn placement_options_clip_a_dcs_image_inside_its_files_clipping_path() { + let dir = temp_dir("placement-clip"); + let path = write(&dir, "pic.eps", &two_plates()); + let square = write(&dir, "square.eps", &two_plates_square()); + let mut s = session(); + let r = s.execute("file.place", &json!({ "path": path, "at": [100, 100] })).unwrap(); + let id = image_of(&s, &r["ids"][0]).id; + s.execute("links.placementOptions", &json!({"ids": [id.0], "preserve": "fill", "clip": true})).unwrap(); + let depth = |doc: &Document| std::iter::successors(Some(id), |n| doc.parent_of(*n)).count(); + let mut first = None; + // The square file fills the 20 × 10 pt placement and is cut to it; the file's own clipping + // path, the left half of its page, still clips the image inside that, on every relink. + for _ in 0..2 { + s.execute("links.relink", &json!({ "ids": [id.0], "path": square })).unwrap(); + let doc = &s.doc().unwrap().doc; + let file = doc.parent_of(id).expect("the file's clip group"); + let (w, h) = clip_size(doc, file); + assert!((w - 10.0).abs() < 1e-6 && (h - 20.0).abs() < 1e-6, "the file's clipping path: {w} × {h}"); + let placement = doc.parent_of(file).expect("the placement's clip group"); + let (w, h) = clip_size(doc, placement); + assert!((w - 20.0).abs() < 1e-6 && (h - 10.0).abs() < 1e-6, "the placement's clip: {w} × {h}"); + assert_eq!(*first.get_or_insert(depth(doc)), depth(doc), "no group is added on a later relink"); + } + // An update of the file keeps both. + s.execute("links.update", &json!({ "ids": [id.0] })).unwrap(); + let doc = &s.doc().unwrap().doc; + assert_eq!(first, Some(depth(doc))); + let file = doc.parent_of(id).unwrap(); + assert!((clip_size(doc, file).0 - 10.0).abs() < 1e-6, "the file's clipping path"); + assert!((clip_size(doc, doc.parent_of(file).unwrap()).1 - 10.0).abs() < 1e-6, "the placement's clip"); + // The file loses its clipping path and gains it again: the same two groups, no more. + let unclipped = String::from_utf8(two_plates_square()).unwrap().replacen("closepath clip newpath", "closepath newpath ", 1); + for _ in 0..2 { + std::fs::write(&square, unclipped.as_bytes()).unwrap(); + s.execute("links.update", &json!({ "ids": [id.0] })).unwrap(); + let doc = &s.doc().unwrap().doc; + assert_eq!(first, Some(depth(doc)), "the file's group stays, without its clip"); + let plain = doc.parent_of(id).unwrap(); + assert!(!matches!(doc.node(plain).unwrap().kind, NodeKind::Group { clip: true, .. }), "the file's group is not clipped"); + assert!((clip_size(doc, doc.parent_of(plain).unwrap()).1 - 10.0).abs() < 1e-6, "the placement's clip stays"); + std::fs::write(&square, two_plates_square()).unwrap(); + s.execute("links.update", &json!({ "ids": [id.0] })).unwrap(); + let doc = &s.doc().unwrap().doc; + assert_eq!(first, Some(depth(doc)), "the file's clip group again, at the same depth"); + let file = doc.parent_of(id).unwrap(); + assert!((clip_size(doc, file).0 - 10.0).abs() < 1e-6, "the file's clipping path again"); + assert!((clip_size(doc, doc.parent_of(file).unwrap()).1 - 10.0).abs() < 1e-6, "the placement's clip"); + } +} + +#[test] +fn placement_options_clip_a_dcs_image_in_a_symbol_inside_its_files_clipping_path() { + let dir = temp_dir("placement-clip-symbol"); + let path = write(&dir, "pic.eps", &two_plates()); + let square = write(&dir, "square.eps", &two_plates_square()); + let mut s = session(); + let r = s.execute("file.place", &json!({ "path": path, "at": [100, 100] })).unwrap(); + s.execute("symbol.new", &json!({ "name": "Pic", "ids": [r["ids"][0]] })).unwrap(); + let list = s.execute("links.list", &json!({})).unwrap(); + let row = list["links"].as_array().unwrap().iter().find(|r| r["owner"]["kind"] == "symbol").cloned().expect("the symbol's image"); + let id = row["id"].as_u64().unwrap(); + s.execute("links.placementOptions", &json!({"ids": [id], "preserve": "fill", "clip": true})).unwrap(); + // The clip groups around the symbol's image, innermost first. + let clips = |s: &Session| { + fn find(n: &Node, id: u64, around: &mut Vec<(f64, f64)>) -> bool { + if n.id.0 == id { + return true; + } + let Some(children) = n.children() else { return false }; + if !children.iter().any(|c| find(c, id, around)) { + return false; + } + if let NodeKind::Group { clip: true, .. } = n.kind + && let Some(b) = children[0].geometric_bounds() + { + around.push((b.width(), b.height())); + } + true + } + let mut around = vec![]; + let doc = &s.doc().unwrap().doc; + assert!(find(&doc.symbols.iter().find(|w| w.name == "Pic").expect("the symbol").art, id, &mut around)); + around + }; + for _ in 0..2 { + s.execute("links.relink", &json!({ "ids": [id], "path": square })).unwrap(); + let around = clips(&s); + assert_eq!(around.len(), 2, "the file's clip group inside the placement's: {around:?}"); + // In the symbol's own units: the file's path as wide as the placement is tall, half as + // wide as it is tall, and the placement twice as wide as it is tall. + let ((fw, fh), (pw, ph)) = (around[0], around[1]); + assert!((fh - 2.0 * fw).abs() < 1e-6 && (fw - ph).abs() < 1e-6, "the file's clipping path: {around:?}"); + assert!((pw - 2.0 * ph).abs() < 1e-6, "the placement's clip: {around:?}"); + } +} + #[test] fn a_dcs_file_takes_the_place_parameters_an_eps_file_takes() { let dir = temp_dir("params"); diff --git a/crates/engine/src/tests/draw2.rs b/crates/engine/src/tests/draw2.rs index 79dbd366f6..d47ca0ccaf 100644 --- a/crates/engine/src/tests/draw2.rs +++ b/crates/engine/src/tests/draw2.rs @@ -184,6 +184,25 @@ fn pencil_alt_closes_path() { assert!(ps[0].1.is_closed()); } +/// A Pencil stroke drawn as a dome and closed with Alt at the release closes with a straight segment +/// across the bottom, from where the stroke ends to where it starts: the path stays within where the +/// pen went, rather than curving on past both ends and back like a hat's brim. +#[test] +fn pencil_alt_closes_a_stroke_straight_back_to_its_start() { + let mut s = session(); + let pts: Vec<(f64, f64)> = + (0..=60).map(|i| f64::from(i) * std::f64::consts::PI / 60.0).map(|a| (300.0 - 150.0 * a.cos(), 400.0 - 200.0 * a.sin())).collect(); + drag(&mut s, "pencil", &pts, Mods { alt: true, ..Default::default() }); + let ps = paths(&s); + let sp = &ps[0].1.subpaths[0]; + assert!(sp.closed); + let b = ps[0].1.bounds().unwrap(); + assert!(b.x0 > 149.5 && b.x1 < 450.5 && b.y1 < 400.5, "within the stroke: {b:?}"); + let (first, last) = (sp.anchors.first().unwrap(), sp.anchors.last().unwrap()); + assert!(first.p.distance(Point::new(150.0, 400.0)) < 1e-6 && last.p.distance(Point::new(450.0, 400.0)) < 1e-6, "{first:?} {last:?}"); + assert_eq!((last.h_out, first.h_in), (last.p, first.p), "a straight closing segment"); +} + /// #3799: with Shift held, a wavy Pencil drag draws one straight segment at 45° steps from the /// Constrain Angle (here 30°: a drag at about 60° comes out at 75°). #[test] @@ -1632,6 +1651,97 @@ fn smoothing_a_whole_closed_path_smooths_a_bump_at_its_start() { assert!(start <= far + 0.5, "the bump at the start stays {start} pt high, the far one {far} pt"); } +/// Checks that the closed path `p` starts at its point nearest `old`, within `reach` of it: its first +/// anchor is no farther from `old` than any other point along the path, and its outline starts there. +fn assert_starts_nearest(p: &PathData, old: Point, reach: f64) { + let sp = &p.subpaths[0]; + assert!(sp.closed, "the path stays closed"); + let first = sp.anchors[0].p; + let nearest = smooth_test_samples(p).iter().map(|q| q.distance(old)).fold(f64::INFINITY, f64::min); + let d = first.distance(old); + assert!(d <= nearest + 1e-6 && d <= reach, "the path starts {d} pt from its old start, its nearest point is {nearest} pt away: {sp:?}"); + let mut bp = kurbo::BezPath::new(); + sp.to_bezpath_into(&mut bp); + assert_eq!(bp.elements().first(), Some(&kurbo::PathEl::MoveTo(first))); +} + +/// A drag over a closed path's first anchor and the anchors either side of it smooths the bump there, +/// and the path starts at the point of the smoothed path nearest the old first anchor. The anchors out +/// of reach keep their places, and undo brings the path back. +#[test] +fn smoothing_over_a_closed_paths_first_anchor_keeps_its_start() { + let mut s = session(); + let (c, r) = (Point::new(300.0, 300.0), 100.0); + let at = |deg: f64, rr: f64| c + rr * kurbo::Vec2::from_angle(deg.to_radians()); + let anchors: Vec<_> = (0..12) + .map(|i| { + let q = at(30.0 * f64::from(i), if i == 0 { r + 8.0 } else { r }); + json!({"x": q.x, "y": q.y}) + }) + .collect(); + let id = smooth_test_path(&mut s, &anchors, true); + let before = path(&s, id); + let old = before.subpaths[0].anchors[0].p; + // Along the circle from -40° to 40°, over anchors 11, 0 and 1. + let drag: Vec = (-20..=20).map(|k| at(2.0 * f64::from(k), r)).collect(); + smooth_pass(&mut s, &drag); + let after = path(&s, id); + assert_ne!(after, before, "the bump is smoothed"); + assert_starts_nearest(&after, old, 12.0); + let kept = &after.subpaths[0].anchors; + for a in &before.subpaths[0].anchors[2..=10] { + assert!(kept.iter().any(|k| k.p == a.p), "{:?} is out of reach and stays: {kept:?}", a.p); + } + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(path(&s, id), before); +} + +/// A drag over the whole of a closed path with a spike that turns back on itself, which the refit +/// keeps as a corner, leaves the path starting at its point nearest the old first anchor. +#[test] +fn smoothing_a_whole_closed_path_with_a_spike_keeps_its_start() { + let mut s = session(); + let mut seed = 5u64; + let (c, r) = (Point::new(300.0, 300.0), 80.0); + let at = |a: f64, rr: f64| c + rr * kurbo::Vec2::from_angle(a); + use std::f64::consts::{PI, TAU}; + let mut pts: Vec = (0..64).map(|i| at(f64::from(i) / 64.0 * TAU, r + 2.5 * smooth_noise(&mut seed))).collect(); + // Out from the anchor at 180° to a tip 40 pt beyond the circle and back. + pts.splice(33..33, [at(PI, r + 40.0), at(PI + 0.002, r)]); + let anchors: Vec<_> = pts.iter().map(|q| json!({"x": q.x, "y": q.y})).collect(); + let id = smooth_test_path(&mut s, &anchors, true); + let before = path(&s, id); + let mut drag: Vec = (0..=128).map(|i| at(f64::from(i) / 128.0 * TAU, r)).collect(); + drag.splice(65..65, (0..=16).chain((0..=16).rev()).map(|k| at(PI, r + 2.5 * f64::from(k)))); + smooth_pass(&mut s, &drag); + let after = path(&s, id); + assert_ne!(after, before, "the path is smoothed"); + assert_starts_nearest(&after, pts[0], 12.0); +} + +/// A drag that reaches a closed path but not its first anchor leaves that anchor first, where it was. +#[test] +fn smoothing_a_closed_path_away_from_its_first_anchor_keeps_it_first() { + let mut s = session(); + let (c, r) = (Point::new(300.0, 300.0), 100.0); + let at = |deg: f64, rr: f64| c + rr * kurbo::Vec2::from_angle(deg.to_radians()); + let anchors: Vec<_> = (0..12) + .map(|i| { + let q = at(30.0 * f64::from(i), if i == 6 { r + 8.0 } else { r }); + json!({"x": q.x, "y": q.y}) + }) + .collect(); + let id = smooth_test_path(&mut s, &anchors, true); + let before = path(&s, id); + // Along the circle from 140° to 220°, over anchors 5, 6 and 7. + let drag: Vec = (70..=110).map(|k| at(2.0 * f64::from(k), r)).collect(); + smooth_pass(&mut s, &drag); + let after = path(&s, id); + assert_ne!(after, before, "the bump is smoothed"); + assert!(after.subpaths[0].closed); + assert_eq!(after.subpaths[0].anchors[0], before.subpaths[0].anchors[0]); +} + /// A straight line along y = 200 from x = 100 to 400, one anchor every 5 pt, whose second and /// second-to-last anchors are 1.5 pt off the line: its first and last segments leave and arrive at /// 16.7° to it. diff --git a/crates/engine/src/tests/expand.rs b/crates/engine/src/tests/expand.rs index d853b91110..e4bfa26b2f 100644 --- a/crates/engine/src/tests/expand.rs +++ b/crates/engine/src/tests/expand.rs @@ -422,6 +422,122 @@ fn a_compound_clipping_path_in_the_art_keeps_its_shape() { assert_eq!(seen, (true, true)); } +/// A Drop Shadow 20 pt to the right on row `row` of instance `id`, solid black with no blur. +fn shadow_row(s: &mut Session, id: NodeId, row: usize) { + let params = json!({"x": 20, "y": 0, "blur": 0, "opacity": 100, "mode": "normal"}); + run(s, "effect.apply", json!({"ids": [id.0], "item": row, "effect": "stylize.dropShadow", "params": params})); +} + +/// Is `p` dark: a shadow, not the white page or the red fill? +fn dark(p: [u8; 4]) -> bool { + p[..3].iter().all(|c| *c < 100) +} + +/// A raster effect on a symbol instance's fill draws on the filled shapes of its art: the shadow +/// falls right of the square, the bounds take it in, a hidden fill draws none, and Expand +/// Appearance keeps the look in one undo step. +#[test] +fn a_symbol_instance_fill_shadow_shadows_its_filled_art() { + let mut s = session(); + let (id, row) = instance_with_row(&mut s, "Square", true); + assert!(near(render(&s).pixel(160, 100), WHITE)); + shadow_row(&mut s, id, row); + let before = render(&s); + assert!(dark(before.pixel(165, 100)), "the fill's shadow falls right of the square: {:?}", before.pixel(165, 100)); + assert!(near(before.pixel(100, 100), RED), "the art draws over its shadow: {:?}", before.pixel(100, 100)); + let doc = s.doc().unwrap().doc.clone(); + let b = vectorcraft_render::painted_bounds(&doc, doc.node(id).unwrap()).expect("the instance has bounds"); + assert!(b.x1 >= 169.0, "the bounds take in the shadow: {b:?}"); + // A view that shows only the shadow, right of the square: the instance is still drawn. + let opts = vectorcraft_render::RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let right = vectorcraft_render::Renderer::new().render(&doc, 200, 200, vectorcraft_geom::Affine::translate((-155.0, 0.0)), &opts); + assert!(dark(right.pixel(10, 100)), "the shadow past the square's box is drawn: {:?}", right.pixel(10, 100)); + + assert!(expandable(&s), "the fill's shadow can be expanded"); + run(&mut s, "effect.expandAppearance", json!({})); + let ch = node(&s, id).children().cloned().expect("the instance becomes a group"); + assert!(matches!(ch[0].kind, NodeKind::Image(_)), "the shadow is an image under the art: {}", ch[0].kind_label()); + assert!(matches!(ch[1].kind, NodeKind::SymbolInstance { .. }), "the art stays an instance: {}", ch[1].kind_label()); + no_effects_left(&ch[1]); + let after = render(&s); + assert!(differing(&before, &after, 24) < 400, "expanding changed {} pixels", differing(&before, &after, 24)); + run(&mut s, "edit.undo", json!({})); + let n = node(&s, id); + assert!(matches!(n.kind, NodeKind::SymbolInstance { .. }), "one undo gives the instance back"); + assert!(n.appearance.items[row].effects().iter().any(|e| e.id == "stylize.dropShadow")); + + run(&mut s, "appearance.setItem", json!({"ids": [id.0], "index": row, "visible": false})); + assert!(near(render(&s).pixel(165, 100), WHITE), "a hidden fill draws no shadow"); +} + +/// A raster effect on a symbol instance's stroke draws on the stroked shapes of its art only: the +/// stroke's shadow falls right of the stroke, and none falls where only the fill would cast one. +#[test] +fn a_symbol_instance_stroke_shadow_shadows_only_its_stroked_art() { + let mut s = session(); + let (id, row) = instance_with_row(&mut s, "Square", false); + shadow_row(&mut s, id, row); + let r = render(&s); + assert!(dark(r.pixel(170, 100)), "the stroke's shadow falls right of the stroke: {:?}", r.pixel(170, 100)); + assert!(near(r.pixel(160, 100), WHITE), "the fill casts no shadow: {:?}", r.pixel(160, 100)); +} + +/// Geometry and raster effects on one fill of an instance: the shadow falls from the grown fill. +#[test] +fn a_symbol_instance_fill_shadow_follows_the_fill_offset_before_it() { + let mut s = session(); + let (id, row) = instance_with_row(&mut s, "Square", true); + offset_row(&mut s, id, row, 10.0); + shadow_row(&mut s, id, row); + let r = render(&s); + assert!(near(r.pixel(44, 100), RED), "the fill grows by the offset: {:?}", r.pixel(44, 100)); + assert!(dark(r.pixel(175, 100)), "the shadow falls from the grown fill: {:?}", r.pixel(175, 100)); +} + +/// An instance inside a symbol's art passes the outer instance's fill shadow on to its own art. +#[test] +fn a_nested_symbol_instance_takes_the_outer_fill_shadow() { + let mut s = session(); + square(&mut s); + run(&mut s, "symbol.new", json!({"name": "Inner"})); + let id = NodeId(run(&mut s, "symbol.new", json!({"name": "Outer"}))["id"].as_u64().unwrap()); + run(&mut s, "appearance.addFill", json!({"ids": [id.0]})); + let row = node(&s, id).appearance.items.len() - 1; + run(&mut s, "appearance.setItem", json!({"ids": [id.0], "index": row, "none": true})); + shadow_row(&mut s, id, row); + assert!(dark(render(&s).pixel(165, 100)), "the inner art casts the shadow: {:?}", render(&s).pixel(165, 100)); +} + +/// Export draws a symbol instance's fill shadow on the filled shapes of its art: baking leaves the +/// shadow on the art's fill, not its stroke, and PDF export makes an image of it. +#[test] +fn export_draws_a_symbol_instance_fill_shadow() { + let mut s = session(); + let (id, row) = instance_with_row(&mut s, "Square", true); + shadow_row(&mut s, id, row); + let doc = s.doc().unwrap().doc.clone(); + let baked = vectorcraft_render::effects::bake_document(&doc).expect("the instance is baked"); + let n = baked.node(id).expect("the baked art keeps the instance's id").clone(); + assert!(!matches!(n.kind, NodeKind::SymbolInstance { .. })); + let shadowed = |i: &vectorcraft_doc::AppearanceItem| i.effects().iter().any(|e| e.id == "stylize.dropShadow"); + let (mut fills, mut strokes) = (0, 0); + n.walk(&mut |part| { + fills += part.appearance.items.iter().filter(|i| i.is_fill() && shadowed(i)).count(); + strokes += part.appearance.items.iter().filter(|i| !i.is_fill() && shadowed(i)).count(); + }); + assert_eq!((fills, strokes), (1, 0), "the art's fill carries the shadow"); + + let flat = crate::flatten_raster_effects(&doc).expect("the shadow becomes an image"); + let mut image = None; + flat.node(id).expect("the flattened art keeps the instance's id").walk(&mut |part| { + if matches!(part.kind, NodeKind::Image(_)) { + image = part.geometric_bounds(); + } + }); + let image = image.expect("the shadow is an image"); + assert!(image.x1 >= 165.0, "the image holds the shadow right of the square: {image:?}"); +} + #[test] fn two_fills_and_an_offset_stroke_become_three_paths_that_look_the_same() { let mut s = session(); diff --git a/crates/engine/src/tests/inline.rs b/crates/engine/src/tests/inline.rs index f7c72956ad..71caf14bf8 100644 --- a/crates/engine/src/tests/inline.rs +++ b/crates/engine/src/tests/inline.rs @@ -1,8 +1,12 @@ //! Inline graphics in text: `text.insertInline`, editing over them, undo, following their symbol. +use std::sync::Arc; + use serde_json::json; +use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::text::INLINE_CHAR; use vectorcraft_doc::{Node, NodeId, NodeKind, TextObject}; +use vectorcraft_geom::{Affine, Rect}; use vectorcraft_tools::{Mods, PointerEvent, PointerKind, ToolKey}; use crate::*; @@ -325,6 +329,143 @@ fn a_symbol_that_shows_itself_inline_is_an_empty_slot() { assert_eq!(d.inline_art_bounds("Loop"), None); } +/// A rectangle `r` filled black, without a stroke. +fn filled_rect(d: &mut vectorcraft_doc::Document, r: Rect) -> Arc { + let look = vectorcraft_doc::Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0); + Arc::new(Node::path(d.alloc_id(), vectorcraft_geom::shapes::rectangle(r), look)) +} + +/// An instance of symbol `name` placed by `xf`. +fn symbol_instance(d: &mut vectorcraft_doc::Document, name: &str, xf: Affine) -> Arc { + Arc::new(Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: name.into(), xf })) +} + +/// Gives symbol `name` the art `art` in a group, adding the symbol when there is none of that name. +fn set_symbol_art(d: &mut vectorcraft_doc::Document, name: &str, art: Vec>) { + let art = Arc::new(Node::group(d.alloc_id(), art)); + match d.symbols.iter_mut().find(|x| x.name == name) { + Some(x) => x.art = art, + None => d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: name.into(), art }), + } +} + +/// An inline graphic of a symbol whose art holds an instance of another symbol is sized by that +/// symbol's art, and follows it when it changes, through undo, redo and a saved copy. +#[test] +fn an_inline_graphic_follows_the_art_of_a_symbol_nested_in_its_symbol() { + let mut s = session(); + s.edit("Symbols", |d, _| { + let far = filled_rect(d, Rect::new(100.0, 0.0, 160.0, 20.0)); + set_symbol_art(d, "Far", vec![far]); + let inner = symbol_instance(d, "Far", Affine::IDENTITY); + set_symbol_art(d, "Holder", vec![inner]); + Ok(()) + }) + .unwrap(); + let id = text(&mut s, "ab"); + let w0 = obj(&s, id).bounds().unwrap().width(); + s.execute("text.insertInline", &json!({"id": id.0, "at": 1, "symbol": "Holder", "scale": 1})).unwrap(); + let wide = Some(Rect::new(100.0, 0.0, 160.0, 20.0)); + let t = obj(&s, id); + assert_eq!(inline_bounds(&t), wide); + // 20 pt tall at 20 pt type and 3 times as wide: the text grows by 60 pt. + let w1 = t.bounds().unwrap().width(); + assert!((w1 - w0 - 60.0).abs() < 1.5, "{w0} → {w1}"); + // Far redefined as a 10 × 40 rectangle: the graphic is 20 pt tall and 5 pt wide. + s.edit("Redefine Far", |d, _| { + let tall = filled_rect(d, Rect::new(0.0, 0.0, 10.0, 40.0)); + set_symbol_art(d, "Far", vec![tall]); + Ok(()) + }) + .unwrap(); + let tall = Some(Rect::new(0.0, 0.0, 10.0, 40.0)); + let t = obj(&s, id); + assert_eq!(inline_bounds(&t), tall); + assert_eq!(s.doc().unwrap().doc.symbol_art_bounds("Holder"), tall); + let w2 = t.bounds().unwrap().width(); + assert!((w2 - w0 - 5.0).abs() < 1.5, "{w0} → {w2}"); + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(inline_bounds(&obj(&s, id)), wide); + assert!((obj(&s, id).bounds().unwrap().width() - w1).abs() < 1e-6); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(inline_bounds(&obj(&s, id)), tall); + // Opening a saved copy measures it the same way. + let doc = (*s.doc().unwrap().doc).clone(); + let mut back = vectorcraft_format::load(&vectorcraft_format::save(&doc, false)).unwrap(); + back.title = "copy".into(); + let mut s2 = Session::new(); + s2.add_document(back, None); + assert_eq!(inline_bounds(&obj(&s2, id)), tall); + assert!((obj(&s2, id).bounds().unwrap().width() - w2).abs() < 1e-6); +} + +/// Symbol C shows Holder inline, Holder holds an instance of B, and B shows A inline: with the +/// symbols listed C, Holder, B, A, a change to A reaches C through B's and Holder's new sizes. +#[test] +fn symbols_are_resolved_after_the_symbols_their_instances_show() { + let mut s = session(); + circle_symbol(&mut s, "A", 10.0); + let t = text(&mut s, "z"); + s.execute("text.insertInline", &json!({"id": t.0, "at": 0, "symbol": "A"})).unwrap(); + s.execute("symbol.new", &json!({"name": "B", "ids": [t.0]})).unwrap(); + s.execute("edit.clear", &json!({})).unwrap(); + s.edit("Holder", |d, _| { + let inner = symbol_instance(d, "B", Affine::IDENTITY); + set_symbol_art(d, "Holder", vec![inner]); + Ok(()) + }) + .unwrap(); + let t = text(&mut s, "z"); + s.execute("text.insertInline", &json!({"id": t.0, "at": 0, "symbol": "Holder"})).unwrap(); + s.execute("symbol.new", &json!({"name": "C", "ids": [t.0]})).unwrap(); + s.execute("edit.clear", &json!({})).unwrap(); + s.edit("Reverse the symbols", |d, _| { + d.symbols.reverse(); + Ok(()) + }) + .unwrap(); + let h0 = s.doc().unwrap().doc.symbol_art_bounds("Holder"); + redefine_as_wide_ellipse(&mut s, "A"); + let d = &s.doc().unwrap().doc; + assert_ne!(d.symbol_art_bounds("Holder"), h0); + assert_eq!(inline_bounds(&art_text(&s, "C")), d.symbol_art_bounds("Holder")); +} + +/// Symbol A holds an instance of B, and B's type shows A inline: the size of each would depend on +/// itself, so both are empty slots, and stay so through later edits. +#[test] +fn a_symbol_that_shows_itself_through_an_instance_is_an_empty_slot() { + let mut s = session(); + circle_symbol(&mut s, "A", 10.0); + let t = text(&mut s, "ab"); + s.execute("text.insertInline", &json!({"id": t.0, "at": 1, "symbol": "A"})).unwrap(); + s.execute("symbol.new", &json!({"name": "B", "ids": [t.0]})).unwrap(); + s.execute("edit.clear", &json!({})).unwrap(); + s.edit("A holds B", |d, _| { + let inner = symbol_instance(d, "B", Affine::IDENTITY); + set_symbol_art(d, "A", vec![inner]); + Ok(()) + }) + .unwrap(); + let line = text(&mut s, "x"); + s.execute("text.insertInline", &json!({"id": line.0, "at": 0, "symbol": "A"})).unwrap(); + for _ in 0..2 { + for name in ["A", "B"] { + assert_eq!(s.doc().unwrap().doc.inline_art_bounds(name), None, "{name}"); + } + assert_eq!(inline_bounds(&art_text(&s, "B")), None); + assert_eq!(inline_bounds(&obj(&s, line)), None); + s.execute("shape.rectangle", &json!({"x": 0, "y": 0, "width": 10, "height": 10})).unwrap(); + } + let _ = s.execute("document.serialize", &json!({"format": "png"})).unwrap(); + // Redefined without the instance, A is on no cycle. + redefine_as_wide_ellipse(&mut s, "A"); + let d = &s.doc().unwrap().doc; + assert!(d.inline_art_bounds("A").is_some()); + assert_eq!(inline_bounds(&art_text(&s, "B")), d.symbol_art_bounds("A")); + assert_eq!(inline_bounds(&obj(&s, line)), d.symbol_art_bounds("A")); +} + /// A list paragraph that starts with an inline graphic draws its bullet before the graphic, and /// live SVG text writes the bullet. #[test] diff --git a/crates/engine/src/tests/knockout.rs b/crates/engine/src/tests/knockout.rs index 723ef66dd2..9f2139fd47 100644 --- a/crates/engine/src/tests/knockout.rs +++ b/crates/engine/src/tests/knockout.rs @@ -138,7 +138,7 @@ fn knockout_settings_round_trip_and_old_bools_load() { } #[test] -fn pdf_and_svg_write_knockout_groups_as_masks() { +fn pdf_writes_knockout_groups_and_svg_writes_them_as_masks() { let mut s = session(); let g = knockout_group(&mut s); let plain = s.doc().unwrap().doc.clone(); @@ -149,10 +149,11 @@ fn pdf_and_svg_write_knockout_groups_as_masks() { let r = pdf(&plain); assert!(!String::from_utf8_lossy(&r.bytes).contains("/SMask") && r.warnings.is_empty()); let r = pdf(&ko); - let text = String::from_utf8_lossy(&r.bytes); - // The lower rectangle is drawn through a luminosity mask made of the upper one's alpha. - assert!(text.contains("/Luminosity") && text.contains("/Alpha"), "soft masks"); - assert!(r.warnings.iter().any(|w| w.contains("knockout")), "{:?}", r.warnings); + let text = String::from_utf8_lossy(&r.bytes).replace(' ', ""); + // The rectangles knock out the area they paint: a PDF knockout group, without soft masks. + assert_eq!(text.matches("/Ktrue").count(), 1, "a knockout group"); + assert!(!text.contains("/Luminosity"), "no soft masks"); + assert!(r.warnings.is_empty(), "{:?}", r.warnings); let svg = |d: &Document| vectorcraft_svg::export(d, &Default::default()); assert!(!svg(&plain).contains("knockout")); @@ -173,5 +174,5 @@ fn pdf_and_svg_write_knockout_groups_as_masks() { assert!(svg(&page).contains("isolation")); page.page_knockout = true; assert_eq!(svg(&page).matches("mask=\"url(#knockout-").count(), 1, "the layer is neutral: its objects knock each other out"); - assert!(String::from_utf8_lossy(&pdf(&page).bytes).contains("/Luminosity")); + assert!(String::from_utf8_lossy(&pdf(&page).bytes).replace(' ', "").contains("/Ktrue")); } diff --git a/crates/engine/src/tests/library.rs b/crates/engine/src/tests/library.rs index c2dccc7bb5..a75bc532bf 100644 --- a/crates/engine/src/tests/library.rs +++ b/crates/engine/src/tests/library.rs @@ -733,6 +733,38 @@ fn a_library_character_style_linked_to_a_missing_swatch_is_added_unlinked() { assert_eq!((r["style"].as_str(), r["existing"].as_bool()), (Some("Accent"), Some(true))); } +/// A gradient stop linked to a spot swatch with process plates, as a library file can hold one. +fn plated_stops() -> Value { + let ink = vectorcraft_color::Color::cmyk(0.0, 0.5, 0.0, 0.0); + json!([ + {"offset": 0, "color": vectorcraft_color::Color::WHITE}, + {"offset": 1, "color": ink, "swatch": "Brand", "tint": 0.5, "plates": [0.3, 0, 0, 0]} + ]) +} + +/// Library gradients and the gradient stops of library character styles lose their links to +/// swatches the document does not have together with the process plates those links print with. +#[test] +fn library_stops_unlinked_from_their_swatch_keep_no_process_plates() { + let data = json!({ + "name": "Plated", + "gradients": [{"name": "Glow", "gradient": {"gradient": {"kind": "Linear", "stops": plated_stops()}, "angle": 0}}], + "charStyles": [{"name": "Accent", "attrs": {"fill": {"type": "gradient", "gradient": {"kind": "Linear", "stops": plated_stops()}}}}] + }); + let mut s = session(); + let lib = run(&mut s, "library.import", json!({"data": data.to_string()}))["id"].as_str().unwrap().to_string(); + let a = run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 40, "height": 20}))["id"].clone(); + run(&mut s, "select.set", json!({"ids": [a]})); + run(&mut s, "library.use", json!({"library": lib, "kind": "fillGradient", "item": "Glow"})); + let st = gradient(&paint_of(&s, &a, false)).gradient.stops[1].clone(); + assert_eq!((st.swatch.as_deref(), st.tint, st.plates), (None, 1.0, None), "{st:?}"); + run(&mut s, "library.addToCharacterStyles", json!({"library": lib, "item": "Accent"})); + let style = s.doc().unwrap().doc.char_styles.iter().find(|c| c.name == "Accent").map(|c| c.attrs["fill"].clone()).unwrap(); + let fill = serde_json::from_value::(style).unwrap(); + let st = gradient(&fill).gradient.stops[1].clone(); + assert_eq!((st.swatch.as_deref(), st.tint, st.plates), (None, 1.0, None), "{st:?}"); +} + /// A library style is compared with the document's in the form the document stores it in, so a /// style whose file writes a size as a whole number is reused, by Add to Character Styles and by a /// click alike. diff --git a/crates/engine/src/tests/linked_stops.rs b/crates/engine/src/tests/linked_stops.rs index 9ed3db2724..62955e6065 100644 --- a/crates/engine/src/tests/linked_stops.rs +++ b/crates/engine/src/tests/linked_stops.rs @@ -213,6 +213,24 @@ fn spot_stops_with_process_plates_export_both_in_device_n_shadings() { assert_eq!(gradient(&s, id).gradient.stops[1].plates, None); } +#[test] +fn deleting_a_spot_swatch_takes_the_process_plates_of_the_stops_it_unlinks() { + let (mut s, id) = setup(); + let plated = json!({"stops": [{"offset": 0, "color": "#ffffff"}, {"offset": 1, "swatch": "Ink", "tint": 50, "plates": [0.3, 0, 0, 0]}]}); + run(&mut s, "paint.editGradient", plated.clone()); + run(&mut s, "swatch.new", json!({"name": "Glow", "gradient": plated})); + let linked = gradient(&s, id).gradient.stops[1].clone(); + assert_eq!((linked.swatch.as_deref(), linked.plates), (Some("Ink"), Some([0.3, 0.0, 0.0, 0.0]))); + run(&mut s, "swatch.delete", json!({"name": "Ink"})); + // The art's stop and the gradient swatch's stop keep the color they show, unlinked and without plates. + let Paint::Gradient(sw) = doc(&s).swatch("Glow").unwrap().paint.clone() else { panic!("a gradient swatch") }; + for st in [&gradient(&s, id).gradient.stops[1], &sw.gradient.stops[1]] { + assert_eq!((st.color, st.swatch.as_deref(), st.tint, st.plates), (linked.color, None, 1.0, None), "{st:?}"); + } + run(&mut s, "edit.undo", json!({})); + assert_eq!(gradient(&s, id).gradient.stops[1], linked, "undo brings back the link and the plates"); +} + #[test] fn radial_spot_gradients_mixed_with_other_inks_export_as_device_n_shadings() { let (mut s, _) = setup(); diff --git a/crates/engine/src/tests/links.rs b/crates/engine/src/tests/links.rs index e683b156e1..62d3e36bad 100644 --- a/crates/engine/src/tests/links.rs +++ b/crates/engine/src/tests/links.rs @@ -768,6 +768,223 @@ fn nested_objects_that_repeat_ids_open_with_ids_of_their_own() { assert!(image(&s, layer_image).link.is_some(), "the image in the layers stays linked"); } +/// The files of the linked images that the stored brushes of [`brush_links`] are made of: a scatter +/// brush's, an art brush's and a pattern brush's side tile. +const BRUSHED: [(&str, &str, &str); 3] = [("scatter.png", "scatter", "Specks"), ("art.png", "art", "Band"), ("side.png", "pattern", "Frame")]; + +/// A document whose stored brushes are made of [`BRUSHED`]'s linked images in `dir`. The art +/// brush's image is still in the layers too, so its brush art repeats that object's id; the other +/// two images were cleared from the layers. +fn brush_links(dir: &Folder) -> (Session, NodeId) { + for (i, (name, ..)) in (0u8..).zip(BRUSHED) { + write(&dir.file(name), &png(20, 10, [30 + 60 * i, 120, 90])); + } + let mut s = session(); + let mut kept = NodeId(0); + for (name, kind, brush) in BRUSHED { + let id = place(&mut s, &dir.file(name)); + s.execute("brush.new", &json!({"type": kind, "name": brush, "ids": [id.0]})).unwrap(); + if kind == "art" { + kept = id; + } else { + s.execute("edit.clear", &json!({"ids": [id.0]})).unwrap(); + } + } + s.execute("select.set", &json!({"ids": []})).unwrap(); + (s, kept) +} + +/// The image in the art of stored brush `name`, as the document stores it. +fn brush_image(s: &Session, name: &str) -> ImageObject { + let b = vectorcraft_brush::find(&s.doc().unwrap().doc, name).unwrap_or_else(|| panic!("no brush {name}")); + let mut found = None; + b.art()[0].walk(&mut |n| { + if let (None, NodeKind::Image(im)) = (&found, &n.kind) { + found = Some((**im).clone()); + } + }); + found.unwrap_or_else(|| panic!("no image in brush {name}")) +} + +/// The id of the image in the art of stored brush `name`, as the document stores it. +fn brush_image_id(s: &Session, name: &str) -> u64 { + let b = vectorcraft_brush::find(&s.doc().unwrap().doc, name).unwrap(); + let mut found = None; + b.art()[0].walk(&mut |n| { + if found.is_none() && matches!(n.kind, NodeKind::Image(_)) { + found = Some(n.id.0); + } + }); + found.unwrap() +} + +/// Images in the art of stored brushes are listed after the others, one row per image in each brush tile, +/// each with an id no other object has (the layer tree keeps its own), the brush named as what holds it; Check +/// Links and the missing filter count them, and the ids stay the same from one list to the next. +#[test] +fn links_in_stored_brush_art_are_listed_and_checked_with_ids() { + let dir = Folder::new("brush-ids"); + let (mut s, kept) = brush_links(&dir); + let list = s.execute("links.list", &json!({})).unwrap(); + let rows = list["links"].as_array().unwrap(); + let owners: Vec<(&str, &Value)> = rows.iter().map(|r| (r["name"].as_str().unwrap(), &r["owner"])).collect(); + let library = vectorcraft_brush::library(&s.doc().unwrap().doc); + let index = |name: &str| library.iter().position(|b| b.name == name).unwrap(); + assert_eq!( + owners, + [ + ("art.png", &Value::Null), + ("scatter.png", &json!({"kind": "brush", "name": "Specks", "index": index("Specks")})), + ("art.png", &json!({"kind": "brush", "name": "Band", "index": index("Band")})), + ("side.png", &json!({"kind": "brush", "name": "Frame", "index": index("Frame"), "tile": "side"})), + ], + "{list}" + ); + assert_eq!(rows[0]["id"], json!(kept.0), "the layer tree keeps its ids: {list}"); + let ids: std::collections::BTreeSet = rows.iter().map(|r| r["id"].as_u64().unwrap()).collect(); + assert_eq!(ids.len(), 4, "{list}"); + assert!(!ids.contains(&0), "{list}"); + assert!(rows.iter().all(|r| r["status"] == "ok" && r["linked"] == true), "{list}"); + assert_eq!(s.execute("links.list", &json!({})).unwrap(), list, "the same ids each time"); + let other = super::rect(&mut s, 0.0, 0.0, 5.0, 5.0); + s.execute("edit.clear", &json!({"ids": [other.0]})).unwrap(); + assert_eq!(s.execute("links.list", &json!({})).unwrap(), list, "the same ids after other objects are made"); + let check = s.execute("links.check", &json!({})).unwrap(); + assert_eq!(check["links"].as_array().unwrap().len(), 3, "{check}"); + std::fs::remove_file(dir.file("side.png")).unwrap(); + let check = s.execute("links.check", &json!({})).unwrap(); + assert_eq!(check["missing"].as_u64(), Some(1), "{check}"); + let missing = s.execute("links.list", &json!({"show": "missing"})).unwrap(); + assert_eq!(missing["links"][0]["id"], rows[3]["id"], "{missing}"); +} + +/// Every links command takes the id of an image in a stored brush's art and acts on that brush's art, +/// never on the image in the layers whose id the art repeated: Link Info, Go To (which clears the +/// selection and names the brush), Placement Options, Relink, Update and Embed. The ids each change +/// gives the art are kept in the library, so the next list names the same rows. +#[test] +fn links_commands_act_on_images_in_stored_brush_art_by_id() { + let dir = Folder::new("brush-act"); + let (mut s, kept) = brush_links(&dir); + let band = row_id_owned(&mut s, "art.png", "brush"); + assert_ne!(band, kept.0); + let info = s.execute("links.info", &json!({"id": band})).unwrap(); + assert_eq!((info["fileName"].as_str(), info["status"].as_str(), info["id"].as_u64()), (Some("art.png"), Some("ok"), Some(band)), "{info}"); + s.execute("select.set", &json!({"ids": [kept.0]})).unwrap(); + let go = s.execute("links.goTo", &json!({"id": band})).unwrap(); + assert_eq!( + (go["onCanvas"].clone(), go["owner"]["kind"].clone(), go["owner"]["name"].clone()), + (json!(false), json!("brush"), json!("Band")), + "{go}" + ); + assert!(s.doc().unwrap().selection.objects.is_empty(), "nothing on the canvas is selected"); + s.execute("links.placementOptions", &json!({"ids": [band], "preserve": "fit"})).unwrap(); + assert_eq!(s.execute("links.placementOptions", &json!({"ids": [band]})).unwrap()["placement"]["preserve"], "fit"); + assert_eq!(brush_image(&s, "Band").placement.preserve, vectorcraft_doc::links::Preserve::Fit); + assert_eq!(brush_image_id(&s, "Band"), band, "the brush keeps the id it is listed by"); + assert_ne!(image(&s, kept).placement.preserve, vectorcraft_doc::links::Preserve::Fit, "the image in the layers is left as it was"); + // Relink: the brush's image shows the new file; the image in the layers keeps its file. + let other = dir.file("other.png"); + write(&other, &png(40, 20, BLUE)); + let r = s.execute("links.relink", &json!({"ids": [band], "path": other})).unwrap(); + assert_eq!(r["relinked"], json!([band]), "{r}"); + assert_eq!(brush_image(&s, "Band").link.unwrap().path, other); + assert_eq!(image(&s, kept).link.unwrap().path, dir.file("art.png")); + assert_eq!(row_id_owned(&mut s, "other.png", "brush"), band, "{}", s.execute("links.list", &json!({})).unwrap()); + // Update: a changed file is read again for the scatter brush's image. + let dots = row_id_owned(&mut s, "scatter.png", "brush"); + let changed = png(30, 30, RED); + write(&dir.file("scatter.png"), &changed); + let r = s.execute("links.update", &json!({"ids": [dots]})).unwrap(); + assert_eq!(r["updated"], json!([dots]), "{r}"); + assert_eq!(brush_image(&s, "Specks").link.unwrap().size, Some(changed.len() as u64)); + // Embed: the pattern brush's side tile keeps its pixels and no longer links. + let frame = row_id_owned(&mut s, "side.png", "brush"); + let r = s.execute("links.embed", &json!({"ids": [frame]})).unwrap(); + assert_eq!(r["embedded"], json!([frame]), "{r}"); + assert!(brush_image(&s, "Frame").link.is_none()); + let embedded = s.execute("links.list", &json!({"show": "embedded"})).unwrap(); + assert_eq!(embedded["links"][0]["id"], json!(frame), "{embedded}"); + // Relink All Instances takes the image in the layers and the brush's image of the same file. + let r = s.execute("links.relink", &json!({"ids": [kept.0], "path": dir.file("scatter.png"), "scope": "all"})).unwrap(); + assert_eq!(r["relinked"], json!([kept.0]), "{r}"); + let r = s.execute("links.relink", &json!({"ids": [dots], "path": other, "scope": "all"})).unwrap(); + let mut relinked: Vec = r["relinked"].as_array().unwrap().iter().map(|v| v.as_u64().unwrap()).collect(); + relinked.sort(); + let mut both = vec![kept.0, dots]; + both.sort(); + assert_eq!(relinked, both, "{r}"); + assert_eq!(image(&s, kept).link.unwrap().path, other); + // One undo step puts the brushes back as they were. + s.execute("edit.undo", &json!({})).unwrap(); + assert_eq!(brush_image(&s, "Specks").link.unwrap().path, dir.file("scatter.png")); +} + +/// The id of the `links.list` row of file `name` whose owner is of `kind`. +fn row_id_owned(s: &mut Session, name: &str, kind: &str) -> u64 { + let list = s.execute("links.list", &json!({})).unwrap(); + let row = list["links"].as_array().unwrap().iter().find(|r| r["name"] == name && r["owner"]["kind"] == kind); + row.unwrap_or_else(|| panic!("{name} in {kind}: {list}"))["id"].as_u64().unwrap() +} + +/// A document saved with links in its stored brushes opens with them reported by the ids the list +/// gives them, and a library entry that does not read as a brush is kept as it was. +#[test] +fn links_in_stored_brush_art_open_by_id_and_unreadable_entries_stay() { + let dir = Folder::new("brush-open"); + let (mut s, _) = brush_links(&dir); + let odd = json!({"name": "Odd", "type": "unknown", "art": {"id": 3}}); + s.edit("Odd brush", |d, _| { + if let Some(list) = d.unknown.get_mut(vectorcraft_brush::DOC_KEY).and_then(Value::as_array_mut) { + list.push(odd.clone()); + } + Ok(()) + }) + .unwrap(); + let path = dir.file("poster.vectorcraft"); + save(&mut s, &path); + std::fs::remove_file(dir.file("scatter.png")).unwrap(); + let r = open(&mut s, &path); + let dots = row_id_owned(&mut s, "scatter.png", "brush"); + assert_eq!(r["missingLinks"][0]["ids"], json!([dots]), "{r}"); + assert_eq!(brush_image_id(&s, "Specks"), dots, "the library keeps the ids opening gave"); + let band = row_id_owned(&mut s, "art.png", "brush"); + s.execute("links.embed", &json!({"ids": [band]})).unwrap(); + let doc = &s.doc().unwrap().doc; + let stored = doc.unknown[vectorcraft_brush::DOC_KEY].as_array().unwrap(); + assert_eq!(stored.last(), Some(&odd), "the unreadable entry is left as it was"); + assert!(doc.mounted_art.is_empty()); +} + +/// The Color Mask of an image in a stored brush's art is made again for the new pixels when Update +/// reads the image's changed file. +#[test] +fn updating_an_image_in_stored_brush_art_makes_its_color_mask_again() { + let dir = Folder::new("brush-mask"); + let path = dir.file("logo.png"); + write(&path, &png(12, 10, RED)); + let mut s = session(); + let id = place(&mut s, &path); + s.execute("select.set", &json!({"ids": [id.0]})).unwrap(); + let hide_white = json!({"background": "colors", "colors": "#ffffff", "contiguous": false, "tolerance": 0, "softness": 0}); + s.execute("addon.image.colorMask", &hide_white).unwrap(); + s.execute("brush.new", &json!({"type": "scatter", "name": "Masked", "ids": [id.0]})).unwrap(); + s.execute("edit.clear", &json!({"ids": [id.0]})).unwrap(); + write(&path, &png(14, 10, BLUE)); + let row = row_id_owned(&mut s, "logo.png", "brush"); + let r = s.execute("links.update", &json!({"ids": [row]})).unwrap(); + assert_eq!(r["updated"], json!([row]), "{r}"); + let doc = &s.doc().unwrap().doc; + let brush = vectorcraft_brush::find(doc, "Masked").unwrap(); + let mut masks = vec![]; + brush.art()[0].walk(&mut |n| { + if let (NodeKind::Image(im), Some(m)) = (&n.kind, Document::color_mask_of(n)) { + masks.push((m.made_for(im), doc.images.contains_key(&m.key))); + } + }); + assert_eq!(masks, [(true, true)], "the mask is made for the new pixels"); +} + /// An image that Placement Options clip, alone in a group the user made, goes into a new clip group /// inside that group when its file grows, in the layers and in a symbol's art; the user's group /// stays a plain group. diff --git a/crates/engine/src/tests/livecorners.rs b/crates/engine/src/tests/livecorners.rs index 190cd0d354..b9e3793913 100644 --- a/crates/engine/src/tests/livecorners.rs +++ b/crates/engine/src/tests/livecorners.rs @@ -126,6 +126,30 @@ fn bad_sides_radii_and_keys_are_errors() { assert_eq!(corners(&s, id).0, [0.0; 4]); } +/// Saved steps play as they did before `sides` and `radius` were checked: a negative radius +/// removes the rounding, a whole side count outside 3 to 1000 is brought into that range, and a +/// fractional or negative side count is ignored. +#[test] +fn saved_steps_with_out_of_range_sides_or_radius_still_play() { + let (mut s, id) = session(); + let poly = NodeId(s.execute("shape.polygon", &json!({"cx": 200, "cy": 200, "radius": 80, "sides": 6})).unwrap()["id"].as_u64().unwrap()); + let replay = |s: &mut Session, p: Value| s.replay("object.setLiveShape", &p).unwrap_or_else(|e| panic!("{p}: {e}")); + run(&mut s, json!({"id": id.0, "radius": 6})); + replay(&mut s, json!({"id": id.0, "radius": -4})); + assert_eq!(corners(&s, id).0, [0.0; 4]); + let sides = |s: &Session| match node_path(s, poly).1 { + Some(LiveShape::Polygon { sides, .. }) => sides, + other => panic!("{other:?}"), + }; + for (n, want) in [(json!(2), 3), (json!(1001), 1000), (json!(2.5), 1000), (json!(-1), 1000), (json!(5.0), 5)] { + replay(&mut s, json!({"ids": [poly.0], "sides": n})); + assert_eq!(sides(&s), want, "{n}"); + } + // A direct call still refuses them. + assert!(s.execute("object.setLiveShape", &json!({"id": id.0, "radius": -4})).is_err()); + assert!(s.execute("object.setLiveShape", &json!({"ids": [poly.0], "sides": 2})).is_err()); +} + #[test] fn direct_selected_corners_round_alone_and_stay_selected() { let (mut s, id) = session(); diff --git a/crates/engine/src/tests/package.rs b/crates/engine/src/tests/package.rs index e61c4bb4a4..952693d7c1 100644 --- a/crates/engine/src/tests/package.rs +++ b/crates/engine/src/tests/package.rs @@ -90,6 +90,38 @@ fn two_links_and_a_font_are_collected_and_relinked() { assert!(s.doc().unwrap().doc.images.values().all(|b| !b.is_proxy()), "the copies' pixels"); } +/// A file linked only from a stored brush's art is copied, and the packaged document's brush +/// links to the copy. +#[test] +fn a_file_linked_from_a_stored_brush_is_collected_and_relinked() { + let dir = Folder::new("package-brush"); + let file = dir.file("art/leaf.png"); + write(&file, &png(40, 20, RED)); + let mut s = session(); + let id = place(&mut s, &file); + run(&mut s, "brush.new", json!({"type": "scatter", "name": "Leaves Here", "ids": [id.0]})); + run(&mut s, "edit.clear", json!({"ids": [id.0]})); + save(&mut s, &dir.file("poster.vectorcraft")); + let out = dir.file("out"); + let r = run(&mut s, "file.package", json!({"folder": out, "copyFonts": false})); + let files: Vec<&str> = r["files"].as_array().unwrap().iter().map(|f| f.as_str().unwrap()).collect(); + assert!(files.contains(&"Links/leaf.png"), "{r}"); + let root = std::path::Path::new(&out).join("poster Folder"); + std::fs::remove_dir_all(dir.0.join("art")).unwrap(); + let r = open(&mut s, &root.join("poster.vectorcraft").to_string_lossy()); + assert_eq!(r["missingLinks"], json!([]), "{r}"); + let brush = vectorcraft_brush::find(&s.doc().unwrap().doc, "Leaves Here").unwrap(); + let mut paths = vec![]; + brush.art()[0].walk(&mut |n| { + if let vectorcraft_doc::NodeKind::Image(im) = &n.kind { + paths.push(im.link.as_ref().map(|l| (l.path.clone(), l.relative.clone()))); + } + }); + let [Some((path, relative))] = paths.as_slice() else { panic!("{paths:?}") }; + assert!(std::path::Path::new(path).starts_with(root.join("Links")), "{path}"); + assert_eq!(relative.as_deref(), Some("Links/leaf.png")); +} + #[test] fn an_unsaved_document_cant_be_packaged() { let mut s = session(); diff --git a/crates/engine/src/tests/params.rs b/crates/engine/src/tests/params.rs index 6fb8d30467..52cb314de0 100644 --- a/crates/engine/src/tests/params.rs +++ b/crates/engine/src/tests/params.rs @@ -572,6 +572,64 @@ fn a_malformed_required_number_is_not_reported_as_missing() { assert_eq!(s.doc().unwrap().history.undo.len(), undo + 1); } +/// A required whole number given as something other than a whole number of 0 or more (`"3"`, `2.5`, +/// `-1`, `true`, `[]`, `{}`) is refused as the wrong type, naming its key, not as a missing integer; one +/// left out or given as null is still missing. An optional one left out or null keeps its default. +/// Neither changes the document or records an undo step. +#[test] +fn a_malformed_required_integer_is_not_reported_as_missing() { + let mut s = Session::new(); + s.execute("file.new", &json!({})).unwrap(); + s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 40})).unwrap(); + let doc = s.doc().unwrap().doc.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let with = |base: &serde_json::Value, key: &str, v: Option| { + let mut p = base.clone(); + let o = p.as_object_mut().unwrap(); + match v { + Some(v) => o.insert(key.into(), v), + None => o.remove(key), + }; + p + }; + let refused = |s: &mut Session, cmd: &str, p: &serde_json::Value, want: &str| match s.execute(cmd, p) { + Err(EngineError::BadParams { cmd: c, msg }) => assert_eq!((c.as_str(), msg.as_str()), (cmd, want), "{p}"), + other => panic!("{cmd} {p}: {other:?}"), + }; + let ends = json!({"sourceDocument": 1, "grab": [0, 0], "at": [0, 0], "ids": [1]}); + let cases = [ + ("appearance.setItem", json!({"index": 0}), "index", "missing integer `index`"), + ("path.removeAnchor", json!({"id": 1, "anchor": 0}), "anchor", "missing integer `anchor`"), + ("path.split", json!({"id": 1, "anchor": 0}), "anchor", "need `anchor` or `segment` + `t`"), + ("addon.pen.removePoint", json!({"anchor": 0}), "anchor", "missing integer `anchor`"), + ("edit.dropSelection", ends, "sourceDocument", "missing integer `sourceDocument`"), + ("document.activate", json!({"index": 0}), "index", "missing index"), + ("document.move", json!({"to": 0}), "to", "missing `to`: a non-negative integer"), + ]; + let malformed = [json!("3"), json!(2.5), json!(-1), json!(true), json!([]), json!({})]; + for (cmd, base, key, missing) in &cases { + for v in &malformed { + refused(&mut s, cmd, &with(base, key, Some(v.clone())), &format!("`{key}` must be a whole number")); + } + for p in [with(base, key, None), with(base, key, Some(json!(null)))] { + refused(&mut s, cmd, &p, missing); + } + } + // An optional `subpath` given as anything else is refused the same way; left out or null, it is + // subpath 0 and the command goes on to read `anchor`. + let base = json!({"id": 1, "anchor": "3"}); + for v in &malformed { + refused(&mut s, "path.removeAnchor", &with(&base, "subpath", Some(v.clone())), "`subpath` must be a whole number"); + } + for p in [with(&base, "subpath", None), with(&base, "subpath", Some(json!(null)))] { + refused(&mut s, "path.removeAnchor", &p, "`anchor` must be a whole number"); + } + assert_eq!(s.doc().unwrap().doc, doc); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + // A whole JSON number is a whole number. + s.execute("document.activate", &json!({"index": 0})).unwrap(); +} + /// A command that takes the keys of one that isn't checked yet isn't checked either. #[test] fn a_reference_to_an_unchecked_command_is_unchecked() { @@ -791,3 +849,75 @@ fn journal_entries_pass_the_check() { assert!(check_params(id, params).is_ok(), "{id} {params}"); } } + +/// An index of a path, type, panel, library, style or ruler command given as something other than a +/// whole number of 0 or more (`"3"`, `2.5`, `-1`, `true`, `[]`, `{}`) is refused as the wrong type, +/// naming its key. A required one is not reported as missing, and an optional one (`subpath` of +/// `path.appendAnchor`, `path.close` and `path.reverse`, `artboard` of the ruler origin commands) is +/// not read as its default. A required one left out or null is still missing, and an optional one left +/// out or null keeps its default. Neither changes the document or records an undo step. +#[test] +fn a_malformed_index_is_not_missing_or_its_default() { + let mut s = Session::new(); + s.execute("file.new", &json!({})).unwrap(); + let id = s.execute("path.create", &json!({"d": "M0 0 L10 0 M20 0 L30 0"})).unwrap()["id"].clone(); + s.execute("library.create", &json!({"name": "Brand"})).unwrap(); + s.execute("library.createGroup", &json!({"name": "Warm"})).unwrap(); + let doc = s.doc().unwrap().doc.clone(); + let undo = s.doc().unwrap().history.undo.len(); + let with = |base: &serde_json::Value, key: &str, v: Option| { + let mut p = base.clone(); + let o = p.as_object_mut().unwrap(); + match v { + Some(v) => o.insert(key.into(), v), + None => o.remove(key), + }; + p + }; + let refused = |s: &mut Session, cmd: &str, p: &serde_json::Value, want: &str| match s.execute(cmd, p) { + Err(EngineError::BadParams { cmd: c, msg }) => assert_eq!((c.as_str(), msg.as_str()), (cmd, want), "{p}"), + other => panic!("{cmd} {p}: {other:?}"), + }; + let malformed = [json!("3"), json!(2.5), json!(-1), json!(true), json!([]), json!({})]; + let handle = json!({"id": id, "x": 5, "y": 5}); + let required = [ + ("path.setHandle", handle.clone(), "anchor", "missing anchor"), + ("path.moveAnchor", handle.clone(), "anchor", "missing anchor"), + ("path.insertAnchor", json!({"id": id}), "segment", "missing segment"), + ("text.setPathHandle", handle.clone(), "anchor", "missing anchor"), + ("artboard.reorder", json!({"index": 0}), "to", "missing to"), + ("library.moveGroup", json!({"group": "Warm"}), "to", "missing `to` (an index)"), + ("graphicStyle.move", json!({"name": "Default"}), "to", "missing `to` (an index)"), + ]; + for (cmd, base, key, missing) in &required { + for v in &malformed { + refused(&mut s, cmd, &with(base, key, Some(v.clone())), &format!("`{key}` must be a whole number")); + } + for p in [with(base, key, None), with(base, key, Some(json!(null)))] { + refused(&mut s, cmd, &p, missing); + } + } + let optional = [ + ("path.appendAnchor", handle.clone(), "subpath"), + ("path.close", json!({"id": id}), "subpath"), + ("path.reverse", json!({"ids": [id]}), "subpath"), + ("document.rulerOrigin", json!({}), "artboard"), + ("document.setRulerOrigin", json!({"x": 5, "y": 5}), "artboard"), + ("document.resetRulerOrigin", json!({}), "artboard"), + ]; + for (cmd, base, key) in &optional { + for v in &malformed { + refused(&mut s, cmd, &with(base, key, Some(v.clone())), &format!("`{key}` must be a whole number")); + } + } + // A whole number that names no artboard is still out of range. + refused(&mut s, "document.resetRulerOrigin", &json!({"artboard": 1}), "index out of range"); + assert_eq!(s.doc().unwrap().doc, doc); + assert_eq!(s.doc().unwrap().history.undo.len(), undo); + // Left out or null, an optional one keeps its default. + for (cmd, base, key) in &optional { + for p in [with(base, key, None), with(base, key, Some(json!(null)))] { + s.execute(cmd, &p).unwrap_or_else(|e| panic!("{cmd} {p}: {e}")); + } + } +} diff --git a/crates/engine/src/tests/perspgrid.rs b/crates/engine/src/tests/perspgrid.rs index 07fce547da..dce149e98c 100644 --- a/crates/engine/src/tests/perspgrid.rs +++ b/crates/engine/src/tests/perspgrid.rs @@ -150,6 +150,42 @@ fn built_in_views_apply_by_name_or_type() { assert!(s.execute("perspective.grid.preset", &json!({})).is_err()); } +#[test] +fn reapplying_the_current_grid_preset_records_no_undo_step() { + let mut s = session(); + // On a document with no grid defined, a preset defines and shows one: an undo step. + run(&mut s, "perspective.grid.preset", json!({"kind": 2})); + assert_eq!(undo_len(&s), 1); + let g = grid(&s); + // The same preset again, by type or by name, leaves the grid as it is: no undo step. + run(&mut s, "perspective.grid.preset", json!({"kind": 2})); + run(&mut s, "perspective.grid.preset", json!({"name": "[2P-Normal View]"})); + assert_eq!((grid(&s), undo_len(&s)), (g.clone(), 1)); + // Another active plane, or a hidden grid, is set back without an undo step. + run(&mut s, "perspective.plane.set", json!({"plane": "ground"})); + run(&mut s, "perspective.grid.show", json!({"visible": false})); + assert_ne!(grid(&s), g); + run(&mut s, "perspective.grid.preset", json!({"kind": 2})); + assert_eq!((grid(&s), undo_len(&s)), (g, 1)); + // Another preset changes the grid. + run(&mut s, "perspective.grid.preset", json!({"kind": 3})); + assert_eq!((grid(&s).kind, undo_len(&s)), (3, 2)); +} + +#[test] +fn define_grid_with_unchanged_fields_records_no_undo_step() { + let mut s = session(); + // On a document with no grid defined, `perspective.grid.set` stores the grid: an undo step, + // and the grid no longer follows the first artboard. + run(&mut s, "perspective.grid.set", json!({})); + assert_eq!((run(&mut s, "perspective.grid.get", json!({}))["defined"].clone(), undo_len(&s)), (json!(true), 1)); + // The stored grid's own values leave it as it is: no undo step. + let g = grid(&s); + run(&mut s, "perspective.grid.set", json!({})); + run(&mut s, "perspective.grid.set", json!({"cell": g.cell, "horizon": g.horizon})); + assert_eq!((grid(&s), undo_len(&s)), (g, 1)); +} + #[test] fn presets_save_rename_delete_and_protect_the_built_in_ones() { let mut s = session(); diff --git a/crates/engine/src/tests/placed_document.rs b/crates/engine/src/tests/placed_document.rs index 2420ef265c..c639fc9232 100644 --- a/crates/engine/src/tests/placed_document.rs +++ b/crates/engine/src/tests/placed_document.rs @@ -1042,6 +1042,57 @@ fn saving_a_document_refreshes_its_placed_copies_inside_symbols_and_patterns() { assert_eq!(hashes, [hash.clone(), hash], "the symbol's, then the pattern's"); } +/// Saving a document reads it again for its placed copy in the art of a stored brush of another +/// open document, the only place that document shows it. +#[test] +fn saving_a_document_refreshes_its_placed_copy_in_a_stored_brush() { + let dir = Folder::new("placed-refresh-brush"); + let src = dir.file("logo.vectorcraft"); + source(&src, 100.0, 50.0, RED, 0); + let mut s = session(); + let id = place(&mut s, &src); + s.execute("brush.new", &json!({"type": "scatter", "name": "Logos", "ids": [id.0]})).unwrap(); + s.execute("edit.clear", &json!({"ids": [id.0]})).unwrap(); + let parent = s.active_index().unwrap(); + s.execute("document.open", &json!({"path": src})).unwrap(); + s.execute("select.all", &json!({})).unwrap(); + s.execute("paint.setFill", &json!({"color": "#1414e6"})).unwrap(); + s.execute("document.save", &json!({})).unwrap(); + let hash = Some(vectorcraft_doc::links::hash_bytes(&std::fs::read(&src).unwrap())); + let doc = &s.documents()[parent]; + assert_eq!(doc.history.undo.last().unwrap().label, "Update Links"); + let brush = vectorcraft_brush::find(&doc.doc, "Logos").unwrap(); + let mut hashes = vec![]; + brush.art()[0].walk(&mut |n| { + if let NodeKind::PlacedDocument(p) = &n.kind { + hashes.push(p.link.hash.clone()); + } + }); + assert_eq!(hashes, [hash]); +} + +/// A placed document kept only in a stored brush's art, whose file is gone and of which the +/// document holds only the preview, is output as its preview with the warning that says so. +#[test] +fn a_placed_document_in_a_stored_brush_without_its_file_is_output_as_its_preview() { + let dir = Folder::new("placed-brush-preview"); + let src = dir.file("logo.vectorcraft"); + // Content of its own: files read are cached by content, and this one is removed. + source(&src, 100.0, 50.0, RED, 3); + let mut s = session(); + let id = place(&mut s, &src); + s.execute("brush.new", &json!({"type": "scatter", "name": "Logos", "ids": [id.0]})).unwrap(); + // The copy in the layers has the save keep only the preview. + let doc_path = dir.file("poster.vectorcraft"); + save(&mut s, &doc_path); + std::fs::remove_file(&src).unwrap(); + let r = open(&mut s, &doc_path); + assert_eq!(r["missingLinks"].as_array().map(Vec::len), Some(1), "{r}"); + s.execute("edit.clear", &json!({"ids": [id.0]})).unwrap(); + let svg = s.execute("document.serialize", &json!({"format": "svg"})).unwrap(); + assert!(svg["warnings"].to_string().contains("1 placed document output as its preview"), "{svg}"); +} + #[test] fn link_info_gives_the_artboards_size_not_pixels() { let dir = Folder::new("placed-info"); diff --git a/crates/engine/src/tests/plugins.rs b/crates/engine/src/tests/plugins.rs index 499f2d15c6..a294cc9036 100644 --- a/crates/engine/src/tests/plugins.rs +++ b/crates/engine/src/tests/plugins.rs @@ -1921,6 +1921,12 @@ fn disabled_plugins_name_files_outside_the_read_root_by_their_names() { run(&mut s, "plugin.remove", json!({"id": id})); } +/// The files and folders in the plug-in store `dir`, without the file windows lock while they +/// change it. +fn store_files(dir: &std::path::Path) -> usize { + std::fs::read_dir(dir).unwrap().filter(|e| e.as_ref().is_ok_and(|e| e.file_name() != crate::store::DISABLED_LOCK)).count() +} + /// #2541: a plug-in installed in a session with a plug-in store is installed again in the next /// session that attaches the store, and Remove Plug-in takes it out of the store. #[test] @@ -1931,14 +1937,14 @@ fn installed_plugins_are_kept_in_the_store() { let mut s = session(); s.attach_plugin_store(folder.0.clone()); install_wat(&mut s, &src); - assert_eq!(std::fs::read_dir(&folder.0).unwrap().count(), 1, "one file in the store"); + assert_eq!(store_files(&folder.0), 1, "one file in the store"); vectorcraft_plugins::registry::remove(id); let mut next = session(); next.attach_plugin_store(folder.0.clone()); assert!(vectorcraft_plugins::registry::get(id).is_some(), "installed again from the store"); run(&mut next, "plugin.remove", json!({"id": id})); - assert_eq!(std::fs::read_dir(&folder.0).unwrap().count(), 0, "removed from the store"); + assert_eq!(store_files(&folder.0), 0, "removed from the store"); // A file that isn't a plug-in is skipped; the store still attaches. std::fs::write(folder.0.join("broken.wasm"), b"\0asm?").unwrap(); @@ -3274,6 +3280,198 @@ fn a_store_loaded_while_installing_loads_the_new_version() { run(&mut s, "plugin.remove", json!({"id": id})); } +/// A grant of `doc.read` to plug-in `id`, the module with the SHA-256 `hash`. +fn doc_read_grant(id: &str, hash: &str) -> vectorcraft_plugins::permissions::Grant { + serde_json::from_value(json!({"id": id, "hash": hash, "permissions": ["doc.read"]})).unwrap() +} + +/// A session that uses the plug-in store `dir` without loading it, as another process using the +/// same folder does: it doesn't wait for the installs and removals of this process's sessions. +fn other_process(dir: std::path::PathBuf) -> Session { + let mut s = Session::new(); + s.plugin_dir = Some(dir); + s +} + +/// Waits on this thread for a turn on a plug-in store, telling `waiting` before it waits. +fn tell_when_waiting(waiting: std::sync::mpsc::Sender<&'static str>) { + crate::store::WHILE_STORE_LOCKED.set(Some(Box::new(move || { + let _ = waiting.send("waiting"); + }))); +} + +/// The ids `grants.json` in `dir` holds grants for, and the hash of each. +fn stored_grant_hashes(dir: &std::path::Path) -> std::collections::BTreeMap { + let entries: Vec = serde_json::from_slice(&std::fs::read(dir.join("grants.json")).unwrap()).unwrap(); + entries.iter().map(|e| (e["id"].as_str().unwrap().to_string(), e["hash"].as_str().unwrap().to_string())).collect() +} + +/// An install into a `Plug-ins` folder that another process also installs the same id into keeps a +/// module with its own grant: the other process's install waits for this one's turn on the folder, +/// between this install's module and its grant, and then writes both of its own. +#[test] +fn installs_from_two_processes_into_one_store_keep_each_module_with_its_grant() { + use vectorcraft_plugins::permissions::sha256_hex; + let folder = crate::tests_links::Folder::new("plugin-store-installs-take-turns"); + let id = "test.engine.permissions.installsturns"; + let ours = asking(id, r#"["doc.read"]"#, &json!({"objects": []})); + let theirs = asking(id, r#"["doc.read"]"#, &json!({"objects": [], "documentData": null})); + let mut s = session(); + s.attach_plugin_store(folder.0.clone()); + + let (said, heard) = std::sync::mpsc::channel::<&'static str>(); + let (handed, other) = std::sync::mpsc::channel(); + let (dir, module) = (folder.0.clone(), theirs.clone()); + crate::cmd::plugin::BEFORE_GRANT_STORED.set(Some(Box::new(move || { + let thread = std::thread::spawn(move || { + tell_when_waiting(said.clone()); + let other = other_process(dir); + let turn = other.plugin_store_turn().unwrap(); + let stored = crate::cmd::plugin::keep_installed(&other, &turn, id, &module, Some(doc_read_grant(id, &sha256_hex(&module)))); + let _ = said.send(if stored { "stored" } else { "not stored" }); + }); + // The other install has written the store, or waits for this one. + let first = heard.recv().unwrap_or("gone"); + let _ = handed.send((first, thread)); + }))); + run(&mut s, "plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&ours), "grant": ["doc.read"]})); + let (first, thread) = other.recv().unwrap(); + thread.join().unwrap(); + + let module = std::fs::read(s.stored_plugin_file(id).unwrap()).unwrap(); + assert_eq!(stored_grant_hashes(&folder.0).get(id), Some(&sha256_hex(&module)), "the stored grant covers the stored module"); + assert_eq!(module, theirs, "the install that waited wrote last"); + assert_eq!(first, "waiting", "the other install waits for this one"); + run(&mut s, "plugin.remove", json!({"id": id})); +} + +/// Grants written for two plug-ins into one `Plug-ins` folder by two processes are both kept: the +/// second write reads `grants.json` only once the first has written it. +#[test] +fn grants_written_by_two_processes_into_one_store_keep_both() { + let folder = crate::tests_links::Folder::new("plugin-store-grants-take-turns"); + let (ours, theirs) = ("test.engine.permissions.grantturnsa", "test.engine.permissions.grantturnsb"); + let hash = vectorcraft_plugins::permissions::sha256_hex(b"module"); + let s = other_process(folder.0.clone()); + + let (said, heard) = std::sync::mpsc::channel::<&'static str>(); + let (handed, other) = std::sync::mpsc::channel(); + let (dir, other_hash) = (folder.0.clone(), hash.clone()); + crate::store::AFTER_GRANTS_READ.set(Some(Box::new(move || { + let thread = std::thread::spawn(move || { + tell_when_waiting(said.clone()); + let written = other_process(dir).store_grant(theirs, Some(doc_read_grant(theirs, &other_hash))); + let _ = said.send(if written { "written" } else { "not written" }); + }); + // The other write has written the file, or waits for this one. + let first = heard.recv().unwrap_or("gone"); + let _ = handed.send((first, thread)); + }))); + assert!(s.store_grant(ours, Some(doc_read_grant(ours, &hash))), "the grant is written"); + let (first, thread) = other.recv().unwrap(); + thread.join().unwrap(); + + let kept = stored_grant_hashes(&folder.0); + assert_eq!(kept.keys().map(String::as_str).collect::>(), [ours, theirs], "both grants are kept"); + assert_eq!(first, "waiting", "the other write waits for this one"); +} + +/// A setting a plug-in changes in one process and another setting it changes in a second process +/// using the same `Plug-ins` folder are both kept: the second process waits for the first's turn on +/// the folder and reads what it wrote. The second process is this test run again with +/// `VECTORCRAFT_TEST_PLUGIN_SETTINGS_STORE` naming the folder; it prints when it waits and when it +/// is done. +#[test] +fn settings_changed_by_two_processes_keep_both() { + use std::io::{BufRead, Write}; + use vectorcraft_plugins::storage::Meter; + const CHILD: &str = "VECTORCRAFT_TEST_PLUGIN_SETTINGS_STORE"; + const NAME: &str = "tests::plugins::settings_changed_by_two_processes_keep_both"; + let id = "test.engine.storagetwoprocesses"; + // Nothing a removal kept is moved back, so the storage is made without a turn on the folder. + let attached = |s: &Session| { + s.attach_plugin_storage(&crate::store::StoreTurn::unheld(), id); + vectorcraft_plugins::registry::storage(id).unwrap() + }; + if let Some(dir) = std::env::var_os(CHILD) { + let st = attached(&other_process(std::path::PathBuf::from(dir))); + crate::store::WHILE_STORE_LOCKED.set(Some(Box::new(|| { + println!("settings-child-waiting"); + let _ = std::io::stdout().flush(); + }))); + st.set_setting("theirs", b"2", &mut Meter::unlimited()).unwrap(); + println!("settings-child-done"); + let _ = std::io::stdout().flush(); + return; + } + let folder = crate::tests_links::Folder::new("plugin-settings-two-processes"); + let st = attached(&other_process(folder.0.clone())); + + let (handed, child) = std::sync::mpsc::channel(); + let dir = folder.0.clone(); + crate::store::AFTER_SETTINGS_READ.set(Some(Box::new(move || { + let mut process = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", NAME, "--nocapture", "--test-threads=1"]) + .env(CHILD, &dir) + .stdout(std::process::Stdio::piped()) + .spawn() + .unwrap(); + let mut lines = std::io::BufReader::new(process.stdout.take().unwrap()).lines(); + // The other process has written the settings, or waits for this change. + let first = lines + .by_ref() + .map_while(std::io::Result::ok) + .find_map(|l| ["waiting", "done"].into_iter().find(|said| l.contains(&format!("settings-child-{said}")))); + let _ = handed.send((first, process, lines)); + }))); + st.set_setting("ours", b"1", &mut Meter::unlimited()).unwrap(); + let (first, mut process, lines) = child.recv().unwrap(); + let rest: Vec = lines.map_while(std::io::Result::ok).collect(); + assert!(process.wait().unwrap().success(), "the other process failed: {rest:?}"); + + let file: std::collections::BTreeMap = + serde_json::from_slice(&std::fs::read(crate::store::plugin_data_dir(&folder.0, id).join("settings.json")).unwrap()).unwrap(); + assert_eq!(file.keys().map(String::as_str).collect::>(), ["ours", "theirs"], "both settings are kept"); + assert_eq!(first, Some("waiting"), "the other process waits for this change"); + vectorcraft_plugins::registry::set_storage(id, None); +} + +/// When the `Plug-ins` folder can't be locked (here `disabled.lock` is a folder), `plugin.install` +/// and `plugin.remove` change nothing and say why: the plug-in installed with the id, its grant and +/// the stored module stay as they were. +#[test] +fn a_store_that_cant_be_locked_refuses_installs_and_removals() { + use vectorcraft_plugins::{permissions::sha256_hex, registry}; + let folder = crate::tests_links::Folder::new("plugin-store-not-locked"); + let id = "test.engine.permissions.notlocked"; + let first = asking(id, r#"["doc.read"]"#, &json!({"objects": []})); + let second = asking(id, r#"["doc.read"]"#, &json!({"objects": [], "documentData": null})); + let mut s = session(); + s.attach_plugin_store(folder.0.clone()); + run(&mut s, "plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&first), "grant": ["doc.read"]})); + let lock = folder.0.join(crate::store::DISABLED_LOCK); + std::fs::remove_file(&lock).unwrap(); + std::fs::create_dir(&lock).unwrap(); + let grants = std::fs::read(folder.0.join("grants.json")).unwrap(); + + let update = json!({"dataBase64": vectorcraft_format::base64_encode(&second), "grant": ["doc.read"], "replace": true}); + let refused = s.execute("plugin.install", &update).unwrap_err().to_string(); + assert!(refused.contains(crate::store::STORE_NOT_LOCKED) && refused.contains("nothing was installed"), "{refused}"); + assert_eq!(registry::get(id).map(|p| p.hash().to_string()), Some(sha256_hex(&first)), "the installed plug-in stays"); + assert_eq!(registry::granted(id).map(|g| g.hash), Some(sha256_hex(&first)), "its grant stays"); + assert_eq!(std::fs::read(s.stored_plugin_file(id).unwrap()).unwrap(), first, "the store keeps its module"); + assert_eq!(std::fs::read(folder.0.join("grants.json")).unwrap(), grants, "and its grant"); + + let refused = s.execute("plugin.remove", &json!({"id": id})).unwrap_err().to_string(); + assert!(refused.contains(crate::store::STORE_NOT_LOCKED) && refused.contains("nothing was removed"), "{refused}"); + assert!(registry::get(id).is_some(), "the plug-in stays installed"); + assert!(std::path::Path::new(&s.stored_plugin_file(id).unwrap()).exists(), "and stored"); + + std::fs::remove_dir(&lock).unwrap(); + run(&mut s, "plugin.remove", json!({"id": id})); + assert!(registry::get(id).is_none()); +} + /// Runs the test `name` of this module again in a process of its own → whether this is that /// process. The list of disabled plug-ins is kept for the whole process, and the other tests here /// read it again each time they attach a plug-in store. @@ -3740,7 +3938,7 @@ fn granted_permissions_are_kept_and_folders_skip_the_rest() { let mut third = session(); third.attach_plugin_store(folder.0.clone()); assert!(vectorcraft_plugins::registry::get(id).is_none(), "nobody granted it"); - assert_eq!(std::fs::read_dir(&folder.0).unwrap().count(), 1, "the module stays in the store"); + assert_eq!(store_files(&folder.0), 1, "the module stays in the store"); // The Additional Plug-ins Folder skips it with a note until it is granted. let dir = crate::tests_links::Folder::new("plugin-folder-grants"); @@ -4678,7 +4876,7 @@ fn plugin_storage_is_capped_and_survives_a_damaged_settings_file() { // An id that differs only in case has storage of its own, which removing this one leaves. let upper_id = "test.engine.StorageCaps"; - s.attach_plugin_storage(upper_id); + s.attach_plugin_storage(&s.plugin_store_turn().unwrap(), upper_id); let upper = vectorcraft_plugins::registry::storage(upper_id).unwrap(); assert_eq!(upper.setting("k0", m).unwrap(), None); upper.set_setting("k0", b"upper", m).unwrap(); @@ -4690,13 +4888,13 @@ fn plugin_storage_is_capped_and_survives_a_damaged_settings_file() { // Removing the plug-in closes the storage a run still holds, even one from before the plug-in // was replaced, so nothing is written back. - s.attach_plugin_storage(id); + s.attach_plugin_storage(&s.plugin_store_turn().unwrap(), id); run(&mut s, "plugin.remove", json!({"id": id})); assert_eq!(st.set_setting("zoom", b"again", m), Err(StorageError::Unavailable)); assert_eq!(st.set_cache_entry("tile", b"again", m), Err(StorageError::Unavailable)); assert!(!dir.exists()); assert_eq!(upper.setting("k0", m).unwrap(), Some(b"upper".to_vec())); - s.remove_plugin_storage(upper_id, || true).unwrap(); + s.remove_plugin_storage(&s.plugin_store_turn().unwrap(), upper_id, || true).unwrap(); } /// Files larger than the storage reads are not read: a settings file larger than 1 MiB, although @@ -4874,12 +5072,12 @@ fn removing_a_plugin_drops_its_settings_from_memory() { std::fs::create_dir_all(file.parent().unwrap()).unwrap(); std::fs::write(&file, &bytes).unwrap(); set_modified(&file, written); - s.attach_plugin_storage(id); + s.attach_plugin_storage(&s.plugin_store_turn().unwrap(), id); let st = vectorcraft_plugins::registry::storage(id).unwrap(); let mut m = Meter::unlimited(); assert_eq!(st.setting("zoom", &mut m).unwrap(), Some(b"hello".to_vec())); assert_eq!(m.used(), bytes.len() as u64, "read from the file"); - s.remove_plugin_storage(id, || true).unwrap(); + s.remove_plugin_storage(&s.plugin_store_turn().unwrap(), id, || true).unwrap(); } /// The cache's total stays in memory while the cache folder keeps its time; a write and a clear diff --git a/crates/engine/src/tests/prefs.rs b/crates/engine/src/tests/prefs.rs index 1010d9b547..d88b8250a2 100644 --- a/crates/engine/src/tests/prefs.rs +++ b/crates/engine/src/tests/prefs.rs @@ -693,7 +693,6 @@ fn use_precise_cursors_swaps_the_tools_own_pointers_for_a_crosshair() { ("blobBrush", Cursor::BlobBrush), ("shaper", Cursor::Shaper), ("pencil", Cursor::PencilNew), - ("smooth", Cursor::Smooth), ("pathEraser", Cursor::PathEraser), ("join", Cursor::Join), ("eraser", Cursor::Eraser), @@ -738,6 +737,27 @@ fn use_precise_cursors_swaps_the_tools_own_pointers_for_a_crosshair() { } } +/// With no selected path, the Smooth tool shows Not Allowed, and Use Precise Cursors leaves it so; with a +/// selected path, it shows its own pointer, or a crosshair with the preference on. +#[test] +fn use_precise_cursors_keeps_the_smooth_tools_not_allowed_pointer() { + use vectorcraft_tools::{Cursor, Mods}; + let mut s = Session::new(); + s.execute("file.new", &json!({"width": 400, "height": 400})).unwrap(); + let at = vectorcraft_geom::Point::new(300.0, 300.0); + s.select_tool("smooth", ViewInfo::default()).unwrap(); + for precise in [false, true] { + s.execute("prefs.set", &json!({"key": "usePreciseCursors", "value": precise})).unwrap(); + assert_eq!(s.cursor(at, Mods::default(), ViewInfo::default()), Cursor::NotAllowed, "precise {precise}"); + } + let id = s.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap()["id"].as_u64().unwrap(); + s.execute("select.set", &json!({"ids": [id]})).unwrap(); + for (precise, c) in [(false, Cursor::Smooth), (true, Cursor::Crosshair)] { + s.execute("prefs.set", &json!({"key": "usePreciseCursors", "value": precise})).unwrap(); + assert_eq!(s.cursor(at, Mods::default(), ViewInfo::default()), c, "precise {precise}"); + } +} + /// With Alt held while drawing, the Pencil and the Paintbrush show their closing cursors, and Use Precise Cursors /// turns those into a crosshair too. #[test] diff --git a/crates/engine/src/tests/swatches.rs b/crates/engine/src/tests/swatches.rs index a80769dd98..e59e9a90b1 100644 --- a/crates/engine/src/tests/swatches.rs +++ b/crates/engine/src/tests/swatches.rs @@ -1075,6 +1075,188 @@ fn deleting_a_global_swatch_unlinks_art_that_keeps_its_colour() { assert_eq!(fill_of(&s, a), linked("#2a6fb0", "Brand")); } +/// A session whose default fill and stroke for new art are linked to the global swatch `Brand` +/// (`#2a6fb0`), in color group `G`, beside the global swatch `Other` (`#ff8800`). +fn brand_defaults_session() -> Session { + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Brand", "color": "#2a6fb0", "global": true})); + run(&mut s, "swatch.newGroup", json!({"name": "G", "swatches": ["Brand"]})); + run(&mut s, "swatch.new", json!({"name": "Other", "color": "#ff8800", "global": true})); + run(&mut s, "select.set", json!({"ids": []})); + run(&mut s, "paint.setFill", json!({"swatch": "Brand"})); + run(&mut s, "paint.setStroke", json!({"swatch": "Brand"})); + assert_eq!(s.paint.fill, linked("#2a6fb0", "Brand")); + s +} + +fn fill_and_stroke(s: &Session, id: NodeId) -> (Paint, Paint) { + let a = &doc(s).node(id).unwrap().appearance; + (a.fill_paint(), a.stroke_paint()) +} + +/// Run `steps` and then draw a rectangle, once one command at a time and once as one +/// `command.batch`, and check that both leave the same default paints and give the rectangle drawn +/// in the batch, and one drawn after it, the same fill and stroke. Returns the batch's rectangle's +/// fill and stroke. +fn batch_matches_steps(steps: &[(&str, Value)]) -> (Paint, Paint) { + batch_matches_steps_from(brand_defaults_session, steps) +} + +/// [`batch_matches_steps`] with both sessions made by `setup`. +fn batch_matches_steps_from(setup: impl Fn() -> Session, steps: &[(&str, Value)]) -> (Paint, Paint) { + let shape = ("shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})); + let mut one_by_one = setup(); + for (id, p) in steps { + run(&mut one_by_one, id, p.clone()); + } + let single = rect(&mut one_by_one); + let mut batched = setup(); + let commands: Vec = steps.iter().chain([&shape]).map(|(id, p)| json!({"command": id, "params": p})).collect(); + let r = run(&mut batched, "command.batch", json!({ "commands": commands })); + let in_batch = NodeId(r["results"][steps.len()]["id"].as_u64().unwrap()); + assert_eq!(batched.paint.fill, one_by_one.paint.fill, "the default fill after {steps:?}"); + assert_eq!(batched.paint.stroke, one_by_one.paint.stroke, "the default stroke after {steps:?}"); + let expected = fill_and_stroke(&one_by_one, single); + assert_eq!(fill_and_stroke(&batched, in_batch), expected, "art drawn in the batch after {steps:?}"); + let later = rect(&mut batched); + assert_eq!(fill_and_stroke(&batched, later), expected, "art drawn after the batch after {steps:?}"); + expected +} + +#[test] +fn swatch_steps_in_a_batch_change_the_new_art_paints_as_commands_do() { + let blue = Paint::solid(Color::from_hex("#2a6fb0").unwrap()); + assert_eq!(batch_matches_steps(&[("swatch.delete", json!({"name": "Brand"}))]), (blue.clone(), blue)); + let link = linked("#2a6fb0", "Brand"); + assert_eq!(batch_matches_steps(&[("swatch.delete", json!({"name": "Brand", "unlink": false}))]), (link.clone(), link)); + let signal = linked("#00ff00", "Signal"); + let edit = ("swatch.edit", json!({"name": "Brand", "newName": "Signal", "color": "#00ff00"})); + assert_eq!(batch_matches_steps(&[edit]), (signal.clone(), signal)); + let other = linked("#ff8800", "Other"); + assert_eq!(batch_matches_steps(&[("swatch.merge", json!({"names": ["Other", "Brand"]}))]), (other.clone(), other)); + let gray = linked("#ababab", "Brand"); + assert_eq!(batch_matches_steps(&[("swatch.editGroup", json!({"group": "G", "colors": ["#ababab"]}))]), (gray.clone(), gray)); +} + +#[test] +fn spot_colors_options_in_a_batch_change_the_new_art_paints_as_the_command_does() { + let _g = crate::tests_colormgmt::GLOBAL.lock().unwrap_or_else(|e| e.into_inner()); + let lab = Color::Lab { l: 55.0, a: 60.0, b: 40.0 }; + let cms = vectorcraft_color::cms::active(); + let cmyk = cms.convert(&lab, vectorcraft_color::cms::Model::Cmyk, cms.settings().intent); + assert!(matches!(cmyk, Color::Cmyk { .. })); + // The default fill and stroke for new art are linked to 40 % of the Lab spot swatch "Lab Ink". + let lab_ink_defaults = |use_lab: bool| { + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Lab Ink", "color": {"l": 55, "a": 60, "b": 40}, "spot": true})); + run(&mut s, "swatch.spotOptions", json!({ "useLab": use_lab })); + run(&mut s, "select.set", json!({"ids": []})); + run(&mut s, "paint.setFill", json!({"swatch": "Lab Ink", "tint": 40})); + run(&mut s, "paint.setStroke", json!({"swatch": "Lab Ink", "tint": 40})); + s + }; + let ink = |color: Color| Paint::Solid { color: color.tinted(0.4), swatch: Some("Lab Ink".into()), tint: 0.4 }; + assert_eq!(lab_ink_defaults(true).paint.fill, ink(lab)); + let to_cmyk = [("swatch.spotOptions", json!({"useLab": false}))]; + assert_eq!(batch_matches_steps_from(|| lab_ink_defaults(true), &to_cmyk), (ink(cmyk), ink(cmyk))); + assert_eq!(lab_ink_defaults(false).paint.fill, ink(cmyk)); + let to_lab = [("swatch.spotOptions", json!({"useLab": true}))]; + assert_eq!(batch_matches_steps_from(|| lab_ink_defaults(false), &to_lab), (ink(lab), ink(lab))); +} + +#[test] +fn default_swatches_replace_in_a_batch_unlinks_the_new_art_paints_as_the_command_does() { + // Brand and Other are not default swatches, so replacing the swatches drops the links to them. + let blue = Paint::solid(Color::from_hex("#2a6fb0").unwrap()); + let replace = [("swatch.resetDefaults", json!({"replace": true}))]; + assert_eq!(batch_matches_steps(&replace), (blue.clone(), blue)); + // Without replace the swatches stay, and so do the links. + let link = linked("#2a6fb0", "Brand"); + assert_eq!(batch_matches_steps(&[("swatch.resetDefaults", json!({}))]), (link.clone(), link)); +} + +#[test] +fn undo_and_redo_of_a_swatch_edit_put_back_the_new_art_paints() { + let edit = json!({"name": "Brand", "newName": "Signal", "color": "#00ff00"}); + let delete = json!({"name": "Brand"}); + for (id, p, fill) in + [("swatch.edit", &edit, linked("#00ff00", "Signal")), ("swatch.delete", &delete, Paint::solid(Color::from_hex("#2a6fb0").unwrap()))] + { + for batch in [false, true] { + let mut s = brand_defaults_session(); + let before = s.paint.clone(); + if batch { + run(&mut s, "command.batch", json!({"commands": [{"command": id, "params": p}]})); + } else { + run(&mut s, id, p.clone()); + } + assert_eq!(s.paint.fill, fill, "{id}, batch: {batch}"); + let after = s.paint.clone(); + run(&mut s, "edit.undo", json!({})); + assert_eq!(s.paint, before, "Undo of {id}, batch: {batch}"); + run(&mut s, "edit.redo", json!({})); + assert_eq!(s.paint, after, "Redo of {id}, batch: {batch}"); + } + } +} + +#[test] +fn swatch_edits_reach_the_paints_of_the_new_art_template() { + let mut s = brand_defaults_session(); + s.paint.appearance = Some(vectorcraft_doc::Appearance::basic(linked("#2a6fb0", "Brand"), linked("#2a6fb0", "Brand"), 1.0)); + run(&mut s, "swatch.edit", json!({"name": "Brand", "newName": "Signal", "color": "#00ff00"})); + let template = |s: &Session| -> Vec { + s.paint + .appearance + .iter() + .flat_map(|a| a.items.iter()) + .map(|it| match it { + vectorcraft_doc::AppearanceItem::Fill(f) => f.paint.clone(), + vectorcraft_doc::AppearanceItem::Stroke(k) => k.paint.clone(), + }) + .collect() + }; + assert_eq!(template(&s), [linked("#00ff00", "Signal"), linked("#00ff00", "Signal")]); + run(&mut s, "swatch.delete", json!({"name": "Signal"})); + let green = Paint::solid(Color::from_hex("#00ff00").unwrap()); + assert_eq!(template(&s), [green.clone(), green]); +} + +#[test] +fn a_failed_batch_puts_back_the_new_art_paints_a_swatch_step_changed() { + let mut s = brand_defaults_session(); + let before = s.paint.clone(); + let steps = json!([ + {"command": "swatch.edit", "params": {"name": "Brand", "newName": "Signal", "color": "#00ff00"}}, + {"command": "no.such.command", "params": {}}, + ]); + assert!(s.execute("command.batch", &json!({ "commands": steps })).is_err()); + assert_eq!(s.paint, before); + assert_eq!(doc(&s).swatch("Brand").unwrap().paint.color(), Some(Color::from_hex("#2a6fb0").unwrap())); +} + +#[test] +fn canceling_a_swatch_options_preview_keeps_the_new_art_paints() { + let mut s = brand_defaults_session(); + let before = s.paint.clone(); + s.begin_interaction("Swatch Options").unwrap(); + s.preview("swatch.edit", &json!({"name": "Brand", "newName": "Signal", "color": "#00ff00"})).unwrap(); + s.cancel_interaction().unwrap(); + assert_eq!(s.paint, before); + assert!(doc(&s).swatch("Signal").is_none()); + // A previewed batch that is canceled puts them back too, and one that is accepted keeps them. + let steps = json!([{"command": "swatch.edit", "params": {"name": "Brand", "newName": "Signal", "color": "#00ff00"}}]); + s.begin_interaction("Batch Preview").unwrap(); + s.preview("command.batch", &json!({ "commands": steps })).unwrap(); + s.cancel_interaction().unwrap(); + assert_eq!(s.paint, before); + s.begin_interaction("Batch Preview").unwrap(); + s.preview("command.batch", &json!({ "commands": steps })).unwrap(); + s.commit_interaction().unwrap(); + assert_eq!(s.paint.fill, linked("#00ff00", "Signal")); + assert_eq!(s.paint.stroke, linked("#00ff00", "Signal")); +} + #[test] fn deleting_several_swatches_and_groups() { let mut s = session(); diff --git a/crates/engine/src/tests/swatchlib.rs b/crates/engine/src/tests/swatchlib.rs index 445ce38ea7..dbf32eba7c 100644 --- a/crates/engine/src/tests/swatchlib.rs +++ b/crates/engine/src/tests/swatchlib.rs @@ -636,6 +636,114 @@ fn gradient_libraries_are_listed_and_gradient_swatches_rename_and_take_new_gradi assert_eq!(doc(&s).swatch("Red").unwrap().paint.color().map(|c| c.to_hex()), Some("#00ff00".into())); } +/// A radial gradient from red to blue, with `extra` keys. +fn radial_gradient(extra: Value) -> Value { + let mut g = json!({"kind": "radial", "stops": [{"offset": 0, "color": "#ff0000"}, {"offset": 1, "color": "#0000ff"}]}); + if let (Some(g), Some(extra)) = (g.as_object_mut(), extra.as_object()) { + g.extend(extra.clone()); + } + g +} + +/// The gradient swatch `name` keeps an aspect of 50%, holds no swatch link, and applies with that +/// aspect, fitted to the object it is applied to. +fn assert_swatch_applies_with_half_aspect(s: &mut Session, name: &str) { + let Paint::Gradient(sw) = &doc(s).swatch(name).unwrap().paint else { panic!("{name}: a gradient swatch") }; + assert!(sw.geom.is_some_and(|g| (g.aspect - 0.5).abs() < 1e-9), "{name} keeps the aspect: {:?}", sw.geom); + assert_eq!(sw.swatch, None, "{name} holds no link to the swatch its gradient came from"); + let r = run(s, "shape.rectangle", json!({"x": 100, "y": 0, "width": 100, "height": 60})); + let id = r["id"].as_u64().unwrap(); + run(s, "paint.setFill", json!({"ids": [id], "swatch": name})); + let fill = doc(s).node(vectorcraft_doc::NodeId(id)).unwrap().appearance.fill_paint(); + let Paint::Gradient(g) = fill else { panic!("{name}: a gradient fill") }; + let geom = g.geom.unwrap(); + assert!( + geom.start.distance(vectorcraft_geom::Point::new(150.0, 30.0)) < 1e-9 && (geom.aspect - 0.5).abs() < 1e-9, + "{name} fits the object with its aspect: {geom:?}" + ); +} + +/// An edited gradient with a vector and an aspect that replaces a gradient swatch keeps its aspect, +/// as a new swatch made from it does. +#[test] +fn a_gradient_swatch_takes_an_edited_gradient_with_its_aspect() { + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Edited", "gradient": radial_gradient(json!({}))})); + let placed = radial_gradient(json!({"start": [25, 25], "end": [50, 25], "aspect": 50})); + run(&mut s, "swatch.edit", json!({"name": "Edited", "paint": {"gradient": placed}})); + assert_swatch_applies_with_half_aspect(&mut s, "Edited"); +} + +/// A gradient swatch Alt-dropped on another gradient swatch gives it its gradient with its aspect. +#[test] +fn a_gradient_swatch_takes_a_dropped_swatch_with_its_aspect() { + let mut s = session(); + run(&mut s, "swatch.new", json!({"name": "Dropped", "gradient": radial_gradient(json!({}))})); + let placed = radial_gradient(json!({"start": [25, 25], "end": [50, 25], "aspect": 50})); + run(&mut s, "swatch.new", json!({"name": "Oval", "gradient": placed})); + run(&mut s, "swatch.edit", json!({"name": "Dropped", "paint": {"swatch": "Oval"}})); + assert_swatch_applies_with_half_aspect(&mut s, "Dropped"); +} + +/// A gradient given an aspect but no vector keeps the aspect in a new swatch and in a replacement, +/// as `paint.setFill` keeps it on the object. +#[test] +fn a_gradient_without_a_vector_keeps_its_aspect_in_a_swatch() { + let mut s = session(); + let oval = radial_gradient(json!({"aspect": 50})); + run(&mut s, "swatch.new", json!({"name": "New", "gradient": oval})); + assert_swatch_applies_with_half_aspect(&mut s, "New"); + run(&mut s, "swatch.new", json!({"name": "Edited", "gradient": radial_gradient(json!({}))})); + run(&mut s, "swatch.edit", json!({"name": "Edited", "paint": {"gradient": oval}})); + assert_swatch_applies_with_half_aspect(&mut s, "Edited"); + // Without an aspect the swatch stays unplaced. + run(&mut s, "swatch.new", json!({"name": "Round", "gradient": radial_gradient(json!({}))})); + let Paint::Gradient(round) = &doc(&s).swatch("Round").unwrap().paint else { panic!("a gradient swatch") }; + assert_eq!(round.geom, None); +} + +/// A pattern that replaces a pattern swatch is stored untransformed, as a new swatch stores it, so +/// art the swatch is applied to keeps its own tile placement. +#[test] +fn a_pattern_swatch_takes_a_new_pattern_untransformed() { + let mut s = session(); + for (name, color) in [("Dots", "#ff0000"), ("Bars", "#0000ff")] { + let r = run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})); + run(&mut s, "paint.setFill", json!({"ids": [r["id"]], "color": color})); + run(&mut s, "select.set", json!({"ids": [r["id"]]})); + run(&mut s, "object.pattern.make", json!({"name": name, "width": 20, "height": 20})); + run(&mut s, "object.pattern.done", json!({})); + } + // A pattern swatch holding a tile transform, as documents saved by older versions can. + let moved = vectorcraft_geom::Affine::new([2.0, 0.0, 0.0, 2.0, 15.0, 10.0]); + let st = s.doc_mut().unwrap(); + let Some(Paint::Pattern { xf, .. }) = std::sync::Arc::make_mut(&mut st.doc).swatch_mut("Bars").map(|w| &mut w.paint) else { + panic!("the Bars pattern swatch") + }; + *xf = moved; + run(&mut s, "swatch.edit", json!({"name": "Dots", "paint": {"swatch": "Bars"}})); + assert_eq!(doc(&s).swatch("Dots").unwrap().paint, vectorcraft_doc::pattern::pattern_paint("Bars")); +} + +/// A pattern swatch takes a pattern given by name, as an Alt-drop of a pattern fill sends it, and +/// an unknown pattern is an error that leaves the swatch as it was. +#[test] +fn a_pattern_swatch_takes_a_pattern_by_name() { + let mut s = session(); + for (name, color) in [("Dots", "#ff0000"), ("Bars", "#0000ff")] { + let r = run(&mut s, "shape.rectangle", json!({"x": 0, "y": 0, "width": 10, "height": 10})); + run(&mut s, "paint.setFill", json!({"ids": [r["id"]], "color": color})); + run(&mut s, "select.set", json!({"ids": [r["id"]]})); + run(&mut s, "object.pattern.make", json!({"name": name, "width": 20, "height": 20})); + run(&mut s, "object.pattern.done", json!({})); + } + run(&mut s, "swatch.edit", json!({"name": "Dots", "paint": {"pattern": "Bars"}})); + assert_eq!(doc(&s).swatch("Dots").unwrap().paint, vectorcraft_doc::pattern::pattern_paint("Bars")); + let before = doc(&s).swatch("Dots").unwrap().paint.clone(); + assert!(s.execute("swatch.edit", &json!({"name": "Dots", "paint": {"pattern": "Nope"}})).is_err()); + assert_eq!(doc(&s).swatch("Dots").unwrap().paint, before); +} + #[test] fn organic_fades_add_with_their_method_midpoints_and_opacities_in_rgb_and_cmyk() { let lib = vectorcraft_color::libraries::builtin_library("organic-fades").unwrap(); diff --git a/crates/engine/src/tests/symbol_nine_slice.rs b/crates/engine/src/tests/symbol_nine_slice.rs index b0689d1587..cba8b8c984 100644 --- a/crates/engine/src/tests/symbol_nine_slice.rs +++ b/crates/engine/src/tests/symbol_nine_slice.rs @@ -20,9 +20,18 @@ fn close(a: Rect, b: Rect) -> bool { /// A 100 × 100 frame with a 10 × 10 square in its top-left corner and one in its center, made /// into symbol "Panel" with 9-slice guides on, its instance selected at its natural size. fn panel_symbol() -> (Session, NodeId) { + panel_symbol_filled(None) +} + +/// [`panel_symbol`] with the frame filled with `fill` when there is one. +fn panel_symbol_filled(fill: Option) -> (Session, NodeId) { let mut s = Session::new(); s.execute("file.new", &json!({"width": 400, "height": 300})).unwrap(); let ids = [rect(&mut s, 50.0, 50.0, 100.0, 100.0), rect(&mut s, 50.0, 50.0, 10.0, 10.0), rect(&mut s, 95.0, 95.0, 10.0, 10.0)]; + if let Some(fill) = fill { + let doc = std::sync::Arc::make_mut(&mut s.doc_mut().unwrap().doc); + doc.node_mut(ids[0]).unwrap().appearance = vectorcraft_doc::Appearance::basic(fill, vectorcraft_color::Paint::None, 0.0).into(); + } s.select(|_, sel| sel.set(ids)).unwrap(); let r = s.execute("symbol.new", &json!({"name": "Panel", "nineSlice": true})).unwrap(); assert_eq!(r["nineSlice"], json!([0.25, 0.25, 0.25, 0.25])); @@ -350,3 +359,39 @@ fn guides_outside_the_art_survive_saving_and_reopening_a_native_file() { assert!(back.symbol_slice_map(symbol, *xf).is_none(), "{bad}: scaled as a whole"); } } + +/// [`panel_symbol`] with a gradient on the frame, so that the frame is drawn in a clip group for +/// each cell, its instance resized to 200 × 150 and turned 20°. +fn turned_gradient_panel() -> (Session, NodeId) { + let gradient = vectorcraft_color::Paint::Gradient(Box::new(vectorcraft_color::GradientPaint::new(vectorcraft_color::Gradient::default()))); + let (mut s, id) = panel_symbol_filled(Some(gradient)); + s.execute("object.setBounds", &json!({"x": 50, "y": 50, "width": 200, "height": 150, "reference": 0})).unwrap(); + s.execute("object.rotate", &json!({"angle": 20})).unwrap(); + (s, id) +} + +/// The bounding box angles of the objects under the art that replaced an instance, and whether +/// that art holds a clip group. +fn expanded_angles(s: &Session, art: NodeId) -> (Vec, bool) { + let (mut angles, mut clips) = (vec![], false); + s.doc().unwrap().doc.node(art).unwrap().walk(&mut |c| { + angles.push(c.bbox_angle); + clips |= matches!(c.kind, NodeKind::Group { clip: true, .. }); + }); + (angles, clips) +} + +#[test] +fn break_link_turns_the_cells_of_a_sliced_instance_with_its_box() { + for reset in [false, true] { + let (mut s, _) = turned_gradient_panel(); + if reset { + assert_eq!(s.execute("object.resetBoundingBox", &json!({})).unwrap()["changed"], 1); + } + let r = s.execute("symbol.breakLink", &json!({})).unwrap(); + let (angles, clips) = expanded_angles(&s, NodeId(r["ids"][0].as_u64().unwrap())); + assert!(clips, "the frame is drawn in clip groups"); + let want = if reset { 0.0 } else { 20.0 }; + assert!(angles.iter().all(|a| (a - want).abs() < 1e-6), "reset {reset}: {angles:?}"); + } +} diff --git a/crates/engine/src/tests/symbollib.rs b/crates/engine/src/tests/symbollib.rs index 54591c4658..c5d32e822a 100644 --- a/crates/engine/src/tests/symbollib.rs +++ b/crates/engine/src/tests/symbollib.rs @@ -84,7 +84,7 @@ fn the_builtin_library_is_original_art_generated_in_code() { let mut s = Session::new(); let list = run(&mut s, "symbol.libraries", json!({})); let libs = list["libraries"].as_array().unwrap(); - assert_eq!(libs.len(), 5, "{libs:?}"); + assert_eq!(libs.len(), 6, "{libs:?}"); assert_eq!((libs[0]["id"].as_str(), libs[0]["category"].as_str()), (Some("basic-shapes"), Some("builtIn"))); assert_eq!( (libs[1]["id"].as_str(), libs[1]["name"].as_str(), libs[1]["category"].as_str()), @@ -102,6 +102,10 @@ fn the_builtin_library_is_original_art_generated_in_code() { (libs[4]["id"].as_str(), libs[4]["name"].as_str(), libs[4]["category"].as_str()), (Some("skill-icons"), Some("Skill Icons"), Some("builtIn")) ); + assert_eq!( + (libs[5]["id"].as_str(), libs[5]["name"].as_str(), libs[5]["category"].as_str()), + (Some("weather-icons"), Some("Weather Icons"), Some("builtIn")) + ); let lib = run(&mut s, "symbol.library", json!({"library": "basic shapes"})); let names: Vec<&str> = lib["symbols"].as_array().unwrap().iter().map(|x| x["name"].as_str().unwrap()).collect(); assert_eq!(names, ["Circle", "Square", "Rounded Square", "Triangle", "Diamond", "Hexagon", "Star", "Burst", "Arrow"]); @@ -215,6 +219,32 @@ fn map_markers_symbols_add_without_nine_slice() { )); } +#[test] +fn weather_icons_library_lists_and_places() { + let mut s = session(); + let lib = run(&mut s, "symbol.library", json!({"library": "weather-icons"})); + let names: Vec<&str> = lib["symbols"].as_array().unwrap().iter().map(|x| x["name"].as_str().unwrap()).collect(); + assert_eq!(names, ["Sun", "Moon", "Cloud", "Rain", "Thunder", "Snow"]); + let mut placed = Vec::new(); + for (i, name) in names.iter().enumerate() { + let r = run( + &mut s, + "symbol.addFromLibrary", + json!({"library": "weather-icons", "name": name, "place": true, "x": 100.0 + 80.0 * i as f64, "y": 100.0}), + ); + assert_eq!(r["added"], json!([name])); + placed.push(r["placed"].as_u64().unwrap()); + } + let d = doc(&s); + for (i, name) in names.iter().enumerate() { + assert_eq!(d.symbol_nine_slice(name), None, "{name} should not carry 9-slice guides"); + assert!(matches!( + d.node(NodeId(placed[i])).map(|n| &n.kind), + Some(NodeKind::SymbolInstance { symbol, .. }) if symbol == *name + )); + } +} + #[test] fn a_saved_library_reopens_and_its_symbols_join_another_document_in_one_step() { let dir = folder("user"); diff --git a/crates/engine/src/tests/toolsettings.rs b/crates/engine/src/tests/toolsettings.rs index e896a0ab32..2ec7667bde 100644 --- a/crates/engine/src/tests/toolsettings.rs +++ b/crates/engine/src/tests/toolsettings.rs @@ -241,6 +241,69 @@ fn options_are_saved_with_the_preferences() { assert_eq!(t.prefs.tool_settings["polygon"]["sides"], json!(9)); } +#[test] +fn spiral_decay_is_normalized_for_active_and_inactive_tools_and_preferences() { + let mut s = session(); + for active in [false, true] { + select(&mut s, if active { "spiral" } else { "selection" }); + let options = s.set_tool_option_cmd(&json!({"tool": "spiral", "values": {"decay": 150, "segments": 4, "clockwise": false}})).unwrap(); + assert_eq!(options["decay"], json!(99.99)); + assert_eq!(s.tool_options_of("spiral")["decay"], json!(99.99)); + assert_eq!(s.prefs.tool_settings["spiral"]["decay"], json!(99.99)); + assert_eq!(s.tool_id(), if active { "spiral" } else { "selection" }); + select(&mut s, "selection"); + select(&mut s, "spiral"); + assert_eq!(s.tool_options()["decay"], json!(99.99)); + } + let saved = serde_json::to_string(&s.prefs).unwrap(); + let mut restored = session(); + restored.apply_prefs(serde_json::from_str(&saved).unwrap()); + select(&mut restored, "spiral"); + assert_eq!(restored.tool_options(), json!({"decay": 99.99, "segments": 4, "clockwise": false})); +} + +#[test] +fn legacy_spiral_decay_preferences_report_the_ratio_drawn_after_reopening() { + use vectorcraft_geom::Point; + use vectorcraft_tools::{PointerEvent, PointerKind}; + + // Older versions saved 100–150, although their geometry already capped the ratio at 0.9999. + for clockwise in [false, true] { + let mut s = session(); + let mut prefs = Prefs::default(); + prefs.tool_settings.insert("spiral".into(), json!({"decay": 150, "segments": 4, "clockwise": clockwise}).as_object().unwrap().clone()); + s.apply_prefs(serde_json::from_str(&serde_json::to_string(&prefs).unwrap()).unwrap()); + let view = ViewInfo { smart_guides: false, ..Default::default() }; + s.select_tool("spiral", view).unwrap(); + let decay = s.tool_options()["decay"].as_f64().unwrap(); + assert_eq!(decay, 99.99); + let before = s.doc().unwrap().history.undo.len(); + for (kind, x) in [(PointerKind::Down, 200.0), (PointerKind::Drag, 300.0), (PointerKind::Up, 300.0)] { + s.pointer(&PointerEvent::new(kind, x, 200.0), view).unwrap(); + } + let d = s.doc().unwrap(); + assert_eq!(d.history.undo.len(), before + 1); + assert_eq!(d.selection.objects.len(), 1); + let id = d.selection.objects[0]; + let path = d.doc.node(id).unwrap().path_data().unwrap().clone(); + let anchors = &path.subpaths[0].anchors; + assert_eq!(anchors.len(), 5); + assert!(!path.is_closed()); + let center = Point::new(200.0, 200.0); + // The path runs from the centre end outwards, and decay is per full wind: four quarter-turn + // segments give the decay. + for pair in anchors.windows(2) { + let ratio = pair[0].p.distance(center) / pair[1].p.distance(center); + assert!((100.0 * ratio.powi(4) - decay).abs() < 1e-9); + } + assert_eq!(s.prefs.tool_settings["spiral"]["decay"], json!(99.99)); + s.execute("edit.undo", &json!({})).unwrap(); + assert!(s.doc().unwrap().doc.node(id).is_none()); + s.execute("edit.redo", &json!({})).unwrap(); + assert_eq!(s.doc().unwrap().doc.node(id).unwrap().path_data().unwrap(), &path); + } +} + /// Escape on a polygon or rounded rectangle drag puts back the side count or corner radius its /// arrows changed, in the saved options and the Corner Radius preference too. #[test] diff --git a/crates/engine/tests/color_settings.rs b/crates/engine/tests/color_settings.rs index e8b3ab0906..b02e34690b 100644 --- a/crates/engine/tests/color_settings.rs +++ b/crates/engine/tests/color_settings.rs @@ -149,6 +149,34 @@ fn loading_an_assigned_profile_again_keeps_it_in_use() { assert_eq!(cms::working_settings(), working); } +/// A document behind the front one draws through its own assigned profile: loading that profile's +/// file again or removing it redraws the document, and the front document stays as it was. +#[test] +fn loading_or_removing_a_back_documents_profile_redraws_it() { + const NAME: &str = "Back RGB P"; + let _g = settings(); + let dir = fresh_dir("back-assigned"); + let _reset = ColorSettingsReset { profile: Some(NAME), paths: vec![dir.clone()] }; + std::fs::create_dir_all(&dir).unwrap(); + let path = dir.join("back.icc"); + std::fs::write(&path, icc_named(NAME)).unwrap(); + let mut s = session(); + let load = |s: &mut Session| assert_eq!(exec(s, "color.loadProfile", json!({"path": path.to_str().unwrap()}))["name"], NAME); + load(&mut s); + exec(&mut s, "edit.assignProfile", json!({"rgb": NAME})); + exec(&mut s, "file.new", json!({"width": 100, "height": 100})); + let revisions = |s: &Session| s.documents().iter().map(|d| d.revision).collect::>(); + let before = revisions(&s); + load(&mut s); + let loaded = revisions(&s); + assert!(loaded[0] > before[0], "the back document assigned the profile redraws after a load"); + assert_eq!(loaded[1], before[1], "the front document does not use it"); + exec(&mut s, "color.removeProfile", json!({"name": NAME})); + let removed = revisions(&s); + assert!(removed[0] > loaded[0], "the back document assigned the profile redraws after a removal"); + assert_eq!(removed[1], loaded[1], "the front document does not use it"); +} + /// A batch that assigns a profile and then changes the color mode, as Document Setup's OK does, /// converts the colors through the profile it assigns. #[test] diff --git a/crates/engine/tests/import_fuzz.rs b/crates/engine/tests/import_fuzz.rs index 79178d6233..7e613460cd 100644 --- a/crates/engine/tests/import_fuzz.rs +++ b/crates/engine/tests/import_fuzz.rs @@ -4329,7 +4329,8 @@ proptest! { "0 R", "0 O", "0 1 1 0 K", "1 0 0 0 k", "0 0 0 0 1 0 0 Xa", "0 0 0 0 1 0 0 XA", "0.5 G", "0 g", "K", "Xa", "0 J 0 j 2 w 10 M []0 d", "-1 w", "1e400 w", "0 M", "[3 -1]0 d", "[]0 d", "1 0 Xd", "0 1 Xd", "1 1 Xd", "0 0 Xd", "1 Xd", "Xd", "0 1 0 0 0 Xy", "1 0.5 1 1 0 Xy", "Xy", - "0 Bb", "2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg", "0 BB", "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p", + "0 Bb", "1 Bb", "2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg", "2 (Sky) 0 0 1e400 100 1 0 0 1 0 0 Bg", "2 (Dusk) 0 0 0 100 1 0 0 1 0 0 Bg", + "0 BB", "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p", "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] P", "0 XR", ]).prop_map(|op| (op.to_string(), true)), "[ -~]{0,12}".prop_map(|text| (text, false)), @@ -4338,9 +4339,11 @@ proptest! { ) { use vectorcraft_testkit::ai; let close = if closed { "/Paint ;\n/Def ;\n" } else { "" }; - // C, a red 2 pt stroke, comes first, so that it reads whatever A holds. + // C, a red 2 pt stroke, comes first, so that it reads whatever A holds. The file defines the + // gradient Sky, which a gradient paint of A may name. let header = format!( - "%AI9_BeginArtStyles\n/KnownStyle :\n(C) /Name ,\n/SimpleStyle :\n0 R\n0 1 1 0 K\n2 w\n1 0 Xd\n/Paint ;\n/Def ;\n\ + "%AI5_BeginGradient: (Sky)\n(Sky) 0 2 Bd\n[\n%_0 0 0 0 0 1 0 2 1 6 50 0 Bs\n%_0 0 0 0 1 1 1 2 1 6 50 100 Bs\nBD\n%AI5_EndGradient\n\ + %AI9_BeginArtStyles\n/KnownStyle :\n(C) /Name ,\n/SimpleStyle :\n0 R\n0 1 1 0 K\n2 w\n1 0 Xd\n/Paint ;\n/Def ;\n\ /KnownStyle :\n(A) /Name ,\n/SimpleStyle :\n{}\n{close}/KnownStyle :\n(B) /Name ,\n/SimpleStyle :\n1 0 Xd\n/Paint ;\n/Def ;\n\ %AI9_EndArtStyles\n%AI9_BeginArtStyleList\n(A)\n(B)\n(C)\n%AI9_EndArtStyleList\n", ops.iter().map(|(op, _)| op.as_str()).collect::>().join("\n") diff --git a/crates/engine/tests/it/dimensions.rs b/crates/engine/tests/it/dimensions.rs index 56ee67be17..240a7fe280 100644 --- a/crates/engine/tests/it/dimensions.rs +++ b/crates/engine/tests/it/dimensions.rs @@ -419,6 +419,56 @@ fn a_reflected_horizontal_dimension_keeps_its_line_on_the_reflected_side() { assert_eq!(text(&s, id), "100.00 pt"); } +/// An unlinked aligned dimension reflected on its own has its line on the reflected side of its +/// points: a line 30 pt above a level pair is 30 pt below it after a flip top to bottom, and a +/// half turn moves it below them as well, by turning it. +#[test] +fn a_reflected_aligned_dimension_keeps_its_line_on_the_reflected_side() { + let mut s = session(); + let id = run(&mut s, "dimension.create", json!({"a":[100,200],"b":[200,200],"offset":-30}))["id"].as_u64().unwrap(); + assert_eq!(path_ends(&s, id)[2], vec![(100.0, 170.0), (200.0, 170.0)]); + run(&mut s, "select.set", json!({"ids":[id]})); + run(&mut s, "object.reflect", json!({"axis":"horizontal","origin":[0,200]})); + assert_eq!(path_ends(&s, id)[2], vec![(100.0, 230.0), (200.0, 230.0)]); + assert_eq!(text(&s, id), "100.00 pt"); + // Reflected left to right, the points swap ends and the line stays below them. + run(&mut s, "object.reflect", json!({"axis":"vertical","origin":[150,0]})); + assert_eq!(path_ends(&s, id)[2], vec![(200.0, 230.0), (100.0, 230.0)]); + run(&mut s, "edit.undo", json!({})); + run(&mut s, "edit.undo", json!({})); + assert_eq!(path_ends(&s, id)[2], vec![(100.0, 170.0), (200.0, 170.0)]); + // A half turn about the points' midpoint puts the line below them by turning it. + run(&mut s, "object.rotate", json!({"angle":180,"origin":[150,200]})); + let ends = path_ends(&s, id)[2].iter().map(|(x, y)| (x.round(), y.round())).collect::>(); + assert_eq!(ends, vec![(200.0, 230.0), (100.0, 230.0)]); +} + +/// An unlinked aligned dimension of a diagonal pair reflected about a mirror line through its +/// points has its line on the other side of them, and a scale by a negative factor reverses the +/// side as a reflection does, while a scale by positive factors keeps it. +#[test] +fn an_aligned_dimension_reflected_about_an_angle_or_scaled_by_a_negative_factor_changes_sides() { + let mut s = session(); + let id = run(&mut s, "dimension.create", json!({"a":[100,200],"b":[200,100],"offset":-30}))["id"].as_u64().unwrap(); + let k = 30.0 / 2f64.sqrt(); + let near = |got: &[(f64, f64)], want: [(f64, f64); 2]| got.iter().zip(want).all(|(g, w)| (g.0 - w.0).abs() < 1e-6 && (g.1 - w.1).abs() < 1e-6); + let ends = path_ends(&s, id)[2].clone(); + assert!(near(&ends, [(100.0 - k, 200.0 - k), (200.0 - k, 100.0 - k)]), "{ends:?}"); + run(&mut s, "select.set", json!({"ids":[id]})); + // The mirror line at 45 degrees through (150, 150) holds both points. + run(&mut s, "object.reflect", json!({"axis":45,"origin":[150,150]})); + let ends = path_ends(&s, id)[2].clone(); + assert!(near(&ends, [(100.0 + k, 200.0 + k), (200.0 + k, 100.0 + k)]), "{ends:?}"); + run(&mut s, "edit.undo", json!({})); + let level = run(&mut s, "dimension.create", json!({"a":[100,200],"b":[200,200],"offset":-30}))["id"].as_u64().unwrap(); + run(&mut s, "select.set", json!({"ids":[level]})); + run(&mut s, "object.scale", json!({"sx":-200,"sy":100,"origin":[150,0]})); + assert_eq!(path_ends(&s, level)[2], vec![(250.0, 170.0), (50.0, 170.0)]); + run(&mut s, "edit.undo", json!({})); + run(&mut s, "object.scale", json!({"sx":200,"sy":200,"origin":[150,200]})); + assert_eq!(path_ends(&s, level)[2], vec![(50.0, 170.0), (250.0, 170.0)]); +} + /// The line of a linked horizontal dimension below both points stays below them when the art /// turns a half turn; a line between the points keeps its distance from the first point. #[test] diff --git a/crates/engine/tests/plugin_fuzz.rs b/crates/engine/tests/plugin_fuzz.rs index 58cc302279..20546835c1 100644 --- a/crates/engine/tests/plugin_fuzz.rs +++ b/crates/engine/tests/plugin_fuzz.rs @@ -950,9 +950,10 @@ proptest! { prop_assert_eq!(theirs.setting("mine", m).unwrap(), Some(b"kept".to_vec())); prop_assert_eq!(theirs.cache_entry("mine", m).unwrap(), Some(b"kept".to_vec())); prop_assert_eq!(theirs.cache_bytes(), 4); - // The host names every file: the store holds the two modules, their grants and their folders. + // The host names every file: the store holds the two modules, their grants, their folders and + // the file windows lock while they change the store. let names = |dir: &std::path::Path| std::fs::read_dir(dir).unwrap().filter_map(Result::ok).map(|e| e.file_name()).collect::>(); - prop_assert!(names(&folder).len() <= 4, "{:?}", names(&folder)); + prop_assert!(names(&folder).len() <= 5, "{:?}", names(&folder)); prop_assert!(names(&folder.join("storage")).len() <= 2, "{:?}", names(&folder.join("storage"))); let _ = s.execute("plugin.remove", &json!({"id": "fuzz.storage"})); let _ = s.execute("plugin.remove", &json!({"id": "fuzz.storage.other"})); diff --git a/crates/eps/src/ai_editing/tests.rs b/crates/eps/src/ai_editing/tests.rs index 967c982ad4..ce64e56fd5 100644 --- a/crates/eps/src/ai_editing/tests.rs +++ b/crates/eps/src/ai_editing/tests.rs @@ -1187,6 +1187,28 @@ fn a_symbol_definition_is_written_only_with_room_for_its_instance() { } } +/// A symbol definition without room for its group, asked for by an instance in art drawn for an +/// object (a stained instance's art), is left out and leaves the writing of that art as it was. +#[test] +fn a_symbol_definition_without_room_in_drawn_art_is_left_out() { + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + let dot = square(&mut doc, Rect::new(0.0, 0.0, 10.0, 10.0), Color::gray(0.5)); + doc.symbols.push(Symbol { dynamic: false, name: "Dot".into(), art: Arc::new(dot) }); + let inner = instance(&mut doc, "Dot", Affine::IDENTITY); + doc.symbols.push(Symbol { dynamic: false, name: "Badge".into(), art: Arc::new(inner) }); + let mut stained = instance(&mut doc, "Badge", Affine::translate((50.0, 10.0))); + stained.appearance = Appearance::basic(solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0).into(); + doc.insert(Some(layer), usize::MAX, stained).unwrap(); + let read = crate::import::objects_read(&export_ai_editing(&doc, &opts()).unwrap().program).unwrap(); + for max in 0..read { + let out = export_within(&doc, &opts(), max).unwrap(); + assert!(out.warnings.iter().any(|w| w == writer::OBJECT_LIMIT), "room for {max} of {read}"); + let objects = crate::import::objects_read(&out.program).unwrap(); + assert!(objects <= max, "{objects} objects read with room for {max}"); + } +} + /// The writer's limit is the reader's, which its warning names. #[test] fn the_object_limit_is_the_readers() { @@ -3255,7 +3277,8 @@ fn images_are_written_again_as_the_same_bytes() { /// The program of `doc` with LF line ends, and each image's samples (from after `XI` and its line /// end to `%%EndData`, a `%_` before it kept) and each preview's rows (from after `32 17 ` to the -/// line end before `%AI26_EndPlacedObjectPreview`) shown as ``. +/// line end before `%AI26_EndPlacedObjectPreview` or `%_%AI26_EndPlacedObjectPreview`) shown as +/// ``. fn program_shown(doc: &Document) -> String { shown(&export_ai_editing(doc, &opts()).unwrap().program) } @@ -3267,10 +3290,13 @@ fn shown(p: &[u8]) -> String { let mut at = 0; loop { let xi = find(at, b"\r\nXI\r\n").map(|i| (i + 6, b"%%EndData".as_slice())); - let pv = find(at, b" 32 17 ").map(|i| (i + 7, b"\r\n%AI26_EndPlacedObjectPreview".as_slice())); + let pv = find(at, b" 32 17 ").map(|i| (i + 7, b"%AI26_EndPlacedObjectPreview".as_slice())); let Some((start, end)) = [xi, pv].into_iter().flatten().min_by_key(|(s, _)| *s) else { break }; let mut stop = find(start, end).unwrap(); - if end.starts_with(b"%%") && p.get(stop - 2..stop) == Some(b"%_") { + if p.get(stop - 2..stop) == Some(b"%_") { + stop -= 2; + } + if end.starts_with(b"%AI26") && p.get(stop - 2..stop) == Some(b"\r\n") { stop -= 2; } out.extend_from_slice(&p[at..start]); @@ -7354,18 +7380,508 @@ fn an_image_on_hidden_lines_does_not_come_in_beside_its_look() { assert_eq!(art[0].name.as_deref(), Some("Photo")); } -/// A linked image, an image with an opacity mask, and an image with a Warp and another effect are -/// written as their drawn art, with no art style. +/// A 64 × 64 RGB image, every pixel of it different, 128 pt square at (20, 10) in `doc`. +fn speckled_photo(doc: &mut Document) -> Node { + let px = image::RgbImage::from_fn(64, 64, |x, y| image::Rgb([(x * 4) as u8, (y * 4) as u8, ((x * 7 + y * 13) % 256) as u8])); + image_node(doc, ImageBlob::png(png_of(px.into())), (64, 64), Affine::new([2.0, 0.0, 0.0, 2.0, 20.0, 10.0]), None) +} + +/// The sizes `%%BeginData:` gives the images' samples in the program written from `doc`. +fn sample_sizes(doc: &Document) -> Vec { + let program = export_ai_editing(doc, &opts()).unwrap().program; + String::from_utf8_lossy(&program).lines().filter_map(|l| l.strip_prefix("%%BeginData: ")?.trim().parse().ok()).collect() +} + +/// The samples of a 64 × 64 RGB image, as `%%BeginData:` counts them (`XI` and CR LF too). +const SPECKLED_WHOLE: usize = 64 * 64 * 3 + 4; + +/// The pieces of an image cut into a raster mesh warp (as Object › Expand leaves a Warp or an +/// envelope on an image) are written as the image whole once, then each as the part of it that its +/// triangle shows: the file holds a little more than the image's pixels rather than a copy for every +/// piece, and it reads back drawing as it did. +#[test] +fn the_pieces_of_a_warped_image_are_written_as_the_parts_they_show() { + // GUARDS: each of a warped image's 200 pieces was written with all of the image's samples. + let doc = photo_doc(|d| { + let photo = speckled_photo(d); + let NodeKind::Image(im) = &photo.kind else { panic!("not an image") }; + let bend = |p: vectorcraft_geom::Point| vectorcraft_geom::Point::new(p.x, p.y + 12.0 * ((p.x - 20.0) / 128.0 * std::f64::consts::PI).sin()); + vectorcraft_doc::live::mesh_warp_image(&photo, im, &bend, 10, false, false) + }); + let sizes = sample_sizes(&doc); + assert_eq!(sizes.len(), 200, "{sizes:?}"); + assert_eq!(sizes[0], SPECKLED_WHOLE, "the first piece holds the whole image"); + // Each piece holds its cell (two triangles share one) and 2 pixels more around it. + let total: usize = sizes.iter().sum(); + assert!(total < 10 * SPECKLED_WHOLE, "{total} bytes of samples for an image of {SPECKLED_WHOLE}"); + let back = read_back(&doc); + let st = vectorcraft_testkit::raster::perceptual_diff( + &vectorcraft_testkit::raster::render_artboard(&doc), + &vectorcraft_testkit::raster::render_artboard(&back), + 8.0, + ); + assert!((st.bad_pixels as f64) < 0.005 * st.pixels as f64, "{} of {} pixels differ", st.bad_pixels, st.pixels); +} + +/// The pieces of a warped image that Preserve Shape Using Transparency cuts with opacity masks that +/// clip are written as the parts their masks show, in a group without knockout, and the file reads +/// back drawing as it did. +#[test] +fn masked_pieces_of_a_warped_image_are_written_as_the_parts_they_show() { + // GUARDS: each masked piece of a warped image was written with all of the image's samples. + // GUARDS: the pieces' knockout group read back with each piece hiding the pieces below it. + let doc = photo_doc(|d| { + let photo = speckled_photo(d); + let NodeKind::Image(im) = &photo.kind else { panic!("not an image") }; + let bend = |p: vectorcraft_geom::Point| vectorcraft_geom::Point::new(p.x, p.y + 12.0 * ((p.x - 20.0) / 128.0 * std::f64::consts::PI).sin()); + vectorcraft_doc::live::mesh_warp_image(&photo, im, &bend, 4, false, true) + }); + assert_eq!(doc.layers[0].children().unwrap()[0].knockout, vectorcraft_doc::Knockout::On); + let sizes = sample_sizes(&doc); + assert_eq!(sizes.len(), 32, "{sizes:?}"); + assert_eq!(sizes[0], SPECKLED_WHOLE, "the first piece holds the whole image"); + let total: usize = sizes.iter().sum(); + assert!(total < 6 * SPECKLED_WHOLE, "{total} bytes of samples for an image of {SPECKLED_WHOLE}"); + let back = read_back(&doc); + let st = vectorcraft_testkit::raster::perceptual_diff( + &vectorcraft_testkit::raster::render_artboard(&doc), + &vectorcraft_testkit::raster::render_artboard(&back), + 8.0, + ); + assert!((st.bad_pixels as f64) < 0.005 * st.pixels as f64, "{} of {} pixels differ", st.bad_pixels, st.pixels); +} + +/// The masked pieces of a warped image whose pixels are half transparent read back drawing as they +/// did, except where neighboring pieces overlap: there the image's alpha draws twice. +#[test] +fn masked_pieces_of_a_translucent_warped_image_read_back_but_for_their_overlaps() { + // GUARDS: the pieces' knockout group read back with each piece hiding the pieces below it + // (8,942 of 20,000 pixels differed). + let doc = photo_doc(|d| { + let px = image::RgbaImage::from_fn(64, 64, |x, y| image::Rgba([(x * 4) as u8, (y * 4) as u8, ((x * 7 + y * 13) % 256) as u8, 128])); + let photo = image_node(d, ImageBlob::png(png_of(px.into())), (64, 64), Affine::new([2.0, 0.0, 0.0, 2.0, 20.0, 10.0]), None); + let NodeKind::Image(im) = &photo.kind else { panic!("not an image") }; + let bend = |p: vectorcraft_geom::Point| vectorcraft_geom::Point::new(p.x, p.y + 12.0 * ((p.x - 20.0) / 128.0 * std::f64::consts::PI).sin()); + vectorcraft_doc::live::mesh_warp_image(&photo, im, &bend, 4, false, true) + }); + let back = read_back(&doc); + let st = vectorcraft_testkit::raster::perceptual_diff( + &vectorcraft_testkit::raster::render_artboard(&doc), + &vectorcraft_testkit::raster::render_artboard(&back), + 8.0, + ); + assert!((st.bad_pixels as f64) < 0.05 * st.pixels as f64, "{} of {} pixels differ", st.bad_pixels, st.pixels); +} + +/// An image with a live Warp keeps its pixels whole once, and its drawn look's pieces are each the +/// part of them they show: it reads back as the image with its Warp live. +#[test] +fn an_image_with_a_live_warp_writes_its_pixels_whole_once() { + // GUARDS: a live Warp's drawn look wrote all of the image's samples for each of its pieces. + let doc = photo_doc(|d| { + let mut photo = speckled_photo(d); + photo.appearance = Appearance { effects: vec![fx("warp.arc", serde_json::json!({"bend": 40.0}))], ..Appearance::default() }.into(); + photo + }); + let sizes = sample_sizes(&doc); + assert!(sizes.len() > 100, "{sizes:?}"); + assert_eq!(sizes.iter().filter(|s| **s == SPECKLED_WHOLE).count(), 1, "{sizes:?}"); + let total: usize = sizes.iter().sum(); + assert!(total < 10 * SPECKLED_WHOLE, "{total} bytes of samples for an image of {SPECKLED_WHOLE}"); + let back = read_back(&doc); + let art = back.layers[0].children().unwrap(); + assert_eq!(art.len(), 1, "{:#?}", lines(&back)); + assert!(matches!(art[0].kind, NodeKind::Image(_)), "{:?}", art[0].kind); + assert_eq!(art[0].appearance.effects.len(), 1, "{:?}", art[0].appearance); +} + +/// An image cut to a clipping path is written with all of its pixels when it is the first of them +/// written, so releasing the clipping path shows the whole image; a second copy cut to a small part +/// is written as that part, 2 pixels more on each side. +#[test] +fn a_clipped_image_written_first_keeps_all_of_its_pixels() { + let window = |d: &mut Document| { + let photo = speckled_photo(d); + let corner = clipping(d, shapes::rectangle(Rect::new(30.0, 20.0, 50.0, 40.0))); + group(d, vec![corner, photo], true) + }; + let doc = photo_doc(|d| { + let (a, b) = (window(d), window(d)); + group(d, vec![a, b], false) + }); + let sizes = sample_sizes(&doc); + assert_eq!(sizes.len(), 2, "{sizes:?}"); + assert_eq!(sizes[0], SPECKLED_WHOLE); + // The path shows 10 × 10 pixels. + assert_eq!(sizes[1], 14 * 14 * 3 + 4, "{sizes:?}"); + let back = read_back(&doc); + let st = vectorcraft_testkit::raster::perceptual_diff( + &vectorcraft_testkit::raster::render_artboard(&doc), + &vectorcraft_testkit::raster::render_artboard(&back), + 8.0, + ); + assert!((st.bad_pixels as f64) < 0.002 * st.pixels as f64, "{} of {} pixels differ", st.bad_pixels, st.pixels); +} + +/// The images in `n` and its members, each as its count of effects, its width and its height. +fn images_in(n: &Node, out: &mut Vec<(usize, u32, u32)>) { + if let NodeKind::Image(im) = &n.kind { + out.push((n.appearance.effects.len(), im.width, im.height)); + } + for c in n.children().into_iter().flatten() { + images_in(c, out); + } +} + +/// A copy of an image written whole already that its clipping path shows none of is written as one +/// pixel of it. +#[test] +fn a_copy_of_an_image_that_does_not_show_is_one_pixel() { + // GUARDS: a copy whose clipping path missed the image was written with all of its pixels. + let doc = photo_doc(|d| { + let photo = speckled_photo(d); + let corner = clipping(d, shapes::rectangle(Rect::new(30.0, 20.0, 50.0, 40.0))); + let first = group(d, vec![corner, photo], true); + let photo = speckled_photo(d); + let away = clipping(d, shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 5.0))); + let second = group(d, vec![away, photo], true); + group(d, vec![first, second], false) + }); + assert_eq!(sample_sizes(&doc), [SPECKLED_WHOLE, 3 + 4]); +} + +/// A 200 × 100 document of: the speckled image when `first`; a square whose opacity mask's art is +/// the image then six squares; the image in a small clipping group. +fn mask_art_then_clipped_photo(first: bool) -> Document { + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + if first { + let photo = speckled_photo(&mut doc); + doc.insert(Some(layer), usize::MAX, photo).unwrap(); + } + let mut masked = square(&mut doc, Rect::new(10.0, 10.0, 50.0, 50.0), Color::gray(0.5)); + // The image, then more objects than the clipping group after the mask holds. + let mut members = vec![speckled_photo(&mut doc)]; + for i in 0..6 { + let x = f64::from(i) * 10.0; + members.push(square(&mut doc, Rect::new(x, 0.0, x + 5.0, 5.0), Color::rgb(1.0, 1.0, 1.0))); + } + let art = group(&mut doc, members, false); + masked.extras_mut().mask = Some(Box::new(OpacityMask::new(art, false))); + doc.insert(Some(layer), usize::MAX, masked).unwrap(); + let photo = speckled_photo(&mut doc); + let corner = clipping(&mut doc, shapes::rectangle(Rect::new(30.0, 20.0, 50.0, 40.0))); + let clipped = group(&mut doc, vec![corner, photo], true); + doc.insert(Some(layer), usize::MAX, clipped).unwrap(); + doc +} + +/// For each object limit from none to all of `doc`'s objects: whether the mask is written, and the +/// sizes `%%BeginData:` gives the images' samples on `%_` lines (the mask's art) and on the others. +fn samples_within_each_limit(doc: &Document) -> Vec<(usize, bool, Vec, Vec)> { + let read = crate::import::objects_read(&export_ai_editing(doc, &opts()).unwrap().program).unwrap(); + (0..=read) + .map(|max| { + let text = String::from_utf8_lossy(&export_within(doc, &opts(), max).unwrap().program).replace("\r\n", "\n"); + let size = |l: &str| l.strip_prefix("%%BeginData: ")?.trim().parse::().ok(); + let hidden = text.lines().filter_map(|l| size(l.strip_prefix("%_")?)).collect(); + let shown = text.lines().filter_map(size).collect(); + (max, text.contains("(AI9_Mask)"), hidden, shown) + }) + .collect() +} + +/// An image whose whole copy was in art left out for the object limit (here an opacity mask's art) +/// is written whole again where it is next written, even cut to a small clipping path: the file +/// always holds all of its pixels once. +#[test] +fn an_image_whose_whole_copy_is_left_out_is_written_whole_again() { + // GUARDS: once the mask's art was left out, the clipped copy was written as the part it shows. + let mut left_out_with_copy = 0; + for (max, mask, hidden, shown) in samples_within_each_limit(&mask_art_then_clipped_photo(false)) { + if hidden.is_empty() && shown.is_empty() { + continue; + } + assert!(hidden.contains(&SPECKLED_WHOLE) || shown.contains(&SPECKLED_WHOLE), "room for {max}: {hidden:?} {shown:?}"); + left_out_with_copy += usize::from(!mask); + } + assert!(left_out_with_copy > 0, "no room left the mask out and kept the clipped copy"); +} + +/// An image written whole, then whole again in an opacity mask's art left out for the object limit, +/// is not written whole a third time: the first copy is kept, and the clipped copy after the mask is +/// the part it shows. +#[test] +fn an_image_written_whole_before_art_left_out_stays_written_whole() { + // GUARDS: the mask's copy took the first copy's place, so giving it back wrote the clipped copy whole. + let mut left_out = 0; + for (max, mask, _, shown) in samples_within_each_limit(&mask_art_then_clipped_photo(true)) { + assert!(shown.iter().filter(|s| **s == SPECKLED_WHOLE).count() <= 1, "room for {max}: {shown:?}"); + left_out += usize::from(!mask && shown.len() == 2); + } + assert!(left_out > 0, "no room left the mask out and kept both copies"); +} + +/// An image with a live Warp in a small clipping group keeps all of its pixels: its drawn look is +/// written first, and neither the look nor the image itself is cut to the clipping path, so it +/// reads back with its Warp live and every pixel it had. +#[test] +fn a_clipped_image_with_a_live_warp_keeps_all_of_its_pixels() { + // GUARDS: the image under a live Warp was cut to the clipping path around it. + let doc = photo_doc(|d| { + let mut photo = speckled_photo(d); + photo.appearance = Appearance { effects: vec![fx("warp.arc", serde_json::json!({"bend": 40.0}))], ..Appearance::default() }.into(); + let corner = clipping(d, shapes::rectangle(Rect::new(30.0, 20.0, 60.0, 50.0))); + group(d, vec![corner, photo], true) + }); + let sizes = sample_sizes(&doc); + assert_eq!(sizes.iter().filter(|s| **s == SPECKLED_WHOLE).count(), 1, "the look's first piece: {sizes:?}"); + let total: usize = sizes.iter().sum(); + assert!(total < 10 * SPECKLED_WHOLE, "{total} bytes of samples for an image of {SPECKLED_WHOLE}"); + // The image itself, on `%_` lines. + let program = export_ai_editing(&doc, &opts()).unwrap().program; + let hidden: Vec = + String::from_utf8_lossy(&program).lines().filter_map(|l| l.strip_prefix("%_%%BeginData: ")?.trim().parse().ok()).collect(); + assert_eq!(hidden, [SPECKLED_WHOLE]); + let back = read_back(&doc); + let mut images = vec![]; + for n in back.layers[0].children().unwrap() { + images_in(n, &mut images); + } + assert_eq!(images, [(1, 64, 64)], "{:#?}", lines(&back)); +} + +/// An image cut by an opacity mask whose art has an effect that paints past its path keeps the +/// pixels the effect shows: a copy of an image written whole already is cut to all that its mask +/// paints. +#[test] +fn a_masked_image_keeps_the_pixels_its_mask_effects_show() { + // GUARDS: the copy was cut to the mask art's path, short of what its Offset Path paints. + let doc = photo_doc(|d| { + let photo = speckled_photo(d); + let corner = clipping(d, shapes::rectangle(Rect::new(20.0, 10.0, 24.0, 14.0))); + let first = group(d, vec![corner, photo], true); + let mut masked = speckled_photo(d); + let mut ap = Appearance::basic(solid(Color::WHITE), Paint::None, 0.0); + ap.effects = vec![fx("path.offsetPath", serde_json::json!({"offset": 30.0}))]; + let art = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(70.0, 40.0, 80.0, 50.0)), ap); + masked.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(art), clip: true, invert: false, disabled: false, linked: true })); + group(d, vec![first, masked], false) + }); + let sizes = sample_sizes(&doc); + assert_eq!(sizes.len(), 2, "{sizes:?}"); + assert_eq!(sizes[0], SPECKLED_WHOLE); + // The offset art covers (40, 10) to (110, 80): 35 × 35 pixels of the image. + assert!(sizes[1] >= 35 * 35 * 3, "{sizes:?}"); +} + +/// The speckled image with an opacity mask that clips it to six small white squares in its corner. +fn photo_masked_to_its_corner(doc: &mut Document) -> Node { + let mut masked = speckled_photo(doc); + let squares = (0..6).map(|i| square(doc, Rect::new(20.0 + f64::from(i) * 5.0, 10.0, 23.0 + f64::from(i) * 5.0, 20.0), Color::WHITE)).collect(); + let art = group(doc, squares, false); + masked.extras_mut().mask = Some(Box::new(OpacityMask { art: Arc::new(art), clip: true, invert: false, disabled: false, linked: true })); + masked +} + +/// A copy of an image written whole already whose opacity mask is left out for the object limit is +/// written whole: without the mask, it shows all of its pixels. +#[test] +fn a_masked_copy_whose_mask_is_left_out_keeps_all_of_its_pixels() { + // GUARDS: the copy was cut to its mask, and the mask then left out, so it read back cropped. + let doc = photo_doc(|d| { + let photo = speckled_photo(d); + let masked = photo_masked_to_its_corner(d); + group(d, vec![photo, masked], false) + }); + let (mut left_out, mut kept) = (0, 0); + for (max, mask, _, shown) in samples_within_each_limit(&doc) { + if shown.len() < 2 { + continue; + } + if mask { + assert!(shown[1] < SPECKLED_WHOLE, "room for {max}: {shown:?}"); + kept += 1; + } else { + assert_eq!(shown, [SPECKLED_WHOLE, SPECKLED_WHOLE], "room for {max}"); + left_out += 1; + } + } + assert!(left_out > 0 && kept > 0, "{left_out} limits left the mask out, {kept} kept it"); +} + +/// A copy of an image written whole already whose opacity mask is nested too deep to be written is +/// written whole. +#[test] +fn a_masked_copy_nested_too_deep_for_its_mask_keeps_all_of_its_pixels() { + // GUARDS: the copy was cut to its mask, and the mask then left out for its depth. + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + let photo = speckled_photo(&mut doc); + doc.insert(Some(layer), usize::MAX, photo).unwrap(); + // Isolated instances are written as their art, each a level deeper: the masked copy is at the limit. + let art = photo_masked_to_its_corner(&mut doc); + doc.symbols.push(Symbol { dynamic: false, name: "S0".into(), art: Arc::new(art) }); + for i in 1..writer::MAX_NEST { + let mut inner = instance(&mut doc, &format!("S{}", i - 1), Affine::IDENTITY); + inner.isolate = true; + doc.symbols.push(Symbol { dynamic: false, name: format!("S{i}"), art: Arc::new(inner) }); + } + let mut outer = instance(&mut doc, &format!("S{}", writer::MAX_NEST - 1), Affine::IDENTITY); + outer.isolate = true; + doc.insert(Some(layer), usize::MAX, outer).unwrap(); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(out.warnings.iter().any(|w| w == writer::DEEP_MASKS), "{:?}", out.warnings); + // The symbols' definitions hold copies too: each copy written with its mask is the part the + // mask shows, and each copy whose mask is left out is whole. + let sizes = sample_sizes(&doc); + let whole = sizes.iter().filter(|s| **s == SPECKLED_WHOLE).count(); + let masks = String::from_utf8_lossy(&out.program).matches("(AI9_Mask)").count(); + assert_eq!(sizes.len() - whole, masks, "{sizes:?}"); + assert!(whole >= 2, "the first copy and a copy whose mask is left out: {sizes:?}"); +} + +/// [`warped_photo`] linked to `/Users/someone/Job/art/photo.png`, in folder `art` next to the +/// document's. +fn linked_warped_photo(doc: &mut Document, effects: Vec) -> Node { + let mut n = warped_photo(doc, effects); + if let NodeKind::Image(im) = &mut n.kind { + let mut link = vectorcraft_doc::LinkInfo::new("/Users/someone/Job/art/photo.png"); + link.relative = Some("art/photo.png".into()); + im.link = Some(link); + } + n +} + +/// A linked image with one Warp is written with an art style of that Warp, its bent pieces as its +/// drawn look and the image itself as a placed file on `%_` lines, with its path, folder and +/// preview: it reads back as the linked image, its pixels, placement, name, opacity and link as +/// they were, with its Warp live and its settings kept. +#[test] +fn a_linked_image_with_a_warp_reads_back_linked_with_its_warp_live() { + // GUARDS: a linked image with a Warp was written as its drawn pieces alone, and read back + // without its Warp or its link. + let params = serde_json::json!({"bend": 40.0}); + let doc = photo_doc(|d| linked_warped_photo(d, vec![fx("warp.arc", params.clone())])); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(out.warnings.is_empty(), "{:?}", out.warnings); + let text = program_shown(&doc); + assert!(text.contains("\n%_%AI5_BeginPlace\n"), "{text}"); + assert!(text.contains("\n%_(/Users/someone/Job/art/photo.png)`\n"), "{text}"); + assert!(text.contains("\n%_(art/)\n"), "{text}"); + assert!(text.contains("\n%_8 8 32 32 17 <256 bytes>\n"), "{text}"); + assert!(text.contains("\n%_%AI5_EndPlace\n") && text.contains("\n1 (Anon 1) XW\n"), "{text}"); + assert!(!text.contains("BeginRaster\n%_"), "no embedded copy: {text}"); + let back = read_back(&doc); + let art = back.layers[0].children().unwrap(); + assert_eq!(art.len(), 1, "{:#?}", lines(&back)); + let (mut want, mut got) = (vec![], vec![]); + pictures(&doc, doc.layers[0].children().unwrap(), "", &mut want); + pictures(&back, art, "", &mut got); + assert_eq!(got, want); + let [warp] = art[0].appearance.effects.as_slice() else { panic!("{:?}", art[0].appearance) }; + assert_eq!(warp.id, "warp.arc"); + let (w, g) = (vectorcraft_effects::merged_params("warp.arc", ¶ms), vectorcraft_effects::merged_params(&warp.id, &warp.params)); + for key in ["bend", "horizontal", "vertical"] { + assert!((g[key].as_f64().unwrap() - w[key].as_f64().unwrap()).abs() < 6e-3, "{key}: {g} for {w}"); + } +} + +/// A linked image with one Warp larger than a placed file's preview: its copy's preview and its drawn +/// look's pieces (placed files of the same image) hold the same smaller preview, so fine detail +/// reads back with the Warp live, the link kept and the preview's pixels, as a linked image without +/// a Warp does. +#[test] +fn a_large_linked_image_with_a_warp_reads_back_from_its_preview() { + // GUARDS: a linked image with a Warp was written as its drawn pieces alone. + let mut doc = Document::new(200.0, 100.0); + let layer = doc.layers[0].id; + let checks = + image::RgbaImage::from_fn(600, 300, |x, y| if (x + y) % 2 == 0 { image::Rgba([255, 0, 0, 255]) } else { image::Rgba([0, 0, 255, 255]) }); + let mut link = vectorcraft_doc::LinkInfo::new("/Users/someone/Job/art/checks.png"); + link.relative = Some("art/checks.png".into()); + let xf = Affine::new([0.25, 0.0, 0.0, 0.25, 20.0, 10.0]); + let mut n = image_node(&mut doc, ImageBlob::png(png_of(checks.into())), (600, 300), xf, Some(link)); + n.appearance = Appearance { effects: vec![fx("warp.arc", serde_json::json!({"bend": 40.0}))], ..Appearance::default() }.into(); + doc.insert(Some(layer), usize::MAX, n).unwrap(); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(out.warnings.is_empty(), "{:?}", out.warnings); + let text = program_shown(&doc); + assert!(text.contains("\n%_256 128 1024 32 17 <131072 bytes>\n"), "the copy's preview"); + assert!(text.contains("\n256 128 1024 32 17 <131072 bytes>\n"), "the look's pieces' previews"); + let back = read_back(&doc); + let art = back.layers[0].children().unwrap(); + assert_eq!(art.len(), 1, "{:#?}", lines(&back)); + let NodeKind::Image(im) = &art[0].kind else { panic!("{:?}", art[0].kind) }; + assert_eq!((im.width, im.height), (256, 128)); + assert_eq!( + im.link.as_ref().map(|l| (l.path.as_str(), l.relative.as_deref())), + Some(("/Users/someone/Job/art/checks.png", Some("art/checks.png"))) + ); + assert_eq!(art[0].appearance.effects.iter().map(|e| e.id.as_str()).collect::>(), ["warp.arc"]); +} + +/// A hidden or locked image with one Warp, embedded or linked, keeps its state, its link and its +/// live Warp. +#[test] +fn a_hidden_or_locked_image_with_a_warp_keeps_its_state() { + // GUARDS: a linked image with a Warp was written as its drawn pieces alone, and a hidden image's + // Warp was compared with a look that drew nothing, so it came in as its drawn pieces. + for (what, make) in [("embedded", warped_photo as fn(&mut Document, Vec) -> Node), ("linked", linked_warped_photo)] { + for (shown, locked) in [(true, true), (false, false), (false, true)] { + let doc = photo_doc(|d| { + let mut n = make(d, vec![fx("warp.arc", serde_json::json!({"bend": 40.0}))]); + (n.visible, n.locked) = (shown, locked); + n + }); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(out.warnings.is_empty(), "{what} {shown} {locked}: {:?}", out.warnings); + let back = read_back(&doc); + let art = back.layers[0].children().unwrap(); + assert_eq!(art.len(), 1, "{what} {shown} {locked}: {:#?}", lines(&back)); + assert_eq!(images_of(&back).len(), 1, "{what} {shown} {locked}"); + assert_eq!(images_of(&back), images_of(&doc), "{what} {shown} {locked}"); + assert_eq!(art[0].appearance.effects.iter().map(|e| e.id.as_str()).collect::>(), ["warp.arc"]); + } + } +} + +/// A linked image with one Warp in an opacity mask's art keeps its live Warp; its copy on `%_` lines +/// is embedded, as linked images in masks are, with that warning. +#[test] +fn a_linked_image_with_a_warp_in_a_mask_is_embedded_with_its_warp_live() { + // GUARDS: the placed file of a styled image written in an opacity mask's art. + let doc = photo_doc(|d| { + let art = linked_warped_photo(d, vec![fx("warp.arc", serde_json::json!({"bend": 40.0}))]); + let mut square = + Node::path(d.alloc_id(), shapes::rectangle(Rect::new(20.0, 10.0, 100.0, 90.0)), Appearance::basic(solid(Color::BLACK), Paint::None, 0.0)); + square.extras_mut().mask = Some(Box::new(OpacityMask::new(art, false))); + square + }); + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert_eq!(out.warnings, [writer::LINKS_EMBEDDED]); + let text = program_shown(&doc); + assert!(!text.contains("BeginPlace") && text.contains("1 (Anon 1) XW"), "{text}"); + let back = read_back(&doc); + let mask = back.layers[0].children().unwrap()[0].extras().mask.as_ref().map(|m| m.art.clone()).expect("the mask"); + let NodeKind::Image(im) = &mask.kind else { panic!("{:?}", mask.kind) }; + assert!(im.link.is_none()); + assert_eq!(mask.appearance.effects.iter().map(|e| e.id.as_str()).collect::>(), ["warp.arc"]); +} + +/// An image with an opacity mask and an image with a Warp and another effect are written as their +/// drawn art, with no art style, linked or embedded. #[test] fn other_warped_images_are_written_as_their_drawn_art() { let arc = || fx("warp.arc", serde_json::json!({"bend": 40.0})); - let linked = photo_doc(|d| { - let mut n = warped_photo(d, vec![arc()]); - if let NodeKind::Image(im) = &mut n.kind { - im.link = Some(vectorcraft_doc::LinkInfo::new("/art/photo.png")); - } + let linked_masked = photo_doc(|d| { + let mut n = linked_warped_photo(d, vec![arc()]); + let white = + Node::path(d.alloc_id(), shapes::rectangle(Rect::new(20.0, 10.0, 100.0, 90.0)), Appearance::basic(solid(Color::WHITE), Paint::None, 0.0)); + n.extras_mut().mask = Some(Box::new(OpacityMask::new(white, false))); n }); + let linked_stacked = photo_doc(|d| linked_warped_photo(d, vec![arc(), fx("stylize.feather", serde_json::json!({"radius": 2.0}))])); let masked = photo_doc(|d| { let mut n = warped_photo(d, vec![arc()]); let white = @@ -7374,7 +7890,7 @@ fn other_warped_images_are_written_as_their_drawn_art() { n }); let stacked = photo_doc(|d| warped_photo(d, vec![arc(), fx("stylize.feather", serde_json::json!({"radius": 2.0}))])); - for (what, doc) in [("linked", linked), ("masked", masked), ("stacked", stacked)] { + for (what, doc) in [("linked masked", linked_masked), ("linked stacked", linked_stacked), ("masked", masked), ("stacked", stacked)] { assert!(!program_shown(&doc).contains("1 (Anon"), "{what}"); let back = read_back(&doc); let art = back.layers[0].children().unwrap(); @@ -8188,7 +8704,7 @@ impl ArtBrushOptions { /// A path with the Calligraphic brush, and one with an Art brush in Tints whose art bends along the /// path, come back as those paths with the brush on their stroke at its weight, not as their drawn -/// look; a path with the Art brush that keeps its art's colors comes back as its drawn look. +/// look; so does a path with the Art brush that keeps its art's colors. #[test] fn brushed_paths_are_read_back_brushed() { let mut doc = brushes_document(); @@ -8208,8 +8724,63 @@ fn brushed_paths_are_read_back_brushed() { assert_eq!(art[1].path_data(), ours[1].path_data()); brushed(&mut doc, "Plain ribbon", (20.0, 180.0), (280.0, 180.0), 1.0); let out = export_ai_editing(&doc, &opts()).unwrap(); - assert!(out.warnings.iter().any(|w| w == writer::STROKES), "{:?}", out.warnings); - assert!(matches!(read_back(&doc).layers[0].children().unwrap()[2].kind, NodeKind::Group { .. })); + assert!(!out.warnings.iter().any(|w| w == writer::STROKES), "{:?}", out.warnings); + let back = read_back(&doc); + let n = &back.layers[0].children().unwrap()[2]; + assert!(matches!(n.kind, NodeKind::Path { .. }), "{n:#?}"); + assert_eq!(n.appearance.stroke().and_then(|s| s.brush.as_deref()), Some("Plain ribbon")); +} + +/// Art brushes at another width, flipped along or across, scaled proportionately or stretched +/// between guides (flipped along too, or at guides the written numbers round) are written with those +/// options, and a path with each comes back as the path with the brush on its stroke, except Scale +/// Proportionately's, which is written as its brush's art. +#[test] +fn art_brushes_with_options_are_read_back_with_them() { + use vectorcraft_brush::{ArtBrush, ArtScale, Brush, BrushKind}; + let thirds = ArtScale::BetweenGuides { start: 1.0 / 3.0, end: 2.0 / 3.0 }; + let options: Vec<(&str, ArtBrush)> = vec![ + ("Wide", ArtBrush { width: 250.0, ..ArtBrush::default() }), + ("Along", ArtBrush { flip_along: true, ..ArtBrush::default() }), + ("Across", ArtBrush { flip_across: true, ..ArtBrush::default() }), + ("Proportional", ArtBrush { scale: ArtScale::Proportional, width: 50.0, ..ArtBrush::default() }), + ("Guides", ArtBrush { scale: ArtScale::BetweenGuides { start: 0.25, end: 0.5 }, ..ArtBrush::default() }), + ("Guides along", ArtBrush { scale: ArtScale::BetweenGuides { start: 0.25, end: 0.5 }, flip_along: true, ..ArtBrush::default() }), + ("Thirds", ArtBrush { scale: thirds, flip_along: true, ..ArtBrush::default() }), + ]; + let lib: Vec = options + .iter() + .map(|(name, a)| Brush { name: (*name).into(), kind: BrushKind::Art(ArtBrush { art: brush_art_node(), ..a.clone() }) }) + .collect(); + let mut doc = Document::new(300.0, 200.0); + vectorcraft_brush::store(&mut doc, &lib); + for (i, b) in lib.iter().enumerate() { + let y = 20.0 + 25.0 * i as f64; + brushed(&mut doc, &b.name, (20.0, y), (280.0, y), 1.0); + } + let out = export_ai_editing(&doc, &opts()).unwrap(); + assert!(!out.warnings.iter().any(|w| w == writer::BRUSHES), "{:?}", out.warnings); + let back = read_back(&doc); + let got = vectorcraft_brush::library(&back); + assert_eq!(got.len(), lib.len()); + for (g, w) in got.iter().zip(&lib) { + let (BrushKind::Art(g), BrushKind::Art(w)) = (&g.kind, &w.kind) else { panic!("art") }; + if w.scale == thirds { + let ArtScale::BetweenGuides { start, end } = g.scale else { panic!("guides: {g:?}") }; + assert!((start - 1.0 / 3.0).abs() < 1e-6 && (end - 2.0 / 3.0).abs() < 1e-6, "{g:?}"); + assert_eq!(ArtBrushOptions::of(&ArtBrush { scale: thirds, ..g.clone() }), ArtBrushOptions::of(w)); + } else { + assert_eq!(ArtBrushOptions::of(g), ArtBrushOptions::of(w)); + } + } + for (n, b) in back.layers[0].children().unwrap().iter().zip(&lib) { + if b.name == "Proportional" { + assert!(matches!(n.kind, NodeKind::Group { .. }), "{}: the brush's art: {n:#?}", b.name); + continue; + } + assert!(matches!(n.kind, NodeKind::Path { .. }), "{}: {n:#?}", b.name); + assert_eq!(n.appearance.stroke().and_then(|s| s.brush.as_deref()), Some(b.name.as_str())); + } } /// A compound path with the Calligraphic brush comes back as that compound path with the brush on its @@ -8513,8 +9084,8 @@ fn brushes_write_the_same_bytes_again() { /// beside a brush that comes back, and each changed from a brush that comes back by the one setting /// that leaves it out: an Art brush whose art is a group with a fill of its own, a Scatter brush whose /// art is a path without points, an Art brush whose art is a group without members, Pattern and Bristle -/// brushes, Art brushes flipped along or across, overlapping, at another width, with a width that -/// varies, in another direction or scale, Art and Scatter brushes in Tints and Shades or Hue Shift, a +/// brushes, Art brushes overlapping, with a width that varies, in another direction or with guides +/// that leave no art between them, Art and Scatter brushes in Tints and Shades or Hue Shift, a /// brush whose name holds a slash and a second brush of a name. A brush left out doesn't take its /// name from a later one. #[test] @@ -8538,13 +9109,10 @@ fn brushes_the_reader_cant_read_are_left_out() { ("empty group", art_with(&|a| a.art = Node::group(vectorcraft_doc::NodeId(1), vec![]))), ("pattern", BrushKind::Pattern(PatternBrush::default())), ("bristle", BrushKind::Bristle(Bristle::default())), - ("flipped along", art_with(&|a| a.flip_along = true)), - ("flipped across", art_with(&|a| a.flip_across = true)), ("overlap", art_with(&|a| a.overlap = true)), - ("width", art_with(&|a| a.width = 50.0)), ("width varies", art_with(&|a| a.width_mode = Some(Variation::Pressure))), ("direction", art_with(&|a| a.direction = Direction::RightToLeft)), - ("proportional", art_with(&|a| a.scale = ArtScale::Proportional)), + ("guides with no art between them", art_with(&|a| a.scale = ArtScale::BetweenGuides { start: 0.5, end: 0.5 })), ("art tints and shades", art_with(&|a| a.colorization = Colorization::TintsAndShades)), ("art hue shift", art_with(&|a| a.colorization = hue)), ( @@ -8754,8 +9322,8 @@ fn an_empty_brushes_panel_comes_back_empty() { } /// A path with one of a new document's brushes writes the brushes the reader reads, and keeps its -/// brush. The new document's Art brush with other options, its Pattern brushes and its Bristle -/// brushes are left out with a warning, so the file opens without them. +/// brush. The new document's Pattern brushes and its Bristle brushes are left out with a warning, +/// so the file opens without them. #[test] fn a_new_documents_brush_on_a_path_writes_the_brushes() { let mut doc = Document::new(300.0, 200.0); @@ -8765,7 +9333,7 @@ fn a_new_documents_brush_on_a_path_writes_the_brushes() { let back = read_back(&doc); let n = &back.layers[0].children().unwrap()[0]; assert_eq!(n.appearance.stroke().and_then(|s| s.brush.as_deref()), Some("3 pt. Round")); - let left_out = ["Arrow", "Chain", "Stitches", "Diamonds", "Bristle Round", "Bristle Flat Fan"]; + let left_out = ["Chain", "Stitches", "Diamonds", "Bristle Round", "Bristle Flat Fan"]; let want: Vec<&str> = vectorcraft_brush::defaults().iter().map(|b| b.name.as_str()).filter(|n| !left_out.contains(n)).collect(); let lib = vectorcraft_brush::library(&back); assert_eq!(lib.iter().map(|b| b.name.as_str()).collect::>(), want); @@ -10017,14 +10585,15 @@ fn text_wrap_options_of_type_and_envelopes_are_read_back() { } /// A clipping path inside art cut to a clipping object is written as its fills and its strokes, -/// two objects: its text wrap options are written once, whether it has both or only strokes. +/// two objects: its text wrap options are written once, whether it has both or only strokes, and +/// with its strokes when the region outside leaves nothing of its fills. #[test] fn a_clipping_path_written_as_its_paint_keeps_one_text_wrap() { - for fill in [solid(Color::gray(0.5)), Paint::None] { + for (fill, left, width) in [(solid(Color::gray(0.5)), 20.0, 2.0), (Paint::None, 20.0, 2.0), (solid(Color::gray(0.5)), 101.0, 4.0)] { let mut doc = Document::new(200.0, 100.0); let layer = doc.layers[0].id; - let mut cutter = clipping(&mut doc, shapes::rectangle(Rect::new(20.0, 20.0, 80.0, 80.0))); - cutter.appearance = Appearance::basic(fill, solid(Color::BLACK), 2.0).into(); + let mut cutter = clipping(&mut doc, shapes::rectangle(Rect::new(left, 20.0, left + 60.0, 80.0))); + cutter.appearance = Appearance::basic(fill, solid(Color::BLACK), width).into(); let cutter = wrapped(cutter, 5.0, true); let member = square(&mut doc, Rect::new(30.0, 30.0, 120.0, 60.0), Color::rgb(1.0, 0.0, 0.0)); let inner = group(&mut doc, vec![cutter, member], true); diff --git a/crates/eps/src/ai_editing/writer.rs b/crates/eps/src/ai_editing/writer.rs index 879eb9d9f5..6361efe5ff 100644 --- a/crates/eps/src/ai_editing/writer.rs +++ b/crates/eps/src/ai_editing/writer.rs @@ -206,6 +206,9 @@ pub(super) struct Writer<'a> { mask_level: Option<(u32, u32)>, /// The image just written was written as a placed file. placed: bool, + /// The image being written is the copy of a styled object on the layers, on `%_` lines: linked, + /// it is written as a placed file there ([`Self::styled_object`]). + styled_copy: bool, /// The type just written was written as type, not as its outlines. typed: bool, /// The objects bound to variables so far, in the order they are written: each one's id, its XML @@ -278,6 +281,17 @@ pub(super) struct Writer<'a> { /// How many more envelopes may be written live: as many as the reader checks in one file /// ([`crate::import::ENVELOPE_CHECKS`]). envelopes_left: usize, + /// The image read last and its pixels ([`images::Samples::of`], `None` when they can't be + /// read): the pieces of a warped image, which follow one another, read them once. + last_samples: Option<(vectorcraft_doc::ImageBlob, Option)>, + /// The images written whole so far, by the address of their data (which each entry keeps), each + /// with the index of its samples in [`Self::payloads`]. + whole_images: HashMap>, usize)>, + /// The outlines of the clipping groups the art being written is in, in the document (empty in + /// a definition, an opacity mask's art and a brush's art, which are written apart from them). + shown: Vec, + /// The copy of an image that the last [`Self::image`] wrote as a window, when it did. + windowed: Option, } impl<'a> Writer<'a> { @@ -299,6 +313,7 @@ impl<'a> Writer<'a> { hidden: 0, mask_level: None, placed: false, + styled_copy: false, typed: false, bound: vec![], texts: texts::TextDoc::default(), @@ -344,6 +359,10 @@ impl<'a> Writer<'a> { definition_objects: 0, definition_symbol_nodes: 0, max_objects: crate::import::MAX_EDITING_OBJECTS, + last_samples: None, + whole_images: HashMap::new(), + shown: vec![], + windowed: None, } } @@ -410,15 +429,21 @@ impl<'a> Writer<'a> { /// Art written since `c` as `lines` is not used: the objects and symbol art charged since are /// given back, except those of the definitions written since, and the images `lines` marks - /// are emptied (the others keep their indices). + /// are emptied (the others keep their indices). An image whose whole copy is among them is no + /// longer written whole ([`Self::whole_images`]). fn give_back(&mut self, c: Charges, lines: &str) { self.objects = c.objects + (self.definition_objects - c.kept_objects); self.symbol_nodes = c.symbol_nodes + (self.definition_symbol_nodes - c.kept_symbol_nodes); + let mut emptied = HashSet::new(); for index in lines.split(PAYLOAD).skip(1).step_by(2) { - if let Some(p) = index.parse::().ok().and_then(|i| self.payloads.get_mut(i)) { + if let Some((i, p)) = index.parse::().ok().and_then(|i| Some((i, self.payloads.get_mut(i)?))) { *p = Vec::new(); + emptied.insert(i); } } + if !emptied.is_empty() { + self.whole_images.retain(|_, (_, i)| !emptied.contains(i)); + } } /// Whether the art of a symbol, `art`, may be written: the objects of the symbol art written @@ -639,8 +664,17 @@ impl<'a> Writer<'a> { } self.effects(n); self.state(n.locked, !n.visible); - let xy = Xy::of(n); + let mut xy = Xy::of(n); + if masked_warp_pieces(n) { + // The reader gives the pieces no mark, and a knockout group's member then knocks out + // what it paints without its opacity mask: each piece would hide the pieces below it. + // Without knockout, a partly transparent image draws its alpha twice only where the + // pieces overlap. + xy.knockout = Knockout::Off; + } let start = self.body.len(); + // An image's copy written as the part that its opacity mask, among other regions, shows. + let mut mask_window = None; match &n.kind { NodeKind::Layer { .. } => {} NodeKind::Group { children, clip: true } => self.clip_group(children, xy), @@ -667,7 +701,25 @@ impl<'a> Writer<'a> { } NodeKind::Compound { rule, .. } => self.shape(n, &compound_path(n), *rule, xy), NodeKind::Text(_) => self.text(n, xy), - NodeKind::Image(im) => self.image(&self.doc.shown_image(n, im), xy), + NodeKind::Image(im) => { + // An opacity mask that clips shows the image within what its art paints only (its + // effects and its symbol instances' art included, as the renderer measures it). + let masked = n + .extras() + .mask + .as_ref() + .filter(|m| m.clip && !m.invert && !m.disabled && self.nest < MAX_NEST) + .and_then(|m| vectorcraft_render::painted_bounds(self.doc, &m.art)); + if let Some(b) = masked { + self.shown.push(b.to_path(0.1)); + } + self.windowed = None; + self.image(&self.doc.shown_image(n, im), xy); + if masked.is_some() { + self.shown.pop(); + mask_window = self.windowed.take(); + } + } NodeKind::SymbolInstance { symbol, xf } if self.live_instance_in_room(n, symbol, *xf) => self.symbol_instance(symbol, *xf, xy), NodeKind::SymbolInstance { symbol, xf } => { if !self.open_group("u") { @@ -733,10 +785,14 @@ impl<'a> Writer<'a> { // A group's dictionary goes between its end and its state block. let block = (self.block_end == self.body.len() && self.block_start >= start).then(|| self.body.split_off(self.block_start)); self.block_end = usize::MAX; - self.dictionary(n); + let mask_written = self.dictionary(n); if let Some(b) = block { self.body.push_str(&b); } + // Without its opacity mask, the image shows whole. + if let Some(w) = mask_window.filter(|_| !mask_written) { + self.write_whole(w); + } } // An envelope's plugin `XP` follows its distorted art, after the art's state block. if deform { @@ -769,25 +825,28 @@ impl<'a> Writer<'a> { /// is bound to variables ([`Self::bound_variables`]; without a name, it gets an XML id and an /// empty `AIArtName`), has text wrap options ([`Self::text_wrap`]), has an opacity mask /// (`AI9_Mask`, see [`Self::mask`]), or is a symbol's art (its symbol's entries first, see - /// [`Self::define_symbol`]). - fn dictionary(&mut self, n: &Node) { + /// [`Self::define_symbol`]). False when `n` has an opacity mask that is left out: nested too + /// deep, or its art doesn't fit. + fn dictionary(&mut self, n: &Node) -> bool { let name = n.name.as_deref().filter(|s| !s.is_empty()); let wrap = n.extras().wrap.filter(|_| self.drawn == 0 && !self.in_look); let placed = std::mem::take(&mut self.placed); let typed = std::mem::take(&mut self.typed); let bound = self.bound_variables(n, placed, typed); let mut mask = n.extras().mask.as_deref(); + let mut mask_written = true; // Masks nested too deep are left out (an empty mask would hide the object). if mask.is_some() && self.nest >= MAX_NEST { self.warn(DEEP_MASKS); mask = None; + mask_written = false; } let entries = match &self.root_entries { Some((id, _)) if *id == n.id => self.root_entries.take().map(|(_, e)| e), _ => None, }; if name.is_none() && mask.is_none() && bound.is_empty() && entries.is_none() && wrap.is_none() { - return; + return mask_written; } let start = self.body.len(); let has_id = name.is_some() || !bound.is_empty(); @@ -813,13 +872,15 @@ impl<'a> Writer<'a> { // A mask whose art doesn't fit is left out, and with nothing else in it the dictionary too. if let Some(m) = mask && !self.mask(m) - && !has_id - && !has_entries - && wrap.is_none() { - return self.body.truncate(start); + if !has_id && !has_entries && wrap.is_none() { + self.body.truncate(start); + return false; + } + mask_written = false; } self.body.push_str("%_;\n%_\n"); + mask_written } /// Text wrap options, as entries of their object's dictionary: the offset in art space's points @@ -862,6 +923,7 @@ impl<'a> Writer<'a> { fn mask(&mut self, m: &OpacityMask) -> bool { let outer = std::mem::take(&mut self.body); let (state, gs, clip) = (self.state, self.gs, self.clip.take()); + let shown_by = std::mem::take(&mut self.shown); let (charges, bound) = (self.charges(), self.bound.len()); (self.state, self.gs) = (Some((false, false)), Some(Xy::OPAQUE)); // The canvas draws the art's root even when it is hidden, and the reader puts a hidden object @@ -901,6 +963,7 @@ impl<'a> Writer<'a> { self.hidden -= 1; self.nest -= 1; let lines = std::mem::replace(&mut self.body, outer); + self.shown = shown_by; if self.left_out_since(charges) { // The art isn't written, nor are the variable bindings of its objects. self.give_back(charges, &lines); @@ -986,9 +1049,11 @@ impl<'a> Writer<'a> { } } self.clip_paint_part(first, &path, rule, &fills); + self.shown.push(path.to_bezpath()); for c in rest { self.node(c); } + self.shown.pop(); self.clip_paint_part(first, &path, rule, &strokes); self.state(first.locked, !first.visible); let start = self.body.len(); @@ -1037,22 +1102,25 @@ impl<'a> Writer<'a> { /// A container's members, the first one's outline cutting the others: its fills painted /// behind them (cut to the region outside too), its strokes over them, not cut by it. Its text - /// wrap options are written once: with its fills, or without fills with its strokes. + /// wrap options are written once: with its fills, or with its strokes when no fill object is + /// written (it has no fills, or the region outside leaves nothing of them). fn clip_contents(&mut self, children: &[Arc]) { let Some((first, rest)) = children.split_first() else { return }; // Nothing to clip by hides the clipped art. let Some((outline, rule)) = vectorcraft_effects::clip_outline(first) else { return }; let mut paint = first.clip_paint(); - if let (Some(_), Some(stroke)) = (&paint.fill, &mut paint.stroke) - && stroke.extras().wrap.is_some() - { - stroke.extras_mut().wrap = None; - } let outer = self.clip.clone(); let region = self.cut(&PathData::from_bezpath(&outline), rule); self.clip = Some(region); if let Some(fill) = &paint.fill { + let objects = self.objects; self.node(fill); + if self.objects > objects + && let Some(stroke) = &mut paint.stroke + && stroke.extras().wrap.is_some() + { + stroke.extras_mut().wrap = None; + } } for c in rest { self.node(c); @@ -1663,6 +1731,16 @@ fn clip_path(n: &Node) -> Option<(PathData, FillRule)> { path.subpaths.iter().any(|sp| !sp.anchors.is_empty()).then_some((path, rule)) } +/// Is `n` a knockout group of the pieces of a mesh-warped image cut by opacity masks +/// ([`vectorcraft_doc::live::mesh_warp_image`] with Preserve Shape Using Transparency)? Each piece +/// knocks out its triangle ([`Node::knockout_outline`]); read from the data, a piece knocks out all +/// that its image paints instead. +fn masked_warp_pieces(n: &Node) -> bool { + n.knockout == Knockout::On + && matches!(&n.kind, NodeKind::Group { children, clip: false } + if !children.is_empty() && children.iter().all(|c| c.extras().warp_piece && c.extras().mask.is_some())) +} + /// `text`'s lines on `%_` lines, as a part of the data that readers of the printed form skip (an /// opacity mask's art, a pattern's tile) has them. An image's samples stay as they are after an /// `XI` without `%_`, and `%_%%EndData` ends them, as in the files users sent. Samples hidden diff --git a/crates/eps/src/ai_editing/writer/brushes.rs b/crates/eps/src/ai_editing/writer/brushes.rs index 2c281e702d..029b37597f 100644 --- a/crates/eps/src/ai_editing/writer/brushes.rs +++ b/crates/eps/src/ai_editing/writer/brushes.rs @@ -23,7 +23,7 @@ use super::{Writer, Xy}; use crate::ai_ops; use crate::ps; -pub(in crate::ai_editing) const BRUSHES: &str = "Pattern and Bristle brushes, Art brushes that don't stretch their art along the path from left to right at 100% unflipped without overlap, Scatter and Art brushes in Tints and Shades or Hue Shift, brushes whose art holds an empty path or group or more than paths, compound paths and groups with one solid fill and one plain stroke each, brushes whose names hold a slash or repeat an earlier brush's name, brushes that would open with other settings, brushes past the number or the amount of art one file's brushes can hold, and every brush on a large canvas are left out of the Brushes panel in the editing data for other apps"; +pub(in crate::ai_editing) const BRUSHES: &str = "Pattern and Bristle brushes, Art brushes that don't run their art from left to right, that overlap or whose width follows the pen, Scatter and Art brushes in Tints and Shades or Hue Shift, brushes whose art holds an empty path or group or more than paths, compound paths and groups with one solid fill and one plain stroke each, brushes whose names hold a slash or repeat an earlier brush's name, brushes that would open with other settings, brushes past the number or the amount of art one file's brushes can hold, and every brush on a large canvas are left out of the Brushes panel in the editing data for other apps"; /// Most brushes written (the reader's limit). const MAX_BRUSHES: usize = 4096; @@ -145,22 +145,71 @@ fn scatter_params(s: &Scatter, art: &str) -> Option { Some(format!("2 /{art}/ 5 0 0 0 / {}", nums6(&numbers))) } -/// An Art brush's parameters, its art the section `art`: `None` for options the reader doesn't read -/// (it reads an Art brush that stretches its art along the path from left to right at 100%, -/// unflipped, without overlap, in Tints or keeping its colors). -fn art_params(a: &ArtBrush, art: &str) -> Option { - let plain = a.direction == Direction::LeftToRight - && matches!(a.scale, ArtScale::Stretch) - && a.width == 100.0 - && a.width_mode.is_none() - && !a.flip_along - && !a.flip_across - && !a.overlap; - if !plain { +/// An Art brush's settings as its parameters' numbers 2 to 15 give them and a brushed stroke's filter +/// holds them ([`ART_SETTINGS`]): `None` for options the reader doesn't read (it reads an Art brush +/// that runs its art from left to right without overlap, at a fixed width, in Tints or keeping its +/// colors). The guides of Stretch Between Guides are the lengths of the art before the first and +/// after the second, measured before the art is flipped along the path. +fn art_settings(a: &ArtBrush) -> Option<[f64; 14]> { + if a.direction != Direction::LeftToRight || a.width_mode.is_some() || a.overlap { return None; } - let c = colorization_code(a.colorization)?; - let numbers = [1.0, c, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0]; + let length = a.art.geometric_bounds().map_or(0.0, |b| b.width()); + let (proportional, segmented, before, after) = match a.scale { + ArtScale::Stretch => (0.0, 0.0, 0.0, 0.0), + ArtScale::Proportional => (1.0, 0.0, 0.0, 0.0), + ArtScale::BetweenGuides { start, end } if start < end => { + let (before, after) = (start * length, (1.0 - end) * length); + let (before, after) = if a.flip_along { (after, before) } else { (before, after) }; + (0.0, 1.0, before, after) + } + ArtScale::BetweenGuides { .. } => return None, + }; + let scaling = a.width / 100.0; + let flip = |on: bool| f64::from(u8::from(on)); + Some([ + colorization_code(a.colorization)?, + scaling, + 0.0, + 1.0, + flip(a.flip_along), + flip(a.flip_across), + proportional, + scaling, + scaling, + 0.0, + segmented, + before, + after, + 1.0, + ]) +} + +/// The entries of a brushed stroke's filter that hold an Art brush's settings, in the order of +/// [`art_settings`], with how each is written. +const ART_SETTINGS: [(&str, &str); 14] = [ + ("Colorization", "Int"), + ("Scaling", "Real"), + ("Spacing", "Real"), + ("Adjustment", "Int"), + ("Counterclockwise", "Int"), + ("UpsideDown", "Int"), + ("Proportional", "Bool"), + ("MinScaling", "Real"), + ("MaxScaling", "Real"), + ("ScaleYDependsOn", "Int"), + ("Segmented", "Bool"), + ("StartSegmentLength", "Real"), + ("EndSegmentLength", "Real"), + ("FoldAdjustment", "Bool"), +]; + +/// An Art brush's parameters, its art the section `art`: `None` for options the reader doesn't read +/// ([`art_settings`]). +fn art_params(a: &ArtBrush, art: &str) -> Option { + let settings = art_settings(a)?; + let mut numbers = vec![1.0]; + numbers.extend(settings); Some(format!("2 / {art}/ / / / / 0 0/ 5 0 0 0 / {}", nums6(&numbers))) } @@ -373,7 +422,7 @@ impl Writer<'_> { (self.to_art, self.grad_space, self.canvas), self.state.take(), self.gs.replace(Xy::OPAQUE), - self.clip.take(), + (self.clip.take(), std::mem::take(&mut self.shown)), (self.block_start, self.block_end), // The art is the brush's own: not on `%_` lines, in a drawn look or in a symbol that // first uses the brush. @@ -410,7 +459,7 @@ impl Writer<'_> { (self.to_art, self.grad_space, self.canvas), self.state, self.gs, - self.clip, + (self.clip, self.shown), (self.block_start, self.block_end), (self.hidden, self.in_look, self.in_symbol), ) = saved; @@ -458,25 +507,10 @@ impl Writer<'_> { d.push_str("0 /Int (AngleRelativeTo) ,\n"); "(Calligraphic Brush) /Title ,\n" } - BrushKind::Art(_) => { + BrushKind::Art(a) => { d.push_str("15 /Int (Adobe Effect Expand Before Version) ,\n"); // brand-ok: the entry's name in the files - for (key, value, kind) in [ - ("StartSegmentLength", "0", "Real"), - ("EndSegmentLength", "0", "Real"), - ("Counterclockwise", "0", "Int"), - ("MinScaling", "1", "Real"), - ("MaxScaling", "1", "Real"), - ("Colorization", "1", "Int"), - ("Spacing", "0", "Real"), - ("Adjustment", "1", "Int"), - ("Proportional", "0", "Bool"), - ("Segmented", "0", "Bool"), - ("UpsideDown", "0", "Int"), - ("FoldAdjustment", "1", "Bool"), - ("ScaleYDependsOn", "0", "Int"), - ("Scaling", "1", "Real"), - ] { - let _ = writeln!(d, "{value} /{kind} ({key}) ,"); + for ((key, kind), value) in ART_SETTINGS.iter().zip(art_settings(a)?) { + let _ = writeln!(d, "{} /{kind} ({key}) ,", nums6(&[value])); } "(Art Brush) /Title ,\n" } diff --git a/crates/eps/src/ai_editing/writer/images.rs b/crates/eps/src/ai_editing/writer/images.rs index 36c21c14eb..1d5b9a8c4c 100644 --- a/crates/eps/src/ai_editing/writer/images.rs +++ b/crates/eps/src/ai_editing/writer/images.rs @@ -2,13 +2,14 @@ //! (see [`crate::ai_editing`] for the form). use std::fmt::Write; +use std::sync::Arc; use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::{FillLayer, ImageBlob, ImageObject, LinkInfo}; use vectorcraft_geom::{Affine, FillRule, PathData, Rect, Shape}; use super::{Writer, Xy}; -use crate::ps; +use crate::{ai_ops, ps}; pub(in crate::ai_editing) const IMAGES: &str = "images that can't be decoded or have more than 33,554,432 pixels are written as their outlines filled mid gray in the editing data for other apps"; pub(in crate::ai_editing) const IMAGE_DEPTH: &str = "images of 16 bits a channel are written at 8 bits a channel in the editing data for other apps"; @@ -26,8 +27,23 @@ pub(in crate::ai_editing) const PAYLOAD: char = '\u{1}'; /// What starts the line of an image's samples: `XI` and its payload, then `%%EndData`. pub(super) const SAMPLES_LINE: &str = "XI\u{1}"; +/// An image's pixels as the data holds them, and whether it had 16 bits a channel ([`Samples::of`]). +pub(super) type Read = Arc<(Samples, bool)>; + +/// A copy of an image written as the part of it that its regions show ([`Writer::image`]). +pub(super) struct Windowed { + /// Where its raster is in the body. + at: std::ops::Range, + /// The index of its samples in [`Writer::payloads`]. + payload: usize, + /// The image's pixels. + samples: Read, + /// What places the image's whole pixel grid in the document. + xf: Affine, +} + /// An image's pixels as the data holds them. -struct Samples { +pub(super) struct Samples { /// `/DeviceGray`, `/DeviceRGB` or `/DeviceCMYK`. space: &'static str, /// The image type of `XI` (§8.1): 1 gray, 3 RGB, 4 CMYK. @@ -79,6 +95,19 @@ impl Samples { Some((Samples { space, kind, width, height, color, alpha }, deep)) } + /// The pixels of `window` (`[x0, y0, x1, y1]`, within the image) alone. + fn window(&self, window: [u32; 4]) -> Samples { + let [x0, y0, x1, y1] = window; + Samples { + space: self.space, + kind: self.kind, + width: x1 - x0, + height: y1 - y0, + color: ai_ops::window_samples(&self.color, self.width, usize::from(self.kind), window), + alpha: self.alpha.as_ref().map(|a| ai_ops::window_samples(a, self.width, 1, window)), + } + } + /// `XI`'s fourth flag as the files users sent have it: 0 gray, 1 RGB, 2 CMYK, 16 more with an /// alpha channel. fn reserved(&self) -> u8 { @@ -94,11 +123,15 @@ impl Samples { impl Writer<'_> { /// Image object `im` of transparency `xy`: embedded, a raster ([`Self::raster`]); linked, a /// placed file with a preview ([`Self::placed_file`]), except in a part of the data written on - /// `%_` lines and in a symbol's art. One whose pixels can't be read is its outline filled mid gray. Where the art is - /// cut to a clipping path, the image is in a clipping group of that path. + /// `%_` lines (other than a styled object's copy on the layers, [`Self::styled_object`]) and in + /// a symbol's art. One whose pixels can't be read is its outline filled mid gray. Where the art is + /// cut to a clipping path, the image is in a clipping group of that path; a raster of pixels + /// written whole already is then the part of them that the path shows ([`ai_ops::image_window`]). pub(super) fn image(&mut self, im: &ImageObject, xy: Xy) { let doc = self.doc; - let Some((samples, deep)) = doc.image_blob(im).and_then(Samples::of) else { + let blob = doc.image_blob(im); + let read = blob.and_then(|b| self.samples(b)); + let Some((samples, deep)) = read.as_deref() else { let bounds = PathData::from_bezpath(&(im.xf * Rect::new(0.0, 0.0, f64::from(im.width), f64::from(im.height)).to_path(0.1))); self.warn(IMAGES); return self.fill_object(&bounds, FillRule::NonZero, &FillLayer::new(Paint::solid(Color::gray(0.5))), xy); @@ -112,7 +145,7 @@ impl Writer<'_> { if !self.take_objects(1 + clipping) { return; } - if deep { + if *deep { self.warn(IMAGE_DEPTH); } let cut = self.clip.take(); @@ -125,16 +158,44 @@ impl Writer<'_> { let fit = Affine::scale_non_uniform(f64::from(im.width.max(1)) / f64::from(samples.width), f64::from(im.height.max(1)) / f64::from(samples.height)); match &im.link { - Some(link) if self.hidden == 0 && !self.in_symbol => { + Some(link) if (self.hidden == 0 || self.styled_copy) && !self.in_symbol => { // Cut to a region, the placed file is in a clipping group. self.placed = cut.is_none(); - self.placed_file(link, &samples, (im.width.max(1), im.height.max(1)), im.xf); + self.placed_file(link, samples, (im.width.max(1), im.height.max(1)), im.xf); } other => { if other.is_some() { self.warn(LINKS_EMBEDDED); } - self.raster(&samples, im.xf * fit); + // An image written whole already: the part its region shows, placed where it is in + // the image (the pieces of a warped image each show a small part of the same one). + // An object's editable original (on `%_` lines) and an image in an opacity mask's art + // are written whole. + let data = blob.map(|b| &b.bytes); + let written = self.hidden == 0 && data.is_some_and(|d| self.whole_images.contains_key(&(Arc::as_ptr(d) as usize))); + let window = written + .then(|| { + let clips: Vec<_> = self.shown.iter().cloned().chain(cut.iter().map(PathData::to_bezpath)).collect(); + ai_ops::image_window(&clips, im.xf * fit, (samples.width, samples.height)) + }) + .flatten(); + match (window, &read) { + (Some(window), Some(read)) => { + let at = self.body.len(); + self.raster(&samples.window(window), im.xf * fit * Affine::translate((f64::from(window[0]), f64::from(window[1])))); + self.windowed = + Some(Windowed { at: at..self.body.len(), payload: self.payloads.len() - 1, samples: read.clone(), xf: im.xf * fit }); + } + _ => { + if let Some(d) = data { + // `raster` adds the samples as the next payload. A copy written whole on + // `%_` lines after an earlier whole copy keeps the earlier one's entry. + let next = self.payloads.len(); + self.whole_images.entry(Arc::as_ptr(d) as usize).or_insert_with(|| (d.clone(), next)); + } + self.raster(samples, im.xf * fit); + } + } } } if let Some(region) = &cut { @@ -231,6 +292,32 @@ impl Writer<'_> { ); } + /// The pixels of `blob` ([`Samples::of`]), read once for images that follow one another with + /// the same data. + fn samples(&mut self, blob: &ImageBlob) -> Option { + if let Some((last, read)) = &self.last_samples + && Arc::ptr_eq(&last.bytes, &blob.bytes) + && last.mime == blob.mime + { + return read.clone(); + } + let read = Samples::of(blob).map(Arc::new); + self.last_samples = Some((blob.clone(), read.clone())); + read + } + + /// The copy `w`, written as a window, written whole in its place, with fresh samples; its + /// window's samples are emptied. + pub(super) fn write_whole(&mut self, w: Windowed) { + let tail = self.body.split_off(w.at.end); + self.body.truncate(w.at.start); + if let Some(p) = self.payloads.get_mut(w.payload) { + *p = Vec::new(); + } + self.raster(&w.samples.0, w.xf); + self.body.push_str(&tail); + } + /// Keep `bytes` to go in the program where the mark this returns is. fn payload(&mut self, bytes: Vec) -> String { self.payloads.push(bytes); diff --git a/crates/eps/src/ai_editing/writer/paints.rs b/crates/eps/src/ai_editing/writer/paints.rs index f1b52dd91b..d0a90ce86a 100644 --- a/crates/eps/src/ai_editing/writer/paints.rs +++ b/crates/eps/src/ai_editing/writer/paints.rs @@ -481,7 +481,7 @@ impl Writer<'_> { (self.to_art, self.grad_space, self.canvas), self.state.take(), self.gs.replace(Xy::OPAQUE), - self.clip.take(), + (self.clip.take(), std::mem::take(&mut self.shown)), self.block_end, ); // `Bg` places a gradient in a pattern's tile as on the canvas, mirrored top to bottom: its @@ -505,7 +505,7 @@ impl Writer<'_> { self.hidden -= 1; self.nest -= 1; let art; - (art, (self.to_art, self.grad_space, self.canvas), self.state, self.gs, self.clip, self.block_end) = saved; + (art, (self.to_art, self.grad_space, self.canvas), self.state, self.gs, (self.clip, self.shown), self.block_end) = saved; let art = std::mem::replace(&mut self.body, art); self.defining.pop(); if self.left_out_since(before) { diff --git a/crates/eps/src/ai_editing/writer/styles.rs b/crates/eps/src/ai_editing/writer/styles.rs index 163d70381c..ab9ed6a482 100644 --- a/crates/eps/src/ai_editing/writer/styles.rs +++ b/crates/eps/src/ai_editing/writer/styles.rs @@ -42,7 +42,7 @@ pub(in crate::ai_editing) fn style_links(doc: &Document) -> usize { /// The objects of `doc`'s layers and of their opacity masks' art that may be written with an art /// style ([`Writer::styled_object`]), by id (a mask's art root shown, as [`Writer::mask`] writes /// it): paths and compound paths with points and groups, with live effects, linked to a graphic -/// style or (paths and compound paths) with a brush on a stroke, and embedded images with one Warp +/// style or (paths and compound paths) with a brush on a stroke, and images with one Warp /// ([`warped_image`]), without Opacity & Mask Define /// Knockout Shape (the reader takes an object's transparency /// from its look, which doesn't carry it). A group's members are paths, compound paths or such @@ -100,12 +100,11 @@ fn candidate(n: &Node) -> bool { } } -/// Is `n` an embedded image without an opacity mask whose appearance is one Warp, with no fills or -/// strokes that paint and no effects on them: an image the reader reads with its Warp live -/// ([`crate::import::read_art_style`]'s `image_warp`)? +/// Is `n` an image, embedded or linked, without an opacity mask whose appearance is one Warp, with +/// no fills or strokes that paint and no effects on them: an image the reader reads with its Warp +/// live ([`crate::import::read_art_style`]'s `image_warp`)? fn warped_image(n: &Node) -> bool { - let NodeKind::Image(im) = &n.kind else { return false }; - im.link.is_none() + matches!(n.kind, NodeKind::Image(_)) && n.extras().mask.is_none() && matches!(n.appearance.effects.as_slice(), [e] if e.id.starts_with("warp.")) && n.appearance.items.iter().all(|i| i.paint().is_none() && i.effects().is_empty()) @@ -725,7 +724,8 @@ impl Writer<'_> { /// glows or feathers, the object's transparency /// after the group's end, `0 0 Xd`, `6 () XW`); the object itself on `%_` lines (a path's or /// compound path's points painted with nothing, or with its gradient fill when its style has - /// one; a group with its members; an image with its pixels), its name and opacity mask; then + /// one; a group with its members; an image with its pixels, or on the layers a linked image as + /// a placed file with its path, folder and preview), its name and opacity mask; then /// `1 (name) XW`. /// The look's group and the object itself are counted first ([`Self::take_objects`]): without /// room for them, nothing is written, and the object counts neither as written with its graphic @@ -750,6 +750,9 @@ impl Writer<'_> { let xy = Xy::of(orig); let was = self.in_look; self.in_look = true; + // The reader draws the look apart from the clipping groups around the object to compare it + // with the object's effects, and keeps the object itself: neither is cut to those groups. + let shown_by = std::mem::take(&mut self.shown); self.line("u"); let mut look = n.clone(); (look.name, look.opacity, look.blend, look.isolate, look.knockout, look.knockout_shape) = @@ -772,6 +775,9 @@ impl Writer<'_> { // The object, on `%_` lines, in its own state (the look's members may have changed it). self.state(orig.locked, !orig.visible); let saved = std::mem::take(&mut self.body); + // On the layers, a linked image's copy is a placed file; in an opacity mask's art, it is + // embedded, as other linked images there are. + let on_layers = self.hidden == 0; self.hidden += 1; let fit = drawn_outline(n, orig).map(|p| p.bounding_box()); // A path's or an image's objects were kept for it above; it counts them itself. @@ -781,7 +787,11 @@ impl Writer<'_> { match &orig.kind { NodeKind::Path { path, rule, .. } => self.styled_outline(orig, path, *rule, fit, xy), NodeKind::Compound { rule, .. } => self.styled_outline(orig, &compound_path(orig), *rule, fit, xy), - NodeKind::Image(im) => self.image(&self.doc.shown_image(orig, im), xy), + NodeKind::Image(im) => { + let was = std::mem::replace(&mut self.styled_copy, on_layers); + self.image(&self.doc.shown_image(orig, im), xy); + self.styled_copy = was; + } NodeKind::Group { children, .. } => { self.line("u"); for c in children { @@ -793,6 +803,7 @@ impl Writer<'_> { } self.dictionary(orig); self.hidden -= 1; + self.shown = shown_by; let part = std::mem::replace(&mut self.body, saved); hide(&part, &mut self.body); self.block_end = usize::MAX; diff --git a/crates/eps/src/ai_editing/writer/symbols.rs b/crates/eps/src/ai_editing/writer/symbols.rs index 86d7c4694d..0c8d2c7d3b 100644 --- a/crates/eps/src/ai_editing/writer/symbols.rs +++ b/crates/eps/src/ai_editing/writer/symbols.rs @@ -233,6 +233,7 @@ impl Writer<'_> { if !self.take_objects(1) { self.defining_symbols.pop(); self.keep_since(before); + (self.in_look, self.drawn) = (in_look, drawn); return false; } // The art is written in the symbol's space, from the state `0 A` and `0 Xw` set, from the @@ -245,7 +246,7 @@ impl Writer<'_> { (self.to_art, self.grad_space, self.canvas, self.instance_space), self.state.replace((false, false)), self.gs.replace(Xy::OPAQUE), - self.clip.take(), + (self.clip.take(), std::mem::take(&mut self.shown)), (self.block_start, self.block_end), (std::mem::replace(&mut self.in_symbol, true), std::mem::take(&mut self.hidden)), self.root_entries.take(), @@ -302,7 +303,7 @@ impl Writer<'_> { (self.to_art, self.grad_space, self.canvas, self.instance_space), self.state, self.gs, - self.clip, + (self.clip, self.shown), (self.block_start, self.block_end), (self.in_symbol, self.hidden), self.root_entries, diff --git a/crates/eps/src/ai_ops.rs b/crates/eps/src/ai_ops.rs index 3b2bdd88d8..6b1374cd83 100644 --- a/crates/eps/src/ai_ops.rs +++ b/crates/eps/src/ai_ops.rs @@ -7,7 +7,7 @@ use std::fmt::Write; use vectorcraft_color::{Color, Gradient}; use vectorcraft_doc::{LAYER_COLORS, LayerColor, LineCap, LineJoin, StrokeLayer}; -use vectorcraft_geom::{Affine, Anchor, AnchorKind, PathData, Point, SubPath}; +use vectorcraft_geom::{Affine, Anchor, AnchorKind, PathData, Point, Shape, SubPath}; use crate::ps; @@ -131,6 +131,55 @@ pub(crate) fn average(g: &Gradient) -> Color { Color::rgb(unit(sum[0] / n), unit(sum[1] / n), unit(sum[2] / n)) } +/// The pixels an image's part keeps past the edge of the region that shows it, on each side: as +/// many as smoothing reads from beside a pixel, and one more. +const WINDOW_MARGIN: f64 = 2.0; + +/// The part of an image of `w` × `h` pixels, which `to_doc` places in the document, that regions +/// `clips` (each in the document, the image cut to all of them) show, with [`WINDOW_MARGIN`] pixels +/// more on each side: `[x0, y0, x1, y1]`, in pixels from the top left. One pixel of the image, the +/// nearest to where the regions are, when they show none of it. `None` when that part has half the +/// image's pixels or more, or when `to_doc` can't be undone; the whole image is written then. +pub(crate) fn image_window(clips: &[kurbo::BezPath], to_doc: Affine, (w, h): (u32, u32)) -> Option<[u32; 4]> { + if clips.is_empty() || w == 0 || h == 0 || !to_doc.is_finite() || to_doc.determinant().abs() < 1e-12 { + return None; + } + let to_pixels = to_doc.inverse(); + let (mut x0, mut y0, mut x1, mut y1) = (0.0, 0.0, f64::from(w), f64::from(h)); + for clip in clips { + let b = (to_pixels * clip.clone()).bounding_box(); + if !b.is_finite() { + return None; + } + x0 = f64::max(x0, b.x0.floor() - WINDOW_MARGIN); + y0 = f64::max(y0, b.y0.floor() - WINDOW_MARGIN); + x1 = f64::min(x1, b.x1.ceil() + WINDOW_MARGIN); + y1 = f64::min(y1, b.y1.ceil() + WINDOW_MARGIN); + } + if x0 >= x1 || y0 >= y1 { + let (x, y) = ((x0 as u32).min(w - 1), (y0 as u32).min(h - 1)); + return Some([x, y, x + 1, y + 1]); + } + if 2.0 * (x1 - x0) * (y1 - y0) >= f64::from(w) * f64::from(h) { + return None; + } + Some([x0 as u32, y0 as u32, x1 as u32, y1 as u32]) +} + +/// The rows `y0..y1` and columns `x0..x1` (`window`) of `samples`, `w` pixels a row of `channels` +/// bytes each, rows from the top. +pub(crate) fn window_samples(samples: &[u8], w: u32, channels: usize, [x0, y0, x1, y1]: [u32; 4]) -> Vec { + let row = w as usize * channels; + let (from, to) = (x0 as usize * channels, x1 as usize * channels); + let mut out = Vec::with_capacity((y1 - y0) as usize * (to - from)); + for y in y0 as usize..y1 as usize { + if let Some(part) = samples.get(y * row + from..y * row + to) { + out.extend_from_slice(part); + } + } + out +} + /// The stroke's width, cap, join, miter limit and dashes: `w J j M d`. pub(crate) fn line_style(s: &mut String, st: &StrokeLayer) { let cap = match st.cap { diff --git a/crates/eps/src/import/ai/brush.rs b/crates/eps/src/import/ai/brush.rs index 5a5db47114..fd28e42e47 100644 --- a/crates/eps/src/import/ai/brush.rs +++ b/crates/eps/src/import/ai/brush.rs @@ -18,7 +18,8 @@ //! 1 pt draws it at its own size), the brush by name (`/GObjRef : (name) (plug-in) //! /PluginObject`), and the brush's settings for this path as entries: `Diameter`, `Roundness`, //! `Angle`, their `…Variation` either side and `…DependsOn` codes, and `AngleRelativeTo` (0 the -//! page). +//! page). Samples of the pen may follow a path's own lines on `%_` lines (`(hex) Xt n XD`). They +//! aren't read, so such a path keeps its drawn look when a setting varies with the pen. //! - A path with an Art brush is a stroke in its art style too: the filter //! `(Adobe ArtOnPath Brush Tool)`, its stroke's paint and weight (the weight scales the art across //! the path), the brush by name, and its settings for this path as entries: `Scaling`, @@ -36,7 +37,13 @@ //! - Scatter: the size (2, 3), spacing (5, 6) and scatter (8, 9) as (low, high) factors of the //! art, the rotation in degrees (11, 12), how each varies (4, 7, 10, 13) and whether the //! rotation follows the path (14), and 1 Tints (1). -//! - Art: 1 Tints (2). +//! - Art: numbers 2 to 15 are the settings a path's art style holds as entries ([`ArtSettings`]): +//! the colorization (2: 0 None, 1 Tints; other codes color the art otherwise), the width as a factor +//! (3), `Spacing` (4), `Adjustment` (5), flipped along (6) and across (7), Scale Proportionately +//! (8), the lowest and highest width when the width follows the pen (9, 10, not drawn otherwise), +//! how the width varies (11, 0 Fixed), Stretch Between Guides (12) and the lengths of the art +//! before its first guide and after its second (13, 14, in the art's units, measured before +//! the art is flipped along the path), and `FoldAdjustment` (15). //! - Pattern: its scale as a factor (3). //! - A Bristle brush's parameters start with 8 numbers: two codes, then the stiffness, bristle //! thickness, density, paint opacity and bristle length as fractions and the size in @@ -45,14 +52,15 @@ //! [`super::read`]), usually in a group after its frame, an unpainted rectangle around it. A frame //! at the art's bounds isn't kept ([`without_frame`]); a wider one is. //! -//! What isn't read keeps its default: the Art brush's other options, the pattern brush's tiles +//! What isn't read keeps its default: an Art brush's settings that VectorCraft doesn't draw as the +//! file does ([`art_options`]) apart from its colorization, the pattern brush's tiles //! (which slot is which tile isn't known) and the colorization of the other brushes, which is left //! at None so the art keeps its own colors. use std::collections::{HashMap, HashSet}; use kurbo::Affine; -use vectorcraft_brush::{ArtBrush, Bristle, Brush, BrushKind, Calligraphic, Colorization, Scatter, Variation}; +use vectorcraft_brush::{ArtBrush, ArtScale, Bristle, Brush, BrushKind, Calligraphic, Colorization, Scatter, Variation}; use vectorcraft_color::Paint; use vectorcraft_doc::{AppearanceItem, Node, NodeKind}; @@ -118,13 +126,13 @@ pub(super) enum DraftKind { brush: Scatter, art: String, }, - /// The art is the section named `art`. `plain`: the brush stretches its art along the path, - /// unflipped, at 100% in Tints (see [`art_is_plain`]), so [`Self::Art`]'s `brush` draws as the - /// file's brush does. + /// The art is the section named `art`. `settings`: the brush's settings when [`art_options`] + /// reads them, so [`Self::Art`]'s `brush` draws as the file's brush does (its guides set from + /// its art's length by [`finish_brushes`]). Art { brush: ArtBrush, art: String, - plain: bool, + settings: Option, }, /// The five art sections the brush names, in its order (which is which tile isn't known), and /// its scale (%). @@ -226,12 +234,17 @@ pub(super) fn calligraphic(values: [f64; 3], variation: [f64; 3], codes: [f64; 3 Calligraphic { angle, roundness, size, variation, modes: Some(modes) } } +/// An Art brush's settings: its object's numbers 2 to 15, which a path's art style holds as the +/// entries `Colorization`, `Scaling`, `Spacing`, `Adjustment`, `Counterclockwise`, `UpsideDown`, +/// `Proportional`, `MinScaling`, `MaxScaling`, `ScaleYDependsOn`, `Segmented`, +/// `StartSegmentLength`, `EndSegmentLength` and `FoldAdjustment`, in that order. +pub(super) type ArtSettings = [f64; 14]; + /// The settings a path's art style gives its stroke's brush. #[derive(Clone, Debug, PartialEq)] pub(super) enum PathBrush { Calligraphic(Calligraphic), - /// An Art brush whose art stretches along the path, at the brush's own width, in Tints. - Art, + Art(ArtSettings), } /// Does an Art brush draw `art` as the file does? It bends paths in solid colors: other objects @@ -250,8 +263,9 @@ pub(super) fn art_bends(art: &Node) -> bool { bends } -/// The art sections of `drafts`' Art brushes that an Art brush draws as the file does. -pub(super) fn bending_art(drafts: &[BrushDraft], art: &HashMap) -> HashSet { +/// The art sections of `drafts`' Art brushes that an Art brush draws as the file does, with the +/// length of each (its width, the art running left to right). +pub(super) fn bending_art(drafts: &[BrushDraft], art: &HashMap) -> HashMap { let names: HashSet<&String> = drafts .iter() .filter_map(|d| match &d.kind { @@ -259,13 +273,15 @@ pub(super) fn bending_art(drafts: &[BrushDraft], art: &HashMap) -> _ => None, }) .collect(); - names.into_iter().filter(|n| art.get(*n).is_some_and(art_bends)).cloned().collect() + names.into_iter().filter_map(|n| art.get(n).filter(|a| art_bends(a)).and_then(|a| a.geometric_bounds()).map(|b| (n.clone(), b.width()))).collect() } /// Does the brush `draft` draw as `settings`, the settings a path's art style gives it? A path whose /// settings differ (Options of Selected Object) keeps its drawn look: a stroke names a brush, and -/// has no settings of its own. `bending`: [`bending_art`]. -pub(super) fn draws_as(draft: &BrushDraft, settings: &PathBrush, bending: &HashSet) -> bool { +/// has no settings of its own. An Art brush's settings that don't draw ([`drawn`]) may differ, and +/// the path's own settings must be ones the brush would open with ([`art_options`], [`opens_live`]). +/// `bending`: [`bending_art`]. +pub(super) fn draws_as(draft: &BrushDraft, settings: &PathBrush, bending: &HashMap) -> bool { let close = |a: f64, b: f64| (a - b).abs() <= 1e-3 * a.abs().max(b.abs()).max(1.0); match (&draft.kind, settings) { (DraftKind::Calligraphic(d), PathBrush::Calligraphic(c)) => { @@ -275,16 +291,90 @@ pub(super) fn draws_as(draft: &BrushDraft, settings: &PathBrush, bending: &HashS && d.variation.iter().zip(&c.variation).all(|(a, b)| close(*a, *b)) && d.modes() == c.modes() } - (DraftKind::Art { plain: true, art: name, .. }, PathBrush::Art) => bending.contains(name), + (DraftKind::Art { settings: Some(d), art: name, .. }, PathBrush::Art(s)) => { + let (dd, ds) = (drawn(d), drawn(s)); + art_options(s).is_some() + && bending.get(name).is_some_and(|length| { + // The guides match as lengths and as fractions of the art's length, so they differ + // neither on short art nor near the ends of long art. + dd.iter().zip(ds).all(|(a, b)| close(*a, b)) + && [11, 12].iter().all(|&i| close(dd[i] / length, ds[i] / length)) + && opens_live(d, *length) + && opens_live(s, *length) + }) + } _ => false, } } -/// Are an Art brush's last 15 numbers those of a brush that stretches its art along the path, -/// unflipped, at 100% in Tints? The numbers aren't read otherwise: any other value keeps its paths' -/// drawn look. -fn art_is_plain(numbers: &[f64; 15]) -> bool { - *numbers == [1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0] +/// Art brush settings `s` with those that don't draw set to 0: the lowest and highest width while the +/// width is fixed, and the guides' lengths without Stretch Between Guides. +fn drawn(s: &ArtSettings) -> ArtSettings { + let mut out = *s; + if s[9] == 0.0 { + (out[7], out[8]) = (0.0, 0.0); + } + if s[10] == 0.0 { + (out[11], out[12]) = (0.0, 0.0); + } + out +} + +/// What an Art brush's settings give VectorCraft's Art brush, its guides apart ([`guides`]): `None` +/// when VectorCraft doesn't draw them as the file does: a colorization other than None or Tints, a +/// width outside [`ArtBrush::WIDTH_RANGE`] or one that varies, both Scale Proportionately and Stretch +/// Between Guides, a flip or scale that isn't 0 or 1, or a `Spacing`, `Adjustment` or +/// `FoldAdjustment` other than 0, 1 and 1 (what other values change isn't known). +fn art_options(s: &ArtSettings) -> Option { + let [colorization, scaling, spacing, adjustment, along, across, proportional, _, _, varies, segmented, _, _, fold] = *s; + let switch = |v: f64| match v { + 0.0 => Some(false), + 1.0 => Some(true), + _ => None, + }; + let colorization = match colorization { + 0.0 => Colorization::None, + 1.0 => Colorization::Tints, + _ => return None, + }; + let width = scaling * 100.0; + let (low, high) = ArtBrush::WIDTH_RANGE; + if !(low..=high).contains(&width) || varies != 0.0 || spacing != 0.0 || adjustment != 1.0 || fold != 1.0 { + return None; + } + let scale = match (switch(proportional)?, switch(segmented)?) { + (false, false) => ArtScale::Stretch, + (true, false) => ArtScale::Proportional, + (false, true) => ArtScale::BetweenGuides { start: 0.0, end: 1.0 }, + (true, true) => return None, + }; + Some(ArtBrush { scale, width, flip_along: switch(along)?, flip_across: switch(across)?, colorization, ..ArtBrush::default() }) +} + +/// The guides of Art brush settings `s` (with Stretch Between Guides) for art of length `length`, as +/// [`ArtScale::BetweenGuides`] fractions of the art as it runs along the path: `None` when they leave +/// no art between them. The settings measure the art before it is flipped along the path. +fn guides(s: &ArtSettings, length: f64) -> Option<(f64, f64)> { + let (before, after) = (s[11], s[12]); + if !(before >= 0.0 && after >= 0.0 && before + after < length) { + return None; + } + let (before, after) = if s[4] == 1.0 { (after, before) } else { (before, after) }; + Some((before / length, 1.0 - after / length)) +} + +/// Do Art brush settings `s` draw art of length `length`: no Stretch Between Guides, or guides with +/// art between them? +fn guides_fit(s: &ArtSettings, length: f64) -> bool { + s[10] == 0.0 || guides(s, length).is_some() +} + +/// Does a path with Art brush settings `s`, its art of length `length`, open with the brush on its +/// stroke? Its guides must fit ([`guides_fit`]). Scale Proportionately keeps the drawn look: +/// VectorCraft's Art brush sizes proportional art by the path's length and not by the stroke's +/// weight. +fn opens_live(s: &ArtSettings, length: f64) -> bool { + s[6] == 0.0 && guides_fit(s, length) } /// The brush named `name` of kind `kind` from its parameters `params`. @@ -342,15 +432,22 @@ pub(super) fn parse_tool_object(kind: Tool, name: &str, params: &str) -> Result< Tool::Art => { // The older form's 8 numbers aren't known: its brush keeps the defaults and its // paths their drawn look. The count tells the form, not the first number. - // Any other count isn't a form this reads. - let (colorization, plain) = if let Ok(n15) = <&[f64; 15]>::try_from(n.as_slice()) { - (if n15[1] == 1.0 { Colorization::Tints } else { Colorization::None }, art_is_plain(n15)) + // Any other count isn't a form this reads. Settings that aren't read keep the + // defaults but the colorization, and their paths their drawn look. + let (brush, settings) = if let Ok(&[first, ref settings @ ..]) = <&[f64; 15]>::try_from(n.as_slice()) { + match art_options(settings).filter(|_| first == 1.0) { + Some(brush) => (brush, Some(*settings)), + None => { + let colorization = if settings[0] == 1.0 { Colorization::Tints } else { Colorization::None }; + (ArtBrush { colorization, ..ArtBrush::default() }, None) + } + } } else if n.len() == 8 { - (ArtBrush::default().colorization, false) + (ArtBrush::default(), None) } else { return Err(BrushError::Values); }; - DraftKind::Art { brush: ArtBrush { colorization, ..ArtBrush::default() }, art: art()?, plain } + DraftKind::Art { brush, art: art()?, settings } } _ => { let [_, _, p3, ..] = n.as_slice() else { return Err(BrushError::Values) }; @@ -453,10 +550,15 @@ pub(super) fn finish_brushes_within( _ if !kept => None, DraftKind::Calligraphic(c) => Some(BrushKind::Calligraphic(c)), DraftKind::Scatter { brush, art: name } => copy(&name).map(|a| BrushKind::Scatter(Scatter { art: a, ..brush })), - DraftKind::Art { brush, art: name, .. } => copy(&name).map(|mut a| { + DraftKind::Art { mut brush, art: name, settings } => copy(&name).map(|mut a| { // The side of the section with y up draws on the right of the path, and a brush // draws art's y (down here) on the left of the path. a.transform(Affine::scale_non_uniform(1.0, -1.0), false); + if let ArtScale::BetweenGuides { start, end } = &mut brush.scale { + // Guides that leave no art between them stretch the whole art. + let length = a.geometric_bounds().map_or(0.0, |b| b.width()); + (*start, *end) = settings.and_then(|s| guides(&s, length)).unwrap_or((0.0, 1.0)); + } BrushKind::Art(ArtBrush { art: a, ..brush }) }), DraftKind::Pattern { .. } => None, @@ -586,8 +688,8 @@ pub(crate) struct BrushRead { pub brush: Brush, /// A path whose art style names the brush, at the brush's own settings, opens with the brush on /// its stroke: a Calligraphic brush, or an Art brush whose art an Art brush draws as the file - /// does ([`art_bends`]) and whose numbers are those of a brush that stretches its art along the - /// path, unflipped, at 100% in Tints. + /// does ([`art_bends`]) and whose settings VectorCraft draws as the file does ([`art_options`], + /// with guides that leave art between them and without Scale Proportionately: [`opens_live`]). pub live: bool, } @@ -604,7 +706,9 @@ pub(crate) fn read_brush_object(plugin: &str, name: &str, params: &str, art: Opt let live = kept(&drafts, §ions).first().copied().unwrap_or(false) && match &drafts[0].kind { DraftKind::Calligraphic(_) => true, - DraftKind::Art { plain: true, art: section, .. } => bending_art(&drafts, §ions).contains(section), + DraftKind::Art { settings: Some(s), art: section, .. } => { + bending_art(&drafts, §ions).get(section).is_some_and(|length| opens_live(s, *length)) + } _ => false, }; let [draft] = drafts; @@ -643,8 +747,8 @@ pub(crate) struct BrushesRead { /// The brush a stroke that names a brush is drawn with, by name: the first one kept /// ([`kept`]), as an index in [`Self::drafts`]. by_name: HashMap, - /// The art an Art brush draws as the file does ([`bending_art`]). - bending: HashSet, + /// The art an Art brush draws as the file does, with its length ([`bending_art`]). + bending: HashMap, } impl BrushesRead { @@ -681,7 +785,7 @@ impl BrushesRead { st.items.iter().all(|item| match item { StyleItem::Stroke { brush: Some((name, settings)), .. } => { let Some(draft) = self.by_name.get(name).and_then(|i| self.drafts.get(*i)) else { return false }; - draws_as(draft, settings, &self.bending) && !(matches!(settings, PathBrush::Art) && !st.effects.is_empty()) + draws_as(draft, settings, &self.bending) && !(matches!(settings, PathBrush::Art(_)) && !st.effects.is_empty()) } _ => true, }) diff --git a/crates/eps/src/import/ai/read.rs b/crates/eps/src/import/ai/read.rs index b77bc32199..5ef013ecb5 100644 --- a/crates/eps/src/import/ai/read.rs +++ b/crates/eps/src/import/ai/read.rs @@ -8,7 +8,8 @@ //! next layers: a clipping group in each layer, read by [`masks`]. //! - Ruler guides: a straight `(N) *` guide path, directly on a layer, that runs across the whole //! canvas (16,383 points around the template box's centre) or from edge to edge of one artboard -//! is a ruler guide on that layer ([`Document::guides`]); other guide paths stay paths. +//! is a ruler guide on that layer ([`Document::guides`]), shown or hidden, with the path's name, +//! lock and visibility; other guide paths stay paths. //! - Groups `u` … `U`, compound paths `*u` … `*U`, clipping groups `q` … `Q` (the path painted //! with `W` clips); a group's transparency and name follow its end. A wraparound group `*w` … //! `*W` (version 7 specification §15.4.2) is a group whose objects other than its type wrap @@ -437,8 +438,8 @@ struct BrushesKept { read: (usize, usize), /// Which of [`Reader::brush_drafts`] are kept as brushes. kept: Vec, - /// The art an Art brush draws as the file does. - bending: HashSet, + /// The art an Art brush draws as the file does, with its length. + bending: HashMap, } struct Reader<'a> { @@ -598,6 +599,10 @@ struct Reader<'a> { compound_groups: HashSet, /// Groups of a text object and its look (see [`Self::style_marker`]), which aren't a look. text_looks: HashSet, + /// Objects followed by samples of the pen (`(…) Xt n XD`), which aren't read: such an object + /// whose style has a Calligraphic brush that varies with the pen keeps its drawn look (see + /// [`Self::style_marker`]). + pen_samples: HashSet, /// The gradient mesh being read (`/Mesh X!` … `/End X!`), and whether it started on a `%_` line. mesh: Option<(super::mesh::MeshReader, bool)>, /// The art styles (`%AI9_BeginArtStyles`), by name. @@ -790,6 +795,7 @@ impl<'a> Reader<'a> { ruler_guides: HashMap::new(), compound_groups: HashSet::new(), text_looks: HashSet::new(), + pen_samples: HashSet::new(), group_ended: false, mesh_ended: false, layer_state: None, diff --git a/crates/eps/src/import/ai/read/art.rs b/crates/eps/src/import/ai/read/art.rs index 7e0f91e993..3338968895 100644 --- a/crates/eps/src/import/ai/read/art.rs +++ b/crates/eps/src/import/ai/read/art.rs @@ -234,11 +234,10 @@ impl<'a> Reader<'a> { } let kind = NodeKind::Path { path, rule: gs.rule, live: None, clipping: clip, guide }; let mut node = self.new_node(kind, &gs); - // A ruler guide is written as a straight `(N) *` guide path on its layer. + // A ruler guide is written as a straight `(N) *` guide path on its layer, shown or hidden. if guide && op == "N" && !hidden - && !gs.hidden && !clip && self.pattern.is_none() && matches!(self.frames.last(), Some(Frame { kind: Kind::Layer(_), .. })) diff --git a/crates/eps/src/import/ai/read/directives.rs b/crates/eps/src/import/ai/read/directives.rs index 911d8340cc..f86ee6603b 100644 --- a/crates/eps/src/import/ai/read/directives.rs +++ b/crates/eps/src/import/ai/read/directives.rs @@ -1181,7 +1181,7 @@ mod tests { assert!(nodes > 0); let draft = |i: usize| brush::BrushDraft { name: format!("Brush {i}"), - kind: brush::DraftKind::Art { brush: vectorcraft_brush::ArtBrush::default(), art: "A".to_string(), plain: false }, + kind: brush::DraftKind::Art { brush: vectorcraft_brush::ArtBrush::default(), art: "A".to_string(), settings: None }, }; let drafts: Vec<_> = (0..5).map(draft).collect(); let (kept, left_out) = brush::finish_brushes_within(drafts.clone(), &reader.brush_art, None, 3 * nodes); diff --git a/crates/eps/src/import/ai/read/document.rs b/crates/eps/src/import/ai/read/document.rs index ded114bc67..ecae1e8954 100644 --- a/crates/eps/src/import/ai/read/document.rs +++ b/crates/eps/src/import/ai/read/document.rs @@ -1147,7 +1147,7 @@ impl<'a> Reader<'a> { continue; } let Some(st) = self.styles.get(&name) else { continue }; - let Some(mut appearance) = appearance_from_art_style(st) else { continue }; + let Some(mut appearance) = appearance_from_art_style(st, &self.gradients) else { continue }; // A Large Canvas copy's styles are at its art's scale ([`Self::ensure_space`]). if let Some(s) = self.large_canvas.filter(|s| *s != 1.0) { appearance.scale_strokes(s); @@ -1445,7 +1445,8 @@ fn ruler_guide(a: Point, b: Point, centre: Option<(f64, f64)>, boards: &[Rect]) } /// Makes the children of the layers and sublayers of `nodes` that `pick` makes a guide of into -/// ruler guide nodes with the same ids, moved to the top of their layer in their order. +/// ruler guide nodes with the same ids, names, locks and visibility, moved to the top of their layer +/// in their order. fn take_ruler_guides(nodes: &mut [Arc], pick: &dyn Fn(NodeId) -> Option, depth: usize) { if depth > MAX_DEPTH { return; @@ -1458,7 +1459,11 @@ fn take_ruler_guides(nodes: &mut [Arc], pick: &dyn Fn(NodeId) -> Option { - guides.push(Arc::new(Node::new(k.id, NodeKind::RulerGuide { vertical: g.vertical, pos: g.pos, artboard: g.artboard }))); + let mut n = Node::new(k.id, NodeKind::RulerGuide { vertical: g.vertical, pos: g.pos, artboard: g.artboard }); + n.name = k.name.clone(); + n.locked = k.locked; + n.visible = k.visible; + guides.push(Arc::new(n)); false } None => true, diff --git a/crates/eps/src/import/ai/read/ops.rs b/crates/eps/src/import/ai/read/ops.rs index c1a6aa0385..8c032d5d83 100644 --- a/crates/eps/src/import/ai/read/ops.rs +++ b/crates/eps/src/import/ai/read/ops.rs @@ -89,6 +89,18 @@ impl<'a> Reader<'a> { } } + /// `(…) Xt n XD`: samples of the pen along the object before it. They aren't read, so the object + /// keeps its drawn look when its style has a Calligraphic brush with a setting that varies with + /// the pen ([`Self::style_marker`]). + fn pen_samples_op(&mut self) { + if !self.after_object || self.pen_samples.len() >= MAX_NODES { + return; + } + if let Some(n) = self.frames.last().and_then(|f| f.children.last()) { + self.pen_samples.insert(n.id); + } + } + /// `/identifier (string) XT` (version 7 specification §7): a tag on the object before it. The /// `AdobeURL` tag sets the object's URL, and every other tag is added to the object's data in /// order, up to [`MAX_TAGS`]. A tag with no object before it, with an empty identifier, or with @@ -418,6 +430,7 @@ impl<'a> Reader<'a> { self.end_envelope(); } } + "XD" => self.pen_samples_op(), _ if IGNORED.contains(&w) => {} // Before the art, the setup runs procedures of the printing format. _ if self.frames.is_empty() => {} @@ -559,9 +572,9 @@ impl<'a> Reader<'a> { return; } self.image_tail = false; - // An object's tags (`XT`, and a graph's `Go`) follow it one after another, and an image's - // follow the `XH` that ends its data. - if matches!(w, "Xy" | "Xd" | "XW" | "BB" | "LB" | "XT" | "XH" | "Go") { + // An object's tags (`XT`, and a graph's `Go`) and samples of the pen (`Xt`, `XD`) follow it + // one after another, and an image's tags follow the `XH` that ends its data. + if matches!(w, "Xy" | "Xd" | "XW" | "BB" | "LB" | "XT" | "XH" | "Go" | "Xt" | "XD") { return; } self.after_object = false; @@ -688,6 +701,8 @@ impl<'a> Reader<'a> { /// drawn look before it (all on `%_` lines inside another such object). Other markers end what /// follows an object. fn style_marker(&mut self, vals: &[V], hidden: bool) { + use crate::import::ai::brush::PathBrush; + use crate::import::ai::style::{ArtStyle, StyleItem}; let code = Self::nums(vals).last().copied().unwrap_or(0.0); let style = vals.iter().rev().find_map(|v| self.names.text(v)).unwrap_or_default(); let after = std::mem::take(&mut self.after_object); @@ -754,8 +769,20 @@ impl<'a> Reader<'a> { } else { look }; - // A style read here: the object, painted as it says. - let appearance = self.styles.get(&style).and_then(|st| { + // A style read here: the object, painted as it says. An object with samples of the pen + // keeps its drawn look when its style has a Calligraphic brush with a setting that varies + // with the pen: the samples aren't read, and the brush draws such a stroke at the pen's + // middle values. + let sampled = self.pen_samples.contains(&object.id); + let follows_pen = |st: &ArtStyle| { + st.items.iter().any(|i| match i { + StyleItem::Stroke { brush: Some((_, PathBrush::Calligraphic(c))), .. } => { + c.modes().iter().zip(c.variation).any(|(m, v)| m.follows_pen() && v != 0.0) + } + _ => false, + }) + }; + let appearance = self.styles.get(&style).filter(|st| !(sampled && follows_pen(st))).and_then(|st| { styled( object, look, @@ -992,8 +1019,8 @@ struct StylePaints<'a> { brushes: &'a [super::super::brush::BrushDraft], /// Which of [`Self::brushes`] are kept as brushes ([`super::super::brush::kept`]). kept: &'a [bool], - /// The art an Art brush draws as the file does ([`super::super::brush::bending_art`]). - bending: &'a HashSet, + /// The art an Art brush draws as the file does, with its length ([`super::super::brush::bending_art`]). + bending: &'a HashMap, space: Affine, } @@ -1141,7 +1168,8 @@ fn image_warps(object: &Node, st: &crate::import::ai::style::ArtStyle) -> bool { /// Does image `object` with `appearance` (its style's Warp) draw as `look`, its drawn look, compared /// over all that the warp draws ([`crate::import::ai::envelope::warped_alike`]) on `layer`, a layer -/// id no other node has? Both are drawn shown, opaque and in the Normal mode. Unless the look is on +/// id no other node has? Both are drawn shown, opaque and in the Normal mode; a hidden look is drawn +/// with every object in it shown, as the hidden object's look holds them. Unless the look is on /// `%_` lines itself (`hidden`), the copies in it that are on `%_` lines (`hidden_ids`) are left out. #[allow(clippy::too_many_arguments)] fn image_warp_alike( @@ -1161,12 +1189,24 @@ fn image_warp_alike( if !hidden { strip(&mut plain, hidden_ids); } + if !plain.visible { + show_members(&mut plain); + } for n in [&mut live, &mut plain] { (n.visible, n.opacity, n.blend) = (true, 1.0, BlendMode::Normal); } crate::import::ai::envelope::warped_alike(&live, &plain, layer, shared, page, spent) } +/// Show every object in container `n`, at any depth. +fn show_members(n: &mut Node) { + for c in n.children_mut().into_iter().flatten() { + let c = Arc::make_mut(c); + c.visible = true; + show_members(c); + } +} + /// What [`placed_paints`] keys a pattern's name with, apart from the gradients' names. const PATTERN_KEY: &str = "\u{1}pattern "; @@ -1257,7 +1297,7 @@ fn styled(object: &Node, look: &Node, st: &crate::import::ai::style::ArtStyle, p if !super::super::brush::draws_as(draft, settings, paints.bending) { return None; } - let art = matches!(settings, super::super::brush::PathBrush::Art); + let art = matches!(settings, super::super::brush::PathBrush::Art(_)); let on_a_path = matches!(object.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }); if !on_a_path && (art || !slot) { return None; @@ -1283,9 +1323,11 @@ fn styled(object: &Node, look: &Node, st: &crate::import::ai::style::ArtStyle, p } /// A graphic style's appearance from art style `st`, on no object: `None` when the style isn't one -/// this reads, or paints with a gradient or a pattern (placed on each object as its drawn look has them). +/// this reads, paints with a pattern, or paints with a gradient that names no swatch of `gradients`. /// A style that is one paint is its fill and stroke ([`crate::import::ai::style::ArtStyle::one_paint`]). -pub(super) fn appearance_from_art_style(st: &crate::import::ai::style::ArtStyle) -> Option { +/// A style keeps only its gradients' names and angles, so each one's gradient, by VectorCraft's own +/// rule, is fitted to the bounds of whatever object the style is applied to, at its angle. +pub(super) fn appearance_from_art_style(st: &crate::import::ai::style::ArtStyle, gradients: &HashMap) -> Option { use crate::import::ai::style::StyleItem; if !st.plain { return None; @@ -1301,8 +1343,15 @@ pub(super) fn appearance_from_art_style(st: &crate::import::ai::style::ArtStyle) // A graphic style's brush isn't checked against the file's brushes: it is left out. StyleItem::Stroke { brush: Some(_), .. } => return None, StyleItem::Stroke { .. } => stroke_layer(item)?, - StyleItem::Gradient { .. } | StyleItem::Pattern { .. } => return None, + StyleItem::Gradient { name, angle } => AppearanceItem::Fill(FillLayer::new(named_gradient(name.as_deref()?, *angle, gradients)?)), + StyleItem::Pattern { .. } => return None, }; + // A one-paint style's gradient stroke names its swatch (`style::OnePaint::items`). + if let AppearanceItem::Stroke(s) = &mut layer + && let Paint::Gradient(g) = &s.paint + { + s.paint = named_gradient(g.swatch.as_deref()?, g.angle, gradients)?; + } if let Some(look) = st.looks.get(n) { with_look(&mut layer, look); } @@ -1311,6 +1360,14 @@ pub(super) fn appearance_from_art_style(st: &crate::import::ai::style::ArtStyle) Some(Appearance { items, effects: st.effects.clone(), contents_index: st.contents_index }) } +/// The gradient of `gradients` named `name` at `angle` degrees, fitted to the bounds of the object it +/// paints (`None` when there is no such gradient). +fn named_gradient(name: &str, angle: f64, gradients: &HashMap) -> Option { + let mut g = vectorcraft_color::gradient::GradientPaint::new(gradients.get(name)?.clone()); + g.angle = angle; + Some(Paint::Gradient(Box::new(g))) +} + /// What the reader makes of art style `name` in `section` (the text between `%AI9_BeginArtStyles` /// and its end), for writers that check a style before they write it. #[derive(Clone, Debug)] @@ -1360,7 +1417,9 @@ pub(crate) fn read_art_style(section: &[u8], name: &str, own_gradient: Option<&P _ => None, }) .collect(); - let mut appearance = appearance_from_art_style(&st)?; + // No gradient is taken by name: on an object, one that isn't its own is placed where its drawn + // look has it. + let mut appearance = appearance_from_art_style(&st, &HashMap::new())?; for (item, brush) in appearance.items.iter_mut().zip(brushes) { if let (AppearanceItem::Stroke(s), Some(brush)) = (item, brush) { s.brush = Some(brush); @@ -1557,7 +1616,7 @@ mod tests { let st = &styles["Inked"]; let brushes = [parse_tool_object(Tool::Calligraphic, "N", "1 4 8 30 50 -150 210 2 5 6 0").unwrap()]; let (gradients, patterns, names, v7_patterns, bending) = - (HashMap::new(), HashMap::new(), ShownNames::default(), HashSet::new(), HashSet::new()); + (HashMap::new(), HashMap::new(), ShownNames::default(), HashSet::new(), HashMap::new()); let paints = StylePaints { gradients: &gradients, patterns: &patterns, @@ -1603,7 +1662,7 @@ mod tests { // GUARDS: an image with a Warp in its art style came in as its drawn look. let warp = ("Adobe Deform", "1 /Int (DeformStyle) ,\n0.4 /Real (DeformValue) ,\n"); // brand-ok: the filter's name in the files let (gradients, patterns, names, v7_patterns, bending) = - (HashMap::new(), HashMap::new(), ShownNames::default(), HashSet::new(), HashSet::new()); + (HashMap::new(), HashMap::new(), ShownNames::default(), HashSet::new(), HashMap::new()); let paints = StylePaints { gradients: &gradients, patterns: &patterns, diff --git a/crates/eps/src/import/ai/read/types.rs b/crates/eps/src/import/ai/read/types.rs index 83a838a6cb..b6e908c2e1 100644 --- a/crates/eps/src/import/ai/read/types.rs +++ b/crates/eps/src/import/ai/read/types.rs @@ -386,9 +386,8 @@ pub(super) const IGNORED: &[&str] = &[ // Path resolution (`Ar`, §12): how finely curves print. "Ar", "Xs", + // The samples of the pen that `XD` notes on the object before them (`Reader::pen_samples`). "Xt", - // Five indexed curves of samples along a brushed path (`(…) Xt n XD`), on its hidden source path. - "XD", "Xi", "XI", "LB2", diff --git a/crates/eps/src/import/ai/style.rs b/crates/eps/src/import/ai/style.rs index d27a297925..e0068a52be 100644 --- a/crates/eps/src/import/ai/style.rs +++ b/crates/eps/src/import/ai/style.rs @@ -216,7 +216,8 @@ pub(super) struct ArtStyle { pub simple_pattern: Option, /// A style that is one paint: its fill and stroke, bottom first, each there when its /// `stroke fill Xd` turns it on (none when neither is on). `Err` when it turns on a fill or - /// stroke whose paint isn't read here (a gradient, a pattern, a color that isn't read) or has + /// stroke whose paint isn't read here (a gradient that names no swatch or isn't in a gradient + /// instance, a pattern, a color that isn't read) or has /// no `Xd`. `None` for a style with filters, whose paint is [`Self::items`]. pub one_paint: Option, ()>>, } @@ -313,6 +314,8 @@ struct Filter { gradient_of: Option<(Option, f64)>, /// `(name) … [matrix] p`, and the numbers between the name and the matrix. pattern: Option<(String, Option<[f64; 6]>, Vec)>, + /// Its last fill paint, which replaces those before it. + fill_last: LastPaint, /// The plug-in object it refers to (`/GObjRef : (name) (plug-in) /PluginObject`): its name and /// plug-in name. plugin_object: Option<(String, String)>, @@ -346,6 +349,7 @@ impl Default for Filter { gradient: false, gradient_of: None, pattern: None, + fill_last: LastPaint::None, plugin_object: None, xy: None, xy_group: None, @@ -354,6 +358,15 @@ impl Default for Filter { } } +/// Which paint a filter's paint operators set last. +#[derive(Clone, Copy, Debug, PartialEq)] +enum LastPaint { + None, + Color, + Gradient, + Pattern, +} + /// Most filters read in one style. const MAX_FILTERS: usize = 4096; @@ -662,7 +675,7 @@ fn paint_op(f: &mut Filter, op: &str, vals: &[V], names: &mut Names) { | "xz" => { let Some((p, _)) = paint::color_op_in(op, vals, names) else { return }; if op.ends_with(|c: char| c.is_ascii_lowercase()) { - f.fill = Some(p); + (f.fill, f.fill_last) = (Some(p), LastPaint::Color); } else { f.stroke = Some(p); } @@ -719,7 +732,7 @@ fn paint_op(f: &mut Filter, op: &str, vals: &[V], names: &mut Names) { } // `flag (name) x y angle length a b c d tx ty Bg`. "Bg" => { - f.gradient = true; + (f.gradient, f.fill_last) = (true, LastPaint::Gradient); let at = vals.iter().rposition(|v| matches!(v, V::Str(_))); let name = at.and_then(|i| vals.get(i)).and_then(|v| names.text(v)); let n: Vec = at.map_or(&[][..], |i| vals.get(i + 1..).unwrap_or_default()).iter().filter_map(V::num).collect(); @@ -728,7 +741,7 @@ fn paint_op(f: &mut Filter, op: &str, vals: &[V], names: &mut Names) { } "p" => { if let Some(pattern) = pattern_operands(vals, names) { - f.pattern = Some(pattern); + (f.pattern, f.fill_last) = (Some(pattern), LastPaint::Pattern); } } _ => {} @@ -786,6 +799,11 @@ struct OnePaint { stroke_unread: bool, /// Inside a gradient instance (`flag Bb` … `BB`): whether it paints the stroke (flag 1). instance: Option, + /// The gradient swatch's name and angle of its last fill paint, when that is a gradient + /// instance's `Bg`. + fill_gradient: Option<(String, f64)>, + /// The same for its last stroke paint. + stroke_gradient: Option<(String, f64)>, } impl OnePaint { @@ -811,9 +829,26 @@ impl OnePaint { _ => {} } paint_op(&mut self.paint, op, vals, names); + // A gradient instance's `Bg` names the swatch its fill or stroke paints with; any other + // paint of that side replaces it. Outside an instance, which side it paints isn't known. + let named = || match (op, &self.paint.gradient_of) { + ("Bg", Some((Some(name), angle))) => Some((name.clone(), *angle)), + _ => None, + }; + match op { + "Bg" if self.instance == Some(true) => self.stroke_gradient = named(), + "Bg" if self.instance == Some(false) => self.fill_gradient = named(), + "Bg" => (self.fill_gradient, self.stroke_gradient) = (None, None), + "p" | "Xa" | "k" | "g" | "x" | "Xx" | "Xk" | "Xs" | "Xz" | "xa" | "xx" | "xk" | "xs" | "xz" => self.fill_gradient = None, + "P" | "XA" | "K" | "G" | "X" | "XX" | "XK" | "XS" | "XZ" => self.stroke_gradient = None, + _ => {} + } } - /// Its fill and stroke ([`ArtStyle::one_paint`]). + /// Its fill and stroke ([`ArtStyle::one_paint`]). A gradient fill is its [`StyleItem::Gradient`]; + /// a gradient stroke's paint is a gradient that only names its swatch (`swatch`) at its angle, + /// with default stops: `read::ops`' `appearance_from_art_style` gives it the file's gradient of + /// that name. fn items(&self) -> Result, ()> { let f = &self.paint; if !self.xd { @@ -822,14 +857,22 @@ impl OnePaint { let (stroked, filled) = f.paints; let mut items = vec![]; if filled { - match &f.fill { - Some(p) if !self.fill_unread => items.push(StyleItem::Fill(p.clone())), + match (&f.fill, &self.fill_gradient) { + (Some(p), _) if !self.fill_unread => items.push(StyleItem::Fill(p.clone())), + (_, Some((name, angle))) if self.fill_unread => items.push(StyleItem::Gradient { name: Some(name.clone()), angle: *angle }), _ => return Err(()), } } if stroked { - match &f.stroke { - Some(p) if !self.stroke_unread => items.push(StyleItem::Stroke { + let named = self.stroke_gradient.as_ref().filter(|_| self.stroke_unread).map(|(name, angle)| { + Paint::Gradient(Box::new(vectorcraft_color::gradient::GradientPaint { + angle: *angle, + swatch: Some(name.clone()), + ..vectorcraft_color::gradient::GradientPaint::new(vectorcraft_color::gradient::Gradient::default()) + })) + }); + match named.as_ref().or(f.stroke.as_ref().filter(|_| !self.stroke_unread)) { + Some(p) => items.push(StyleItem::Stroke { paint: p.clone(), width: f.width, cap: f.cap, @@ -1396,6 +1439,8 @@ fn paint_item(f: &Filter) -> Result, ()> { match f.name.as_str() { FILL if !f.paints.1 => Ok(None), FILL => match (&f.pattern, &f.gradient_of, &f.fill) { + (.., Some(p)) if f.fill_last == LastPaint::Color => Ok(Some(StyleItem::Fill(p.clone()))), + (_, Some((name, angle)), _) if f.fill_last == LastPaint::Gradient => Ok(Some(StyleItem::Gradient { name: name.clone(), angle: *angle })), (Some((name, matrix, controls)), ..) => Ok(Some(StyleItem::Pattern { name: name.clone(), matrix: *matrix, controls: controls.clone() })), (None, Some((name, angle)), _) => Ok(Some(StyleItem::Gradient { name: name.clone(), angle: *angle })), (None, None, _) if f.gradient => Ok(Some(StyleItem::Gradient { name: None, angle: 0.0 })), @@ -1445,13 +1490,38 @@ fn offset_stroke(f: &Filter) -> Result, ()> { stroke_item(f, if inside { StrokeAlign::Inside } else { StrokeAlign::Outside }) } +/// The entries a Calligraphic brush's filter may hold, with the settings [`calligraphic_stroke`] +/// reads. Any other entry keeps the drawn look. +const CALLIGRAPHIC_ENTRIES: [&str; 14] = [ + "StrokeStyle", + "DisplayString", + "Brush", + "Diameter", + "DiameterVariation", + "DiameterDependsOn", + "Roundness", + "RoundnessVariation", + "RoundnessDependsOn", + "Angle", + "AngleVariation", + "AngleDependsOn", + "AngleRelativeTo", + "Adobe Effect Expand Before Version", // brand-ok: the entry's name in the files +]; + /// A Calligraphic brush's filter `f` as the stroke it paints: `None` when it isn't a stroke in a -/// colour, names no Calligraphic brush, or its settings aren't all there as numbers. An angle -/// relative to the path isn't read. +/// color, names no Calligraphic brush, holds an entry or a width that isn't read, or its settings +/// aren't all there as numbers. An angle relative to the path isn't read. fn calligraphic_stroke(f: &Filter) -> Option { let real = |key: &str| entry(f, key, Kind::Real).ok().flatten(); let code = |key: &str| entry(f, key, Kind::Int).ok().flatten(); - if !f.paints.0 || f.gradient || f.pattern.is_some() || f.repeated { + if !f.paints.0 + || f.gradient + || f.pattern.is_some() + || f.repeated + || !f.arrays.is_empty() + || !f.kinds.keys().all(|k| CALLIGRAPHIC_ENTRIES.contains(&k.as_str())) + { return None; } if entry(f, "AngleRelativeTo", Kind::Int).ok()?.unwrap_or(0.0) != 0.0 { @@ -1500,11 +1570,30 @@ const ART_ENTRIES: [&str; 18] = [ "Adobe Effect Expand Before Version", // brand-ok: the entry's name in the files ]; -/// An Art brush's filter `f` as the stroke it paints: `None` when it isn't a stroke in a color, names -/// no Art brush, holds an entry that isn't read, or its settings aren't those of art that stretches -/// along the path, unflipped, at the brush's own width (`Scaling` 1), in Tints (`Colorization` 1), -/// with `FoldAdjustment` 1, which is [`vectorcraft_brush::ArtBrush`]'s `overlap: false`: its drawn -/// look stays. +/// The entries of an Art brush's filter that hold its settings, in the order of +/// [`super::brush::ArtSettings`], with how each is written and its value when the filter leaves it +/// out (`None`: the filter must hold it). +const ART_SETTINGS: [(&str, Kind, Option); 14] = [ + ("Colorization", Kind::Int, None), + ("Scaling", Kind::Real, None), + ("Spacing", Kind::Real, Some(0.0)), + ("Adjustment", Kind::Int, Some(1.0)), + ("Counterclockwise", Kind::Int, Some(0.0)), + ("UpsideDown", Kind::Int, Some(0.0)), + ("Proportional", Kind::Bool, Some(0.0)), + ("MinScaling", Kind::Real, Some(1.0)), + ("MaxScaling", Kind::Real, Some(1.0)), + ("ScaleYDependsOn", Kind::Int, Some(0.0)), + ("Segmented", Kind::Bool, Some(0.0)), + ("StartSegmentLength", Kind::Real, Some(0.0)), + ("EndSegmentLength", Kind::Real, Some(0.0)), + ("FoldAdjustment", Kind::Bool, Some(1.0)), +]; + +/// An Art brush's filter `f` as the stroke it paints, with its settings: `None` when it isn't a +/// stroke in a color, names no Art brush, holds an entry that isn't read or a setting that isn't a +/// number of its kind, or tints its art with a swatch's color: its drawn look stays. Whether the +/// brush draws as these settings is [`super::brush::draws_as`]'s to say. fn art_stroke(f: &Filter) -> Option { if !f.paints.0 || f.gradient @@ -1519,28 +1608,13 @@ fn art_stroke(f: &Filter) -> Option { if plugin != ART_BRUSH { return None; } - let off = |key: &str, kind: Kind| matches!(entry(f, key, kind), Ok(None | Some(0.0))); - let plain = off("Proportional", Kind::Bool) - && off("Segmented", Kind::Bool) - && off("UpsideDown", Kind::Int) - && off("Counterclockwise", Kind::Int) - && off("ScaleYDependsOn", Kind::Int) - && off("Spacing", Kind::Real) - && off("StartSegmentLength", Kind::Real) - && off("EndSegmentLength", Kind::Real); - if !plain || entry(f, "Adjustment", Kind::Int).ok()?.unwrap_or(1.0) != 1.0 || entry(f, "FoldAdjustment", Kind::Bool).ok()?.unwrap_or(1.0) != 1.0 { - return None; - } - let one = |key: &str| entry(f, key, Kind::Real).is_ok_and(|v| v.unwrap_or(1.0) == 1.0); - if entry(f, "Scaling", Kind::Real).ok()?? != 1.0 || !one("MinScaling") || !one("MaxScaling") { - return None; - } - if entry(f, "Colorization", Kind::Int).ok()?? != 1.0 { - return None; + let mut settings = [0.0; 14]; + for (slot, (key, kind, missing)) in settings.iter_mut().zip(ART_SETTINGS) { + *slot = entry(f, key, kind).ok()?.or(missing)?; } let paint = f.stroke.clone()?; // The tinted pieces are process colors, so a swatch's ink would be lost. - if matches!(paint, Paint::Solid { swatch: Some(_), .. }) { + if settings[0] == 1.0 && matches!(paint, Paint::Solid { swatch: Some(_), .. }) { return None; } Some(StyleItem::Stroke { @@ -1552,7 +1626,7 @@ fn art_stroke(f: &Filter) -> Option { dash: None, profile: None, align: StrokeAlign::Center, - brush: Some((name.clone(), PathBrush::Art)), + brush: Some((name.clone(), PathBrush::Art(settings))), }) } diff --git a/crates/eps/src/import/ai/style/tests.rs b/crates/eps/src/import/ai/style/tests.rs index ea8428809c..c4b006fe2a 100644 --- a/crates/eps/src/import/ai/style/tests.rs +++ b/crates/eps/src/import/ai/style/tests.rs @@ -471,6 +471,28 @@ fn lettering() -> String { format!("/KnownStyle :\n(Lettering) /Name ,\n/ActiveStyle :\n{root}\n/Execution ;\n /Def ;\n") } +/// A fill filter's last paint is its fill: a color, a gradient or a pattern replaces whichever of the +/// others came before it. +#[test] +fn a_fill_filter_paints_with_its_last_paint() { + let gradient = "0 Bb\n2 (Sky) 0 0 30 1 1 0 0 1 0 0 1 Bg\n0 BB"; + let pattern = "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p"; + let color = "0 0 0 0 1 0 0 Xa"; + let items = |paint: String| { + let root = compound("Chain Style Filter", &[fill(&paint)]); + let data = format!("/KnownStyle :\n(S) /Name ,\n/ActiveStyle :\n{root}\n/Execution ;\n /Def ;\n"); + art_styles(data.as_bytes()).remove("S").map(|s| s.items).unwrap_or_default() + }; + for before in [gradient, pattern] { + assert!(matches!(items(format!("{before}\n{color}")).as_slice(), [StyleItem::Fill(Paint::Solid { .. })]), "{before}"); + } + for before in [color, pattern] { + assert_eq!(items(format!("{before}\n{gradient}")), [StyleItem::Gradient { name: Some("Sky".into()), angle: 30.0 }], "{before}"); + } + assert!(matches!(items(format!("{color}\n{pattern}")).as_slice(), [StyleItem::Pattern { .. }])); + assert!(matches!(items(format!("{gradient}\n{pattern}")).as_slice(), [StyleItem::Pattern { .. }])); +} + #[test] fn a_stack_of_fills_with_effects_of_their_own_is_read_as_itself() { // GUARDS: more than one fill, or an effect on a fill, made the style not plain, and type @@ -1544,14 +1566,22 @@ fn a_style_of_one_paint_reads_as_the_fill_and_stroke_its_xd_turns_on() { // A gradient instance's flag says which one it paints: a stroke gradient leaves a solid fill read. let fill_and_stroke_gradient = one("0 0 1 0 k\n1 Bb\n2 (Ramp) 0 0 90 1 1 0 0 1 0 0 1 Bg\n0 BB\n0 1 Xd\n"); assert!(matches!(fill_and_stroke_gradient, Some(Ok(i)) if matches!(i.as_slice(), [StyleItem::Fill(_)]))); - // Not read: no `Xd`, a gradient or pattern fill, a pattern stroke, a gradient stroke after a solid one, a paint - // turned on with no color. + // A gradient instance's fill is its swatch at its angle; its stroke, after a solid one too, is a + // gradient naming its swatch at its angle, at the stroke's weight. + let gradient_fill = one("0 Bb\n2 (Sky) 0 0 30 100 1 0 0 1 0 0 Bg\n0 BB\n0 1 Xd\n"); + assert_eq!(gradient_fill, Some(Ok(vec![StyleItem::Gradient { name: Some("Sky".into()), angle: 30.0 }]))); + let gradient_stroke = one("0 R\n0 1 1 0 K\n1 Bb\n0 0 0 0 Bh\n2 (Ramp) 0 0 90 1 1 0 0 1 0 0 1 Bg\n0 BB\n2 w\n1 0 Xd\n"); + let Some(Ok(items)) = &gradient_stroke else { panic!("{gradient_stroke:?}") }; + let [StyleItem::Stroke { paint: Paint::Gradient(g), width, .. }] = items.as_slice() else { panic!("{items:?}") }; + assert_eq!((g.swatch.as_deref(), g.angle, g.geom, *width), (Some("Ramp"), 90.0, None, 2.0)); + // Not read: no `Xd`, a pattern fill, a pattern stroke, a gradient outside a gradient instance, a + // paint turned on with no color. for paint in [ format!("0 0 1 0 k\n{stroke}"), - "0 Bb\n2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg\n0 BB\n0 1 Xd\n".to_string(), "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p\n0 1 Xd\n".to_string(), "(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] P\n1 0 Xd\n".to_string(), - "0 R\n0 1 1 0 K\n1 Bb\n0 0 0 0 Bh\n2 (Ramp) 0 0 90 1 1 0 0 1 0 0 1 Bg\n0 BB\n2 w\n1 0 Xd\n".to_string(), + "2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg\n0 1 Xd\n".to_string(), + "0 Bb\n2 (Sky) 0 0 0 100 1 0 0 1 0 0 Bg\n0 BB\n(Dots) 0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0] p\n0 1 Xd\n".to_string(), "0 0 1 0 k\n1 1 Xd\n".to_string(), ] { assert_eq!(one(&paint), Some(Err(())), "{paint}"); diff --git a/crates/eps/src/import/ai/tests.rs b/crates/eps/src/import/ai/tests.rs index f1e201824d..d160248a2d 100644 --- a/crates/eps/src/import/ai/tests.rs +++ b/crates/eps/src/import/ai/tests.rs @@ -8832,7 +8832,8 @@ fn other_guide_paths_stay_guide_paths() { guide_line(0.0, 30.0, 200.0, 30.0, "S"), guide_line(-7885.0, -7796.0, 8498.0, 8587.0, "N"), format!("u\n{}U\n", guide_line(-7885.0, 40.0, 8498.0, 40.0, "N")), - format!("1 Xw\n{}0 Xw\n", guide_line(-7885.0, 40.0, 8498.0, 40.0, "N")), + format!("1 Xw\n{}0 Xw\n", guide_line(20.0, 40.0, 80.0, 40.0, "N")), + format!("1 A\n{}0 A\n", guide_line(-7885.0, 40.0, 8498.0, 40.0, "S")), "-7885 40 m\n306 40 L\n8498 40 L\n(N) *\n".to_string(), ]; for body in cases { @@ -8842,6 +8843,35 @@ fn other_guide_paths_stay_guide_paths() { } } +/// A hidden (`1 Xw`), locked (`1 A`) or named ruler guide path is a ruler guide that keeps its own +/// visibility, lock and name, across the canvas or an artboard, on a shown layer. +#[test] +fn hidden_locked_and_named_guide_paths_are_ruler_guides() { + let body = format!( + "1 Xw\n{}0 Xw\n1 A\n{}0 A\n{}%_/ArtDictionary :\n%_(Mark) /String (AIArtName) ,\n%_;\n%_\n1 Xw\n{}0 Xw\n", + guide_line(-7885.0, 40.0, 8498.0, 40.0, "N"), + guide_line(25.0, 8587.0, 25.0, -7796.0, "N"), + guide_line(-7885.0, 90.0, 8498.0, 90.0, "N"), + guide_line(0.0, 30.0, 200.0, 30.0, "N"), + ); + let doc = read(canvas_stream(&layer(&body)).as_bytes()).unwrap().doc; + let top = &doc.layers[0]; + assert!(top.visible); + let kids = top.children().unwrap(); + assert_eq!(kids.len(), 4); + assert!(kids.iter().all(|c| c.is_ruler_guide()), "no guide path is left"); + let got: Vec<_> = doc.ruler_guides().into_iter().map(|g| (g.vertical, g.pos, g.artboard, g.layer, g.hidden, g.locked, g.name)).collect(); + let want = [ + (false, 60.0, None, Some(top.id), true, false, None), + (true, 25.0, None, Some(top.id), false, true, None), + (false, 10.0, None, Some(top.id), false, false, Some("Mark".to_string())), + (false, 70.0, Some(1), Some(top.id), true, false, None), + ]; + assert_eq!(got, want); + // The nodes themselves carry the state, so the Layers rows show it. + assert_eq!(kids.iter().map(|k| (k.visible, k.locked)).collect::>(), [(false, false), (true, true), (true, false), (false, false)]); +} + /// The layer whose `Lb` has `ops` as its options (the first one in the file). fn layer_with(ops: &str) -> Node { let doc = read_ok(&format!("%AI5_BeginLayer\n{ops} Lb\n(L) Ln\nLB\n%AI5_EndLayer--\n")).doc; @@ -9767,7 +9797,7 @@ fn a_pattern_brushs_five_slots_are_kept() { fn an_older_art_brush_comes_in_with_its_art() { const OLD_RIBBON: &str = "1 / Ribbon art/ / / / / 0 1 / 1 0 1 0 1 0 0 0"; let d = brush::parse_tool_object(brush::Tool::Art, "Ribbon", OLD_RIBBON).unwrap(); - assert!(matches!(d.kind, brush::DraftKind::Art { ref art, plain: false, .. } if art == "Ribbon art"), "{d:?}"); + assert!(matches!(d.kind, brush::DraftKind::Art { ref art, settings: None, .. } if art == "Ribbon art"), "{d:?}"); let brush::DraftKind::Art { ref brush, .. } = d.kind else { panic!("art") }; assert_eq!(brush.colorization, vectorcraft_brush::ArtBrush::default().colorization, "the default colorization"); // A count of numbers neither form has isn't read. @@ -9777,8 +9807,8 @@ fn an_older_art_brush_comes_in_with_its_art() { assert_eq!(brush::parse_tool_object(brush::Tool::Scatter, "Spray", "1 /Dot art/ 0 1 / 1 0 1 0 1 0 0 0"), Err(brush::BrushError::Values)); // 8 numbers are the older form whatever the first number says: read with the defaults. let d = brush::parse_tool_object(brush::Tool::Art, "Ribbon", "0 / Ribbon art/ / / / / 0 1 / 1 0 1 0 1 0 0 0").unwrap(); - let brush::DraftKind::Art { ref brush, ref art, plain } = d.kind else { panic!("art") }; - assert_eq!((art.as_str(), plain, brush.colorization), ("Ribbon art", false, vectorcraft_brush::ArtBrush::default().colorization)); + let brush::DraftKind::Art { ref brush, ref art, settings } = d.kind else { panic!("art") }; + assert_eq!((art.as_str(), settings, brush.colorization), ("Ribbon art", None, vectorcraft_brush::ArtBrush::default().colorization)); let objects = [plugin_object(ART_BRUSH, "Ribbon", OLD_RIBBON), plugin_object(ART_BRUSH, "Bare", "1 / / / / / / 0 1 / 1 0 1 0 1 0 0 0")].concat(); let r = read_ok(&format!("{}{objects}{}", brush_art("Ribbon art", 4.0), layer(""))); let lib = vectorcraft_brush::library(&r.doc); @@ -10274,20 +10304,86 @@ fn a_path_with_a_calligraphic_brush_comes_in_brushed() { let pieces = vectorcraft_brush::stroke_pieces(&r.doc, &lib[0], &a[0].path_data().unwrap().to_bezpath(), st); let height = pieces.iter().filter_map(|n| n.geometric_bounds()).map(|b| b.height()).fold(0.0, f64::max); assert!(height > 40.0 && height < 46.0, "the line's rise and about half the nib's 3 pt: {height}"); + // A filter with the version entry an effect's filter may carry still comes in brushed. + let versioned = style.replace("(Brush) ,\n", "(Brush) ,\n15 /Int (Adobe Effect Expand Before Version) ,\n"); + let a = art(&read_ok(&format!("{def}{versioned}{}", layer(&brushed_path()))).doc); + assert!(matches!(a[0].kind, NodeKind::Path { .. }), "{a:#?}"); +} + +/// Samples of the pen along a path (`(…) Xt n XD`), as they follow its own lines. +const PEN_SAMPLES: &str = "%_(00FE64FE) Xt 0 XD\n%_(00006400) Xt 1 XD\n%_(00986498) Xt 2 XD\n%_(009E649E) Xt 3 XD\n%_(007F647F) Xt 4 XD\n"; + +/// A path with a Calligraphic brush that varies with the pen, followed by samples of the pen, comes +/// in as its drawn look alone, with the note that says so: the samples aren't read, and the brush +/// would draw it at the pen's middle values. Its own path doesn't come in beside the look. A brush +/// that doesn't follow the pen draws such a path the same without the samples, so it comes in +/// brushed. +#[test] +fn a_brushed_path_with_samples_of_the_pen_keeps_its_drawn_look() { + // GUARDS: the path came in beside its look, unpainted, and the note was missing. + let def = plugin_object(CALLIGRAPHIC, "Six D", SIX_D); + let style = brushed_style("Six D", 0.5, SIX_D_SETTINGS, [2, 5, 6], 0); + let path = brushed_path().replace("%_n\n", &format!("%_n\n{PEN_SAMPLES}")); + let r = read_ok(&format!("{def}{style}{}", layer(&path))); + let a = art(&r.doc); + assert_eq!(a.len(), 1, "{a:#?}"); + assert!(matches!(a[0].kind, NodeKind::Group { .. }), "the drawn look: {a:#?}"); + assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings); + // The samples belong to the path before them: a path after them is read as it was. + let after = format!("{path}{RED}{}f\n", rect_path(0.0, 0.0, 10.0, 10.0)); + let a = art(&read_ok(&format!("{def}{style}{}", layer(&after))).doc); + assert_eq!(a.len(), 2, "{a:#?}"); + assert!(matches!(a[1].kind, NodeKind::Path { .. }) && a[1].appearance.fill().is_some(), "{a:#?}"); + // Samples with no object before them in the layer mark nothing: the path after them is read. + let first = format!("{PEN_SAMPLES}{}", brushed_path()); + let a = art(&read_ok(&format!("{def}{style}{}", layer(&first))).doc); + assert_eq!(a.len(), 1, "{a:#?}"); + assert!(matches!(a[0].kind, NodeKind::Path { .. }), "the path, brushed: {a:#?}"); + // A brush whose modes are Fixed and Random, one whose pen modes vary by 0, and an Art brush + // don't follow the pen: the path comes in brushed. + let fixed_def = plugin_object(CALLIGRAPHIC, "Six D", &SIX_D.replace(" 2 5 6 0", " 0 1 0 0")); + let fixed = brushed_style("Six D", 0.5, SIX_D_SETTINGS, [0, 1, 0], 0); + let even_def = plugin_object(CALLIGRAPHIC, "Six D", "1 6 6 40 40 30 30 2 5 6 0"); + let even = brushed_style("Six D", 0.5, [(6.0, 0.0), (40.0, 0.0), (30.0, 0.0)], [2, 5, 6], 0); + for (why, def, style) in [("Fixed and Random", fixed_def, fixed), ("no variation", even_def, even)] { + let r = read_ok(&format!("{def}{style}{}", layer(&path))); + let a = art(&r.doc); + assert_eq!(a.len(), 1, "{why}: {a:#?}"); + assert!(matches!(a[0].kind, NodeKind::Path { .. }), "{why}: the path, brushed: {a:#?}"); + assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{why}: {:?}", r.warnings); + } + let ribbon = format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", RIBBON)); + let a = art(&read_ok(&format!("{ribbon}{}{}", art_style("Ribbon", 2.0, &STRETCHED, ""), layer(&path))).doc); + assert_eq!(a.len(), 1, "{a:#?}"); + assert_eq!(a[0].appearance.stroke().and_then(|s| s.brush.as_deref()), Some("Ribbon"), "{a:#?}"); + // A style with no brush doesn't draw the samples: the path takes it as it would without them. + let square = styled_square("Blue").replace("f\n1 (Blue) XW", &format!("f\n{PEN_SAMPLES}1 (Blue) XW")); + let r = read_ok(&format!("{}{}", styles_and_list(&[fill_style("Blue", "0 0 0 0 0 0 1 Xa\n")], &["Blue"]), layer(&square))); + let a = art(&r.doc); + assert_eq!(a.len(), 1, "{a:#?}"); + assert!(matches!(a[0].kind, NodeKind::Path { .. }), "the path with its style: {a:#?}"); + assert_eq!(a[0].extras().graphic_style, Some(1), "linked to its style"); } /// A brushed path keeps its drawn look when its stroke can't be read as the brush: the object's /// own settings differ from the brush's (Options of Selected Object), its angle follows the path, -/// or the file defines no brush of its name. +/// its filter holds an entry or a variable width that isn't read, or the file defines no brush of +/// its name. #[test] fn a_brushed_path_the_brush_cant_draw_keeps_its_drawn_look() { let def = plugin_object(CALLIGRAPHIC, "Six D", SIX_D); let mut own = SIX_D_SETTINGS; own[0] = (9.0, 2.0); + let plain = brushed_style("Six D", 1.0, SIX_D_SETTINGS, [2, 5, 6], 0); + let with = |more: &str| plain.replace("(Brush) ,\n", &format!("(Brush) ,\n{more}")); + let widths = "/Dictionary : /NotRecorded ,\n/Array :\n0 /Real ,\n1 /Real ,\n; (BSVariableWidthTValuesArray) ,\n\ + /Array :\n1 /Real ,\n0.1 /Real ,\n; (BSCenteredWidthsArray) ,\n; (kAIBeautifulStrokesParamsDictKey) ,\n"; let cases = [ ("its own settings", def.clone(), brushed_style("Six D", 1.0, own, [2, 5, 6], 0)), ("its own modes", def.clone(), brushed_style("Six D", 1.0, SIX_D_SETTINGS, [2, 5, 4], 0)), ("an angle on the path", def.clone(), brushed_style("Six D", 1.0, SIX_D_SETTINGS, [2, 5, 6], 1)), + ("an entry that isn't read", def.clone(), with("1 /Real (Unread) ,\n")), + ("a variable width", def.clone(), with(widths)), ("no such brush", def, brushed_style("Other", 1.0, SIX_D_SETTINGS, [2, 5, 6], 0)), ]; for (why, def, style) in cases { @@ -10441,9 +10537,109 @@ fn an_art_brush_bends_only_paths_in_solid_fills() { assert!(wrong.is_empty(), "{wrong:?}"); } +/// The entries of an Art brush's filter that hold its settings, in the order of its object's numbers 2 +/// to 15, with how each is written. +const ART_KEYS: [(&str, &str); 14] = [ + ("Colorization", "Int"), + ("Scaling", "Real"), + ("Spacing", "Real"), + ("Adjustment", "Int"), + ("Counterclockwise", "Int"), + ("UpsideDown", "Int"), + ("Proportional", "Bool"), + ("MinScaling", "Real"), + ("MaxScaling", "Real"), + ("ScaleYDependsOn", "Int"), + ("Segmented", "Bool"), + ("StartSegmentLength", "Real"), + ("EndSegmentLength", "Real"), + ("FoldAdjustment", "Bool"), +]; + +/// The Art brush `Ribbon` (its art 40 long: [`lopsided_art`]) whose settings, numbers 2 to 15 of its +/// object, are those of [`RIBBON`] with `changes` (index in the 14, value), and the style `Inked` that +/// gives a path the same settings. +fn ribbon_with(changes: &[(usize, &str)]) -> (String, String) { + let mut settings = ["1", "1", "0", "1", "0", "0", "0", "1", "1", "0", "0", "0", "0", "1"]; + for (i, v) in changes { + settings[*i] = v; + } + let brush = format!("2 / Ribbon art/ / / / / 0 0/ 5 0 0 0 / 1 {}", settings.join(" ")); + let entries: Vec<(&str, &str, &str)> = ART_KEYS.iter().zip(settings).map(|((key, kind), value)| (*key, value, *kind)).collect(); + (format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", &brush)), art_style("Ribbon", 1.0, &entries, "")) +} + +/// A path with an Art brush whose settings are its own comes in brushed, the brush with those +/// settings: None, another width (the lowest and highest widths aren't drawn while the width is +/// fixed), flipped along or across, and Stretch Between Guides, whose guides come in as fractions of +/// the art as it runs along the path (measured before it is flipped along it, so a flip along swaps +/// them). Lengths without Stretch Between Guides aren't guides. A brush that scales its art +/// proportionately comes into the panel with that option, and its path keeps its drawn look. +#[test] +fn an_art_brush_with_options_comes_in_brushed_with_them() { + use vectorcraft_brush::{ArtBrush, ArtScale, Colorization}; + let check_file = |why: &str, (def, style): (String, String), want: &dyn Fn(&ArtBrush) -> bool| { + let r = read_ok(&format!("{def}{style}{}", layer(&brushed_path()))); + let a = art(&r.doc); + assert!(matches!(a[0].kind, NodeKind::Path { .. }), "{why}: the path, not its look: {a:#?}"); + assert_eq!(a[0].appearance.stroke().and_then(|s| s.brush.as_deref()), Some("Ribbon"), "{why}"); + let lib = vectorcraft_brush::library(&r.doc); + let vectorcraft_brush::BrushKind::Art(brush) = brush_named(&lib, "Ribbon") else { panic!("{why}: art") }; + assert!(want(brush), "{why}: {brush:?}"); + r + }; + let check = |why: &str, changes: &[(usize, &str)], want: &dyn Fn(&ArtBrush) -> bool| check_file(why, ribbon_with(changes), want); + let near = |a: f64, b: f64| (a - b).abs() < 1e-9; + // Settings that don't draw may differ between the brush and the path: the lowest and highest + // width while the width is fixed, and lengths without Stretch Between Guides. + let (def, style) = ribbon_with(&[(1, "2"), (7, "2"), (8, "2")]); + let style = style.replace("2 /Real (MinScaling) ,\n", "").replace("2 /Real (MaxScaling) ,\n", ""); + check_file("the path leaves out the widths the pen would give", (def, style), &|b| b.width == 200.0); + let (def, _) = ribbon_with(&[]); + let (_, style) = ribbon_with(&[(11, "5"), (12, "10")]); + check_file("lengths on the path alone", (def, style), &|b| b.scale == ArtScale::Stretch); + check("its art's colors", &[(0, "0")], &|b| b.colorization == Colorization::None); + check("twice as wide", &[(1, "2"), (7, "2"), (8, "2")], &|b| b.width == 200.0); + check("half as wide, the pen's widths left", &[(1, "0.5")], &|b| b.width == 50.0 && b.width_mode.is_none()); + let along = check("flipped along", &[(4, "1")], &|b| b.flip_along && !b.flip_across); + let across = check("flipped across", &[(5, "1")], &|b| b.flip_across && !b.flip_along); + let (def, style) = ribbon_with(&[(6, "1")]); + let r = read_ok(&format!("{def}{style}{}", layer(&brushed_path()))); + assert!(matches!(art(&r.doc)[0].kind, NodeKind::Group { .. }), "proportional: the drawn look"); + let lib = vectorcraft_brush::library(&r.doc); + let vectorcraft_brush::BrushKind::Art(brush) = brush_named(&lib, "Ribbon") else { panic!("proportional: art") }; + assert_eq!(brush.scale, ArtScale::Proportional); + check( + "between guides", + &[(10, "1"), (11, "5"), (12, "10")], + &|b| matches!(b.scale, ArtScale::BetweenGuides { start, end } if near(start, 5.0 / 40.0) && near(end, 30.0 / 40.0)), + ); + check("between guides, flipped along", &[(10, "1"), (11, "5"), (12, "10"), (4, "1")], &|b| { + b.flip_along && matches!(b.scale, ArtScale::BetweenGuides { start, end } if near(start, 10.0 / 40.0) && near(end, 35.0 / 40.0)) + }); + check("lengths without guides", &[(11, "5"), (12, "10")], &|b| b.scale == ArtScale::Stretch); + // Along a straight line, y down: unflipped, the wide block is above the line and the narrow one + // below it, at the start. + let line = kurbo::BezPath::from_vec(vec![kurbo::PathEl::MoveTo(Point::new(0.0, 0.0)), kurbo::PathEl::LineTo(Point::new(100.0, 0.0))]); + let filled = |r: &Structure, x: f64, y: f64| { + let lib = vectorcraft_brush::library(&r.doc); + let st = art(&r.doc)[0].appearance.stroke().cloned().unwrap(); + let ribbon = lib.iter().find(|b| b.name == "Ribbon").unwrap(); + let pieces = vectorcraft_brush::stroke_pieces(&r.doc, ribbon, &line, &st); + pieces.iter().any(|n| { + let mut hit = false; + n.walk(&mut |c| hit |= c.path_data().is_some_and(|p| kurbo::Shape::winding(&p.to_bezpath(), Point::new(x, y)) != 0)); + hit + }) + }; + // At weight 1 the art is 8 across: each block is 4 across, on its side of the line. + assert!(filled(&across, 50.0, 2.0) && filled(&across, 10.0, -2.0) && !filled(&across, 50.0, -2.0), "across: the wide block below"); + assert!(filled(&along, 50.0, -2.0) && filled(&along, 90.0, 2.0) && !filled(&along, 10.0, 2.0), "along: the narrow block at the end"); +} + /// An Art brushed path keeps its drawn look when the brush wouldn't draw it the way the file does: -/// its settings aren't those of art that stretches along the path at the brush's own width and -/// color, the brush's own aren't, its art isn't read, or the brush isn't one the panel keeps. +/// its settings differ from the brush's, the brush's are ones VectorCraft doesn't draw as the file +/// does, its art isn't read, or the brush isn't one the panel keeps. #[test] fn an_art_brushed_path_the_brush_cant_draw_keeps_its_drawn_look() { let good = format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", RIBBON)); @@ -10486,21 +10682,7 @@ fn an_art_brushed_path_the_brush_cant_draw_keeps_its_drawn_look() { ), plain_style.clone(), ), - ( - "a width other than the brush's 100%", - format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", wide)), - art_style( - "Ribbon", - 1.0, - &STRETCHED.map(|e| if matches!(e.0, "Scaling" | "MinScaling" | "MaxScaling") { (e.0, "2", e.2) } else { e }), - "", - ), - ), - ( - "a brush that keeps its art's colors", - format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", own_colors)), - art_style("Ribbon", 1.0, &STRETCHED.map(|e| if e.0 == "Colorization" { (e.0, "0", e.2) } else { e }), ""), - ), + ("a brush that keeps its art's colors, the path in Tints", format!("{}{}", lopsided_art("Ribbon art"), plugin_object(ART_BRUSH, "Ribbon", own_colors)), plain_style.clone()), ("an entry that isn't read", good.clone(), art_style("Ribbon", 1.0, &STRETCHED, "1 /Int (SomeOtherSetting) ,\n")), ( "an effect on the path", @@ -10513,17 +10695,16 @@ fn an_art_brushed_path_the_brush_cant_draw_keeps_its_drawn_look() { ("proportional", good.clone(), style_with("Proportional", "1")), ("between guides", good.clone(), style_with("Segmented", "1")), ("its own width", good.clone(), style_with("Scaling", "2")), - ("a width that varies", good.clone(), style_with("MaxScaling", "2")), ("a width on the pen", good.clone(), style_with("ScaleYDependsOn", "2")), ("spacing", good.clone(), style_with("Spacing", "1")), - ("flipped", good.clone(), style_with("UpsideDown", "1")), + ("a spacing close to the brush's 0", good.clone(), style_with("Spacing", "0.0005")), + ("flipped",good.clone(), style_with("UpsideDown", "1")), ("flipped the other way", good.clone(), style_with("Counterclockwise", "1")), ("another adjustment", good.clone(), style_with("Adjustment", "2")), ("no fold adjustment", good.clone(), style_with("FoldAdjustment", "0")), ("its own colorization", good.clone(), style_with("Colorization", "0")), ("tints and shades", good.clone(), style_with("Colorization", "2")), ("hue shift", good.clone(), style_with("Colorization", "3")), - ("start of a guide", good.clone(), art_style("Ribbon", 1.0, &STRETCHED, "5 /Real (StartSegmentLength) ,\n")), ("variable width", good.clone(), art_style("Ribbon", 1.0, &STRETCHED, "2 /Int (BSWidthSource) ,\n")), ( "width arrays", @@ -10540,6 +10721,35 @@ fn an_art_brushed_path_the_brush_cant_draw_keeps_its_drawn_look() { ("art not read", plugin_object(ART_BRUSH, "Ribbon", RIBBON), plain_style.clone()), ("no such brush", good.clone(), art_style("Other", 1.0, &STRETCHED, "")), ]; + // The brush's own settings, which the path shares, but VectorCraft doesn't draw as the file does. + let own = [ + ("both brush and path: tints and shades", &[(0, "2")][..]), + ("both: hue shift", &[(0, "3")]), + ("both: spacing", &[(2, "1")]), + ("both: another adjustment", &[(3, "2")]), + ("both: no fold adjustment", &[(13, "0")]), + ("both: a width on the pen", &[(9, "1"), (7, "0.5"), (8, "2")]), + ("both: a width past the range", &[(1, "20"), (7, "20"), (8, "20")]), + ("both: a flip of another value", &[(4, "2")]), + ("both: proportional", &[(6, "1")]), + ("both: proportional and between guides", &[(6, "1"), (10, "1"), (11, "5"), (12, "10")]), + ("both: guides that leave no art between them", &[(10, "1"), (11, "30"), (12, "10")]), + ("both: a guide past the start", &[(10, "1"), (11, "-5"), (12, "10")]), + ]; + let mut cases: Vec<(&str, String, String)> = cases + .into_iter() + .chain(own.iter().map(|(why, changes)| { + let (def, style) = ribbon_with(changes); + (*why, def, style) + })) + .collect(); + // The brush's guides leave art between them, and the path's, close to them, leave none. + let (def, style) = ribbon_with(&[(10, "1"), (11, "20"), (12, "19.99")]); + cases.push(("path guides close to the brush's that leave no art between them", def, style.replace("19.99 /", "20 /"))); + // On art 0.01 long, a guide at 0.0035 is 35% of the way along it, and the brush's at 0.003 is 30%. + let (def, style) = ribbon_with(&[(10, "1"), (11, "0.003"), (12, "0.002")]); + let short = format!("%AI8_BeginBrushPattern\n(Ribbon art)\n0 A\n0 g\n{}f\n%AI8_EndBrushPattern\n", rect_path(0.0, 0.0, 0.01, 4.0)); + cases.push(("path guides elsewhere on short art", def.replace(&lopsided_art("Ribbon art"), &short), style.replace("0.003 /", "0.0035 /"))); let mut wrong = vec![]; for (why, def, style) in cases { let r = read_ok(&format!("{def}{style}{}", layer(&brushed_path()))); diff --git a/crates/eps/src/import/ate.rs b/crates/eps/src/import/ate.rs index 8d01b141d0..28994527a7 100644 --- a/crates/eps/src/import/ate.rs +++ b/crates/eps/src/import/ate.rs @@ -26,8 +26,8 @@ use std::collections::{BTreeMap, HashMap}; use kurbo::{BezPath, CubicBez, ParamCurve, ParamCurveArclen}; use vectorcraft_color::{Color, Paint}; use vectorcraft_doc::{ - CharStyle, HyphenationOptions, JustificationOptions, Justify, LineCap, LineJoin, Node, NodeId, NodeKind, ParaDirection, ParaStyle, PathAlign, - PathEffect, TabAlign, TabStop, TextKind, TextObject, TextRun, + Burasagari, CharStyle, HyphenationOptions, JustificationOptions, Justify, Kinsoku, KinsokuShoriType, LineCap, LineJoin, Node, NodeId, NodeKind, + ParaDirection, ParaStyle, PathAlign, PathEffect, TabAlign, TabStop, TextKind, TextObject, TextRun, }; use vectorcraft_geom::{Affine, PathData, Point, Rect}; @@ -405,6 +405,42 @@ struct Para { tabs: Vec, /// The paragraph has more than [`MAX_TABS`] stops: those past them were left out. tabs_truncated: bool, + /// Key 27: the Kinsoku set, `/nil` for None, else the index of one of the document's sets + /// ([`Texts::kinsoku_sets`]). `None`: the default. + kinsoku: Option, + /// Key 27 names a set of the document that isn't Hard or Soft: the paragraph takes the set it + /// would have without it. + kinsoku_custom: bool, + /// Key 25: Kinsoku Shori Type, 0 Push In First, 1 Push Out First, 2 Push Out Only. `None`: the + /// default. + kinsoku_type: Option, + /// Key 24: Burasagari, 0 None, 1 Regular, 2 Force. `None`: the default. + burasagari: Option, + /// Key 23: Bunri-Kinshi. + bunri_kinshi: bool, +} + +/// The name of the document's predefined Hard Kinsoku set (key 0 of its entry in the document's +/// Kinsoku sets). +const KINSOKU_HARD: &str = "PhotoshopKinsokuHard"; +/// The name of the document's predefined Soft Kinsoku set. +const KINSOKU_SOFT: &str = "PhotoshopKinsokuSoft"; +/// The warning when a paragraph's Kinsoku set is one VectorCraft doesn't have. +pub(crate) const KINSOKU_SETS_LEFT_OUT: &str = "custom Kinsoku sets were left out: their paragraphs take the set their paragraph style has"; + +/// The Kinsoku sets of text document `doc` (the list at key 0 of key 4 of its resources), in +/// order, each by its name (key 0 of the set): Hard or Soft, `None` for any other set. Those past +/// [`MAX_SHEETS`] are left out. +fn kinsoku_sets(doc: &Val) -> Vec> { + let list = doc.get("0").and_then(|d| d.get("4")).and_then(|s| s.get("0")).map(Val::list).unwrap_or_default(); + list.iter() + .take(MAX_SHEETS) + .map(|s| match s.get("0").and_then(|r| r.get("0")).and_then(Val::str) { + Some(KINSOKU_HARD) => Some(Kinsoku::Hard), + Some(KINSOKU_SOFT) => Some(Kinsoku::Soft), + _ => None, + }) + .collect() } /// Most tab stops read for one paragraph. @@ -542,6 +578,9 @@ pub(super) struct Texts { /// The patterns that paint characters, by the name of the art style that gives each /// ([`Self::with_patterns`]). patterns: HashMap, + /// The document's Kinsoku sets (key 4 of its resources), in order, each by its name (key 0): + /// Hard or Soft, `None` for any other set. + kinsoku_sets: Vec>, } impl Texts { @@ -611,6 +650,7 @@ impl Texts { para_sheets: sheets("6"), frames: doc.get("0")?.get("8")?.get("0")?.list().to_vec(), patterns: HashMap::new(), + kinsoku_sets: kinsoku_sets(&doc), }) } @@ -749,7 +789,37 @@ impl Texts { chain.extend(self.para_sheets.first().and_then(|s| s.get("5"))); let pick = |k: &str| chain.iter().find_map(|s| s.get(k)).or_else(|| self.para_defaults.get(k)); let num = |k: &str| pick(k).and_then(Val::num).filter(|v| v.abs() < 1e5).unwrap_or(0.0); + // The East Asian settings: the first value along the chain that can be read, so one that + // can't be read takes the paragraph style's. + let levels = || chain.iter().copied().chain(std::iter::once(&self.para_defaults)); + let choice = |k: &str| { + levels().find_map(|s| match s.get(k) { + Some(Val::Num(v)) if *v == 0.0 || *v == 1.0 || *v == 2.0 => Some(*v as u8), + _ => None, + }) + }; + let set = |v: &Val| match v { + Val::Name(n) if n == "nil" => Some(Some(Kinsoku::None)), + Val::Num(i) if *i >= 0.0 && i.fract() == 0.0 => self.kinsoku_sets.get(*i as usize).copied(), + _ => None, + }; Para { + kinsoku: levels().find_map(|s| s.get("27").and_then(set).flatten()), + kinsoku_custom: levels().find_map(|s| s.get("27").and_then(set)).is_some_and(|k| k.is_none()), + kinsoku_type: choice("25").map(|v| match v { + 0 => KinsokuShoriType::PushInFirst, + 1 => KinsokuShoriType::PushOutFirst, + _ => KinsokuShoriType::PushOutOnly, + }), + burasagari: choice("24").map(|v| match v { + 0 => Burasagari::None, + 1 => Burasagari::Standard, + _ => Burasagari::Forced, + }), + bunri_kinshi: levels().find_map(|s| match s.get("23") { + Some(Val::Bool(b)) => Some(*b), + _ => None, + }) == Some(true), justify: pick("0").and_then(Val::num).map_or(0, |v| v.clamp(0.0, 6.0) as u8), rtl: pick("33").and_then(Val::num) == Some(1.0), first_indent: num("1"), @@ -1264,6 +1334,11 @@ impl Story { self.tabs_left_out.get() } + /// Does a paragraph have a Kinsoku set VectorCraft doesn't have ([`Para::kinsoku_custom`])? + pub(super) fn kinsoku_sets_left_out(&self) -> bool { + self.paras.iter().any(|(_, p)| p.kinsoku_custom) + } + /// Area type (`node`, the story's first frame as [`Self::node`] makes it with `template` and /// `to_doc`) whose first line the file lays out higher or lower than it is laid out here, as its /// page draws it: its first baseline is fixed where the file has it. The font's ascent below the @@ -1425,6 +1500,10 @@ fn para_style(p: &Para, scale: f64) -> ParaStyle { auto_leading: p.auto_leading.map_or(JustificationOptions::default().auto_leading, |a| (a * 1e6).round() / 1e4), ..JustificationOptions::default() }, + kinsoku: p.kinsoku.unwrap_or_default(), + kinsoku_type: p.kinsoku_type.unwrap_or_default(), + burasagari: p.burasagari.unwrap_or_default(), + bunri_kinshi: p.bunri_kinshi, ..ParaStyle::default() } } @@ -1496,6 +1575,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let justify = |own: &[u8]| para_style(&texts.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), 1.0).justify; // Right to left from the document's defaults, or the paragraph's own. @@ -1520,6 +1600,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let auto = |own: &[u8]| para_style(&texts.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), 1.0).justification.auto_leading; assert_eq!(auto(b""), JustificationOptions::default().auto_leading); @@ -1543,6 +1624,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let options = |own: &[u8], scale: f64| para_style(&texts.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), scale).hyphenation; let want = HyphenationOptions { words_longer_than: 6, after_first: 2, before_last: 2, hyphen_limit: 0, zone: 36.0, capitalized: true }; @@ -1561,12 +1643,93 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let own = |own: &[u8]| para_style(&bare.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), 1.0).hyphenation; assert_eq!(own(b""), d); assert_eq!(own(b"/10 0 /11 99 /12 2.5 /13 -1 /14 -3 /15 1"), d); } + /// The document's Kinsoku sets are known by their names, in order: the predefined Hard and + /// Soft sets, in either string form, and any other set as one VectorCraft doesn't have. + #[test] + fn the_documents_kinsoku_sets_are_known_by_name() { + let utf16: Vec = b"(\xfe\xff".iter().copied().chain(KINSOKU_SOFT.bytes().flat_map(|c| [0, c])).chain(*b")").collect(); + let doc = read( + &[ + b"/0 << /4 << /0 [ << /0 << /0 (PhotoshopKinsokuHard) /5 << /4 1 >> >> >> << /0 << /0 ".as_slice(), + &utf16, + b" >> >> << /0 << /0 (My Set) >> >> << /0 << >> >> ] >> >>", + ] + .concat(), + ) + .unwrap(); + assert_eq!(kinsoku_sets(&doc), [Some(Kinsoku::Hard), Some(Kinsoku::Soft), None, None]); + assert_eq!(kinsoku_sets(&read(b"/0 << >>").unwrap()), []); + } + + /// Keys 23 to 27 are the paragraph's East Asian settings: Bunri-Kinshi (23), Burasagari (24: + /// 0 None, 1 Regular, 2 Force), Kinsoku Shori Type (25: 0 Push In First, 1 Push Out First, 2 + /// Push Out Only) and the Kinsoku set (27: `/nil` for None, else the index of one of the + /// document's sets). A value that can't be read, and a set VectorCraft doesn't have, take the + /// paragraph style's, or else the document's. + #[test] + fn a_paragraph_keeps_its_east_asian_settings() { + let texts = Texts { + stories: vec![], + fonts: vec![], + defaults: Val::Dict(BTreeMap::new()), + para_defaults: read(b"/27 0 /25 2 /24 0 /23 false").unwrap(), + char_sheets: vec![], + // [Normal Paragraph Style] has the Soft set; the second style has Force burasagari. + para_sheets: vec![read(b"/5 << /27 1 >>").unwrap(), read(b"/5 << /24 2 /23 true >>").unwrap()], + frames: vec![], + patterns: HashMap::new(), + kinsoku_sets: vec![Some(Kinsoku::Hard), Some(Kinsoku::Soft), None], + }; + let para = |run: &[u8]| texts.para(Some(&read(run).unwrap())); + let settings = |run: &[u8]| { + let p = para_style(¶(run), 1.0); + (p.kinsoku, p.kinsoku_type, p.burasagari, p.bunri_kinshi) + }; + let normal = (Kinsoku::Soft, KinsokuShoriType::PushOutOnly, Burasagari::None, false); + assert_eq!(settings(b"/5 << >>"), normal); + assert_eq!(settings(b"/5 << /27 /nil /25 0 /24 1 /23 true >>"), (Kinsoku::None, KinsokuShoriType::PushInFirst, Burasagari::Standard, true)); + assert_eq!(settings(b"/5 << /27 0 /25 1 /24 2 >>"), (Kinsoku::Hard, KinsokuShoriType::PushOutFirst, Burasagari::Forced, false)); + // The paragraph style it is based on (key 6), then [Normal Paragraph Style]. + assert_eq!(settings(b"/5 << >> /6 1"), (Kinsoku::Soft, KinsokuShoriType::PushOutOnly, Burasagari::Forced, true)); + assert_eq!(settings(b"/5 << /23 false >> /6 1"), (Kinsoku::Soft, KinsokuShoriType::PushOutOnly, Burasagari::Forced, false)); + // A set VectorCraft doesn't have takes the paragraph style's, and the paragraph says so. + assert_eq!(settings(b"/5 << /27 2 >>"), normal); + assert!(para(b"/5 << /27 2 >>").kinsoku_custom); + assert!(!para(b"/5 << /27 0 >>").kinsoku_custom && !para(b"/5 << >>").kinsoku_custom); + // The story warns of it (the importer's warning). + assert!(story("あ\r", &[0.0], ¶(b"/5 << /27 2 >>")).kinsoku_sets_left_out()); + assert!(!story("あ\r", &[0.0], ¶(b"/5 << /27 1 >>")).kinsoku_sets_left_out()); + for unreadable in [ + b"/5 << /27 3 >>".as_slice(), + b"/5 << /27 -1 >>", + b"/5 << /27 0.5 >>", + b"/5 << /27 (PhotoshopKinsokuHard) >>", + b"/5 << /27 /Hard >>", + b"/5 << /25 3 >>", + b"/5 << /25 1.5 >>", + b"/5 << /25 -1 >>", + b"/5 << /24 /nil >>", + b"/5 << /24 true >>", + b"/5 << /23 1 >>", + b"/5 << /23 /nil >>", + ] { + assert_eq!(settings(unreadable), normal, "{}", String::from_utf8_lossy(unreadable)); + assert!(!para(unreadable).kinsoku_custom, "{}", String::from_utf8_lossy(unreadable)); + } + // Without any of the keys, VectorCraft's defaults. + let bare = Texts { para_defaults: Val::Dict(BTreeMap::new()), para_sheets: vec![], kinsoku_sets: vec![], ..texts }; + let p = para_style(&bare.para(Some(&read(b"/5 << >>").unwrap())), 1.0); + let d = ParaStyle::default(); + assert_eq!((p.kinsoku, p.kinsoku_type, p.burasagari, p.bunri_kinshi), (d.kinsoku, d.kinsoku_type, d.burasagari, d.bunri_kinshi)); + } + /// Key 30 holds the paragraph's tab stops: their positions (key 0), sorted, and alignments (key /// 1: 0 left, 1 center, 2 right, 3 decimal), scaled as sizes are. A stop that can't be read is /// left out. A user's price list keeps a right stop at 269.29 and a left one at 272.13. @@ -1581,6 +1744,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let tabs = |own: &[u8], scale: f64| { para_style(&texts.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), scale) @@ -1648,6 +1812,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], } .para(None); let mut s = story(" 80 mm ", &[0.0], ¶); @@ -1696,6 +1861,7 @@ mod tests { para_sheets: vec![], frames: cases.iter().map(|c| frame(c)).collect(), patterns: HashMap::new(), + kinsoku_sets: vec![], }; let vertical: Vec = (0..cases.len() + 1).map(|i| texts.frame_vertical(i)).collect(); assert_eq!(vertical, [true, false, false, false, false, false, false, false, false, false, false]); @@ -1714,6 +1880,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let tcy = |run: &[u8]| texts.style(Some(&read(run).unwrap())).tate_chu_yoko; assert!(tcy(b"/6 << /35 3 >>"), "the run's own"); @@ -1738,6 +1905,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let roman = |defaults: &[u8], run: &[u8]| texts(defaults).style(Some(&read(run).unwrap())).standard_vertical_roman; assert!(roman(b"/35 1", b"/6 << >>"), "the document's defaults"); @@ -1769,6 +1937,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let stroke = |run: &[u8]| { let s = char_style(&texts.style(Some(&read(run).unwrap())), 1.0, Affine::IDENTITY); @@ -1811,6 +1980,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], } .with_patterns(patterns) } @@ -1894,6 +2064,7 @@ mod tests { para_sheets: vec![], frames: vec![read(b"/0 << /0 [ 0 0 ] /2 << /0 0 >> >>").unwrap()], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let text = |kerns: &[u8]| -> TextObject { let node = texts(kerns).story(0).unwrap().node(NodeId(1), 0, (0.0, 0.0), Affine::IDENTITY).unwrap(); @@ -1961,6 +2132,7 @@ mod tests { para_sheets: vec![], frames: vec![], patterns: HashMap::new(), + kinsoku_sets: vec![], }; let direction = |own: &[u8]| para_style(&texts.para(Some(&read(&[b"/5 << ", own, b" >>"].concat()).unwrap())), 1.0).direction; assert_eq!(direction(b"/0 2"), Some(ParaDirection::RightToLeft), "from the document's defaults"); @@ -2009,6 +2181,7 @@ mod tests { para_sheets: vec![], frames: vec![read(doc.as_bytes()).unwrap()], patterns: HashMap::new(), + kinsoku_sets: vec![], }; texts.frame(0) } @@ -2667,6 +2840,7 @@ mod tests { para_sheets: vec![], frames: vec![read(doc.as_bytes()).unwrap()], patterns: HashMap::new(), + kinsoku_sets: vec![], }; texts.frame(0).unwrap() } diff --git a/crates/eps/src/import/native/plan.rs b/crates/eps/src/import/native/plan.rs index eaa50b6bbf..005b89397e 100644 --- a/crates/eps/src/import/native/plan.rs +++ b/crates/eps/src/import/native/plan.rs @@ -59,7 +59,7 @@ pub(super) fn make_slots( to_doc: Affine, warn: &mut Vec, ) -> Vec> { - let (mut taller, mut deeper, mut tabs_left_out) = (0, 0, false); + let (mut taller, mut deeper, mut tabs_left_out, mut kinsoku_left_out) = (0, 0, false, false); let made = infos .iter() .enumerate() @@ -68,6 +68,7 @@ pub(super) fn make_slots( let story = stories.get(k)?.as_ref()?; let mut node = story.node(NodeId(0), info.frame, t, to_doc)?; tabs_left_out |= story.tabs_left_out(); + kinsoku_left_out |= story.kinsoku_sets_left_out(); let mut region = story.region(t, to_doc); // The first line where the file has it, in the text document's frame (that of a // copied object is its original's, as its lines are). @@ -102,6 +103,9 @@ pub(super) fn make_slots( if tabs_left_out { warn.push(crate::import::ate::TABS_LEFT_OUT.into()); } + if kinsoku_left_out { + warn.push(crate::import::ate::KINSOKU_SETS_LEFT_OUT.into()); + } made } diff --git a/crates/eps/src/import/predefined_cmap.rs b/crates/eps/src/import/predefined_cmap.rs index c688ebf9ae..46890af653 100644 --- a/crates/eps/src/import/predefined_cmap.rs +++ b/crates/eps/src/import/predefined_cmap.rs @@ -279,6 +279,7 @@ fn code_space(cmap: &str) -> Option { const CNS_EUC: CodeSpace = &[(b"\x00", b"\x80"), (b"\xa1\xa1", b"\xfe\xfe"), (b"\x8e\xa1\xa1\xa1", b"\x8e\xa3\xfe\xfe")]; const KSC_PC: CodeSpace = &[(b"\x00", b"\x84"), (b"\xfe", b"\xff"), (b"\xa1\x41", b"\xfd\xfe")]; const UHC: CodeSpace = &[(b"\x00", b"\x80"), (b"\x81\x41", b"\xfe\xfe")]; + const JOHAB: CodeSpace = &[(b"\x00", b"\x80"), (b"\x84\x41", b"\xd3\xfe"), (b"\xd8\x31", b"\xde\xfe"), (b"\xe0\x31", b"\xf9\xfe")]; let stem = match cmap { "H" | "V" => "", _ => cmap.strip_suffix("-H").or_else(|| cmap.strip_suffix("-V"))?, @@ -301,6 +302,7 @@ fn code_space(cmap: &str) -> Option { "CNS-EUC" => CNS_EUC, "KSCpc-EUC" => KSC_PC, "KSCms-UHC" => UHC, + "KSC-Johab" => JOHAB, _ => return None, }) } diff --git a/crates/eps/src/import/tests_cid.rs b/crates/eps/src/import/tests_cid.rs index 8350cd514b..f63a77e09b 100644 --- a/crates/eps/src/import/tests_cid.rs +++ b/crates/eps/src/import/tests_cid.rs @@ -677,6 +677,10 @@ fn latin_names_ending_in_h_and_cmaps_that_cannot_be_read() { "/Ryumin-Light-GBT-H findfont 20 scalefont setfont <09092121> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and", // A byte that starts no row-and-cell code is a code of its own, also before a tab: three. "/Ryumin-Light-GBT-H findfont 20 scalefont setfont <21092121> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and", + // In the Johab code space each ASCII byte is a one-byte code and a Hangul code takes two + // bytes: three codes, across and down. + "/Ryumin-Light-KSC-Johab-H findfont 20 scalefont setfont <41428441> stringwidth abs 0.01 lt exch 60 sub abs 0.01 lt and", + "/Ryumin-Light-KSC-Johab-V findfont 20 scalefont setfont 10 100 moveto <41428441> show currentpoint 40 sub abs 0.01 lt exch 10 sub abs 0.01 lt and", ] { let r = super::tests::read(&format!("{cond} {{ 0 0 10 10 rectfill }} if")); assert!(all(&r.document).iter().any(|n| matches!(n.kind, NodeKind::Path { .. })), "{cond}"); diff --git a/crates/eps/src/legacy_ai/tests.rs b/crates/eps/src/legacy_ai/tests.rs index 15d7d07152..663e21bec6 100644 --- a/crates/eps/src/legacy_ai/tests.rs +++ b/crates/eps/src/legacy_ai/tests.rs @@ -658,6 +658,47 @@ fn images_are_written_in_the_form_the_specification_shows() { assert!(rgb.iter().zip([247.0, 148.0, 29.0]).all(|(c, want)| (c * 255.0 - want).abs() < 0.1), "{rgb:?}"); } +/// The pieces of an image cut into a raster mesh warp (as Object › Expand leaves a Warp on an +/// image) are written as the image whole once, then each as the part of it that its triangle shows, +/// and the file draws as the document does ([`write`] runs it). +#[test] +fn the_pieces_of_a_warped_image_are_written_as_the_parts_they_show() { + // GUARDS: each of a warped image's 200 pieces was written with all of the image's samples. + let mut doc = Document::new(200.0, 160.0); + let mut png = vec![]; + image::RgbaImage::from_fn(64, 64, |x, y| image::Rgba([(x * 4) as u8, (y * 4) as u8, ((x * 7 + y * 13) % 256) as u8, 255])) + .write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png) + .unwrap(); + let blob = ImageBlob::new("image/png", png); + let key = blob.content_key(); + doc.images.insert(key.clone(), blob); + let im = ImageObject { + key, + width: 64, + height: 64, + xf: Affine::new([2.0, 0.0, 0.0, 2.0, 20.0, 10.0]), + link: None, + placement: Default::default(), + pixels: None, + }; + let photo = Node::new(doc.alloc_id(), NodeKind::Image(Box::new(im.clone()))); + let bend = |p: vectorcraft_geom::Point| vectorcraft_geom::Point::new(p.x, p.y + 12.0 * ((p.x - 20.0) / 128.0 * std::f64::consts::PI).sin()); + let warped = vectorcraft_doc::live::mesh_warp_image(&photo, &im, &bend, 10, false, false); + let layer = doc.layers[0].id; + doc.insert(Some(layer), usize::MAX, warped).unwrap(); + let text = String::from_utf8(write(&doc).bytes).unwrap(); + let images = rasters(&text); + assert_eq!(images.len(), 200); + let digits = |lines: &Vec<&str>| { + lines.iter().filter_map(|l| l.strip_prefix('%')).filter(|l| l.bytes().all(|b| b.is_ascii_hexdigit())).map(str::len).sum::() + }; + let whole = 64 * 64 * 3 * 2; + assert_eq!(digits(&images[0]), whole, "the first piece holds the whole image"); + // Each piece holds its cell (two triangles share one) and 2 pixels more around it. + let total: usize = images.iter().map(digits).sum(); + assert!(total < 10 * whole, "{total} digits of samples for an image of {whole}"); +} + /// An image whose data is empty is left out with the note for empty or too large images, and an /// image whose data can't be decoded is left out with the decode note. #[test] @@ -2067,3 +2108,17 @@ fn colr_glyphs_of_outlined_type_are_vector_art() { assert!(rasters(&text).is_empty(), "no images: {text}"); assert!(text.contains("1 0 0 Xa"), "the red layer: {text}"); } + +/// An instance stained blue by its fill writes its symbol's red art in blue, as the canvas draws it. +#[test] +fn a_stained_instance_is_written_in_its_stained_color() { + let mut doc = Document::new(200.0, 100.0); + let art = shape(&mut doc, shapes::rectangle(Rect::new(0.0, 0.0, 40.0, 40.0)), red(), Paint::None); + doc.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Mark".into(), art: Arc::new(art) }); + let mut n = Node::new(doc.alloc_id(), NodeKind::SymbolInstance { symbol: "Mark".into(), xf: Affine::translate((50.0, 30.0)) }); + n.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0).into(); + let l = doc.layers[0].id; + doc.insert(Some(l), 0, n).unwrap(); + let text = String::from_utf8(write(&doc).bytes).unwrap(); + assert!(text.contains("0 0 1 Xa") && !text.contains("1 0 0 Xa"), "{text}"); +} diff --git a/crates/eps/src/legacy_ai/writer.rs b/crates/eps/src/legacy_ai/writer.rs index ad0ccbce43..0b41c3defa 100644 --- a/crates/eps/src/legacy_ai/writer.rs +++ b/crates/eps/src/legacy_ai/writer.rs @@ -45,6 +45,13 @@ pub(super) struct Writer<'a> { roman: bool, /// Inside a Kumi block `1 TY` began (Tate-chu-yoko in horizontal type). kumi: bool, + /// The outlines of the clipping groups the art being written is in, in the document. + clips: Vec, + /// The image decoded last (`None` when it can't be): the pieces of a warped image, which follow + /// one another, decode it once. + last_image: Option<(ImageBlob, Option>)>, + /// The images written whole so far, by the address of their data (which each entry keeps). + whole_images: std::collections::HashMap>>, } impl<'a> Writer<'a> { @@ -68,6 +75,9 @@ impl<'a> Writer<'a> { fonts: vec![], roman: false, kumi: false, + clips: vec![], + last_image: None, + whole_images: std::collections::HashMap::new(), } } @@ -297,7 +307,7 @@ impl<'a> Writer<'a> { self.warn(LIVE); if let Some(sym) = self.doc.symbols.iter().find(|s| &s.name == symbol) && self.nest < MAX_NEST - && let Some(mut art) = self.doc.place_symbol_art(symbol, &vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n), *xf) + && let Some(mut art) = self.doc.place_symbol_art(symbol, &vectorcraft_doc::symbol_overrides::instance_art(&sym.art, n), *xf) { art.visible = true; self.nest += 1; @@ -363,12 +373,14 @@ impl<'a> Writer<'a> { if several { self.line("*U"); } + self.clips.push(outline); if let Some(fill) = &paint.fill { self.node(fill, locked); } for c in rest { self.node(c, locked); } + self.clips.pop(); self.lock(locked); self.line("Q"); if let Some(stroke) = &paint.stroke { @@ -1037,7 +1049,8 @@ impl<'a> Writer<'a> { /// whose pixels are all black or white is written as an image mask (ImageMask 1, §8.1): its /// color as the fill, then 1-bit samples, a 0 bit for each black pixel, which takes the color, /// and a 1 bit for each white pixel, which is clear. Another colorized image is written with - /// its color in its pixels. + /// its color in its pixels. In a clipping group, an image whose pixels were written whole + /// already is written as the part of them the group shows ([`ai_ops::image_window`]). fn image(&mut self, blob: Option<&ImageBlob>, width: u32, height: u32, xf: Affine, colorize: Option<&Paint>) { let flip = Affine::new([1.0, 0.0, 0.0, -1.0, 0.0, 0.0]); let m = self.to_art * xf * flip; @@ -1048,7 +1061,7 @@ impl<'a> Writer<'a> { self.warn(LARGE_IMAGE); return; } - let Some(img) = blob.and_then(|b| image::load_from_memory(&b.bytes).ok()) else { + let Some((blob, img)) = blob.and_then(|b| Some((b, self.decoded(b)?))) else { self.warn(UNDECODED); return; }; @@ -1059,14 +1072,31 @@ impl<'a> Writer<'a> { } // The object places the image's own pixel grid (its width × height) wherever the file's is. let fit = Affine::scale_non_uniform(f64::from(width.max(1)) / f64::from(w), f64::from(height.max(1)) / f64::from(h)); - let m = self.to_art * xf * fit * flip; + let coverage = match colorize { + Some(paint) => { + let Some((_, _, coverage)) = ImageBlob::coverage(blob).filter(|(cw, ch, _)| (*cw, *ch) == (w, h)) else { + self.warn(UNDECODED); + return; + }; + Some((paint, coverage)) + } + None => None, + }; + // An image written whole already, cut to a clipping group: the part the group shows, placed + // where it is in the image (the pieces of a warped image each show a small part of the same one). + let key = Arc::as_ptr(&blob.bytes) as usize; + let window = if self.whole_images.contains_key(&key) { ai_ops::image_window(&self.clips, xf * fit, (w, h)) } else { None }; + if window.is_none() { + self.whole_images.insert(key, blob.bytes.clone()); + } + let window = window.unwrap_or([0, 0, w, h]); + let [x0, y0, x1, y1] = window; + let m = self.to_art * xf * fit * Affine::translate((f64::from(x0), f64::from(y0))) * flip; + let (w, h) = (x1 - x0, y1 - y0); // Over white. let over = |c: u8, a: u8| ((u32::from(c) * u32::from(a) + 255 * (255 - u32::from(a)) + 127) / 255) as u8; - if let Some(paint) = colorize { - let Some((_, _, coverage)) = blob.and_then(ImageBlob::coverage).filter(|(cw, ch, _)| (*cw, *ch) == (w, h)) else { - self.warn(UNDECODED); - return; - }; + if let Some((paint, coverage)) = coverage { + let coverage = ai_ops::window_samples(&coverage, img.width(), 1, window); if coverage.iter().all(|&v| v == 0 || v == 255) { let stride = (w as usize).div_ceil(8); let mut bits = vec![0xFF; stride.saturating_mul(h as usize)]; @@ -1086,7 +1116,7 @@ impl<'a> Writer<'a> { self.raster(m, &format!("0 0 {w} {h} {w} {h} 8 3 0 0 0 0"), &samples); return; } - let rgba = img.to_rgba8(); + let rgba = img.crop_imm(x0, y0, w, h).to_rgba8(); let mut samples = Vec::with_capacity(rgba.len() / 4 * 3); let mut see_through = false; for px in rgba.pixels() { @@ -1102,6 +1132,19 @@ impl<'a> Writer<'a> { self.raster(m, &format!("0 0 {w} {h} {w} {h} 8 3 0 0 0 0"), &samples); } + /// The pixels of `blob`, decoded once for images that follow one another with the same data. + fn decoded(&mut self, blob: &ImageBlob) -> Option> { + if let Some((last, img)) = &self.last_image + && Arc::ptr_eq(&last.bytes, &blob.bytes) + && last.mime == blob.mime + { + return img.clone(); + } + let img = image::load_from_memory(&blob.bytes).ok().map(Arc::new); + self.last_image = Some((blob.clone(), img.clone())); + img + } + /// An image's lines (§8.4): `%AI5_File:`, `%AI5_BeginRaster`, matrix `m` as `[ a b c d tx ty ]` /// and the numbers `operands` with `XI`, `samples` in hex on comment lines of [`HEX_LINE`] /// digits, `%AI5_EndRaster`, then `F`. diff --git a/crates/eps/src/scene.rs b/crates/eps/src/scene.rs index c20c5847a2..299d130f7d 100644 --- a/crates/eps/src/scene.rs +++ b/crates/eps/src/scene.rs @@ -92,6 +92,19 @@ struct ImageCode { } impl ImageCode { + /// A hash of everything that is written for the image: equal images have equal keys. + fn content_key(&self) -> u64 { + use std::hash::{Hash, Hasher}; + let mut h = std::collections::hash_map::DefaultHasher::new(); + (&self.prelude, &self.dict, self.filter, self.op, &self.ascii).hash(&mut h); + h.finish() + } + + /// Is everything written for `other` the same as for this image? + fn same_image(&self, other: &ImageCode) -> bool { + self.prelude == other.prelude && self.dict == other.dict && self.filter == other.filter && self.op == other.op && self.ascii == other.ascii + } + /// The operators and data that draw the image where it is placed. fn push_inline(&self, s: &mut String) { s.push_str(&self.prelude); @@ -253,6 +266,9 @@ pub(crate) struct Scene<'a> { images: HashMap>, /// The source key and solid paint together identify a colorized encoding. colorized_images: HashMap<(String, String), Option>, + /// Freeform gradients' images by [`ImageCode::content_key`] → their indices in `codes`: a field + /// encoded the same as one already kept draws from it. + fields: HashMap>, /// The encoded images. codes: Vec, /// Where in `body` each placement of an encoded image goes (in order) and the index of its code. @@ -281,6 +297,7 @@ impl<'a> Scene<'a> { brushes: None, images: HashMap::new(), colorized_images: HashMap::new(), + fields: HashMap::new(), codes: vec![], placements: vec![], pending: 0, @@ -478,7 +495,7 @@ impl<'a> Scene<'a> { _ => {} } self.note_losses(n); - let (was, placed) = (self.body.len(), self.placements.len()); + let (was, placed, codes) = (self.body.len(), self.placements.len(), self.codes.len()); match &n.kind { NodeKind::Layer { children, clip: false, .. } | NodeKind::Group { children, clip: false } => { children.iter().for_each(|c| self.node(c, false)); @@ -511,7 +528,7 @@ impl<'a> Scene<'a> { NodeKind::SymbolInstance { symbol, xf } => { if let Some(sym) = self.doc.symbols.iter().find(|s| &s.name == symbol) && self.nest < MAX_NEST - && let Some(art) = self.doc.place_symbol_art(symbol, &vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n), *xf) + && let Some(art) = self.doc.place_symbol_art(symbol, &vectorcraft_doc::symbol_overrides::instance_art(&sym.art, n), *xf) { self.nest += 1; self.node(&art, true); @@ -536,6 +553,7 @@ impl<'a> Scene<'a> { if self.size() > self.max_body { self.body.truncate(was); self.unplace(placed); + self.forget_fields(codes); self.warn(TOO_LARGE); } } @@ -913,18 +931,21 @@ impl<'a> Scene<'a> { /// process inks the stops use, in CMYK order, and the spot inks, in the order the stops name /// them. Paper white adds no ink, a gray stop is black ink, and a spot stop's process plates /// print with its ink. An off-center midpoint is a stop - /// with the inks halfway between its two stops. `None` for a gradient without a spot ink, and, - /// with a warning, for one whose inks can't be kept or that is mixed by the Perceptual method - /// or around the hue wheel; it is then written in process colors. + /// with the inks halfway between its two stops. Stop opacity is left out, so the stops that + /// color a stretch ([`vectorcraft_color::Gradient::reached_stops`]) name the inks, a spot ink + /// only above a tint of 0 or with process plates; the others are written with no ink. `None` for a gradient without a + /// spot ink, and, with a warning, for one whose inks can't be kept or that is mixed by the + /// Perceptual method or around the hue wheel; it is then written in process colors. fn ink_stops(&mut self, g: &vectorcraft_color::Gradient) -> Option<(GradientSpace, RawStops)> { let doc = self.doc; let spot_of = |s: &vectorcraft_color::GradientStop| -> Option { s.swatch.as_deref().filter(|n| doc.swatch(n).is_some_and(|w| w.spot)).map(str::to_string) }; + let reached = g.reached_stops(); // The spot inks, collected up to one more than a DeviceN space can hold. let mut names: Vec = vec![]; - for s in &g.stops { - if let Some(n) = spot_of(s) + for (s, &r) in g.stops.iter().zip(&reached) { + if let Some(n) = spot_of(s).filter(|_| r && (s.tint > 0.0 || s.plates.is_some())) && !names.contains(&n) { names.push(n); @@ -953,9 +974,10 @@ impl<'a> Scene<'a> { }; // Each stop's ink coverage: the four process inks, then one tint per spot ink. let mut inks: Vec> = Vec::with_capacity(g.stops.len()); - for s in &g.stops { + for (s, &r) in g.stops.iter().zip(&reached) { let mut v = vec![0.0; 4 + names.len()]; match spot_of(s) { + _ if !r => {} Some(n) => { if let Some(i) = names.iter().position(|m| *m == n) { v[4 + i] = unit(s.tint); @@ -1098,7 +1120,10 @@ impl<'a> Scene<'a> { // keep no swatch links: the warning [`Self::ink_stops`] gives the others. if g.gradient.method.is_hue() && g.gradient.is_spread() && g.gradient.spread == vectorcraft_color::GradientSpread::Reflect { let doc = self.doc; - if g.gradient.stops.iter().any(|s| s.swatch.as_deref().is_some_and(|n| doc.swatch(n).is_some_and(|w| w.spot))) { + let spot = |s: &vectorcraft_color::GradientStop| { + (s.tint > 0.0 || s.plates.is_some()) && s.swatch.as_deref().is_some_and(|n| doc.swatch(n).is_some_and(|w| w.spot)) + }; + if g.gradient.stops.iter().zip(g.gradient.reached_stops()).any(|(s, r)| r && spot(s)) { self.warn(SPOT_GRADIENTS_HUE); } } @@ -1364,6 +1389,14 @@ impl<'a> Scene<'a> { if !(long > 1e-9 && long.is_finite()) { return; } + let place = Affine::translate(area.origin().to_vec2()) * Affine::scale_non_uniform(area.width(), area.height()); + if !invertible(place) { + return; + } + if self.size().saturating_add(64) > self.max_body { + self.warn(TOO_LARGE); + return; + } let k = (self.doc.raster_effects_ppi / 72.0).min(MAX_FIELD_PX / long); let along = |len: f64| (len * k).ceil().clamp(1.0, MAX_FIELD_PX) as u16; let (cols, rows) = (along(area.width()), along(area.height())); @@ -1383,9 +1416,43 @@ impl<'a> Scene<'a> { let rgba: Vec = field.display_grid(area, cols, rows).flat_map(|(c, a)| [q(c[0]), q(c[1]), q(c[2]), q(a)]).collect(); self.encode_image(&rgba, w, h) }; - let place = Affine::translate(area.origin().to_vec2()) * Affine::scale_non_uniform(area.width(), area.height()); - if let Some(image) = image { - self.place_inline(&image, place); + let Some(image) = image else { return }; + let key = image.content_key(); + let found = + self.fields.get(&key).and_then(|bucket| bucket.iter().copied().find(|&i| self.codes.get(i).is_some_and(|c| c.same_image(&image)))); + let i = match found { + Some(i) => i, + None => { + // A field that can't be placed isn't kept. + if self.size().saturating_add(image.inline_len).saturating_add(64) > self.max_body { + self.warn(TOO_LARGE); + return; + } + let i = self.add_code(image); + self.fields.entry(key).or_default().push(i); + i + } + }; + self.place_image(i, place); + } + + /// Forget the field images after the first `n` codes that no placement draws any longer, last + /// first, up to the first code that is drawn or isn't a field image. + fn forget_fields(&mut self, n: usize) { + while self.codes.len() > n { + let i = self.codes.len() - 1; + let Some(code) = self.codes.get(i) else { break }; + if code.uses > 0 { + break; + } + let key = code.content_key(); + let Some(bucket) = self.fields.get_mut(&key) else { break }; + let Some(at) = bucket.iter().position(|&j| j == i) else { break }; + bucket.swap_remove(at); + if bucket.is_empty() { + self.fields.remove(&key); + } + self.codes.pop(); } } @@ -1595,21 +1662,6 @@ impl<'a> Scene<'a> { self.line("Q"); } - /// Draw `code`, an image drawn nowhere else, on the unit square mapped by `place`. - fn place_inline(&mut self, code: &ImageCode, place: Affine) { - if !invertible(place) { - return; - } - if self.size().saturating_add(code.inline_len).saturating_add(64) > self.max_body { - self.warn(TOO_LARGE); - return; - } - self.line("q"); - let _ = writeln!(self.body, "{} cm", ps::matrix(place)); - code.push_inline(&mut self.body); - self.line("Q"); - } - /// Straight RGBA pixels (`w` × `h`, rows from the top) as the operators and data that draw /// them on the unit square: in the process colour space, transparent pixels masked out at /// Level 3 (a key colour no opaque pixel has), white at Level 2; partly transparent ones over diff --git a/crates/eps/src/tests.rs b/crates/eps/src/tests.rs index c98cb9689a..3eaf476489 100644 --- a/crates/eps/src/tests.rs +++ b/crates/eps/src/tests.rs @@ -532,6 +532,66 @@ fn a_gradient_mixing_a_spot_ink_with_rgb_is_written_without_the_ink() { assert!(!out.warnings.iter().any(|w| w.contains("spot")), "{:?}", out.warnings); } +#[test] +fn gradients_name_only_the_spot_inks_of_stops_that_color_a_stretch() { + let black = |offset: f32| GradientStop::new(offset, Color::cmyk(0.0, 0.0, 0.0, 1.0)); + let paper = |offset: f32| GradientStop::new(offset, Color::cmyk(0.0, 0.0, 0.0, 0.0)); + let no_spot_space = |ps: &str| !ps.contains("(Gold Ink) cvn") && !ps.contains("/DeviceN") && !ps.contains("/Separation"); + for level in [Level::Two, Level::Three] { + // Gold Ink out of order: the stops at 0 and 0.8 cover the stretches next to it, so it + // colors nothing and has no plate. + let d = spot_gradient_doc(vec![black(0.0), black(0.8), spot_stop(0.2, "Gold Ink", GOLD, 1.0), black(0.4), black(1.0)]); + let out = export(&d, &EpsOptions { level, ..opts(&d) }, None, None).unwrap(); + let ps = text(&out); + assert_eq!(dsc(&ps, "DocumentCustomColors"), None, "{level:?}: {ps}"); + assert!(no_spot_space(&ps), "{level:?}: {ps}"); + assert!(!out.warnings.iter().any(|w| w.contains("spot")), "{level:?}: {:?}", out.warnings); + checked_page(&ps); + // Without it, Leaf Ink's tints over paper are a Separation shading. + let d = spot_gradient_doc(vec![ + spot_stop(0.0, "Leaf Ink", LEAF, 1.0), + spot_stop(0.8, "Leaf Ink", LEAF, 0.5), + spot_stop(0.2, "Gold Ink", GOLD, 1.0), + paper(0.4), + paper(1.0), + ]); + let ps = text(&export(&d, &EpsOptions { level, ..opts(&d) }, None, None).unwrap()); + assert_eq!(dsc(&ps, "DocumentCustomColors").as_deref(), Some("(Leaf Ink)"), "{level:?}: {ps}"); + assert!(ps.contains("/VCsp0 [/Separation (Leaf Ink) cvn /DeviceCMYK") && !ps.contains("(Gold Ink) cvn"), "{level:?}: {ps}"); + checked_page(&ps); + // An RGB stop out of order colors nothing either, so it keeps no ink out. + let d = spot_gradient_doc(vec![ + spot_stop(0.0, "Gold Ink", GOLD, 1.0), + spot_stop(0.8, "Gold Ink", GOLD, 0.5), + GradientStop::new(0.2, Color::rgb(0.0, 1.0, 0.0)), + paper(0.4), + paper(1.0), + ]); + let out = export(&d, &EpsOptions { level, ..opts(&d) }, None, None).unwrap(); + let ps = text(&out); + assert!(ps.contains("/VCsp0 [/Separation (Gold Ink) cvn /DeviceCMYK"), "{level:?}: {ps}"); + assert!(!out.warnings.iter().any(|w| w.contains("spot")), "{level:?}: {:?}", out.warnings); + // Gold Ink at a tint of 0 prints no ink. + let d = spot_gradient_doc(vec![spot_stop(0.0, "Gold Ink", GOLD, 0.0), black(1.0)]); + let ps = text(&export(&d, &EpsOptions { level, ..opts(&d) }, None, None).unwrap()); + assert_eq!(dsc(&ps, "DocumentCustomColors"), None, "{level:?}: {ps}"); + assert!(no_spot_space(&ps), "{level:?}: {ps}"); + } + // Gold Ink at a tint of 0 over a 30% cyan plate (a DeviceN gradient read from a PDF) keeps + // its process plate in the same space. + let plated = GradientStop { plates: Some([0.3, 0.0, 0.0, 0.0]), ..spot_stop(1.0, "Gold Ink", GOLD, 0.0) }; + let d = spot_gradient_doc(vec![GradientStop::new(0.0, Color::cmyk(0.3, 0.0, 0.0, 0.0)), plated]); + let ps = text(&export(&d, &opts(&d), None, None).unwrap()); + assert!(ps.contains("/VCdn0 [/DeviceN [/Cyan (Gold Ink) cvn ] /DeviceCMYK") && checked_page(&ps).contains("/C0 [0.3 0] /C1 [0.3 0]"), "{ps}"); + // EPS leaves stop opacity out, so a clear Gold Ink stop between clear stops is written opaque + // and keeps its plate. + let clear = |s: GradientStop| GradientStop { opacity: 0.0, ..s }; + let d = spot_gradient_doc(vec![black(0.0), clear(black(0.2)), clear(spot_stop(0.4, "Gold Ink", GOLD, 1.0)), clear(black(0.6)), black(1.0)]); + let ps = text(&export(&d, &opts(&d), None, None).unwrap()); + assert_eq!(dsc(&ps, "DocumentCustomColors").as_deref(), Some("(Gold Ink)"), "{ps}"); + assert!(ps.contains("/VCdn0 [/DeviceN [/Black (Gold Ink) cvn ] /DeviceCMYK"), "{ps}"); +} + #[test] fn spot_inks_named_all_or_none_are_written_under_names_of_their_own() { let rect = |d: &mut Document, fill: &str, stroke: &str| { @@ -1264,6 +1324,177 @@ fn the_page_limit_counts_a_repeated_images_samples_once() { assert!(page.body.len() + page.setup.len() <= inline + 1000 + 400, "{}", page.body.len()); } +/// Type whose color bitmap glyphs fit under the page limit but whose run fill passes it is left +/// out with its glyph image placements: the page is the page without that type. A glyph image +/// that other art draws once more is written inline there again, and an image that other art +/// draws twice keeps its shared samples. +#[test] +fn type_taken_back_for_the_page_limit_takes_its_glyph_images_with_it() { + use vectorcraft_doc::{CharStyle, TextObject}; + use vectorcraft_text::test_fonts::{COLOUR_CHAR, colour_bitmap_family, colour_bitmap_font}; + vectorcraft_text::FontDb::global().add_font(colour_bitmap_font(false).unwrap()); + let black = Paint::solid(Color::rgb(0.0, 0.0, 0.0)); + let type_node = |d: &mut Document, at: Point, text: &str, fill: Paint| { + let st = CharStyle { font_family: colour_bitmap_family(false).into(), size: 32.0, fill, ..CharStyle::default() }; + Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(at, text, st)))) + }; + // Six glyph images, then outlines enough for the fill to pass the limit. + let target = format!("{}{}", COLOUR_CHAR.to_string().repeat(6), "W".repeat(40)); + // `shared`: an image drawn twice comes first; `before`: one glyph drawn with the type's image; + // `fill`: the type's run fill (`None`: no type). A red rectangle comes last. + let build = |shared: bool, before: bool, fill: Option| { + let mut d = if shared { + let mut d = image_doc(&noise(8, 8), 1.0); + place_again(&mut d, 0, Affine::translate((40.0, 0.0))); + d + } else { + Document::new(200.0, 200.0) + }; + let mut nodes = vec![]; + if before { + nodes.push(type_node(&mut d, Point::new(20.0, 40.0), &COLOUR_CHAR.to_string(), black.clone())); + } + if let Some(fill) = fill { + nodes.push(type_node(&mut d, Point::new(20.0, 100.0), &target, fill)); + } + nodes.push(red_rect(&mut d)); + for n in nodes { + d.insert(d.default_layer(), usize::MAX, n).unwrap(); + } + d + }; + for shared in [false, true] { + for before in [false, true] { + let case = format!("shared {shared}, before {before}"); + let (without, unfilled, filled) = + (build(shared, before, None), build(shared, before, Some(Paint::None)), build(shared, before, Some(black.clone()))); + let o = opts(&filled); + let glyph = usize::from(shared); + let fits = crate::scene::Scene::new(&unfilled, &o).run(); + let full = crate::scene::Scene::new(&filled, &o).run(); + assert!(fits.warnings.is_empty() && full.warnings.is_empty(), "{case}: {:?} {:?}", fits.warnings, full.warnings); + assert_eq!(reuses(&fits.body, glyph, o.level), 6 + usize::from(before), "{case}: {}", fits.body); + assert_eq!(reuses(&full.body, glyph, o.level), 6 + usize::from(before), "{case}: {}", full.body); + let (fits_len, full_len) = (fits.body.len() + fits.setup.len(), full.body.len() + full.setup.len()); + assert!(full_len > fits_len + 2000, "{case}: {fits_len} {full_len}"); + let limit = (fits_len + full_len) / 2; + // Without its fill the type fits, every glyph image with it. + let page = crate::scene::Scene::new(&unfilled, &o).with_max_body(limit).run(); + assert!(page.warnings.is_empty(), "{case}: {:?}", page.warnings); + assert_eq!((page.setup, page.body), (fits.setup, fits.body), "{case}"); + // With it the type is taken back after its glyph images were placed. + let page = crate::scene::Scene::new(&filled, &o).with_max_body(limit).run(); + assert!(page.warnings.iter().any(|w| w.contains("too large")), "{case}: {:?}", page.warnings); + let alone = crate::scene::Scene::new(&without, &o).run(); + assert!(alone.warnings.is_empty(), "{case}: {:?}", alone.warnings); + assert_eq!(reuses(&page.body, glyph, o.level), 0, "{case}: {}", page.body); + assert!(!page.setup.contains(&format!("/VCim{glyph} ")), "{case}: {}", page.setup); + assert_eq!(page.body.matches("/Width 16 /Height 16").count(), usize::from(before), "{case}: {}", page.body); + assert_eq!(reuses(&page.body, 0, o.level), if shared { 2 } else { 0 }, "{case}: {}", page.body); + assert_eq!((&page.setup, &page.body), (&alone.setup, &alone.body), "{case}"); + checked_page(&page.body); + } + } +} + +/// A freeform gradient of `points` (x, y and color). +fn freeform(points: &[(f64, f64, Color)]) -> Paint { + let mut g = GradientPaint::new(Gradient { kind: GradientKind::Freeform, ..Default::default() }); + g.freeform = Some(Freeform { points: points.iter().map(|&(x, y, c)| FreeformPoint::new(Point::new(x, y), c)).collect(), ..Default::default() }); + Paint::Gradient(Box::new(g)) +} + +/// A square at (`x`, `y`) of side `side`, filled with a freeform gradient of `a` and `b` at a +/// fifth and four fifths of its width. +fn freeform_square(d: &mut Document, x: f64, y: f64, side: f64, a: Color, b: Color) -> Node { + let mid = y + side / 2.0; + let paint = freeform(&[(x + side / 5.0, mid, a), (x + side * 0.8, mid, b)]); + path(d, shapes::rectangle(Rect::new(x, y, x + side, y + side)), paint, Paint::None, 0.0) +} + +/// A freeform gradient on a shape and on a moved copy of it is sampled the same for both: its +/// image's samples are written once, at both levels, in RGB and in CMYK. +#[test] +fn a_freeform_gradients_image_drawn_twice_writes_its_samples_once() { + let rgb = (Color::rgb(1.0, 0.0, 0.0), Color::rgb(0.0, 0.0, 1.0)); + let cmyk = (Color::cmyk(1.0, 0.0, 0.0, 0.0), Color::cmyk(0.0, 0.0, 0.0, 1.0)); + for (a, b) in [rgb, cmyk] { + let single = doc_with(|d| vec![freeform_square(d, 0.0, 0.0, 64.0, a, b)]); + let twice = doc_with(|d| vec![freeform_square(d, 0.0, 0.0, 64.0, a, b), freeform_square(d, 64.0, 64.0, 64.0, a, b)]); + for level in Level::ALL { + let one = export(&single, &EpsOptions { level, ..opts(&single) }, None, None).unwrap(); + let one_ps = text(&one); + assert!(!one_ps.contains("VCim"), "a field drawn once is written where it is drawn: {one_ps}"); + let out = export(&twice, &EpsOptions { level, ..opts(&twice) }, None, None).unwrap(); + let ps = text(&out); + checked_page(&ps); + assert_eq!(reuses(&ps, 0, level), 2, "{ps}"); + assert!(!ps.contains("VCim1"), "{ps}"); + let body = &ps[ps.find("%%EndSetup").unwrap()..]; + assert!(!body.contains("currentfile") && !body.contains("~>"), "no samples in the page: {ps}"); + assert_eq!(reused_samples(&ps, level), inline_samples(&one_ps, level), "{level:?}"); + assert_eq!(out.warnings, one.warnings); + } + } +} + +/// Fields sampled differently are each written where they are drawn: different gradients, and one +/// gradient on shapes of different sizes. +#[test] +fn freeform_gradients_sampled_differently_dont_share_an_image() { + let (red, blue, green) = (Color::rgb(1.0, 0.0, 0.0), Color::rgb(0.0, 0.0, 1.0), Color::rgb(0.0, 1.0, 0.0)); + let colors = doc_with(|d| vec![freeform_square(d, 0.0, 0.0, 64.0, red, blue), freeform_square(d, 0.0, 0.0, 64.0, red, green)]); + let sizes = doc_with(|d| { + let paint = freeform(&[(20.0, 50.0, red), (80.0, 50.0, blue)]); + vec![ + path(d, shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 100.0)), paint.clone(), Paint::None, 0.0), + path(d, shapes::rectangle(Rect::new(0.0, 0.0, 50.0, 100.0)), paint, Paint::None, 0.0), + ] + }); + for d in [colors, sizes] { + for level in Level::ALL { + let ps = page_of(&d, &EpsOptions { level, ..opts(&d) }); + assert!(!ps.contains("VCim"), "{ps}"); + assert_eq!(ps.matches("} exec\n").count(), 2, "{ps}"); + } + } +} + +/// A field's second placement that passes the page limit is left out, and the first is written +/// where it is drawn. A field taken back with the shape that passed the limit leaves nothing in the +/// setup. +#[test] +fn a_field_taken_back_at_the_page_limit_leaves_no_image_behind() { + let (red, blue) = (Color::rgb(1.0, 0.0, 0.0), Color::rgb(0.0, 0.0, 1.0)); + let single = doc_with(|d| vec![freeform_square(d, 0.0, 0.0, 64.0, red, blue)]); + let o = opts(&single); + let inline = crate::scene::Scene::new(&single, &o).run().body; + let twice = doc_with(|d| vec![freeform_square(d, 0.0, 0.0, 64.0, red, blue), freeform_square(d, 0.0, 0.0, 64.0, red, blue)]); + let page = crate::scene::Scene::new(&twice, &o).with_max_body(inline.len() + 50).run(); + assert!(page.warnings.iter().any(|w| w.contains("too large")), "{:?}", page.warnings); + assert!(page.body.starts_with(&inline), "{}", page.body); + assert_eq!(page.body.matches("} exec\n").count(), 1, "{}", page.body); + assert!(!page.setup.contains("VCim"), "{}", page.setup); + // A many-sided shape whose stroke passes the limit after its fill's field was placed. + let big = |d: &mut Document, stroke: Paint| { + let paint = freeform(&[(60.0, 100.0, Color::rgb(0.0, 1.0, 0.0)), (140.0, 100.0, red)]); + path(d, shapes::polygon(Point::new(100.0, 100.0), 90.0, 2000, 0.0), paint, stroke, 1.0) + }; + let filled = doc_with(|d| vec![big(d, Paint::None)]); + let stroked = doc_with(|d| vec![big(d, Paint::solid(Color::rgb(0.0, 0.0, 0.0)))]); + let fill = crate::scene::Scene::new(&filled, &o).run().body.len(); + let both = crate::scene::Scene::new(&stroked, &o).run().body.len(); + assert!(both > fill + 20_000, "{fill} {both}"); + let d = doc_with(|d| { + let s = big(d, Paint::solid(Color::rgb(0.0, 0.0, 0.0))); + vec![s, freeform_square(d, 0.0, 0.0, 64.0, red, blue), freeform_square(d, 0.0, 0.0, 64.0, red, blue)] + }); + let page = crate::scene::Scene::new(&d, &o).with_max_body(fill + (both - fill) / 2).run(); + assert!(page.warnings.iter().any(|w| w.contains("too large")), "{:?}", page.warnings); + assert_eq!(reuses(&page.body, 0, Level::Three), 2, "{}", page.body); + assert!(page.setup.contains("/VCim0 VCsrc") && !page.setup.contains("VCim1"), "{}", page.setup); +} + #[test] fn run_length_and_ascii85_round_trip() { let cycle: Vec = (0..=255u8).cycle().take(1000).collect(); @@ -1390,6 +1621,20 @@ fn an_instance_whose_art_reaches_the_region_is_written() { assert!(page.contains("1 0 0 rg"), "{page}"); } +/// An instance stained blue by its fill writes its symbol's red art in blue, as the canvas draws it. +#[test] +fn a_stained_instance_is_written_in_its_stained_color() { + let mut d = doc_with(|d| { + let mut n = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Mark".into(), xf: Affine::translate((50.0, 50.0)) }); + n.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0).into(); + vec![n] + }); + let art = path(&mut d, shapes::rectangle(Rect::new(0.0, 0.0, 40.0, 40.0)), Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Mark".into(), art: Arc::new(art) }); + let page = page_of(&d, &opts(&d)); + assert!(page.contains("0 0 1 rg") && !page.contains("1 0 0 rg"), "{page}"); +} + #[test] fn an_instance_whose_brush_art_reaches_the_region_is_written() { // The symbol's art: a line from (0, 40) to (0, 60) with a 1 pt red stroke painted by a 20 pt diff --git a/crates/mcp/src/tests/fileio.rs b/crates/mcp/src/tests/fileio.rs index 3a89588ecd..b9794c8263 100644 --- a/crates/mcp/src/tests/fileio.rs +++ b/crates/mcp/src/tests/fileio.rs @@ -284,7 +284,7 @@ fn save_file_warns_about_options_it_does_not_use() { } /// The notes on `options` name the `.ai` file the save writes, as the note on a top-level option -/// does: a legacy `.ai` for `aiVersion: "7"` (beside `pdfCompatible: false` too), a +/// does: a legacy `.ai` for `aiVersion: "7"` (beside `pdfCompatible: false` too, which it notes), a /// non-PDF-compatible `.ai` for `pdfCompatible: false`, and a PDF-compatible `.ai` otherwise, also /// when the save reuses the options the document was last saved with. #[test] @@ -301,8 +301,12 @@ fn save_file_notes_name_the_ai_file_it_writes() { ("pdf.ai", json!({"pdfCompatible": true, "preview": true}), "PDF-compatible .ai"), ] { let r = text(&call_tool(&mut h, "save_file", &json!({"path": tmp(&dir, name), "version": 3, "options": options}))); - let expected = - [format!("`version` was not used: {label} files don't read it"), format!("`options.preview` was not used: {label} files don't read it")]; + // A legacy `.ai` doesn't read `pdfCompatible` either. + let unread = |k: &str| options.get(k).is_some() && (k != "pdfCompatible" || label.starts_with("legacy")); + let expected: Vec = std::iter::once("version".to_string()) + .chain(["pdfCompatible", "preview"].into_iter().filter(|k| unread(k)).map(|k| format!("options.{k}"))) + .map(|k| format!("`{k}` was not used: {label} files don't read it")) + .collect(); assert_eq!(notes(&r), expected, "{name}: {r}"); } // A save given no option the file reads writes it as last saved: a legacy `.ai` again. diff --git a/crates/mcp/src/ui_catalog.rs b/crates/mcp/src/ui_catalog.rs index e3b57166b7..e801df4a7a 100644 --- a/crates/mcp/src/ui_catalog.rs +++ b/crates/mcp/src/ui_catalog.rs @@ -666,7 +666,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "learn.list", "List Tutorials", "", - "{} the Learn panel's skills in the order its Skills tab lists them: {skills: [{id, title, tutorials: [{id, title, steps: number of steps}]}]}", + "{} the Learn panel's skills in the order its Skills tab lists them, with the progress its rings, counts and check marks show: {skills: [{id, title, done: number of its tutorials finished, total: number of its tutorials, tutorials: [{id, title, steps: number of steps, finished: bool, completedSteps: [zero-based indexes of the steps marked done, every step once finished]}]}]}", ), ( "learn.skills", @@ -692,11 +692,17 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{tutorial: id (see learn.list)} open that tutorial's practice sample as a new untitled document, which becomes the active one, and move the Learn view to the tutorial, as its View more button does; each call opens another copy and open documents stay as they are; a missing, non-string or unknown id is an error and changes nothing; returns {tutorial, index, title} of the new document", ), + ( + "learn.markStep", + "Mark Tutorial Step", + "", + "{tutorial: id (see learn.list), step: zero-based step number, complete?: bool} mark a step of a tutorial whose sample learn.openSample opened as done (true, omitted or null) or not done (false), as the check box before the step does; marking does not finish the tutorial; a missing, non-string or unknown id, a missing step or one the tutorial does not have, a complete that is not true or false, a tutorial whose sample was not opened, or a finished tutorial is an error and changes nothing; the preferences keep the marks; returns {tutorial, step, complete}", + ), ( "learn.finish", "Finish Tutorial", "", - "{tutorial: id (see learn.list)} mark a tutorial whose sample learn.openSample opened as finished, as its Finish tutorial button does; finishing it again keeps one entry; a missing, non-string or unknown id, or a tutorial whose sample was not opened, is an error and changes nothing; returns {tutorial, finished: true, next: id of the next tutorial in its skill, or null after the skill's last one}", + "{tutorial: id (see learn.list)} mark a tutorial whose sample learn.openSample opened as finished, with all its steps done, as its Finish tutorial button does; finishing it again keeps one entry, and needs no sample after a restart; a missing, non-string or unknown id, or a tutorial not finished whose sample was not opened, is an error and changes nothing; the preferences keep the tutorials finished; returns {tutorial, finished: true, next: id of the next tutorial in its skill, or null after the skill's last one}", ), ( "learn.next", @@ -704,6 +710,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{tutorial: id (see learn.list)} show the Learn panel on the tutorial after a finished one in the same skill, as its Next Up button does, without opening a sample; a missing, non-string or unknown id, a tutorial not finished, or a skill's last tutorial is an error and changes nothing; returns {skill, tutorial, title} of the next tutorial", ), + ( + "learn.resetProgress", + "Reset Learn Progress", + "", + "{} clear the Learn panel's progress, every tutorial finished and every step marked done, as Reset progress under the list of skills does; open documents, opened practice samples and the Learn view stay as they are; returns what learn.list returns", + ), ("window.brightness", "UI Brightness", "", "{brightness: dark|mediumDark|mediumLight|light}"), ( "window.workspace", @@ -1264,7 +1276,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.smoothAuto", "Auto-Smooth", "", - "{} the open Smooth slider (Object › Path › Smooth and the canvas context menu's Smooth… open it: dialog `smoothSlider` with field `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until ui.dialog.confirm keeps it as one undo step) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", + "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: dialog `smoothSlider` with field `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until ui.dialog.confirm keeps it as one undo step) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", ), ( "ui.simplifyMoreOptions", @@ -1330,7 +1342,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "file.exportAs", "Export As…", "", - "{format?, useArtboards?, range?} opens Export As (then the format's options); with {path, …document.export options} writes the file(s) → {path, warnings, files?}; under automation read roots, an SVG or SVGZ is refused while the document links a JavaScript file outside them, as document.export refuses it", + "{format?, useArtboards?, range?} opens Export As (then the format's options); with {path, …document.export options} writes the file(s) → {path, warnings, files?}; exportSelection: true writes the selection alone, cropped to it, as document.exportSelection writes it (artboard options are not used); under automation read roots, an SVG or SVGZ is refused while the document links a JavaScript file outside them, as document.export refuses it", ), ( "ui.fileInfoDialog", @@ -1465,7 +1477,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.action.new", "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), which the panel does not show. Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( "ui.action.options", @@ -1479,6 +1491,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last, ui.action.stop, or a step that comes due while a different document is active than after the step before → {results: [the first step's result], pending: the steps left}. An action with a stop, at any speed, plays up to the stop and waits until ui.action.continue or ui.action.stop; at Accelerated the steps between stops are one undoable batch each → {results, pending, atStop?: true when it already waits}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays", ), + ( + "ui.action.playAt", + "Play Action", + "", + "{set: index, action: index} play the Actions panel's action at action in set (0 is the top set) as ui.action.play plays it, and return what ui.action.play returns. A click on an action's button in Button Mode runs this. A missing index, or one that is not a whole number or is past the last set or action, is an error and nothing plays", + ), + ( + "ui.action.buttonMode", + "Button Mode", + "", + "{enabled?: bool} with true, the Actions panel shows every action of every set, in set order and then action order, as a button with its name in its Action Options color (no color: an ordinary button), without set names, steps or checkmarks, and a click on a button plays its action (ui.action.playAt); with false, it shows its list again; left out or null, it switches to the other view. The panel menu's Button Mode runs this and shows a check mark while it is on. The view is kept with the UI preferences. Turning it on while an action records, or an enabled that is not true, false or null, is an error and the view stays → {enabled}", + ), ( "ui.action.playbackOptions", "Playback Options", diff --git a/crates/metafile/src/scene.rs b/crates/metafile/src/scene.rs index ecba61ce8e..6a6fd0b61f 100644 --- a/crates/metafile/src/scene.rs +++ b/crates/metafile/src/scene.rs @@ -217,7 +217,7 @@ impl<'a> Scene<'a> { NodeKind::SymbolInstance { symbol, xf } => { if let Some(sym) = self.doc.symbols.iter().find(|s| &s.name == symbol) && self.nest < MAX_NEST - && let art = vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n) + && let art = vectorcraft_doc::symbol_overrides::instance_art(&sym.art, n) && let Some(art) = if self.clips { self.doc.place_symbol_art(symbol, &art, *xf) } else { self.doc.place_symbol_art_unclipped(symbol, &art, *xf) } { diff --git a/crates/metafile/src/tests.rs b/crates/metafile/src/tests.rs index 602db3d55f..ceb65d6fe2 100644 --- a/crates/metafile/src/tests.rs +++ b/crates/metafile/src/tests.rs @@ -399,6 +399,22 @@ fn an_instance_whose_art_reaches_the_artboard_is_written() { assert!(k.contains(&39), "a brush fills the art: {k:?}"); } +/// An instance stained blue by its fill writes its symbol's red art in blue, as the canvas draws it, +/// in EMF (clipped) and in WMF (unclipped). +#[test] +fn a_stained_instance_is_written_in_its_stained_color() { + let mut inst = Node::new(NodeId(0), NodeKind::SymbolInstance { symbol: "Mark".into(), xf: Affine::translate((30.0, 30.0)) }); + inst.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0).into(); + let mut d = doc_with(100.0, 100.0, vec![inst]); + let art = path(shapes::rectangle(Rect::new(0.0, 0.0, 40.0, 40.0)), red(), Paint::None, 0.0); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Mark".into(), art: Arc::new(art) }); + for clips in [true, false] { + let (ops, _) = crate::scene::Scene::new(&d, d.artboards[0].rect, clips).run(); + let colors: Vec<[u8; 3]> = fills(&ops).into_iter().map(|(_, rgb)| rgb).collect(); + assert_eq!(colors, [[0, 0, 255]], "clips: {clips}"); + } +} + /// A pattern `name` repeating `art` every point. fn point_tiles(name: &str, art: Node) -> PatternDef { let mut def = PatternDef::new(name, vec![Arc::new(art)]); diff --git a/crates/pathops/src/sweep_axis.rs b/crates/pathops/src/sweep_axis.rs index fb544ad163..8940515dcc 100644 --- a/crates/pathops/src/sweep_axis.rs +++ b/crates/pathops/src/sweep_axis.rs @@ -259,8 +259,9 @@ mod tests { #[test] fn offset_path_sweeps_a_long_low_path_turned_with_the_result_of_the_path_on_end() { let mut rng = Rng(17); - // Grown past the zigzag's bends, where the stroker leaves loops whose faces are dropped by - // the distance test; grown a little; and inset. + // An open zigzag grown by 1.5, a closed one grown by 0.5 and a closed one inset by 0.3. Each + // is swept turned when low and as it is when stood on end, and the two results cover the + // same region. None of the three leaves a face for the distance test to drop. for (closed, delta) in [(false, 1.5), (true, 0.5), (true, -0.3)] { let what = format!("closed {closed}, offset {delta}"); let low = zigzag(3, 300, 0.4, &mut rng, closed); @@ -274,7 +275,8 @@ mod tests { assert_same_region(&turned, &upright(&on_end), &what); } // A long plate with a row of round holes: growing it by 1 closes the narrow holes, which - // the distance test drops, and keeps the wide ones. + // the distance test drops when it measures each hole's point turned back into the plate's + // own frame, and keeps the wide ones. use kurbo::Shape; let mut plate = kurbo::Rect::new(0.0, 0.0, 4000.0, 20.0).to_path(0.1); for i in 0..200u32 { diff --git a/crates/pdf/src/export.rs b/crates/pdf/src/export.rs index 4ba4aa123d..4ba361d29b 100644 --- a/crates/pdf/src/export.rs +++ b/crates/pdf/src/export.rs @@ -46,7 +46,7 @@ use exporter::{MAX_COORD, writable, xf}; #[cfg(test)] use images::{png_8_bit, png_16_bit}; #[cfg(test)] -pub(crate) use nodes::MEASURES; +pub(crate) use nodes::{KNOCKOUT_BRUSHES, KNOCKOUT_SHAPES, MAX_KNOCKOUT_MASK_OBJECTS, MEASURES}; pub(crate) use writer::{Sheet, Writer}; pub(crate) struct Exporter<'a> { @@ -127,6 +127,14 @@ pub(crate) struct Exporter<'a> { /// The most [`Self::symbol_nodes`] may reach: [`vectorcraft_doc::MAX_SYMBOL_NODES`], or less /// while one of the copies on a sheet is drawn ([`Writer::page`]). pub(crate) symbol_limit: u64, + /// Objects the symbol instances in the copies drawn in knockout masks held, together: counted + /// apart from [`Self::symbol_nodes`], within [`vectorcraft_doc::MAX_SYMBOL_NODES`] of their own. + mask_symbol_nodes: u64, + /// Whether a knockout mask is being drawn: [`Self::symbol_nodes`] then counts + /// [`Self::mask_symbol_nodes`]. + in_knockout_mask: bool, + /// Whether a knockout mask left out symbol art because the objects its copies may hold ran out. + mask_art_left_out: bool, } #[cfg(test)] diff --git a/crates/pdf/src/export/exporter.rs b/crates/pdf/src/export/exporter.rs index 22109b3e82..f102e0a0ab 100644 --- a/crates/pdf/src/export/exporter.rs +++ b/crates/pdf/src/export/exporter.rs @@ -54,6 +54,9 @@ impl<'a> Exporter<'a> { paper: Rect::ZERO, symbol_nodes: 0, symbol_limit: vectorcraft_doc::MAX_SYMBOL_NODES, + mask_symbol_nodes: 0, + in_knockout_mask: false, + mask_art_left_out: false, overprint: false, overprinted: false, invisible: false, diff --git a/crates/pdf/src/export/images.rs b/crates/pdf/src/export/images.rs index d0158d8cd2..8110ce2db5 100644 --- a/crates/pdf/src/export/images.rs +++ b/crates/pdf/src/export/images.rs @@ -144,7 +144,8 @@ impl Exporter<'_> { self.rgb_in_cmyk.images.insert(key.to_string()); } let r = if cmyk_image { - crate::images::recode_cmyk(blob, size, c, interpolate, out.cmyk_pixels(), None) + let icc = out.cmyk_image_icc(blob); + crate::images::recode_cmyk(blob, size, c, interpolate, out.cmyk_pixels(), None, icc.as_deref()) } else { crate::images::recode(&blob.bytes, size, c, interpolate, out.pixels()) }; @@ -191,7 +192,8 @@ impl Exporter<'_> { let doc = self.doc; let img = doc.image_blob(im).filter(|b| b.is_cmyk()).and_then(|blob| { let alpha = crate::images::mask_alpha(doc.image_blob(mi)?, im.width, im.height, m.clip)?; - let r = crate::images::recode_cmyk(blob, size, self.compression, interpolate, self.out.cmyk_pixels(), Some(alpha)); + let icc = self.out.cmyk_image_icc(blob); + let r = crate::images::recode_cmyk(blob, size, self.compression, interpolate, self.out.cmyk_pixels(), Some(alpha), icc.as_deref()); if let (Some(w), Some(_)) = (r.warning, &r.image) { self.warn(w); } @@ -313,10 +315,6 @@ pub(super) fn png_8_bit(bytes: &[u8]) -> Option> { Some(png) } -/// Most pixels an image may have to be embedded: twice what the app reads (64 million), so every image -/// it holds is still written. -const MAX_EMBED_PIXELS: u64 = 1 << 27; - /// Image `blob` as it is: PNG, JPEG, GIF and WebP through the PDF writer (JPEG data unchanged), /// other formats decoded. Without `sixteen_bit` (a file before PDF 1.5), a PNG of 16 bits a /// sample is written at 8 bits ([`png_8_bit`]). @@ -324,7 +322,7 @@ pub(super) fn embed(blob: &vectorcraft_doc::ImageBlob, interpolate: bool, sixtee // The header's size first: the writer's decoders allocate what it declares, and the encoded // bytes of an image that is far larger than any the app reads may be a few kilobytes. let size = image::ImageReader::new(std::io::Cursor::new(blob.bytes.as_slice())).with_guessed_format().ok()?.into_dimensions(); - if size.is_ok_and(|(w, h)| u64::from(w) * u64::from(h) > MAX_EMBED_PIXELS) { + if size.is_ok_and(|(w, h)| u64::from(w) * u64::from(h) > crate::images::MAX_EMBED_PIXELS) { return None; } let bytes = blob.bytes.as_ref().clone(); diff --git a/crates/pdf/src/export/nodes.rs b/crates/pdf/src/export/nodes.rs index 8bafe017c6..78930c7500 100644 --- a/crates/pdf/src/export/nodes.rs +++ b/crates/pdf/src/export/nodes.rs @@ -1,7 +1,9 @@ +use std::collections::HashMap; + use super::exporter::{UNDECODED, address, blend, color, constant_mask, cover, in_range, norm, rects_overlap, rule, to_path, writable, xf}; use super::{ - Affine, AppearanceItem, BezPath, BlendMode, Exporter, Fill, FillRule, GradientKind, LineCap, LineJoin, Mark, Node, NodeKind, NormalizedF32, - Paint, Path, Rect, Shape, Stroke, StrokeAlign, StrokeDash, StrokeLayer, Surface, WrittenShape, krilla, stroke, + Affine, AppearanceItem, BezPath, BlendMode, Document, Exporter, Fill, FillRule, GradientKind, LineCap, LineJoin, Mark, Node, NodeKind, + NormalizedF32, Paint, Path, Rect, Shape, Stroke, StrokeAlign, StrokeDash, StrokeLayer, Surface, WrittenShape, krilla, stroke, }; /// An object's visual box for leaving out what is off the page. A plain group or layer also holds @@ -57,88 +59,146 @@ impl Exporter<'_> { /// The children of a group, as the elements of a knockout group when it is one. pub(super) fn children(&mut self, s: &mut Surface, children: &[std::sync::Arc], page: Rect) { - self.measured_children(s, children, page, &[]); + self.measured_children(s, children, page, &[], false); } - /// [`Self::children`] with the boxes of the last members in `measured`. - fn measured_children(&mut self, s: &mut Surface, children: &[std::sync::Arc], page: Rect, measured: &[Measured]) { + /// [`Self::children`] with the boxes of the last members in `measured`, in an isolated group + /// when `isolated`. + fn measured_children(&mut self, s: &mut Surface, children: &[std::sync::Arc], page: Rect, measured: &[Measured], isolated: bool) { if !self.knockout { + if isolated { + s.push_isolated(); + } let unmeasured = children.len().saturating_sub(measured.len()); for (i, c) in children.iter().enumerate() { self.measured_node(s, c, page, false, i.checked_sub(unmeasured).and_then(|i| measured.get(i))); } + if isolated { + s.pop(); + } return; } - let elements: Vec<_> = Node::knockout_elements(children) + let elements: Vec<(&Node, Measured)> = Node::knockout_elements(children) .into_iter() - .map(|c| (c, self.measure(c))) + .map(|c| (&**c, self.measure(c))) .filter(|(_, m)| m.bounds.is_some_and(|b| rects_overlap(b.inflate(1.0, 1.0), page))) .collect(); - if !elements.is_empty() && elements.iter().all(|(c, _)| c.knockout_outline().is_some()) { - let pieces: Vec<&Node> = elements.iter().map(|(c, _)| &***c).collect(); - if vectorcraft_effects::warp_pieces_translucent(self.doc, &pieces) { - return self.warp_pieces(s, &elements, page); + if elements.is_empty() { + return; + } + if elements.iter().all(|(c, _)| c.knockout_outline().is_some()) { + let pieces: Vec<&Node> = elements.iter().map(|(c, _)| *c).collect(); + if isolated { + s.push_isolated(); } - for (c, m) in &elements { - self.measured_node(s, c, page, false, Some(m)); + if vectorcraft_effects::warp_pieces_translucent(self.doc, &pieces) { + self.warp_pieces(s, &elements, page); + } else { + for (c, m) in &elements { + self.measured_node(s, c, page, false, Some(m)); + } + } + if isolated { + s.pop(); } return; } - // The PDF writer has no knockout groups: each element is drawn through a soft mask of - // where the elements above it don't paint (the same look for Normal blending). The masks - // nest, so element i sits inside the masks of elements i+1…n: open them outermost first. - self.warn("knockout groups are written as soft-masked groups (same look, but not editable as knockout groups)"); - let Some(((first, measured), rest)) = elements.split_first() else { return }; - for (c, m) in rest.iter().rev() { - let mask = self.knockout_mask(s, c, page, m); - s.push_mask(mask); + let several = elements.len() > 1; + // A PDF knockout group (`/K`) knocks out by the area each element paints. Where an element + // above another knocks out by less (its opacity or mask defines its knockout shape, or it + // paints translucently), each element is drawn through one soft mask of where the + // elements above it that overlap it paint, while those masks hold no more than + // [`MAX_KNOCKOUT_MASK_OBJECTS`] objects and no brushed stroke. + if several && !elements.iter().skip(1).all(|(c, _)| shape_is_coverage(c)) { + let doc = self.doc; + let brushes = self.brushes.get_or_insert_with(|| vectorcraft_brush::library(doc)); + match knockout_masks(BrushSearch::new(doc, brushes), &elements) { + Ok(above) => { + // Every mask is made before anything is drawn: when the symbol objects the + // masks may hold run out, one would leave out art its element covers, and + // the group is written as a PDF knockout group instead. + let outer = std::mem::take(&mut self.mask_art_left_out); + let before = *self.mask_counter(); + let mut masks = Vec::with_capacity(above.len()); + for above in above { + let shapes: Vec<_> = above.into_iter().map(|j| &elements[j]).collect(); + masks.push((!shapes.is_empty()).then(|| self.knockout_mask(s, &shapes, page))); + } + let left_out = std::mem::replace(&mut self.mask_art_left_out, outer); + if left_out { + *self.mask_counter() = before; + self.warn(KNOCKOUT_SHAPES); + } else { + if isolated { + s.push_isolated(); + } + for ((c, m), mask) in elements.iter().zip(masks) { + if let Some(mask) = mask { + s.push_mask(mask); + self.measured_node(s, c, page, false, Some(m)); + s.pop(); + } else { + self.measured_node(s, c, page, false, Some(m)); + } + } + if isolated { + s.pop(); + } + return; + } + } + Err(warning) => self.warn(warning), + } } - self.measured_node(s, first, page, false, Some(measured)); - for (c, m) in rest { - s.pop(); + let group = several || isolated; + if group { + s.push_group(krilla::blend::GroupOptions { isolated, knockout: several }); + } + for (c, m) in &elements { + // In a PDF knockout group each painting operation knocks out the ones before it. An + // element drawn with several is one non-isolated group (drawn through a full alpha + // mask), so that its own fills and strokes don't knock each other out; its opacity + // or opacity mask makes it one already. + let unit = several && !one_paint(c) && c.opacity >= 1.0 && c.extras().mask.as_deref().is_none_or(|m| m.disabled); + if unit { + let all = constant_mask(s, page, 1.0); + s.push_mask(all); + } self.measured_node(s, c, page, false, Some(m)); + if unit { + s.pop(); + } + } + if group { + s.pop(); } } /// [`Self::measured_children`] of a plain group or layer. When they are the pieces of a /// mesh-warped image, every piece, on the page or not, takes part in the one size its pixels /// are resampled for ([`Self::warp_image_size`]). - fn group_children(&mut self, s: &mut Surface, children: &[std::sync::Arc], page: Rect, measured: &[Measured]) { + fn group_children(&mut self, s: &mut Surface, children: &[std::sync::Arc], page: Rect, measured: &[Measured], isolated: bool) { let outer = self.warp_image_size(children).map(|w| self.warp_size.replace(w)); - self.measured_children(s, children, page, measured); + self.measured_children(s, children, page, measured, isolated); if let Some(outer) = outer { self.warp_size = outer; } } - /// A luminosity mask that is 1 − the knockout shape of `c`, whose box is in `measured`: white, - /// then black through an alpha mask of `c` (at full object opacity without its own mask, unless - /// those define its shape). - fn knockout_mask(&mut self, s: &mut Surface, c: &Node, page: Rect, measured: &Measured) -> krilla::mask::Mask { - let shape = if c.knockout_shape { - c.clone() - } else { - let mut s = c.clone().with_mask(None); - s.opacity = 1.0; - s - }; - self.shapes_mask(s, &[(&shape, Some(measured))], page) - } - /// The pieces of a partly transparent mesh-warped image (`elements`, each with its box) as the /// elements of a knockout group ([`vectorcraft_effects::warp_pieces_translucent`]). Each piece /// is drawn through one soft mask of where the pieces above it that reach its box don't cover /// ([`vectorcraft_effects::knockout_silhouette`]): only neighbors overlap, so each mask holds a /// few triangles and no mask nests in another. A piece above that overlaps it only over opaque /// pixels ([`vectorcraft_effects::WarpSeams`]) is left out of its mask. - fn warp_pieces(&mut self, s: &mut Surface, elements: &[(&std::sync::Arc, Measured)], page: Rect) { + fn warp_pieces(&mut self, s: &mut Surface, elements: &[(&Node, Measured)], page: Rect) { // Each piece's triangle and its box: a piece paints inside its triangle only. let silhouette = |c: &Node| { let b = c.knockout_outline()?.geometric_bounds()?; Some((vectorcraft_effects::knockout_silhouette(c, vectorcraft_doc::color::Color::WHITE)?, b)) }; let silhouettes: Vec> = elements.iter().map(|(c, _)| silhouette(c)).collect(); - let pieces: Vec<&Node> = elements.iter().map(|(c, _)| &***c).collect(); + let pieces: Vec<&Node> = elements.iter().map(|(c, _)| *c).collect(); let seams = vectorcraft_effects::WarpSeams::new(self.doc, &pieces); for (i, (c, measured)) in elements.iter().enumerate() { let Some((_, reach)) = &silhouettes[i] else { continue }; @@ -191,6 +251,67 @@ impl Exporter<'_> { krilla::mask::Mask::new(sb.finish(), krilla::mask::MaskType::Luminosity) } + /// A luminosity mask that is 1 − the knockout shapes of `shapes` (each with its box): white, + /// then black through an alpha mask of each (at full object opacity without its own mask, + /// unless those define its shape). The symbol instances in the copies count toward + /// [`Exporter::mask_symbol_nodes`], not toward the objects the visible art may draw. A + /// knockout mask drawn inside another one counts toward the same objects as the outer one. + fn knockout_mask(&mut self, s: &mut Surface, shapes: &[&(&Node, Measured)], page: Rect) -> krilla::mask::Mask { + if self.in_knockout_mask { + return self.knockout_mask_art(s, shapes, page); + } + self.in_knockout_mask = true; + let visible = std::mem::replace(&mut self.symbol_nodes, self.mask_symbol_nodes); + let limit = std::mem::replace(&mut self.symbol_limit, vectorcraft_doc::MAX_SYMBOL_NODES); + let mask = self.knockout_mask_art(s, shapes, page); + self.mask_symbol_nodes = std::mem::replace(&mut self.symbol_nodes, visible); + self.symbol_limit = limit; + self.in_knockout_mask = false; + mask + } + + /// The symbol objects the copies drawn in knockout masks held, together: [`Self::symbol_nodes`] + /// while a knockout mask is being drawn, [`Exporter::mask_symbol_nodes`] otherwise. + fn mask_counter(&mut self) -> &mut u64 { + if self.in_knockout_mask { &mut self.symbol_nodes } else { &mut self.mask_symbol_nodes } + } + + /// [`Self::knockout_mask`], drawn within the symbol objects counted at the time. + fn knockout_mask_art(&mut self, s: &mut Surface, shapes: &[&(&Node, Measured)], page: Rect) -> krilla::mask::Mask { + let transform = s.group_transform(); + let mut sb = s.stream_builder(); + let mut ms = Surface::stream(sb.surface()); + ms.push_transform(&transform); + cover(&mut ms, page, 255, 1.0); + for (c, measured) in shapes.iter().map(|e| (e.0, &e.1)) { + let shape = if c.knockout_shape { + c.clone() + } else { + let mut s = c.clone().with_mask(None); + s.opacity = 1.0; + s + }; + let alpha = { + let transform = ms.group_transform(); + let mut ab = ms.stream_builder(); + let mut als = Surface::stream(ab.surface()); + als.push_transform(&transform); + let overprint = std::mem::take(&mut self.overprint); + self.measured_node(&mut als, &shape, page, false, Some(measured)); + self.overprint = overprint; + als.pop(); + als.finish(); + krilla::mask::Mask::new(ab.finish(), krilla::mask::MaskType::Alpha) + }; + ms.push_mask(alpha); + cover(&mut ms, page, 0, 1.0); + ms.pop(); + } + ms.pop(); + ms.finish(); + krilla::mask::Mask::new(sb.finish(), krilla::mask::MaskType::Luminosity) + } + /// The box of `n`, and of the members of a plain group or layer. fn measure(&self, n: &Node) -> Measured { if !matches!(n.kind, NodeKind::Layer { clip: false, .. } | NodeKind::Group { clip: false, .. }) { @@ -242,23 +363,7 @@ impl Exporter<'_> { // Whether this container's children knock each other out (a knockout group is written as a group). let knockout = n.knocks_out(self.knockout); let enclosing = std::mem::replace(&mut self.knockout, knockout); - let mut pushes = 0; - if n.blend != BlendMode::Normal { - s.push_blend_mode(blend(n.blend)); - pushes += 1; - } - if n.opacity < 1.0 || (container && (n.isolate || n.blend != BlendMode::Normal || knockout)) { - if !n.isolate && n.blends_through() { - // Not isolated: blending inside reaches the art below the group. - let alpha = constant_mask(s, page, n.opacity); - s.push_mask(alpha); - } else if n.opacity < 1.0 { - s.push_opacity(norm(n.opacity)); - } else { - s.push_isolated(); - } - pushes += 1; - } + let (mut pushes, isolated_children) = transparency(s, n, page, container, knockout); let mask = n.extras().mask.as_deref().filter(|m| !m.disabled); let alpha = match (&n.kind, mask) { (NodeKind::Image(im), Some(m)) => self.masked_image(im, m, !n.extras().pixelated), @@ -279,7 +384,7 @@ impl Exporter<'_> { } match &n.kind { NodeKind::Layer { children, clip: false, .. } | NodeKind::Group { children, clip: false } => { - self.group_children(s, children, page, measured.map_or(&[], |m| m.members.as_slice())); + self.group_children(s, children, page, measured.map_or(&[], |m| m.members.as_slice()), isolated_children); } NodeKind::Group { children, clip: true } | NodeKind::Layer { children, clip: true, .. } => { // The region every output clips to; nothing to clip by hides the clipped art. The @@ -336,14 +441,15 @@ impl Exporter<'_> { // instances multiply. // Placing through 9-slice guides needs room for the most objects it can make // (`NineSliceMap::most_placed`), and the objects it makes count. - // A dynamic symbol's instance shows its own appearance changes. + // A dynamic symbol's instance shows its own appearance changes, and the instance's + // fill stains its art, as on the canvas. let doc = self.doc; if let Some(sym) = doc.symbols.iter().find(|x| &x.name == symbol) { let changed; - let art: &Node = if n.extras().symbol_overrides.is_empty() { + let art: &Node = if n.extras().symbol_overrides.is_empty() && vectorcraft_doc::symbol_overrides::stain(n).is_none() { &sym.art } else { - changed = vectorcraft_doc::symbol_overrides::dynamic_art(&sym.art, n); + changed = vectorcraft_doc::symbol_overrides::instance_art(&sym.art, n); &changed }; let count = art.count() as u64; @@ -365,8 +471,10 @@ impl Exporter<'_> { (art, count) }) }); - if let Some(art) = placed.flatten() { - self.node(s, &art, page, true); + match placed.flatten() { + Some(art) => self.node(s, &art, page, true), + // A knockout mask that leaves the art out no longer matches what it masks. + None => self.mask_art_left_out |= self.in_knockout_mask, } } } @@ -740,3 +848,379 @@ impl Exporter<'_> { true } } + +/// Opens the blend mode and the transparency group `n` is drawn with (`container` when it is a +/// group or layer whose children `knockout` each other). Returns how many were opened, and +/// whether the children are to be drawn in an isolated group of their own: the knockout group of +/// an unclipped group's elements is its isolated group too. +fn transparency(s: &mut Surface, n: &Node, page: Rect, container: bool, knockout: bool) -> (usize, bool) { + let mut pushes = 0; + if n.blend != BlendMode::Normal { + s.push_blend_mode(blend(n.blend)); + pushes += 1; + } + let mut isolated_children = false; + if n.opacity < 1.0 || (container && (n.isolate || n.blend != BlendMode::Normal || knockout)) { + if !n.isolate && n.blends_through() { + // Not isolated: blending inside reaches the art below the group. + let alpha = constant_mask(s, page, n.opacity); + s.push_mask(alpha); + pushes += 1; + } else if n.opacity < 1.0 { + s.push_opacity(norm(n.opacity)); + pushes += 1; + } else if knockout && matches!(n.kind, NodeKind::Layer { clip: false, .. } | NodeKind::Group { clip: false, .. }) { + isolated_children = true; + } else { + s.push_isolated(); + pushes += 1; + } + } + (pushes, isolated_children) +} + +/// The warning for a knockout group whose elements are too many to draw through soft masks: it is +/// written as a PDF knockout group, where an element knocks out all of the area it paints. +pub(crate) const KNOCKOUT_SHAPES: &str = "knockout groups with too many overlapping translucent elements are written as PDF knockout groups: \ + their translucent elements knock out what they cover fully"; + +/// The most objects the soft masks of one knockout group's elements draw between them: each mask +/// draws the elements above its own element that overlap it. +pub(crate) const MAX_KNOCKOUT_MASK_OBJECTS: usize = 1 << 16; + +/// The most elements of one knockout group drawn through soft masks: finding the elements that +/// overlap compares every pair. +pub(crate) const MAX_MASKED_ELEMENTS: usize = 2048; + +/// The warning for a knockout group in which a soft mask would draw an element with a brushed +/// stroke: it is written as a PDF knockout group, where an element knocks out all of the area it +/// paints. +pub(crate) const KNOCKOUT_BRUSHES: &str = "knockout groups with brushed strokes over other translucent elements are written as PDF knockout groups: \ + their translucent elements knock out what they cover fully"; + +/// For each element of a knockout group (with its box), the indices of the elements above it whose +/// boxes overlap its own. The warning to give instead ([`KNOCKOUT_SHAPES`]) when there are more than +/// [`MAX_MASKED_ELEMENTS`] elements or the masks would draw more than +/// [`MAX_KNOCKOUT_MASK_OBJECTS`] objects, or ([`KNOCKOUT_BRUSHES`]) when a mask would draw a +/// brushed stroke ([`BrushSearch`]), whose brush art the object count leaves out. +fn knockout_masks(mut search: BrushSearch, elements: &[(&Node, Measured)]) -> Result>, &'static str> { + if elements.len() > MAX_MASKED_ELEMENTS { + return Err(KNOCKOUT_SHAPES); + } + let counts: Vec = elements.iter().map(|(c, _)| c.count_with_masks()).collect(); + let mut checked: Vec> = vec![None; elements.len()]; + let mut objects = 0usize; + let mut out = Vec::with_capacity(elements.len()); + for (i, (_, below)) in elements.iter().enumerate() { + let mut above = vec![]; + for (j, (over_node, over)) in elements.iter().enumerate().skip(i + 1) { + if let (Some(a), Some(b)) = (below.bounds, over.bounds) + && rects_overlap(a.inflate(1.0, 1.0), b.inflate(1.0, 1.0)) + { + // The mask draws a copy of the element without its own opacity mask, unless the + // mask defines its knockout shape. + if *checked[j].get_or_insert_with(|| search.node(over_node, over_node.knockout_shape, 0)) { + return Err(if search.exhausted { KNOCKOUT_SHAPES } else { KNOCKOUT_BRUSHES }); + } + objects = objects.checked_add(counts[j]).filter(|&o| o <= MAX_KNOCKOUT_MASK_OBJECTS).ok_or(KNOCKOUT_SHAPES)?; + above.push(j); + } + } + out.push(above); + } + Ok(out) +} + +/// The art a [`BrushSearch`] looks through once: a symbol's or a pattern's, by name, or a +/// symbol's with one instance's appearance changes, by the symbol's name and the changes. +#[derive(Clone, Copy, PartialEq, Eq, Hash)] +enum SharedArt { + Symbol, + Pattern, + Dynamic, +} + +/// A search for the brushed strokes drawing an object draws, whose brush art can hold many more +/// objects than the stroked path. +struct BrushSearch<'a> { + doc: &'a Document, + /// The brushes the export draws strokes with ([`Exporter::brush_art`]); a stroke whose brush + /// is not among them is drawn as a plain stroke. + brushes: &'a [vectorcraft_brush::Brush], + /// The answer for each symbol's and pattern's art, and each symbol's art with an instance's + /// appearance changes, once found: false while it is being looked through, so that art that + /// uses itself ends the search. + seen: HashMap<(SharedArt, String), bool>, + /// The objects the search may still visit or copy: [`MAX_KNOCKOUT_MASK_OBJECTS`] at the start. + left: usize, + /// Whether the search stopped because [`Self::left`] ran out; it then answers true. + exhausted: bool, +} + +impl<'a> BrushSearch<'a> { + fn new(doc: &'a Document, brushes: &'a [vectorcraft_brush::Brush]) -> Self { + Self { doc, brushes, seen: HashMap::new(), left: MAX_KNOCKOUT_MASK_OBJECTS, exhausted: false } + } + + /// Takes `n` objects from [`Self::left`]; false, and the search exhausted, when fewer are left. + fn spend(&mut self, n: usize) -> bool { + match self.left.checked_sub(n) { + Some(left) if !self.exhausted => { + self.left = left; + true + } + _ => { + (self.left, self.exhausted) = (0, true); + false + } + } + } + + /// Takes the objects of `n` (its members and opacity-mask art included) from [`Self::left`], + /// counting no further than what is left; false when they don't fit. + fn spend_tree(&mut self, n: &Node) -> bool { + self.spend(1) + && n.extras().mask.as_deref().is_none_or(|m| self.spend_tree(&m.art)) + && n.children().into_iter().flatten().all(|c| self.spend_tree(c)) + } + + /// Whether drawing `n` draws a brushed stroke: on `n` or its visible members (a compound + /// path's members are drawn with its own paint), in the art of the opacity masks that are on + /// (`n`'s own when `own_mask`), of symbol instances and inline graphics, of live objects as + /// evaluated, and of the patterns that fills, strokes and type paint with. `depth` counts the + /// objects and the mask, symbol and pattern art above `n`: past + /// [`vectorcraft_doc::depth::MAX_DRAWN_DEPTH`] the search stops and counts as a brush, and so + /// it does when the objects it may visit or copy ([`Self::left`]) run out. + fn node(&mut self, n: &Node, own_mask: bool, depth: usize) -> bool { + if depth > vectorcraft_doc::depth::MAX_DRAWN_DEPTH || !self.spend(1) { + return true; + } + let depth = depth + 1; + // A fill is drawn when it is visible, and a stroke when it also paints and has a width + // (as `Exporter::shape` draws them). + for item in n.appearance.items.iter().filter(|i| i.visible()) { + let paint = match item { + AppearanceItem::Fill(f) => &f.paint, + AppearanceItem::Stroke(st) if st.paint.is_none() || st.width <= 0.0 => continue, + AppearanceItem::Stroke(st) => { + if st.brush.as_deref().is_some_and(|name| self.brushes.iter().any(|b| b.name == name)) { + return true; + } + &st.paint + } + }; + if self.paint(paint, depth) { + return true; + } + } + if own_mask && n.extras().mask.as_deref().is_some_and(|m| !m.disabled && self.node(&m.art, true, depth)) { + return true; + } + match &n.kind { + NodeKind::SymbolInstance { symbol, .. } => { + // A dynamic symbol's instance draws its art with its own appearance changes: the + // art is copied once for each set of changes, counted before it is copied. + let doc = self.doc; + match doc.symbols.iter().find(|s| &s.name == symbol) { + Some(s) if !n.extras().symbol_overrides.is_empty() => { + let key = format!("{symbol}\u{0}{:?}", n.extras().symbol_overrides); + self.shared(SharedArt::Dynamic, &key, |search| { + !search.spend_tree(&s.art) || search.node(&vectorcraft_doc::symbol_overrides::dynamic_art(&s.art, n), true, depth) + }) + } + _ => self.symbol(symbol, depth), + } + } + NodeKind::Text(t) => t.runs.iter().any(|r| { + let stroke = r.style.stroke_width > 0.0 && self.paint(&r.style.stroke, depth); + stroke || self.paint(&r.style.fill, depth) || r.inline.as_ref().is_some_and(|ig| self.symbol(&ig.symbol, depth)) + }), + NodeKind::Compound { .. } => false, + // Live objects are drawn as their evaluated art, as `Exporter::measured_node` draws them. + NodeKind::Blend { .. } + | NodeKind::Envelope { .. } + | NodeKind::Mesh(_) + | NodeKind::Repeat(_) + | NodeKind::PlacedDocument(_) + | NodeKind::Intertwine { .. } => { + // Each live object is reached once in the art searched (shared art is searched + // once); its evaluated art is counted before it is searched. + let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n); + !self.spend_tree(&g) || g.children().into_iter().flatten().filter(|c| c.visible).any(|c| self.node(c, true, depth)) + } + _ => n.children().into_iter().flatten().filter(|c| c.visible).any(|c| self.node(c, true, depth)), + } + } + + /// Whether the art of the symbol named `name` draws a brushed stroke. + fn symbol(&mut self, name: &str, depth: usize) -> bool { + let doc = self.doc; + let Some(s) = doc.symbols.iter().find(|s| s.name == name) else { return false }; + self.shared(SharedArt::Symbol, name, |search| search.node(&s.art, true, depth)) + } + + /// Whether `paint` is a pattern whose tile art draws a brushed stroke. + fn paint(&mut self, paint: &Paint, depth: usize) -> bool { + let Paint::Pattern { pattern, .. } = paint else { return false }; + let doc = self.doc; + let Some(def) = doc.pattern(pattern) else { return false }; + self.shared(SharedArt::Pattern, pattern, |search| def.art.iter().filter(|c| c.visible).any(|c| search.node(c, true, depth))) + } + + /// The answer of `search` for the shared art `kind` named `name`, found once. + fn shared(&mut self, kind: SharedArt, name: &str, search: impl FnOnce(&mut Self) -> bool) -> bool { + let key = (kind, name.to_string()); + if let Some(&b) = self.seen.get(&key) { + return b; + } + self.seen.insert(key.clone(), false); + let b = search(self); + self.seen.insert(key, b); + b + } +} + +/// Whether `n` is drawn with one painting operation at most: a path or compound path with at most +/// one visible fill or stroke that paints, in a solid color, without effects, a brush or +/// arrowheads. +fn one_paint(n: &Node) -> bool { + let mut items = n.appearance.items.iter().filter(|i| i.visible() && !matches!(i.paint(), Paint::None)); + let simple = items.next().is_none_or(|i| { + let plain = match i { + AppearanceItem::Fill(_) => true, + AppearanceItem::Stroke(st) => st.brush.is_none() && st.start_arrow.is_none() && st.end_arrow.is_none(), + }; + plain && i.effects().is_empty() && matches!(i.paint(), Paint::Solid { .. }) + }); + matches!(n.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) && n.appearance.effects.is_empty() && simple && items.next().is_none() +} + +/// Whether element `c` of a knockout group knocks out all of the area it paints, as an element of +/// a PDF knockout group does: its opacity and opacity mask are full or don't define its knockout +/// shape, and every part of it paints opaquely. +fn shape_is_coverage(c: &Node) -> bool { + let own = !c.knockout_shape || (c.opacity >= 1.0 && c.extras().mask.as_deref().is_none_or(|m| m.disabled)); + own && paints_opaque(c) +} + +/// Whether what `n` paints is opaque wherever it paints, at its own opacity and mask: its visible +/// fills and strokes are solid colors or gradients with opaque stops, without effects or brushes, +/// and so are the members of a group or compound path, at full opacity without an opacity mask. +fn paints_opaque(n: &Node) -> bool { + let paint = |p: &Paint| match p { + Paint::None | Paint::Solid { .. } => true, + Paint::Gradient(g) => g.gradient.stops.iter().all(|s| s.opacity >= 1.0), + _ => false, + }; + let items = n.appearance.items.iter().all(|i| { + let brush = matches!(i, AppearanceItem::Stroke(s) if s.brush.is_some()); + !i.visible() || (i.opacity() >= 1.0 && i.effects().is_empty() && !brush && paint(i.paint())) + }); + let member = + |c: &std::sync::Arc| !c.visible || (c.opacity >= 1.0 && c.extras().mask.as_deref().is_none_or(|m| m.disabled) && paints_opaque(c)); + n.appearance.effects.is_empty() + && items + && match &n.kind { + NodeKind::Path { .. } => true, + NodeKind::Group { children, .. } | NodeKind::Layer { children, .. } | NodeKind::Compound { children, .. } => children.iter().all(member), + NodeKind::Mesh(m) => m.points.iter().all(|p| p.opacity >= 1.0), + _ => false, + } +} + +#[cfg(test)] +mod tests { + use std::sync::Arc; + + use vectorcraft_doc::{Appearance, NodeId, Symbol, SymbolOverride}; + use vectorcraft_geom::shapes; + + use super::*; + + /// An instance of a dynamic symbol whose art holds an instance of the same symbol with the same + /// appearance changes ends the search for brushed strokes where the art comes round again, + /// after a few objects, instead of recursing until the stack runs out. + #[test] + fn a_dynamic_symbol_holding_itself_ends_the_brush_search() { + let mut d = Document::new(200.0, 200.0); + let instance = || { + let mut n = Node::new(NodeId(0), NodeKind::SymbolInstance { symbol: "Loop".into(), xf: Affine::translate((40.0, 0.0)) }); + n.extras_mut().symbol_overrides = vec![SymbolOverride { path: vec![0], opacity: Some(0.5), ..Default::default() }]; + n + }; + let square = Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::basic(Paint::None, Paint::None, 0.0)); + let art = Node::group(NodeId(0), vec![Arc::new(square), Arc::new(instance())]); + d.symbols.push(Symbol { dynamic: true, name: "Loop".into(), art: Arc::new(art) }); + let mut search = BrushSearch::new(&d, &[]); + assert!(!search.node(&instance(), true, 0)); + assert!(!search.exhausted); + assert!(MAX_KNOCKOUT_MASK_OBJECTS - search.left < 10, "{} objects", MAX_KNOCKOUT_MASK_OBJECTS - search.left); + } + + /// A group of 1,000 instances of a dynamic symbol whose art holds 100 squares, each instance + /// with appearance changes of its own: copying and looking through every instance's art would + /// take about 203,000 objects, and the search stops when [`MAX_KNOCKOUT_MASK_OBJECTS`] are + /// used, counting as a brush. With the same changes on every instance, the art is copied + /// once. + #[test] + fn the_brush_search_stops_within_its_object_limit() { + let mut d = Document::new(200.0, 200.0); + let square = + Arc::new(Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 1.0, 1.0)), Appearance::basic(Paint::None, Paint::None, 0.0))); + d.symbols.push(Symbol { dynamic: true, name: "Dots".into(), art: Arc::new(Node::group(NodeId(0), vec![square; 100])) }); + let group = |distinct: bool| { + let instances = (0..1000u32) + .map(|i| { + let mut n = Node::new(NodeId(0), NodeKind::SymbolInstance { symbol: "Dots".into(), xf: Affine::IDENTITY }); + let path = if distinct { vec![0, i] } else { vec![0] }; + n.extras_mut().symbol_overrides = vec![SymbolOverride { path, opacity: Some(0.5), ..Default::default() }]; + Arc::new(n) + }) + .collect(); + Node::group(NodeId(0), instances) + }; + let mut search = BrushSearch::new(&d, &[]); + assert!(search.node(&group(true), true, 0)); + assert!(search.exhausted); + assert_eq!(search.left, 0); + let mut search = BrushSearch::new(&d, &[]); + assert!(!search.node(&group(false), true, 0)); + assert!(!search.exhausted); + // The group, the 1,000 instances, and one copy of the art counted and looked through. + assert_eq!(MAX_KNOCKOUT_MASK_OBJECTS - search.left, 1 + 1000 + 101 + 101); + } + + /// A placed file read as one square with a 3 pt brushed stroke. + fn brushed_art() -> (Document, Node, Rect) { + let mut d = Document::new(40.0, 20.0); + d.layers.clear(); + let mut st = StrokeLayer::new(Paint::solid(vectorcraft_color::Color::BLACK), 3.0); + st.brush = Some("3 pt. Round".into()); + let mut square = Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 40.0, 20.0)), Appearance::basic(Paint::None, Paint::None, 0.0)); + square.appearance.items.push(AppearanceItem::Stroke(st)); + let art = Node::group(NodeId(0), vec![Arc::new(square)]); + (d, art, Rect::new(0.0, 0.0, 40.0, 20.0)) + } + + /// A placed document is drawn as the art read from its file, and the brushed strokes in that + /// art count. + #[test] + fn brushed_strokes_in_a_placed_documents_art_count() { + let d = Document::new(200.0, 200.0); + let placed = vectorcraft_doc::PlacedDocument { + link: vectorcraft_doc::LinkInfo::new("/art/placed.vectorcraft"), + key: "placed-1".into(), + bounding: false, + page_box: vectorcraft_doc::placed_document::PageBox::Crop, + width: 40.0, + height: 20.0, + xf: Affine::IDENTITY, + placement: Default::default(), + }; + // The art the export reads for it before drawing (`Document::with_placed_art`). + vectorcraft_doc::placed_document::prime(&placed, Arc::new(vec![]), brushed_art()); + let n = Node::new(NodeId(0), NodeKind::PlacedDocument(Box::new(placed))); + let brushes = vectorcraft_brush::library(&d); + assert!(BrushSearch::new(&d, &brushes).node(&n, true, 0)); + } +} diff --git a/crates/pdf/src/export/paint.rs b/crates/pdf/src/export/paint.rs index 77815f93b3..6baffa48a8 100644 --- a/crates/pdf/src/export/paint.rs +++ b/crates/pdf/src/export/paint.rs @@ -90,16 +90,20 @@ impl Exporter<'_> { /// The stops of a gradient whose every stop is a tint of one spot ink (or paper white, 0% of /// it) as tints of that ink — a Separation shading — with midpoints as explicit stops (the /// tint and opacity there are halfway). A gradient that mixes a spot ink with other colors - /// gets [`Self::device_n_stops`]. `None` for gradients without a spot ink. + /// gets [`Self::device_n_stops`]. `None` for gradients without a spot ink that prints + /// ([`Self::printed_spot`]). fn spot_stops(&mut self, g: &vectorcraft_color::Gradient) -> Option> { - let ink = g.stops.iter().find_map(|s| s.swatch.as_deref().filter(|n| self.doc.swatch(n).is_some_and(|w| w.spot)))?; + let drawn = g.drawn_stops(); + let ink = g.stops.iter().zip(&drawn).find_map(|(s, &d)| self.printed_spot(s, d))?; let tints: Option> = g .stops .iter() - .map(|s| match s.swatch.as_deref() { + .zip(&drawn) + .map(|(s, &d)| match s.swatch.as_deref() { + _ if !d => Some(0.0), // A stop that also prints process plates needs a DeviceN space. Some(n) if n == ink && s.plates.is_none() => Some(s.tint), - _ if self.paper_stop(s) => Some(0.0), + _ if self.inkless_stop(s) => Some(0.0), _ => None, }) .collect(); @@ -126,19 +130,22 @@ impl Exporter<'_> { /// the order the stops name them), with midpoints as explicit stops (the tints and opacity /// there are halfway), or for a Perceptual gradient the stops on its curve /// ([`vectorcraft_color::Gradient::ink_mixes`]). Paper white adds no ink; a spot stop with - /// process plates ([`vectorcraft_color::GradientStop::plates`]) prints them too. `None`, with a - /// warning, when a stop is written in RGB or Lab or the spot inks can't share a DeviceN space; - /// the gradient is then written in the colors of its stops. + /// process plates ([`vectorcraft_color::GradientStop::plates`]) prints them too. Only the stops + /// that color something that draws ([`vectorcraft_color::Gradient::drawn_stops`]) name inks: + /// the others are written with no ink. `None`, with a warning, when a stop is written in RGB or + /// Lab or the spot inks can't share a DeviceN space; the gradient is then written in the colors + /// of its stops. fn device_n_stops(&mut self, g: &vectorcraft_color::Gradient) -> Option> { use krilla::color::device_n::{Color as DnColor, Colorant, DeviceNSpace, Process}; let doc = self.doc; fn spot_of<'s>(doc: &vectorcraft_doc::Document, s: &'s vectorcraft_color::GradientStop) -> Option<&'s str> { s.swatch.as_deref().filter(|n| doc.swatch(n).is_some_and(|w| w.spot)) } + let drawn = g.drawn_stops(); // Each spot ink: its swatch's name, then its colorant name and CMYK equivalent. let mut spots: Vec<(&str, (String, [f32; 4]))> = Vec::new(); - for s in &g.stops { - if let Some(n) = spot_of(doc, s) + for (s, &d) in g.stops.iter().zip(&drawn) { + if let Some(n) = self.printed_spot(s, d) && !spots.iter().any(|(m, _)| *m == n) { spots.push((n, self.spot_ink(n)?)); @@ -146,12 +153,15 @@ impl Exporter<'_> { } // Each stop's ink coverage: the four process inks, then one tint per spot ink. let mut inks: Vec> = Vec::with_capacity(g.stops.len()); - for s in &g.stops { + for (s, &d) in g.stops.iter().zip(&drawn) { let mut v = vec![0.0; 4 + spots.len()]; match spot_of(doc, s) { + _ if !d => {} Some(n) => { - let i = spots.iter().position(|(m, _)| *m == n)?; - v[4 + i] = s.tint; + // A spot ink that no drawn stop prints ([`Self::printed_spot`]) has no colorant. + if let Some(i) = spots.iter().position(|(m, _)| *m == n) { + v[4 + i] = s.tint; + } if let Some(p) = s.plates { v[..4].copy_from_slice(&p.map(|t| t.clamp(0.0, 1.0))); } @@ -434,18 +444,38 @@ impl Exporter<'_> { !s.swatch.as_deref().is_some_and(|n| self.doc.swatch(n).is_some_and(|w| w.spot)) && paper(&s.color) } - /// The spot swatch whose tints are every stop of `g` that isn't paper white - /// ([`Self::paper_stop`]); `None` when no stop is linked to a spot swatch or a stop has - /// another color. - fn one_spot_ink<'g>(&self, g: &'g vectorcraft_color::Gradient) -> Option<&'g str> { - let spot = |s: &'g vectorcraft_color::GradientStop| s.swatch.as_deref().filter(|n| self.doc.swatch(n).is_some_and(|w| w.spot)); - let ink = g.stops.iter().find_map(spot)?; - g.stops.iter().all(|s| (spot(s) == Some(ink) && s.plates.is_none()) || self.paper_stop(s)).then_some(ink) + /// The spot swatch stop `s` prints: the one it is linked to, when the stop colors something + /// that draws (`drawn`, [`vectorcraft_color::Gradient::drawn_stops`]) at a tint above 0 or + /// with process plates ([`vectorcraft_color::GradientStop::plates`]), which print in the same + /// DeviceN space. + fn printed_spot<'s>(&self, s: &'s vectorcraft_color::GradientStop, drawn: bool) -> Option<&'s str> { + s.swatch.as_deref().filter(|n| drawn && (s.tint > 0.0 || s.plates.is_some()) && self.doc.swatch(n).is_some_and(|w| w.spot)) } - /// Can every stop of `g` be inks of a DeviceN space ([`Self::device_n_stops`]): is a stop - /// linked to a spot swatch, and is every other stop paper white ([`Self::paper_stop`]) or - /// written in CMYK or gray? + /// Does stop `s` add no ink to a Separation or DeviceN shading: is it paper white + /// ([`Self::paper_stop`]) or linked to a spot swatch at a tint of 0 without process plates? + fn inkless_stop(&self, s: &vectorcraft_color::GradientStop) -> bool { + let spot = s.swatch.as_deref().is_some_and(|n| self.doc.swatch(n).is_some_and(|w| w.spot)); + self.paper_stop(s) || (spot && self.printed_spot(s, true).is_none()) + } + + /// The spot swatch whose tints are every stop of `g` that colors something that draws + /// ([`vectorcraft_color::Gradient::drawn_stops`]) and adds ink ([`Self::inkless_stop`]); `None` + /// when no such stop prints a spot swatch ([`Self::printed_spot`]) or one has another color. + fn one_spot_ink<'g>(&self, g: &'g vectorcraft_color::Gradient) -> Option<&'g str> { + let drawn = g.drawn_stops(); + let ink = g.stops.iter().zip(&drawn).find_map(|(s, &d)| self.printed_spot(s, d))?; + g.stops + .iter() + .zip(&drawn) + .all(|(s, &d)| !d || (s.swatch.as_deref() == Some(ink) && s.plates.is_none()) || self.inkless_stop(s)) + .then_some(ink) + } + + /// Can every stop of `g` be inks of a DeviceN space ([`Self::device_n_stops`]): does a stop + /// print a spot swatch ([`Self::printed_spot`]), and is every other stop that colors something + /// that draws linked to a spot swatch, paper white ([`Self::paper_stop`]) or written in CMYK or + /// gray? fn device_n_inks_only(&self, g: &vectorcraft_color::Gradient) -> bool { let doc = self.doc; let cmyk_doc = doc.color_mode == vectorcraft_doc::ColorMode::Cmyk; @@ -453,7 +483,9 @@ impl Exporter<'_> { let inks = |s: &vectorcraft_color::GradientStop| { self.paper_stop(s) || matches!(self.out.color(&s.color, self.intent, cmyk_doc, self.convert), Color::Cmyk { .. } | Color::Gray { .. }) }; - g.stops.iter().any(spot) && g.stops.iter().all(|s| spot(s) || inks(s)) + let drawn = g.drawn_stops(); + let mut stops = g.stops.iter().zip(&drawn); + stops.clone().any(|(s, &d)| self.printed_spot(s, d).is_some()) && stops.all(|(s, &d)| !d || spot(s) || inks(s)) } /// Is `g` a Perceptual linear or radial gradient of spot inks, alone or mixed with process @@ -485,16 +517,20 @@ impl Exporter<'_> { let doc = self.doc; let full = doc.linked_color(doc.swatch(ink)?.paint.color()?, true); let space = self.separation(ink)?; - // The stops keep their own tints; paper white is 0% of the ink. - let own: Vec = g.stops.iter().map(|s| if s.swatch.as_deref() == Some(ink) { s.tint } else { 0.0 }).collect(); + // The stops keep their own tints; paper white, and a stop that colors nothing that draws, + // is 0% of the ink. + let own: Vec = + g.stops.iter().zip(g.drawn_stops()).map(|(s, d)| if d && s.swatch.as_deref() == Some(ink) { s.tint } else { 0.0 }).collect(); Some(g.ink_tints(&full, &own)?.into_iter().map(|(o, t, a)| (o, SepColor::new_f32(t, space.clone()).into(), a)).collect()) } - /// Warn when gradient `g`, drawn as an image, has stops linked to a spot swatch: the image is - /// in process colors, so the spot inks have no plate of their own. + /// Warn when gradient `g`, drawn as an image, has stops that print a spot swatch + /// ([`Self::printed_spot`]): the image is in process colors, so the spot inks have no plate of + /// their own. fn warn_spot_image(&mut self, g: &vectorcraft_color::GradientPaint) { let from_stops = g.gradient.kind != GradientKind::Freeform || !g.has_freeform_points(); - if from_stops && self.has_spot_stop(&g.gradient) { + let prints_spot = || g.gradient.stops.iter().zip(g.gradient.drawn_stops()).any(|(s, d)| self.printed_spot(s, d).is_some()); + if from_stops && prints_spot() { self.warn( "spot colors in gradients exported as images (freeform or dithered gradients, ones mixed around the hue wheel, and Perceptual ones with RGB or Lab stops or too many stops) are written in process colors", ); diff --git a/crates/pdf/src/export/writer.rs b/crates/pdf/src/export/writer.rs index 9f6d9d6906..ca70ef2695 100644 --- a/crates/pdf/src/export/writer.rs +++ b/crates/pdf/src/export/writer.rs @@ -271,7 +271,8 @@ impl Writer { PdfError::from(e) })?; if self.cmyk { - cmyk_blending(&mut bytes, self.out.tagged); + let profile = self.out.tagged.then(|| vectorcraft_color::cms::icc_bytes(self.out.cmyk_profile()).ok()).flatten(); + cmyk_blending(&mut bytes, self.out.tagged, profile.as_deref(), self.out.standard != Standard::PdfA2b); } let lab = !self.lab_spots.is_empty() && !self.out.standard.cmyk_only(); let bytes = if lab { crate::lab_spot::lab_alternates(bytes, &self.lab_spots) } else { bytes }; @@ -285,12 +286,21 @@ impl Writer { /// its blending space (DeviceRGB, or sRGB when colours are `tagged`), so the group dictionaries /// are rewritten in place to DeviceCMYK (or the CMYK profile's space), keeping their length so the /// cross-reference offsets stay valid. Luminosity masks' groups keep RGB: mask luminance is that -/// of screen colours, as on screen. -fn cmyk_blending(pdf: &mut [u8], tagged: bool) { +/// of screen colours, as on screen. Tagged groups blend in the space of CMYK profile `profile` +/// (the one that tags CMYK colours) when the file has one. When its only CMYK spaces are of other +/// profiles (images' own), they blend in DeviceCMYK where `device` allows it, else they keep RGB; +/// without `profile`, they blend in the first CMYK space. +fn cmyk_blending(pdf: &mut [u8], tagged: bool, profile: Option<&[u8]>, device: bool) { let masks = luminosity_mask_groups(pdf); let mut spaces = vec![("/CS/DeviceRGB".to_string(), "/CS/DeviceCMYK".to_string())]; if tagged { - spaces.extend(icc_spaces(pdf)); + let own = profile.and_then(|icc| crate::output::tagging_stream(pdf, &crate::patch::Xref::read(pdf)?, icc)); + let without = match (profile, device) { + (None, _) => Without::FirstCmyk, + (Some(_), true) => Without::DeviceCmyk, + (Some(_), false) => Without::Rgb, + }; + spaces.extend(icc_spaces(pdf, own, without)); } let mut from = 0; while let Some(at) = find(pdf, b"/Group<<", from).map(|i| i + b"/Group".len()) { @@ -303,11 +313,22 @@ fn cmyk_blending(pdf: &mut [u8], tagged: bool) { } } +/// What tagged groups blend in when the file holds no space of the document's CMYK profile. +#[derive(Clone, Copy, Debug, PartialEq)] +enum Without { + /// The first ICC-based CMYK space of the file. + FirstCmyk, + DeviceCmyk, + /// The RGB space they have. + Rgb, +} + /// The ICC-based RGB colour spaces of `pdf`, each with the ICC-based CMYK one to blend in instead, -/// as group `/CS` entries (`/CS 3 0 R`); none without a CMYK one. -fn icc_spaces(pdf: &[u8]) -> Vec<(String, String)> { +/// as group `/CS` entries (`/CS 3 0 R`): the one whose profile is stream `own`, else as `without` +/// says; none without a CMYK one. +fn icc_spaces(pdf: &[u8], own: Option, without: Without) -> Vec<(String, String)> { const ICC: &[u8] = b"[/ICCBased "; - let (mut rgb, mut cmyk) = (vec![], None); + let (mut rgb, mut cmyk, mut own_cmyk) = (vec![], None, None); let mut from = 0; while let Some(at) = find(pdf, ICC, from) { from = at + ICC.len(); @@ -319,11 +340,19 @@ fn icc_spaces(pdf: &[u8]) -> Vec<(String, String)> { let Some(head) = find(pdf, format!("\n{stream} 0 obj").as_bytes(), 0) else { continue }; let dict = pdf.get(head..find(pdf, b"stream", head).unwrap_or(pdf.len())).unwrap_or_default(); if find(dict, b"/N 4", 0).is_some() { + if own == Some(stream) { + own_cmyk.get_or_insert(format!("/CS {array} 0 R")); + } cmyk.get_or_insert(format!("/CS {array} 0 R")); } else if find(dict, b"/N 3", 0).is_some() { rgb.push(format!("/CS {array} 0 R")); } } + let cmyk = own_cmyk.or_else(|| match without { + Without::FirstCmyk => cmyk, + Without::DeviceCmyk => cmyk.map(|_| "/CS/DeviceCMYK".to_string()), + Without::Rgb => None, + }); let Some(cmyk) = cmyk else { return vec![] }; rgb.into_iter().map(|r| (r, cmyk.clone())).collect() } @@ -385,3 +414,27 @@ pub(super) fn date_time(t: i64) -> krilla::metadata::DateTime { .utc_offset_hour(0) .utc_offset_minute(0) } + +#[cfg(test)] +mod tests { + use super::{Without, icc_spaces}; + + /// Objects 1 to 3: an RGB ICC-based space (profile 4), then two CMYK ones (profiles 5, 6). + const SPACES: &[u8] = b"%PDF-1.7\n1 0 obj\n[/ICCBased 4 0 R]\nendobj\n2 0 obj\n[/ICCBased 5 0 R]\nendobj\n3 0 obj\n[/ICCBased 6 0 R]\nendobj\n\ + 4 0 obj\n<>stream\n\nendstream\nendobj\n5 0 obj\n<>stream\n\nendstream\nendobj\n\ + 6 0 obj\n<>stream\n\nendstream\nendobj\n"; + + #[test] + fn groups_blend_in_the_documents_cmyk_space_else_device_cmyk() { + let rgb = "/CS 1 0 R".to_string(); + // The space of the document's profile, wherever it is. + for without in [Without::FirstCmyk, Without::DeviceCmyk, Without::Rgb] { + assert_eq!(icc_spaces(SPACES, Some(6), without), [(rgb.clone(), "/CS 3 0 R".to_string())], "{without:?}"); + } + // Without it, DeviceCMYK, or RGB where DeviceCMYK isn't allowed, rather than another + // profile's space; the first CMYK space when the document's profile isn't known. + assert_eq!(icc_spaces(SPACES, None, Without::DeviceCmyk), [(rgb.clone(), "/CS/DeviceCMYK".to_string())]); + assert_eq!(icc_spaces(SPACES, None, Without::Rgb), []); + assert_eq!(icc_spaces(SPACES, None, Without::FirstCmyk), [(rgb, "/CS 2 0 R".to_string())]); + } +} diff --git a/crates/pdf/src/images.rs b/crates/pdf/src/images.rs index 4139259583..d1382449e5 100644 --- a/crates/pdf/src/images.rs +++ b/crates/pdf/src/images.rs @@ -10,7 +10,9 @@ //! CMYK images ([`ImageBlob::cmyk`]) stay CMYK: a CMYK JPEG already as asked is embedded as it is //! when its numbers are kept; the others' ink amounts are resampled, converted when the Output //! settings convert CMYK colours ([`CmykPixels`]) and compressed again. CMYK JPEGs hold Adobe's -//! inverted samples, which the PDF writer's Decode array undoes. +//! inverted samples, which the PDF writer's Decode array undoes. A CMYK image whose numbers are +//! kept carries the CMYK profile it is given ([`cmyk_icc`]), whether it is embedded as it is or +//! written again; without one it is untagged, a JPEG's own `ICC_PROFILE` segments included. use std::io::Cursor; use std::sync::Arc; @@ -26,7 +28,8 @@ use vectorcraft_doc::cmyk::jpeg_components; use crate::output::{CmykPixels, Pixels}; use crate::{CompressionSettings, Downsample, ImageCodec, JpegQuality, MonoCodec}; -/// Raw 8-bit pixels: colour samples (RGB, grey or CMYK) and an optional alpha channel. +/// Raw 8-bit pixels: colour samples (RGB, grey or CMYK) and an optional alpha channel, with the +/// ICC profile the colour samples are in, if any. #[derive(Clone, Hash)] struct Raw { color: Arc>, @@ -34,6 +37,7 @@ struct Raw { width: u32, height: u32, space: ImageColorspace, + icc: Option>>, } impl CustomImage for Raw { @@ -54,7 +58,7 @@ impl CustomImage for Raw { } fn icc_profile(&self) -> Option<&[u8]> { - None + self.icc.as_deref().map(Vec::as_slice) } fn color_space(&self) -> ImageColorspace { @@ -79,7 +83,7 @@ fn from_rgba(rgba: &[u8], width: u32, height: u32, interpolate: bool, pixels: Op (px.iter().flat_map(|p| [p[0], p[1], p[2]]).collect(), ImageColorspace::Rgb) }; let alpha = px.iter().any(|p| p[3] < 255).then(|| Arc::new(px.iter().map(|p| p[3]).collect())); - Image::from_custom(Raw { color: Arc::new(color), alpha, width, height, space }, interpolate).ok() + Image::from_custom(Raw { color: Arc::new(color), alpha, width, height, space, icc: None }, interpolate).ok() } /// Are all of the RGBA pixels `rgba` grey? @@ -88,9 +92,57 @@ fn neutral(rgba: &[u8]) -> bool { } /// Colour `samples` (grey, RGB, or CMYK ink amounts, as `space` says) with an optional `alpha` -/// channel, written losslessly. -fn lossless(samples: Vec, alpha: Option>, space: ImageColorspace, width: u32, height: u32, interpolate: bool) -> Option { - Image::from_custom(Raw { color: Arc::new(samples), alpha: alpha.map(Arc::new), width, height, space }, interpolate).ok() +/// channel, written losslessly, tagged with ICC profile `icc` when given. +fn lossless( + samples: Vec, + alpha: Option>, + space: ImageColorspace, + width: u32, + height: u32, + interpolate: bool, + icc: Option<&[u8]>, +) -> Option { + let icc = icc.map(|icc| Arc::new(icc.to_vec())); + Image::from_custom(Raw { color: Arc::new(samples), alpha: alpha.map(Arc::new), width, height, space, icc }, interpolate).ok() +} + +/// Most pixels an image may have to be embedded: twice what the app reads (64 million), so every image +/// it holds is still written. +pub(crate) const MAX_EMBED_PIXELS: u64 = 1 << 27; + +/// The most bytes a CMYK profile carried by an image is written with (16 MiB). +const MAX_ICC: usize = 16 << 20; + +/// The CMYK ICC profile image `blob` carries ([`ImageBlob::cmyk_icc_profile`]), when it is one a +/// CMYK image can be tagged with: at most [`MAX_ICC`] bytes, the size its header declares, the +/// `acsp` signature, an input, display, output or colour space profile of CMYK colours, and a tag +/// table whose tags lie within it. `None` for other images and other profiles. +pub(crate) fn cmyk_icc(blob: &ImageBlob) -> Option> { + blob.cmyk_icc_profile().filter(|icc| valid_cmyk_icc(icc)) +} + +/// Is `icc` a CMYK profile as [`cmyk_icc`] describes? +fn valid_cmyk_icc(icc: &[u8]) -> bool { + let be = |at: usize| icc.get(at..at + 4).and_then(|b| b.try_into().ok()).map(u32::from_be_bytes); + let fits = |at: u32, len: u32| u64::from(at) + u64::from(len) <= icc.len() as u64; + if icc.len() > MAX_ICC || be(0).and_then(|n| usize::try_from(n).ok()) != Some(icc.len()) { + return false; + } + let class = icc.get(12..16); + if icc.get(36..40) != Some(b"acsp".as_slice()) + || icc.get(16..20) != Some(b"CMYK".as_slice()) + || ![b"scnr", b"mntr", b"prtr", b"spac"].iter().any(|c| class == Some(c.as_slice())) + { + return false; + } + let Some(count) = be(128) else { return false }; + if !fits(132, count.saturating_mul(12)) { + return false; + } + (0..count as usize).all(|i| { + let at = 132 + i * 12; + matches!((be(at + 4), be(at + 8)), (Some(offset), Some(len)) if fits(offset, len)) + }) } /// [`from_rgba`] of pixels converted by `pixels` (when given). @@ -114,7 +166,7 @@ pub(crate) fn from_inks(inks: Vec, alpha: Vec, width: u32, height: u32, Some(p) => p.convert(&inks), None => (inks, ImageColorspace::Cmyk), }; - lossless(samples, alpha, space, width, height, interpolate) + lossless(samples, alpha, space, width, height, interpolate, None) } /// The kinds of images the Compression section has settings for. @@ -291,7 +343,7 @@ pub(crate) fn recode(bytes: &[u8], size: (f64, f64), c: &CompressionSettings, in None if grey => (rgba.pixels().map(|p| p[0]).collect(), ImageColorspace::Luma), None => (rgba.pixels().flat_map(|p| [p[0], p[1], p[2]]).collect(), ImageColorspace::Rgb), }; - to_jpeg(&samples, space, width, height, q, interpolate) + to_jpeg(&samples, space, width, height, q, interpolate, None) }); let image = jpeg.or_else(|| from_rgba(rgba.as_raw(), width, height, interpolate, convert)); Recoded { image, warning: rule.instead } @@ -323,7 +375,8 @@ pub(crate) fn coverage_sized(w: u32, h: u32, cover: Vec, size: (f64, f64), c /// is when its numbers are (`convert` is `None`); otherwise its ink amounts are resampled, /// converted by `convert` and compressed again. With `alpha` (one sample a pixel, see /// [`mask_alpha`]) the image is lossless and carries it as its soft mask; `None` then when its -/// inks can't be read. +/// inks can't be read. When its numbers are kept, the image is tagged with CMYK profile `icc` +/// (see [`cmyk_icc`]), and is untagged without one; converted pixels are never tagged with it. pub(crate) fn recode_cmyk( blob: &ImageBlob, size: (f64, f64), @@ -331,13 +384,20 @@ pub(crate) fn recode_cmyk( interpolate: bool, convert: Option<&CmykPixels>, alpha: Option>, + icc: Option<&[u8]>, ) -> Recoded { let rule = rule(c, Kind::Color); let jpeg = jpeg_components(&blob.bytes).is_some(); + let icc = icc.filter(|_| convert.is_none()); if jpeg && convert.is_none() && alpha.is_none() { let dims = ImageReader::new(Cursor::new(blob.bytes.as_slice())).with_guessed_format().ok().and_then(|r| r.into_dimensions().ok()); - if dims.is_some_and(|d| kept(&rule, d, size, true)) { - return Recoded { image: None, warning: rule.instead }; + if let Some((w, h)) = dims.filter(|d| kept(&rule, *d, size, true)) { + // The JPEG data as it is, tagged with `icc` rather than with its own segments; one + // larger than [`MAX_EMBED_PIXELS`] is not written. + let image = (u64::from(w) * u64::from(h) <= MAX_EMBED_PIXELS) + .then(|| Image::from_jpeg_with_icc(blob.bytes.as_ref().clone().into(), icc.map(|i| i.to_vec().into()), interpolate).ok()) + .flatten(); + return Recoded { image, warning: rule.instead }; } } let Some(inks) = blob.cmyk() else { @@ -360,8 +420,8 @@ pub(crate) fn recode_cmyk( None => (inks, ImageColorspace::Cmyk), }; // JPEG needs opaque pixels. - let image = jpeg_quality(&rule, jpeg).filter(|_| alpha.is_none()).and_then(|q| to_jpeg(&samples, space, width, height, q, interpolate)); - let image = image.or_else(|| lossless(samples, alpha, space, width, height, interpolate)); + let image = jpeg_quality(&rule, jpeg).filter(|_| alpha.is_none()).and_then(|q| to_jpeg(&samples, space, width, height, q, interpolate, icc)); + let image = image.or_else(|| lossless(samples, alpha, space, width, height, interpolate, icc)); Recoded { image, warning: rule.instead } } @@ -405,9 +465,9 @@ pub(crate) fn mask_alpha(blob: &ImageBlob, width: u32, height: u32, clip: bool) } /// Opaque colour `samples` (grey, RGB, or CMYK ink amounts, as `space` says) as a JPEG at -/// `quality`. CMYK JPEGs hold Adobe's inverted samples, which the PDF writer's Decode array -/// undoes. -fn to_jpeg(samples: &[u8], space: ImageColorspace, width: u32, height: u32, quality: u8, interpolate: bool) -> Option { +/// `quality`, tagged with ICC profile `icc` when given. CMYK JPEGs hold Adobe's inverted samples, +/// which the PDF writer's Decode array undoes. +fn to_jpeg(samples: &[u8], space: ImageColorspace, width: u32, height: u32, quality: u8, interpolate: bool, icc: Option<&[u8]>) -> Option { let mut out = Vec::new(); match space { ImageColorspace::Cmyk => { @@ -420,5 +480,5 @@ fn to_jpeg(samples: &[u8], space: ImageColorspace, width: u32, height: u32, qual } ImageColorspace::DeviceN => return None, } - Image::from_jpeg(out.into(), interpolate).ok() + Image::from_jpeg_with_icc(out.into(), icc.map(|i| i.to_vec().into()), interpolate).ok() } diff --git a/crates/pdf/src/import/builder.rs b/crates/pdf/src/import/builder.rs index 4a979e8742..0b32054c7b 100644 --- a/crates/pdf/src/import/builder.rs +++ b/crates/pdf/src/import/builder.rs @@ -387,6 +387,21 @@ impl<'p> Builder<'p> { only = fold_stop_opacity(&only, &m).unwrap_or_else(|| only.with_mask(Some(Box::new(m)))); } Some(only) + } else if let [only] = children.as_slice() + && matches!(only.kind, NodeKind::Group { clip: false, .. }) + && only.knockout == Knockout::On + && only.opacity >= 0.999 + && only.blend == BlendMode::Normal + && !only.isolate + && only.extras().mask.is_none() + && mask.is_none() + && !knockout + { + // A knockout group drawn in a form that carries its opacity, blend mode or + // isolation: one knockout group with them. + let mut only = (**only).clone(); + (only.opacity, only.blend, only.isolate) = (opacity, blend, isolate); + Some(only) } else { let mut g = Node::group(self.id(), children); (g.opacity, g.blend, g.isolate) = (opacity, blend, isolate); diff --git a/crates/pdf/src/output.rs b/crates/pdf/src/output.rs index 77bc7d1d66..8114931bc4 100644 --- a/crates/pdf/src/output.rs +++ b/crates/pdf/src/output.rs @@ -18,7 +18,9 @@ //! document's), RGB with sRGB (colours of another RGB space as their sRGB equivalents) and grey //! with the sRGB tone curve. Otherwise they are device colours. PDF/A, PDF/X-3 and PDF/X-4 //! always tag them, whatever `profiles` says; PDF/X-1a never does, and always converts to a -//! CMYK destination (see [`crate::pdfx`]). +//! CMYK destination (see [`crate::pdfx`]). A CMYK image that keeps its numbers is tagged with +//! the CMYK profile it carries, if any, with `all` and `taggedSource`, and in PDF/A, PDF/X-3 +//! and PDF/X-4 unless `profiles` is `destination` ([`ColorOut::cmyk_image_icc`]). //! - Output intent: the profile `outputIntent` names, embedded as the `/GTS_PDFX` output intent //! of the catalog with the condition, identifier and registry; Trapped goes in the document //! information (`/False` when an output intent is written untrapped). PDF/A files carry their @@ -59,6 +61,9 @@ pub(crate) struct ColorOut { dest: Option, /// Colours are written in ICC-based colour spaces. pub tagged: bool, + /// CMYK images that keep their numbers are tagged with the CMYK profile they carry + /// ([`Self::cmyk_image_icc`]). + image_icc: bool, /// The CMYK profile that tags CMYK colours. cmyk_profile: String, /// Tagged RGB colours are written as their sRGB equivalents: why (a warning), when their RGB @@ -105,6 +110,7 @@ impl Default for ColorOut { profile_notes: vec![], dest: None, tagged: false, + image_icc: false, cmyk_profile, srgb_note: None, pixels: OnceLock::new(), @@ -240,6 +246,14 @@ impl ColorOut { ProfileInclusion::All | ProfileInclusion::Destination => true, ProfileInclusion::TaggedSource => !doc.color_profiles.is_empty(), }); + // Source profiles: with `all` and `taggedSource`, and in the files that tag every colour + // unless only the destination profile is asked for; never in PDF/X-1a. + out.image_icc = !set.standard.cmyk_only() + && match set.output.profiles { + ProfileInclusion::All | ProfileInclusion::TaggedSource => true, + ProfileInclusion::None => matches!(set.standard, Standard::PdfA2b | Standard::PdfX3 | Standard::PdfX4), + ProfileInclusion::Destination => false, + }; let rgb = match &out.dest { Some(d) if d.model == Model::Rgb => (d.srgb, d.cms.settings().rgb.clone()), _ => (source.rgb_is_srgb(), st.rgb.clone()), @@ -324,6 +338,16 @@ impl ColorOut { .as_ref() } + /// The CMYK profile CMYK image `blob` is tagged with ([`crate::images::cmyk_icc`]): the one it + /// carries, when its numbers are kept and the Profiles setting or the standard includes source + /// profiles. `None` otherwise, and in PDF/X-1a, whose images are untagged CMYK. + pub(crate) fn cmyk_image_icc(&self, blob: &vectorcraft_doc::ImageBlob) -> Option> { + if !self.image_icc || self.cmyk_pixels().is_some() { + return None; + } + crate::images::cmyk_icc(blob) + } + /// How CMYK images' ink amounts are converted; `None` when they keep their numbers (no /// conversion, or to a CMYK destination that keeps them). pub(crate) fn cmyk_pixels(&self) -> Option<&CmykPixels> { @@ -477,7 +501,7 @@ fn catalog(set: &PdfSettings, cmyk_profile: &str) -> Option { /// The object number of the stream of an ICC-based colour space of `pdf` that holds profile `icc` /// (its data as it is, or Flate-compressed); `None` when no colour space uses that profile. -fn tagging_stream(pdf: &[u8], xref: &Xref, icc: &[u8]) -> Option { +pub(crate) fn tagging_stream(pdf: &[u8], xref: &Xref, icc: &[u8]) -> Option { use std::io::Read; const ICC: &[u8] = b"[/ICCBased "; let mut from = 0; diff --git a/crates/pdf/src/print/plates.rs b/crates/pdf/src/print/plates.rs index ce6c5b336e..8b0876d9f3 100644 --- a/crates/pdf/src/print/plates.rs +++ b/crates/pdf/src/print/plates.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use vectorcraft_color::Color; use vectorcraft_color::cms::{self, Cms, Model, ProfileKind}; use vectorcraft_color::swatch::REGISTRATION; -use vectorcraft_doc::inks::{Link, inks, plates, visit_node_colors}; +use vectorcraft_doc::inks::{Link, StopPlates, inks, plates, spot_color, stop_inks, visit_node_colors}; use vectorcraft_doc::overprint::darken_overprints; use vectorcraft_doc::{ColorMode, Document, ImageBlob, Node, NodeKind}; @@ -101,12 +101,33 @@ impl<'a> Separator<'a> { inks(self.doc, &self.cms, c, link, color.intent).on_plate(plate) } - /// Recolour `n`'s subtree as plate `plate`: the grey of each colour's coverage, unlinked. + /// [`Self::ink`] of a colour that prints process plates `plates` with its spot tint + /// ([`stop_inks`]): the spot plate prints the tint and the process plates print `plates`. With + /// spots as process, each process plate prints `plates` layered with the spot tint's process + /// equivalent, as a separated image's plates layer ([`vectorcraft_doc::separated::Separated::coverage_as`]). + fn stop_ink(&self, plate: &str, c: &Color, link: Link, plates: StopPlates) -> f32 { + let own = stop_inks(self.doc, &self.cms, c, link, plates, self.set.color.intent); + let (Some(_), Some((name, tint))) = (plates, own.spot.as_ref()) else { + return self.ink(plate, c, link); + }; + if !self.set.output.spots_to_process { + return own.on_plate(plate); + } + let Some(i) = cms::PROCESS_PLATES.iter().position(|p| *p == plate) else { + return 0.0; + }; + let spot = spot_color(self.doc, name).map_or(0.0, |s| self.ink(plate, &s.tinted(*tint), None)); + 1.0 - (1.0 - own.cmyk[i]) * (1.0 - spot) + } + + /// Recolour `n`'s subtree as plate `plate`: the grey of each colour's coverage, unlinked and + /// without process plates. pub fn node(&self, plate: &str, n: &mut Node) { - visit_node_colors(n, &mut |c, swatch, tint| { - *c = Color::Gray { k: self.ink(plate, c, swatch.as_deref().map(|s| (s, *tint))) }; + visit_node_colors(n, &mut |c, swatch, tint, plates| { + *c = Color::Gray { k: self.stop_ink(plate, c, swatch.as_deref().map(|s| (s, *tint)), *plates) }; *swatch = None; *tint = 1.0; + *plates = None; }); } diff --git a/crates/pdf/src/surface.rs b/crates/pdf/src/surface.rs index 4229781cdd..b20b9667ab 100644 --- a/crates/pdf/src/surface.rs +++ b/crates/pdf/src/surface.rs @@ -81,6 +81,11 @@ impl<'a> Surface<'a> { self.group(|s| s.push_isolated()); } + /// A transparency group with `options` (isolated, knockout), as [`Self::push_isolated`]. + pub fn push_group(&mut self, options: krilla::blend::GroupOptions) { + self.group(|s| s.push_group(options)); + } + /// The mask's stream is already in [`Self::group_transform`]'s space, like the group's art. pub fn push_mask(&mut self, mask: Mask) { self.group(|s| s.push_mask(mask)); diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index d63aaedb35..bee80238bd 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -271,6 +271,71 @@ fn a_scaled_nine_slice_instance_keeps_its_corners() { assert!(close(boxes[2], Rect::new(105.0, 85.0, 135.0, 105.0), 0.01), "{boxes:?}"); } +/// An instance of symbol `name` placed by `xf`, its fill red at `opacity` (shown when `visible`). +fn stained_instance(name: &str, xf: Affine, opacity: f32, visible: bool) -> Node { + let mut n = Node::new(NodeId(0), NodeKind::SymbolInstance { symbol: name.into(), xf }); + n.appearance = Appearance::basic(Paint::solid(Color::rgb(1.0, 0.0, 0.0)), Paint::None, 0.0).into(); + n.appearance.items.retain(AppearanceItem::is_fill); + if let AppearanceItem::Fill(f) = &mut n.appearance.items[0] { + (f.opacity, f.visible) = (opacity, visible); + } + n +} + +/// The fill colors of `d`'s leaves, in paint order. +fn leaf_fills(d: &Document) -> Vec { + leaves(d).iter().filter_map(|n| n.appearance.fill_paint().color()).map(|c| c.to_hex()).collect() +} + +/// A stained instance is written in the colors the canvas draws it in +/// ([`vectorcraft_brush::instance_art`]): on its own, with a Transform effect that moves it, inside +/// a group, after a dynamic symbol's own fill change, and placed through 9-slice guides. A hidden +/// fill or one at 0% opacity leaves the art's colors as they are. +#[test] +fn a_stained_instance_keeps_its_stain() { + let blue = Color::rgb8(30, 90, 220); + let art = || Node::group(NodeId(0), vec![Arc::new(rect_node(Rect::new(0.0, 0.0, 100.0, 100.0), blue))]); + let canvas = |n: &Node| leaf_fills_of(&vectorcraft_brush::instance_art(&art(), n)); + fn leaf_fills_of(n: &Node) -> Vec { + let mut d = doc(10.0, 10.0); + add(&mut d, n.clone()); + leaf_fills(&d) + } + let write = |n: Node, nine_slice: bool| { + let mut d = doc(300.0, 200.0); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: true, name: "Panel".into(), art: Arc::new(art()) }); + if nine_slice { + d.set_symbol_nine_slice("Panel", Some(vectorcraft_doc::SymbolNineSlice::default())); + } + add(&mut d, n); + leaf_fills(&roundtrip(&d)) + }; + let half = stained_instance("Panel", Affine::translate((20.0, 20.0)), 0.5, true); + let want = canvas(&half); + assert_ne!(want, [blue.to_hex()], "the stain changes the color"); + assert_eq!(write(half.clone(), false), want, "on its own"); + let mut moved = half.clone(); + moved.appearance.effects.push(vectorcraft_doc::Effect { + id: "distort.transform".into(), + params: serde_json::json!({"moveH": 30.0}), + visible: true, + }); + assert_eq!(write(moved, false), want, "with a geometry effect"); + assert_eq!(write(Node::group(NodeId(0), vec![Arc::new(half.clone())]), false), want, "in a group"); + let mut scaled = half.clone(); + scaled.kind = NodeKind::SymbolInstance { symbol: "Panel".into(), xf: Affine::translate((20.0, 20.0)) * Affine::scale_non_uniform(2.0, 1.5) }; + assert_eq!(write(scaled, true), want, "through 9-slice guides"); + let mut changed = half.clone(); + changed.extras_mut().symbol_overrides = + vec![vectorcraft_doc::SymbolOverride { path: vec![0], fill: Some(Paint::solid(Color::rgb(0.0, 1.0, 0.0))), ..Default::default() }]; + let changed_want = canvas(&changed); + assert_ne!(changed_want, want, "the part's own fill is stained"); + assert_eq!(write(changed, false), changed_want, "after a dynamic symbol's change"); + for (opacity, visible) in [(0.0, true), (0.5, false)] { + assert_eq!(write(stained_instance("Panel", Affine::IDENTITY, opacity, visible), false), [blue.to_hex()], "unstained"); + } +} + /// The placed art of all the 9-slice instances in one export holds at most `MAX_SYMBOL_NODES` /// objects, opacity-mask art included, as on the canvas: of two instances whose art placed through /// the guides holds about 9,009,000 objects each (a gradient square in all nine cells, each copy diff --git a/crates/pdf/src/tests/blend.rs b/crates/pdf/src/tests/blend.rs index 346b4f34d9..c55a0b7504 100644 --- a/crates/pdf/src/tests/blend.rs +++ b/crates/pdf/src/tests/blend.rs @@ -97,3 +97,466 @@ fn a_knockout_group_with_blending_elements_is_non_isolated_unless_isolated() { assert_eq!(text(&d).contains("/Itrue"), isolate, "isolate {isolate}"); } } + +/// A knockout group of `n` red, green and blue squares at 50% opacity that all overlap, over an +/// opaque backdrop. `knockout_shape`: their opacity defines their knockout shape. +fn knockout_squares(n: usize, knockout_shape: bool, isolate: bool) -> Document { + let mut d = Document::new(200.0, 200.0); + add(&mut d, rect(Rect::new(0.0, 0.0, 200.0, 200.0), (0.9, 0.8, 0.2))); + let colors = [(1.0, 0.0, 0.0), (0.0, 0.8, 0.0), (0.0, 0.0, 1.0)]; + let squares = (0..n) + .map(|i| { + let x = (i % 20) as f64 * 2.0; + let mut s = rect(Rect::new(20.0 + x, 50.0, 120.0 + x, 150.0), colors[i % 3]); + (s.id, s.opacity, s.knockout_shape) = (d.alloc_id(), 0.5, knockout_shape); + std::sync::Arc::new(s) + }) + .collect(); + let mut g = Node::group(NodeId(0), squares); + (g.knockout, g.isolate) = (vectorcraft_doc::Knockout::On, isolate); + add(&mut d, g); + d +} + +/// How many objects each knockout group of `d` holds. +fn knockout_groups(d: &Document) -> Vec { + let mut out = vec![]; + d.walk(|n| { + if n.knockout == vectorcraft_doc::Knockout::On { + out.push(n.children().map_or(0, |c| c.len())); + } + }); + out +} + +/// A knockout group whose elements knock out the area they paint is written as one PDF knockout +/// group (`/K true`), whatever the number of elements, and reads back as a knockout group that +/// draws as the original does. +#[test] +fn a_knockout_group_is_written_as_one_pdf_knockout_group() { + for n in [0, 1, 2, 49, 50, 200] { + let d = knockout_squares(n, false, false); + let t = text(&d); + assert_eq!(t.matches("/Ktrue").count(), usize::from(n > 1), "{n}"); + let back = import(&export(&d, &PdfOptions::default()).unwrap()).unwrap_or_else(|e| panic!("{n}: {e}")); + assert_eq!(knockout_groups(&back), if n > 1 { vec![n] } else { vec![] }, "{n}"); + if n == 200 { + vectorcraft_testkit::raster::assert_similar( + &vectorcraft_testkit::raster::render_artboard(&back), + &vectorcraft_testkit::raster::render_artboard(&d), + 4.0, + 0.01, + ); + } + } +} + +/// The knockout group of an isolated group is isolated too (`/I true` beside `/K true`), and the +/// group reads back as isolated and knocking out. (Each translucent element is a group of its own.) +#[test] +fn an_isolated_knockout_group_is_one_isolated_pdf_knockout_group() { + for isolate in [false, true] { + let mut d = knockout_squares(3, false, isolate); + // Blending inside, which isolation keeps from the backdrop. + let g = d.layers[0].children().unwrap()[1].id; + let top = d.node(g).unwrap().children().unwrap()[2].id; + d.node_mut(top).unwrap().blend = BlendMode::Multiply; + let t = text(&d); + assert_eq!(t.matches("/Ktrue").count(), 1, "isolate {isolate}"); + assert_eq!(t.contains("/Itrue/Ktrue"), isolate, "isolate {isolate}"); + let back = import(&export(&d, &PdfOptions::default()).unwrap()).unwrap(); + let mut found = vec![]; + back.walk(|n| { + if n.knockout == vectorcraft_doc::Knockout::On { + found.push(n.isolate); + } + }); + assert_eq!(found, [isolate]); + } +} + +/// A translucent knockout group is written as a form with its opacity around the `/K` group, and +/// reads back as one knockout group with that opacity and its isolation. +#[test] +fn a_translucent_knockout_group_reads_back_as_one_group() { + for isolate in [false, true] { + let mut d = knockout_squares(3, false, isolate); + let g = d.layers[0].children().unwrap()[1].id; + d.node_mut(g).unwrap().opacity = 0.5; + let top = d.node(g).unwrap().children().unwrap()[2].id; + d.node_mut(top).unwrap().blend = BlendMode::Multiply; + let back = import(&export(&d, &PdfOptions::default()).unwrap()).unwrap(); + let mut found = vec![]; + back.walk(|n| { + if matches!(n.kind, vectorcraft_doc::NodeKind::Group { .. }) { + found.push(( + n.knockout == vectorcraft_doc::Knockout::On, + n.isolate, + (n.opacity * 100.0).round(), + n.children().map_or(0, |c| c.len()), + )); + } + }); + assert_eq!(found, [(true, isolate, 50.0, 3)], "isolate {isolate}"); + } +} + +/// Elements whose opacity defines their knockout shape knock out less than a PDF knockout group +/// knocks out: each is drawn through one soft mask of the elements above it, so that 200 of them +/// still read back, every one of them. +#[test] +fn elements_whose_opacity_defines_their_knockout_shape_are_drawn_through_one_mask_each() { + let d = knockout_squares(200, true, false); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + assert!(!r.warnings.iter().any(|w| w.contains("knockout")), "{:?}", r.warnings); + assert!(!text(&d).contains("/Ktrue")); + let back = import(&r.bytes).unwrap(); + let mut paths = 0; + back.walk(|n| paths += usize::from(matches!(n.kind, vectorcraft_doc::NodeKind::Path { .. }))); + // The backdrop and the 200 squares (the masks' copies of them are opacity-mask art). + assert_eq!(paths, 201); +} + +/// When the masks would draw more than [`crate::export::MAX_KNOCKOUT_MASK_OBJECTS`] objects, the +/// group is written as a PDF knockout group, with a warning, and reads back as a knockout group. +#[test] +fn a_knockout_group_too_large_to_mask_is_a_pdf_knockout_group_with_a_warning() { + // 400 elements that all overlap: 79,800 objects in their masks. + const { assert!(400 * 399 / 2 > crate::export::MAX_KNOCKOUT_MASK_OBJECTS) }; + let d = knockout_squares(400, true, false); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + assert!(r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_SHAPES), "{:?}", r.warnings); + assert_eq!(text(&d).matches("/Ktrue").count(), 1); + assert_eq!(knockout_groups(&import(&r.bytes).unwrap()), [400]); +} + +/// In a PDF knockout group each painting operation knocks out the ones before it: an element with +/// two fills, the second in Multiply, is drawn as one group (through a full alpha mask), so that +/// its second fill blends with its first. An element with one fill needs no group. +#[test] +fn an_element_with_several_paints_is_one_group_in_a_knockout_group() { + for (fills, groups) in [(1, 0), (2, 1)] { + let mut d = Document::new(200.0, 200.0); + let below = rect(Rect::new(0.0, 0.0, 100.0, 100.0), (0.0, 0.0, 1.0)); + let mut top = rect(Rect::new(50.0, 50.0, 150.0, 150.0), (1.0, 0.0, 0.0)); + if fills == 2 { + let mut multiply = vectorcraft_doc::FillLayer::new(Paint::solid(Color::rgb(0.0, 0.0, 1.0))); + multiply.blend = BlendMode::Multiply; + top.appearance.items.push(vectorcraft_doc::AppearanceItem::Fill(multiply)); + } + top.id = d.alloc_id(); + let below = Node { id: d.alloc_id(), ..below }; + let mut g = Node::group(NodeId(0), vec![std::sync::Arc::new(below), std::sync::Arc::new(top)]); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + let t = text(&d); + assert_eq!(t.matches("/Ktrue").count(), 1, "{fills}"); + let Some(start) = t.find("/Ktrue") else { panic!("no knockout group") }; + let group = &t[start..]; + let Some(end) = group.find("endstream") else { panic!("no knockout stream") }; + assert_eq!(group[..end].matches("Do").count(), groups, "{fills}: {t}"); + } +} + +/// Elements that don't overlap need no masks of each other. +#[test] +fn knockout_masks_hold_only_the_elements_that_overlap() { + let mut d = Document::new(200.0, 100.0); + let squares = (0..3) + .map(|i| { + let x = f64::from(i) * 60.0; + let mut s = rect(Rect::new(x, 0.0, x + 40.0, 40.0), (0.0, 0.0, 1.0)); + (s.id, s.opacity, s.knockout_shape) = (d.alloc_id(), 0.5, true); + std::sync::Arc::new(s) + }) + .collect(); + let mut g = Node::group(NodeId(0), squares); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + let t = text(&d); + assert!(!t.contains("/Luminosity") && !t.contains("/Ktrue"), "{t}"); +} + +/// The copies of symbol instances drawn in knockout masks don't count toward the objects the +/// visible symbol art of an export may hold (`MAX_SYMBOL_NODES`): of two overlapping 50% instances +/// whose art placed through 9-slice guides holds about 6,510,000 objects each (a gradient square +/// in all nine cells, each copy with a disabled opacity mask of 723,351 objects), both are written +/// in their nine cells, although the lower one's mask draws a copy of the upper one first. +#[test] +fn knockout_mask_copies_of_symbol_instances_leave_the_visible_art_its_object_limit() { + let d = panel_instances(850, &[20.0, 40.0]); + // Nine squares of each instance (the mask's copy of the upper one is opacity-mask art). + assert_eq!(painted_paths(&export(&d, &PdfOptions::default()).unwrap()), 18); +} + +/// A knockout group of overlapping 50% instances, at `xs`, of a symbol whose art placed through +/// 9-slice guides holds 9 × (`mask_objects`² + `mask_objects` + 3) objects (a gradient square in +/// all nine cells, each copy with a disabled opacity mask of `mask_objects`² + `mask_objects` + 1 +/// objects). +fn panel_instances(mask_objects: usize, xs: &[f64]) -> Document { + use vectorcraft_color::{Gradient, GradientPaint}; + use vectorcraft_geom::Affine; + let mut d = Document::new(300.0, 200.0); + let leaf = std::sync::Arc::new(rect(Rect::new(0.0, 0.0, 1.0, 1.0), (0.0, 0.0, 0.0))); + let inner = std::sync::Arc::new(Node::group(NodeId(0), vec![leaf; mask_objects])); + let mut mask = vectorcraft_doc::OpacityMask::new(Node::group(NodeId(0), vec![inner; mask_objects]), true); + (mask.linked, mask.disabled) = (false, true); + let gradient = Paint::Gradient(Box::new(GradientPaint::new(Gradient::default()))); + let mut square = Node::path(NodeId(0), shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 100.0)), Appearance::basic(gradient, Paint::None, 0.0)); + square.extras_mut().mask = Some(Box::new(mask)); + let art = Node::group(NodeId(0), vec![std::sync::Arc::new(square)]); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Panel".into(), art: std::sync::Arc::new(art) }); + d.set_symbol_nine_slice("Panel", Some(vectorcraft_doc::SymbolNineSlice::default())); + let instances = xs + .iter() + .map(|&x| { + let xf = Affine::translate((x, 20.0)) * Affine::scale_non_uniform(2.0, 1.5); + let mut n = Node::new(NodeId(0), vectorcraft_doc::NodeKind::SymbolInstance { symbol: "Panel".into(), xf }); + (n.id, n.opacity, n.knockout_shape) = (d.alloc_id(), 0.5, true); + std::sync::Arc::new(n) + }) + .collect(); + let mut g = Node::group(NodeId(0), instances); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + d +} + +/// The paths of `pdf` read back, the art of opacity masks left out. +fn painted_paths(pdf: &[u8]) -> usize { + let mut paths = 0; + import(pdf).unwrap().walk(|n| paths += usize::from(matches!(n.kind, vectorcraft_doc::NodeKind::Path { .. }))); + paths +} + +/// When the copies the knockout masks draw would hold more symbol objects than they may +/// (`MAX_SYMBOL_NODES` of their own), the group is written as a PDF knockout group, with a +/// warning, instead of masks that leave out art their elements cover: four overlapping instances +/// of about 3,870,000 objects each fit the visible art's limit, and the six copies in their masks +/// do not. +#[test] +fn knockout_masks_whose_symbol_copies_run_out_give_way_to_a_pdf_knockout_group() { + let d = panel_instances(655, &[20.0, 40.0, 60.0, 80.0]); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + assert!(r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_SHAPES), "{:?}", r.warnings); + assert_eq!(painted_paths(&r.bytes), 36); +} + +/// A brushed stroke draws brush art that the objects counted for the knockout masks leave out: +/// a group in which a mask would draw an element with a brushed stroke is written as a PDF +/// knockout group, with a warning. A brushed element that no mask draws (the lowest one) leaves +/// the masks as they are. +#[test] +fn a_knockout_group_whose_masks_would_draw_a_brushed_stroke_is_a_pdf_knockout_group() { + for (brushed, expected) in [(1, true), (0, false)] { + let mut d = Document::new(200.0, 200.0); + let squares = (0..2) + .map(|i| { + let x = f64::from(i) * 40.0; + let mut s = rect(Rect::new(20.0 + x, 50.0, 120.0 + x, 150.0), (0.0, 0.0, 1.0)); + (s.id, s.opacity, s.knockout_shape) = (d.alloc_id(), 0.5, true); + if i == brushed { + let mut st = vectorcraft_doc::StrokeLayer::new(Paint::solid(Color::BLACK), 3.0); + st.brush = Some("3 pt. Round".into()); + s.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(st)); + } + std::sync::Arc::new(s) + }) + .collect(); + let mut g = Node::group(NodeId(0), squares); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + assert_eq!(r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_BRUSHES), expected, "{brushed}: {:?}", r.warnings); + assert!(!r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_SHAPES), "{brushed}: {:?}", r.warnings); + assert_eq!(text(&d).matches("/Ktrue").count(), usize::from(expected), "{brushed}"); + } +} + +/// The knockout group of `upper` at 50%, whose opacity defines its knockout shape when +/// `knockout_shape`, between two 50% squares whose opacity defines theirs (so that the group is +/// drawn through masks): whether the export gives the brushed-stroke warning. +fn warns_of_brushes(mut d: Document, mut upper: Node, knockout_shape: bool) -> bool { + (upper.id, upper.opacity, upper.knockout_shape) = (d.alloc_id(), 0.5, knockout_shape); + let mut lower = rect(Rect::new(20.0, 50.0, 120.0, 150.0), (1.0, 0.0, 0.0)); + (lower.id, lower.opacity, lower.knockout_shape) = (d.alloc_id(), 0.5, true); + let mut top = rect(Rect::new(100.0, 50.0, 180.0, 150.0), (0.0, 0.8, 0.0)); + (top.id, top.opacity, top.knockout_shape) = (d.alloc_id(), 0.5, true); + let mut g = Node::group(NodeId(0), [lower, upper, top].map(std::sync::Arc::new).to_vec()); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_BRUSHES) +} + +/// A square at (60, 50) with a 3 pt brushed stroke. +fn brushed_square() -> Node { + let mut line = rect(Rect::new(60.0, 50.0, 160.0, 150.0), (1.0, 1.0, 1.0)); + let mut st = vectorcraft_doc::StrokeLayer::new(Paint::solid(Color::BLACK), 3.0); + st.brush = Some("3 pt. Round".into()); + line.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(st)); + line +} + +/// Only brushed strokes a mask draws count: a hidden member's is not drawn, nor is one without +/// paint or width, nor the one in the opacity mask of an element whose mask does not define its +/// knockout shape (its copy in a mask leaves the opacity mask out). +#[test] +fn brushed_strokes_that_a_mask_does_not_draw_leave_the_masks_as_they_are() { + let d = Document::new(200.0, 200.0); + let mut hidden = brushed_square(); + hidden.visible = false; + let plain = rect(Rect::new(60.0, 50.0, 160.0, 150.0), (0.0, 0.0, 1.0)); + let group = Node::group(NodeId(0), vec![std::sync::Arc::new(plain.clone()), std::sync::Arc::new(hidden)]); + assert!(!warns_of_brushes(d.clone(), group, true)); + // A brushed stroke without paint or width draws nothing. + for (paint, width) in [(Paint::None, 3.0), (Paint::solid(Color::BLACK), 0.0)] { + let mut idle = brushed_square(); + if let Some(vectorcraft_doc::AppearanceItem::Stroke(st)) = idle.appearance.items.last_mut() { + (st.paint, st.width) = (paint, width); + } + assert!(!warns_of_brushes(d.clone(), idle, true), "width {width}"); + } + assert!(warns_of_brushes(d.clone(), brushed_square(), true)); + // A group's own brushed stroke is drawn too: the export bakes it into a path among the + // group's members. + let mut stroked_group = Node::group(NodeId(0), vec![std::sync::Arc::new(plain.clone())]); + stroked_group.appearance = brushed_square().appearance; + assert!(warns_of_brushes(d.clone(), stroked_group, true)); + for (knockout_shape, expected) in [(false, false), (true, true)] { + let mut masked = plain.clone(); + let mut mask = vectorcraft_doc::OpacityMask::new(brushed_square(), true); + mask.linked = false; + masked.extras_mut().mask = Some(Box::new(mask)); + assert_eq!(warns_of_brushes(d.clone(), masked, knockout_shape), expected, "knockout shape {knockout_shape}"); + } +} + +/// A compound path's members are drawn with its own paint, so a brushed stroke on a member draws +/// nothing; one on the compound path does. +#[test] +fn a_brushed_stroke_counts_on_a_compound_path_and_not_on_its_members() { + let d = Document::new(200.0, 200.0); + let compound = |members: Vec| { + let children = members.into_iter().map(std::sync::Arc::new).collect(); + let mut c = Node::new(NodeId(0), vectorcraft_doc::NodeKind::Compound { children, rule: Default::default() }); + c.appearance = Appearance::basic(Paint::solid(Color::rgb(0.0, 0.0, 1.0)), Paint::None, 0.0).into(); + c + }; + assert!(!warns_of_brushes(d.clone(), compound(vec![brushed_square()]), true)); + let mut stroked = compound(vec![rect(Rect::new(60.0, 50.0, 160.0, 150.0), (1.0, 1.0, 1.0))]); + stroked.appearance = brushed_square().appearance; + assert!(warns_of_brushes(d, stroked, true)); +} + +/// A pattern's tiles draw the brushed strokes in its art: an element filled with such a pattern +/// counts, and one filled with a pattern without them does not. +#[test] +fn a_brushed_stroke_in_a_pattern_counts() { + for (brushed_tile, expected) in [(true, true), (false, false)] { + let mut d = Document::new(200.0, 200.0); + let tile = if brushed_tile { brushed_square() } else { rect(Rect::new(60.0, 50.0, 160.0, 150.0), (1.0, 1.0, 1.0)) }; + d.patterns.push(vectorcraft_doc::pattern::PatternDef::new("Tile", vec![std::sync::Arc::new(tile)])); + let pattern = Paint::Pattern { pattern: "Tile".into(), xf: vectorcraft_geom::Affine::IDENTITY }; + let filled = Node::path(NodeId(0), shapes::rectangle(Rect::new(60.0, 50.0, 160.0, 150.0)), Appearance::basic(pattern, Paint::None, 0.0)); + assert_eq!(warns_of_brushes(d, filled, true), expected, "brushed tile {brushed_tile}"); + } +} + +/// A stroke whose brush the export does not know is drawn as a plain stroke, and a stroke without +/// width draws nothing, not even its pattern's brushed strokes. +#[test] +fn strokes_that_draw_no_brush_art_leave_the_masks_as_they_are() { + let mut unknown = brushed_square(); + if let Some(vectorcraft_doc::AppearanceItem::Stroke(st)) = unknown.appearance.items.last_mut() { + st.brush = Some("No Such Brush".into()); + } + assert!(!warns_of_brushes(Document::new(200.0, 200.0), unknown, true)); + let mut d = Document::new(200.0, 200.0); + d.patterns.push(vectorcraft_doc::pattern::PatternDef::new("Tile", vec![std::sync::Arc::new(brushed_square())])); + let pattern = Paint::Pattern { pattern: "Tile".into(), xf: vectorcraft_geom::Affine::IDENTITY }; + let mut thin = rect(Rect::new(60.0, 50.0, 160.0, 150.0), (0.0, 0.0, 1.0)); + thin.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(vectorcraft_doc::StrokeLayer::new(pattern, 0.0))); + assert!(!warns_of_brushes(d, thin, true)); +} + +/// Type draws the brushed strokes in the patterns its characters are filled with and in the art +/// of its inline graphics. +#[test] +fn brushed_strokes_in_type_patterns_and_inline_graphics_count() { + let text = |d: &mut Document, fill: Paint, inline: bool| { + let style = vectorcraft_doc::CharStyle { size: 60.0, fill, ..Default::default() }; + let mut t = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(60.0, 120.0), "Type", style.clone()); + if inline { + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Brushed".into(), art: std::sync::Arc::new(brushed_square()) }); + let mut run = vectorcraft_doc::TextRun::new("\u{FFFC}", style); + run.inline = Some(vectorcraft_doc::InlineArt::new("Brushed")); + t.runs.push(run); + } + Node::new(NodeId(0), vectorcraft_doc::NodeKind::Text(Box::new(t))) + }; + let black = Paint::solid(Color::BLACK); + let mut d = Document::new(200.0, 200.0); + let plain = text(&mut d, black.clone(), false); + assert!(!warns_of_brushes(d.clone(), plain, true)); + d.patterns.push(vectorcraft_doc::pattern::PatternDef::new("Tile", vec![std::sync::Arc::new(brushed_square())])); + let patterned = text(&mut d, Paint::Pattern { pattern: "Tile".into(), xf: vectorcraft_geom::Affine::IDENTITY }, false); + assert!(warns_of_brushes(d, patterned, true)); + let mut d = Document::new(200.0, 200.0); + let inline = text(&mut d, black, true); + assert!(warns_of_brushes(d, inline, true)); +} + +/// Type draws the brushed strokes of its appearance as brush art too. +#[test] +fn a_brushed_stroke_on_type_counts() { + let style = vectorcraft_doc::CharStyle { size: 60.0, ..Default::default() }; + let text = vectorcraft_doc::TextObject::point(vectorcraft_geom::Point::new(60.0, 120.0), "Type", style); + let mut n = Node::new(NodeId(0), vectorcraft_doc::NodeKind::Text(Box::new(text))); + n.appearance = brushed_square().appearance; + assert!(warns_of_brushes(Document::new(200.0, 200.0), n, true)); +} + +/// The brushed strokes a mask would draw are found in the opacity-mask art of a symbol's art too, +/// and a disabled opacity mask, which is not drawn, holds none. +#[test] +fn brushed_strokes_in_mask_art_count_only_where_the_mask_is_on() { + for (in_symbol, disabled, expected) in [(true, false, true), (false, true, false), (false, false, true)] { + let mut d = Document::new(200.0, 200.0); + let mut line = rect(Rect::new(0.0, 0.0, 100.0, 100.0), (1.0, 1.0, 1.0)); + let mut st = vectorcraft_doc::StrokeLayer::new(Paint::solid(Color::BLACK), 3.0); + st.brush = Some("3 pt. Round".into()); + line.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(st)); + let mut mask = vectorcraft_doc::OpacityMask::new(line, true); + (mask.linked, mask.disabled) = (false, disabled); + let mut masked = rect(Rect::new(0.0, 0.0, 100.0, 100.0), (0.0, 0.0, 1.0)); + masked.extras_mut().mask = Some(Box::new(mask)); + let mut upper = if in_symbol { + let art = Node::group(NodeId(0), vec![std::sync::Arc::new(masked)]); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Masked".into(), art: std::sync::Arc::new(art) }); + let xf = vectorcraft_geom::Affine::translate((60.0, 50.0)); + Node::new(NodeId(0), vectorcraft_doc::NodeKind::SymbolInstance { symbol: "Masked".into(), xf }) + } else { + masked.transform(vectorcraft_geom::Affine::translate((60.0, 50.0)), false); + masked + }; + (upper.id, upper.opacity, upper.knockout_shape) = (d.alloc_id(), 0.5, true); + let mut lower = rect(Rect::new(20.0, 50.0, 120.0, 150.0), (1.0, 0.0, 0.0)); + (lower.id, lower.opacity, lower.knockout_shape) = (d.alloc_id(), 0.5, true); + let mut g = Node::group(NodeId(0), vec![std::sync::Arc::new(lower), std::sync::Arc::new(upper)]); + g.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, g); + let r = export_with_report(&d, &PdfOptions::default()).unwrap(); + let warned = r.warnings.iter().any(|w| w == crate::export::KNOCKOUT_BRUSHES); + assert_eq!(warned, expected, "symbol {in_symbol}, disabled {disabled}: {:?}", r.warnings); + } +} + +/// PDF/A-2 allows transparency: a knockout group is written as one there too. +#[test] +fn a_pdf_a_2b_file_keeps_a_knockout_group() { + let mut o = PdfOptions::default(); + (o.settings.standard, o.settings.compatibility) = (Standard::PdfA2b, Standard::PdfA2b.version()); + let bytes = export(&knockout_squares(3, false, false), &o).unwrap(); + assert_eq!(knockout_groups(&import(&bytes).unwrap()), [3]); +} diff --git a/crates/pdf/src/tests/cmykimages.rs b/crates/pdf/src/tests/cmykimages.rs index 45222bb04d..4719beec70 100644 --- a/crates/pdf/src/tests/cmykimages.rs +++ b/crates/pdf/src/tests/cmykimages.rs @@ -75,16 +75,18 @@ fn cmyk_dict(w: u32, h: u32, more: &str) -> String { const INVERTED: &str = "/Decode [1 0 1 0 1 0 1 0]"; -/// An image XObject of a written PDF: its colour space and the components of its ICC profile, -/// its Decode array, its filter and its stream data. +/// An image XObject of a written PDF: its colour space and the components and bytes of its ICC +/// profile, its Decode array, its filter, its stream data and whether it has a soft mask. #[derive(Debug)] struct Written { space: String, icc_n: Option, + icc: Option>, decode: Vec, filter: Option, data: Vec, width: u32, + smask: bool, } fn written(pdf: &[u8]) -> Vec { @@ -96,22 +98,26 @@ fn written(pdf: &[u8]) -> Vec { if d.get::>(b"Subtype").is_none_or(|n| n.as_ref() != b"Image") { continue; } - let (space, icc_n) = match (d.get::>(b"ColorSpace"), d.get::>(b"ColorSpace")) { - (Some(n), _) => (n.as_str().to_string(), None), + let (space, icc_n, icc) = match (d.get::>(b"ColorSpace"), d.get::>(b"ColorSpace")) { + (Some(n), _) => (n.as_str().to_string(), None, None), (_, Some(a)) => { let mut it = a.flex_iter(); let name = it.next::>().unwrap().as_str().to_string(); - (name, it.next::>().and_then(|s| s.dict().get::(b"N"))) + let profile = it.next::>(); + let n = profile.as_ref().and_then(|s| s.dict().get::(b"N")); + (name, n, profile.map(|s| s.decoded().unwrap().into_owned())) } - _ => (String::new(), None), + _ => (String::new(), None, None), }; out.push(Written { space, icc_n, + icc, decode: d.get::>(b"Decode").map(|a| a.iter::().collect()).unwrap_or_default(), filter: d.get::>(b"Filter").map(|n| n.as_str().to_string()), data: s.raw_data().to_vec(), width: d.get::(b"Width").unwrap_or(0), + smask: d.get::>(b"SMask").is_some(), }); } out @@ -447,6 +453,222 @@ fn the_output_settings_convert_cmyk_images_and_compression_recompresses_them_in_ assert_eq!(blob.cmyk().unwrap().data, flat(ink, 16)); } +/// A version 2.1 output profile of CMYK colors with a one-tag table (`cprt`), its header and table +/// consistent with its size; `edit` changes it after it is made. +fn cmyk_profile(edit: impl FnOnce(&mut Vec)) -> Vec { + let mut icc = vec![0u8; 156]; + icc[0..4].copy_from_slice(&156u32.to_be_bytes()); + icc[8..12].copy_from_slice(&[2, 0x10, 0, 0]); + icc[12..16].copy_from_slice(b"prtr"); + icc[16..20].copy_from_slice(b"CMYK"); + icc[20..24].copy_from_slice(b"Lab "); + icc[36..40].copy_from_slice(b"acsp"); + icc[128..132].copy_from_slice(&1u32.to_be_bytes()); + icc[132..136].copy_from_slice(b"cprt"); + icc[136..140].copy_from_slice(&144u32.to_be_bytes()); + icc[140..144].copy_from_slice(&12u32.to_be_bytes()); + icc[144..156].copy_from_slice(b"text\0\0\0\0VC\0\0"); + edit(&mut icc); + icc +} + +/// `inks` (four bytes a pixel) as a CMYK JPEG carrying `icc` in its `ICC_PROFILE` segments. +fn cmyk_jpeg_with(inks: &[u8], w: u16, h: u16, icc: &[u8]) -> Vec { + let mut out = Vec::new(); + let mut e = jpeg_encoder::Encoder::new(&mut out, 100); + e.add_icc_profile(icc).unwrap(); + e.encode(inks, w, h, jpeg_encoder::ColorType::Cmyk).unwrap(); + out +} + +/// A CMYK TIFF of `w` × `h` pixels of `ink` carrying `icc` as its tag 34675 (written as Open +/// stores a CMYK JPEG that carries one). +fn cmyk_tiff_with(ink: [u8; 4], w: u16, h: u16, icc: &[u8]) -> ImageBlob { + let jpg = cmyk_jpeg_with(&flat(ink, usize::from(w) * usize::from(h)), w, h, icc); + let (tiff, _) = vectorcraft_doc::cmyk::turned_cmyk(&jpg, image::metadata::Orientation::NoTransforms, None).unwrap(); + let blob = ImageBlob::new("image/tiff", tiff); + assert_eq!(blob.cmyk_icc_profile().as_deref(), Some(icc), "the TIFF carries the profile"); + blob +} + +/// A CMYK image whose numbers are kept is written in an ICC-based space of the CMYK profile it +/// carries, byte for byte, when the Profiles setting or the standard includes source profiles: +/// a TIFF written again, a JPEG kept as it is or compressed again, and an image with its mask as +/// its soft mask. Its inks are those it had. Without source profiles it is DeviceCMYK, and a +/// converted image never carries the profile its old numbers were in. +#[test] +fn a_cmyk_image_that_keeps_its_numbers_carries_its_cmyk_profile() { + let ink = [0u8, 102, 255, 0]; + let icc = cmyk_profile(|_| {}); + let tiff = cmyk_tiff_with(ink, 4, 4, &icc); + let tiff_inks = tiff.cmyk().unwrap().data; + let d = image_doc(tiff, 4, 4); + let export = |d: &Document, s: serde_json::Value| { + let out = export_with_report(d, &opts(s.clone())).unwrap_or_else(|e| panic!("{s}: {e}")); + let w: Vec = written(&out.bytes).into_iter().filter(|w| w.space != "DeviceGray").collect(); + assert_eq!(w.len(), 1, "{s}: {w:?}"); + (w.into_iter().next().unwrap(), out.bytes) + }; + let tagged = |w: &Written, s: &serde_json::Value| { + assert_eq!((w.space.as_str(), w.icc_n), ("ICCBased", Some(4)), "{s}"); + assert!(w.icc.as_deref() == Some(icc.as_slice()), "{s}: the image's own profile, byte for byte"); + }; + for s in [ + json!({"output": {"profiles": "all"}}), + json!({"output": {"profiles": "taggedSource"}}), + json!({"standard": "pdfX4"}), + json!({"standard": "pdfX3"}), + json!({"output": {"profiles": "all", "conversion": "preserveNumbers", "destination": DEVICE_CMYK}}), + ] { + let (w, bytes) = export(&d, s.clone()); + tagged(&w, &s); + assert_eq!(blobs(&import(&bytes).unwrap())[0].cmyk().unwrap().data, tiff_inks, "{s}: the inks as they were"); + } + // Without source profiles, untagged; PDF/X-1a images are always DeviceCMYK. + for s in [json!({}), json!({"output": {"profiles": "destination"}}), json!({"standard": "pdfX1a", "output": {"profiles": "all"}})] { + let (w, _) = export(&d, s.clone()); + assert!(w.icc.as_deref() != Some(icc.as_slice()), "{s}: {w:?}"); + } + let (w, _) = export(&d, json!({"standard": "pdfX1a", "output": {"profiles": "all"}})); + assert_eq!(w.space, "DeviceCMYK"); + // Converted to another CMYK profile: its new numbers aren't in the old profile. + let (w, _) = export(&d, json!({"output": {"profiles": "all", "conversion": "destination", "destination": DEVICE_CMYK}})); + assert!(w.icc.as_deref() != Some(icc.as_slice()), "{w:?}"); + + // A CMYK JPEG kept as it is carries the profile only when source profiles are included, and + // PDF/X-1a writes it untagged. + let jpg = cmyk_jpeg_with(&flat(ink, 64 * 64), 64, 64, &icc); + let d = image_doc(ImageBlob::new("image/jpeg", jpg.clone()), 64, 64); + let s = json!({"output": {"profiles": "all"}}); + let (w, _) = export(&d, s.clone()); + tagged(&w, &s); + assert!(w.data == jpg, "the JPEG data unchanged"); + for s in [json!({"standard": "pdfX1a"}), json!({})] { + let (w, _) = export(&d, s.clone()); + assert_eq!((w.space.as_str(), w.filter.as_deref()), ("DeviceCMYK", Some("DCTDecode")), "{s}"); + assert!(w.data == jpg, "{s}: the JPEG data unchanged"); + } + // Resampled and compressed again, it keeps the profile. + let s = json!({"output": {"profiles": "all"}, "compression": {"color": {"downsample": "bicubic", "ppi": 72.0, "abovePpi": 100.0}}}); + let (w, bytes) = export(&d, s.clone()); + tagged(&w, &s); + assert_eq!((w.width, w.filter.as_deref()), (40, Some("DCTDecode")), "{s}"); + assert!(blobs(&import(&bytes).unwrap())[0].cmyk().unwrap().data.as_chunks::<4>().0.iter().all(|p| close(p, &ink, 3))); + + // With its mask as its soft mask. + let mut d = masked_doc(png(image::GrayImage::from_raw(2, 2, vec![255, 128, 0, 64]).unwrap()), true, false); + d.images.insert("img".into(), cmyk_tiff_with(ink, 2, 2, &icc)); + let s = json!({"output": {"profiles": "all"}}); + let (w, bytes) = export(&d, s.clone()); + tagged(&w, &s); + assert!(w.smask, "{w:?}"); + assert!(!String::from_utf8_lossy(&bytes).contains("/S/Luminosity"), "no luminosity soft mask"); +} + +/// A CMYK JPEG kept as it is whose header declares far more pixels than the app reads is left out +/// with a warning, as other images that large are. +#[test] +fn a_kept_cmyk_jpeg_declaring_too_many_pixels_is_left_out() { + let mut jpg = cmyk_jpeg_with(&flat([0, 102, 255, 0], 4), 2, 2, &cmyk_profile(|_| {})); + // Height and width of the SOF0 segment (after its marker, length and precision): 16384 × 16384. + let sof = jpg.windows(2).position(|w| w == [0xFF, 0xC0]).unwrap(); + jpg[sof + 5..sof + 9].copy_from_slice(&[0x40, 0, 0x40, 0]); + assert_eq!(ImageBlob::new("image/jpeg", jpg.clone()).header_size(), Some((16384, 16384))); + let d = image_doc(ImageBlob::new("image/jpeg", jpg), 2, 2); + for s in [ + json!({"compression": {"color": {"downsample": "none"}}}), + json!({"output": {"profiles": "all"}, "compression": {"color": {"downsample": "none"}}}), + ] { + let out = export_with_report(&d, &opts(s.clone())).unwrap(); + assert!(written(&out.bytes).is_empty(), "{s}"); + assert!(out.warnings.iter().any(|w| w.contains("couldn't be decoded")), "{s}: {:?}", out.warnings); + } +} + +/// The profile each transparency group of written PDF `bytes` blends in: its ICC-based space's +/// profile, or `None` for DeviceCMYK. +fn group_profiles(bytes: &[u8]) -> Vec>> { + let text = String::from_utf8_lossy(bytes); + let file = Pdf::new(Arc::new(bytes.to_vec())).unwrap(); + let groups: Vec<&str> = text.split("/Group<<").skip(1).filter(|g| g.contains("/S/Transparency")).collect(); + assert!(!groups.is_empty(), "{text}"); + groups + .into_iter() + .map(|group| { + let cs = group.split("/CS").nth(1).unwrap(); + if cs.starts_with("/DeviceCMYK") { + return None; + } + let cs: i32 = cs.trim_start().split(' ').next().unwrap().parse().unwrap(); + let space = text.split(&format!("\n{cs} 0 obj\n")).nth(1).unwrap(); + let stream: i32 = space.strip_prefix("[/ICCBased ").unwrap().split(' ').next().unwrap().parse().unwrap(); + let profile = file.xref().get::>(craft_pdf::syntax::object::ObjectIdentifier::new(stream, 0)).unwrap(); + Some(profile.decoded().unwrap().into_owned()) + }) + .collect() +} + +/// Transparency in a tagged CMYK document blends in the document's CMYK profile space, not in the +/// space of the profile a CMYK image carries, whichever the file holds first. +#[test] +fn tagged_cmyk_documents_blend_in_their_own_profile_beside_an_image_profile() { + let icc = cmyk_profile(|_| {}); + let document = cms::icc_bytes(&cms::active_settings().cmyk).unwrap().to_vec(); + // A transparent CMYK rectangle over the image, and the image itself transparent. + let mut d = image_doc(cmyk_tiff_with([0, 102, 255, 0], 4, 4, &icc), 4, 4); + let mut n = Node::path( + d.alloc_id(), + shapes::rectangle(Rect::new(20.0, 20.0, 60.0, 60.0)), + Appearance::basic(Paint::solid(Color::cmyk(0.0, 1.0, 0.0, 0.0)), Paint::None, 0.0), + ); + n.opacity = 0.5; + let l = d.layers[0].id; + d.insert(Some(l), 1, n).unwrap(); + let mut alone = Document::new_with_mode(100.0, 100.0, ColorMode::Cmyk); + alone.images.insert("img".into(), cmyk_tiff_with([0, 102, 255, 0], 4, 4, &icc)); + let image = + ImageObject { key: "img".into(), width: 4, height: 4, xf: Affine::scale(10.0), link: None, placement: Default::default(), pixels: None }; + let mut n = Node::new(alone.alloc_id(), NodeKind::Image(Box::new(image))); + n.opacity = 0.5; + let l = alone.layers[0].id; + alone.insert(Some(l), 0, n).unwrap(); + for d in [d, alone] { + let out = export_with_report(&d, &opts(json!({"output": {"profiles": "all"}}))).unwrap(); + let w = written(&out.bytes); + assert!(w.iter().any(|w| w.icc.as_deref() == Some(icc.as_slice())), "the image's own profile: {w:?}"); + for profile in group_profiles(&out.bytes) { + assert!(profile.as_ref().is_none_or(|p| *p == document), "the group blends in the document's CMYK profile or DeviceCMYK"); + } + } +} + +/// Only a well-formed CMYK profile tags an image: one whose size, signature, class, colour space +/// or tag table is wrong leaves it untagged. +#[test] +fn a_cmyk_image_with_a_malformed_profile_is_written_untagged() { + let tag = |icc: Vec| crate::images::cmyk_icc(&ImageBlob::new("image/jpeg", cmyk_jpeg_with(&flat([0, 102, 255, 0], 4), 2, 2, &icc))); + let good = cmyk_profile(|_| {}); + assert_eq!(tag(good.clone()), Some(good)); + let bad: [(&str, Vec); 7] = [ + ("declared size", cmyk_profile(|i| i[0..4].copy_from_slice(&200u32.to_be_bytes()))), + ("signature", cmyk_profile(|i| i[36..40].copy_from_slice(b"xxxx"))), + ("device link class", cmyk_profile(|i| i[12..16].copy_from_slice(b"link"))), + ("RGB colour space", cmyk_profile(|i| i[16..20].copy_from_slice(b"RGB "))), + ("tag beyond the end", cmyk_profile(|i| i[136..140].copy_from_slice(&150u32.to_be_bytes()))), + ("table beyond the end", cmyk_profile(|i| i[128..132].copy_from_slice(&3u32.to_be_bytes()))), + ("header only", cmyk_profile(|i| i.truncate(100))), + ]; + for (what, icc) in bad { + assert_eq!(tag(icc), None, "{what}"); + } + // And the image is written untagged. + let icc = cmyk_profile(|i| i[36..40].copy_from_slice(b"xxxx")); + let d = image_doc(cmyk_tiff_with([0, 102, 255, 0], 4, 4, &icc), 4, 4); + let out = export_with_report(&d, &opts(json!({"output": {"profiles": "taggedSource"}}))).unwrap(); + let w = written(&out.bytes); + assert_eq!((w.len(), w[0].space.as_str()), (1, "DeviceCMYK"), "{w:?}"); +} + /// A Press Quality export of a 2 × 2 CMYK image masked by PNG `mask` on its own pixel grid /// (`clip`, `invert`): the file, and the decoded soft mask of each CMYK image (`None`: it has none). fn export_masked(mask: Vec, clip: bool, invert: bool) -> (Vec, Vec>>) { diff --git a/crates/pdf/src/tests/output.rs b/crates/pdf/src/tests/output.rs index 0ab4d58c18..e0f00dc0e7 100644 --- a/crates/pdf/src/tests/output.rs +++ b/crates/pdf/src/tests/output.rs @@ -161,6 +161,36 @@ fn spot_alternates_and_device_n_gradient_inks_are_written_as_the_document_holds_ assert!(text.contains("/C0[0 0 0.75]/C1[0.75 0.04 0]"), "the stops' C75, K4 and 75% Gold are written as they are"); } +#[test] +fn blend_steps_between_spot_gradients_with_process_plates_print_both_inks() { + let stop = |offset: f32, tint: f32, plates: Option<[f32; 4]>| { + let mut s = GradientStop::new(offset, Color::cmyk(0.0, 0.2, 0.8, 0.1).tinted(tint)); + s.swatch = Some("Gold".into()); + s.tint = tint; + s.plates = plates; + s + }; + let gradient = |tint: f32, plates: Option<[f32; 4]>| { + Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Linear, vec![stop(0.0, tint, plates), stop(1.0, tint, plates)])))) + }; + let step_pdf = |a: &Paint, b: &Paint| { + let mut d = doc(ColorMode::Cmyk, &[]); + d.swatches.push(Swatch { name: "Gold".into(), paint: Paint::solid(Color::cmyk(0.0, 0.2, 0.8, 0.1)), global: true, spot: true }); + let step = vectorcraft_doc::blend::lerp_paint(a, b, 0.5); + let l = d.layers[0].id; + let n = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(10.0, 10.0, 110.0, 30.0)), Appearance::basic(step, Paint::None, 0.0)); + d.insert(Some(l), 0, n).unwrap(); + String::from_utf8_lossy(&export(&d, &PdfOptions::uncompressed()).unwrap()).into_owned() + }; + // The middle step prints 60% Gold over 30% Cyan, in one DeviceN shading of both inks. + let text = step_pdf(&gradient(0.2, Some([0.2, 0.0, 0.0, 0.0])), &gradient(1.0, Some([0.4, 0.0, 0.0, 0.0]))); + assert!(text.contains("[/DeviceN[/Cyan/Gold]"), "{text}"); + assert!(text.contains("/C0[0.3 0.6]/C1[0.3 0.6]"), "{text}"); + // Without plates the step is a Separation shading of Gold alone. + let text = step_pdf(&gradient(0.2, None), &gradient(1.0, None)); + assert!(!text.contains("/DeviceN") && text.contains("[/Separation/Gold/"), "{text}"); +} + /// A spot swatch's Separation space with alternate C0 M20 Y80 K10 under `colorant` (a PDF name). fn gold_separation(colorant: &str) -> String { format!("[/Separation{colorant}/DeviceCMYK<>]") @@ -278,6 +308,60 @@ fn spot_gradients_keep_a_trace_of_process_ink_at_a_light_stop() { } } +/// [`gold_gradient_pdf`] with spot swatch "Leaf" (C100 Y100) in the document too. +fn gold_and_leaf_gradient_pdf(stops: Vec, perceptual: bool) -> String { + let mut d = doc(ColorMode::Cmyk, &[]); + d.swatches.push(Swatch { name: "Gold".into(), paint: Paint::solid(Color::cmyk(0.0, 0.2, 0.8, 0.1)), global: true, spot: true }); + d.swatches.push(Swatch { name: "Leaf".into(), paint: Paint::solid(Color::cmyk(1.0, 0.0, 1.0, 0.0)), global: true, spot: true }); + let mut g = Gradient::new(GradientKind::Linear, stops); + if perceptual { + g.method = GradientMethod::Perceptual; + } + let paint = Paint::Gradient(Box::new(GradientPaint::new(g))); + let l = d.layers[0].id; + let n = Node::path(d.alloc_id(), shapes::rectangle(Rect::new(10.0, 10.0, 110.0, 30.0)), Appearance::basic(paint, Paint::None, 0.0)); + d.insert(Some(l), 0, n).unwrap(); + String::from_utf8_lossy(&export(&d, &PdfOptions::uncompressed()).unwrap()).into_owned() +} + +#[test] +fn gradients_name_only_the_spot_inks_of_stops_that_color_what_draws() { + let black = |offset: f32, opacity: f32| GradientStop { opacity, ..GradientStop::new(offset, Color::cmyk(0.0, 0.0, 0.0, 1.0)) }; + let paper = |offset: f32| GradientStop::new(offset, Color::cmyk(0.0, 0.0, 0.0, 0.0)); + let leaf = |offset: f32, tint: f32| { + let mut s = GradientStop::new(offset, Color::cmyk(1.0, 0.0, 1.0, 0.0).tinted(tint)); + s.swatch = Some("Leaf".into()); + s.tint = tint; + s + }; + let clear_gold = GradientStop { opacity: 0.0, ..gold_stop(0.4, 1.0) }; + for perceptual in [false, true] { + // Gold in a stretch where every stop is clear, and Gold out of order, where the stops at 0 + // and 0.8 cover the stretches next to it: Gold colors nothing, so no Gold plate. + let clear = vec![black(0.0, 1.0), black(0.2, 0.0), clear_gold.clone(), black(0.6, 0.0), black(1.0, 1.0)]; + let out_of_order = vec![black(0.0, 1.0), black(0.8, 1.0), gold_stop(0.2, 1.0), black(0.4, 1.0), black(1.0, 1.0)]; + // Gold at a tint of 0 prints no Gold ink. + let no_tint = vec![gold_stop(0.0, 0.0), black(1.0, 1.0)]; + for (what, stops) in [("clear", clear), ("out of order", out_of_order), ("tint 0", no_tint)] { + let text = gold_gradient_pdf(stops, perceptual); + assert!(!text.contains("/Gold"), "{what}, perceptual {perceptual}: {text}"); + assert!(!text.contains("/DeviceN") && !text.contains("/Separation"), "{what}, perceptual {perceptual}: {text}"); + } + // Without the Gold stop out of order, Leaf's tints over paper are a Separation shading. + let leaf_only = vec![leaf(0.0, 1.0), leaf(0.8, 0.5), gold_stop(0.2, 1.0), paper(0.4), paper(1.0)]; + let text = gold_and_leaf_gradient_pdf(leaf_only, perceptual); + assert!(text.contains("[/Separation/Leaf/") && !text.contains("/Gold") && !text.contains("/DeviceN"), "perceptual {perceptual}: {text}"); + // A clear Gold stop next to an opaque one colors the stretch between them. + let text = gold_gradient_pdf(vec![black(0.0, 1.0), clear_gold.clone(), black(1.0, 1.0)], perceptual); + assert!(text.contains("[/DeviceN[/Black/Gold]"), "perceptual {perceptual}: {text}"); + } + // Gold at a tint of 0 over a 30% cyan plate (a DeviceN gradient read from a PDF) keeps its + // process plate in the same space. + let plated = GradientStop { plates: Some([0.3, 0.0, 0.0, 0.0]), ..gold_stop(1.0, 0.0) }; + let text = gold_gradient_pdf(vec![GradientStop::new(0.0, Color::cmyk(0.3, 0.0, 0.0, 0.0)), plated], false); + assert!(text.contains("[/DeviceN[/Cyan/Gold]"), "{text}"); +} + #[test] fn converting_to_rgb_turns_cmyk_into_rg() { let ink = Color::cmyk(0.0, 1.0, 1.0, 0.0); diff --git a/crates/pdf/src/tests/print.rs b/crates/pdf/src/tests/print.rs index 5c5e1eb2c0..155912c124 100644 --- a/crates/pdf/src/tests/print.rs +++ b/crates/pdf/src/tests/print.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use serde_json::json; -use vectorcraft_color::{Color, Paint, Swatch}; +use vectorcraft_color::{Color, Freeform, FreeformPoint, Gradient, GradientKind, GradientPaint, GradientStop, Paint, Swatch}; use vectorcraft_doc::{Appearance, Artboard, Document, LayerColor, Node, NodeKind}; use vectorcraft_geom::{Rect, shapes}; use vectorcraft_testkit::raster::render_region; @@ -536,6 +536,70 @@ fn cmyk_and_a_spot_separate_into_five_plates() { assert_eq!(inks(&p[2]), [0.0, 40.0], "the gold's yellow"); } +/// A 100 pt CMYK document with spot swatch `Gold` and a square filled with gradient `g`. +fn gold_gradient_doc(g: GradientPaint) -> Document { + let mut d = doc(100.0, 100.0, &[(Rect::new(0.0, 0.0, 50.0, 50.0), Paint::Gradient(Box::new(g)))]); + d.color_mode = vectorcraft_doc::ColorMode::Cmyk; + d.swatches.push(Swatch { name: "Gold".into(), paint: Paint::solid(Color::cmyk(0.0, 0.2, 0.8, 0.1)), global: true, spot: true }); + d +} + +/// The grey of each plate of a separation of `d` (job options `v`), in percent: of the first +/// gradient stop, and of the first freeform point when there is one. No plate keeps a link or +/// process plates. +fn gradient_plates(d: &Document, v: serde_json::Value) -> Vec<(f32, Option)> { + let opts = PrintOptions { settings: settings(v), ..Default::default() }; + let gray = |c: &Color| match c { + Color::Gray { k } => (k * 100.0).round(), + c => panic!("{c:?}"), + }; + let plan = plan(d, &opts).unwrap(); + plan.plates + .iter() + .map(|p| { + let mut found = vec![]; + p.walk(|n| { + if let Some(Paint::Gradient(g)) = n.appearance.fill().map(|f| &f.paint) { + let s = &g.gradient.stops[0]; + assert_eq!((s.swatch.as_deref(), s.tint, s.plates), (None, 1.0, None), "the stop is unlinked"); + found.push((gray(&s.color), g.freeform.as_ref().and_then(|f| f.points.first()).map(|q| gray(&q.color)))); + } + }); + assert_eq!(found.len(), 1); + found[0] + }) + .collect() +} + +#[test] +fn a_spot_gradient_stop_prints_its_process_plates() { + let mut mixed = GradientStop::new(0.0, Color::cmyk(0.25, 0.1, 0.8, 0.05)); + (mixed.swatch, mixed.tint, mixed.plates) = (Some("Gold".into()), 0.5, Some([0.25, 0.0, 0.4, 0.0])); + let g = GradientPaint::new(Gradient::new(GradientKind::Linear, vec![mixed, GradientStop::new(1.0, Color::cmyk(0.0, 0.0, 0.0, 0.0))])); + let d = gold_gradient_doc(g); + let first = |v| gradient_plates(&d, v).into_iter().map(|(s, _)| s).collect::>(); + assert_eq!(first(json!({"output": {"mode": "separations"}})), [25.0, 0.0, 40.0, 0.0, 50.0], "Cyan, Magenta, Yellow, Black, Gold"); + // Spots as process: the plates layered with the gold tint's process inks (0, 10, 40, 5). + assert_eq!(first(json!({"output": {"mode": "separations", "spotsToProcess": true}})), [25.0, 10.0, 64.0, 5.0]); +} + +#[test] +fn a_freeform_gradients_points_separate_into_plates() { + let mut g = GradientPaint::new(Gradient::new(GradientKind::Freeform, vec![GradientStop::new(0.0, Color::cmyk(0.0, 0.0, 0.0, 1.0))])); + let point = FreeformPoint::new(vectorcraft_geom::Point::new(25.0, 25.0), Color::cmyk(0.0, 0.6, 0.0, 0.0)); + g.freeform = Some(Freeform { points: vec![point], ..Default::default() }); + let d = gold_gradient_doc(g); + let set = json!({"output": {"mode": "separations"}}); + let points = gradient_plates(&d, set.clone()).into_iter().map(|(_, p)| p).collect::>(); + assert_eq!(points, [Some(0.0), Some(60.0), Some(0.0), Some(0.0), Some(0.0)], "the point's magenta, on its plate only"); + // Each plate draws the square in the grey of the point's ink on it. + let plan = plan(&d, &PrintOptions { settings: settings(set), ..Default::default() }).unwrap(); + let drawn: Vec = plan.plates.iter().map(|p| render_region(p, Rect::new(0.0, 0.0, 50.0, 50.0), 1.0).over_white(25, 25)[0]).collect(); + for (plate, (v, ink)) in drawn.iter().zip([0.0, 0.6, 0.0, 0.0, 0.0]).enumerate() { + assert!((f32::from(*v) - 255.0 * (1.0 - ink)).abs() <= 3.0, "plate {plate}: {drawn:?}"); + } +} + #[test] fn trim_marks_surround_the_artboard_on_the_paper() { let d = doc(200.0, 100.0, &[(Rect::new(0.0, 0.0, 200.0, 100.0), rgb(1.0, 0.0, 0.0))]); diff --git a/crates/pdf/tests/gradient_forms.rs b/crates/pdf/tests/gradient_forms.rs index 9f06c9b844..7373ec8494 100644 --- a/crates/pdf/tests/gradient_forms.rs +++ b/crates/pdf/tests/gradient_forms.rs @@ -91,9 +91,7 @@ fn fixture(form: Form, kind: GradientKind, mode: ColorMode, origin: Point) -> (D /// Round trips preserve gradient placement for the form types the importer supports. #[test] fn gradients_in_forms_keep_their_position_when_read_back() { - // The importer has a pre-existing mismatch on the knockout's synthesized nested masks; - // Quartz below checks its actual PDF output, along with the other forms. - for form in FORMS.into_iter().filter(|f| !matches!(f, Form::Knockout)) { + for form in FORMS { for kind in [GradientKind::Linear, GradientKind::Radial] { for origin in [Point::ORIGIN, Point::new(125.0, -80.0)] { let (d, opts) = fixture(form, kind, ColorMode::Rgb, origin); diff --git a/crates/plugins/src/objects.rs b/crates/plugins/src/objects.rs index 3e844415a7..192ed24a96 100644 --- a/crates/plugins/src/objects.rs +++ b/crates/plugins/src/objects.rs @@ -951,7 +951,8 @@ fn paints(ap: &Appearance, fill: bool) -> Vec<&Paint> { } /// `p` without swatch links: a plug-in's colours are its own, so only paints it returned -/// unchanged keep theirs. +/// unchanged keep theirs. A gradient stop also loses its process plates, which print only with +/// a spot swatch. fn unlinked(mut p: Paint) -> Paint { match &mut p { Paint::Solid { swatch, tint, .. } => { @@ -961,8 +962,7 @@ fn unlinked(mut p: Paint) -> Paint { Paint::Gradient(g) => { g.swatch = None; for s in &mut g.gradient.stops { - s.swatch = None; - s.tint = 1.0; + s.set_color(s.color, None); } } Paint::None | Paint::Pattern { .. } => {} diff --git a/crates/plugins/src/objects/tests.rs b/crates/plugins/src/objects/tests.rs index 3483971355..5fb48cf396 100644 --- a/crates/plugins/src/objects/tests.rs +++ b/crates/plugins/src/objects/tests.rs @@ -109,27 +109,81 @@ fn only_a_radial_keeps_a_focal_point_through_a_plug_in() { } } -/// A gradient stop's process plates handed back out of range are clamped to 0..1, each in its +/// A gradient stop's process plates handed back out of range are read clamped to 0..1, each in its /// place, in a fill and in a stroke (a JSON number too large for `f32` is infinite); plates in range /// and a stop without plates are kept. #[test] fn gradient_stop_plates_are_clamped_through_a_plug_in() { use vectorcraft_color::{Gradient, GradientKind, GradientPaint, GradientStop}; - let (mut d, ids, _) = doc(); + let (_, ids, _) = doc(); let stops = vec![GradientStop::new(0.0, Color::WHITE), GradientStop::new(0.5, Color::gray(0.5)), GradientStop::new(1.0, Color::BLACK)]; let mut p = serde_json::to_value(Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Linear, stops))))).unwrap(); - p["gradient"]["stops"][0]["plates"] = json!([-0.5, 1.5, -1e300, 1e300]); - p["gradient"]["stops"][1]["plates"] = json!([0.25, 2.0, 0.75, -3.0]); + for (i, plates) in [(0, json!([-0.5, 1.5, -1e300, 1e300])), (1, json!([0.25, 2.0, 0.75, -3.0]))] { + p["gradient"]["stops"][i]["plates"] = plates; + p["gradient"]["stops"][i]["swatch"] = json!("Spot"); + } let out = json!({"objects": [{"id": ids[0].0, "fills": [p.clone()], "strokes": [{"paint": p}]}]}); - apply_output(&mut d, &ids, decode_json(out).unwrap(), None, &keep).unwrap(); - let ap = &d.node(ids[0]).unwrap().appearance; - for (what, paint) in [("fill", ap.fill_paint()), ("stroke", ap.stroke_paint())] { + let out = decode_json(out).unwrap(); + let fill = &out[0].fills.as_ref().unwrap()[0]; + let stroke = &out[0].strokes.as_ref().unwrap()[0].paint; + for (what, paint) in [("fill", fill), ("stroke", stroke)] { let Paint::Gradient(g) = paint else { panic!("a gradient {what}") }; let plates: Vec<_> = g.gradient.stops.iter().map(|s| s.plates).collect(); assert_eq!(plates, [Some([0.0, 1.0, 0.0, 1.0]), Some([0.25, 1.0, 0.75, 0.0]), None], "{what}"); } } +/// A gradient linked to a gradient swatch, whose first stop is linked to a spot swatch at a tint +/// with process plates. +fn spot_gradient(color: Color) -> Paint { + use vectorcraft_color::{Gradient, GradientKind, GradientPaint, GradientStop}; + let mut spot = GradientStop::new(0.0, color); + spot.midpoint = 0.3; + spot.opacity = 0.75; + spot.set_color(color, Some(("Spot".into(), 0.4))); + spot.plates = Some([0.1, 0.2, 0.3, 0.4]); + let mut g = GradientPaint::new(Gradient::new(GradientKind::Linear, vec![spot, GradientStop::new(1.0, Color::BLACK)])); + g.swatch = Some("Blend".into()); + Paint::Gradient(Box::new(g)) +} + +/// A changed gradient handed back loses each stop's spot link, tint and process plates, in a fill +/// and in a stroke, and keeps the stop's color, offset, opacity and midpoint; a new stop handed back +/// with plates and no link has none. +#[test] +fn changed_gradient_fill_and_stroke_drop_spot_plates() { + let (mut d, ids, _) = doc(); + let a = ids[0]; + let was = Color::cmyk(0.0, 0.5, 1.0, 0.0); + d.node_mut(a).unwrap().appearance.set_fill(spot_gradient(was)); + d.node_mut(a).unwrap().appearance.set_stroke(spot_gradient(was)); + let now = Color::cmyk(0.0, 0.25, 0.5, 0.0); + let mut p = serde_json::to_value(spot_gradient(now)).unwrap(); + p["gradient"]["stops"][1]["plates"] = json!([0.5, 0.5, 0.5, 0.5]); + let out = json!({"objects": [{"id": a.0, "fills": [p.clone()], "strokes": [{"paint": p}]}]}); + apply_output(&mut d, &[a], decode_json(out).unwrap(), None, &keep).unwrap(); + let ap = &d.node(a).unwrap().appearance; + for (what, paint) in [("fill", ap.fill_paint()), ("stroke", ap.stroke_paint())] { + let Paint::Gradient(g) = paint else { panic!("a gradient {what}") }; + assert_eq!(g.swatch, None, "{what}"); + let stops: Vec<_> = g.gradient.stops.iter().map(|s| (s.offset, s.color, s.opacity, s.midpoint, s.swatch.clone(), s.tint, s.plates)).collect(); + assert_eq!(stops, [(0.0, now, 0.75, 0.3, None, 1.0, None), (1.0, Color::BLACK, 1.0, 0.5, None, 1.0, None)], "{what}"); + } +} + +/// A gradient handed back as it was keeps its stops' spot links, tints and process plates. +#[test] +fn unchanged_gradient_paint_keeps_spot_plates() { + let (mut d, ids, _) = doc(); + let a = ids[0]; + d.node_mut(a).unwrap().appearance.set_fill(spot_gradient(Color::cmyk(0.0, 0.5, 1.0, 0.0))); + d.node_mut(a).unwrap().appearance.set_stroke(spot_gradient(Color::cmyk(0.0, 0.5, 1.0, 0.0))); + let input: Value = serde_json::from_slice(&encode_input(&d, &[a])).unwrap(); + let before = d.clone(); + apply_output(&mut d, &[a], decode(&serde_json::to_vec(&input).unwrap()).unwrap(), None, &keep).unwrap(); + assert_eq!(d, before); +} + /// A plate that is not a number is 0; infinities go to the nearest end of 0..1. #[test] fn plates_that_are_not_finite_are_in_range() { diff --git a/crates/render/src/frame.rs b/crates/render/src/frame.rs index e16f134aca..7d000aa64f 100644 --- a/crates/render/src/frame.rs +++ b/crates/render/src/frame.rs @@ -110,8 +110,8 @@ pub(crate) struct PlacedEntry { pub(crate) art: std::sync::Weak, /// The art placed, or `None` for art placed again in every frame ([`depends_on_document`]). pub(crate) placed: Option>, - /// The font generation ([`vectorcraft_text::FontDb::generation`]) the art was placed in, when - /// it holds type: the art is placed again when the fonts change. + /// The layout inputs ([`vectorcraft_text::layout_inputs`]) the art was placed with, when it + /// holds type: the art is placed again when the fonts or the hyphenation exceptions change. pub(crate) fonts: Option, /// The 9-slice map the art was placed through ([`Renderer::sliced_art`]), or `None` for art /// placed by the transform alone ([`Renderer::placed_art`]). An entry is used only by the diff --git a/crates/render/src/fx/bounds.rs b/crates/render/src/fx/bounds.rs index 13a6dad415..65ce8a91fd 100644 --- a/crates/render/src/fx/bounds.rs +++ b/crates/render/src/fx/bounds.rs @@ -356,7 +356,7 @@ fn shape_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { }; let reshaped = effects::reshape(Some(symbols.document()), n, symbol.as_ref()); let b = match &reshaped { - Some(r) if matches!(n.kind, NodeKind::SymbolInstance { .. }) && effects::has_item_geometry(n) => instance_piece_bounds(symbols, r), + Some(r) if has_instance_row_effects(n) => instance_piece_bounds(symbols, r), Some(r) if matches!(n.kind, NodeKind::Text(_)) || (matches!(n.kind, NodeKind::Image(_)) && !r.clips()) => { r.children().into_iter().flatten().fold(None, |acc, c| vectorcraft_geom::union_opt(acc, painted_reach(symbols, c))) } @@ -379,9 +379,16 @@ fn shape_bounds(symbols: &SymbolBoxes, n: &Node) -> Option { } } +/// Is `n` a symbol instance whose active fill or stroke has geometry or raster effects that the +/// fills and strokes of its art take ([`effects::has_item_geometry`], +/// [`effects::has_instance_row_raster`])? +fn has_instance_row_effects(n: &Node) -> bool { + matches!(n.kind, NodeKind::SymbolInstance { .. }) && (effects::has_item_geometry(n) || effects::has_instance_row_raster(n)) +} + /// The bounds of `art`, the art [`effects::reshape`] made of a symbol instance whose active fill or -/// stroke has geometry effects ([`effects::has_item_geometry`]): its paths measured with the -/// geometry effects of their fills and strokes ([`visual_bounds`]), the symbol instances in it that +/// stroke has geometry or raster effects ([`has_instance_row_effects`]): its paths measured with the +/// effects of their fills and strokes, shadows and glows included ([`visual_bounds`]), the symbol instances in it that /// took those effects by their own reshaped art in turn, its groups and layers with their own fills /// and strokes by the art those paint ([`effects::evaluate_container`]), its clip groups by their /// clipping paths and other objects as [`Node::visual_bounds_with`] measures them. Hidden objects are left out. @@ -409,7 +416,7 @@ fn pieces_within(symbols: &SymbolBoxes, art: &Node, depth: usize, budget: &mut u g.children().into_iter().flatten().fold(None, |acc, c| vectorcraft_geom::union_opt(acc, pieces_within(symbols, c, depth, budget))) } NodeKind::Path { .. } | NodeKind::Compound { .. } if has_fx(art) => visual_bounds(symbols, art), - NodeKind::SymbolInstance { symbol, .. } if depth < vectorcraft_doc::depth::MAX_DEPTH && effects::has_item_geometry(art) => { + NodeKind::SymbolInstance { symbol, .. } if depth < vectorcraft_doc::depth::MAX_DEPTH && has_instance_row_effects(art) => { let doc = symbols.document(); let reshaped = doc.symbols.iter().find(|s| s.name == *symbol).and_then(|s| { let count = s.art.count() as u64; @@ -616,7 +623,7 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b let art = effects::evaluate_container(Some(symbols.document()), n); let art = art.as_ref().unwrap_or(n); let b = if art.clips() { - art.visual_bounds_with(symbols) + art.visual_bounds_with(symbols).map(|b| with_clip_region(symbols, art, b)) } else { art.children()?.iter().fold(None, |acc, c| vectorcraft_geom::union_opt(acc, member(c))) }?; @@ -639,7 +646,7 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b }; let reshaped = effects::reshape(Some(symbols.document()), n, symbol.as_ref()); let b = match &reshaped { - Some(r) if matches!(n.kind, NodeKind::SymbolInstance { .. }) && effects::has_item_geometry(n) => instance_piece_bounds(symbols, r), + Some(r) if has_instance_row_effects(n) => instance_piece_bounds(symbols, r), Some(r) if matches!(n.kind, NodeKind::Text(_)) || (matches!(n.kind, NodeKind::Image(_)) && !r.clips()) => { r.children().into_iter().flatten().fold(None, |acc, c| vectorcraft_geom::union_opt(acc, inner(c))) } @@ -664,7 +671,7 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b let b = n.visual_bounds_with(symbols)?; let b = match &n.kind { NodeKind::Text(t) => vectorcraft_geom::union_opt(Some(b), glyphs_box(t, n.appearance.outset())).unwrap_or(b), - _ => b, + _ => with_clip_region(symbols, n, b), }; let a = live_content_reach(symbols, n); Some(b.inflate(a, a)) @@ -672,6 +679,24 @@ fn cull_bounds_in(symbols: &SymbolBoxes, n: &Node, after_reshape: bool, brush: b } } +/// `b`, the visual bounds of `n`, grown to the region a clip group's or clipping layer's clipping +/// path clips to when geometry effects in it move or grow that region ([`effects::clip_outline`]) +/// past its plain shape, and to where its stroke paints along it. Other objects keep `b`. +fn with_clip_region(symbols: &SymbolBoxes, n: &Node, b: Rect) -> Rect { + match &n.kind { + NodeKind::Group { children, clip: true } | NodeKind::Layer { children, clip: true, .. } => match children.first() { + Some(c) if effects::needs_bake(c) => { + let s = c.appearance.outset(); + let region = effects::clip_outline(c).map(|(bp, _)| bp.bounding_box().inflate(s, s)); + let painted = if has_fx(c) { visual_bounds(symbols, c) } else { None }; + vectorcraft_geom::union_opt(vectorcraft_geom::union_opt(Some(b), region), painted).unwrap_or(b) + } + _ => b, + }, + _ => b, + } +} + /// The bounds of the art a 3D effect of `n` draws (Revolve, Extrude & Bevel, Inflate, Rotate), /// built now, without `n`'s own raster effects ([`three_d_art_bounds`]): `None` when it draws no /// such art, `Some(None)` when that art paints nothing. The renderer measures the art it keeps diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 72731f7330..cdf817f1e4 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -412,7 +412,7 @@ impl Renderer { /// brush library it reads; for images and placed documents their pixels and files, the /// layer's Dim Images and the options they are drawn with (with /// [`crate::RenderOptions::kept_images_only`], also which pixels and undecodable notes the - /// image store holds); for type the fonts, whether overprinting shows + /// image store holds); for type the fonts and the hyphenation exceptions, whether overprinting shows /// ([`crate::proof::overprints`]) and Document Setup's substitution highlights; and the /// plug-ins installed, with the names of the document's swatches and patterns and its pattern /// definitions (a plug-in's painted pieces can name them), when an object in it has a plug-in @@ -457,7 +457,7 @@ impl Renderer { f.doc.setup.highlight_substituted_glyphs, o.highlight_alternate_glyphs, )); - (vectorcraft_text::FontDb::global().generation(), crate::proof::overprints(f.opts), highlights).hash(&mut h); + (vectorcraft_text::layout_inputs(), crate::proof::overprints(f.opts), highlights).hash(&mut h); } if reads.plugins || (doc.plugins && (reads.symbols || reads.patterns)) { (effects::plugin_revision(), doc.names, doc.patterns).hash(&mut h); diff --git a/crates/render/src/fx/predicates.rs b/crates/render/src/fx/predicates.rs index 4f14cadfd1..e4e479b2e5 100644 --- a/crates/render/src/fx/predicates.rs +++ b/crates/render/src/fx/predicates.rs @@ -20,12 +20,14 @@ pub(crate) fn has_fx(n: &Node) -> bool { /// Does `n` carry visible object-level effects that only apply through its art (type, images, /// symbol instances, live objects; Crop Marks and colour adjustments on anything), is it type with /// a geometry effect on a fill or stroke of its own or an image with a fill or stroke of its own -/// that paints a shape ([`effects::has_item_geometry`]), is it a path whose Transform effect copies -/// it with a gradient or changes its fills and strokes ([`effects::has_transform_art`]), or is it a -/// group or layer with an appearance of its own (see [`Renderer::draw_object_fx`])? +/// that paints a shape ([`effects::has_item_geometry`]), a symbol instance whose active fill or +/// stroke has a raster effect ([`effects::has_instance_row_raster`]), is it a path whose Transform +/// effect copies it with a gradient or changes its fills and strokes ([`effects::has_transform_art`]), +/// or is it a group or layer with an appearance of its own (see [`Renderer::draw_object_fx`])? pub(crate) fn has_object_fx(n: &Node) -> bool { (effects::needs_outline(n) && (visible(&n.appearance.effects) || n.projection().is_some())) || effects::has_item_geometry(n) + || effects::has_instance_row_raster(n) || effects::has_transform_art(n) || effects::has_container_appearance(n) || effects::has_crop_marks(n) diff --git a/crates/render/src/ink.rs b/crates/render/src/ink.rs index 2d67db2073..7bcc117a23 100644 --- a/crates/render/src/ink.rs +++ b/crates/render/src/ink.rs @@ -239,19 +239,29 @@ fn inks(c: &Color) -> [f32; 4] { let key = c.key(); let cms = cms::active(); SEPARATED.with(|s| { - let (owner, seen) = &mut *s.borrow_mut(); + let kept = &mut *s.borrow_mut(); + let i = match kept.iter().position(|(owner, _)| Arc::ptr_eq(owner, &cms)) { + Some(i) => i, + None => { + if kept.len() >= KEPT_TABLES { + kept.remove(0); + } + kept.push((cms.clone(), HashMap::new())); + kept.len() - 1 + } + }; + let seen = &mut kept[i].1; // Large enough for the many colours of gradient meshes and blends, which otherwise cleared // it over and over and separated every colour through the profile again. - if !owner.as_ref().is_some_and(|o| Arc::ptr_eq(o, &cms)) || seen.len() >= 1 << 16 { + if seen.len() >= 1 << 16 { seen.clear(); - *owner = Some(cms.clone()); } *seen.entry(key).or_insert_with(|| cms.to_cmyk(c, cms.settings().intent)) }) } -/// Separated colours, for the colour settings they were separated with. -type Separated = (Option>, HashMap<[u32; 5], [f32; 4]>); +/// Separated colours, for each of the colour settings they were separated with, the newest last. +type Separated = Vec<(Arc, HashMap<[u32; 5], [f32; 4]>)>; thread_local! { static SEPARATED: RefCell = RefCell::default(); @@ -276,31 +286,37 @@ impl InkLut { } } -/// A table built for the colour settings it was built with, and its generation (see [`cached`]). -type Cached = Mutex, Arc, u64)>>; +/// Tables built for the colour settings they were built with, and their generations, the newest +/// last (see [`cached`]). +type Cached = Mutex, Arc, u64)>>; + +/// How many tables each [`Cached`] keeps: documents drawn side by side through their own profiles +/// don't make them again and again. +const KEPT_TABLES: usize = 4; /// The last table generation handed out: images made with a table are cached under its /// generation (see [`crate::images`]), and none is ever reused. static GENERATION: AtomicU64 = AtomicU64::new(0); -static DISPLAY: Cached = Mutex::new(None); +static DISPLAY: Cached = Mutex::new(Vec::new()); /// Screen colours → [`Ink::Cmy`] and [`Ink::K`] values (placed images). -static SEPARATE: Cached<[ProofLut; 2]> = Mutex::new(None); +static SEPARATE: Cached<[ProofLut; 2]> = Mutex::new(Vec::new()); -/// The table in `slot` for the active colour settings, built by `build` when they changed, and -/// its generation. +/// The table in `slot` for the active colour settings, built by `build` when none is kept for +/// them, and its generation. fn cached(slot: &Cached, build: impl FnOnce(&Cms) -> T) -> (Arc, u64) { let cms = cms::active(); let mut s = slot.lock().unwrap_or_else(|e| e.into_inner()); - match &*s { - Some((owner, t, g)) if Arc::ptr_eq(owner, &cms) => (t.clone(), *g), - _ => { - let t = Arc::new(build(&cms)); - let g = GENERATION.fetch_add(1, Ordering::Relaxed) + 1; - *s = Some((cms, t.clone(), g)); - (t, g) - } + if let Some((_, t, g)) = s.iter().find(|(owner, _, _)| Arc::ptr_eq(owner, &cms)) { + return (t.clone(), *g); } + let t = Arc::new(build(&cms)); + let g = GENERATION.fetch_add(1, Ordering::Relaxed) + 1; + if s.len() >= KEPT_TABLES { + s.remove(0); + } + s.push((cms, t.clone(), g)); + (t, g) } /// [`compose`] puts at least this many pixels in each band but the last. @@ -585,6 +601,18 @@ mod tests { assert_eq!(pm.data()[0].r, 204, "source pixels remain unchanged"); } + #[test] + fn tables_of_two_color_settings_are_kept_side_by_side() { + // Two documents drawn in turn through their own settings each keep their tables. + let settings = || Arc::new(Cms::new(&cms::ColorSettings::default()).unwrap()); + let (a, b) = (settings(), settings()); + let tables = |c: &Arc| cms::with_active(c.clone(), || (display_lut().1, separation().1)); + let (first_a, first_b) = (tables(&a), tables(&b)); + assert_ne!(first_a, first_b, "each settings get their own tables"); + assert_eq!(tables(&a), first_a, "the first settings' tables are not made again"); + assert_eq!(tables(&b), first_b, "the second settings' tables are not made again"); + } + #[test] fn the_ink_table_matches_the_profile() { let cms = cms::active(); diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 141c3524c5..6a92d91e8f 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -65,8 +65,8 @@ pub struct Renderer { /// The latest cached glyph geometry for each text object id. A move changes the node's Arc /// but not its glyphs in text space, so the old geometry can still be used after comparison. text_ids: PtrMap, - /// The [`vectorcraft_text::FontDb::generation`] `texts` was laid out with: type lays out - /// again when fonts are added or rescanned. + /// The [`vectorcraft_text::layout_inputs`] `texts` was laid out with: type lays out again + /// when fonts are added or rescanned and when the hyphenation exceptions change. text_fonts: u64, /// Clip regions per clipping path (see [`Self::clip_of`]). clips: FrameCache, diff --git a/crates/render/src/live.rs b/crates/render/src/live.rs index 4d41e16af8..3777c98948 100644 --- a/crates/render/src/live.rs +++ b/crates/render/src/live.rs @@ -127,8 +127,9 @@ struct Walked { } impl Walked { - /// The [`resources_key`] of the node walked: the walk's hash, the font generation when it found - /// type or a placed file, the plug-in revision and the hash of the document's swatch and pattern + /// The [`resources_key`] of the node walked: the walk's hash, the layout inputs (fonts and + /// hyphenation exceptions, [`vectorcraft_text::layout_inputs`]) when it found type or a placed + /// file, the plug-in revision and the hash of the document's swatch and pattern /// names (`names`) when it found a plug-in effect, and the color settings `cms`. Whether a /// plug-in paints its pieces depends on the plug-ins installed, so the names count for every /// plug-in effect. @@ -136,7 +137,7 @@ impl Walked { let mut h = DefaultHasher::new(); self.hash.hash(&mut h); if self.text { - vectorcraft_text::FontDb::global().generation().hash(&mut h); + vectorcraft_text::layout_inputs().hash(&mut h); } if self.plugins { crate::effects::plugin_revision().hash(&mut h); diff --git a/crates/render/src/pattern.rs b/crates/render/src/pattern.rs index 2372abdbf2..317a423681 100644 --- a/crates/render/src/pattern.rs +++ b/crates/render/src/pattern.rs @@ -39,7 +39,8 @@ type TileKey = (String, u64, Ink, bool); /// What a tile was drawn from besides its pattern's own art, for art that shows more than itself: /// the art of every pattern and symbol and the pixels of every image in the document, the -/// document's other data (which holds its brushes), and the fonts. Editing a symbol leaves the art +/// document's other data (which holds its brushes), and the fonts and hyphenation exceptions +/// ([`vectorcraft_text::layout_inputs`]). Editing a symbol leaves the art /// of a pattern that shows it as it was, so the art alone kept the tile from before (#1723). Held /// weakly: a weak reference keeps the allocation, so no other value gets one of these addresses /// while the tile is kept. @@ -66,13 +67,13 @@ impl Deps { art: Self::art(doc).map(Arc::downgrade).collect(), pixels: Self::pixels(doc).map(Arc::downgrade).collect(), unknown: vectorcraft_doc::Shared::downgrade(&doc.unknown), - fonts: vectorcraft_text::FontDb::global().generation(), + fonts: vectorcraft_text::layout_inputs(), } } /// Does `doc` hold what the tile was drawn from? fn current(&self, doc: &Document) -> bool { - self.fonts == vectorcraft_text::FontDb::global().generation() + self.fonts == vectorcraft_text::layout_inputs() && std::ptr::eq(self.unknown.as_ptr(), &*doc.unknown) && self.art.iter().map(Weak::as_ptr).eq(Self::art(doc).map(Arc::as_ptr)) && self.pixels.iter().map(Weak::as_ptr).eq(Self::pixels(doc).map(Arc::as_ptr)) diff --git a/crates/render/src/proof.rs b/crates/render/src/proof.rs index a6736b022d..284ad8ce5d 100644 --- a/crates/render/src/proof.rs +++ b/crates/render/src/proof.rs @@ -4,7 +4,8 @@ //! space (CMYK press or RGB/colour-blindness simulation) → display, through a cached 17³ LUT. //! * **Separations Preview** recolours the *document* before rendering: each paint colour is split //! into process inks (colour-managed), or a spot ink at the colour's tint when it's linked to a -//! spot swatch (solid colours and gradient stops alike). With one plate visible the plate +//! spot swatch (solid colours and gradient stops alike), with the process plates a gradient stop +//! prints beside its spot ink ([`vectorcraft_color::GradientStop::plates`]). With one plate visible the plate //! renders as greyscale ink coverage (black = 100%); with several, the visible inks are //! composited through the proof profile, spots multiplied on top. Colours linked to the //! Registration swatch print their tint on every plate, spot plates included. @@ -29,6 +30,7 @@ use vectorcraft_color::cms::{self, Cms, CmykLut, PROCESS_PLATES, ProofLut, lab}; pub use vectorcraft_color::cms::{Intent, ProofSetup, ProofTarget}; use vectorcraft_color::{Color, Swatch, SwatchGroup}; pub use vectorcraft_doc::inks::{Inks, Link, Plate, inks, map_document_colors, map_node_colors, plates, spot_color}; +use vectorcraft_doc::inks::{StopPlates, map_node_inks, stop_inks}; use vectorcraft_doc::overprint::darken_overprints; use vectorcraft_doc::{Document, ImageBlob, Node, NodeId, Shared}; use vello_cpu::Pixmap; @@ -59,8 +61,8 @@ fn plate_rgb(c: &Cms, proof: &ProofSetup, visible: &[String], ink: &Inks) -> [f3 c.proof_cmyk_to_srgb(cmyk, proof) } -fn plate_color(doc: &Document, c: &Cms, proof: &ProofSetup, visible: &[String], color: &Color, link: Link) -> Color { - let ink = inks(doc, c, color, link, proof.intent); +fn plate_color(doc: &Document, c: &Cms, proof: &ProofSetup, visible: &[String], color: &Color, link: Link, plates: StopPlates) -> Color { + let ink = stop_inks(doc, c, color, link, plates, proof.intent); let mut rgb = plate_rgb(c, proof, visible, &ink); // Over several plates the visible spot inks print on top. for name in visible.iter().filter(|v| visible.len() != 1 && !PROCESS_PLATES.contains(&v.as_str())) { @@ -355,7 +357,7 @@ impl How<'_> { fn apply(&self, a: &mut Arc) { darken_overprints(a, self.discard_white); if let Some((c, proof, visible)) = self.plates { - map_node_colors(Arc::make_mut(a), &mut |col, sw| plate_color(self.doc, c, proof, visible, col, sw)); + map_node_inks(Arc::make_mut(a), &mut |col, sw, plates| plate_color(self.doc, c, proof, visible, col, sw, plates)); } } } diff --git a/crates/render/src/renderer/nodes.rs b/crates/render/src/renderer/nodes.rs index f649453663..15bd354496 100644 --- a/crates/render/src/renderer/nodes.rs +++ b/crates/render/src/renderer/nodes.rs @@ -122,7 +122,8 @@ impl Renderer { /// When a plug-in has been installed or removed since the last check /// ([`effects::plugin_revision`]), drop what the caches keep from plug-in effects: the effect /// geometry of paths with a plug-in effect, the cull bounds of objects that have one or hold one, - /// of symbol instances and of the objects that hold them, and the art drawn for the effects of + /// of symbol instances and of the objects that hold them, the regions of clipping paths that + /// have one or hold one, and the art drawn for the effects of /// objects that have a plug-in effect or hold one. Rasters of raster effects and evaluations of live objects hold /// the revision in their keys when what they draw has a plug-in effect (`fx::Inputs`, /// `live::resources_key`). @@ -148,6 +149,8 @@ impl Renderer { self.geom.retain(|_, e| !holds_plugin_effect(&e.node) && !holds_instance(&e.node)); // The art of a group holds what its members' plug-in effects draw. self.fx_arts.retain(|(node, ..)| !holds_plugin_effect(node)); + // A clipping path's plug-in effects shape the region it clips to. + self.clips.retain(|(node, _)| !holds_plugin_effect(node)); } } diff --git a/crates/render/src/renderer/text.rs b/crates/render/src/renderer/text.rs index b4a0dd0d2e..945ce5303b 100644 --- a/crates/render/src/renderer/text.rs +++ b/crates/render/src/renderer/text.rs @@ -55,7 +55,7 @@ impl Renderer { /// objects) hit for them. Other art is placed again in every frame, and so is art that holds /// symbol instances, type with inline graphics, images, placed documents or raster effects /// ([`depends_on_document`]), and art that the cache has no room for. Art that holds type is - /// placed again when the fonts change. + /// placed again when the fonts or the hyphenation exceptions change. pub(super) fn placed_art(&mut self, art: &Arc, xf: Affine, scale_strokes: bool, inst: Option<&Node>) -> (Arc, bool) { let kept_kind = matches!(art.kind, NodeKind::Group { .. } | NodeKind::Layer { .. }) || vectorcraft_doc::live::is_live(art); // An instance with appearance changes of its own isn't kept: the key doesn't tell them apart. @@ -67,7 +67,7 @@ impl Renderer { let key = (Arc::as_ptr(art) as usize, xf.as_coeffs().map(f64::to_bits), scale_strokes, stain); if let Some(e) = self.placed_arts.get(&key, self.stamp) && std::ptr::eq(e.art.as_ptr(), Arc::as_ptr(art)) - && e.fonts.is_none_or(|g| g == vectorcraft_text::FontDb::global().generation()) + && e.fonts.is_none_or(|g| g == vectorcraft_text::layout_inputs()) && e.slice.is_none() { return match &e.placed { @@ -106,7 +106,7 @@ impl Renderer { if keeps && let Some(e) = self.placed_arts.get(&key, self.stamp) && std::ptr::eq(e.art.as_ptr(), Arc::as_ptr(art)) - && e.fonts.is_none_or(|g| g == vectorcraft_text::FontDb::global().generation()) + && e.fonts.is_none_or(|g| g == vectorcraft_text::layout_inputs()) && e.slice.as_ref() == Some(map) { match e.placed.clone() { @@ -134,7 +134,7 @@ impl Renderer { fn keep_placed(&mut self, key: PlacedKey, art: &Arc, placed: &Arc, slice: Option) -> bool { let kept = (!depends_on_document(art)).then(|| placed.clone()); let keeps = kept.is_some(); - let fonts = (keeps && holds_type(art)).then(|| vectorcraft_text::FontDb::global().generation()); + let fonts = (keeps && holds_type(art)).then(vectorcraft_text::layout_inputs); // The bytes count the key and the entry, the art's allocation that the weak reference // keeps, and the kept art. let bytes = size_of::<(PlacedKey, PlacedEntry, Node)>() + kept.as_deref().map_or(0, lru::node_bytes); @@ -150,7 +150,7 @@ impl Renderer { if !matches!(&a.kind, NodeKind::Text(own) if std::ptr::eq(&**own, t)) { return (Arc::new(text_geom(t)), false); } - let fonts = vectorcraft_text::FontDb::global().generation(); + let fonts = vectorcraft_text::layout_inputs(); if fonts != self.text_fonts { self.texts.clear(); self.text_ids.clear(); diff --git a/crates/render/src/tests/clip.rs b/crates/render/src/tests/clip.rs index 7b04c02e2d..205c2a2583 100644 --- a/crates/render/src/tests/clip.rs +++ b/crates/render/src/tests/clip.rs @@ -95,6 +95,79 @@ fn nothing_to_clip_by_hides_the_art() { assert_eq!(r.pixel(50, 50), CLEAR); } +#[test] +fn the_clipping_paths_geometry_effects_shape_the_clip() { + // A Transform effect moving the left half 50 pt right: the right half shows instead. + let mut d = Document::new(100.0, 100.0); + let mut clip = Node::path(d.alloc_id(), rect(Rect::new(0.0, 0.0, 50.0, 100.0)), Appearance::basic(Paint::None, Paint::None, 0.0)); + clip.appearance.effects.push(vectorcraft_doc::Effect { id: "distort.transform".into(), params: serde_json::json!({"moveH": 50}), visible: true }); + let r = clipped(d, Arc::new(clip)); + assert_eq!(r.pixel(25, 50), CLEAR, "the clipping path's own place"); + assert_eq!(r.pixel(75, 50), BLACK, "where its effect moves it"); +} + +#[test] +fn a_view_of_only_the_moved_clip_draws_the_clipped_art() { + // The clipping path covers x 0 to 50 and its Transform effect moves it to x 50 to 100; the + // view shows x 60 to 100, past the clipping path's own shape. + let mut d = Document::new(100.0, 100.0); + let mut clip = Node::path(d.alloc_id(), rect(Rect::new(0.0, 0.0, 50.0, 100.0)), Appearance::basic(Paint::None, Paint::None, 0.0)); + clip.appearance.effects.push(vectorcraft_doc::Effect { id: "distort.transform".into(), params: serde_json::json!({"moveH": 50}), visible: true }); + let art = Node::path(d.alloc_id(), rect(Rect::new(0.0, 0.0, 100.0, 100.0)), Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0)); + let members = vec![Arc::new(clip), Arc::new(art)]; + let g = Node::new(d.alloc_id(), NodeKind::Group { children: members.clone(), clip: true }); + // The same in a sublayer that clips by its first object. + let mut sublayer = (*d.layers[0]).clone(); + sublayer.id = d.alloc_id(); + if let NodeKind::Layer { children, clip, .. } = &mut sublayer.kind { + (*children, *clip) = (members, true); + } + for clipping in [g, sublayer] { + let mut d = d.clone(); + let l = d.layers[0].id; + d.insert(Some(l), 0, clipping).unwrap(); + let r = Renderer::new().render(&d, 40, 100, Affine::translate((-60.0, 0.0)), &RenderOptions::default()); + assert_eq!(r.pixel(20, 50), BLACK, "x 80, inside the moved clip"); + } +} + +#[test] +fn a_view_of_only_the_moved_clip_draws_a_clip_group_with_its_own_appearance() { + // As above, with the Transform effect on the clipping path itself or on its fill, and the clip + // group with an effect of its own: a Drop Shadow, or a Transform that moves nothing. + let moved = || vectorcraft_doc::Effect { id: "distort.transform".into(), params: serde_json::json!({"moveH": 50}), visible: true }; + let shadow = vectorcraft_doc::Effect { + id: "stylize.dropShadow".into(), + params: serde_json::json!({"x": 0, "y": 6, "blur": 0, "opacity": 100}), + visible: true, + }; + let still = vectorcraft_doc::Effect { id: "distort.transform".into(), params: serde_json::json!({"moveV": 0}), visible: true }; + for on_fill in [false, true] { + for own in [shadow.clone(), still.clone()] { + let mut d = Document::new(100.0, 100.0); + let mut clip = Node::path(d.alloc_id(), rect(Rect::new(0.0, 0.0, 50.0, 100.0)), Appearance::basic(Paint::None, Paint::None, 0.0)); + match clip.appearance.items.iter_mut().find_map(|i| match i { + vectorcraft_doc::AppearanceItem::Fill(f) if on_fill => Some(f), + _ => None, + }) { + Some(f) => f.effects.push(moved()), + None => clip.appearance.effects.push(moved()), + } + let art = + Node::path(d.alloc_id(), rect(Rect::new(0.0, 0.0, 100.0, 100.0)), Appearance::basic(Paint::solid(Color::BLACK), Paint::None, 0.0)); + let mut g = Node::new(d.alloc_id(), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(art)], clip: true }); + g.appearance.effects.push(own.clone()); + let l = d.layers[0].id; + d.insert(Some(l), 0, g).unwrap(); + let what = format!("effect on the fill: {on_fill}, group effect {}", own.id); + let whole = Renderer::new().render(&d, 100, 100, Affine::IDENTITY, &RenderOptions::default()); + assert_eq!(whole.pixel(80, 50), BLACK, "the whole canvas ({what})"); + let r = Renderer::new().render(&d, 40, 100, Affine::translate((-60.0, 0.0)), &RenderOptions::default()); + assert_eq!(r.pixel(20, 50), BLACK, "x 80, inside the moved clip ({what})"); + } + } +} + #[test] fn clip_regions_are_cached_per_clipping_path() { let mut d = Document::new(100.0, 100.0); diff --git a/crates/render/src/tests/colorize.rs b/crates/render/src/tests/colorize.rs index 721707502d..8a8891c7da 100644 --- a/crates/render/src/tests/colorize.rs +++ b/crates/render/src/tests/colorize.rs @@ -289,6 +289,35 @@ fn separations_preview_keeps_a_reduced_dcs_plates_coverage() { assert!(p[..3].iter().all(|v| (100..=160).contains(v)), "half the ink, got {p:?}"); } +/// A gradient stop linked to a spot ink that prints process plates with it shows them on those +/// plates, and its tint on the spot plate. +#[test] +fn separations_preview_shows_a_spot_gradient_stops_process_plates() { + use vectorcraft_color::{Gradient, GradientKind, GradientPaint, GradientStop}; + let mut d = Document::new_with_mode(20.0, 20.0, vectorcraft_doc::ColorMode::Cmyk); + d.swatches.push(vectorcraft_color::Swatch { + name: "Gold".into(), + paint: Paint::solid(Color::cmyk(0.0, 0.2, 0.8, 0.1)), + global: true, + spot: true, + }); + let stop = |offset| { + let mut s = GradientStop::new(offset, Color::cmyk(0.25, 0.1, 0.8, 0.05)); + (s.swatch, s.tint, s.plates) = (Some("Gold".into()), 0.5, Some([0.25, 0.0, 0.4, 0.0])); + s + }; + let g = Paint::Gradient(Box::new(GradientPaint::new(Gradient::new(GradientKind::Linear, vec![stop(0.0), stop(1.0)])))); + let (layer, id) = (d.layers[0].id, d.alloc_id()); + let square = Node::path(id, shapes::rectangle(Rect::new(0.0, 0.0, 20.0, 20.0)), Appearance::basic(g, Paint::None, 0.0)); + d.insert(Some(layer), 0, square).unwrap(); + let gray = |plate: &str| Renderer::new().render(&d, 20, 20, Affine::IDENTITY, &separations(&[plate])).pixel(10, 10)[0]; + let near = |v: u8, ink: f32| (f32::from(v) - 255.0 * (1.0 - ink)).abs() <= 3.0; + for (plate, ink) in [("Cyan", 0.25), ("Magenta", 0.0), ("Yellow", 0.4), ("Black", 0.0), ("Gold", 0.5)] { + let v = gray(plate); + assert!(near(v, ink), "{plate}: {ink} of the ink, got {v}"); + } +} + /// Separations Preview showing `plates`, as the canvas draws it. fn separations(plates: &[&str]) -> RenderOptions { let proof = proof::ProofSetup { separations: Some(plates.iter().map(|p| p.to_string()).collect()), ..Default::default() }; diff --git a/crates/render/src/tests/container.rs b/crates/render/src/tests/container.rs index 89126cf2a2..dfc8dca91c 100644 --- a/crates/render/src/tests/container.rs +++ b/crates/render/src/tests/container.rs @@ -217,9 +217,9 @@ fn type_in_a_group_keeps_its_transparency_and_visibility_under_the_groups_geomet #[test] fn type_in_a_clipping_path_clips_alike_under_the_groups_geometry_effects() { - // The red square is clipped by type with a Transform of its own, which the clip leaves out, - // then by a group of that type and a small square, with the type shown and hidden. Offset - // Path 0 on the clip group leaves every path as it is. + // The red square is clipped by type with a Transform of its own, then by a group of that type + // and a small square, with the type shown and hidden. Offset Path 0 on the clip group leaves + // every path as it is, so the clip group draws the same with it and without it. let doc = |effect: bool, grouped: bool, hidden: bool| { let mut d = Document::new(100.0, 100.0); let style = CharStyle { size: 40.0, fill: Paint::None, ..Default::default() }; diff --git a/crates/render/src/tests/fontchange.rs b/crates/render/src/tests/fontchange.rs index bedffb6b4b..15389cd805 100644 --- a/crates/render/src/tests/fontchange.rs +++ b/crates/render/src/tests/fontchange.rs @@ -3,16 +3,16 @@ use std::sync::{PoisonError, RwLock, RwLockReadGuard, RwLockWriteGuard}; -use vectorcraft_doc::text::{CharStyle, TextObject}; +use vectorcraft_doc::text::{CharStyle, TextKind, TextObject}; use vectorcraft_doc::{Node, NodeKind}; -use vectorcraft_geom::Point; +use vectorcraft_geom::{PathData, Point}; use crate::*; -/// Taken to add fonts, or to look up an installed one by name (`FontDb::face` loads it, which -/// changes the fonts too). Renderers lay type out again when the fonts change, so tests of what -/// they keep between frames hold it shared ([`fonts_steady`]) and the tests that change the fonts -/// hold it alone ([`adding_fonts`]). +/// Taken to add fonts, to look up an installed one by name (`FontDb::face` loads it, which +/// changes the fonts too) or to change the hyphenation exceptions. Renderers lay type out again +/// when the fonts or the exceptions change, so tests of what they keep between frames hold it +/// shared ([`fonts_steady`]) and the tests that change them hold it alone ([`adding_fonts`]). static FONTS: RwLock<()> = RwLock::new(()); /// No fonts are added by these tests until the guard is dropped. @@ -29,14 +29,12 @@ pub(crate) fn adding_fonts() -> RwLockWriteGuard<'static, ()> { /// What `step` returns from a run in which the fonts stayed the same. The fonts can change while /// [`fonts_steady`] is held: the first lookup by family name catalogs the installed fonts, and /// resolving a cataloged family, or a character no loaded font has, loads a face. `step` runs up -/// to 100 times, until [`vectorcraft_text::FontDb::generation`] is the same after a run as before -/// it. +/// to 100 times, until [`vectorcraft_text::layout_inputs`] is the same after a run as before it. pub(crate) fn with_fonts_unchanged(mut step: impl FnMut() -> T) -> T { - let db = vectorcraft_text::FontDb::global(); for _ in 0..100 { - let before = db.generation(); + let before = vectorcraft_text::layout_inputs(); let out = step(); - if db.generation() == before { + if vectorcraft_text::layout_inputs() == before { return out; } } @@ -466,6 +464,75 @@ fn enveloped_type_under_effects_redraws_when_its_font_becomes_available() { } } +/// Hyphenated area type redraws with its new line breaks when Preferences › Hyphenation › +/// Exceptions change: its glyph geometry, the pixels of its raster effects, the art drawn for +/// geometry effects, the art kept for a symbol instance and an envelope's evaluation are made +/// again. +#[test] +fn hyphenated_type_redraws_when_the_exceptions_change() { + let _adding = adding_fonts(); + struct Clear; + impl Drop for Clear { + fn drop(&mut self) { + vectorcraft_text::set_hyphenation_exceptions(""); + } + } + let _clear = Clear; + use vectorcraft_doc::Effect; + let moved = || Effect { id: "distort.transform".into(), params: serde_json::json!({"moveH": 0.0}), visible: true }; + const WORDS: &str = "Extraordinarily comprehensive typographical considerations notwithstanding everything."; + const NEVER: &str = "extraordinarily, comprehensive, typographical, considerations, notwithstanding"; + let cases = ["the area type", "the type with a drop shadow", "the group with a Transform effect", "the symbol instance", "the envelope"]; + for (i, what) in cases.into_iter().enumerate() { + vectorcraft_text::set_hyphenation_exceptions(""); + let mut d = Document::new(300.0, 150.0); + let mut t = TextObject::point(Point::ZERO, WORDS, CharStyle { size: 14.0, ..Default::default() }); + t.kind = TextKind::Area { frame: PathData::from_bezpath(&Rect::new(10.0, 10.0, 130.0, 145.0).to_path(0.1)) }; + t.xf = Affine::IDENTITY; + t.para.hyphenate = true; + let mut object = Node::new(d.alloc_id(), NodeKind::Text(Box::new(t))); + match i { + 0 => {} + 1 => { + let params = serde_json::json!({"x": 4, "y": 4, "blur": 1, "opacity": 100}); + object.appearance.effects.push(Effect { id: "stylize.dropShadow".into(), params, visible: true }); + } + 2 => { + object = Node::group(d.alloc_id(), vec![Arc::new(object)]); + object.appearance.effects.push(moved()); + } + 3 => { + object.appearance.effects.push(moved()); + let art = Node::group(d.alloc_id(), vec![Arc::new(object)]); + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Words".into(), art: Arc::new(art) }); + object = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Words".into(), xf: Affine::IDENTITY }); + } + _ => { + let kind = vectorcraft_doc::EnvelopeKind::Warp { style: "arc".into(), bend: 30.0, h: 0.0, v: 0.0, horizontal: true, version: 0 }; + let envelope = NodeKind::Envelope { + content: vec![Arc::new(object)], + kind: Box::new(kind), + fidelity: 50.0, + editing: false, + options: Default::default(), + frame: Box::new(Affine::IDENTITY), + }; + object = Node::new(d.alloc_id(), envelope); + } + } + let l = d.layers[0].id; + d.insert(Some(l), 0, object).unwrap(); + let opts = RenderOptions { background: Some([255, 255, 255, 255]), ..Default::default() }; + let mut r = Renderer::new(); + let before = r.render(&d, 300, 150, Affine::IDENTITY, &opts).pixels; + vectorcraft_text::set_hyphenation_exceptions(NEVER); + let after = r.render(&d, 300, 150, Affine::IDENTITY, &opts).pixels; + let fresh = Renderer::new().render(&d, 300, 150, Affine::IDENTITY, &opts).pixels; + assert_ne!(before, fresh, "{what}: the words in the list are not broken"); + assert!(after == fresh, "{what}: drawn as a new renderer draws it"); + } +} + /// Without an engine session, a renderer maps an envelope of type from its glyph outline bounds, /// and measures the type again when its font becomes available. #[test] diff --git a/crates/render/src/tests/memory.rs b/crates/render/src/tests/memory.rs index d286fa7e3c..a9226da834 100644 --- a/crates/render/src/tests/memory.rs +++ b/crates/render/src/tests/memory.rs @@ -320,13 +320,13 @@ fn kept_glyphs(r: &mut Renderer, d: &Document) -> Vec>> { .collect() } -/// `f`'s result from a run during which the fonts did not change: other tests add fonts, and the -/// renderer lays all type out again when the fonts change. +/// `f`'s result from a run during which the fonts and the hyphenation exceptions did not change: +/// other tests change them, and the renderer lays all type out again when they change. fn fonts_unchanged(mut f: impl FnMut() -> T) -> T { loop { - let fonts = vectorcraft_text::FontDb::global().generation(); + let inputs = vectorcraft_text::layout_inputs(); let t = f(); - if vectorcraft_text::FontDb::global().generation() == fonts { + if vectorcraft_text::layout_inputs() == inputs { return t; } } @@ -1667,6 +1667,16 @@ fn objects_with_plugin_effects_follow_the_plugins_installed() { plugin_change_draws_as_new(alone(20.0, vec![drop_shadow()]), ID, small.clone(), big.clone()); let blur = effect("blur.gaussian", serde_json::json!({"radius": 1.0})); plugin_change_draws_as_new(alone(20.0, vec![blur]), ID, small.clone(), big.clone()); + // A clip group whose clipping path, the square, has the plug-in effect: it clips a red + // rectangle over the whole view by the shape the plug-in draws. + let mut d = Document::new(200.0, 100.0); + let mut clip = square(&mut d, 20.0, 30.0, vec![]); + if let NodeKind::Path { clipping, .. } = &mut clip.kind { + *clipping = true; + } + let red = filled(&mut d, rectangle(Rect::new(0.0, 0.0, 200.0, 100.0)), Paint::solid(Color::rgb(1.0, 0.0, 0.0)), vec![]); + let group = Node::new(d.alloc_id(), NodeKind::Group { children: vec![Arc::new(clip), Arc::new(red)], clip: true }); + plugin_change_draws_as_new(with_art(d, vec![group]), ID, small.clone(), big.clone()); // An instance of symbol `Shaped`, a group of the square around the origin. let mut d = Document::new(200.0, 100.0); let art = square(&mut d, -20.0, -20.0, vec![]); diff --git a/crates/render/src/tests/typeedges.rs b/crates/render/src/tests/typeedges.rs index fae0207d0d..3295342ce8 100644 --- a/crates/render/src/tests/typeedges.rs +++ b/crates/render/src/tests/typeedges.rs @@ -859,7 +859,7 @@ fn type_outside_its_frame_is_drawn() { fn a_pan_draws_the_type_from_the_kept_pixels() { let _fonts = crate::tests_fontchange::fonts_steady(); let opts = RenderOptions::default(); - let fonts = || vectorcraft_text::FontDb::global().generation(); + let fonts = vectorcraft_text::layout_inputs; // How many type objects a renderer drew offscreen for `b` in `second` after drawing `a` in // `first`. The second frame's pixels are a new renderer's, each channel within `near`. The // frames are drawn again while the fonts change between them (other tests load fonts, and the diff --git a/crates/svg/Cargo.toml b/crates/svg/Cargo.toml index 7708d23c06..36744c8de5 100644 --- a/crates/svg/Cargo.toml +++ b/crates/svg/Cargo.toml @@ -31,6 +31,8 @@ image = { workspace = true } # Colour / transform / length parsing for the fallback (MIT OR Apache-2.0; already used by usvg). svgtypes = "0.16" simplecss = "0.2.2" +# Bidi classes for the first strong character of `unicode-bidi: plaintext` text (MIT OR Apache-2.0; already used by vectorcraft-text). +unicode-bidi = "0.3.18" [dev-dependencies] # Reading embedded font subsets back. diff --git a/crates/svg/src/export/nodes.rs b/crates/svg/src/export/nodes.rs index a4cdf26271..ea1d5ab95b 100644 --- a/crates/svg/src/export/nodes.rs +++ b/crates/svg/src/export/nodes.rs @@ -163,6 +163,18 @@ fn pin_to_page(n: &mut Node, m: Affine) { /// What SVG Tiny 1.2 does without masks. const TINY_MASKS: &str = "SVG Tiny 1.2 has no masks: opacity masks are left out and knockout groups written as plain groups"; + +/// What a knockout group too large to mask is written as. +const KNOCKOUT_SIZE: &str = "knockout groups with too many overlapping elements to mask are written as plain groups"; + +/// The most knockout shapes the masks of one knockout group's elements use between them: each +/// mask uses the shapes of the elements above its own element that overlap it. +const MAX_KNOCKOUT_MASK_SHAPES: usize = 1 << 16; + +/// The most elements of one knockout group drawn through masks: finding the elements that +/// overlap compares every pair. +const MAX_MASKED_ELEMENTS: usize = 2048; + pub(super) const UNDECODED: &str = "an image couldn't be decoded and is missing from the picture"; /// The region of a mask or filter over art that has no box to measure: one covering any artwork. @@ -419,11 +431,75 @@ impl Writer<'_> { self.def(1, ""); self.line(&format!("")); self.depth += 1; + self.spanning_rect(&bare, ®ion); self.node_body(&bare); self.depth -= 1; self.line(""); } + /// Some readers draw a masked group only inside the bounding box of its shapes, which leaves + /// out a drop shadow, blur, glow or feather that paints past them. When `n`, written inside a + /// ``, holds one ([`Self::holds_raster`]), a hidden, unpainted rectangle over the + /// mask's `region` makes that box cover what it paints. + fn spanning_rect(&mut self, n: &Node, region: &str) { + if self.holds_raster(n) { + self.line(&format!("")); + } + } + + /// Do `n`, its fills and strokes, its members at any depth, its symbols' art or the art its + /// live objects are written as have a visible raster effect (shadow, glow, blur, feather)? + /// Objects that aren't written (hidden ones, unless the options keep them) are skipped, and so + /// are fills and strokes that [`Self::shape`] doesn't write (hidden, unpainted or zero-width). + /// An instance with overrides is looked at in the art it is written as + /// ([`vectorcraft_brush::instance_art`]). The walk keeps its own stack, and looks at each + /// symbol's art once, and at each instance's overridden art once. + fn holds_raster(&self, n: &Node) -> bool { + let mut stack: Vec> = vec![]; + let mut symbols: std::collections::HashSet<(String, Option)> = std::collections::HashSet::new(); + let paints = |i: &AppearanceItem| match i { + AppearanceItem::Fill(f) => f.visible && !f.paint.is_none(), + AppearanceItem::Stroke(s) => s.visible && !s.paint.is_none() && s.width > 0.0, + }; + // Whether `n` itself has one; else its members, symbol art or expanded art go on the stack. + let mut visit = |n: &Node, stack: &mut Vec>| { + if !(n.visible || self.opts.hidden_layers) { + return false; + } + if has_raster(&n.appearance.effects) || n.appearance.items.iter().any(|i| paints(i) && has_raster(i.effects())) { + return true; + } + // A live object is written as its expanded art ([`Self::node_body`]), which holds no + // live objects. + if vectorcraft_doc::live::is_live(n) { + let g = vectorcraft_effects::expand_live_deep(Some(self.doc), n); + if !vectorcraft_doc::live::is_live(&g) { + stack.push(std::sync::Arc::new(g)); + return false; + } + } + if let NodeKind::SymbolInstance { symbol, .. } = &n.kind { + let custom = !n.extras().symbol_overrides.is_empty(); + if symbols.insert((symbol.clone(), custom.then_some(n.id))) + && let Some(s) = self.doc.symbols.iter().find(|s| s.name == *symbol) + { + stack.push(if custom { std::sync::Arc::new(vectorcraft_brush::instance_art(&s.art, n)) } else { s.art.clone() }); + } + } + stack.extend(n.children().into_iter().flatten().cloned()); + false + }; + if visit(n, &mut stack) { + return true; + } + while let Some(c) = stack.pop() { + if visit(&c, &mut stack) { + return true; + } + } + false + } + /// What `write` writes to the body, taken out of it (written at `depth`, for ``). fn detached(&mut self, depth: usize, write: impl FnOnce(&mut Self)) -> String { let (body, saved) = (std::mem::take(&mut self.body), self.depth); @@ -450,20 +526,39 @@ impl Writer<'_> { region } + /// The box of what each of `nodes` paints, as [`Self::paint_box`] measures it. + fn paint_boxes(&mut self, nodes: &[&Node]) -> Vec>> { + let symbols = self.region_boxes.take().unwrap_or_else(|| self.doc.symbol_boxes()); + let mut art_reach = std::mem::take(&mut self.art_reach); + let boxes = nodes.iter().map(|n| self.paint_box(&symbols, &mut art_reach, n)).collect(); + self.region_boxes = Some(symbols); + self.art_reach = art_reach; + boxes + } + + /// The box of what `n` paints in the current user space, as [`Self::region_attrs`] measures + /// it: `Some(None)` when it has no box, `None` when the box can't be told (type, or nesting + /// deeper than [`MAX_REACH_DEPTH`]). + fn paint_box(&self, symbols: &vectorcraft_doc::SymbolBoxes, art_reach: &mut HashMap, n: &Node) -> Option> { + let Some(v) = n.visual_bounds_with(symbols) else { return Some(None) }; + let r = self.paint_reach(symbols, art_reach, n, v, 0)?; + let g = n.geometric_bounds_with(symbols).unwrap_or(v); + let stroke = [g.x0 - v.x0, g.y0 - v.y0, v.x1 - g.x1, v.y1 - g.y1].into_iter().fold(0.0, f64::max); + let scaled = self.xf.transform_rect_bbox(v.inflate(r, r)); + let unscaled = self.xf.transform_rect_bbox(g).inflate(stroke + r, stroke + r); + Some(Some(scaled.union(unscaled))) + } + /// [`Self::region_attrs`] with the document's symbol boxes and the symbols' art reach so far. fn region_of(&self, symbols: &vectorcraft_doc::SymbolBoxes, art_reach: &mut HashMap, nodes: &[&Node]) -> String { let mut painted: Option = None; for n in nodes { - let Some(v) = n.visual_bounds_with(symbols) else { continue }; - let Some(r) = self.paint_reach(symbols, art_reach, n, v, 0) else { + let Some(b) = self.paint_box(symbols, art_reach, n) else { return BIG.to_string(); }; - let g = n.geometric_bounds_with(symbols).unwrap_or(v); - let stroke = [g.x0 - v.x0, g.y0 - v.y0, v.x1 - g.x1, v.y1 - g.y1].into_iter().fold(0.0, f64::max); - let scaled = self.xf.transform_rect_bbox(v.inflate(r, r)); - let unscaled = self.xf.transform_rect_bbox(g).inflate(stroke + r, stroke + r); - let both = scaled.union(unscaled); - painted = Some(painted.map_or(both, |p| p.union(both))); + if let Some(both) = b { + painted = Some(painted.map_or(both, |p| p.union(both))); + } } let Some(b) = painted.map(|b| b.inflate(2.0, 2.0)).filter(|b| b.is_finite()) else { return BIG.to_string(); @@ -572,8 +667,10 @@ impl Writer<'_> { } /// Children of the group being written. SVG has no knockout groups: in one, each element is - /// drawn through a mask of where the elements above it don't paint (the same look for Normal - /// blending). The masks nest, so element i sits inside the masks of elements i+1…n. + /// drawn through one mask of where the elements above it that overlap it don't paint (the + /// same look for Normal blending). The masks share one copy of each element's knockout shape, + /// and the elements stay siblings however many there are. A group whose masks would hold more + /// than [`MAX_KNOCKOUT_MASK_SHAPES`] shapes is written as a plain group, with a warning. pub(super) fn children(&mut self, children: &[std::sync::Arc]) { if self.knockout && self.tiny() { self.warn(TINY_MASKS); @@ -603,36 +700,129 @@ impl Writer<'_> { } return; } - let Some((first, rest)) = elements.split_first() else { return }; - // The elements are written first, in paint order, so that each mask copies an element + let all: Vec<&Node> = elements.iter().map(|c| &***c).collect(); + let Some(above) = self.knockout_masks(&all) else { + self.warn(KNOCKOUT_SIZE); + for c in elements { + self.node(c); + } + return; + }; + // The elements are written first, in paint order, so that each shape copies an element // with the symbol art count the element itself was written with - // (`Self::symbol_nodes`): an instance left out of an element is left out of its mask. - let (depth, nest) = (self.depth, rest.len()); - let first = self.detached(depth + nest, |w| w.node(first)); - let mut written = Vec::with_capacity(nest); - for (i, c) in rest.iter().enumerate() { + // (`Self::symbol_nodes`): an instance left out of an element is left out of its shape. + let depth = self.depth; + let mut written = Vec::with_capacity(elements.len()); + for (c, above) in elements.iter().zip(&above) { let before = self.symbol_nodes; - written.push((before, self.detached(depth + nest - 1 - i, |w| w.node(c)))); + written.push((before, self.detached(depth + usize::from(!above.is_empty()), |w| w.node(c)))); } let after = self.symbol_nodes; // Each mask covers what the group's elements paint. - let all: Vec<&Node> = elements.iter().map(|c| &***c).collect(); let region = self.region_attrs(&all); - for (c, (before, _)) in rest.iter().zip(&written).rev() { - self.symbol_nodes = *before; - let mid = self.knockout_mask(c, ®ion); - self.line(&format!("")); - self.depth += 1; + let mut shapes: Vec> = vec![None; elements.len()]; + for &j in above.iter().flatten() { + if shapes[j].is_none() { + self.symbol_nodes = written[j].0; + shapes[j] = Some(self.knockout_shape(elements[j])); + } } self.symbol_nodes = after; - self.body.push_str(&first); - for (_, body) in written { + for ((c, above), (_, body)) in elements.iter().zip(&above).zip(written) { + if above.is_empty() { + self.body.push_str(&body); + continue; + } + let ids: Vec<&str> = above.iter().filter_map(|&j| shapes[j].as_deref()).collect(); + let mid = self.knockout_mask(&ids, ®ion); + self.line(&format!("")); + // An element that paints past its shapes starts its mask group with a spanning + // rectangle (`Self::spanning_rect`). + self.depth += 1; + self.spanning_rect(c, ®ion); self.depth -= 1; - self.line(""); self.body.push_str(&body); + self.line(""); } } + /// For each element of a knockout group, the indices of the elements above it whose painted + /// boxes overlap its own (every one above it when a box can't be told). `None` when there are + /// more than [`MAX_MASKED_ELEMENTS`] elements or the masks would hold more than + /// [`MAX_KNOCKOUT_MASK_SHAPES`] shapes. + fn knockout_masks(&mut self, elements: &[&Node]) -> Option>> { + if elements.len() > MAX_MASKED_ELEMENTS { + return None; + } + let boxes = self.paint_boxes(elements); + let overlap = |a: Option>, b: Option>| match (a, b) { + (Some(None), _) | (_, Some(None)) => false, + (Some(Some(a)), Some(Some(b))) => a.x0 <= b.x1 + 2.0 && b.x0 <= a.x1 + 2.0 && a.y0 <= b.y1 + 2.0 && b.y0 <= a.y1 + 2.0, + _ => true, + }; + let mut shapes = 0usize; + let mut out = Vec::with_capacity(elements.len()); + for (i, &below) in boxes.iter().enumerate() { + let mut above = vec![]; + for (j, &over) in boxes.iter().enumerate().skip(i + 1) { + if overlap(below, over) { + shapes = shapes.checked_add(1).filter(|&s| s <= MAX_KNOCKOUT_MASK_SHAPES)?; + above.push(j); + } + } + out.push(above); + } + Some(out) + } + + /// One copy of the knockout shape of `c` in the definitions: `c` at full object opacity + /// without its own mask, unless those define its shape. Returns its id. + fn knockout_shape(&mut self, c: &Node) -> String { + let shape = if c.knockout_shape { + c.clone() + } else { + let mut s = c.clone().with_mask(None); + s.opacity = 1.0; + s + }; + let anonymous = std::mem::replace(&mut self.anonymous, true); + let art = self.detached(2, |w| w.node(&shape)); + self.anonymous = anonymous; + let id = self.fresh_id("knockout-art"); + self.def(1, &format!("")); + self.defs.push_str(&art); + self.def(1, ""); + id + } + + /// A mask that is 1 − the knockout shapes `ids` ([`Self::knockout_shape`]): white, then the + /// shapes painted black. `region` is the attributes of the mask's region + /// ([`Self::region_attrs`]), which the filter that paints the shapes black shares. Returns + /// the mask id. + fn knockout_mask(&mut self, ids: &[&str], region: &str) -> String { + let filter = match self.knockout_filters.get(region) { + Some(f) => f.clone(), + None => { + let f = self.fresh_id("knockout-shape"); + self.def(1, &format!("")); + self.def(2, ""); + self.def(1, ""); + self.knockout_filters.insert(region.to_string(), f.clone()); + f + } + }; + let mid = self.fresh_id("knockout"); + self.def(1, &format!("")); + self.def(2, &format!("")); + self.def(2, &format!("")); + for id in ids { + self.def(3, &format!("")); + } + self.def(2, ""); + self.def(1, ""); + mid + } + /// The pieces of a partly transparent mesh-warped image (`elements`) as the elements of a /// knockout group ([`vectorcraft_effects::warp_pieces_translucent`]). Each piece is drawn /// through one mask of where the pieces above it that reach it don't cover @@ -683,42 +873,6 @@ impl Writer<'_> { } } - /// A mask that is 1 − the knockout shape of `c`: white, then `c` painted black (at full object - /// opacity without its own mask, unless those define its shape). `region` is the attributes of - /// the mask's region ([`Self::region_attrs`]), which the filter that paints `c` black shares. - /// Returns the mask id. - fn knockout_mask(&mut self, c: &Node, region: &str) -> String { - let filter = match self.knockout_filters.get(region) { - Some(f) => f.clone(), - None => { - let f = self.fresh_id("knockout-shape"); - self.def(1, &format!("")); - self.def(2, ""); - self.def(1, ""); - self.knockout_filters.insert(region.to_string(), f.clone()); - f - } - }; - let shape = if c.knockout_shape { - c.clone() - } else { - let mut s = c.clone().with_mask(None); - s.opacity = 1.0; - s - }; - let anonymous = std::mem::replace(&mut self.anonymous, true); - let art = self.detached(3, |w| w.node(&shape)); - self.anonymous = anonymous; - let mid = self.fresh_id("knockout"); - self.def(1, &format!("")); - self.def(2, &format!("")); - self.def(2, &format!("")); - self.defs.push_str(&art); - self.def(2, ""); - self.def(1, ""); - mid - } - /// An object, inside `` when it links to a URL (Attributes panel). pub(super) fn node(&mut self, n: &Node) { // Ruler guides are not written, not even as a link. diff --git a/crates/svg/src/export/text.rs b/crates/svg/src/export/text.rs index 2b9139f19b..ccd5f56806 100644 --- a/crates/svg/src/export/text.rs +++ b/crates/svg/src/export/text.rs @@ -283,6 +283,11 @@ impl Writer<'_> { self.warn("type on a path with Insert Aki is outlined to keep its look"); return self.text_outlines(n, t); } + // Tsume does as well. + if t.runs.iter().any(|r| r.style.tsume != 0.0) { + self.warn("type on a path with Tsume is outlined to keep its look"); + return self.text_outlines(n, t); + } // A `` holds the characters of the text, not the bullets or numbers drawn // before them. if !lay.markers.is_empty() { @@ -715,13 +720,13 @@ const PLACE_TOLERANCE: f64 = 1e-6; /// starts a new segment at each character the layout draws elsewhere than a reader continuing /// the segment would ([`reader_advances`]): a Justify All line's letter gaps, the gaps between /// the characters of a justified Japanese line, and the spacing Mojikumi changes. Text with Insert -/// Aki does so on every line, with `fewer` too. +/// Aki or Tsume does so on every line, with `fewer` too. fn text_lines(t: &TextObject, lay: &vectorcraft_text::TextLayout, fewer: bool) -> Vec { let plain = t.plain_text(); let mut lines = Vec::with_capacity(lay.lines.len()); let (mut kerned, mut unkerned) = (None, None); - // Insert Aki moves characters from where a reader draws them, with `fewer` too. - let aki = t.runs.iter().any(|r| r.style.aki_left != 0.0 || r.style.aki_right != 0.0); + // Insert Aki and Tsume move characters from where a reader draws them, with `fewer` too. + let aki = t.runs.iter().any(|r| r.style.aki_left != 0.0 || r.style.aki_right != 0.0 || r.style.tsume != 0.0); for line in &lay.lines { let para = plain.as_bytes().get(..line.start).map_or(0, |b| b.iter().filter(|&&c| c == b'\n').count()); let style = t.para_at(para); @@ -885,11 +890,12 @@ fn reader_advances(t: &TextObject, lay: &vectorcraft_text::TextLayout, kerning: if !kerning { r.style.kerning.get_or_insert(0.0); } - // A reader puts no space before a line's first character (`kerningBefore`) and no Insert - // Aki: the segment starts that much further along instead. + // A reader puts no space before a line's first character (`kerningBefore`), no Insert + // Aki and no Tsume: the segment starts that much further along instead. r.style.kerning_before = 0.0; r.style.aki_left = 0.0; r.style.aki_right = 0.0; + r.style.tsume = 0.0; } let relaid; let glyphs = if set == *t { diff --git a/crates/svg/src/import/files.rs b/crates/svg/src/import/files.rs index bab4246270..d2b5504f9d 100644 --- a/crates/svg/src/import/files.rs +++ b/crates/svg/src/import/files.rs @@ -4,6 +4,10 @@ //! (missing, remote, not an image) becomes a placeholder that keeps the link and its place, so it //! can be relinked, and a warning. //! +//! A linked SVG file's own `` links are read the same way, relative paths from that file's +//! folder, within the same limits; an href that leads back to an SVG file showing it gets the +//! placeholder and a warning. +//! //! A raster image, linked or a data URL, whose orientation (EXIF, or a TIFF's Orientation tag) //! turns or flips its pixels is turned before usvg gets it, so it is sized, fitted and stored as //! it is shown. @@ -35,6 +39,9 @@ pub const MAX_NESTED_SVG_TEXT: u64 = 512 << 20; pub(in crate::import) struct Files { /// What usvg gets for each linked href. sources: HashMap, + /// The SVG images usvg is reading, innermost last: a linked SVG file, whose own links an href + /// inside it is looked up in, or `None` for a data URL. + within: Mutex>>>, /// The link of each linked raster or placeholder, by the address of the bytes usvg got. links: HashMap, /// An SVG image had text (which isn't imported). @@ -61,6 +68,9 @@ pub(in crate::import) struct Files { svg_text: AtomicU64, /// SVG images were left out for exceeding [`MAX_NESTED_SVG_READS`] or [`MAX_NESTED_SVG_TEXT`]. too_much_svg_read: AtomicBool, + /// Images linked from linked SVG files were left out, their files not read, past the same + /// limits for the files read for links. + too_much_linked: AtomicBool, /// The CMYK TIFF stored in place of a turned CMYK image, by the address of the PNG usvg got /// (kept here too, so the address stays its own). cmyk: Mutex>, @@ -84,8 +94,82 @@ type RasterKind = fn(Arc>) -> ImageKind; enum Source { /// A raster file of the kind usvg reads it as. Raster(RasterKind, Arc>), - /// An SVG file's text (unpacked when it is SVGZ), parsed by usvg as an image. - Svg(Arc), + /// An SVG file, parsed by usvg as an image. + Svg(Arc), +} + +/// A linked SVG file as usvg reads it. +struct SvgFile { + /// Its text (unpacked when it is SVGZ), placeholders stretched to their boxes. + text: Arc, + /// What usvg gets for each href its own `` elements link to. + sources: HashMap, +} + +/// The state of [`Files::read`] across the SVG files it reads the links of. +struct Reading<'a, 'w> { + opts: &'a ImportOptions<'a>, + warnings: &'w mut Vec, + /// The placeholder's bytes, made once. + placeholder: Option>>, + /// What each file read gave, by the file: hrefs spelled differently (`a.png`, `./a.png`, + /// `%61.png`), and in different SVG files, share one read and one copy of its bytes. Only an + /// SVG file whose art depends on where it is shown ([`Reading::placed`]) isn't kept, and a + /// raster read past the limits, which is left out. + by_file: HashMap, + /// The SVG files whose links are being read, innermost last, by [`identity`]. + active: Vec, + /// What the file being read gives depends on where it is shown: a link inside it led back to + /// an SVG file around it, or an SVG file inside it nests too deep there for its links to be + /// read. + placed: bool, + /// How many linked SVG files were read for their links, and the bytes of every linked SVG + /// file read and of every file read for the links of a linked SVG file. Rasters the imported + /// SVG links to aren't counted. + svg_reads: usize, + svg_text: u64, +} + +impl Reading<'_, '_> { + /// The files read for links passed [`MAX_NESTED_SVG_READS`] or [`MAX_NESTED_SVG_TEXT`]. + fn spent(&self) -> bool { + self.svg_reads > MAX_NESTED_SVG_READS || self.svg_text > MAX_NESTED_SVG_TEXT + } +} + +/// What reading a linked file gave: what usvg gets, or why it can't be read. +#[derive(Clone)] +struct Outcome { + source: Result, + /// An SVG file whose own links weren't read, past [`Reading::spent`]: inside a linked SVG + /// file it is left out, and where the imported SVG links to it, it is shown without them. + capped: bool, +} + +impl Outcome { + fn not_read(why: &'static str) -> Self { + Outcome { source: Err(why), capped: false } + } + + fn shown(source: Source) -> Self { + Outcome { source: Ok(source), capped: false } + } +} + +/// Does SVG text `text` have an `` that links to a file (not a data URL)? +fn links_files(text: &str) -> bool { + super::parse(text).is_ok_and(|xml| xml.descendants().any(|n| n.is_element() && n.tag_name().name() == "image" && file_href(n).is_some())) +} + +/// The href of `` element `n`, unless it is a data URL. +fn file_href<'a>(n: roxmltree::Node<'a, '_>) -> Option<&'a str> { + href(n).filter(|h| !h.trim_start().starts_with("data:")) +} + +/// What the link to an SVG file being read is compared by, to find a link back to it: its path +/// with links and `..` resolved, or the path as given when that can't be found. +fn identity(file: &str) -> String { + std::fs::canonicalize(file).map_or_else(|_| file.to_string(), |p| p.to_string_lossy().into_owned()) } /// A linked raster image (or the placeholder of a missing one). @@ -164,54 +248,156 @@ impl Files { /// relinked. pub(in crate::import) fn read(svg: &str, xml: &roxmltree::Document, opts: &ImportOptions, edits: &mut Edits, warnings: &mut Vec) -> Self { let mut files = Files::default(); - let mut placeholder = None; - // What each file read gave, by the file: hrefs spelled differently (`a.png`, `./a.png`, - // `%61.png`) share one read and one copy of its bytes. - let mut by_file: HashMap> = HashMap::new(); - for n in xml.descendants().filter(|n| n.is_element() && n.tag_name().name() == "image") { - let Some(h) = href(n).filter(|h| !h.trim_start().starts_with("data:")) else { continue }; - if !files.sources.contains_key(h) { - let (path, file) = target(h, opts.folder); - // A failed read is cached too, but each href gets its own placeholder: its own link - // path (an Arc shared between hrefs would share the first href's link) and warning. - let cached = file.as_ref().and_then(|f| by_file.get(f)).cloned(); - let source = match cached { - Some(source) => source, - None => { - let read = file.clone().and_then(|file| opts.read.and_then(|read| read(&file))); - let source = match read { - Some((bytes, link)) => files.source(bytes, link).ok_or("is not an image VectorCraft reads"), - None => Err("not found"), - }; - if let Some(file) = file { - by_file.insert(file, source.clone()); - } - source - } - }; - let source = source.or_else(|why| { - warnings.push(format!("linked image '{h}' {why}: a placeholder keeps its place until it is relinked")); - let bytes = Arc::new(placeholder.get_or_insert_with(missing_placeholder).clone().ok_or(why)?); - files.links.insert(key(&bytes), Linked { link: LinkInfo::new(path), missing: true }); - Ok::<_, &str>(Source::Raster(ImageKind::PNG, bytes)) - }); - let Ok(source) = source else { continue }; - files.sources.insert(h.to_string(), source); - } - if files.placeholder(h) { - edits.set(svg, n, "preserveAspectRatio", "none"); - } - } + let mut reading = + Reading { opts, warnings, placeholder: None, by_file: HashMap::new(), active: vec![], placed: false, svg_reads: 0, svg_text: 0 }; + files.sources = files.links_of(svg, xml, opts.folder, None, edits, &mut reading); files } + /// What usvg gets for each href the `` elements of `xml` (the text `svg`) link to, + /// relative paths taken from `folder`. `inside` is how deep the SVG images `xml` shows nest in + /// it and the SVGs around it, measured when an SVG file is read (`None` for `xml` itself). + fn links_of( + &mut self, + svg: &str, + xml: &roxmltree::Document, + folder: Option<&str>, + mut inside: Option, + edits: &mut Edits, + reading: &mut Reading<'_, '_>, + ) -> HashMap { + let mut sources: HashMap = HashMap::new(); + let nested = !reading.active.is_empty(); + for n in xml.descendants().filter(|n| n.is_element() && n.tag_name().name() == "image") { + let Some(h) = file_href(n) else { continue }; + if !sources.contains_key(h) { + let (path, file) = target(h, folder); + // A failed read is cached too, but each href gets its own placeholder: its own link + // path (an Arc shared between hrefs would share the first href's link) and warning. + let back = nested && file.as_deref().is_some_and(|f| reading.active.contains(&identity(f))); + let cached = file.as_ref().and_then(|f| reading.by_file.get(f)).cloned(); + let outcome = match cached { + _ if back => { + reading.placed = true; + Some(Outcome::not_read("leads back to an SVG file that shows it")) + } + Some(outcome) => Some(outcome), + None => { + let around = std::mem::replace(&mut reading.placed, false); + let outcome = self.file(file.as_deref(), xml, &mut inside, reading); + // Kept unless what it shows depends on where it is. + let placed = reading.placed; + reading.placed |= around; + if let (Some(file), Some(outcome)) = (file, &outcome) + && !placed + { + reading.by_file.insert(file, outcome.clone()); + } + outcome + } + }; + // Inside a linked SVG file, past what may be read, the image is left out (noted). + let source = match outcome { + None => continue, + Some(Outcome { capped: true, .. }) if nested => { + self.too_much_svg_read.store(true, Ordering::Relaxed); + continue; + } + Some(outcome) => outcome.source, + }; + let source = source.or_else(|why| { + reading.warnings.push(format!("linked image '{h}' {why}: a placeholder keeps its place until it is relinked")); + let bytes = Arc::new(reading.placeholder.get_or_insert_with(missing_placeholder).clone().ok_or(why)?); + self.links.insert(key(&bytes), Linked { link: LinkInfo::new(path), missing: true }); + Ok::<_, &str>(Source::Raster(ImageKind::PNG, bytes)) + }); + let Ok(source) = source else { continue }; + sources.insert(h.to_string(), source); + } + if sources.get(h).is_some_and(|s| self.missing(s)) { + edits.set(svg, n, "preserveAspectRatio", "none"); + } + } + sources + } + + /// What reading linked file `file` gives, linked from `xml`, whose SVG images nest `inside` + /// deep (measured here when an SVG file is read); `None` for an image left out, noted. Inside + /// a linked SVG file each file read counts toward [`MAX_NESTED_SVG_TEXT`] before it is looked + /// at, and once the files read for links pass [`MAX_NESTED_SVG_READS`] or + /// [`MAX_NESTED_SVG_TEXT`] no file is read there; a raster whose read passes them is left out + /// undecoded. Every file the imported SVG links to is read. + fn file(&mut self, file: Option<&str>, xml: &roxmltree::Document, inside: &mut Option, reading: &mut Reading<'_, '_>) -> Option { + let (Some(file), Some(read)) = (file, reading.opts.read) else { return Some(Outcome::not_read("not found")) }; + let nested = !reading.active.is_empty(); + if nested && reading.spent() { + self.too_much_linked.store(true, Ordering::Relaxed); + return None; + } + let Some((bytes, link)) = read(file) else { return Some(Outcome::not_read("not found")) }; + let counted = if nested { bytes.len() as u64 } else { 0 }; + reading.svg_text = reading.svg_text.saturating_add(counted); + if nested && reading.spent() && image::guess_format(&bytes).is_ok() { + self.too_much_linked.store(true, Ordering::Relaxed); + return None; + } + match self.source(bytes, link) { + Some(Source::Svg(svg)) => { + let inside = *inside.get_or_insert_with(|| depth::height(xml, MAX_ELEMENT_DEPTH).unwrap_or(MAX_ELEMENT_DEPTH)); + Some(self.svg_file(svg, file, inside, counted, reading)) + } + source => Some(source.map_or_else(|| Outcome::not_read("is not an image VectorCraft reads"), Outcome::shown)), + } + } + + /// Linked SVG file `file`, read as `svg`, with the files its own `` elements link to + /// read from its folder; `inside` is how deep it nests in the SVGs around it, and `counted` the + /// bytes of it already counted toward [`MAX_NESTED_SVG_TEXT`]. Its text counts toward + /// [`MAX_NESTED_SVG_TEXT`], and reading its links toward [`MAX_NESTED_SVG_READS`]; once they + /// are passed, its links aren't read ([`Outcome::capped`], noted when it links to files). Its + /// links aren't read either when it nests too deep to be shown, or when it isn't XML. + fn svg_file(&mut self, svg: Arc, file: &str, inside: usize, counted: u64, reading: &mut Reading<'_, '_>) -> Outcome { + reading.svg_text = reading.svg_text.saturating_add((svg.text.len() as u64).saturating_sub(counted)); + let links = svg.text.contains("image"); + reading.svg_reads += usize::from(links); + if reading.spent() { + if links && links_files(&svg.text) { + self.too_much_linked.store(true, Ordering::Relaxed); + } + return Outcome { source: Ok(Source::Svg(svg)), capped: true }; + } + let left = MAX_ELEMENT_DEPTH.saturating_sub(inside); + if !links { + return Outcome::shown(Source::Svg(svg)); + } + if depth::xml_deeper_than(&svg.text, left) { + reading.placed = true; + return Outcome::shown(Source::Svg(svg)); + } + // Read from its own handle: the text stays borrowed while `svg` may be given back. + let text = svg.text.clone(); + let Ok(xml) = super::parse(&text) else { return Outcome::shown(Source::Svg(svg)) }; + let Some(height) = depth::height(&xml, left) else { + reading.placed = true; + return Outcome::shown(Source::Svg(svg)); + }; + let folder = Path::new(file).parent().map(|p| p.to_string_lossy().into_owned()); + let mut edits = Edits::default(); + reading.active.push(identity(file)); + let sources = self.links_of(&text, &xml, folder.as_deref(), Some(inside + height), &mut edits, reading); + reading.active.pop(); + let text = Arc::from(edits.apply(&text).as_ref()); + Outcome::shown(Source::Svg(Arc::new(SvgFile { text, sources }))) + } + /// What usvg gets for a file read (`bytes`, linked by `link`): a raster as [`shown`] gives it - /// (formats usvg doesn't read are stored as PNG) or an SVG; `None` for anything else. + /// (formats usvg doesn't read are stored as PNG) or an SVG, its own links not read yet; `None` + /// for anything else. fn source(&mut self, bytes: Vec, link: LinkInfo) -> Option { let Ok(format) = image::guess_format(&bytes) else { // Unpacked once, here, within what the SVGZ images may unpack to. let text = crate::text_within(&bytes, &self.unpacked).ok()?; - return text.contains(" bool { - matches!(self.sources.get(h), Some(Source::Raster(_, b)) if self.links.get(&key(b)).is_some_and(|l| l.missing)) + /// Is `source` a placeholder? + fn missing(&self, source: &Source) -> bool { + matches!(source, Source::Raster(_, b) if self.links.get(&key(b)).is_some_and(|l| l.missing)) + } + + /// What usvg gets for href `h` where it is read: inside a linked SVG file, from that file's + /// own links; outside any SVG image, from the imported SVG's. Inside an SVG data URL, which + /// has no folder of its own, nothing. + fn find(&self, h: &str) -> Option { + let within = self.within.lock().ok()?; + let sources = match within.last() { + None => &self.sources, + Some(file) => &file.as_ref()?.sources, + }; + sources.get(h).or_else(|| sources.get(h.trim())).cloned() } /// The link of the image whose data usvg got as `kind`. @@ -272,6 +470,12 @@ impl Files { MAX_NESTED_SVG_TEXT >> 20 )); } + if self.too_much_linked.load(Ordering::Relaxed) { + notes.push(format!( + "images linked from linked SVG files were left out: once {MAX_NESTED_SVG_READS} SVG files or {} MB have been read for their links, the files they link to aren't read", + MAX_NESTED_SVG_TEXT >> 20 + )); + } notes } @@ -308,9 +512,9 @@ impl Files { let (kind, bytes) = self.keep(shown(bytes, format)?); Some(kind(bytes)) }), - resolve_string: Box::new(move |h, opts| match self.sources.get(h).or_else(|| self.sources.get(h.trim()))? { - Source::Raster(kind, bytes) => Some(kind(bytes.clone())), - Source::Svg(text) => self.svg(text, opts), + resolve_string: Box::new(move |h, opts| match self.find(h)? { + Source::Raster(kind, bytes) => Some(kind(bytes)), + Source::Svg(file) => self.svg(&file.text.clone(), Some(file), opts), }), } } @@ -320,7 +524,7 @@ impl Files { /// noted. fn svg_data(&self, bytes: &[u8], opts: &usvg::Options) -> Option { match crate::text_within(bytes, &self.unpacked) { - Ok(text) => self.svg(&text, opts), + Ok(text) => self.svg(&text, None, opts), Err(e) => leave_out(&self.too_big, matches!(e, SvgError::TooBig(_))), } } @@ -329,8 +533,9 @@ impl Files { /// can't read, when it isn't SVG or when its elements nest deeper than the SVGs around it /// leave: usvg reads it while it reads them, on the same stack. Only a decoded image, with the /// images decoded inside it, counts toward [`MAX_NESTED_SVG_IMAGES`]; every image read counts - /// toward [`MAX_NESTED_SVG_READS`] and [`MAX_NESTED_SVG_TEXT`]. - fn svg(&self, text: &str, opts: &usvg::Options) -> Option { + /// toward [`MAX_NESTED_SVG_READS`] and [`MAX_NESTED_SVG_TEXT`]. `file` is the linked SVG file + /// the text is, whose own links the hrefs in it are looked up in. + fn svg(&self, text: &str, file: Option>, opts: &usvg::Options) -> Option { let decoded = self.svg_images.load(Ordering::Relaxed); if decoded >= MAX_NESTED_SVG_IMAGES { return leave_out(&self.too_many_svg_images, true); @@ -345,7 +550,7 @@ impl Files { // The image's place is taken while usvg reads it, so the images inside it get what is left. // usvg reads them all on this thread, so no other read comes between these steps. self.svg_images.store(decoded + 1, Ordering::Relaxed); - let tree = self.svg_tree(text, opts); + let tree = self.svg_tree(text, file, opts); if tree.is_none() { self.svg_images.store(decoded, Ordering::Relaxed); } @@ -353,7 +558,7 @@ impl Files { } /// [`Files::svg`]'s image once it is counted. - fn svg_tree(&self, text: &str, opts: &usvg::Options) -> Option { + fn svg_tree(&self, text: &str, file: Option>, opts: &usvg::Options) -> Option { // Measured as the SVG holding it is (`import`): the text before the XML reader. let used = self.depth.load(Ordering::Relaxed); let left = MAX_ELEMENT_DEPTH.saturating_sub(used); @@ -365,7 +570,27 @@ impl Files { // usvg's parser would overflow on it, as on the SVG holding it (`import`). super::convolve_matrices_ok(&xml).ok()?; self.depth.store(used + height, Ordering::Relaxed); - let tree = usvg::Tree::from_data_nested(text.as_bytes(), opts); + let within = self.within.lock().ok().map(|mut w| w.push(file)).is_some(); + // usvg's `Tree::from_data_nested`, except that hrefs to files go to the resolver. + let nested = usvg::Options { + resources_dir: None, + dpi: opts.dpi, + font_size: opts.font_size, + languages: opts.languages.clone(), + shape_rendering: opts.shape_rendering, + text_rendering: opts.text_rendering, + image_rendering: opts.image_rendering, + default_size: opts.default_size, + image_href_resolver: ImageHrefResolver { + resolve_data: Box::new(|mime, bytes, o| (opts.image_href_resolver.resolve_data)(mime, bytes, o)), + resolve_string: Box::new(|h, o| (opts.image_href_resolver.resolve_string)(h, o)), + }, + ..usvg::Options::default() + }; + let tree = usvg::Tree::from_str(text, &nested); + if within && let Ok(mut w) = self.within.lock() { + w.pop(); + } self.depth.store(used, Ordering::Relaxed); let tree = tree.ok()?; self.note_text(text); @@ -630,6 +855,131 @@ mod tests { assert!(read("1")); } + /// An SVG file of 2 × 2 showing `hrefs`. + fn linking(hrefs: &[&str]) -> Vec { + let images: String = hrefs.iter().map(|h| format!(r#""#)).collect(); + format!(r#"{images}"#).into_bytes() + } + + /// The links of the SVG showing `hrefs` read as [`Files::read`] reads them, the files `served` + /// by name, with the SVG files and bytes read for links starting at `reads` and `text`: the + /// names of the files read, in order, and the files. + fn read_links(hrefs: &[&str], served: &[(&str, Vec)], reads: usize, text: u64) -> (Vec, Files) { + let log = Mutex::new(vec![]); + let read = |path: &str| { + let name = Path::new(path).file_name()?.to_string_lossy().into_owned(); + log.lock().ok()?.push(name.clone()); + served.iter().find(|(n, _)| *n == name).map(|(_, bytes)| (bytes.clone(), LinkInfo::new(path))) + }; + let folder = std::env::temp_dir().join("vectorcraft-svg-limits"); + let folder = folder.to_string_lossy(); + let opts = ImportOptions { folder: Some(&folder), read: Some(&read) }; + let svg = String::from_utf8(linking(hrefs)).unwrap(); + let xml = super::super::parse(&svg).unwrap(); + let mut warnings = vec![]; + let mut reading = Reading { + opts: &opts, + warnings: &mut warnings, + placeholder: None, + by_file: HashMap::new(), + active: vec![], + placed: false, + svg_reads: reads, + svg_text: text, + }; + let mut files = Files::default(); + files.sources = files.links_of(&svg, &xml, opts.folder, None, &mut Edits::default(), &mut reading); + (log.into_inner().unwrap(), files) + } + + fn png() -> Vec { + let mut out = vec![]; + image::RgbaImage::new(1, 1).write_to(&mut std::io::Cursor::new(&mut out), image::ImageFormat::Png).unwrap(); + out + } + + fn linked_note() -> String { + format!( + "images linked from linked SVG files were left out: once {MAX_NESTED_SVG_READS} SVG files or {} MB have been read for their links, the files they link to aren't read", + MAX_NESTED_SVG_TEXT >> 20 + ) + } + + /// Every file read for a linked SVG file's links counts toward [`MAX_NESTED_SVG_TEXT`], a + /// raster too, after the linked SVG file's own text: the file that passes it is left out, and + /// no file after it is read. + #[test] + fn linked_files_past_the_text_limit_are_not_read() { + let a = linking(&["one.png", "two.png", "three.png"]); + let served = [("a.svg", a.clone()), ("one.png", png()), ("two.png", png()), ("three.png", png())]; + let (log, files) = read_links(&["a.svg"], &served, 0, MAX_NESTED_SVG_TEXT - (png().len() + a.len()) as u64); + assert_eq!(log, ["a.svg", "one.png", "two.png"]); + let Some(Source::Svg(a)) = files.sources.get("a.svg") else { panic!("a.svg is shown") }; + assert!(a.sources.contains_key("one.png") && a.sources.len() == 1, "{:?}", a.sources.keys()); + assert_eq!(files.left_out(), [linked_note()]); + } + + /// Once more than [`MAX_NESTED_SVG_READS`] SVG files are read for their links, the SVG file + /// past it is left out inside a linked SVG file, and no file a linked SVG file links to is + /// read (a nested link past the limit); rasters the imported SVG links to still are. + #[test] + fn linked_files_past_the_read_limit_are_not_read() { + let served = [("a.svg", linking(&["b.svg", "two.png"])), ("b.svg", linking(&["one.png"])), ("one.png", png()), ("two.png", png())]; + let (log, files) = read_links(&["a.svg", "two.png"], &served, MAX_NESTED_SVG_READS - 1, 0); + assert_eq!(log, ["a.svg", "b.svg", "two.png"]); + let Some(Source::Svg(a)) = files.sources.get("a.svg") else { panic!("a.svg is shown") }; + assert!(a.sources.is_empty(), "{:?}", a.sources.keys()); + assert!(matches!(files.sources.get("two.png"), Some(Source::Raster(..)))); + assert_eq!(files.left_out().len(), 2, "{:?}", files.left_out()); + assert!(files.left_out().contains(&linked_note())); + } + + /// Reading the SVG files the imported SVG links to, and their links, counts toward the + /// limits: past them, such a file is still shown, but the files it links to aren't read. + #[test] + fn svg_files_the_imported_svg_links_to_are_shown_without_their_links_past_the_limits() { + let served = [("a.svg", linking(&["one.png"])), ("one.png", png())]; + for (reads, text) in [(MAX_NESTED_SVG_READS, 0), (0, MAX_NESTED_SVG_TEXT)] { + let (log, files) = read_links(&["a.svg"], &served, reads, text); + assert_eq!(log, ["a.svg"], "one.png isn't read"); + let Some(Source::Svg(a)) = files.sources.get("a.svg") else { panic!("a.svg is shown") }; + assert!(a.sources.is_empty(), "{:?}", a.sources.keys()); + assert_eq!(files.left_out(), [linked_note()]); + } + // More of them than the limit: those past it are shown without their links. + let names: Vec = (0..MAX_NESTED_SVG_READS + 2).map(|i| format!("s{i}.svg")).collect(); + let hrefs: Vec<&str> = names.iter().map(String::as_str).collect(); + let mut served: Vec<(&str, Vec)> = hrefs.iter().map(|h| (*h, linking(&["one.png"]))).collect(); + served.push(("one.png", png())); + let (log, files) = read_links(&hrefs, &served, 0, 0); + assert_eq!(log.len(), hrefs.len() + 1, "one.png is read once"); + let with_links = hrefs.iter().filter(|h| matches!(files.sources.get(**h), Some(Source::Svg(s)) if s.sources.contains_key("one.png"))); + assert_eq!(with_links.count(), MAX_NESTED_SVG_READS); + assert!(hrefs.iter().all(|h| matches!(files.sources.get(*h), Some(Source::Svg(_)))), "all shown"); + assert_eq!(files.left_out(), [linked_note()]); + } + + /// An SVG file read once is kept by its file wherever it was read: another spelling of its + /// href doesn't read it again, past the limits too. + #[test] + fn an_svg_file_is_read_once_past_the_limits() { + let served = [("a.svg", linking(&["one.png"])), ("one.png", png())]; + let (log, files) = read_links(&["a.svg", "./a.svg", "%61.svg"], &served, MAX_NESTED_SVG_READS, 0); + assert_eq!(log, ["a.svg"]); + assert!(["a.svg", "./a.svg", "%61.svg"].iter().all(|h| matches!(files.sources.get(*h), Some(Source::Svg(_))))); + // Read inside a linked SVG file, where its read passes the text limit: left out there, + // and shown, not read again, where the imported SVG links to it. + let x = linking(&["a.svg"]); + let served = [("x.svg", x.clone()), ("a.svg", linking(&["one.png"])), ("one.png", png())]; + let (log, files) = read_links(&["x.svg", "./a.svg"], &served, 0, MAX_NESTED_SVG_TEXT - x.len() as u64); + assert_eq!(log, ["x.svg", "a.svg"]); + let Some(Source::Svg(x)) = files.sources.get("x.svg") else { panic!("x.svg is shown") }; + assert!(x.sources.is_empty(), "{:?}", x.sources.keys()); + let Some(Source::Svg(a)) = files.sources.get("./a.svg") else { panic!("a.svg is shown") }; + assert!(a.sources.is_empty(), "{:?}", a.sources.keys()); + assert_eq!(files.left_out().len(), 2, "{:?}", files.left_out()); + } + /// The nested SVG images read, decoded or not, take at most [`MAX_NESTED_SVG_TEXT`] bytes of /// text together: an image whose text goes past it is left out and noted. A broken image's /// text counts too, and its decoded place is given back. diff --git a/crates/svg/src/import/prepass.rs b/crates/svg/src/import/prepass.rs index 95c0d57203..3d1b04ad60 100644 --- a/crates/svg/src/import/prepass.rs +++ b/crates/svg/src/import/prepass.rs @@ -109,7 +109,7 @@ impl Edits { /// `svg` with the edits made; overlapping ones and ranges off character boundaries are /// skipped. - fn apply(mut self, svg: &str) -> Cow<'_, str> { + pub(super) fn apply(mut self, svg: &str) -> Cow<'_, str> { self.list.append(&mut self.id_edits); for (at, has_style, decls) in std::mem::take(&mut self.styles).into_values() { self.insert(at, if has_style { decls } else { format!(" style=\"{}\"", decls.strip_prefix(';').unwrap_or(&decls)) }); diff --git a/crates/svg/src/import/text.rs b/crates/svg/src/import/text.rs index 419e73a385..bbe72063e1 100644 --- a/crates/svg/src/import/text.rs +++ b/crates/svg/src/import/text.rs @@ -110,8 +110,25 @@ struct ElemStyle { word_spacing: f64, /// `paint-order` paints the stroke before the fill. stroke_first: bool, + /// What its characters' Character Direction ([`Ctx::elem`]) leaves out of the file's + /// `unicode-bidi`, for the import's warnings. + bidi_notes: Vec<&'static str>, } +/// An override (`unicode-bidi="bidi-override"`) read as an embedding. +const BIDI_OVERRIDE: &str = "unicode-bidi=\"bidi-override\" imported as an embedding; directional override is not supported"; +/// An isolate (`unicode-bidi="isolate"`) read as an embedding. +const BIDI_ISOLATE: &str = "unicode-bidi=\"isolate\" imported as an embedding; isolation is not supported"; +/// `unicode-bidi="isolate-override"` read as an embedding. +const BIDI_ISOLATE_OVERRIDE: &str = "unicode-bidi=\"isolate-override\" imported as an embedding; isolation and override are not supported"; +/// `unicode-bidi="plaintext"` read as an embedding in the direction of its first strong character. +const BIDI_PLAINTEXT: &str = + "unicode-bidi=\"plaintext\" imported as an embedding in the direction of its first strong character; isolation is not supported"; +/// An embedding inside another, kept as an embedding of its own. +const BIDI_NESTED: &str = "a unicode-bidi embedding inside another imported one level deep; its characters may be ordered differently"; +/// An override on the `` itself, which keeps only its paragraph direction. +const BIDI_TEXT_OVERRIDE: &str = "unicode-bidi override on the text imported as its paragraph direction; directional override is not supported"; + /// One character of a text and the adjustments its position needs. struct Cell { ch: char, @@ -694,6 +711,9 @@ struct Ctx { sizes: RefCell>, weights: RefCell>, elems: RefCell>>, + /// The first strong characters of each `` read so far, by the `` + /// ([`Self::first_strong_rtl`]). + strong: RefCell>>, /// The path each `` read so far follows ([`Self::text_path`]); `None` where it has /// no usable one. The styles of a `` instance share it, so each path is found and parsed /// once however many `` elements show its text. @@ -716,6 +736,7 @@ impl Ctx { sizes: RefCell::default(), weights: RefCell::default(), elems: RefCell::default(), + strong: RefCell::default(), paths: Rc::default(), }; let root = xml.root_element(); @@ -737,6 +758,7 @@ impl Ctx { sizes: RefCell::default(), weights: RefCell::default(), elems: RefCell::default(), + strong: RefCell::default(), paths: self.paths.clone(), } } @@ -915,6 +937,8 @@ impl Ctx { }; let parent = if n.tag_name().name() == "text" { 0.0 } else { n.parent_element().map_or(0.0, |p| self.elem(p).style.baseline_shift) }; st.baseline_shift = parent + own; + let (char_direction, bidi_notes) = self.char_direction(n); + st.char_direction = char_direction; if self.prop(n, "visibility").is_some_and(|v| v == "hidden" || v == "collapse") { (st.fill, st.stroke, fill_url, stroke_url) = (Paint::None, Paint::None, None, None); } @@ -922,11 +946,116 @@ impl Ctx { let order = self.prop(n, "paint-order").and_then(|v| svgtypes::PaintOrder::from_str(&v).ok()).unwrap_or_default().order; let at = |k| order.iter().position(|o| *o == k); let stroke_first = at(svgtypes::PaintOrderKind::Stroke) < at(svgtypes::PaintOrderKind::Fill); - let e = Rc::new(ElemStyle { style: st, fill: fill_url, stroke: stroke_url, word_spacing, stroke_first }); + let e = Rc::new(ElemStyle { style: st, fill: fill_url, stroke: stroke_url, word_spacing, stroke_first, bidi_notes }); self.elems.borrow_mut().insert(n.id(), e.clone()); e } + /// The computed `unicode-bidi` of element `n`, in lowercase. It is not inherited: `normal` + /// unless `n` sets it, and its parent's value for `inherit`. + fn unicode_bidi(&self, n: XNode) -> String { + let mut at = Some(n); + while let Some(a) = at { + match self.css.own(a, "unicode-bidi").map(|v| v.trim().to_ascii_lowercase()) { + Some(v) if v == "inherit" => at = self.parent(a), + Some(v) => return v, + None => break, + } + } + "normal".into() + } + + /// Whether the computed `direction` of element `n` is `rtl`, in any letter case (CSS keywords + /// are ASCII case-insensitive, https://www.w3.org/TR/css-values-3/#keywords). + fn is_rtl(&self, n: XNode) -> bool { + self.prop(n, "direction").is_some_and(|d| d.trim().eq_ignore_ascii_case("rtl")) + } + + /// The Character Direction of the characters of element `n` inside a ``, and what it + /// leaves out (SVG 1.1 §10.7.4, + /// https://www.w3.org/TR/SVG11/text.html#RelationshipWithBi-directionality, and CSS Writing + /// Modes 3 §2.2, https://www.w3.org/TR/css-writing-modes-3/#unicode-bidi). A ``, + /// `` or `` whose `unicode-bidi` opens an embedding gives its characters an + /// embedding in its `direction`; one that opens none (`normal`) leaves them in its parent's. + /// The text model holds one level of embedding and no override or isolation: overrides and + /// isolates become embeddings, `plaintext` an embedding in the direction of its first strong + /// character, and an embedding inside another an embedding of its own, each with a note. The + /// `` itself sets the paragraph direction ([`pin_direction`]) and no Character Direction. + fn char_direction(&self, n: XNode) -> (Option, Vec<&'static str>) { + let name = n.tag_name().name(); + let bidi = self.unicode_bidi(n); + if !matches!(name, "tspan" | "textPath" | "a") { + let notes = + if name == "text" && matches!(bidi.as_str(), "bidi-override" | "isolate-override") { vec![BIDI_TEXT_OVERRIDE] } else { vec![] }; + return (None, notes); + } + let parent = n.parent_element().map(|p| self.elem(p)); + let inherited = parent.as_ref().and_then(|p| p.style.char_direction); + let mut notes = parent.map_or_else(Vec::new, |p| p.bidi_notes.clone()); + let rtl = |rtl: bool| Some(if rtl { ParaDirection::RightToLeft } else { ParaDirection::LeftToRight }); + let own = || rtl(self.is_rtl(n)); + let (dir, note) = match bidi.as_str() { + "embed" => (own(), None), + "bidi-override" => (own(), Some(BIDI_OVERRIDE)), + "isolate" => (own(), Some(BIDI_ISOLATE)), + "isolate-override" => (own(), Some(BIDI_ISOLATE_OVERRIDE)), + "plaintext" => (rtl(self.first_strong_rtl(n) == Some(true)), Some(BIDI_PLAINTEXT)), + // `normal`, and a value CSS ignores. + _ => return (inherited, notes), + }; + for note in note.into_iter().chain(inherited.map(|_| BIDI_NESTED)) { + if !notes.contains(¬e) { + notes.push(note); + } + } + (dir, notes) + } + + /// Whether the first strong character (UAX #9 P2) of the characters [`Self::collect`] reads + /// from element `n` is right to left; `None` when they hold none. The characters of the whole + /// `` are read once, as one sequence, so an isolate that opens in one text node and + /// closes in a later one is skipped whole ([`FirstStrong`]). + fn first_strong_rtl(&self, n: XNode) -> Option { + // The `` (or outermost element) whose characters hold those of `n`. + let mut root = n; + while let Some(p) = root.parent_element().filter(|_| root.tag_name().name() != "text" && self.is_inline_child(root)) { + root = p; + } + let strong = self.strong.borrow().get(&root.id()).cloned(); + let strong = strong.unwrap_or_else(|| { + let mut chars = vec![]; + let mut spans = HashMap::new(); + self.inline_chars(root, &mut chars, &mut spans); + let s = Rc::new(FirstStrong::new(&chars, spans)); + self.strong.borrow_mut().insert(root.id(), s.clone()); + s + }); + strong.of(n.id()) + } + + /// Appends the characters of element `n` and of its shown inline children to `chars`, in + /// document order, and the range each of those elements holds to `spans`. + fn inline_chars(&self, n: XNode, chars: &mut Vec, spans: &mut HashMap>) { + let start = chars.len(); + for c in n.children() { + if c.is_text() { + chars.extend(c.text().unwrap_or("").chars()); + } else if self.is_inline_child(c) { + self.inline_chars(c, chars, spans); + } + } + spans.insert(n.id(), start..chars.len()); + } + + /// Whether child `c` of a `` content element holds characters of the text: a shown + /// ``, `` or ``. + fn is_inline_child(&self, c: XNode) -> bool { + c.is_element() + && c.tag_name().namespace() == Some(SVG_NS) + && matches!(c.tag_name().name(), "tspan" | "textPath" | "a") + && self.css.own(c, "display").as_deref() != Some("none") + } + /// Characters of `el` and its ``, `` and `` children, with white space /// handled like `xml:space` (newlines and tabs become spaces; runs of spaces collapse unless /// preserved). @@ -943,11 +1072,7 @@ impl Ctx { } out.chars.push((ch, el)); } - } else if c.is_element() - && c.tag_name().namespace() == Some(SVG_NS) - && matches!(c.tag_name().name(), "tspan" | "textPath" | "a") - && self.css.own(c, "display").as_deref() != Some("none") - { + } else if self.is_inline_child(c) { if c.tag_name().name() == "textPath" { out.path.get_or_insert(c); } @@ -1234,6 +1359,16 @@ impl Ctx { } }) .collect(); + // What the Character Direction leaves out of the file's `unicode-bidi`, once for the text. + let mut bidi_notes: Vec<&str> = vec![]; + for (el, _) in cs.spans.iter().filter(|(_, r)| !r.is_empty() && r.start < n) { + for note in &self.elem(*el).bidi_notes { + if !bidi_notes.contains(note) { + bidi_notes.push(note); + } + } + } + warnings.extend(bidi_notes.into_iter().map(|note| format!("{label}: {note}"))); let under = stroke_under(&mut cells, label, warnings); let path = cs.path.and_then(|tp| match self.text_path(xml, tp) { @@ -1244,7 +1379,16 @@ impl Ctx { } }); let vertical = self.prop(t, "writing-mode").is_some_and(|m| m.starts_with("tb") || m.starts_with("vertical")); - let rtl = self.prop(t, "direction").is_some_and(|d| d.trim() == "rtl"); + // With `unicode-bidi: plaintext`, the text runs in the direction of its first strong + // character, and each paragraph in that of its own ([`pin_first_strong`]). + let plaintext = self.unicode_bidi(t) == "plaintext"; + let rtl = if plaintext { self.first_strong_rtl(t) == Some(true) } else { self.is_rtl(t) }; + let pin = |obj: &mut TextObject| { + pin_direction(obj, rtl); + if plaintext { + pin_first_strong(obj); + } + }; // Where the chunk starting at character `i` sits on its anchor: 0 its left (or top) edge, // 0.5 its middle, 1 its right (or bottom) edge; on a path, its edge toward the path's // start, its middle or its edge toward the path's end. In horizontal type `start` and @@ -1258,7 +1402,15 @@ impl Ctx { Some("end") => 1.0, _ => 0.0, }; - if !vertical && self.prop(el, "direction").is_some_and(|d| d.trim() == "rtl") { 1.0 - a } else { a } + // With `unicode-bidi: plaintext` on the ``, a chunk runs in the direction of its + // first strong character, left to right without one ([`pin_first_strong`]). + let chunk_rtl = || { + let end = (i + 1..n).find(|&j| x[j].is_some() || y[j].is_some()).unwrap_or(n); + let chunk: String = cs.chars[i..end].iter().map(|c| c.0).collect(); + text_first_strong_rtl(&chunk) == Some(true) + }; + let rtl = if plaintext { chunk_rtl() } else { self.is_rtl(el) }; + if !vertical && rtl { 1.0 - a } else { a } }; let anchor = anchor_of(0); self.fit_lengths(&cs.spans, &mut cells, vertical, label, warnings); @@ -1279,10 +1431,18 @@ impl Ctx { let em = self.font_size(tp); let offset = tp.attribute("startOffset").and_then(|v| self.length(v, em, len)).unwrap_or(0.0) + dx[0]; let width = if anchor > 0.0 { advance(&point_text(&cells)) } else { 0.0 }; - // Text that would start before the path's beginning starts at it, with all its glyphs - // on the path (SVG does not draw the glyphs that fall off it). - let start = Some((offset - anchor * width) / len).filter(|s| s.is_finite()).map_or(0.0, |s| s.clamp(0.0, 1.0)); - obj.kind = TextKind::OnPath { path: PathData::from_bezpath(&bp), start, end: None }; + // On a path of one closed subpath, text that starts before the path's start or past its + // end wraps around the path. Otherwise it starts at the path's start or end. + let path = PathData::from_bezpath(&bp); + let wraps = path.subpaths.len() == 1 && path.is_closed(); + let wrap = |s: f64| { + // `rem_euclid` can round a tiny negative value up to 1. + let s = s.rem_euclid(1.0); + if s < 1.0 { s } else { 0.0 } + }; + let start = + Some((offset - anchor * width) / len).filter(|s| s.is_finite()).map_or(0.0, |s| if wraps { wrap(s) } else { s.clamp(0.0, 1.0) }); + obj.kind = TextKind::OnPath { path, start, end: None }; obj.xf = Affine::IDENTITY; } else if vertical { // Type on a vertical path: dy is extra advance, dx shifts across the column. @@ -1306,7 +1466,7 @@ impl Ctx { obj.xf = Affine::IDENTITY; } else { let origin = Point::new(x[0].unwrap_or(0.0) + dx[0], y[0].unwrap_or(0.0) + dy[0]); - let (justify, left, starts) = lines(&mut cells, &x, &y, &dx, &dy, &anchor_of, rtl, origin.x, &mut breaks); + let (justify, left, starts) = lines(&mut cells, &x, &y, &dx, &dy, &anchor_of, &pin, origin.x, &mut breaks); obj.para.justify = justify; obj.xf = Affine::translate((finite(left), finite(origin.y))); // Lines anchored differently or at different x (paragraphs aligned or indented @@ -1332,7 +1492,7 @@ impl Ctx { if !para_styles.is_empty() { obj.set_paragraph_styles(para_styles); } - pin_direction(&mut obj, rtl); + pin(&mut obj); keep_reader_anchors(&mut obj); // The placeholder covers the text (laid out when a paint server needs its bounding box). let b = if paints.is_empty() { obj.bounds() } else { Some(obj.xf.transform_rect_bbox(measure(&obj).bounds)) }.unwrap_or_default(); @@ -1437,9 +1597,9 @@ fn leading_tolerance(spacing: f64) -> f64 { /// Point type: line breaks, baseline shifts and kerning from the positioning lists. Returns the /// justification, the x of the first line's left (or anchor) edge and each line's first /// character, alignment (as for [`justify_of`]) and anchor x. `anchor_of` gives where the chunk -/// starting at a character sits on its anchor, and `rtl` whether the text's `direction` is `rtl` -/// ([`pin_direction`]). When characters are placed on their own, every line is left-aligned and -/// its anchor x is its left edge. +/// starting at a character sits on its anchor, and `pin` sets the paragraph directions of the +/// text ([`pin_direction`]). When characters are placed on their own, every line is left-aligned +/// and its anchor x is its left edge. #[allow(clippy::too_many_arguments)] fn lines( cells: &mut [Cell], @@ -1448,7 +1608,7 @@ fn lines( dx: &[f64], dy: &[f64], anchor_of: &dyn Fn(usize) -> f64, - rtl: bool, + pin: &dyn Fn(&mut TextObject), x0: f64, breaks: &mut Vec, ) -> (Justify, f64, Vec<(usize, f64, f64)>) { @@ -1519,7 +1679,7 @@ fn lines( for round in 0..4 { let (runs, bytes) = assemble(cells, breaks); let mut text = with_runs(runs.0); - pin_direction(&mut text, rtl); + pin(&mut text); let (pens, ends) = pens(&measure(&text), &bytes); // The edges of each line's first chunk, found once a round. let first: Vec> = lines.iter().map(|&(s, _)| edges(s, &pens, &ends)).collect(); @@ -1621,6 +1781,80 @@ fn pin_direction(obj: &mut TextObject, rtl: bool) { } } +/// `unicode-bidi: plaintext` on a `` (CSS Writing Modes 3 §2.2, +/// https://www.w3.org/TR/css-writing-modes-3/#unicode-bidi): each paragraph of `obj` is pinned to +/// the direction of its first strong character, and left to right without one (UAX #9 P2, P3). +fn pin_first_strong(obj: &mut TextObject) { + let text = obj.plain_text(); + let mut styles = obj.paragraph_styles(); + for (para, style) in text.split('\n').zip(styles.iter_mut()) { + let rtl = text_first_strong_rtl(para) == Some(true); + style.direction = Some(if rtl { ParaDirection::RightToLeft } else { ParaDirection::LeftToRight }); + } + obj.set_paragraph_styles(styles); +} + +/// Whether the first strong character (UAX #9 P2) of `text` is right to left; `None` when it holds +/// none. Paragraph separators count as spaces, so all of `text` is searched. +fn text_first_strong_rtl(text: &str) -> Option { + let line: String = text.chars().map(|c| if matches!(c, '\n' | '\r' | '\u{1C}'..='\u{1E}' | '\u{85}' | '\u{2029}') { ' ' } else { c }).collect(); + if vectorcraft_text::paragraph_is_rtl(&line, None) { + return Some(true); + } + // Without a strong character of its own, a right-to-left letter after it is the first one. + (!vectorcraft_text::paragraph_is_rtl(&format!("{line}\u{5D0}"), None)).then_some(false) +} + +/// The first strong characters (UAX #9 P2) of the elements of one ``, found for each element +/// in constant time from one pass over the text's characters. An isolate initiator is skipped to +/// its matching PDI (UAX #9 BD9), and one without a matching PDI to the end; paragraph separators +/// count as spaces, as in [`text_first_strong_rtl`]. +struct FirstStrong { + /// The characters each element holds: a range of indices into `next`. + spans: HashMap>, + /// For each character and for the end: the index of the first strong character from there on, + /// isolates skipped, and whether it is right to left; `None` when there is none. + next: Vec>, +} + +impl FirstStrong { + fn new(chars: &[char], spans: HashMap>) -> Self { + use unicode_bidi::BidiClass::{AL, FSI, L, LRI, PDI, R, RLI}; + let class = |c: char| unicode_bidi::bidi_class(c); + // The matching PDI of each isolate initiator. + let mut pdi = vec![None; chars.len()]; + let mut open = vec![]; + for (i, &c) in chars.iter().enumerate() { + match class(c) { + LRI | RLI | FSI => open.push(i), + PDI => { + if let Some(at) = open.pop() { + pdi[at] = Some(i); + } + } + _ => {} + } + } + let mut next = vec![None; chars.len() + 1]; + for (i, &c) in chars.iter().enumerate().rev() { + next[i] = match class(c) { + L => Some((i, false)), + R | AL => Some((i, true)), + LRI | RLI | FSI => pdi[i].and_then(|p| next[p + 1]), + _ => next[i + 1], + }; + } + Self { spans, next } + } + + /// Whether the first strong character of element `n` is right to left; `None` when it holds + /// none. An isolate that opens inside `n` and closes after it hides the rest of `n`. + fn of(&self, n: roxmltree::NodeId) -> Option { + let span = self.spans.get(&n)?; + self.next.get(span.start).copied().flatten().filter(|&(at, _)| at < span.end).map(|(_, rtl)| rtl) + } +} + /// A left-aligned point text of `runs` at the origin (for measuring). fn with_runs(runs: Vec) -> TextObject { let mut t = TextObject::point(Point::ZERO, "", CharStyle::default()); diff --git a/crates/svg/src/lib.rs b/crates/svg/src/lib.rs index 23cc07d3c1..b035e6cd10 100644 --- a/crates/svg/src/lib.rs +++ b/crates/svg/src/lib.rs @@ -491,16 +491,10 @@ pub(crate) fn text_within<'a>(bytes: &'a [u8], unpacked: &std::sync::atomic::Ato match craft_svg::svgz::inflate(bytes, most) { Ok(raw) => { unpacked.fetch_add(raw.len() as u64, Ordering::Relaxed); - craft_svg::svgz::decode(&raw) - .map(|t| std::borrow::Cow::Owned(t.into_owned())) - .map_err(|_| not_utf8()) - } - Err(craft_svg::svgz::Error::TooLarge(_)) => { - Err(SvgError::TooBig(format!("the SVGZ file unpacks to more than {} MB", most >> 20))) - } - Err(craft_svg::svgz::Error::Corrupt(e)) => { - Err(SvgError::Parse(format!("not a valid SVGZ file: {e}"))) + craft_svg::svgz::decode(&raw).map(|t| std::borrow::Cow::Owned(t.into_owned())).map_err(|_| not_utf8()) } + Err(craft_svg::svgz::Error::TooLarge(_)) => Err(SvgError::TooBig(format!("the SVGZ file unpacks to more than {} MB", most >> 20))), + Err(craft_svg::svgz::Error::Corrupt(e)) => Err(SvgError::Parse(format!("not a valid SVGZ file: {e}"))), Err(craft_svg::svgz::Error::Encoding) => Err(not_utf8()), Err(e) => Err(SvgError::Parse(e.to_string())), } diff --git a/crates/svg/tests/it/blend_export.rs b/crates/svg/tests/it/blend_export.rs index 3804d30ed2..ec947041b0 100644 --- a/crates/svg/tests/it/blend_export.rs +++ b/crates/svg/tests/it/blend_export.rs @@ -202,6 +202,212 @@ fn a_mask_region_keeps_the_shadows_of_the_masked_art() { } } +fn drop_shadow() -> vectorcraft_doc::Effect { + vectorcraft_doc::Effect { + id: "stylize.dropShadow".into(), + params: serde_json::json!({"x": 15, "y": 15, "blur": 0, "opacity": 100}), + visible: true, + } +} + +/// Whether every `` in `svg` starts with a hidden, unpainted rectangle over its mask's region, +/// and whether any does. +fn spanning_rects(svg: &str) -> (bool, bool) { + let spans = masked_group_spans(svg); + (spans.iter().all(|s| *s), spans.iter().any(|s| *s)) +} + +/// For each `` in `svg`, in document order, whether it starts with a hidden, unpainted +/// rectangle over its mask's region. +fn masked_group_spans(svg: &str) -> Vec { + let xml = roxmltree::Document::parse_with_options(svg, roxmltree::ParsingOptions { allow_dtd: true, ..Default::default() }).unwrap(); + let spans: Vec = xml + .descendants() + .filter(|n| n.has_tag_name("g") && n.has_attribute("mask")) + .map(|group| { + let id = group.attribute("mask").unwrap().trim_start_matches("url(#").trim_end_matches(')'); + let mask = xml.descendants().find(|n| n.has_tag_name("mask") && n.attribute("id") == Some(id)).unwrap(); + let first = group.children().find(|n| n.is_element()).unwrap(); + first.has_tag_name("rect") + && first.attribute("fill") == Some("none") + && first.attribute("visibility") == Some("hidden") + && ["x", "y", "width", "height"].iter().all(|a| first.attribute(*a).is_some() && first.attribute(*a) == mask.attribute(*a)) + }) + .collect(); + assert!(!spans.is_empty(), "no masked group in {svg}"); + spans +} + +/// The number of paths `svg` imports as. +fn imported_paths(svg: &str) -> usize { + let (back, warnings) = vectorcraft_svg::import_with_report(svg).unwrap(); + assert!(warnings.is_empty(), "{warnings:?}"); + let mut paths = 0; + back.walk(|n| paths += usize::from(n.path_data().is_some())); + paths +} + +/// A masked group whose content holds a raster effect (a drop shadow, blur, glow or feather, which +/// paint past the shapes) starts with a hidden, unpainted rectangle over the mask's region, so that +/// a reader that draws a masked group only inside the box of its shapes still draws it. Art without +/// one gets none, brushed strokes (written as shapes) included, nor does an object whose own shadow +/// is drawn outside the mask. Import leaves the rectangle out. +#[test] +fn a_masked_group_spans_its_region_when_its_art_paints_past_its_shapes() { + // How the red square sits under the mask. + #[derive(Debug, Clone, Copy)] + enum Case { + Alone, + InGroup, + InNestedGroup, + FillEffect, + HiddenFill, + UnpaintedStroke, + HiddenInGroup, + Brushed, + InSymbol, + OverriddenSymbol, + InBlend, + } + use Case::*; + for (case, shadowed, want) in [ + (InGroup, true, true), + (InGroup, false, false), + (Alone, true, false), + (Alone, false, false), + (InNestedGroup, true, true), + (FillEffect, true, true), + (FillEffect, false, false), + // A fill or stroke that isn't written doesn't count. + (HiddenFill, true, false), + (UnpaintedStroke, true, false), + (HiddenInGroup, true, false), + (Brushed, false, false), + (Brushed, true, true), + (InSymbol, true, true), + (InSymbol, false, false), + // An unpainted fill in a dynamic symbol's art that the instance paints counts. + (OverriddenSymbol, true, true), + (OverriddenSymbol, false, false), + (InBlend, true, true), + (InBlend, false, false), + ] { + let mut d = Document::new(100.0, 60.0); + let mut red = rect(&mut d, Rect::new(10.0, 10.0, 30.0, 30.0), [255, 0, 0]); + if matches!(case, Brushed) { + let mut stroke = vectorcraft_doc::StrokeLayer::new(Paint::solid(Color::rgb8(0, 0, 200)), 8.0); + stroke.brush = Some("Bristle Round".into()); + red.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(stroke)); + } + if matches!(case, UnpaintedStroke) { + red.appearance.items.push(vectorcraft_doc::AppearanceItem::Stroke(vectorcraft_doc::StrokeLayer::new(Paint::None, 8.0))); + } + if shadowed { + match case { + FillEffect | HiddenFill | OverriddenSymbol => red.appearance.items[0].effects_mut().push(drop_shadow()), + UnpaintedStroke => red.appearance.items.last_mut().unwrap().effects_mut().push(drop_shadow()), + _ => red.appearance.effects.push(drop_shadow()), + } + } + if matches!(case, HiddenFill) + && let vectorcraft_doc::AppearanceItem::Fill(f) = &mut red.appearance.items[0] + { + f.visible = false; + } + if matches!(case, OverriddenSymbol) { + red.appearance.set_fill(Paint::None); + } + let group = |d: &mut Document, n: Node| Node::group(d.alloc_id(), vec![n.into()]); + let mut masked = match case { + Alone | FillEffect => red, + HiddenFill | UnpaintedStroke => group(&mut d, red), + InGroup | Brushed => group(&mut d, red), + InNestedGroup => { + let inner = group(&mut d, red); + group(&mut d, inner) + } + HiddenInGroup => { + red.visible = false; + group(&mut d, red) + } + InSymbol => { + d.symbols.push(vectorcraft_doc::Symbol { dynamic: false, name: "Square".into(), art: std::sync::Arc::new(red) }); + let instance = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Square".into(), xf: vectorcraft_geom::Affine::IDENTITY }); + group(&mut d, instance) + } + OverriddenSymbol => { + d.symbols.push(vectorcraft_doc::Symbol { dynamic: true, name: "Square".into(), art: std::sync::Arc::new(red) }); + let mut instance = + Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "Square".into(), xf: vectorcraft_geom::Affine::IDENTITY }); + let fill = Some(Paint::solid(Color::rgb8(255, 0, 0))); + instance.extras_mut().symbol_overrides.push(vectorcraft_doc::symbol_overrides::SymbolOverride { fill, ..Default::default() }); + group(&mut d, instance) + } + InBlend => { + let mut blue = rect(&mut d, Rect::new(60.0, 10.0, 80.0, 30.0), [0, 0, 255]); + blue.appearance.effects = red.appearance.effects.clone(); + let blend = Node::new(d.alloc_id(), NodeKind::Blend { children: vec![red.into(), blue.into()], spec: Default::default() }); + group(&mut d, blend) + } + }; + let art = rect(&mut d, Rect::new(10.0, 10.0, 20.0, 30.0), [255, 255, 255]); + masked.extras_mut().mask = Some(Box::new(OpacityMask::new(art, false))); + add(&mut d, masked); + let svg = export(&d, &ExportOptions::default()); + assert_eq!(spanning_rects(&svg).0, want, "{case:?}, shadowed {shadowed}:\n{svg}"); + if matches!(case, Alone | InGroup | InNestedGroup | FillEffect) { + // The red square alone: no rectangle of the region's size comes back. + assert_eq!(imported_paths(&svg), 1, "{case:?}, shadowed {shadowed}:\n{svg}"); + } + } + // Type can't be measured, so its mask's region covers any artwork: a group of type gets the + // rectangle only when it holds a raster effect, on the type or on a path beside it. + for (shadowed, path_shadowed) in [(false, false), (true, false), (false, true)] { + let mut d = Document::new(80.0, 40.0); + let style = CharStyle { size: 24.0, fill: Paint::solid(Color::BLACK), ..CharStyle::default() }; + let mut t = Node::new(d.alloc_id(), NodeKind::Text(Box::new(TextObject::point(Point::new(5.0, 30.0), "Wide", style)))); + if shadowed { + t.appearance.effects.push(drop_shadow()); + } + let mut red = rect(&mut d, Rect::new(50.0, 5.0, 60.0, 15.0), [255, 0, 0]); + if path_shadowed { + red.appearance.effects.push(drop_shadow()); + } + let mut group = Node::group(d.alloc_id(), vec![t.into(), red.into()]); + let art = rect(&mut d, Rect::new(0.0, 0.0, 40.0, 40.0), [255, 255, 255]); + group.extras_mut().mask = Some(Box::new(OpacityMask::new(art, false))); + add(&mut d, group); + let svg = export(&d, &ExportOptions::default()); + let want = shadowed || path_shadowed; + assert_eq!(svg.contains("visibility=\"hidden\""), want, "type {shadowed}, path {path_shadowed}:\n{svg}"); + } +} + +/// In a knockout group, each element is drawn inside one mask of the elements above it. When the +/// element inside a mask's group has a drop shadow, that group starts with the same hidden, +/// unpainted rectangle over the region, the other groups don't, and import leaves it out. +#[test] +fn a_knockout_group_spans_its_masks_when_an_element_paints_past_its_shapes() { + for shadowed in [false, true] { + let mut d = Document::new(60.0, 60.0); + let mut below = rect(&mut d, Rect::new(5.0, 5.0, 25.0, 25.0), [200, 0, 0]); + if shadowed { + below.appearance.effects.push(drop_shadow()); + } + let mut middle = rect(&mut d, Rect::new(15.0, 15.0, 35.0, 35.0), [0, 200, 0]); + middle.opacity = 0.5; + let mut top = rect(&mut d, Rect::new(20.0, 5.0, 30.0, 40.0), [0, 0, 200]); + top.opacity = 0.5; + let mut group = Node::group(d.alloc_id(), vec![below.into(), middle.into(), top.into()]); + group.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, group); + let svg = export(&d, &ExportOptions::default()); + // The bottom and middle elements are masked, in paint order; the top one isn't. + assert_eq!(masked_group_spans(&svg), [shadowed, false], "shadowed {shadowed}:\n{svg}"); + assert_eq!(imported_paths(&svg), 3, "shadowed {shadowed}:\n{svg}"); + } +} + /// Type is measured by its layout or its path, and a reader sets live type in its own font, so a /// mask or knockout over type keeps the region that covers any artwork. #[test] @@ -262,3 +468,93 @@ fn a_mask_region_covers_a_blend_as_written() { let [x, y, w, h] = ["x", "y", "width", "height"].map(|a| mask.attribute(a).and_then(|v| v.parse::().ok()).unwrap_or(f64::NAN)); assert!(x <= 0.0 && y <= 0.0 && x + w >= 95.0 && y + h >= 35.0 && w < 200.0 && h < 200.0, "{x} {y} {w} {h} in {svg}"); } + +/// A knockout group of `n` red, green and blue squares at 50% opacity that all overlap, over an +/// opaque backdrop. `knockout_shape`: their opacity defines their knockout shape. +fn knockout_squares(n: usize, knockout_shape: bool) -> Document { + let mut d = Document::new(200.0, 200.0); + let backdrop = rect(&mut d, Rect::new(0.0, 0.0, 200.0, 200.0), [230, 200, 50]); + add(&mut d, backdrop); + let colors = [[255, 0, 0], [0, 200, 0], [0, 0, 255]]; + let squares = (0..n) + .map(|i| { + let x = (i % 20) as f64 * 2.0; + let mut s = rect(&mut d, Rect::new(20.0 + x, 50.0, 120.0 + x, 150.0), colors[i % 3]); + (s.opacity, s.knockout_shape) = (0.5, knockout_shape); + std::sync::Arc::new(s) + }) + .collect(); + let mut group = Node::group(d.alloc_id(), squares); + group.knockout = vectorcraft_doc::Knockout::On; + add(&mut d, group); + d +} + +/// The deepest an element of `svg` nests, counting the root element as 1. +fn element_depth(svg: &str) -> usize { + let xml = roxmltree::Document::parse_with_options(svg, roxmltree::ParsingOptions { allow_dtd: true, ..Default::default() }).unwrap(); + xml.descendants().filter(|n| n.is_element()).map(|n| n.ancestors().filter(|a| a.is_element()).count()).max().unwrap_or(0) +} + +/// The elements of a knockout group are siblings, each in one mask of the overlapping elements +/// above it, however many there are: 200 translucent elements stay well within the nesting the +/// web build reads (34 levels), and the file reads back with nothing merged. Where the elements' +/// shapes are the area they paint, the file draws as the canvas does. +#[test] +fn a_knockout_group_of_many_translucent_elements_stays_shallow() { + for knockout_shape in [false, true] { + let d = knockout_squares(200, knockout_shape); + let (svg, warnings) = vectorcraft_svg::export_with_report(&d, &ExportOptions::default()); + assert!(warnings.is_empty(), "{warnings:?}"); + assert_eq!(svg.matches("").expect("its end")]; + body[body.find('>').unwrap()..].to_string() + }; + assert_eq!(clipped(0.0, true), clipped(50.0, false), "the clip path is written where the effect moves it"); + assert_ne!(clipped(0.0, true), clipped(0.0, false)); +} + #[test] fn geometry_effects_on_type_export_as_its_reshaped_outlines() { let style = CharStyle { size: 40.0, fill: Paint::solid(Color::BLACK), ..Default::default() }; diff --git a/crates/svg/tests/it/image_orientation.rs b/crates/svg/tests/it/image_orientation.rs index fbf412a0bb..549a40a3bf 100644 --- a/crates/svg/tests/it/image_orientation.rs +++ b/crates/svg/tests/it/image_orientation.rs @@ -276,3 +276,18 @@ fn a_turned_jpeg_in_an_svg_image_imports_upright() { let px = pixels(&d, &im); assert!(red(px.get_pixel(4, 3)) && !red(px.get_pixel(4, 12))); } + +/// A turned JPEG that a linked SVG file links to is turned too. +#[test] +fn a_turned_jpeg_linked_from_a_linked_svg_file_imports_upright() { + let dir = folder("nested-file"); + std::fs::create_dir_all(dir.join("sub")).unwrap(); + std::fs::write(dir.join("sub").join("photo.jpg"), jpeg(Some(6))).unwrap(); + let inner = r#""#; + std::fs::write(dir.join("sub").join("inner.svg"), inner).unwrap(); + let (d, im) = import_one(r#""#, Some(&dir)); + assert_eq!((im.width, im.height), (8, 16)); + assert!(near(placed(&im), Rect::new(20.0, 0.0, 60.0, 80.0)), "{:?}", placed(&im)); + let px = pixels(&d, &im); + assert!(red(px.get_pixel(4, 3)) && !red(px.get_pixel(4, 12))); +} diff --git a/crates/svg/tests/it/import_details.rs b/crates/svg/tests/it/import_details.rs index b043e4d985..69e5cafa21 100644 --- a/crates/svg/tests/it/import_details.rs +++ b/crates/svg/tests/it/import_details.rs @@ -216,6 +216,185 @@ fn svgz_images_import_as_vector_art() { assert!((boxes[1].x0 - 100.0).abs() < 1e-6 && (boxes[1].height() - 20.0).abs() < 1e-6, "{boxes:?}"); } +/// An SVG file of 20 × 20 holding a 5 × 5 rectangle and `images`. +fn svg_file(images: &str) -> String { + format!(r#"{images}"#) +} + +/// Reads as [`read`] does, counting the reads of each file name. +fn counting(reads: &std::sync::Mutex>) -> impl Fn(&str) -> Option<(Vec, LinkInfo)> + Sync + '_ { + move |path: &str| { + if let Ok(mut reads) = reads.lock() { + reads.push(Path::new(path).file_name().unwrap().to_string_lossy().into_owned()); + } + read(path) + } +} + +/// A raster an SVG file links to is read from that file's folder and stays linked, in its place in +/// the SVG file's art. +#[test] +fn a_raster_linked_from_a_linked_svg_file_is_read_from_its_folder() { + let dir = folder("nested-link"); + let bytes = png(40, 20); + std::fs::write(dir.join("img").join("photo.png"), &bytes).unwrap(); + std::fs::write(dir.join("img").join("inner.svg"), svg_file(r#""#)).unwrap(); + let (d, w) = open_in(&dir, r#""#); + assert!(w.is_empty(), "{w:?}"); + assert_eq!(rects(&d), 1, "the SVG file's art"); + let [(_, im)] = images(&d)[..] else { panic!("{:?}", art(&d)) }; + let link = im.link.as_ref().unwrap(); + assert_eq!(Path::new(&link.path), dir.join("img").join("photo.png")); + assert_eq!(*d.images[&im.key].bytes, bytes, "the file's pixels"); + let b = im.xf.transform_rect_bbox(Rect::new(0.0, 0.0, 40.0, 20.0)); + assert!((b.x0 - 12.0).abs() < 1e-6 && (b.y0 - 14.0).abs() < 1e-6 && (b.width() - 10.0).abs() < 1e-6, "{b:?}"); +} + +/// One href in two SVG files of different folders names two files: each shows its own. +#[test] +fn one_href_in_svg_files_of_different_folders_shows_each_folders_file() { + let dir = folder("nested-same-href"); + let (outer, inner) = (png(4, 4), png(6, 6)); + std::fs::write(dir.join("photo.png"), &outer).unwrap(); + std::fs::write(dir.join("img").join("photo.png"), &inner).unwrap(); + std::fs::write(dir.join("img").join("inner.svg"), svg_file(r#""#)).unwrap(); + let (d, w) = open_in(&dir, r#""#); + assert!(w.is_empty(), "{w:?}"); + let [(_, a), (_, b)] = images(&d)[..] else { panic!("{:?}", art(&d)) }; + assert_eq!(Path::new(&a.link.as_ref().unwrap().path), dir.join("photo.png")); + assert_eq!(*d.images[&a.key].bytes, outer); + assert_eq!(Path::new(&b.link.as_ref().unwrap().path), dir.join("img").join("photo.png")); + assert_eq!(*d.images[&b.key].bytes, inner); +} + +/// A raster an SVG file links to that can't be read (missing, or refused by the reader) gets the +/// placeholder, stretched to its box, its link and a warning, as one the imported SVG links to. +#[test] +fn a_missing_raster_linked_from_a_linked_svg_file_keeps_a_placeholder() { + let dir = folder("nested-missing"); + std::fs::write(dir.join("img").join("secret.png"), png(4, 4)).unwrap(); + let links = r#""#; + std::fs::write(dir.join("img").join("inner.svg"), svg_file(links)).unwrap(); + let refusing = |path: &str| if path.ends_with("secret.png") { None } else { read(path) }; + let folder = dir.to_string_lossy(); + let body = r#""#; + let (d, w) = import_with(&svg(body), &ImportOptions { folder: Some(&folder), read: Some(&refusing) }).unwrap(); + for name in ["gone.png", "secret.png"] { + assert!(w.iter().any(|w| w.contains(&format!("'{name}' not found"))), "{name}: {w:?}"); + } + let [(_, gone), (_, secret)] = images(&d)[..] else { panic!("{:?}", art(&d)) }; + assert_eq!(Path::new(&gone.link.as_ref().unwrap().path), dir.join("img").join("gone.png")); + assert_eq!(Path::new(&secret.link.as_ref().unwrap().path), dir.join("img").join("secret.png")); + assert!(d.images[&gone.key].is_proxy() && d.images[&secret.key].is_proxy(), "placeholders, not the files"); + let b = gone.xf.transform_rect_bbox(Rect::new(0.0, 0.0, gone.width as f64, gone.height as f64)); + assert!((b.x0 - 12.0).abs() < 1e-6 && (b.width() - 10.0).abs() < 1e-6 && (b.height() - 5.0).abs() < 1e-6, "{b:?}"); +} + +/// An SVG file that links to itself, or to an SVG file that links back to it, is read once each +/// time it is shown: the link back gets the placeholder and a warning. +#[test] +fn svg_files_that_link_back_keep_a_placeholder_where_they_lead_back() { + let dir = folder("nested-cycle"); + std::fs::write(dir.join("img").join("self.svg"), svg_file(r#""#)).unwrap(); + std::fs::write(dir.join("img").join("a.svg"), svg_file(r#""#)).unwrap(); + std::fs::write(dir.join("img").join("b.svg"), svg_file(r#""#)).unwrap(); + let folder = dir.to_string_lossy(); + for (body, files, back) in [("img/self.svg", vec!["self.svg"], "self.svg"), ("img/a.svg", vec!["a.svg", "b.svg"], "./a.svg")] { + let reads = std::sync::Mutex::new(vec![]); + let counted = counting(&reads); + let body = format!(r#""#); + let (d, w) = import_with(&svg(&body), &ImportOptions { folder: Some(&folder), read: Some(&counted) }).unwrap(); + assert_eq!(*reads.lock().unwrap(), [files.clone(), files.clone()].concat()); + let warning = format!("linked image '{back}' leads back to an SVG file that shows it: a placeholder keeps its place until it is relinked"); + assert_eq!(w, [warning.clone(), warning]); + assert_eq!(rects(&d), 2 * files.len(), "each file's art once in each place"); + let found = images(&d); + assert_eq!(found.len(), 2); + for (_, im) in found { + assert!(d.images[&im.key].is_proxy()); + assert_eq!(Path::new(&im.link.as_ref().unwrap().path), dir.join("img").join(back.trim_start_matches("./"))); + } + } +} + +/// Two SVG files that link to each other, each shown by the imported SVG, each show the other +/// once, then the placeholder of the link back to themselves. +#[test] +fn svg_files_that_link_to_each_other_each_lead_back_to_themselves() { + let dir = folder("nested-cycle-both"); + std::fs::write(dir.join("img").join("a.svg"), svg_file(r#""#)).unwrap(); + std::fs::write(dir.join("img").join("b.svg"), svg_file(r#""#)).unwrap(); + let (d, w) = open_in(&dir, r#""#); + assert_eq!(w.len(), 2, "{w:?}"); + assert_eq!(rects(&d), 4, "each file's art once in each place"); + let [(_, a), (_, b)] = images(&d)[..] else { panic!("{:?}", art(&d)) }; + assert_eq!(Path::new(&a.link.as_ref().unwrap().path), dir.join("img").join("a.svg")); + assert_eq!(Path::new(&b.link.as_ref().unwrap().path), dir.join("img").join("b.svg")); +} + +/// An SVG file shown twice, and a raster that two SVG files link to, are read once. +#[test] +fn a_repeated_linked_svg_file_is_read_once() { + let dir = folder("nested-repeat"); + std::fs::write(dir.join("img").join("photo.png"), png(4, 4)).unwrap(); + std::fs::write(dir.join("img").join("a.svg"), svg_file(r#""#)).unwrap(); + std::fs::write( + dir.join("img").join("b.svg"), + svg_file(r#""#), + ) + .unwrap(); + let reads = std::sync::Mutex::new(vec![]); + let counted = counting(&reads); + let folder = dir.to_string_lossy(); + let body = r#""#; + let (d, w) = import_with(&svg(body), &ImportOptions { folder: Some(&folder), read: Some(&counted) }).unwrap(); + assert!(w.is_empty(), "{w:?}"); + let mut reads = reads.lock().unwrap().clone(); + reads.sort(); + assert_eq!(reads, ["a.svg", "b.svg", "photo.png"]); + let found = images(&d); + assert_eq!(found.len(), 4); + assert!(found.iter().all(|(_, im)| Path::new(&im.link.as_ref().unwrap().path) == dir.join("img").join("photo.png"))); +} + +/// A chain of SVG files, each linking to the next, is read only as deep as SVG images may nest: +/// past it the images are left out, with a warning. +#[test] +fn a_chain_of_linked_svg_files_stops_at_the_depth_cap() { + let dir = folder("nested-chain"); + let levels = vectorcraft_svg::MAX_ELEMENT_DEPTH; + for i in 0..levels { + std::fs::write(dir.join("img").join(format!("{i}.svg")), svg_file(&format!(r#""#, i + 1))) + .unwrap(); + } + let reads = std::sync::Mutex::new(vec![]); + let counted = counting(&reads); + let folder = dir.to_string_lossy(); + let (d, w) = + import_with(&svg(r#""#), &ImportOptions { folder: Some(&folder), read: Some(&counted) }) + .unwrap(); + let reads = reads.lock().unwrap().len(); + assert!(reads <= levels / 2 + 4, "{reads} reads"); + assert!(rects(&d) < levels / 2, "{}", rects(&d)); + assert!(w.iter().any(|w| w.contains("nest more than")), "{w:?}"); +} + +/// An SVG file reached first inside an SVG file where it nests too deep to be shown, then from the +/// imported SVG, shows the raster it links to where it fits. +#[test] +fn an_svg_file_too_deep_in_one_place_shows_its_links_in_another() { + let dir = folder("nested-deep-then-shallow"); + let depth = vectorcraft_svg::MAX_ELEMENT_DEPTH; + let nest = |n: usize, inner: &str| format!("{}{inner}{}", "".repeat(n), "".repeat(n)); + std::fs::write(dir.join("img").join("photo.png"), png(4, 4)).unwrap(); + std::fs::write(dir.join("img").join("deep.svg"), svg_file(&nest(depth * 2 / 3, r#""#))).unwrap(); + std::fs::write(dir.join("img").join("a.svg"), svg_file(&nest(depth / 2, r#""#))).unwrap(); + let (d, w) = open_in(&dir, r#""#); + assert!(w.iter().any(|w| w.contains("nest more than")), "{w:?}"); + let [(_, im)] = images(&d)[..] else { panic!("{:?} {w:?}", art(&d)) }; + assert_eq!(Path::new(&im.link.as_ref().unwrap().path), dir.join("img").join("photo.png")); +} + const SVG_NS: &str = r#"xmlns="http://www.w3.org/2000/svg""#; /// An image showing `svg`, from a base64 data URL of type `mime` (none when empty). diff --git a/crates/svg/tests/it/import_text.rs b/crates/svg/tests/it/import_text.rs index 92747cd05a..d55e8b930e 100644 --- a/crates/svg/tests/it/import_text.rs +++ b/crates/svg/tests/it/import_text.rs @@ -299,6 +299,84 @@ fn text_path_becomes_type_on_a_path() { assert_eq!(t[2].para.justify, Justify::Left); } +#[test] +fn text_on_a_closed_path_wraps_past_the_path_start() { + // A closed path 400 long: text anchored before its start, or offset past its end, wraps + // around the path instead of stopping at its start or end. + let d = open( + r##" + Wave + Wave + Wave + Wave + Wave + Wave + + Wave + + Wave + Wave"##, + ); + let t = texts(&d); + assert_eq!(t.len(), 9); + let start_of = |t: &TextObject| match t.kind { + TextKind::OnPath { start, .. } => start, + _ => panic!("{:?}", t.kind), + }; + let width: f64 = layout(FontDb::global(), t[0]).glyphs.iter().map(|g| g.advance).sum(); + assert!(width > 0.0); + // Ending at the path's start: the text starts its width before the end of the loop. + assert!(close(start_of(t[0]), 1.0 - width / 400.0, 1e-6), "{} {width}", start_of(t[0])); + assert!(close(start_of(t[1]), 0.1, 1e-9), "{}", start_of(t[1])); + // Right-to-left text starts at its edge toward the path's end, here the path's start. + assert!(close(start_of(t[2]), 1.0 - width / 400.0, 1e-6), "{} {width}", start_of(t[2])); + // Centered on the path's start: half the text before it, half after. + assert!(close(start_of(t[3]), 1.0 - width / 800.0, 1e-6), "{} {width}", start_of(t[3])); + // A negative startOffset, in user units or as a percentage, counts back from the path's end. + assert!(close(start_of(t[4]), 0.9, 1e-9), "{}", start_of(t[4])); + assert!(close(start_of(t[5]), 0.9, 1e-9), "{}", start_of(t[5])); + // A path of two closed subpaths, and an open path, do not wrap: the text starts at the path's + // start or end. + assert_eq!(start_of(t[6]), 0.0); + assert_eq!(start_of(t[7]), 0.0); + assert_eq!(start_of(t[8]), 1.0); + + // Laid out, the end-anchored text draws every glyph up the left side and ends at the start + // point; the centered text crosses the start point from the left side onto the top. + let lay = layout(FontDb::global(), t[0]); + assert!(!lay.overflow); + assert_eq!(lay.glyphs.len(), 4); + for g in &lay.glyphs { + let o = t[0].xf * g.origin; + assert!(close(o.x, 50.0, 0.05) && o.y > 50.0 && o.y < 150.0, "{o:?}"); + } + let last = lay.glyphs.last().map(|g| t[0].xf * (g.origin + baseline_dir(g.angle) * g.advance)); + assert!(last.is_some_and(|p| close(p.x, 50.0, 0.05) && close(p.y, 50.0, 0.05)), "{last:?}"); + let lay = layout(FontDb::global(), t[3]); + assert!(!lay.overflow); + assert_eq!(lay.glyphs.len(), 4); + let first = t[3].xf * lay.glyphs[0].origin; + assert!(close(first.x, 50.0, 0.05) && first.y > 50.0, "{first:?}"); + let last = t[3].xf * lay.glyphs[3].origin; + assert!(close(last.y, 50.0, 0.05) && last.x > 50.0, "{last:?}"); + + // Text longer than the loop draws its first characters, whatever its anchor. + let d = open( + r##" + Wave Wave Wave"##, + ); + let t = only_text(&d); + let lay = layout(FontDb::global(), t); + assert!(lay.overflow); + assert!(!lay.glyphs.is_empty() && lay.glyphs.len() < 14, "{}", lay.glyphs.len()); + assert!(lay.glyphs.iter().enumerate().all(|(i, g)| g.byte == i), "{:?}", lay.glyphs.iter().map(|g| g.byte).collect::>()); +} + +/// The unit vector along a glyph's baseline. +fn baseline_dir(angle: f64) -> vectorcraft_geom::Vec2 { + vectorcraft_geom::Vec2::new(angle.cos(), angle.sin()) +} + #[test] fn per_character_positions_rotation_and_shifts() { let d = open(r#"abcd"#); @@ -391,6 +469,14 @@ fn rtl_point_text_start_and_end_use_directional_edges() { (r#"Wave"#, 0.0), (r#"Wave"#, 0.0), (r#"Wave"#, 1.0), + // CSS keywords are case-insensitive. + (r#"Wave"#, 1.0), + (r#"Wave"#, 0.0), + // With `unicode-bidi: plaintext`, the direction of the chunk's first strong character. + (r#"אבג"#, 1.0), + (r#"12 אב"#, 0.0), + (r#"Wave"#, 0.0), + (r#"12"#, 1.0), ] { let d = open(body); let (left, right) = line_edges(only_text(&d))[0]; @@ -464,6 +550,177 @@ fn rtl_lines_use_each_chunk_first_character_direction_and_anchor() { assert!(close((e[3].0 + e[3].1) / 2.0, 200.0, 1e-6), "a middle line is centered on 200: {e:?}"); } +/// The Character Direction of the run holding `part`. +fn char_direction_of(t: &TextObject, part: &str) -> Option { + t.runs.iter().find(|r| r.text.contains(part)).unwrap_or_else(|| panic!("no run holds {part:?}: {:?}", t.runs)).style.char_direction +} + +/// SVG 1.1 §10.7.4: a `` whose `unicode-bidi` is `embed` or `bidi-override` opens a bidi +/// embedding in its `direction`; with `normal`, its `direction` leaves the ordering alone. The +/// embedding becomes the Character Direction of its characters, and the `` keeps its own +/// paragraph direction. https://www.w3.org/TR/SVG11/text.html#RelationshipWithBi-directionality +#[test] +fn a_tspan_bidi_embedding_becomes_its_character_direction() { + use vectorcraft_doc::ParaDirection::{LeftToRight as Ltr, RightToLeft as Rtl}; + let read = |body: &str| { + let (d, w) = import_with_report(&svg(body)).unwrap_or_else(|e| panic!("{e}")); + (only_text(&d).clone(), w) + }; + // (outer direction, inner direction, unicode-bidi, the inner run's Character Direction, a warning) + for (outer, inner, bidi, want, warns) in [ + ("ltr", "rtl", "embed", Some(Rtl), false), + ("rtl", "ltr", "embed", Some(Ltr), false), + ("ltr", "rtl", "bidi-override", Some(Rtl), true), + ("rtl", "ltr", "bidi-override", Some(Ltr), true), + ("ltr", "rtl", "normal", None, false), + ("rtl", "ltr", "normal", None, false), + ("ltr", "rtl", "EMBED", Some(Rtl), false), + ("ltr", "RTL", "embed", Some(Rtl), false), + ("RTL", "ltr", "embed", Some(Ltr), false), + ("ltr", "rtl", "sideways", None, false), + ] { + let (t, w) = read(&format!( + r#"ab 1 2 cd"# + )); + let case = format!("{outer} text, {inner} {bidi} tspan"); + assert_eq!(t.plain_text(), "ab 1 2 cd", "{case}: the characters stay in logical order"); + assert_eq!(char_direction_of(&t, "1 2"), want, "{case}: {:?}", t.runs); + assert_eq!(char_direction_of(&t, "ab"), None, "{case}"); + assert_eq!(t.para_at(0).direction == Some(Rtl), outer.eq_ignore_ascii_case("rtl"), "{case}: the paragraph keeps the text's direction"); + assert_eq!(w.iter().any(|w| w.contains("bidi-override") && w.contains("not supported")), warns, "{case}: {w:?}"); + if !warns { + assert!(w.is_empty(), "{case}: {w:?}"); + } + } + // In left-to-right text, digits in a right-to-left embedding are drawn right to left. + let order = |bidi: &str| { + let (t, _) = read(&format!(r#"ab 1 2"#)); + let lay = layout(FontDb::global(), &t); + let x = |byte: usize| lay.glyphs.iter().find(|g| g.byte == byte).map(|g| g.origin.x).unwrap_or_else(|| panic!("no glyph at {byte}")); + x(3) < x(5) + }; + assert!(!order("embed"), "an embedding draws 2 before 1"); + assert!(order("normal"), "without one, 1 comes first"); +} + +/// `unicode-bidi` is not inherited: a `` without one stays in its parent's embedding, and +/// `inherit` takes the parent's value. CSS rules and `style` set it as they set any property. +#[test] +fn unicode_bidi_is_not_inherited_and_reads_from_the_cascade() { + use vectorcraft_doc::ParaDirection::{LeftToRight as Ltr, RightToLeft as Rtl}; + let read = |body: &str| { + let (d, w) = import_with_report(&svg(body)).unwrap_or_else(|e| panic!("{e}")); + (only_text(&d).clone(), w) + }; + // An inner `` with only a `direction` stays in the outer embedding. + let (t, w) = read(r#"ab 12 34 cd"#); + assert_eq!((char_direction_of(&t, "12"), char_direction_of(&t, "34"), char_direction_of(&t, "cd")), (Some(Rtl), Some(Rtl), None), "{:?}", t.runs); + assert!(w.is_empty(), "{w:?}"); + // `inherit` opens an embedding of its own, inside the outer one: kept one level deep, with a warning. + let (t, w) = read( + r#"ab 12 34"#, + ); + assert_eq!((char_direction_of(&t, "12"), char_direction_of(&t, "34")), (Some(Rtl), Some(Ltr)), "{:?}", t.runs); + assert!(w.len() == 1 && w[0].contains("inside another"), "{w:?}"); + // A `unicode-bidi` on the `` or a group is not passed on to the ``. + let (t, _) = read(r#"ab 12"#); + assert!(t.runs.iter().all(|r| r.style.char_direction.is_none()), "{:?}", t.runs); + // From a CSS rule and from `style`; `direction` inherits from the ``. + for body in [ + r#"ab 12"#, + r#"ab 12"#, + ] { + let (t, w) = read(body); + assert_eq!(char_direction_of(&t, "12"), Some(Rtl), "{body}: {:?}", t.runs); + assert_eq!(char_direction_of(&t, "ab"), None, "{body}: {:?}", t.runs); + assert!(w.is_empty(), "{body}: {w:?}"); + } + // On a path and in a link too. + let (t, _) = read( + r##"ab 12 34"##, + ); + assert!(matches!(t.kind, TextKind::OnPath { .. })); + assert_eq!((char_direction_of(&t, "12"), char_direction_of(&t, "34")), (Some(Ltr), Some(Rtl)), "{:?}", t.runs); +} + +/// The text model holds embeddings only: isolates and overrides become embeddings in their +/// `direction`, and `plaintext` one in the direction of its first strong character, each with a +/// warning once a text (CSS Writing Modes 3 §2.2, +/// https://www.w3.org/TR/css-writing-modes-3/#unicode-bidi). +#[test] +fn unicode_bidi_values_the_text_model_cannot_hold_are_reported() { + use vectorcraft_doc::ParaDirection::{LeftToRight as Ltr, RightToLeft as Rtl}; + for (bidi, dir, text, want, says) in [ + ("isolate", "rtl", "12", Some(Rtl), "isolation is not supported"), + ("isolate-override", "rtl", "12", Some(Rtl), "isolation and override are not supported"), + ("plaintext", "ltr", "\u{5D0}\u{5D1}", Some(Rtl), "first strong character"), + ("plaintext", "rtl", "12 ab", Some(Ltr), "first strong character"), + ] { + let body = format!( + r#"ab {text} {text}"# + ); + let (d, w) = import_with_report(&svg(&body)).unwrap_or_else(|e| panic!("{e}")); + let t = only_text(&d); + assert_eq!(char_direction_of(t, text), want, "{bidi}: {:?}", t.runs); + assert!(w.len() == 1 && w[0].starts_with("text 't': ") && w[0].contains(&format!("\"{bidi}\"")) && w[0].contains(says), "{bidi}: {w:?}"); + } + // `plaintext` looks for the first strong character among the characters imported, however far in. + let far = format!("{}\u{5D0}\u{5D1}", "1 ".repeat(1500)); + for (body, part, want) in [ + (r#"אבab"#.to_string(), "ab", Ltr), + (format!("{far}"), "\u{5D0}", Rtl), + (format!("\n12 {far}"), "\u{5D0}", Rtl), + // An isolate that opens in one text node and closes in a later one is skipped whole. + ("⁧ab⁩א".to_string(), "\u{5D0}", Rtl), + ("⁧abcd⁩א".to_string(), "\u{5D0}", Rtl), + // An isolate that opens in a nested `plaintext` element and closes after it hides the rest of that element. + (r#"⁧ab⁩א"#.to_string(), "\u{5D0}", Rtl), + (r#"⁧ab⁩א"#.to_string(), "ab", Ltr), + ] { + let (d, _) = + import_with_report(&svg(&format!(r#"x {body}"#))).unwrap(); + let t = only_text(&d); + assert_eq!(char_direction_of(t, part), Some(want), "{body}: {:?}", t.runs); + } + // `plaintext` on the ``: each paragraph runs in the direction of its first strong character. + for (body, want) in [ + ("12 \u{5D0}\u{5D1} cd", vec![Some(Rtl)]), + (r#"12 ab"#, vec![Some(Ltr)]), + ( + "ab\u{5D0}\u{5D1} cd", + vec![Some(Ltr), Some(Rtl)], + ), + // A paragraph without a strong character runs left to right. + ( + "\u{5D0}\u{5D1}1-2", + vec![Some(Rtl), Some(Ltr)], + ), + ] { + let (d, w) = import_with_report(&svg(body)).unwrap(); + let t = only_text(&d); + let got: Vec<_> = (0..t.paragraph_styles().len()).map(|i| t.para_at(i).direction).collect(); + assert_eq!(got, want, "{body}"); + assert!(w.is_empty(), "{body}: {w:?}"); + } + // Absolutely placed characters sit on their x in the direction of their own paragraph. + let (d, _) = import_with_report(&svg( + r#"אבab אב cdef"#, + )) + .unwrap(); + let t = only_text(&d); + assert_eq!((t.para_at(0).direction, t.para_at(1).direction), (Some(Rtl), Some(Ltr))); + let lay = layout(FontDb::global(), t); + for (byte, x) in [(5, 100.0), (15, 300.0)] { + let g = lay.glyphs.iter().find(|g| g.byte == byte).unwrap_or_else(|| panic!("no glyph at {byte}")); + let left = (t.xf * g.origin).x; + assert!(close(left, x, 0.05), "the character at {byte} starts at {left}, not {x}"); + } + // An override on the `` keeps its paragraph direction. + let (d, w) = import_with_report(&svg(r#"ab"#)).unwrap(); + assert_eq!(only_text(&d).para_at(0).direction, Some(Rtl)); + assert!(w.len() == 1 && w[0].contains("override on the text"), "{w:?}"); +} + /// A line starts at its own x, also when it is anchored as the line before it is and when another /// line holds absolutely placed characters. #[test] diff --git a/crates/svg/tests/it/symbols_layers.rs b/crates/svg/tests/it/symbols_layers.rs index 8e83b6262e..005a03e0fa 100644 --- a/crates/svg/tests/it/symbols_layers.rs +++ b/crates/svg/tests/it/symbols_layers.rs @@ -272,6 +272,33 @@ fn instances_the_def_cant_stand_for_get_their_own_art() { assert_similar(&render_artboard(&d), &resvg_render(&svg, 200, 120), 24.0, 0.002); } +/// An instance half stained red whose Transform effect moves it 60 pt right is written in its +/// stained colors where the canvas draws it, on its own and inside a group. +#[test] +fn a_stained_instance_with_a_geometry_effect_keeps_its_stain() { + for grouped in [false, true] { + let mut d = symbol_doc(0.0, &[]); + let mut stained = Node::new(d.alloc_id(), NodeKind::SymbolInstance { symbol: "My Mark".into(), xf: Affine::translate((40.0, 60.0)) }); + stained.appearance = Appearance::basic(Paint::solid(Color::rgb8(255, 0, 0)), Paint::None, 0.0).into(); + stained.appearance.items.retain(|i| i.is_fill()); + if let vectorcraft_doc::AppearanceItem::Fill(f) = &mut stained.appearance.items[0] { + f.opacity = 0.5; + } + stained.appearance.effects.push(vectorcraft_doc::Effect { + id: "distort.transform".into(), + params: serde_json::json!({"moveH": 60.0}), + visible: true, + }); + let n = if grouped { Node::group(d.alloc_id(), vec![Arc::new(stained)]) } else { stained }; + let l = d.layers[0].id; + d.insert(Some(l), usize::MAX, n).unwrap(); + let svg = export(&d, &ExportOptions::default()); + let blue = Color::rgb8(30, 90, 220).to_hex().to_ascii_lowercase(); + assert!(!svg.to_ascii_lowercase().contains(&blue), "the symbol's own blue is stained: {svg}"); + assert_similar(&render_artboard(&d), &resvg_render(&svg, 200, 120), 24.0, 0.003); + } +} + #[test] fn pattern_paints_in_symbols_stay_on_the_page() { let mut d = Document::new(200.0, 120.0); diff --git a/crates/svg/tests/it/text_layout.rs b/crates/svg/tests/it/text_layout.rs index 25d4d27d68..c53318c358 100644 --- a/crates/svg/tests/it/text_layout.rs +++ b/crates/svg/tests/it/text_layout.rs @@ -196,6 +196,35 @@ fn insert_aki_places_each_moved_character() { assert!(!out.svg.contains("` where the character is +/// drawn, so a reader draws the text where the canvas does, with fewer ``s asked for too. +/// On a path the type is outlined. +#[test] +fn tsume_places_each_moved_character() { + let tight = CharStyle { tsume: 50.0, ..style(12.0) }; + let runs = + vec![run("H", style(12.0)), run("O", tight.clone()), run("H ", style(12.0)), run("OHO\nHO", CharStyle { tsume: 100.0, ..style(12.0) })]; + for justify in [Justify::Left, Justify::Center, Justify::Right] { + assert_drawn_in_place(&area_doc(runs.clone(), 200.0, justify)); + } + let d = area_doc(runs, 200.0, Justify::Left); + let plain = tspans(&export(&area_doc(vec![run("HOH OHO\nHO", style(12.0))], 200.0, Justify::Left), &ExportOptions::default())).len(); + let fewer = tspans(&export(&d, &ExportOptions { fewer_tspans: true, ..Default::default() })).len(); + assert!(fewer > plain, "each moved character is placed with fewer tspans too: {plain} {fewer}"); + let mut t = TextObject::point(Point::ZERO, "", style(12.0)); + t.runs = vec![run("HO", tight)]; + let mut line = BezPath::new(); + line.move_to((20.0, 100.0)); + line.line_to((280.0, 100.0)); + t.kind = TextKind::OnPath { path: PathData::from_bezpath(&line), start: 0.0, end: None }; + let mut d = Document::new(300.0, 200.0); + let n = Node::new(d.alloc_id(), NodeKind::Text(Box::new(t))); + let l = d.layers[0].id; + d.insert(Some(l), 0, n).unwrap(); + let out = vectorcraft_svg::export_full(&d, &ExportOptions::default(), None); + assert!(!out.svg.contains(" Tree<'a> { }) .collect() }; - let gradient = |kind, stops: Vec, geom| { - let mut paint = GradientPaint::new(Gradient { kind, stops, ..Gradient::default() }); + let gradient = |kind, stops: Vec, spread, geom| { + // COLR repeats the interval from the first stop to the last, and one run of the + // stops spans the gradient's vector. + let mut paint = GradientPaint::new(Gradient { kind, stops, spread, ..Gradient::default() }); paint.geom = Some(geom); Paint::Gradient(Box::new(paint)) }; @@ -290,22 +292,22 @@ impl<'a> Tree<'a> { Some((Paint::solid(c), a)) } Brush::LinearGradient { p0, p1, color_stops, extend } => { - if *extend != Extend::Pad { - self.unsupported.get_or_insert("a repeating or reflecting gradient"); + let spread = spread(*extend); + let (p0, p1) = (point(*p0), point(*p1)); + let stops = stops(color_stops, self); + // Without a stop, the others would repeat over a different interval. + if !spread.is_pad() && stops.len() < color_stops.len() { + self.unsupported.get_or_insert("a repeating or reflecting gradient with a stop missing from the palette"); return None; } - let (p0, p1) = (point(*p0), point(*p1)); - let (stops, first, last) = normalized(stops(color_stops, self))?; + let (stops, first, last) = normalized(stops)?; // Stops past 0 and 1 move the ends instead. let mut geom = GradientGeom { start: p0.lerp(p1, f64::from(first)), end: p0.lerp(p1, f64::from(last)), aspect: 1.0, focal: None }; geom.transform(xf, GradientKind::Linear); - Some((gradient(GradientKind::Linear, stops, geom), 1.0)) + Some((gradient(GradientKind::Linear, stops, spread, geom), 1.0)) } Brush::RadialGradient { c0, r0, c1, r1, color_stops, extend } => { - if *extend != Extend::Pad { - self.unsupported.get_or_insert("a repeating or reflecting gradient"); - return None; - } + let spread = spread(*extend); let (c0, c1, r0, r1) = (point(*c0), point(*c1), f64::from(*r0), f64::from(*r1)); let concentric = (c0 - c1).hypot() < 1e-6; if (r0 > 1e-6 && !concentric) || r1 <= r0 || (c0 - c1).hypot() >= r1 { @@ -317,13 +319,27 @@ impl<'a> Tree<'a> { self.unsupported.get_or_insert("a radial gradient with stops past its circles"); return None; } + if !spread.is_pad() { + if stops.len() < color_stops.len() { + self.unsupported.get_or_insert("a repeating or reflecting gradient with a stop missing from the palette"); + return None; + } + // A run of the stops is the whole way from the center to the circle: one that + // starts at a circle (a first stop past the center comes as one) repeats over + // less of it. The normalized ends can be a rounding error off 0 and 1. + let (lo, hi) = stops.iter().fold((f32::INFINITY, f32::NEG_INFINITY), |(lo, hi), s| (lo.min(s.offset), hi.max(s.offset))); + if r0.abs() > 1e-6 || lo.abs() > 1e-4 || (hi - 1.0).abs() > 1e-4 { + self.unsupported.get_or_insert("a repeating or reflecting radial gradient that doesn't start at its center"); + return None; + } + } // A start circle around the centre starts the stops further out. for s in &mut stops { s.offset = ((r0 + f64::from(s.offset) * (r1 - r0)) / r1) as f32; } let mut geom = GradientGeom { start: c1, end: c1 + Vec2::new(r1, 0.0), aspect: 1.0, focal: (!concentric).then_some(c0) }; geom.transform(xf, GradientKind::Radial); - Some((gradient(GradientKind::Radial, stops, geom), 1.0)) + Some((gradient(GradientKind::Radial, stops, spread, geom), 1.0)) } Brush::SweepGradient { .. } => { self.unsupported.get_or_insert("a sweep gradient"); @@ -345,6 +361,16 @@ impl<'a> Tree<'a> { } } +/// A COLR extend mode as the gradient's spread; an unknown one pads, as the COLR specification +/// says. +fn spread(extend: Extend) -> GradientSpread { + match extend { + Extend::Repeat => GradientSpread::Repeat, + Extend::Reflect => GradientSpread::Reflect, + _ => GradientSpread::Pad, + } +} + /// `stops` sorted, from 0 to 1 (as the gradient's ends then move), and where the first and last /// were; `None` without stops. fn normalized(mut stops: Vec) -> Option<(Vec, f32, f32)> { diff --git a/crates/text/src/fontdb/names.rs b/crates/text/src/fontdb/names.rs index 47faeeddae..8b778f7805 100644 --- a/crates/text/src/fontdb/names.rs +++ b/crates/text/src/fontdb/names.rs @@ -53,6 +53,7 @@ pub(super) fn script_families(c: char) -> &'static [&'static str] { "Lohit Devanagari", "Mangal", ], + Script::Gujarati => &["Gujarati Sangam MN", "GujaratiMT", "Nirmala UI", "Shruti", "Noto Sans Gujarati", "Noto Sans Gujarati UI"], _ => &[], } } @@ -164,6 +165,13 @@ mod tests { assert!(script_families('a').is_empty()); } + /// Gujarati takes a font that draws it (macOS Gujarati Sangam MN, Windows Nirmala UI or Shruti). + #[test] + fn gujarati_prefers_fonts_made_for_it() { + assert_eq!(script_families('ગ').first(), Some(&"Gujarati Sangam MN")); + assert!(script_families('ગ').contains(&"Nirmala UI")); + } + #[test] fn a_name_table_of_many_records_is_cut_short() { let many: Vec<(u16, &str)> = (0..2000).map(|_| (1, "Short")).collect(); diff --git a/crates/text/src/harakat.rs b/crates/text/src/harakat.rs index 4c75aa3dbc..0f8ce4facd 100644 --- a/crates/text/src/harakat.rs +++ b/crates/text/src/harakat.rs @@ -56,6 +56,7 @@ pub(crate) fn paint_only(a: &CharStyle, b: &CharStyle) -> bool { kerning_before: _, aki_left: _, aki_right: _, + tsume: _, optical_kerning, baseline_shift, h_scale, diff --git a/crates/text/src/hyphen.rs b/crates/text/src/hyphen.rs index e293346279..c940ed85a4 100644 --- a/crates/text/src/hyphen.rs +++ b/crates/text/src/hyphen.rs @@ -502,16 +502,16 @@ mod tests { } /// Process-wide store used by `prefs.set` / restore. Each change makes envelopes measure type - /// again. + /// again, and caches of layouts lay type out again. #[test] fn set_hyphenation_exceptions_round_trips_the_source_string() { - let inputs = crate::layout::envelope_ink_inputs(); + let inputs = crate::layout_inputs(); set_hyphenation_exceptions("typography, hap-pen"); assert_eq!(hyphenation_exceptions(), "typography, hap-pen"); - let changed = crate::layout::envelope_ink_inputs(); - assert_ne!(changed, inputs, "the envelope inputs change with the exceptions"); + let changed = crate::layout_inputs(); + assert_ne!(changed, inputs, "the layout inputs change with the exceptions"); set_hyphenation_exceptions(""); assert!(hyphenation_exceptions().is_empty()); - assert_ne!(crate::layout::envelope_ink_inputs(), changed, "and again when they are cleared"); + assert_ne!(crate::layout_inputs(), changed, "and again when they are cleared"); } } diff --git a/crates/text/src/layout.rs b/crates/text/src/layout.rs index 82a849a3dc..a7d7d1d3f3 100644 --- a/crates/text/src/layout.rs +++ b/crates/text/src/layout.rs @@ -46,9 +46,7 @@ pub(crate) use driver::{fit_passes, layout_faces_per_call}; pub(crate) use on_path::{layout_trying_each_start, path_arrangements}; use vertical::{TcyStyle, stands_upright, tate_chu_yoko, upright_cell, upright_centre, upright_extent, whole_character_widths}; -#[cfg(test)] -pub(crate) use driver::envelope_ink_inputs; -pub use driver::{envelope_ink, register_envelope_ink}; +pub use driver::{envelope_ink, layout_inputs, register_envelope_ink}; const EPS: f64 = 1e-6; diff --git a/crates/text/src/layout/driver.rs b/crates/text/src/layout/driver.rs index 9108cc171d..59c6ac38bf 100644 --- a/crates/text/src/layout/driver.rs +++ b/crates/text/src/layout/driver.rs @@ -191,12 +191,13 @@ pub fn envelope_ink(t: &TextObject, m: Affine, projection: Option<(vectorcraft_g /// Make envelopes map type from [`envelope_ink`], measured again when the fonts or the hyphenation /// exceptions change (the first registration stays, see `vectorcraft_doc::live::set_type_ink`). pub fn register_envelope_ink() { - vectorcraft_doc::live::set_type_ink(envelope_ink, envelope_ink_inputs); + vectorcraft_doc::live::set_type_ink(envelope_ink, layout_inputs); } -/// A number that changes whenever what [`envelope_ink`] reads besides the type changes: the -/// installed fonts and the hyphenation exceptions. -pub(crate) fn envelope_ink_inputs() -> u64 { +/// A number that changes when the fonts ([`FontDb::generation`]) or the hyphenation exceptions +/// (Preferences › Hyphenation › Exceptions) change. Caches of layouts made with the global font +/// database, and of art made from them, key on it. +pub fn layout_inputs() -> u64 { FontDb::global().generation().rotate_left(32) ^ crate::hyphen::exceptions_generation() } diff --git a/crates/text/src/layout/flow.rs b/crates/text/src/layout/flow.rs index 1ee9a3fe50..e7753c8c04 100644 --- a/crates/text/src/layout/flow.rs +++ b/crates/text/src/layout/flow.rs @@ -544,6 +544,9 @@ struct LineJustification { fit: LineFit, start_x: f64, after: Vec>, + /// The warichu glyphs drawn inside a block already started, by offset from the line's first + /// glyph ([`blocks_begun`]). + begun: Vec, kashidas: Vec<(usize, f64)>, /// Right-aligned area type: the line's last tab, which takes the text after it to the right /// edge (the text before it sits at its stops, from the left edge). @@ -805,14 +808,14 @@ fn visible_after(index: usize, glyph: usize, after: &[Option], sg: &[SGly next } -// The glyph after which a gap between drawn glyphs opens, and the visible glyph that follows it: -// not a held glyph, and never a zero-width format control on either side. -fn gap_pair<'a>(glyph: usize, held: &[usize], after: &[Option], index: usize, sg: &'a [SGlyph]) -> Option<(&'a SGlyph, &'a SGlyph)> { +// The glyph after which a gap between drawn glyphs opens, and the visible glyph that follows it +// with its index: not a held glyph, and never a zero-width format control on either side. +fn gap_pair<'a>(glyph: usize, held: &[usize], after: &[Option], index: usize, sg: &'a [SGlyph]) -> Option<(&'a SGlyph, &'a SGlyph, usize)> { if held.contains(&glyph) { return None; } let a = sg.get(glyph).filter(|a| !is_format_control(a.ch))?; - visible_after(index, glyph, after, sg).and_then(|next| sg.get(next)).map(|b| (a, b)) + visible_after(index, glyph, after, sg).and_then(|next| sg.get(next).map(|b| (a, b, next))) } // Are `a` and `b` glyphs of the same warichu block? Right to left, the bidi order can draw a @@ -821,18 +824,61 @@ fn same_warichu_block(a: &SGlyph, b: &SGlyph) -> bool { a.wari.zip(b.wari).is_some_and(|(first, second)| first.start == second.start) } +// Is glyph `next` drawn inside a block the line has already started: a tate-chu-yoko glyph after +// its block's first, or a warichu glyph drawn after another glyph of its block (`begun`, by offset +// from the line's first glyph, from [`blocks_begun`])? A warichu block starts at the first of its +// glyphs drawn on the line, which right to left is not the block's first glyph. +fn continues_drawn_block(next: usize, index: usize, begun: &[bool], sg: &[SGlyph]) -> bool { + let Some(b) = sg.get(next) else { return false }; + match (b.wari, next.checked_sub(index).and_then(|k| begun.get(k))) { + (Some(_), Some(&begun)) => begun, + _ => b.continues_block(), + } +} + +// The warichu glyphs of `line` drawn after another glyph of their block, by offset from the line's +// first glyph. A block the bidi order interleaves with another keeps its start. +fn blocks_begun(line: &LineGeometry, sg: &[SGlyph]) -> Vec { + let len = line.body.saturating_sub(line.index); + // Each glyph's block, as the offset of the block's first glyph: a block's glyphs are neighbors + // in `sg`, and a block stays on one line. + let mut first: Vec = Vec::with_capacity(len); + for k in 0..len { + let pair = k.checked_sub(1).and_then(|p| sg.get(line.index + p)).zip(sg.get(line.index + k)); + let block = match first.last() { + Some(&f) if pair.is_some_and(|(a, b)| same_warichu_block(a, b)) => f, + _ => k, + }; + first.push(block); + } + let mut started = vec![false; len]; + let mut begun = vec![false; len]; + for &j in &line.drawn { + let Some(k) = j.checked_sub(line.index).filter(|_| sg.get(j).is_some_and(|g| g.wari.is_some())) else { continue }; + let Some(&f) = first.get(k) else { continue }; + if let (Some(seen), Some(slot)) = (started.get(f).copied(), begun.get_mut(k)) { + *slot = seen; + } + if let Some(seen) = started.get_mut(f) { + *seen = true; + } + } + begun +} + // Japanese (and Chinese) lines are justified between their characters (JLREQ 3.8): the // gaps next to a CJK character, not inside a Latin word, a tate-chu-yoko or warichu block or a -// shaped cluster. -pub(super) fn is_cjk_gap(glyph: usize, held: &[usize], after: &[Option], index: usize, sg: &[SGlyph]) -> bool { - gap_pair(glyph, held, after, index, sg).is_some_and(|(a, b)| { +// shaped cluster. `begun` holds the warichu glyphs drawn inside a block already started +// ([`blocks_begun`]). +pub(super) fn is_cjk_gap(glyph: usize, held: &[usize], (after, begun): (&[Option], &[bool]), index: usize, sg: &[SGlyph]) -> bool { + gap_pair(glyph, held, after, index, sg).is_some_and(|(a, b, next)| { a.byte != b.byte && !a.is_space() && !b.is_space() - && !b.continues_block() && !same_warichu_block(a, b) && a.ch != '\t' && (is_cjk(a.ch) || is_cjk(b.ch)) + && !continues_drawn_block(next, index, begun, sg) }) && !in_pair(glyph, index, after, sg) } @@ -861,13 +907,20 @@ fn in_pair(glyph: usize, index: usize, after: &[Option], sg: &[SGlyph]) - // its drawn glyphs: not after a held glyph, nor inside a tate-chu-yoko block (one cell) or a // warichu block (set as one piece), a shaped cluster, whose glyphs (a letter and its combining marks, a conjunct and its matra) stay // together, or an inseparable pair. On a line that ends in a drawn hyphen, the gap before the -// hyphen counts too: it follows the line's last visible glyph. -pub(super) fn is_letter_gap(glyph: usize, held: &[usize], after: &[Option], index: usize, sg: &[SGlyph], hyphen: bool) -> bool { +// hyphen counts too: it follows the line's last visible glyph. `begun` is as for [`is_cjk_gap`]. +pub(super) fn is_letter_gap( + glyph: usize, + held: &[usize], + (after, begun): (&[Option], &[bool]), + index: usize, + sg: &[SGlyph], + hyphen: bool, +) -> bool { if held.contains(&glyph) || sg.get(glyph).is_none_or(|a| is_format_control(a.ch)) || in_pair(glyph, index, after, sg) { return false; } match gap_pair(glyph, held, after, index, sg) { - Some((a, b)) => a.byte != b.byte && !b.continues_block() && !same_warichu_block(a, b), + Some((a, b, next)) => a.byte != b.byte && !same_warichu_block(a, b) && !continues_drawn_block(next, index, begun, sg), None => hyphen, } } @@ -974,7 +1027,8 @@ fn justify_flow_line(cx: &Ctx<'_>, paragraph: &ParagraphData<'_, '_>, line: &Lin *slot = Some(b); } } - let cjk_gaps = (line.index..line.body).filter(|&j| free(j) && is_cjk_gap(j, held, &after, line.index, sg)).count(); + let begun = blocks_begun(line, sg); + let cjk_gaps = (line.index..line.body).filter(|&j| free(j) && is_cjk_gap(j, held, (&after, &begun), line.index, sg)).count(); // Single Word Justification: a justified line holding one word (no word space) is // spread between its letters (Full Justify) or aligned. A tab separates two words. let single_word = justify && fixed.is_empty() && spaces == 0 && cjk_gaps == 0; @@ -1013,7 +1067,7 @@ fn justify_flow_line(cx: &Ctx<'_>, paragraph: &ParagraphData<'_, '_>, line: &Lin let pushed_in = line.position.pushed_in && paragraph.regions.is_some() && cjk_gaps > 0 && width > room + EPS; if pushed_in { let ems: f64 = (line.index..line.body) - .filter(|&j| free(j) && is_cjk_gap(j, held, &after, line.index, sg) && may_squeeze(&sg[j])) + .filter(|&j| free(j) && is_cjk_gap(j, held, (&after, &begun), line.index, sg) && may_squeeze(&sg[j])) .map(|j| squeeze_em(&sg[j], cx.vertical)) .sum(); if ems > EPS { @@ -1044,7 +1098,7 @@ fn justify_flow_line(cx: &Ctx<'_>, paragraph: &ParagraphData<'_, '_>, line: &Lin let used: f64 = flex.iter().map(|f| fit.letter(f) + fit.glyph(f)).sum(); let rest = room - width - used; let hyphen = line.hyphen.is_some(); - let gaps = (line.index..line.body).filter(|&j| free(j) && is_letter_gap(j, held, &after, line.index, sg, hyphen)).count(); + let gaps = (line.index..line.body).filter(|&j| free(j) && is_letter_gap(j, held, (&after, &begun), line.index, sg, hyphen)).count(); if gaps > 0 && rest > EPS { per_gap = rest / gaps as f64; } @@ -1076,7 +1130,7 @@ fn justify_flow_line(cx: &Ctx<'_>, paragraph: &ParagraphData<'_, '_>, line: &Lin _ => line.ax1 + line.opt_r - width, } }; - LineJustification { per_space, per_gap, per_cjk, squeeze, fit, start_x, after, kashidas, last_tab, trailing, fixed } + LineJustification { per_space, per_gap, per_cjk, squeeze, fit, start_x, after, begun, kashidas, last_tab, trailing, fixed } } /// The advance and leader of tab `glyph_index` of `line`, drawn at `order_index` of @@ -1203,10 +1257,10 @@ fn emit_flow_line(cx: &mut Ctx<'_>, pen: &mut Pen<'_>, paragraph: &ParagraphData advance += justification.fit.letter(&flex) + justification.fit.glyph(&flex); scale = justification.fit.glyph_scale(&flex); if justification.per_cjk != 0.0 || justification.squeeze != 0.0 { - if is_cjk_gap(glyph_index, &line.held, &justification.after, index, sg) { + if is_cjk_gap(glyph_index, &line.held, (&justification.after, &justification.begun), index, sg) { advance += justification.per_cjk + squeeze_after(glyph, justification.squeeze, cx.vertical); } - } else if is_letter_gap(glyph_index, &line.held, &justification.after, index, sg, line.hyphen.is_some()) { + } else if is_letter_gap(glyph_index, &line.held, (&justification.after, &justification.begun), index, sg, line.hyphen.is_some()) { advance += justification.per_gap; } } diff --git a/crates/text/src/layout/region.rs b/crates/text/src/layout/region.rs index 34c48942d5..b8bad9a246 100644 --- a/crates/text/src/layout/region.rs +++ b/crates/text/src/layout/region.rs @@ -120,7 +120,8 @@ fn near_segment_in_band(a: Point, b: Point, top: f64, bottom: f64, r: f64) -> Op } /// [`band_intervals`] less every x at which some point of the band `top..bottom` is closer than -/// `inset` to an edge of `polys` (holes included), measured from the edge itself. +/// `inset` to an edge of `polys` (holes included), measured from the edge itself. A stretch of an +/// edge that contours meet along bounds no part of the shape, so the inset does not apply beside it. fn band_inset_intervals(polys: &[Vec], top: f64, bottom: f64, inset: f64) -> Vec<(f64, f64)> { let iv = band_intervals(polys, top, bottom); if inset <= 0.0 || iv.is_empty() { @@ -130,10 +131,68 @@ fn band_inset_intervals(polys: &[Vec], top: f64, bottom: f64, inset: f64) return vec![]; } let (top, bottom) = (top.min(bottom), top.max(bottom)); - let near = polys.iter().flat_map(|p| (0..p.len()).filter_map(move |i| near_segment_in_band(p[i], p[(i + 1) % p.len()], top, bottom, inset))); + let edges = boundary_segments(polys, |lo, hi| hi > top - inset && lo < bottom + inset); + let near = edges.into_iter().filter_map(|(a, b)| near_segment_in_band(a, b, top, bottom, inset)); subtract_intervals(&iv, &union_intervals(near.collect())) } +/// The stretches of the edges of `polys` that bound the shape (even-odd), among the edges whose y +/// range `lo..hi` `keep` accepts. Edges that lie exactly along one line and overlap there (contours +/// that meet along an edge, however each one divides it) count by parity, as in +/// [`slant_boundaries`]: a stretch that an even number of them cover has the shape on both sides +/// and is left out. Edges of no length are left out. At most [`MAX_EDGE_PAIRS`] pairs are compared; +/// edges left unpaired count whole. +fn boundary_segments(polys: &[Vec], keep: impl Fn(f64, f64) -> bool) -> Vec<(Point, Point)> { + fn root(parent: &mut [usize], mut i: usize) -> usize { + while parent[i] != i { + parent[i] = parent[parent[i]]; + i = parent[i]; + } + i + } + let mut edges: Vec<(Point, Point)> = polys + .iter() + .flat_map(|p| (0..p.len()).map(move |i| (p[i], p[(i + 1) % p.len()]))) + .filter(|&(a, b)| a != b && keep(a.y.min(b.y), a.y.max(b.y))) + .collect(); + // Edges along one line overlap in x, so only edges whose x ranges overlap are compared. + edges.sort_by(|u, v| u.0.x.min(u.1.x).total_cmp(&v.0.x.min(v.1.x))); + let mut parent: Vec = (0..edges.len()).collect(); + let mut pairs = 0; + 'edges: for (i, &(p, q)) in edges.iter().enumerate() { + // The x ranges of edges along one line can differ by rounding, as in `slant_boundaries`. + let scale = p.x.abs().max(p.y.abs()).max(q.x.abs()).max(q.y.abs()).max(1.0); + let x1 = p.x.max(q.x) + 4.0 * f64::EPSILON * scale; + for (j, &(r, s)) in edges.iter().enumerate().skip(i + 1).take_while(|(_, o)| o.0.x.min(o.1.x) <= x1) { + pairs += 1; + if pairs > MAX_EDGE_PAIRS { + break 'edges; + } + if on_line_exactly(p, q, r) && on_line_exactly(p, q, s) { + let (a, b) = (root(&mut parent, i), root(&mut parent, j)); + parent[a] = b; + } + } + } + let mut groups: Vec<(usize, usize)> = (0..edges.len()).map(|i| (root(&mut parent, i), i)).collect(); + groups.sort_unstable(); + let mut out = Vec::new(); + for run in groups.chunk_by(|a, b| a.0 == b.0) { + if let [(_, i)] = run { + out.push(edges[*i]); + continue; + } + // The stretches an odd number of the edges cover: pairs of their ends, sorted along the + // line by whichever coordinate changes more along it. + let (p, q) = edges[run[0].1]; + let by_x = (q.x - p.x).abs() >= (q.y - p.y).abs(); + let mut ends: Vec = run.iter().flat_map(|&(_, i)| [edges[i].0, edges[i].1]).collect(); + ends.sort_by(|a, b| if by_x { a.x.total_cmp(&b.x) } else { a.y.total_cmp(&b.y) }); + out.extend(ends.as_chunks::<2>().0.iter().filter(|c| c[0] != c[1]).map(|c| (c[0], c[1]))); + } + out +} + /// Union of sorted-or-not intervals. fn union_intervals(mut v: Vec<(f64, f64)>) -> Vec<(f64, f64)> { v.sort_by(|a, b| a.0.total_cmp(&b.0)); @@ -500,6 +559,9 @@ fn eroded_cover(polys: &[Vec], top: f64, bottom: f64, d: f64) -> Vec<(f64 cuts.dedup(); } } + // A stretch of an edge that contours meet along bounds no part of the shape, so the shape is + // not shrunk beside it. + let edges = boundary_segments(polys, |lo, hi| hi > top - r && lo < bottom + r); let mut out = Vec::new(); // A band of no height keeps its two equal cuts: one piece of no height, measured at its y. for w in cuts.windows(2) { @@ -510,13 +572,10 @@ fn eroded_cover(polys: &[Vec], top: f64, bottom: f64, d: f64) -> Vec<(f64 } // The points closer than `d` to an edge make a convex shape, so a vertical line within // the piece lies in it when both its ends do. - let near = polys.iter().flat_map(|p| { - (0..p.len()).filter_map(move |i| { - let (s, t) = (p[i], p[(i + 1) % p.len()]); - let (u, v) = (near_segment(s, t, a, r)?, near_segment(s, t, b, r)?); - let (x, y) = (u.0.max(v.0), u.1.min(v.1)); - (y > x).then_some((x, y)) - }) + let near = edges.iter().filter_map(|&(s, t)| { + let (u, v) = (near_segment(s, t, a, r)?, near_segment(s, t, b, r)?); + let (x, y) = (u.0.max(v.0), u.1.min(v.1)); + (y > x).then_some((x, y)) }); out.extend(subtract_intervals(&cover, &union_intervals(near.collect()))); } @@ -1090,6 +1149,36 @@ fn inset_keeps_text_clear_of_a_hole_s_sloped_edges() { assert_spans(&spans[0], &[(5.0, 36.0 - clear), (64.0 + clear, 95.0)]); } +/// The inset is not kept beside an edge two contours share, vertical, horizontal or slanted with an +/// extra anchor on one side, and is still kept beside the part of an edge only one contour covers. +#[cfg(test)] +#[test] +fn inset_is_not_kept_beside_an_edge_two_contours_share() { + let opts = LayoutOptions { inset: 5.0, ..LayoutOptions::default() }; + let side = closed(&[&[(0.0, 0.0), (50.0, 0.0), (50.0, 100.0), (0.0, 100.0)], &[(50.0, 0.0), (100.0, 0.0), (100.0, 100.0), (50.0, 100.0)]]); + assert_spans(&cell_spans(&side, &opts, &[], 40.0, 44.0)[0], &[(5.0, 95.0)]); + let seam = closed(&[&[(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)], &[(0.0, 50.0), (100.0, 50.0), (100.0, 100.0), (0.0, 100.0)]]); + assert_spans(&cell_spans(&seam, &opts, &[], 46.0, 54.0)[0], &[(5.0, 95.0)]); + let slanted = + closed(&[&[(0.0, 0.0), (40.0, 0.0), (50.0, 50.0), (60.0, 100.0), (0.0, 100.0)], &[(40.0, 0.0), (100.0, 0.0), (100.0, 100.0), (60.0, 100.0)]]); + assert_spans(&cell_spans(&slanted, &opts, &[], 40.0, 44.0)[0], &[(5.0, 95.0)]); + // The lower contour covers only the left half of the upper one's bottom edge: the right half + // and the corner where they meet still keep the inset. + let step = closed(&[&[(0.0, 0.0), (100.0, 0.0), (100.0, 50.0), (0.0, 50.0)], &[(0.0, 50.0), (50.0, 50.0), (50.0, 100.0), (0.0, 100.0)]]); + assert_spans(&cell_spans(&step, &opts, &[], 46.0, 48.0)[0], &[(5.0, 50.0 - 21f64.sqrt())]); +} + +/// A negative wrap offset does not shrink a wrap object beside an edge two of its contours share, +/// with or without Invert Wrap. +#[cfg(test)] +#[test] +fn negative_wrap_offset_does_not_shrink_beside_an_edge_two_contours_share() { + let left: &[(f64, f64)] = &[(40.0, 40.0), (50.0, 40.0), (50.0, 60.0), (40.0, 60.0)]; + let right: &[(f64, f64)] = &[(50.0, 40.0), (60.0, 40.0), (60.0, 60.0), (50.0, 60.0)]; + assert_spans(&wrap_spans(&[left, right], -5.0, false, 44.0, 50.0), &[(0.0, 45.0), (55.0, 100.0)]); + assert_spans(&wrap_spans(&[left, right], -5.0, true, 46.0, 54.0), &[(45.0, 55.0)]); +} + /// In a frame of columns, the inset is kept once from a column's inner edge and once from the /// frame's sloped edge. #[cfg(test)] diff --git a/crates/text/src/layout/shaped.rs b/crates/text/src/layout/shaped.rs index 72f6ed8733..63005364fb 100644 --- a/crates/text/src/layout/shaped.rs +++ b/crates/text/src/layout/shaped.rs @@ -5,6 +5,11 @@ //! line. Each line the composer tries is placed from where the lines above it left the pen, at its //! own tallest metrics, as the line loop in [`super::flow`] places a composed line: the span it //! gets is the room across its whole height. +//! +//! A paragraph the frame cannot hold is still composed whole: a line the frame has no room for, +//! and every line after it, is measured as wide as the span of the last line set in the frame, +//! less its own indents. The line loop sets only the lines that fit, and the rest overflows or +//! goes on in the next threaded frame, which composes it again at its own measures. use std::cell::Cell; use std::collections::HashMap; @@ -63,19 +68,33 @@ struct Start<'r> { /// The paragraph's first line (it takes the first-line indent). first: bool, pen: Pen<'r>, - /// The line placed at each of the metrics it was tried with: its width and the pen after it, - /// or `None` when the frame has no room for it. - placed: Vec<(Metrics, Option<(f64, Pen<'r>)>)>, + /// The width of the span the line above was set in, `None` for the paragraph's first line. + span: Option, + /// The line above was past the frame's end: this line is too, at the width of `span`. + past: bool, + /// The line placed at each of the metrics it was tried with, or `None` when it can't be set. + placed: Vec<(Metrics, Option>)>, /// The metrics of glyphs `pos..to`, measured so far. to: usize, m: Option, } -/// What a line's placement depends on: its first glyph, whether it is the paragraph's first line, -/// and the pen's cell, baselines, pending space, narrowest word without room and further spans. -type Key = (usize, bool, usize, Option, Option, u64, u64, Vec<[u64; 3]>); +/// A line set from a [`Start`]: its width, the pen after it, the width of the span it was set +/// in, and whether it is past the frame's end (measured, but not in the frame). +#[derive(Clone)] +struct Placed<'r> { + width: f64, + pen: Pen<'r>, + span: f64, + past: bool, +} -fn key(pos: usize, first: bool, pen: &Pen<'_>) -> Key { +/// What a line's placement depends on: its first glyph, whether it is the paragraph's first line, +/// the pen's cell, baselines, pending space, narrowest word without room and further spans, the +/// span of the line above and whether the line is past the frame's end. +type Key = (usize, bool, usize, Option, Option, u64, u64, Vec<[u64; 3]>, Option, bool); + +fn key(pos: usize, first: bool, pen: &Pen<'_>, span: Option, past: bool) -> Key { ( pos, first, @@ -85,6 +104,8 @@ fn key(pos: usize, first: bool, pen: &Pen<'_>) -> Key { pen.pending.to_bits(), pen.no_room_for.to_bits(), pen.queued.iter().map(|&(b, x0, x1)| [b.to_bits(), x0.to_bits(), x1.to_bits()]).collect(), + span.map(f64::to_bits), + past, ) } @@ -159,13 +180,14 @@ impl<'a, 'r> Shaped<'a, 'r> { } } - /// The start of a line at glyph `pos` with `pen`: an existing one when its placement is the same. - fn start(&mut self, pos: usize, first: bool, pen: Pen<'r>) -> usize { - let k = key(pos, first, &pen); + /// The start of a line at glyph `pos` with `pen`, after a line set in a span `span` wide (past + /// the frame's end with `past`): an existing one when its placement is the same. + fn start(&mut self, pos: usize, first: bool, pen: Pen<'r>, span: Option, past: bool) -> usize { + let k = key(pos, first, &pen, span, past); if let Some(&id) = self.known.get(&k) { return id; } - self.starts.push(Start { pos, first, pen, placed: vec![], to: pos, m: None }); + self.starts.push(Start { pos, first, pen, span, past, placed: vec![], to: pos, m: None }); let id = self.starts.len() - 1; self.known.insert(k, id); id @@ -177,7 +199,7 @@ impl Measure for Shaped<'_, '_> { fn first(&mut self) -> usize { let pen = self.pen.clone(); - self.start(0, !self.continued, pen) + self.start(0, !self.continued, pen, None, false) } fn line(&mut self, &id: &usize, pos: usize, end: usize) -> Result, Exhausted> { @@ -186,14 +208,14 @@ impl Measure for Shaped<'_, '_> { } self.probes += 1; let Some(start) = self.starts.get_mut(id) else { return Ok(None) }; - let Some((width, pen)) = line(&self.para, start, pos, end)? else { return Ok(None) }; - Ok(Some((width, self.start(end, false, pen)))) + let Some(placed) = line(&self.para, start, pos, end)? else { return Ok(None) }; + Ok(Some((placed.width, self.start(end, false, placed.pen, Some(placed.span), placed.past)))) } /// A longer line is placed as this one is, and gets the same room, unless a glyph after it - /// changes the line's tallest metrics. + /// changes the line's tallest metrics. Past the frame's end every line is as wide. fn may_widen(&mut self, &id: &usize, pos: usize, end: usize) -> bool { - let Some(start) = self.starts.get(id) else { return false }; + let Some(start) = self.starts.get(id).filter(|start| !start.past) else { return false }; let m = if start.pos == pos && start.to == end { start.m } else { self.para.sg.get(pos..end).and_then(Metrics::max) }; match (m, self.rest.get(end).copied().flatten()) { (Some(m), Some(rest)) => m.union(rest) != m, @@ -212,12 +234,14 @@ impl Drop for Shaped<'_, '_> { } } -/// The width of the line of glyphs `pos..end` from `start`, and the pen after it; `None` when -/// the frame has no room for it. -fn line<'r>(p: &Para<'_>, start: &mut Start<'r>, pos: usize, end: usize) -> Result)>, Exhausted> { +/// The line of glyphs `pos..end` from `start`; `None` when it can't be set. +fn line<'r>(p: &Para<'_>, start: &mut Start<'r>, pos: usize, end: usize) -> Result>, Exhausted> { if start.pos != pos || end <= pos { return Ok(None); } + if start.past { + return Ok(past_end(p, start)); + } // The line's tallest metrics, measured on from the glyphs already measured. if end < start.to { start.m = p.sg.get(pos..end).and_then(Metrics::max); @@ -239,9 +263,18 @@ fn line<'r>(p: &Para<'_>, start: &mut Start<'r>, pos: usize, end: usize) -> Resu Ok(placed) } -/// The line from `start` placed with metrics `m`: its width and the pen after it, as the line loop -/// places and settles it; `None` when no frame cell has room for it. -fn place<'r>(p: &Para<'_>, start: &Start<'r>, m: Metrics) -> Result)>, Exhausted> { +/// A line from `start` past the frame's end: as wide as the span of the last line set in the frame, +/// less its indents, and the pen left where the frame ran out. `None` when the paragraph has no line +/// in the frame to measure it by. +fn past_end<'r>(p: &Para<'_>, start: &Start<'r>) -> Option> { + let span = start.span.filter(|span| span.is_finite())?; + let (ind_l, ind_r) = line_indents(p.para, start.first, p.mirror); + Some(Placed { width: span - ind_l - ind_r, pen: start.pen.clone(), span, past: true }) +} + +/// The line from `start` placed with metrics `m`, as the line loop places and settles it; past the +/// frame's end ([`past_end`]) when no frame cell has room for it. +fn place<'r>(p: &Para<'_>, start: &Start<'r>, m: Metrics) -> Result>, Exhausted> { let (ind_l, ind_r) = line_indents(p.para, start.first, p.mirror); let word = word_width(p.sg, start.pos, p.line_end, p.para.kinsoku) - (p.start_credit)(start.pos); let mut pen = start.pen.clone(); @@ -262,12 +295,12 @@ fn place<'r>(p: &Para<'_>, start: &Start<'r>, m: Metrics) -> Result return Ok(None), // Out of steps: the frame may still have room further down. None if p.steps.get() == 0 => return Err(Exhausted), - None => return Ok(None), + None => return Ok(past_end(p, start)), } } } diff --git a/crates/text/src/layout/wrapping_tests.rs b/crates/text/src/layout/wrapping_tests.rs index eae22bab8a..3a83a5673b 100644 --- a/crates/text/src/layout/wrapping_tests.rs +++ b/crates/text/src/layout/wrapping_tests.rs @@ -1173,11 +1173,14 @@ fn justification_adds_no_gap_inside_a_warichu_block_drawn_right_to_left() { let mut glyphs = synthetic_glyphs(&[(0, 2, 10.0, first), (2, 2, 0.0, second)]); block(&mut glyphs[0], 0, 0.0); block(&mut glyphs[1], 0, 10.0); - assert!(!flow::is_letter_gap(1, &[], &after, 0, &glyphs, false), "{first}{second}"); - assert!(!flow::is_cjk_gap(1, &[], &after, 0, &glyphs), "{first}{second}"); + // Glyph 0 is drawn after glyph 1 of its block. + let begun = [true, false]; + assert!(!flow::is_letter_gap(1, &[], (&after, &begun), 0, &glyphs, false), "{first}{second}"); + assert!(!flow::is_cjk_gap(1, &[], (&after, &begun), 0, &glyphs), "{first}{second}"); // The same two glyphs as the first glyphs of two blocks. block(&mut glyphs[1], 2, 0.0); - assert!(flow::is_letter_gap(1, &[], &after, 0, &glyphs, false), "{first}{second}"); - assert_eq!(flow::is_cjk_gap(1, &[], &after, 0, &glyphs), first == '漢', "{first}{second}"); + let begun = [false, false]; + assert!(flow::is_letter_gap(1, &[], (&after, &begun), 0, &glyphs, false), "{first}{second}"); + assert_eq!(flow::is_cjk_gap(1, &[], (&after, &begun), 0, &glyphs), first == '漢', "{first}{second}"); } } diff --git a/crates/text/src/lib.rs b/crates/text/src/lib.rs index 2ff6b9ad5b..362a1c2408 100644 --- a/crates/text/src/lib.rs +++ b/crates/text/src/lib.rs @@ -47,7 +47,7 @@ pub use fontdb::{ user_font_dirs, }; pub use hyphen::{hyphenation_exceptions, set_hyphenation_exceptions}; -pub use layout::{envelope_ink, register_envelope_ink}; +pub use layout::{envelope_ink, layout_inputs, register_envelope_ink}; use std::sync::Arc; pub use svg_glyph::{SvgGlyphReader, set_svg_glyph_reader}; @@ -556,25 +556,32 @@ fn cluster_extent(layout: &TextLayout, glyphs: &[PositionedGlyph], i: usize) -> /// Caret for byte offset `byte`, as a (top, bottom) segment in text space. In horizontal type, a /// cluster drawn with several glyphs is measured whole ([`cluster_extent`]). Inside a ligature the -/// caret stands at its caret stops ([`PositionedGlyph::carets`]). +/// caret stands at its caret stops ([`PositionedGlyph::carets`]). Next to a character of a warichu +/// block the caret spans the band of its block line, as its highlight does. pub fn caret_position(layout: &TextLayout, byte: usize) -> (Point, Point) { let Some(line) = layout.lines.get(layout.line_of(byte)) else { return (Point::ZERO, Point::ZERO); }; let glyphs = &layout.glyphs[line.glyph_start..line.glyph_end]; - let (pos, angle) = if let Some(i) = glyphs.iter().position(|g| g.byte <= byte && g.byte + g.len > byte) { + let (pos, angle, glyph) = if let Some(i) = glyphs.iter().position(|g| g.byte <= byte && g.byte + g.len > byte) { let g = &glyphs[i]; let (origin, advance) = match cluster_extent(layout, glyphs, i) { Some((left, right)) => (Point::new(left, g.origin.y), right - left), None => (g.origin, g.advance), }; let off = g.caret_offset(byte, advance); - (origin + dir(g.angle) * if g.rtl { advance - off } else { off }, g.angle) + (origin + dir(g.angle) * if g.rtl { advance - off } else { off }, g.angle, Some(g)) } else if let Some(g) = glyphs.iter().max_by_key(|g| g.byte + g.len) { - (g.origin + dir(g.angle) * if g.rtl { 0.0 } else { g.advance }, g.angle) + (g.origin + dir(g.angle) * if g.rtl { 0.0 } else { g.advance }, g.angle, Some(g)) } else { - (layout.physical_point(Point::new(line.x0, line.baseline)), if layout.vertical { std::f64::consts::FRAC_PI_2 } else { 0.0 }) + (layout.physical_point(Point::new(line.x0, line.baseline)), if layout.vertical { std::f64::consts::FRAC_PI_2 } else { 0.0 }, None) }; + if let Some((_, top, bottom)) = + glyph.filter(|g| g.warichu.is_some() && !layout.on_path).and_then(|g| block_band(&warichu_rows(layout, line), line, g)) + { + let x = layout.logical_point(pos).x; + return (layout.physical_point(Point::new(x, top)), layout.physical_point(Point::new(x, bottom))); + } // Up vector in y-down space, rotated with the baseline. let d = dir(angle); let up = Vec2::new(d.y, -d.x); @@ -786,6 +793,20 @@ fn warichu_rows(layout: &TextLayout, l: &LineInfo) -> Vec<(usize, f64, f64)> { rows } +/// The band across line `l` (text space, from the top) of the block line that warichu glyph `g` is +/// on, with that block line's index in its block: out to halfway to the block lines next to it, +/// and to the line's top or bottom past the block's outer lines. `rows` are the line's +/// [`warichu_rows`]. None for a glyph of no block. +fn block_band(rows: &[(usize, f64, f64)], l: &LineInfo, g: &PositionedGlyph) -> Option<(usize, f64, f64)> { + let block = g.warichu?; + let lines = rows.get(rows.partition_point(|r| r.0 < block)..rows.partition_point(|r| r.0 <= block)).unwrap_or_default(); + let row = lines.partition_point(|r| r.1 < g.warichu_line - 1e-9); + let own = lines.get(row).filter(|r| (r.1 - g.warichu_line).abs() < 1e-9)?; + let top = row.checked_sub(1).and_then(|k| lines.get(k)).map_or(l.baseline - l.ascent, |above| (above.2 + own.2) * 0.5); + let bottom = lines.get(row + 1).map_or(l.baseline + l.descent, |below| (below.2 + own.2) * 0.5); + Some((row, top, bottom)) +} + /// A glyph of a warichu block line, for [`selection_quads`]: its block and block line, its extent /// along the line and its band across it (text space), and whether the selection covers it. struct BlockPiece { @@ -829,11 +850,7 @@ pub fn selection_quads(layout: &TextLayout, a: usize, b: usize) -> Vec<[Point; 4 let mut pieces: Vec = Vec::new(); for (i, g) in layout.glyphs.iter().enumerate().take(l.glyph_end).skip(l.glyph_start) { let Some(block) = g.warichu else { continue }; - let lines = rows.get(rows.partition_point(|r| r.0 < block)..rows.partition_point(|r| r.0 <= block)).unwrap_or_default(); - let row = lines.partition_point(|r| r.1 < g.warichu_line - 1e-9); - let Some(own) = lines.get(row).filter(|r| (r.1 - g.warichu_line).abs() < 1e-9) else { continue }; - let top = row.checked_sub(1).and_then(|k| lines.get(k)).map_or(l.baseline - l.ascent, |above| (above.2 + own.2) * 0.5); - let bottom = lines.get(row + 1).map_or(l.baseline + l.descent, |below| (below.2 + own.2) * 0.5); + let Some((row, top, bottom)) = block_band(&rows, l, g) else { continue }; let x = layout.logical_point(g.origin).x; let selected = selected(i, g); let (f0, f1) = if selected { covered(g) } else { (0.0, g.advance) }; diff --git a/crates/text/src/shape.rs b/crates/text/src/shape.rs index ff79ce9a4c..befcbed41f 100644 --- a/crates/text/src/shape.rs +++ b/crates/text/src/shape.rs @@ -13,7 +13,7 @@ use kurbo::Shape; use skrifa::MetadataProvider; use skrifa::charmap::Charmap; use skrifa::instance::Size; -use vectorcraft_doc::text::{INLINE_CHAR, MAX_AKI}; +use vectorcraft_doc::text::{INLINE_CHAR, MAX_AKI, MAX_TSUME}; use vectorcraft_doc::{CharStyle, Digits, InlineArt}; use crate::features::{OtFeatures, ligatures_suppressed_by}; @@ -969,9 +969,9 @@ fn source_run_at(runs: &[(Range, &CharStyle)], span: &Range, byte: /// Can one glyph draw characters in styles `a` and `b`? OpenType features already apply to their /// own character ranges during shaping, so feature-only differences do not split a cluster. /// Horizontal type does not read Standard Vertical Roman Alignment or the tate-chu-yoko offsets. -/// The space before a line's first character ([`space_before`]) and Insert Aki ([`aki`]) come -/// from the cluster's first character, so they do not split a ligature or a letter from its marks -/// either. Warichu Settings count only on characters marked Warichu ([`warichu_alike`]). +/// The space before a line's first character ([`space_before`]), Insert Aki ([`aki`]) and Tsume +/// ([`tighten`]) come from the cluster's first character, so they do not split a ligature or a +/// letter from its marks either. Warichu Settings count only on characters marked Warichu ([`warichu_alike`]). fn drawn_alike(a: &CharStyle, b: &CharStyle, vertical: bool) -> bool { // Exhaustive, like `shapes_alike`: compare borrowed fields without copying feature lists. let CharStyle { @@ -986,6 +986,7 @@ fn drawn_alike(a: &CharStyle, b: &CharStyle, vertical: bool) -> bool { kerning_before, aki_left, aki_right, + tsume, optical_kerning, baseline_shift, h_scale, @@ -1034,6 +1035,7 @@ fn drawn_alike(a: &CharStyle, b: &CharStyle, vertical: bool) -> bool { kerning_before == &a.kerning_before && aki_left == &a.aki_left && aki_right == &a.aki_right + && tsume == &a.tsume && offsets == other_offsets && font_family == &b.font_family && font_style == &b.font_style @@ -1094,7 +1096,7 @@ pub(crate) fn warichu_alike(a: &CharStyle, b: &CharStyle) -> bool { /// character style's name, leading, baseline shift, rotation, Character Alignment, Character /// Direction (text is shaped apart where its bidi level changes), Kashidas, the kerning (each glyph takes its /// run's, see [`shape_segment`]), the space before a line's first character ([`space_before`]), -/// Insert Aki ([`aki`]), the OpenType features (each run's apply to its own characters, as features +/// Insert Aki ([`aki`]), Tsume ([`tighten`]), the OpenType features (each run's apply to its own characters, as features /// over a range of the one buffer) and the tracking, as long as the tracking keeps or drops /// standard ligatures alike ([`crate::features::ligatures_suppressed_by`]). fn shapes_alike(a: &CharStyle, b: &CharStyle) -> bool { @@ -1111,6 +1113,7 @@ fn shapes_alike(a: &CharStyle, b: &CharStyle) -> bool { kerning_before: _, aki_left: _, aki_right: _, + tsume: _, optical_kerning: _, baseline_shift: _, h_scale, @@ -1332,6 +1335,9 @@ struct Shaped { /// from their letters and the character-level pass matches ([`crate::harakat`]); empty /// otherwise (glyphs keep their shaping-cluster start). chars: Vec, + /// Each glyph's x advance without the font's pair kerning, the width Tsume measures, when + /// horizontal type with Tsume sets the same glyphs without it; empty otherwise. + unkerned: Vec, } /// The features that turn the whole-text features `base` into `own` over the clusters `range`, put @@ -1443,6 +1449,8 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe } ranged }; + // Horizontal type with Tsume on any of the segment's characters. + let tsume_here = !feats.vertical && runs.get(source_runs.clone()).unwrap_or_default().iter().any(|(_, s)| s.tsume > 0.0); // Shape the segment as if all of it were in `st`, with the features `more` on top. let shape_in = |st: &CharStyle, more: &[Feature]| { // A BCP 47 tag is short ASCII; anything else (a file may hold anything) is shaped without one. @@ -1452,7 +1460,7 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe .filter(|l| l.len() <= 35 && l.bytes().all(|b| b.is_ascii_alphanumeric() || b == b'-')) .and_then(|l| l.parse::().ok()); let mut shaped = Shaped::default(); - let Shaped { raw, proportional, vpal, chars } = &mut shaped; + let Shaped { raw, proportional, vpal, chars, unkerned } = &mut shaped; let hb_shaped = face.hb().map(|hb| { let shaper = face.shaper.shaper(&hb).instance(face.instance.as_ref()).build(); // The baseline and character-level pass use exactly the same resolved features. @@ -1531,6 +1539,16 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe *proportional = full.iter().zip(raw).map(|(a, b)| a.2 != b.2).collect(); } } + if tsume_here { + // Tsume measures each glyph on its own width: the same glyphs set without the + // font's pair kerning (`kern` and `apkn`) give it. + let mut bare = along_features.clone(); + bare.extend([b"kern", b"apkn"].map(|t| Feature::new(Tag::new(t), 0, range.start..=range.end))); + let bare = shape(&bare, along); + if same_glyphs(&bare) { + *unkerned = bare.iter().map(|g| g.2).collect(); + } + } if feats.proportional_vertical(st) { // `vpal` adjusts heights, which only top-to-bottom shaping applies: the same glyphs set // top to bottom with it (and the vertical kerning that goes with it, `vkrn` and `vapk`) @@ -1577,7 +1595,7 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe shaped }; let first_optical = if optical(range.start) { Some(range.start) } else { boundaries().find(|&b| optical(b)) }; - let Shaped { raw, proportional, vpal, chars } = if let Some(first) = first_optical.filter(|_| !feats.vertical) { + let Shaped { raw, proportional, vpal, chars, unkerned } = if let Some(first) = first_optical.filter(|_| !feats.vertical) { // The pair entering Optical keeps the left character's font kerning. Subsequent // Optical pairs use outline spacing, so font pair features stop at its second character. let optical_off = if first == range.start { @@ -1711,11 +1729,16 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe let last_in_cluster = gi + 1 == n || raw[gi + 1].1 as usize != cl; let ch = first_char(cl); let mut adv = xa as f64 * k * hs; + // The glyph's own width, without the font's pair kerning and before the tracking, manual + // kerning and Insert Aki after it: what Tsume measures. + let mut own = unkerned.get(gi).map_or(adv, |&u| f64::from(u) * k * hs); // The chosen glyph takes its own advance. let chosen = chosen_at(gi); let gid = match chosen { Some(c) => { - adv += (face.advance(c.gid) - face.advance(gid)) * k * hs; + let wider = (face.advance(c.gid) - face.advance(gid)) * k * hs; + adv += wider; + own += wider; c.gid } None => gid, @@ -1723,7 +1746,8 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe let mut kern_shift = 0.0; let mut tracked = 0.0; let (mut aki_shift, mut aki_in_adv) = (0.0, 0.0); - if ch == SOFT_HYPHEN || ch == '\u{2028}' { + let invisible = ch == SOFT_HYPHEN || ch == '\u{2028}'; + if invisible { adv = 0.0; } else { let manual_kern = gst.kerning.map(|v| v / 1000.0 * spacing_em).unwrap_or(0.0); @@ -1785,9 +1809,61 @@ fn shape_segment(text: &str, context: &Range, seg: &Segment, feats: &OtFe cursive, hyphen_language: crate::hyphen::Language::from_tag(gst.language.as_deref()), }); + // Tsume takes its share of the blank space beside the cluster's ink once the cluster is + // complete, in horizontal type. + if last_in_cluster && !invisible && !feats.vertical && gst.tsume > 0.0 { + let first = out.iter().rposition(|g| g.byte != cl).map_or(0, |i| i + 1); + tighten(out.get_mut(first..).unwrap_or_default(), own, gst.tsume); + } } } +/// Tsume ([`CharStyle::tsume`]) on one cluster: `glyphs` are its glyphs in the order they are +/// drawn along the line, the last one with `own` as its width before the tracking, kerning and +/// Insert Aki its advance holds. `tsume` percent of the blank space between the cluster's own width +/// and its ink, on each side, comes out of the cluster's advance, and its glyphs are drawn the +/// left side's share earlier. A cluster without ink, such as a space, or with a width that is not +/// positive, keeps its place and width. +fn tighten(glyphs: &mut [SGlyph], own: f64, tsume: f64) { + let Some(last) = glyphs.len().checked_sub(1) else { return }; + let share = if tsume.is_nan() { 0.0 } else { tsume.clamp(0.0, MAX_TSUME) / 100.0 }; + let (mut pen, mut ink): (f64, Option<(f64, f64)>) = (0.0, None); + for (i, g) in glyphs.iter().enumerate() { + if let Some((a, b)) = ink_across(&g.face, g.gid) { + let (a, b) = (pen + g.dx + a * g.sx, pen + g.dx + b * g.sx); + let (lo, hi) = (a.min(b), a.max(b)); + ink = Some(ink.map_or((lo, hi), |(l, h)| (l.min(lo), h.max(hi)))); + } + pen += if i == last { own } else { g.adv }; + } + let Some((lo, hi)) = ink.filter(|(lo, hi)| lo.is_finite() && hi.is_finite()) else { return }; + if !(pen.is_finite() && pen > 0.0) { + return; + } + let left = lo.clamp(0.0, pen) * share; + let right = (pen - hi).clamp(0.0, pen) * share; + for g in glyphs.iter_mut() { + g.dx -= left; + } + if let Some(g) = glyphs.get_mut(last) { + g.adv -= left + right; + } +} + +/// The left and right edges of glyph `gid`'s outline in `face`, in font units; `None` for a glyph +/// without an outline (a space, or a bitmap or color glyph without one). +fn ink_across(face: &FontFace, gid: u32) -> Option<(f64, f64)> { + let font = face.skrifa()?; + let glyph = font.outline_glyphs().get(skrifa::GlyphId::new(gid))?; + let mut pen = crate::fontdb::FlipPen(kurbo::BezPath::new()); + glyph.draw(skrifa::outline::DrawSettings::unhinted(Size::unscaled(), face.location()), &mut pen).ok()?; + if pen.0.elements().is_empty() { + return None; + } + let b = pen.0.bounding_box(); + Some((b.x0, b.x1)) +} + #[cfg(test)] mod optical_tests { use super::*; diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index e7e4f33ff6..423984a630 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -30,6 +30,7 @@ mod shape_plans; mod snap; mod svg_glyphs; mod sysfonts; +mod tsume; mod typo; mod variable; mod versions; diff --git a/crates/text/src/tests/colr.rs b/crates/text/src/tests/colr.rs index 212882ce7a..c3a0499af6 100644 --- a/crates/text/src/tests/colr.rs +++ b/crates/text/src/tests/colr.rs @@ -326,12 +326,8 @@ fn paints_documents_lack_make_the_glyph_an_image() { let line = |extend| ColorLine::new(extend, 2, vec![ColorStop::new(F2Dot14::from_f32(0.0), 0, one), ColorStop::new(one, 1, one)]); let w = FWord::new; type GlyphPaint<'a> = Box ColrPaint + 'a>; - let cases: [(&str, GlyphPaint<'_>); 3] = [ + let cases: [(&str, GlyphPaint<'_>); 2] = [ ("Colrtest Xor", Box::new(|o| ColrPaint::composite(ColrPaint::glyph(solid(2), o), CompositeMode::Xor, ColrPaint::glyph(solid(0), o)))), - ( - "Colrtest Repeat", - Box::new(move |o| ColrPaint::glyph(ColrPaint::linear_gradient(line(Extend::Repeat), w(0), w(0), w(100), w(0), w(0), w(100)), o)), - ), ( "Colrtest Circles", Box::new(move |o| { @@ -362,6 +358,129 @@ fn a_radial_gradient_from_a_circle_around_its_centre_is_vector_art() { assert_eq!(offsets, [0.25, 1.0], "the stops start a quarter of the way out"); } +/// A COLRv1 color line through `stops` (offset, palette index) that extends by `extend`. +fn color_line(extend: write_fonts::tables::colr::Extend, stops: &[(f32, u16)]) -> write_fonts::tables::colr::ColorLine { + use write_fonts::tables::colr::{ColorLine, ColorStop}; + use write_fonts::types::F2Dot14; + let one = F2Dot14::from_f32(1.0); + let stops: Vec = stops.iter().map(|&(at, index)| ColorStop::new(F2Dot14::from_f32(at), index, one)).collect(); + ColorLine::new(extend, u16::try_from(stops.len()).unwrap(), stops) +} + +/// The gradient filling the glyph's one path. +fn glyph_gradient(font: &[u8]) -> vectorcraft_doc::color::GradientPaint { + let root = art(font, COLOUR_CHAR); + let [only] = children(&root) else { panic!("one path") }; + let Paint::Gradient(g) = fill(only) else { panic!("a gradient") }; + *g +} + +/// A linear gradient that repeats or reflects is vector art. The gradient spreads the same way, +/// and its stops run once from the first stop's place to the last stop's place. +#[test] +fn a_repeating_or_reflecting_linear_gradient_is_vector_art() { + use vectorcraft_doc::color::GradientSpread; + use write_fonts::tables::colr::Extend; + use write_fonts::types::FWord; + let w = FWord::new; + for (family, extend, spread) in + [("Colrtest Linear Repeat", Extend::Repeat, GradientSpread::Repeat), ("Colrtest Linear Reflect", Extend::Reflect, GradientSpread::Reflect)] + { + let line = color_line(extend, &[(0.2, 0), (0.6, 1)]); + let font = + v1_font(family, COLOUR_CHAR, |o| ColrPaint::glyph(ColrPaint::linear_gradient(line.clone(), w(0), w(0), w(100), w(0), w(0), w(100)), o)); + let g = glyph_gradient(&font); + assert_eq!(g.gradient.kind, GradientKind::Linear, "{family}"); + assert_eq!(g.gradient.painted_spread(), (spread, 1), "{family}"); + let offsets: Vec = g.gradient.stops.iter().map(|s| s.offset).collect(); + assert_eq!(offsets, [0.0, 1.0], "{family}"); + let geom = g.geom.unwrap(); + assert!((geom.start.x - 20.0).abs() < 0.01 && (geom.end.x - 60.0).abs() < 0.01, "{family}: {:?} → {:?}", geom.start, geom.end); + } +} + +/// A radial gradient from its center that repeats or reflects is vector art that spreads the same +/// way, also with a focal point. Its circle is at the last stop, and its stops run once from the +/// center out to that circle. +#[test] +fn a_repeating_or_reflecting_radial_gradient_from_its_center_is_vector_art() { + use vectorcraft_doc::color::GradientSpread; + use write_fonts::tables::colr::Extend; + use write_fonts::types::{FWord, UfWord}; + let w = FWord::new; + let cases = [ + ("Colrtest Radial Repeat", Extend::Repeat, GradientSpread::Repeat, 250, 1.0, 400.0), + ("Colrtest Radial Reflect", Extend::Reflect, GradientSpread::Reflect, 300, 1.0, 400.0), + ("Colrtest Radial Half", Extend::Repeat, GradientSpread::Repeat, 300, 0.5, 200.0), + // Normalized, the last stop is a rounding error short of 1. + ("Colrtest Radial Fine", Extend::Repeat, GradientSpread::Repeat, 250, 41.0 / 16384.0, 400.0 * 41.0 / 16384.0), + ]; + for (family, extend, spread, x0, last, radius) in cases { + let line = color_line(extend, &[(0.0, 0), (last / 2.0, 2), (last, 1)]); + let font = v1_font(family, COLOUR_CHAR, |o| { + ColrPaint::glyph(ColrPaint::radial_gradient(line.clone(), w(x0), w(300), UfWord::new(0), w(250), w(300), UfWord::new(400)), o) + }); + let g = glyph_gradient(&font); + assert_eq!(g.gradient.kind, GradientKind::Radial, "{family}"); + assert_eq!(g.gradient.painted_spread(), (spread, 1), "{family}"); + let offsets: Vec = g.gradient.stops.iter().map(|s| s.offset).collect(); + assert!(offsets.len() == 3 && offsets.iter().zip([0.0, 0.5, 1.0]).all(|(a, b)| (a - b).abs() < 0.05), "{family}: {offsets:?}"); + let geom = g.geom.unwrap(); + assert!(((geom.end - geom.start).hypot() - radius).abs() < 0.1, "{family}: {geom:?}"); + assert_eq!(geom.focal.is_some(), x0 != 250, "{family}"); + } +} + +/// A radial gradient that repeats from a circle stays an image. The circle is either a start circle +/// around the center or the place a first stop past the center puts the start. +#[test] +fn a_repeating_radial_gradient_from_a_circle_makes_the_glyph_an_image() { + use write_fonts::tables::colr::Extend; + use write_fonts::types::{FWord, UfWord}; + let w = FWord::new; + for (family, r0, first) in [("Colrtest Ring Repeat", 100, 0.0), ("Colrtest Short Repeat", 0, 0.25)] { + let line = color_line(Extend::Repeat, &[(first, 0), (1.0, 1)]); + let font = v1_font(family, COLOUR_CHAR, |o| { + ColrPaint::glyph(ColrPaint::radial_gradient(line.clone(), w(250), w(300), UfWord::new(r0), w(250), w(300), UfWord::new(400)), o) + }); + assert!(matches!(content(&font, COLOUR_CHAR), Some(ColourContent::Image(_))), "{family}"); + } +} + +/// A gradient that repeats or reflects with a stop whose palette index is outside the palette stays +/// an image. Without that stop, the other stops would repeat over a different interval. +#[test] +fn a_repeating_gradient_with_a_stop_missing_from_the_palette_makes_the_glyph_an_image() { + use write_fonts::tables::colr::Extend; + use write_fonts::types::{FWord, UfWord}; + let w = FWord::new; + let line = color_line(Extend::Repeat, &[(0.0, 0), (0.5, 1), (1.0, 200)]); + let linear = v1_font("Colrtest Linear Missing", COLOUR_CHAR, |o| { + ColrPaint::glyph(ColrPaint::linear_gradient(line.clone(), w(0), w(0), w(100), w(0), w(0), w(100)), o) + }); + let radial = v1_font("Colrtest Radial Missing", COLOUR_CHAR, |o| { + ColrPaint::glyph(ColrPaint::radial_gradient(line.clone(), w(250), w(300), UfWord::new(0), w(250), w(300), UfWord::new(400)), o) + }); + for (family, font) in [("linear", linear), ("radial", radial)] { + assert!(matches!(content(&font, COLOUR_CHAR), Some(ColourContent::Image(_))), "{family}"); + } +} + +/// A color line with an extend value the COLR specification doesn't define pads. +#[test] +fn an_unknown_extend_value_pads() { + use vectorcraft_doc::color::GradientSpread; + use write_fonts::tables::colr::Extend; + use write_fonts::types::FWord; + let w = FWord::new; + let line = color_line(Extend::Unknown, &[(0.0, 0), (1.0, 1)]); + let font = v1_font("Colrtest Unknown Extend", COLOUR_CHAR, |o| { + ColrPaint::glyph(ColrPaint::linear_gradient(line.clone(), w(0), w(0), w(100), w(0), w(0), w(100)), o) + }); + let g = glyph_gradient(&font); + assert_eq!(g.gradient.painted_spread(), (GradientSpread::Pad, 1)); +} + /// A glyph whose layers don't use the foreground colour is read once, whatever the type's fill. #[test] fn a_glyph_without_the_foreground_colour_is_read_once_for_every_fill() { diff --git a/crates/text/src/tests/combos.rs b/crates/text/src/tests/combos.rs index 0146871265..4f57aa6972 100644 --- a/crates/text/src/tests/combos.rs +++ b/crates/text/src/tests/combos.rs @@ -465,18 +465,72 @@ fn composer_x_mixed_sizes_in_a_frame_that_widens() { #[test] fn composer_x_mixed_sizes_overflow_a_shaped_frame() { - // A stepped frame too short for the paragraph: the lines that fit are set, in order, each once - // and within its room, and the frame overflows. + // A stepped frame too short for the paragraph: the every-line composer still breaks the lines + // that fit as one paragraph, with the lines past the frame's end measured as wide as the last + // line the frame holds. Here that is the narrow part, so the lines that fit break as in a frame + // tall enough for the whole paragraph, and not as the single-line composer breaks them. They + // are set in order, each once and within its room, and the frame overflows. let w = x_width(); - let mut t = stepped(w, w * 0.5, 40.0, 75.0); - t.runs = with_x(sans(36.0)); - t.para.composer = Composer::EveryLine; - let l = layout(db(), &t); + let set = |bottom: f64, composer: Composer| { + let mut t = stepped(w, w * 0.5, 40.0, bottom); + t.runs = with_x(sans(36.0)); + t.para.composer = composer; + let l = layout(db(), &t); + (line_texts(&t, &l), l, t) + }; + let (every, l, t) = set(75.0, Composer::EveryLine); assert!(l.overflow && l.lines.len() >= 2, "{:?}", l.lines); assert_eq!(l.lines[0].start, 0); assert!(l.lines.windows(2).all(|p| p[0].end == p[1].start && p[0].start < p[0].end), "{:?}", l.lines); assert!(past_their_room(&t, &l).is_empty(), "{:?}", l.lines); assert!(l.lines.iter().all(|li| li.baseline + li.descent <= 75.0 + 0.01), "{:?}", l.lines); + assert_eq!(every, ["Destroy all creatures with toughness", "X or less. Then", "draw a card for each"]); + let (whole, ..) = set(300.0, Composer::EveryLine); + assert_eq!(every, whole[..every.len()]); + let (greedy, ..) = set(75.0, Composer::SingleLine); + assert_ne!(every, greedy); + // A frame with no room for a line sets none. + for composer in [Composer::EveryLine, Composer::SingleLine] { + let mut t = stepped(w, w * 0.5, 4.0, 8.0); + t.runs = with_x(sans(36.0)); + t.para.composer = composer; + let l = layout(db(), &t); + assert!(l.lines.is_empty() && l.overflow, "{composer:?}: {:?}", l.lines); + } +} + +#[test] +fn composer_x_mixed_sizes_overflow_around_text_wrap() { + // A rectangle that wraps around an object beside its lower lines, too short for the + // paragraph: the every-line composer breaks the lines that fit as one paragraph, each span + // measured across its line's whole height, and the frame overflows. No glyph runs into the + // object. + let w = x_width(); + let object = Rect::new(w * 0.4, 40.0, w * 0.6, 70.0); + let set = |composer: Composer| { + let mut runs = with_x(sans(36.0)); + runs[0] = run("Destroy all creatures with toughness\u{a0}", sans(12.0)); + let mut t = area(runs, Rect::new(0.0, 0.0, w, 80.0)); + t.wrap = vec![vectorcraft_doc::WrapShape { path: PathData::from_bezpath(&object.to_path(0.1)), wrap: Default::default() }]; + t.para.composer = composer; + let l = layout(db(), &t); + (line_texts(&t, &l), l, t) + }; + let (every, l, t) = set(Composer::EveryLine); + assert!(l.overflow && l.lines.len() >= 3, "{:?}", l.lines); + assert!(l.lines.windows(2).all(|p| p[0].end == p[1].start && p[0].start < p[0].end), "{:?}", l.lines); + assert!(past_their_room(&t, &l).is_empty(), "{:?}", l.lines); + let text = t.plain_text(); + let hits = l.glyphs.iter().filter(|g| { + let li = &l.lines[g.line]; + let across = li.baseline - li.ascent < object.y1 && li.baseline + li.descent > object.y0; + across && !text[g.byte..].starts_with(char::is_whitespace) && g.origin.x < object.x1 && g.origin.x + g.advance > object.x0 + }); + assert_eq!(hits.count(), 0, "{:?}", l.lines); + // The lines that fit break as in `composer_x_mixed_sizes_around_text_wrap`'s taller frame. + assert_eq!(every, ["Destroy all creatures with", "toughness\u{a0}X", "or less. Then", "draw a card for", "each creature"]); + let (greedy, ..) = set(Composer::SingleLine); + assert_ne!(every, greedy); } #[test] diff --git a/crates/text/src/tests/tsume.rs b/crates/text/src/tests/tsume.rs new file mode 100644 index 0000000000..72f0d69f19 --- /dev/null +++ b/crates/text/src/tests/tsume.rs @@ -0,0 +1,143 @@ +//! Tsume (`CharStyle::tsume`): the share of the blank space on each side of a character's ink, +//! inside its own width, that horizontal type takes away, the glyph keeping its shape. +use super::{area, db, point, style}; +use crate::*; +use kurbo::Shape; +use vectorcraft_doc::{CharStyle, Justify}; + +/// Where glyph `byte` is drawn along a horizontal line. +fn drawn_x(l: &TextLayout, byte: usize) -> f64 { + l.glyphs.iter().find(|g| g.byte == byte).map(|g| g.xf.as_coeffs()[4]).unwrap() +} + +/// The left and right edges of glyph `byte`'s ink. +fn ink(l: &TextLayout, byte: usize) -> (f64, f64) { + let b = l.glyphs.iter().find(|g| g.byte == byte).map(|g| g.outline.bounding_box()).unwrap(); + (b.x0, b.x1) +} + +/// `t` with `f` applied to the style of the character at `byte`. +fn with(t: &TextObject, byte: usize, f: impl Fn(&mut CharStyle)) -> TextObject { + let mut t = t.clone(); + let end = edit::next_char(&t.plain_text(), byte); + edit::style_range(&mut t.runs, byte, end, f); + t +} + +/// How far each of `bytes` moved along the line from `a` to `b`. +fn moves(a: &TextObject, b: &TextObject, bytes: &[usize]) -> Vec { + let (la, lb) = (layout(db(), a), layout(db(), b)); + bytes.iter().map(|&i| drawn_x(&lb, i) - drawn_x(&la, i)).collect() +} + +fn near(values: &[f64], expected: &[f64]) -> bool { + values.len() == expected.len() && values.iter().zip(expected).all(|(v, e)| (v - e).abs() < 1e-6) +} + +/// The blank space before and after the O of "HOH" in `t`'s layout: between the start of its +/// width and its ink, and between its ink and the next character. +fn o_bearings(t: &TextObject) -> (f64, f64) { + let l = layout(db(), t); + let (x0, x1) = ink(&l, 1); + (x0 - drawn_x(&l, 1), drawn_x(&l, 2) - x1) +} + +#[test] +fn tsume_takes_its_share_of_the_space_beside_the_ink() { + let plain = point("HOH", style(100.0)); + let (before, after) = o_bearings(&plain); + assert!(before > 1.0 && after > 1.0, "{before} {after}"); + let plain_layout = layout(db(), &plain); + let width = ink(&plain_layout, 1).1 - ink(&plain_layout, 1).0; + for tsume in [25.0, 50.0, 100.0] { + let tight = with(&plain, 1, |s| s.tsume = tsume); + let share = tsume / 100.0; + // The O's ink moves back by its share of the space before it; the H after it also moves + // back by the share of the space after the O. + let l = layout(db(), &tight); + let (x0, x1) = ink(&l, 1); + let moved = (x0 - ink(&plain_layout, 1).0, ink(&l, 2).0 - ink(&plain_layout, 2).0); + assert!((moved.0 + before * share).abs() < 1e-6, "{tsume}: {moved:?}"); + assert!((moved.1 + (before + after) * share).abs() < 1e-6, "{tsume}: {moved:?}"); + // The glyph keeps its shape, and the H before it stays. + assert!((x1 - x0 - width).abs() < 1e-6, "{tsume}: {} {width}", x1 - x0); + assert!((ink(&l, 0).0 - ink(&plain_layout, 0).0).abs() < 1e-9); + } + // At 100% the O's ink starts where the H before it ends its width, and the next H starts its + // width where the O's ink ends. + let l = layout(db(), &with(&plain, 1, |s| s.tsume = 100.0)); + let cell_start = drawn_x(&plain_layout, 1); + assert!((ink(&l, 1).0 - cell_start).abs() < 1e-6 && (drawn_x(&l, 2) - ink(&l, 1).1).abs() < 1e-6, "{:?} {cell_start}", ink(&l, 1)); +} + +#[test] +fn zero_out_of_range_and_spaces_keep_the_layout() { + let plain = point("H O", style(100.0)); + let base = layout(db(), &plain); + for (tsume, at) in [(0.0, 2), (f64::NAN, 2), (-50.0, 2), (100.0, 1)] { + // 0, a value that is not a number, a negative value, and a space at 100%. + let l = layout(db(), &with(&plain, at, |s| s.tsume = tsume)); + let xs: Vec = l.glyphs.iter().map(|g| g.xf.as_coeffs()[4]).collect(); + let base_xs: Vec = base.glyphs.iter().map(|g| g.xf.as_coeffs()[4]).collect(); + assert_eq!(xs, base_xs, "{tsume} at {at}"); + } + // A value above 100 takes all the space, as 100 does. + let most = moves(&plain, &with(&plain, 2, |s| s.tsume = 500.0), &[2]); + let full = moves(&plain, &with(&plain, 2, |s| s.tsume = 100.0), &[2]); + assert!(near(&most, &full) && full[0] < -1.0, "{most:?} {full:?}"); +} + +#[test] +fn tracking_and_insert_aki_are_added_after_the_tsume() { + let plain = point("HOH", style(100.0)); + let tight = moves(&plain, &with(&plain, 1, |s| s.tsume = 50.0), &[0, 1, 2]); + let spaced = moves(&plain, &with(&plain, 1, |s| (s.tsume, s.aki_left, s.tracking) = (50.0, 250.0, 100.0)), &[0, 1, 2]); + // 25 pt of Aki before the O, and 10 pt of tracking after it, on top of the Tsume. + assert!(tight[1] < -1.0 && tight[2] < tight[1], "{tight:?}"); + assert!(near(&spaced, &[0.0, tight[1] + 25.0, tight[2] + 35.0]), "{tight:?} {spaced:?}"); +} + +#[test] +fn the_font_kerning_is_added_after_the_tsume() { + // An L, with blank space after its ink, before a letter the font kerns it with: its Tsume is + // the same as before an H, which the font does not kern it with. + let lh = point("LH", style(100.0)); + let kerned = ["LT", "LV", "LY", "LW"] + .map(|s| point(s, style(100.0))) + .into_iter() + .find(|t| drawn_x(&layout(db(), t), 1) < drawn_x(&layout(db(), &lh), 1) - 1.0); + let Some(kerned) = kerned else { panic!("the test font kerns none of the pairs") }; + let before_kerned = moves(&kerned, &with(&kerned, 0, |s| s.tsume = 100.0), &[1]); + let before_h = moves(&lh, &with(&lh, 0, |s| s.tsume = 100.0), &[1]); + assert!(near(&before_kerned, &before_h) && before_h[0] < -10.0, "{before_kerned:?} {before_h:?}"); +} + +#[test] +fn a_letter_with_its_mark_takes_the_tsume_of_the_letter() { + let plain = point("H\u{301}O", style(100.0)); + let after = "H\u{301}".len(); + let letter = moves(&plain, &with(&plain, 0, |s| s.tsume = 100.0), &[after]); + let mark = moves(&plain, &with(&plain, 1, |s| s.tsume = 100.0), &[after]); + assert!(letter[0] < -1.0 && near(&mark, &[0.0]), "{letter:?} {mark:?}"); +} + +#[test] +fn justification_keeps_the_tsume() { + let plain = area("HOH HOH", style(20.0), Rect::new(0.0, 0.0, 400.0, 400.0), Justify::JustifyAll); + let tight = with(&plain, 1, |s| s.tsume = 100.0); + let (lp, lt) = (layout(db(), &plain), layout(db(), &tight)); + // The O stays nearer the H before it by the space Tsume took before its ink. + let gap = |l: &TextLayout| ink(l, 1).0 - ink(l, 0).1; + assert!(gap(<) < gap(&lp) - 1.0, "{} {}", gap(&lp), gap(<)); +} + +#[test] +fn vertical_type_keeps_its_spacing() { + for text in ["§§", "ab"] { + let mut plain = point(text, style(20.0)); + plain.xf = Affine::IDENTITY; + plain.vertical = true; + let centers = |t: &TextObject| layout(db(), t).glyphs.iter().map(|g| g.outline.bounding_box().center()).collect::>(); + assert_eq!(centers(&with(&plain, 0, |s| s.tsume = 100.0)), centers(&plain), "{text}"); + } +} diff --git a/crates/text/src/tests/warichu.rs b/crates/text/src/tests/warichu.rs index d68cb8fccc..6aee052cbd 100644 --- a/crates/text/src/tests/warichu.rs +++ b/crates/text/src/tests/warichu.rs @@ -433,6 +433,51 @@ fn blocks_the_bidi_order_interleaves_keep_their_places() { assert!(c.x < bet.x && bet.x < z.x, "{c:?} {bet:?} {z:?}"); } +/// A justified line spreads its letters with the same gap before a right-to-left block as before a +/// left-to-right one: the block starts at the first of its glyphs the line draws. +#[test] +fn justification_opens_the_same_gap_before_a_right_to_left_block() { + for inside in ["cd", "אב"] { + let at = |justify: Justify| { + let mut t = area("", style(20.0), Rect::new(0.0, 0.0, 200.0, 400.0), justify); + t.runs = vec![TextRun::new("ab", style(20.0)), TextRun::new(inside, marked(20.0)), TextRun::new("z", style(20.0))]; + let l = layout(db(), &t); + let x = |byte: usize| l.glyphs.iter().filter(|g| g.byte == byte).map(|g| g.origin.x).fold(f64::INFINITY, f64::min); + let block = l.glyphs.iter().filter(|g| g.warichu.is_some()).map(|g| g.origin.x).fold(f64::INFINITY, f64::min); + (x(0), x(1), block, x(2 + inside.len())) + }; + let (a, b, block, z) = at(Justify::Left); + let (a2, b2, block2, z2) = at(Justify::JustifyAll); + let gap = (b2 - a2) - (b - a); + assert!(gap > 1.0, "{inside}: the line is spread: {gap}"); + assert!(((block2 - b2) - (block - b) - gap).abs() < 1e-6, "{inside}: the gap before the block: {} {gap}", (block2 - b2) - (block - b)); + assert!(((z2 - block2) - (z - block) - gap).abs() < 1e-6, "{inside}: the gap after the block: {} {gap}", (z2 - block2) - (z - block)); + } +} + +/// The caret next to a character of a block spans the band of the character's block line, not +/// the whole line. +#[test] +fn the_caret_in_a_block_spans_its_block_line() { + let l = layout(db(), &with_block("cdef", marked(20.0))); + let (c, e) = (&l.glyphs[2], &l.glyphs[4]); + let middle = (c.origin.y + e.origin.y) * 0.5; + let line = &l.lines[0]; + // "c" and "d", on the upper line. + for byte in [2, 3] { + let (top, bottom) = caret_position(&l, byte); + assert!((top.y - (line.baseline - line.ascent)).abs() < 1e-6 && (bottom.y - middle).abs() < 1e-6, "{byte}: {top:?} {bottom:?} {middle}"); + } + // "e" and "f", on the lower line. + for byte in [4, 5] { + let (top, bottom) = caret_position(&l, byte); + assert!((top.y - middle).abs() < 1e-6 && (bottom.y - (line.baseline + line.descent)).abs() < 1e-6, "{byte}: {top:?} {bottom:?} {middle}"); + } + // Outside the block the caret spans the line. + let (top, bottom) = caret_position(&l, 0); + assert!((top.y - (line.baseline - line.ascent)).abs() < 1e-6 && (bottom.y - (line.baseline + line.descent)).abs() < 1e-6); +} + /// A click on a block's lower line goes to that line's characters, not to the character of the /// upper line at the same place along the block. #[test] diff --git a/crates/text/src/thread/tests.rs b/crates/text/src/thread/tests.rs index 0ac64f5d27..adbf3b2c70 100644 --- a/crates/text/src/thread/tests.rs +++ b/crates/text/src/thread/tests.rs @@ -397,6 +397,80 @@ fn a_continued_paragraph_fills_the_frame_it_continues_into() { assert_eq!(checked, 16); } +/// Area type in a frame `w` wide down to `y` and `narrow` wide below it, down to `bottom`. +fn stepped_frame(w: f64, narrow: f64, y: f64, bottom: f64) -> TextObject { + let mut t = frame(0.0); + let path = kurbo::BezPath::from_vec(vec![ + kurbo::PathEl::MoveTo((0.0, 0.0).into()), + kurbo::PathEl::LineTo((w, 0.0).into()), + kurbo::PathEl::LineTo((w, y).into()), + kurbo::PathEl::LineTo((narrow, y).into()), + kurbo::PathEl::LineTo((narrow, bottom).into()), + kurbo::PathEl::LineTo((0.0, bottom).into()), + kurbo::PathEl::ClosePath, + ]); + t.kind = TextKind::Area { frame: PathData::from_bezpath(&path) }; + t +} + +/// A paragraph of mixed type sizes that a stepped frame cannot hold goes on in the next frame. The +/// every-line composer breaks the lines the first frame holds as one paragraph, as in a frame tall +/// enough for all of it and not as the single-line composer breaks them, and the first frame +/// takes the text of those lines. The next frame sets the rest at its own width, without the +/// first-line indent, and no character is lost or repeated. The frames take the same shares as +/// when each is measured with the whole rest of the story. +#[test] +fn a_mixed_size_paragraph_continued_from_a_shaped_frame_is_composed_in_both() { + use vectorcraft_doc::Composer; + let db = FontDb::global(); + let small = CharStyle { size: 12.0, ..CharStyle::default() }; + let big = CharStyle { size: 36.0, ..CharStyle::default() }; + let probe = layout(db, &TextObject::point(vectorcraft_geom::Point::ZERO, "Destroy all creatures with toughness X or", small.clone())); + let w = probe.lines[0].x1 - probe.lines[0].x0 + 2.0; + let story = vec![ + TextRun { text: "Destroy all creatures with toughness ".into(), style: small.clone(), inline: None }, + TextRun { text: "X".into(), style: big, inline: None }, + TextRun { text: " or less. Then draw a card for each creature destroyed this way.\nSecond paragraph.".into(), style: small, inline: None }, + ]; + let text: String = story.iter().map(|r| r.text.as_str()).collect(); + let (a, tall) = (stepped_frame(w, w * 0.5, 40.0, 85.0), stepped_frame(w, w * 0.5, 40.0, 300.0)); + let b = sized(200.0, w * 0.75, 300.0); + let texts = |lay: &crate::TextLayout, shown: &str| lay.lines.iter().map(|l| shown[l.start..l.end].trim_end().to_string()).collect::>(); + let shares = |composer: Composer, indent: f64| { + let para = ParaStyle { composer, first_line_indent: indent, ..Default::default() }; + let paras = [para.clone(), para]; + let parts = distribute(db, &[&a, &b], &story, ¶s); + assert_eq!(parts.iter().map(|p| p.continues).collect::>(), [false, true], "{composer:?}"); + let joined: String = parts.iter().flat_map(|p| &p.runs).map(|r| r.text.as_str()).collect(); + assert_eq!(joined, text, "{composer:?}: no character lost or repeated"); + same_as_whole_rest(db, &[&a, &b], &story, ¶s, &format!("{composer:?}, indent {indent}")); + let shown = |p: &Slice| p.runs.iter().map(|r| r.text.as_str()).collect::(); + let lays: Vec<_> = [&a, &b].iter().zip(&parts).map(|(f, p)| laid(db, f, p)).collect(); + assert!(lays.iter().all(|l| !l.overflow), "{composer:?}: each frame holds its share"); + let whole = + laid(db, &tall, &Slice { runs: story.clone(), paras: paras.to_vec(), list_count: 0, list_level_counts: vec![], continues: false }); + let first = texts(&lays[0], &shown(&parts[0])); + // The first frame takes the text of the lines it sets. + assert_eq!(shown(&parts[0]).split_whitespace().collect::>(), first.join(" ").split_whitespace().collect::>()); + (first, texts(&whole, &text), lays, parts) + }; + for indent in [0.0, 20.0] { + let (every, whole, lays, parts) = shares(Composer::EveryLine, indent); + assert!(every.len() >= 2, "{every:?}"); + assert_eq!(every, whole[..every.len()], "indent {indent}"); + if indent == 0.0 { + assert_eq!(every, ["Destroy all creatures with toughness", "X or less. Then", "draw a card for each"]); + let (greedy, ..) = shares(Composer::SingleLine, indent); + assert_eq!(greedy, ["Destroy all creatures with toughness X", "or less. Then draw a", "card for each", "creature destroyed"]); + } + // The next frame starts at its left edge, and its lines keep within it. + assert!((line_start(&lays[1], 0) - 200.0).abs() < 1e-6, "{}", line_start(&lays[1], 0)); + assert!(lays[1].lines.iter().all(|l| l.x1 <= 200.0 + w * 0.75 + 1e-6), "{:?}", lays[1].lines); + assert!((line_start(&lays[0], 0) - indent).abs() < 1e-6, "{}", line_start(&lays[0], 0)); + assert!(parts[1].continues && lays[1].lines.len() >= 2, "{:?}", lays[1].lines); + } +} + /// `frames` holding the runs of `parts`, for [`continued`]. fn filled(frames: &[&TextObject], parts: &[Slice]) -> Vec { frames diff --git a/crates/three-d/src/lib.rs b/crates/three-d/src/lib.rs index 309aa77409..bb066c0e8a 100644 --- a/crates/three-d/src/lib.rs +++ b/crates/three-d/src/lib.rs @@ -19,7 +19,7 @@ mod lights; pub use lights::{Light, Lights, MAX_LIGHTS}; mod caps; mod mesh; -pub use mesh::{Mesh, extrude_mesh, inflate_meshes, plane_mesh, revolve_mesh}; +pub use mesh::{Mesh, MeshedSolid, extrude_mesh, extrude_meshed, inflate_meshed, inflate_meshes, plane_mesh, revolve_mesh}; mod shadow; pub use shadow::{MAX_SHADOW_FACES, Shadow, ShadowCaster, ShadowPlane, ShadowPosition, TOO_COMPLEX_SHADOW}; @@ -371,6 +371,10 @@ pub struct Face { /// For a face of the swept side (not an end cap): where its corners lie on the side surface, /// for a graphic mapped onto it. pub surface: Option, + /// The face's plane in view space and the projection it was drawn with, for its depth at a + /// point of the drawing ([`DepthPlane::depth_at`]). `None` when its corners lie more than + /// 0.001 pt off one plane or a corner is at or past the eye. + pub plane: Option, } /// Where a face of Revolve's swept side lies on the side surface, unrolled flat: x runs around the @@ -638,6 +642,14 @@ fn project_face(vertices: &[V3], normals: Option<&[V3]>, o: Revolve, origin: Poi normal = V3(-normal.0, -normal.1, -normal.2); } let flat_brightness = brightness(&o, normal, light); + // As for an extruded face: no plane when a corner lies off it, or when the projection holds a + // corner just in front of the eye, so the drawing no longer matches the plane's projection. + let centre = vertices.iter().fold(V3::default(), |s, v| V3(s.0 + v.0, s.1 + v.1, s.2 + v.2)); + let centre = V3(centre.0 / vertices.len() as f64, centre.1 / vertices.len() as f64, centre.2 / vertices.len() as f64); + let offset = normal.dot(centre); + let held = eye.is_some_and(|e| vertices.iter().any(|v| e - v.2 < e * 1e-3)); + let flat = !held && vertices.iter().all(|v| (normal.dot(*v) - offset).abs() <= 1e-3); + let plane = flat.then_some(DepthPlane { normal: [normal.0, normal.1, normal.2], offset, center: origin, eye }); let points: Vec<_> = vertices .iter() .map(|v| { @@ -707,6 +719,7 @@ fn project_face(vertices: &[V3], normals: Option<&[V3]>, o: Revolve, origin: Poi cap: false, visibility_pieces: None, surface: None, + plane, })) } diff --git a/crates/three-d/src/mesh.rs b/crates/three-d/src/mesh.rs index b12bd315f5..cd9623191c 100644 --- a/crates/three-d/src/mesh.rs +++ b/crates/three-d/src/mesh.rs @@ -10,8 +10,8 @@ use vectorcraft_geom::{FillRule, PathData, Rect}; -use crate::solid::{Face3, extrude_faces, inflate_faces, plane_faces}; -use crate::{Extrude, Inflate, Revolve, V3, View}; +use crate::solid::{Face3, Keep, extrude_faces, inflate_faces, plane_faces}; +use crate::{Extrude, Facet, Inflate, Revolve, V3, View}; /// Most steps the triangulation of one solid may take: a face's ears and bridges each test the /// face's other corners. @@ -56,12 +56,12 @@ impl Mesh { /// Extrude & Bevel's solid ([`crate::extrude`]) as a mesh. pub fn extrude_mesh(path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View) -> Result { - extrude_faces(path, rule, bounds, options, view, true).and_then(|(_, faces, _)| mesh(&faces)) + extrude_faces(path, rule, bounds, options, view, Keep::Faces).and_then(|(_, faces, _)| mesh(&faces?)) } /// Rotate's plane ([`crate::plane`]) as a mesh. pub fn plane_mesh(path: &PathData, rule: FillRule, bounds: Rect, view: View) -> Result { - plane_faces(path, rule, bounds, view, true).and_then(|(_, faces, _)| mesh(&faces)) + plane_faces(path, rule, bounds, view, Keep::Faces).and_then(|(_, faces, _)| mesh(&faces?)) } /// Inflate's solids for several shapes of one object ([`crate::inflate_together`]) as meshes, one @@ -72,7 +72,49 @@ pub fn inflate_meshes( options: Inflate, view: View, ) -> impl Iterator> + use<> { - inflate_faces(shapes, bounds, options, view, true).map(|r| r.and_then(|(_, faces, _)| mesh(&faces))) + inflate_faces(shapes, bounds, options, view, Keep::Faces).map(|r| r.and_then(|(_, faces, _)| mesh(&faces?))) +} + +/// One solid built once for both its drawing and its mesh: the facets [`crate::extrude`] or +/// [`crate::inflate_each`] gives, and the faces before projection that [`MeshedSolid::mesh`] cuts +/// into the mesh [`extrude_mesh`] or [`inflate_meshes`] gives. +#[derive(Clone, Debug)] +pub struct MeshedSolid { + pub facets: Vec, + /// The faces before projection, or the error the mesh alone gives when there are too many. + faces: Result, String>, +} + +/// A solid with no facets and an empty mesh. +impl Default for MeshedSolid { + fn default() -> Self { + Self { facets: vec![], faces: Ok(vec![]) } + } +} + +impl MeshedSolid { + /// The solid as a mesh. The faces are cut into triangles on each call. + pub fn mesh(&self) -> Result { + mesh(self.faces.as_ref().map_err(String::clone)?) + } +} + +/// Extrude & Bevel's solid ([`crate::extrude`]) and its mesh ([`extrude_mesh`]) from one build. An +/// error where [`crate::extrude`] gives one. +pub fn extrude_meshed(path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View) -> Result { + extrude_faces(path, rule, bounds, options, view, Keep::Both).map(|(facets, faces, _)| MeshedSolid { facets, faces }) +} + +/// Inflate's solids for several shapes of one object ([`crate::inflate_each`]) and their meshes +/// ([`inflate_meshes`]), each solid built once, as the iterator reaches it. An error where +/// [`crate::inflate_each`] gives one. +pub fn inflate_meshed( + shapes: &[(&PathData, FillRule)], + bounds: Rect, + options: Inflate, + view: View, +) -> impl Iterator> + use<> { + inflate_faces(shapes, bounds, options, view, Keep::Both).map(|r| r.map(|(facets, faces, _)| MeshedSolid { facets, faces })) } /// Revolve's surface ([`crate::revolve`]) as a mesh. As the effect draws it, a sweep of less than diff --git a/crates/three-d/src/mesh/tests.rs b/crates/three-d/src/mesh/tests.rs index 2011d6689c..76f9b04ecc 100644 --- a/crates/three-d/src/mesh/tests.rs +++ b/crates/three-d/src/mesh/tests.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use vectorcraft_geom::{BezPath, FillRule, PathData, Rect}; use super::*; -use crate::{Bevel, Edge}; +use crate::{Bevel, BevelShape, Edge}; fn square(b: &mut BezPath, x: f64, y: f64, s: f64, clockwise: bool) { b.move_to((x, y)); @@ -372,3 +372,130 @@ fn join_numbers_each_parts_corners_after_the_last() { assert!(both.triangles.iter().all(|t| t.iter().all(|i| (*i as usize) < both.positions.len()))); assert_eq!(both.triangles[one.triangles.len()][0], one.triangles[0][0] + one.positions.len() as u32); } + +/// A mesh's positions and normals as bits, and its triangles. +type MeshBits = (Vec<[u64; 3]>, Vec<[u64; 3]>, Vec<[u32; 3]>); + +/// The bits of every number in `m`, for comparing two meshes exactly. +fn bits(m: &Mesh) -> MeshBits { + (m.positions.iter().map(|p| p.map(f64::to_bits)).collect(), m.normals.iter().map(|n| n.map(f64::to_bits)).collect(), m.triangles.clone()) +} + +/// A star of `points` points about (100, 100), with a square hole: curved and straight edges both. +fn star(points: usize) -> (PathData, Rect) { + let mut b = BezPath::new(); + for k in 0..2 * points { + let (s, c) = (k as f64 * std::f64::consts::PI / points as f64).sin_cos(); + let r = if k % 2 == 0 { 90.0 } else { 45.0 }; + let p = (100.0 + r * c, 100.0 + r * s); + if k == 0 { b.move_to(p) } else { b.curve_to((p.0 + 3.0, p.1), (p.0, p.1 + 3.0), p) } + } + b.close_path(); + square(&mut b, 90.0, 90.0, 20.0, true); + shape(&b) +} + +/// The views the solids are compared in: straight on, turned, with perspective, and with colored +/// lights (Inflate's smooth triangles). +fn views() -> Vec { + let turned = View { rotation_x: -25.0, rotation_y: 35.0, rotation_z: 10.0, ..View::default() }; + vec![front(), turned, View { perspective: 60.0, ..turned }, View { light_color: [1.0, 0.5, 0.25], ..turned }] +} + +/// Extrude & Bevel built once for its facets and its mesh gives what [`crate::extrude`] and +/// [`extrude_mesh`] give apart, to the bit, errors included. +#[test] +fn an_extruded_solid_and_its_mesh_match_the_two_built_apart() { + let bevel = Bevel { shape: BevelShape::Rounded, width: 6.0, height: 5.0, ..Bevel::default() }; + let options = [ + Extrude::default(), + Extrude { depth: 0.0, ..Extrude::default() }, + Extrude { cap: false, ..Extrude::default() }, + Extrude { hidden: true, ..Extrude::default() }, + Extrude { twist: 90.0, taper: 0.6, ..Extrude::default() }, + Extrude { bevel: Some(bevel), ..Extrude::default() }, + Extrude { bevel: Some(Bevel { both_sides: true, inside: true, ..bevel }), twist: 45.0, ..Extrude::default() }, + ]; + let (p, r) = star(7); + for view in views() { + for o in options { + let meshed = extrude_meshed(&p, FillRule::NonZero, r, o, view).unwrap(); + let facets = crate::extrude(&p, FillRule::NonZero, r, o, view).unwrap(); + assert_eq!(format!("{:?}", meshed.facets), format!("{facets:?}"), "{o:?} {view:?}"); + let apart = extrude_mesh(&p, FillRule::NonZero, r, o, view).unwrap(); + assert!(!apart.is_empty()); + assert_eq!(bits(&meshed.mesh().unwrap()), bits(&apart), "{o:?} {view:?}"); + } + } + // A solid that can't be built gives the same error. + let flat = Rect::new(0.0, 0.0, f64::INFINITY, 10.0); + let o = Extrude::default(); + let error = crate::extrude(&p, FillRule::NonZero, flat, o, front()).err(); + assert!(error.is_some()); + assert_eq!(extrude_meshed(&p, FillRule::NonZero, flat, o, front()).err(), error); +} + +/// Inflate's solids built once for their facets and meshes give what [`crate::inflate_each`] and +/// [`inflate_meshes`] give apart, to the bit: several puffs under one eye, both sides, open +/// backs, and twisted sides cut finer than room is left for. +#[test] +fn inflated_solids_and_their_meshes_match_the_two_built_apart() { + let (star, _) = star(5); + let mut b = BezPath::new(); + square(&mut b, 200.0, 20.0, 60.0, false); + let (box_, _) = shape(&b); + let ring: Vec = (0..600) + .map(|k| { + let (s, c) = (k as f64 * std::f64::consts::TAU / 600.0).sin_cos(); + vectorcraft_geom::Point::new(100.0 + 90.0 * c, 100.0 + 90.0 * s) + }) + .collect(); + let ring = PathData::single(vectorcraft_geom::SubPath::polyline(&ring, true)); + let sets = [vec![(&star, FillRule::NonZero), (&box_, FillRule::NonZero), (&star, FillRule::EvenOdd)], vec![(&ring, FillRule::NonZero)]]; + let bounds = Rect::new(0.0, 0.0, 280.0, 200.0); + let options = [ + Inflate::default(), + Inflate { depth: 30.0, both_sides: true, ..Inflate::default() }, + Inflate { depth: 20.0, cap: false, volume: 80.0, ..Inflate::default() }, + Inflate { depth: 40.0, twist: 360.0, taper: 0.7, both_sides: true, ..Inflate::default() }, + // Thin and barely twisted: the star's sides want more pieces than room is left after its + // front and back, and the mesh, which keeps the faces turned away, has less room left. + Inflate { depth: 0.1, twist: 0.1, both_sides: true, ..Inflate::default() }, + ]; + for shapes in &sets { + for view in views() { + for o in options { + let meshed: Vec<_> = inflate_meshed(shapes, bounds, o, view).collect(); + let facets: Vec<_> = crate::inflate_each(shapes, bounds, o, view).collect(); + let apart: Vec<_> = inflate_meshes(shapes, bounds, o, view).collect(); + assert_eq!(meshed.len(), shapes.len()); + for ((m, f), a) in meshed.iter().zip(&facets).zip(&apart) { + let (m, f, a) = (m.as_ref().unwrap(), f.as_ref().unwrap(), a.as_ref().unwrap()); + assert_eq!(format!("{:?}", m.facets), format!("{f:?}"), "{o:?} {view:?}"); + assert!(!a.is_empty()); + assert_eq!(bits(&m.mesh().unwrap()), bits(a), "{o:?} {view:?}"); + } + } + } + } +} + +/// One build gives both the facets and the mesh: each solid is built once. +#[test] +fn a_meshed_solid_is_built_once() { + let (p, r) = star(5); + let extruded = || crate::solid::EXTRUDED.with(|n| n.get()); + let start = extruded(); + let solid = extrude_meshed(&p, FillRule::NonZero, r, Extrude::default(), front()).unwrap(); + assert!(!solid.facets.is_empty() && solid.mesh().is_ok_and(|m| !m.is_empty())); + assert_eq!(extruded(), start + 1); + let inflated = || crate::solid::INFLATED.with(|n| n.get()); + let start = inflated(); + let mut b = BezPath::new(); + square(&mut b, 200.0, 20.0, 60.0, false); + let (q, _) = shape(&b); + for solid in inflate_meshed(&[(&p, FillRule::NonZero), (&q, FillRule::NonZero)], Rect::new(0.0, 0.0, 280.0, 200.0), Inflate::default(), front()) { + assert!(solid.is_ok_and(|s| !s.facets.is_empty() && s.mesh().is_ok_and(|m| !m.is_empty()))); + } + assert_eq!(inflated(), start + 2); +} diff --git a/crates/three-d/src/shadow.rs b/crates/three-d/src/shadow.rs index d7cd01a869..66842abad2 100644 --- a/crates/three-d/src/shadow.rs +++ b/crates/three-d/src/shadow.rs @@ -11,7 +11,7 @@ use std::ops::Range; use vectorcraft_geom::{BezPath, FillRule, PathData, Point, Rect}; -use crate::solid::{Face3, extrude_faces, inflate_faces, plane_faces}; +use crate::solid::{Face3, Keep, extrude_faces, inflate_faces, plane_faces}; use crate::{Extrude, Inflate, MAX_SOLID_FACES, Revolve, V3, View, finite, perspective_scale}; /// Where the shadow falls. @@ -160,14 +160,14 @@ impl ShadowCaster { /// Add Extrude & Bevel's solid ([`crate::extrude`]). pub fn extrude(&mut self, path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View) -> Result, String> { - let (_, faces, projection) = extrude_faces(path, rule, bounds, options, view, true)?; - self.add(faces, projection) + let (_, faces, projection) = extrude_faces(path, rule, bounds, options, view, Keep::Faces)?; + self.add(faces?, projection) } /// Add Rotate's plane ([`crate::plane`]). pub fn plane(&mut self, path: &PathData, rule: FillRule, bounds: Rect, view: View) -> Result, String> { - let (_, faces, projection) = plane_faces(path, rule, bounds, view, true)?; - self.add(faces, projection) + let (_, faces, projection) = plane_faces(path, rule, bounds, view, Keep::Faces)?; + self.add(faces?, projection) } /// Add Inflate's solids for several shapes of one object ([`crate::inflate_together`]), each @@ -182,11 +182,11 @@ impl ShadowCaster { options: Inflate, view: View, ) -> Vec, String>> { - inflate_faces(shapes, bounds, options, view, true) + inflate_faces(shapes, bounds, options, view, Keep::Faces) .enumerate() .map(|(i, r)| { let (_, faces, projection) = r?; - if casts.get(i).copied().unwrap_or(true) { self.add(faces, projection) } else { Ok(self.faces.len()..self.faces.len()) } + if casts.get(i).copied().unwrap_or(true) { self.add(faces?, projection) } else { Ok(self.faces.len()..self.faces.len()) } }) .collect() } diff --git a/crates/three-d/src/solid.rs b/crates/three-d/src/solid.rs index 49b0738d9e..55d270f97d 100644 --- a/crates/three-d/src/solid.rs +++ b/crates/three-d/src/solid.rs @@ -20,9 +20,11 @@ mod membrane; mod outline; mod rings; +#[cfg(test)] +pub(crate) use build::EXTRUDED; #[cfg(test)] use build::{Camera, cuts, edge_distance, newell, section}; -pub(crate) use build::{Face3, extrude_faces, plane_faces}; +pub(crate) use build::{Face3, Keep, extrude_faces, plane_faces}; pub use build::{extrude, plane}; pub use face_map::{FaceMap, extrude_face_map, plane_face_map}; #[cfg(test)] @@ -293,8 +295,8 @@ pub struct Facet { /// (its front). `None` for every other facet. pub end: Option, /// The face's plane in view space and the projection it was drawn with, for its depth at a - /// point of the drawing ([`Facet::depth_at`]). `None` for Revolve's faces and for a face whose - /// corners lie more than 0.001 pt off one plane (a piece of a twisted wall). + /// point of the drawing ([`Facet::depth_at`]). `None` for a face whose corners lie more than + /// 0.001 pt off one plane (a piece of a twisted wall) or reach the eye. pub plane: Option, /// The contours in view space, before projection, for tests that measure depths. #[cfg(test)] @@ -365,7 +367,7 @@ impl Facet { PathData::from_bezpath(&bp) } - /// Revolve's face `face` as a facet: its polygon, curved outline, depth, normal and lighting. + /// Revolve's face `face` as a facet: its polygon, curved outline, depth, plane, normal and lighting. /// A face that joins the profile's ends round the axis is a side; a cap is an end. pub(crate) fn of_face(face: crate::Face) -> Self { Facet { @@ -380,7 +382,7 @@ impl Facet { // A revolved cap is not one of the planar faces graphics map onto. end: None, away: false, - plane: None, + plane: face.plane, #[cfg(test)] view: vec![], } diff --git a/crates/three-d/src/solid/build.rs b/crates/three-d/src/solid/build.rs index 6d21805e74..f3fda46685 100644 --- a/crates/three-d/src/solid/build.rs +++ b/crates/three-d/src/solid/build.rs @@ -3,7 +3,7 @@ use vectorcraft_geom::kurbo::ParamCurveDeriv; use super::outline::{self, Along, Budget, CURVE_TOLERANCE}; use super::rings::{ CURVE_PIECES, MAX_PIECES, MAX_PLANE_POINTS, MAX_SOLID_POINTS, Ring, Span, TOO_COMPLEX_SURFACE, curve_pieces, inset, left, signed_area, - solid_rings_traced, + solid_rings_traced, square_corners, }; use super::{ Bevel, DepthPlane, Extrude, Facet, FillRule, MAX_FACES, MAX_SOLID_FACES, ParamCurve, PathData, PlanarFace, Point, Rect, Revolve, V3, View, @@ -64,9 +64,25 @@ impl Camera { /// and its outward normal. pub(crate) type Face3 = (Vec>, V3); -/// What a solid's builder makes: its facets, or with a mesh asked for, its faces before projection, -/// and the projection it used (`None` when nothing was built). -pub(crate) type Built = (Vec, Vec, Option); +/// What a solid's builder makes: its facets, its faces before projection when a mesh is asked for +/// (an error when they pass [`MAX_SOLID_FACES`] while the facets are built too), and the +/// projection it used (`None` when nothing was built). +pub(crate) type Built = (Vec, Result, String>, Option); + +#[cfg(test)] +thread_local! { + /// How many Extrude & Bevel solids this thread has built, for the tests. + pub(crate) static EXTRUDED: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// What a solid's builder keeps: its facets, its faces before projection for a mesh, or both +/// from one build. +#[derive(Clone, Copy, PartialEq, Eq)] +pub(crate) enum Keep { + Facets, + Faces, + Both, +} /// Facets being collected for one solid. pub(super) struct Builder<'a> { @@ -80,6 +96,11 @@ pub(super) struct Builder<'a> { pub(super) facets: Vec, /// With `Some`, every face goes here as it is, none hidden or projected, for a mesh. pub(super) mesh: Option>, + /// The faces are projected into `facets`; without it only `mesh` is kept. + pub(super) draw: bool, + /// The faces kept for the mesh passed [`MAX_SOLID_FACES`] while the facets were built too: the + /// mesh is too complex, and `mesh` keeps no more faces. + pub(super) lost: bool, } /// Where a face goes in the order the facets are drawn, back to front. @@ -98,20 +119,46 @@ pub(super) enum Order { Last, } -impl Builder<'_> { +impl<'a> Builder<'a> { + /// A builder for one solid seen by `camera`, keeping what `keep` asks for. + pub(super) fn new(camera: &'a Camera, closed: bool, hidden: bool, keep: Keep) -> Self { + Self { camera, closed, hidden, facets: vec![], mesh: (keep != Keep::Facets).then(Vec::new), draw: keep != Keep::Faces, lost: false } + } + /// Add a face of view-space contours with outward normal `n` (view space), drawn in `order`. pub(super) fn face(&mut self, contours: Vec>, n: V3, order: Order) -> Result<(), String> { let count: usize = contours.iter().map(Vec::len).sum(); if count < 3 { return Ok(()); } - if let Some(mesh) = &mut self.mesh { - mesh.push((contours, n.unit())); - if mesh.len() > MAX_SOLID_FACES { + if self.draw { + self.facet(&contours, count, n, order)?; + } + let Some(mesh) = &mut self.mesh else { return Ok(()) }; + mesh.push((contours, n.unit())); + if mesh.len() > MAX_SOLID_FACES { + if !self.draw { return Err(TOO_COMPLEX_SURFACE.into()); } - return Ok(()); + self.lose_mesh(); } + Ok(()) + } + + /// Keep no more faces for the mesh, which is too complex. + pub(super) fn lose_mesh(&mut self) { + self.mesh = None; + self.lost = true; + } + + /// How many faces the mesh holds, while the facets are built too and the mesh is kept. + pub(super) fn faces_kept(&self) -> Option { + self.mesh.as_ref().filter(|_| self.draw).map(Vec::len) + } + + /// Project a face of `count` view-space corners with outward normal `n` into a facet, drawn in + /// `order`, unless it is hidden or has no area. + fn facet(&mut self, contours: &[Vec], count: usize, n: V3, order: Order) -> Result<(), String> { let centre = contours.iter().flatten().fold(V3::default(), |s, v| V3(s.0 + v.0, s.1 + v.1, s.2 + v.2)); let centre = V3(centre.0 / count as f64, centre.1 / count as f64, centre.2 / count as f64); let n = n.unit(); @@ -138,7 +185,7 @@ impl Builder<'_> { let flat = !held && contours.iter().flatten().all(|v| (n.dot(*v) - offset).abs() <= 1e-3); let plane = flat.then_some(DepthPlane { normal: [n.0, n.1, n.2], offset, center: self.camera.origin, eye: self.camera.eye }); #[cfg(test)] - let view = contours.clone(); + let view = contours.to_vec(); let contours: Vec> = contours.iter().map(|c| c.iter().map(|v| self.camera.project(*v)).collect()).collect(); if contours.iter().flatten().any(|p| !p.x.is_finite() || !p.y.is_finite()) { return Err("The 3D projection is not finite".into()); @@ -262,7 +309,7 @@ impl Builder<'_> { /// Give the facet that [`Builder::face`] added, when it added one after `before` facets, the /// outline `outline` makes from its projected contours. pub(super) fn outline(&mut self, before: usize, outline: impl FnOnce(&[Vec]) -> Option) { - if self.mesh.is_some() || self.facets.len() <= before { + if !self.draw || self.facets.len() <= before { return; } if let Some(f) = self.facets.last_mut() { @@ -273,7 +320,7 @@ impl Builder<'_> { /// Mark the facet that [`Builder::face`] added, when it added one after `before` facets, as the /// planar end `end` of the solid. pub(super) fn end(&mut self, before: usize, end: PlanarFace) { - if self.mesh.is_some() || self.facets.len() <= before { + if !self.draw || self.facets.len() <= before { return; } if let Some(f) = self.facets.last_mut() { @@ -281,15 +328,19 @@ impl Builder<'_> { } } - /// How many faces the builder holds: facets, or faces kept for a mesh. + /// How many faces the builder holds: facets, or without them the faces kept for a mesh. pub(super) fn len(&self) -> usize { - self.mesh.as_ref().map_or(self.facets.len(), Vec::len) + match &self.mesh { + Some(mesh) if !self.draw => mesh.len(), + _ => self.facets.len(), + } } /// The facets back to front, and the faces kept for a mesh (none without [`Builder::mesh`]). pub(super) fn finish(mut self) -> Built { self.facets.sort_by(|a, b| a.depth.total_cmp(&b.depth)); - (self.facets, self.mesh.unwrap_or_default(), Some(self.camera.projection())) + let faces = if self.lost { Err(TOO_COMPLEX_SURFACE.into()) } else { Ok(self.mesh.unwrap_or_default()) }; + (self.facets, faces, Some(self.camera.projection())) } } @@ -407,10 +458,15 @@ pub(super) fn check_bounds(b: Rect) -> Result<(), String> { } /// The art's outward direction at edge `i` of `ring` (before rotation), tilted towards the face -/// it borders by `z` (+1 front, -1 back, 0 a side wall). +/// it borders by `z` (+1 front, -1 back, 0 a side wall). An edge of no length (a corner cut +/// square, see [`square_corners`]) faces out between the edges on either side of it. pub(super) fn outward(ring: &[Point], i: usize, z: f64) -> V3 { let n = ring.len(); - let (lx, ly) = left(ring[i], ring[(i + 1) % n]); + let (mut lx, mut ly) = left(ring[i], ring[(i + 1) % n]); + if lx == 0.0 && ly == 0.0 && n > 2 { + let (a, b) = (left(ring[(i + n - 1) % n], ring[i]), left(ring[(i + 1) % n], ring[(i + 2) % n])); + (lx, ly) = (a.0 + b.0, a.1 + b.1); + } V3(-lx, -ly, z) } @@ -536,16 +592,18 @@ fn steps(o: &Extrude) -> Vec { /// Extrude & Bevel: the shape's outline extruded backwards, with optional twist, taper, bevels /// and caps. pub fn extrude(path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View) -> Result, String> { - extrude_faces(path, rule, bounds, options, view, false).map(|(facets, ..)| facets) + extrude_faces(path, rule, bounds, options, view, Keep::Facets).map(|(facets, ..)| facets) } -/// [`extrude`], or with `mesh` the solid's faces before projection instead of its facets. -pub(crate) fn extrude_faces(path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View, mesh: bool) -> Result { +/// [`extrude`], keeping the solid's facets, its faces before projection, or both, as `keep` asks. +pub(crate) fn extrude_faces(path: &PathData, rule: FillRule, bounds: Rect, options: Extrude, view: View, keep: Keep) -> Result { + #[cfg(test)] + EXTRUDED.with(|n| n.set(n.get() + 1)); check_bounds(bounds)?; let o = options.sanitized(); // No depth: the flat shape, seen from either side. if o.depth <= 0.0 { - return plane_faces(path, rule, bounds, view, mesh); + return plane_faces(path, rule, bounds, view, keep); } let steps = steps(&o); // One face for each edge of the outline in each band between two steps, and the two caps: @@ -554,14 +612,17 @@ pub(crate) fn extrude_faces(path: &PathData, rule: FillRule, bounds: Rect, optio let (bands, caps) = (steps.len().saturating_sub(1), if o.cap { 2 } else { 0 }); let size = bounds.width().max(bounds.height()); let most = curve_pieces(path, size, bands, caps)?; - let traced = solid_rings_traced(path, rule, size, MAX_SOLID_POINTS, most)?; + // Every inset of one extrusion goes the same way: into the shape for a bevel inside, out of it + // for one outside. The corners that way opens are cut square past the miter limit. + let side = steps.iter().map(|s| s.inset).find(|w| *w != 0.0).unwrap_or(0.0); + let traced: Vec = solid_rings_traced(path, rule, size, MAX_SOLID_POINTS, most)?.iter().map(|r| square_corners(r, side)).collect(); let rings: Vec<&[Point]> = traced.iter().map(|r| r.points.as_slice()).collect(); let edges = rings.iter().map(|r| r.len()).fold(0usize, usize::saturating_add); if edges.saturating_mul(bands).saturating_add(caps) > MAX_SOLID_FACES { return Err(TOO_COMPLEX_SURFACE.into()); } let camera = Camera::new(view, bounds, o.depth); - let mut b = Builder { camera: &camera, closed: o.cap, hidden: o.hidden, facets: vec![], mesh: mesh.then(Vec::new) }; + let mut b = Builder::new(&camera, o.cap, o.hidden, keep); let z = |t: f64| o.depth / 2.0 - o.depth * t; let ring_at = |ring: &[Point], s: &Step| -> Vec { section(&inset(ring, s.inset), bounds, &o, s.t).iter().map(|p| camera.place(*p, z(s.t))).collect() }; @@ -647,15 +708,15 @@ pub(crate) fn extrude_faces(path: &PathData, rule: FillRule, bounds: Rect, optio /// Rotate: the flat art turned in 3D about the centre of `bounds` (which may be larger than the /// shape's own, so that every part of one object turns about the same point). pub fn plane(path: &PathData, rule: FillRule, bounds: Rect, view: View) -> Result, String> { - plane_faces(path, rule, bounds, view, false).map(|(facets, ..)| facets) + plane_faces(path, rule, bounds, view, Keep::Facets).map(|(facets, ..)| facets) } -/// [`plane`], or with `mesh` its face before projection instead of its facet. -pub(crate) fn plane_faces(path: &PathData, rule: FillRule, bounds: Rect, view: View, mesh: bool) -> Result { +/// [`plane`], keeping its facet, its face before projection, or both, as `keep` asks. +pub(crate) fn plane_faces(path: &PathData, rule: FillRule, bounds: Rect, view: View, keep: Keep) -> Result { check_bounds(bounds)?; let rings = solid_rings_traced(path, rule, bounds.width().max(bounds.height()), MAX_PLANE_POINTS, CURVE_PIECES)?; let camera = Camera::new(view, bounds, 0.0); - let mut b = Builder { camera: &camera, closed: false, hidden: false, facets: vec![], mesh: mesh.then(Vec::new) }; + let mut b = Builder::new(&camera, false, false, keep); let contours: Vec> = rings.iter().map(|r| r.points.iter().map(|p| camera.place(*p, 0.0)).collect()).collect(); // A plane is one flat face, seen from either side. Its normal is turned toward the viewer, so // it is drawn last, as a cap is, and planes drawn in one order keep the order they are given in. diff --git a/crates/three-d/src/solid/inflate.rs b/crates/three-d/src/solid/inflate.rs index d3773a92f9..677e9cc8bc 100644 --- a/crates/three-d/src/solid/inflate.rs +++ b/crates/three-d/src/solid/inflate.rs @@ -1,4 +1,4 @@ -use super::build::{Builder, Built, Camera, Order, Turn, check_bounds, cuts, fit, newell, outward}; +use super::build::{Builder, Built, Camera, Keep, Order, Turn, check_bounds, cuts, fit, newell, outward}; use super::membrane::{Edges, MAX_MATERIAL_SEGMENTS, Membrane, cell_triangles, clip, crossings, filled, material}; use super::rings::{MAX_SOLID_POINTS, TOO_COMPLEX_SURFACE, curve_pieces, signed_area, solid_rings}; use super::{Facet, FillRule, Inflate, MAX_FACES, MAX_SOLID_FACES, PathData, Point, Rect, V3, Vec2, View}; @@ -73,26 +73,26 @@ pub fn inflate_each( options: Inflate, view: View, ) -> impl Iterator, String>> + use<> { - inflate_faces(shapes, bounds, options, view, false).map(|r| r.map(|(facets, ..)| facets)) + inflate_faces(shapes, bounds, options, view, Keep::Facets).map(|r| r.map(|(facets, ..)| facets)) } -/// [`inflate_together`], or with `mesh` each solid's faces before projection instead of its facets. -/// Every shape's membrane is solved at once (the eye depends on the highest puff); each solid is -/// built as the iterator reaches it. +/// [`inflate_together`], keeping each solid's facets, its faces before projection, or both, as +/// `keep` asks. Every shape's membrane is solved at once (the eye depends on the highest puff); +/// each solid is built as the iterator reaches it. pub(crate) fn inflate_faces( shapes: &[(&PathData, FillRule)], bounds: Rect, options: Inflate, view: View, - mesh: bool, + keep: Keep, ) -> impl Iterator> + use<> { let o = options.sanitized(); let puffs: Vec, String>> = shapes.iter().map(|(path, rule)| check_bounds(bounds).and_then(|()| puff(path, *rule, bounds, &o))).collect(); let reach = puffs.iter().flatten().flatten().map(|p| p.height).fold(0.0, f64::max); puffs.into_iter().map(move |p| match p { - Ok(Some(p)) => inflated(p, bounds, o, view, reach, mesh), - Ok(None) => Ok((vec![], vec![], None)), + Ok(Some(p)) => inflated(p, bounds, o, view, reach, keep), + Ok(None) => Ok((vec![], Ok(vec![]), None)), Err(e) => Err(e), }) } @@ -106,9 +106,9 @@ thread_local! { } /// The facets of one inflated shape, for a camera that allows for a puff `reach` high (or the -/// shape's own, if higher): `reach` is the highest puff of the shapes drawn together. With `mesh`, -/// its faces before projection instead. -fn inflated(p: Puff, bounds: Rect, o: Inflate, view: View, reach: f64, mesh: bool) -> Result { +/// shape's own, if higher): `reach` is the highest puff of the shapes drawn together. Its faces +/// before projection instead, or both, as `keep` asks. +fn inflated(p: Puff, bounds: Rect, o: Inflate, view: View, reach: f64, keep: Keep) -> Result { #[cfg(test)] INFLATED.with(|n| n.set(n.get() + 1)); let Puff { rings, edges, cell, nx, ny, m, height } = p; @@ -149,7 +149,7 @@ fn inflated(p: Puff, bounds: Rect, o: Inflate, view: View, reach: f64, mesh: boo let smooth = view.shade && view.has_colored_lights(); let camera = Camera::new(view, bounds, o.depth + 2.0 * height.max(reach)); // Without its back cap the object is a shell open behind, its inside showing. - let mut b = Builder { camera: &camera, closed: o.cap, hidden: false, facets: vec![], mesh: mesh.then(Vec::new) }; + let mut b = Builder::new(&camera, o.cap, false, keep); let half = o.depth / 2.0; // The back: turned and scaled by the twist and taper, its puff too. let back_turn = Turn::new(bounds, o.twist, o.taper, 1.0); @@ -375,15 +375,40 @@ fn inflated(p: Puff, bounds: Rect, o: Inflate, view: View, reach: f64, mesh: boo let turn = Turn::new(bounds, o.twist, o.taper, t); ring.iter().map(|p| camera.place(turn.apply(*p), half - o.depth * t)).collect() }; - let mut pieces: Vec> = rings.iter().map(|r| if o.twist != 0.0 { cuts(&at(r, 0), &at(r, 1)) } else { vec![] }).collect(); + let cut: Vec> = rings.iter().map(|r| if o.twist != 0.0 { cuts(&at(r, 0), &at(r, 1)) } else { vec![] }).collect(); + let mut pieces = cut.clone(); fit(&mut pieces, slices, MAX_FACES.saturating_sub(b.len())); let edges = rings.iter().map(Vec::len).fold(0usize, usize::saturating_add); if b.len().saturating_add(edges.saturating_mul(slices)) > MAX_SOLID_FACES { return Err(TOO_COMPLEX_SURFACE.into()); } - for (ring, pieces) in rings.iter().zip(&pieces) { - for k in 0..slices { - b.band(&at(ring, k), &at(ring, k + 1), pieces, |i| outward(ring, i, 0.0))?; + let sides = |b: &mut Builder<'_>, pieces: &[Vec]| -> Result<(), String> { + for (ring, pieces) in rings.iter().zip(pieces) { + for k in 0..slices { + b.band(&at(ring, k), &at(ring, k + 1), pieces, |i| outward(ring, i, 0.0))?; + } + } + Ok(()) + }; + // A mesh kept with the facets has the sides a mesh alone has: limited, and with a twist + // cut, by the faces the mesh holds, which can be more than the facets. + let mut own_sides = None; + if let Some(kept) = b.faces_kept() { + let mut own = cut; + fit(&mut own, slices, MAX_FACES.saturating_sub(kept)); + if kept.saturating_add(edges.saturating_mul(slices)) > MAX_SOLID_FACES { + b.lose_mesh(); + } else if own != pieces { + own_sides = Some((own, b.mesh.take())); + } + } + sides(&mut b, &pieces)?; + if let Some((own, faces)) = own_sides { + let mut m = Builder::new(&camera, o.cap, false, Keep::Faces); + m.mesh = faces; + match sides(&mut m, &own) { + Ok(()) => b.mesh = m.mesh, + Err(_) => b.lose_mesh(), } } } diff --git a/crates/three-d/src/solid/outline.rs b/crates/three-d/src/solid/outline.rs index 07fb0ce58b..93d9d70340 100644 --- a/crates/three-d/src/solid/outline.rs +++ b/crates/three-d/src/solid/outline.rs @@ -123,7 +123,8 @@ fn contour(path: &mut BezPath, ring: &Ring, points: &[Point], step: &Along, budg while i < n { let end = |k: usize| points.get((k + 1) % n).copied().unwrap_or(first); let Some(span) = ring.spans.get(i).copied().flatten() else { - if i + 1 < n { + // A corner cut square (see `square_corners`) whose two copies did not move apart. + if i + 1 < n && points.get(i).copied() != Some(end(i)) { path.line_to(end(i)); } i += 1; diff --git a/crates/three-d/src/solid/rings.rs b/crates/three-d/src/solid/rings.rs index 80dc66407c..882bd245af 100644 --- a/crates/three-d/src/solid/rings.rs +++ b/crates/three-d/src/solid/rings.rs @@ -16,6 +16,10 @@ pub(super) const CURVE_PIECES: u32 = 32; /// for fewer takes fewer. pub(super) const MIN_CURVE_PIECES: u32 = 4; +/// How far an inset corner's miter reaches at most, as a multiple of the inset. [`square_corners`] +/// cuts a corner whose miter would reach further square across instead. +const MITER_LIMIT: f64 = 4.0; + const TOO_COMPLEX_SHAPE: &str = "The shape is too complex for a 3D effect"; /// The error a solid past its limits returns, and a 3D effect whose solids together pass /// [`crate::MAX_OBJECT_FACES`]. @@ -472,8 +476,10 @@ pub(super) fn left(a: Point, b: Point) -> (f64, f64) { } /// `ring` moved `w` points towards its filled side (negative: away from it), each corner along -/// its bisector, its mitre limited to four times `w` so sharp corners don't shoot off. Each point -/// stays the partner of its source point, so rings at different insets join face to face. +/// its bisector, its miter limited to [`MITER_LIMIT`] times `w` so sharp corners don't shoot off. +/// A point given twice (a corner [`square_corners`] cut) moves each copy along its one edge's +/// normal. Each point stays the partner of its source point, so rings at different insets join +/// face to face. pub(super) fn inset(ring: &[Point], w: f64) -> Vec { if w == 0.0 { return ring.to_vec(); @@ -486,6 +492,12 @@ pub(super) fn inset(ring: &[Point], w: f64) -> Vec { let next = ring[(i + 1) % n]; let (ax, ay) = left(prev, p); let (bx, by) = left(p, next); + if ax == 0.0 && ay == 0.0 { + return Point::new(p.x + bx * w, p.y + by * w); + } + if bx == 0.0 && by == 0.0 { + return Point::new(p.x + ax * w, p.y + ay * w); + } let (mut mx, mut my) = (ax + bx, ay + by); let ml = mx.hypot(my); if ml < 1e-9 { @@ -493,8 +505,43 @@ pub(super) fn inset(ring: &[Point], w: f64) -> Vec { } else { (mx, my) = (mx / ml, my / ml); } - let cos = (mx * ax + my * ay).max(0.25); + let cos = (mx * ax + my * ay).max(1.0 / MITER_LIMIT); Point::new(p.x + mx * w / cos, p.y + my * w / cos) }) .collect() } + +/// `ring` with each corner whose miter an inset towards `side` (positive: the filled side, +/// negative: away from it) would reach past [`MITER_LIMIT`] given twice, joined by an edge of no +/// length that follows no curve. [`inset`] moves the two copies apart along their own edges' +/// normals, so the inset ring cuts the corner square, as a bevel join does, instead of running out +/// to a point along the bisector. Corners on the other side of the turn, whose inset edges meet +/// before the corner, keep one point. +pub(super) fn square_corners(ring: &Ring, side: f64) -> Ring { + let n = ring.points.len(); + if side == 0.0 || n < 3 || ring.spans.len() != n { + return ring.clone(); + } + let mut out = Ring { points: Vec::with_capacity(n), spans: Vec::with_capacity(n) }; + for (i, (&p, span)) in ring.points.iter().zip(&ring.spans).enumerate() { + let prev = ring.points[(i + n - 1) % n]; + let next = ring.points[(i + 1) % n]; + let (a, b) = (left(prev, p), left(p, next)); + let (mx, my) = (a.0 + b.0, a.1 + b.1); + let ml = mx.hypot(my); + // The cosine of the half angle between the bisector and each edge's normal: the miter + // reaches 1 / cos times the inset. + let cos = if ml < 1e-9 { 0.0 } else { (mx * a.0 + my * a.1) / ml }; + // Which way the outline turns at `p`: an inset towards `side` opens the corner when the + // turn is against it. + let turn = (p - prev).cross(next - p); + let edges = (a.0 != 0.0 || a.1 != 0.0) && (b.0 != 0.0 || b.1 != 0.0); + out.points.push(p); + if edges && cos < 1.0 / MITER_LIMIT && turn * side < 0.0 { + out.spans.push(None); + out.points.push(p); + } + out.spans.push(*span); + } + out +} diff --git a/crates/three-d/src/solid/tests.rs b/crates/three-d/src/solid/tests.rs index e89a29afea..7afce495ad 100644 --- a/crates/three-d/src/solid/tests.rs +++ b/crates/three-d/src/solid/tests.rs @@ -225,12 +225,12 @@ fn a_flat_facet_measures_its_depth_on_its_plane() { /// eye, has no plane: its drawing no longer matches the plane's projection there. #[test] fn a_face_reaching_past_the_eye_has_no_plane() { - use super::build::{Builder, Order}; + use super::build::{Builder, Keep, Order}; let (_, b) = shape(&square(0.0, 0.0, 100.0)); let camera = Camera::new(View { perspective: 50.0, ..front() }, b, 0.0); let eye = camera.center_and_eye().1.unwrap(); for (far, has_plane) in [(eye / 2.0, true), (2.0 * eye, false)] { - let mut builder = Builder { camera: &camera, closed: false, hidden: false, facets: vec![], mesh: None }; + let mut builder = Builder::new(&camera, false, false, Keep::Facets); let corners = vec![V3(-10.0, -10.0, 0.0), V3(10.0, -10.0, 0.0), V3(0.0, 10.0, far)]; builder.face(vec![corners], V3(0.0, -far, 20.0), Order::Depth).unwrap(); assert_eq!(builder.facets.len(), 1, "{far}"); @@ -255,6 +255,78 @@ fn a_bevel_inside_shrinks_the_cap_and_outside_grows_the_walls() { assert!(inside.iter().any(|f| !close(f.brightness, inside[inside.len() - 1].brightness, 1e-3))); } +/// A bevel past a sharp corner is cut square, as a bevel join cuts a stroke, instead of running +/// out to a spike along the corner's bisector: seen straight on, no point of the solid lies further +/// from the art than the miters of its corners of about 90° (14.6 pt for a 10 pt bevel), where the +/// sharp corner's spike reached 40 pt. The bevel opens the corner of a thin spike (with its +/// neighbor in the same compound path) when it is outside, and of a narrow notch when it is inside; +/// the other two cases, where the inset edges meet, keep their limited miters and are checked too. +#[test] +fn a_bevel_cuts_sharp_corners_square() { + let poly = |pts: &[(f64, f64)]| { + let mut b = BezPath::new(); + b.move_to(pts[0]); + pts[1..].iter().for_each(|p| b.line_to(*p)); + b.close_path(); + b + }; + let spike = [(50.0, 0.0), (56.0, 100.0), (44.0, 100.0)]; + let block = [(80.0, 40.0), (120.0, 40.0), (120.0, 100.0), (80.0, 100.0)]; + let notched = [(0.0, 0.0), (100.0, 0.0), (100.0, 100.0), (52.0, 100.0), (50.0, 20.0), (48.0, 100.0), (0.0, 100.0)]; + let mut both = poly(&spike); + both.extend(poly(&block).elements().iter().copied()); + let bevel = Bevel { width: 10.0, height: 10.0, ..Bevel::default() }; + let mut far_cases = vec![]; + for (name, art, outline) in [("spike", both, vec![spike.to_vec(), block.to_vec()]), ("notch", poly(¬ched), vec![notched.to_vec()])] { + let (p, b) = shape(&art); + let outline: Vec> = outline.iter().map(|r| r.iter().map(|q| Point::new(q.0, q.1)).collect()).collect(); + for inside in [false, true] { + for shape in [BevelShape::Classic, BevelShape::Rounded] { + let o = Extrude { bevel: Some(Bevel { inside, shape, ..bevel }), ..Extrude::default() }; + let f = extrude(&p, FillRule::NonZero, b, o, front()).unwrap(); + let far = f.iter().flat_map(|f| f.contours.iter().flatten()).map(|q| edge_distance(&outline, *q)).fold(0.0, f64::max); + if far > 15.0 { + far_cases.push(format!("{name} inside {inside} {shape:?}: a point {far} pt from the art")); + } + assert!(f.iter().all(|f| f.normal.iter().all(|v| v.is_finite())), "{name} inside {inside} {shape:?}"); + } + // Turned, every face still has a normal it can be lit and sorted by. + let o = Extrude { bevel: Some(Bevel { inside, ..bevel }), ..Extrude::default() }; + let f = extrude(&p, FillRule::NonZero, b, o, View::default()).unwrap(); + assert!(f.iter().all(|f| f.normal.iter().all(|v| v.is_finite()) && f.brightness.is_finite()), "{name} inside {inside}"); + } + } + assert!(far_cases.is_empty(), "{far_cases:#?}"); +} + +/// With the bevel outside, the cap is the outline itself, so a corner cut square keeps its two +/// points together there: the cap's outline draws no straight segment of no length at that corner. +#[test] +fn a_cap_draws_no_empty_segment_at_a_corner_cut_square() { + use vectorcraft_geom::kurbo::PathEl; + let mut art = BezPath::new(); + art.move_to((50.0, 0.0)); + art.line_to((56.0, 100.0)); + art.curve_to((56.0, 120.0), (44.0, 120.0), (44.0, 100.0)); + art.close_path(); + let (p, b) = shape(&art); + let o = Extrude { bevel: Some(Bevel { width: 10.0, height: 10.0, ..Bevel::default() }), ..Extrude::default() }; + let f = extrude(&p, FillRule::NonZero, b, o, front()).unwrap(); + let cap = f.iter().find(|f| f.depth == f64::MAX && f.outline.is_some()).unwrap(); + let mut at = None; + for el in cap.path().to_bezpath().elements() { + match *el { + PathEl::MoveTo(q) => at = Some(q), + PathEl::LineTo(q) => { + assert_ne!(at, Some(q), "a segment of no length at {q:?}"); + at = Some(q); + } + PathEl::QuadTo(_, q) | PathEl::CurveTo(_, _, q) => at = Some(q), + PathEl::ClosePath => {} + } + } +} + #[test] fn bevel_shapes_repeats_and_both_sides_change_the_surface() { let (p, b) = shape(&square(0.0, 0.0, 100.0)); diff --git a/crates/three-d/src/tests.rs b/crates/three-d/src/tests.rs index fe42769ebb..5dba29c480 100644 --- a/crates/three-d/src/tests.rs +++ b/crates/three-d/src/tests.rs @@ -375,3 +375,35 @@ fn malformed_and_degenerate_inputs_are_bounded() { assert!(revolve(&p, Rect::new(f64::NAN, 0.0, 1.0, 1.0), Revolve::default()).is_err()); assert!(revolve(&PathData::default(), b, Revolve::default()).unwrap().is_empty()); } + +/// A revolved face carries its plane: the depth it gives at each corner of its drawing is the +/// corner's view-space depth, with and without perspective. A face whose corners lie off one plane, +/// or with a corner at or past the eye, has none. +#[test] +fn a_revolved_face_measures_its_depth_on_its_plane() { + let o = Revolve { rotation_x: -30.0, rotation_y: 25.0, ..Default::default() }.sanitized(); + let origin = Point::new(50.0, 80.0); + let light = V3(0.0, 0.0, 1.0); + let [a, b, c, d] = [V3(-20.0, -10.0, 5.0), V3(20.0, -12.0, -15.0), V3(25.0, 15.0, -20.0), V3(-18.0, 14.0, 4.0)]; + // The fourth corner moved onto the plane of the first three. + let n = b.sub(a).cross(c.sub(a)); + let d = V3(d.0, d.1, a.2 - (n.0 * (d.0 - a.0) + n.1 * (d.1 - a.1)) / n.2); + let flat = [a, b, c, d]; + for eye in [None, Some(400.0)] { + let face = project_face(&flat, None, o, origin, eye, light).unwrap().unwrap(); + let plane = face.plane.unwrap(); + for (p, v) in face.points.iter().zip(&flat) { + let depth = plane.depth_at(*p).unwrap(); + assert!((depth - v.2).abs() < 1e-6, "{eye:?}: {depth} against {}", v.2); + } + let twisted = [a, b, c, V3(d.0, d.1, d.2 + 1.0)]; + assert!(project_face(&twisted, None, o, origin, eye, light).unwrap().unwrap().plane.is_none(), "{eye:?}"); + } + let past = [a, b, V3(c.0, c.1, 500.0)]; + assert!(project_face(&past, None, o, origin, Some(400.0), light).unwrap().unwrap().plane.is_none()); + assert!(project_face(&past, None, o, origin, Some(1000.0), light).unwrap().unwrap().plane.is_some()); + // Every face of a revolved profile of straight edges has one. + let (p, b) = cylinder(); + let faces = revolve(&p, b, Revolve { rotation_x: -30.0, perspective: 35.0, ..Default::default() }).unwrap(); + assert!(!faces.is_empty() && faces.iter().all(|f| f.plane.is_some())); +} diff --git a/crates/three-d/src/visibility.rs b/crates/three-d/src/visibility.rs index 424242828b..3ed491ae10 100644 --- a/crates/three-d/src/visibility.rs +++ b/crates/three-d/src/visibility.rs @@ -303,6 +303,7 @@ mod tests { cap: false, visibility_pieces: None, surface: None, + plane: None, } } diff --git a/crates/tools/src/addons/parametric_shape.rs b/crates/tools/src/addons/parametric_shape.rs index d16cb63935..68a42a665f 100644 --- a/crates/tools/src/addons/parametric_shape.rs +++ b/crates/tools/src/addons/parametric_shape.rs @@ -4,7 +4,9 @@ //! dragging, ←/→ its second value or corner radius. A click selects a parametric shape and shows //! its handles (centre, size, rotation, corner radius and one of the kind's own), whose drags run //! `addon.pathtools.shape.set`; a double-click on the canvas places one with the last settings. -//! Each gesture is one undo step. +//! Each gesture is one undo step. A new shape's center (from a press or a double-click) and the +//! point dragged out from it snap as a drawing tool's points do ([`DrawSnap`]), hovering before +//! the press too. //! //! A parametric shape is an ordinary path that keeps its numbers in one entry of its object data //! ([`KEY`]) with a fingerprint of the outline they drew. Moved, turned or scaled by any tool it @@ -17,6 +19,7 @@ use vectorcraft_geom::{Affine, BezPath, PathData, Point, Vec2}; use vectorcraft_pathops::addons::pathtools::shapes::fingerprint; pub use vectorcraft_pathops::addons::pathtools::shapes::{MAX_COUNT, MAX_SIZE, MIN_COUNT, MIN_SIZE, ParametricShape, ShapeKind}; +use crate::guides::DrawSnap; use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; /// The tool's id. @@ -209,7 +212,7 @@ fn angle(c: Point, p: Point, shift: bool) -> f64 { #[derive(Clone, Debug, PartialEq)] enum Drag { /// Drawing a shape out from its centre. - Create { center: Point }, + Create { center: Point, from: Point }, /// Dragging a handle of shape `id`, which was `shape` when the drag began at `from`. Edit { id: NodeId, shape: ParametricShape, grip: Grip, from: Point }, } @@ -221,11 +224,18 @@ pub struct ParametricShapeTool { drag: Option, /// Where the pointer last was during the drag, and the keys held. last: (Point, Mods), + /// Smart Guides for a new shape's center and the point dragged out from it. + snap: DrawSnap, } impl Default for ParametricShapeTool { fn default() -> Self { - Self { next: ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0), drag: None, last: (Point::ZERO, Mods::default()) } + Self { + next: ParametricShape::new(ShapeKind::Polygon, Point::ZERO, 100.0, 100.0), + drag: None, + last: (Point::ZERO, Mods::default()), + snap: DrawSnap::default(), + } } } @@ -247,7 +257,7 @@ impl ParametricShapeTool { fn shaped(&self, drag: &Drag, p: Point, mods: Mods) -> (&'static str, ParametricShape, Option) { let fit = |v: f64| v.clamp(MIN_SIZE, MAX_SIZE); match *drag { - Drag::Create { center } => { + Drag::Create { center, .. } => { let r = center.distance(p); let aspect = self.next.width / self.next.height; let s = ParametricShape { @@ -288,6 +298,18 @@ impl ParametricShapeTool { } Some(Action::Preview(cmd.into(), p)) } + + /// Show the Smart Guides of a new shape's center at `p`, the pointer hovering; none over a + /// handle of the selected shape or over a parametric shape, where a press does not draw. + fn hover(&mut self, cx: &ToolContext, p: Point) { + let tol = cx.point_tol(); + let on_grip = selected(cx).is_some_and(|(_, s)| grips(cx, &s).iter().any(|(_, at)| at.distance(p) <= tol)); + if on_grip || shape_at(cx, p).is_some() { + self.snap.clear(); + } else { + self.snap.hover(cx, p, &[], None); + } + } } impl Tool for ParametricShapeTool { @@ -300,6 +322,9 @@ impl Tool for ParametricShapeTool { } fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { + if ev.kind == PointerKind::Move && self.drag.is_none() { + self.hover(cx, ev.pos); + } match ev.kind { PointerKind::Move => vec![], PointerKind::Down => { @@ -309,15 +334,17 @@ impl Tool for ParametricShapeTool { near.min_by(|a, b| a.1.distance(ev.pos).total_cmp(&b.1.distance(ev.pos))).map(|(g, _)| (id, s, g)) }); if let Some((id, shape, grip)) = grip { + self.snap.clear(); self.drag = Some(Drag::Edit { id, shape, grip, from: ev.pos }); self.last = (ev.pos, ev.mods); return vec![Action::Begin(EDIT.into())]; } if let Some(id) = shape_at(cx, ev.pos) { + self.snap.clear(); return if cx.selection.objects == [id] { vec![] } else { vec![Action::Exec("select.set".into(), json!({ "ids": [id.0] }))] }; } - let (center, _) = crate::guides::snap_draw(cx, ev.pos, &[]); - self.drag = Some(Drag::Create { center }); + let center = self.snap.press(cx, ev.pos, &[], None); + self.drag = Some(Drag::Create { center, from: ev.pos }); self.last = (center, ev.mods); vec![Action::Begin(CREATE.into())] } @@ -325,15 +352,19 @@ impl Tool for ParametricShapeTool { if self.drag.is_none() { return vec![]; } - self.last = (ev.pos, ev.mods); + // The point a new shape is dragged out to snaps; a handle's drag does not. + let pos = if matches!(self.drag, Some(Drag::Create { .. })) { self.snap.drag(cx, ev.pos, None) } else { ev.pos }; + self.last = (pos, ev.mods); let Some(preview) = self.preview() else { return vec![] }; if ev.kind == PointerKind::Drag { return vec![preview]; } + self.snap.clear(); let Some(drag) = self.drag.take() else { return vec![] }; match drag { - // A click draws nothing (a double-click places a shape). - Drag::Create { center } if center.distance(ev.pos) <= cx.tol(2.0) => vec![Action::Cancel], + // A click draws nothing (a double-click places a shape), even when its center + // snapped a few pixels from where it was pressed. + Drag::Create { from, .. } if from.distance(ev.pos) <= cx.tol(2.0) => vec![Action::Cancel], Drag::Create { .. } => { if let Action::Preview(_, p) = &preview && let Ok(s) = apply(self.next, p) @@ -350,7 +381,8 @@ impl Tool for ParametricShapeTool { if self.drag.is_some() || shape_at(cx, ev.pos).is_some() { return vec![]; } - let s = ParametricShape { center: ev.pos, ..self.next }; + let s = ParametricShape { center: self.snap.press(cx, ev.pos, &[], None), ..self.next }; + self.snap.clear(); vec![Action::Exec("addon.pathtools.shape.create".into(), to_json(&s))] } } @@ -358,6 +390,7 @@ impl Tool for ParametricShapeTool { fn key(&mut self, cx: &ToolContext, key: ToolKey, _mods: Mods) -> Vec { if key == ToolKey::Escape && self.drag.take().is_some() { + self.snap.clear(); return vec![Action::Cancel]; } if !matches!(self.drag, Some(Drag::Create { .. })) { @@ -385,13 +418,16 @@ impl Tool for ParametricShapeTool { } fn overlays(&self, cx: &ToolContext) -> Vec { - if let Some(Drag::Create { center }) = &self.drag { - let (_, s, _) = self.shaped(&Drag::Create { center: *center }, self.last.0, self.last.1); + if let Some(drag @ Drag::Create { .. }) = &self.drag { + let (_, s, _) = self.shaped(drag, self.last.0, self.last.1); let text = format!("{}\nAngle: {:.1}°", cx.size_label(s.width, s.height), s.rotation); - return vec![Overlay::Measure { p: self.last.0 + Vec2::new(cx.tol(12.0), cx.tol(12.0)), text }]; + let mut out = self.snap.guides().to_vec(); + out.push(Overlay::Measure { p: self.last.0 + Vec2::new(cx.tol(12.0), cx.tol(12.0)), text }); + return out; } - let Some((_, s)) = selected(cx) else { return vec![] }; - // The shape's box, then its handles. + // The hovering pointer's Smart Guides, then the selected shape's box and handles. + let mut out = self.snap.guides().to_vec(); + let Some((_, s)) = selected(cx) else { return out }; let (rx, ry) = (s.width / 2.0, s.height / 2.0); let mut bp = BezPath::new(); let f: Affine = s.frame(); @@ -400,7 +436,7 @@ impl Tool for ParametricShapeTool { if i == 0 { bp.move_to(*p) } else { bp.line_to(*p) } } bp.close_path(); - let mut out = vec![Overlay::Path { path: bp, color: BLUE, width: 1.0, dashed: true }]; + out.push(Overlay::Path { path: bp, color: BLUE, width: 1.0, dashed: true }); for (grip, p) in grips(cx, &s) { if grip == Grip::Rotate { out.push(Overlay::Line { a: f * Point::new(0.0, -ry), b: p, color: BLUE, dashed: false }); @@ -418,6 +454,11 @@ impl Tool for ParametricShapeTool { Cursor::ParametricShape } + fn deactivate(&mut self, _cx: &ToolContext) -> Vec { + self.snap.clear(); + vec![] + } + /// The next shape's numbers (its size and rotation are a double-click's). fn options(&self) -> Value { let mut v = to_json(&self.next); diff --git a/crates/tools/src/builder.rs b/crates/tools/src/builder.rs index 5a8d44d400..f5be7ac4c5 100644 --- a/crates/tools/src/builder.rs +++ b/crates/tools/src/builder.rs @@ -695,6 +695,14 @@ impl Tool for ShapeBuilderTool { self.finish_edit(cx) } + /// The pointer hovers nothing for the tool: its highlight, the stroke a click would split and + /// the cursor swatch preview go, and a map that arrives afterwards highlights nothing. + fn hover_ended(&mut self, _cx: &ToolContext) { + self.hover = None; + self.stroke = None; + self.at = None; + } + fn poll(&mut self, cx: &ToolContext, wait: bool) -> Vec { let mut acts = self.poll_merge(cx, wait); if !acts.is_empty() || self.dragging { diff --git a/crates/tools/src/builder/live_paint.rs b/crates/tools/src/builder/live_paint.rs index 2ae2f082ee..e5f696a5a7 100644 --- a/crates/tools/src/builder/live_paint.rs +++ b/crates/tools/src/builder/live_paint.rs @@ -769,6 +769,11 @@ impl Tool for LivePaintSelectionTool { vec![] } + /// The pointer hovers nothing for the tool: its highlight goes. + fn hover_ended(&mut self, _cx: &ToolContext) { + self.hover = LpHover::None; + } + fn overlays(&self, cx: &ToolContext) -> Vec { if let Some(r) = self.drag.and_then(|d| d.marquee(cx)) { return vec![Overlay::Marquee(r)]; diff --git a/crates/tools/src/builder/tests.rs b/crates/tools/src/builder/tests.rs index 01b64ee8c3..90e4832771 100644 --- a/crates/tools/src/builder/tests.rs +++ b/crates/tools/src/builder/tests.rs @@ -920,6 +920,43 @@ fn shape_builder_shift_drag_shows_no_scissors_or_stroke_highlight() { assert_eq!(t.cursor(&cx, Point::new(75.0, 75.0), shift), Cursor::ShapeBuilder); } +/// When the pointer leaves the canvas, the Shape Builder's region or stroke highlight and its +/// cursor swatch preview go. +#[test] +fn shape_builder_hover_ended_drops_the_highlight_and_the_swatch_preview() { + let (d, s) = corner_rects(); + let p = paint(); + let cx = cx(&d, &s, &p); + let mut t = ShapeBuilderTool::default(); + for (key, v) in [("pickColorFrom", json!("swatches")), ("cursorSwatchPreview", json!(true)), ("clickStrokeSplitsPath", json!(true))] { + t.set_option(key, &v); + } + // Over a region, then over a stroke a click would split. + for (x, y) in [(25.0, 25.0), (-1.0, 25.0)] { + t.pointer(&cx, &ev(PointerKind::Move, x, y)); + let ov = t.overlays(&cx); + assert!(ov.iter().any(|o| matches!(o, Overlay::Swatch { .. })) && ov.iter().any(|o| matches!(o, Overlay::Path { .. })), "{ov:?}"); + t.hover_ended(&cx); + assert!(t.overlays(&cx).is_empty()); + } +} + +/// A map of a large selection that arrives after the pointer leaves the canvas highlights nothing +/// under the point where the pointer was last seen. +#[test] +fn shape_builder_map_arriving_after_hover_ended_highlights_nothing() { + let (d, s) = square_row(40); + let p = paint(); + let cx = ToolContext { revision: (1, 1), ..cx(&d, &s, &p) }; + let mut t = ShapeBuilderTool::default(); + t.pointer(&cx, &ev(PointerKind::Move, 15.0, 10.0)); + assert!(t.waiting() && t.hover.is_none(), "the map is built on another thread"); + t.hover_ended(&cx); + t.poll(&cx, true); + assert!(!t.waiting()); + assert!(t.hover.is_none() && t.overlays(&cx).is_empty(), "{:?}", t.hover); +} + #[test] fn shape_builder_stroke_options_round_trip_and_pick_the_side_under_the_pointer() { let (d, s) = corner_rects(); @@ -1593,6 +1630,21 @@ fn live_paint_selection_hover_builds_no_map_of_the_selection() { assert!(!t.waiting()); } +/// When the pointer leaves the canvas, the Live Paint Selection tool's highlight goes. +#[test] +fn live_paint_selection_hover_ended_drops_the_highlight() { + let (d, ..) = live_group_doc(); + let s = Selection::default(); + let p = paint(); + let cx = cx(&d, &s, &p); + let mut t = LivePaintSelectionTool::default(); + t.pointer(&cx, &ev(PointerKind::Move, 75.0, 25.0)); + let ov = t.overlays(&cx); + assert!(ov.iter().any(|o| matches!(o, Overlay::Path { .. })), "{ov:?}"); + t.hover_ended(&cx); + assert!(t.overlays(&cx).is_empty()); +} + /// A Live Paint Selection click pressed with `down`: the press does nothing, and the release does /// what is returned. fn lp_click(t: &mut LivePaintSelectionTool, cx: &ToolContext, down: PointerEvent) -> Vec { diff --git a/crates/tools/src/cursors.toml b/crates/tools/src/cursors.toml index 6f5b32e56a..674ecebf60 100644 --- a/crates/tools/src/cursors.toml +++ b/crates/tools/src/cursors.toml @@ -453,6 +453,7 @@ group = "Navigation" shown_when = [ "The Rotate, Reflect, Scale and Shear tools with nothing selected.", "Puppet Warp off the mesh, where no pin can go.", + "The Smooth tool, and the Pencil or Blob Brush where Alt gives the Smooth tool, when no path is selected that the Smooth tool can act on: a drag changes nothing.", ] hotspot = "The centre." designer = false @@ -690,10 +691,10 @@ look = "Only a small dot at the centre, as the Blob Brush's: the tip outline dra id = "Smooth" group = "Drawing and editing tools" shown_when = [ - "The Smooth tool: a drag along a selected path smooths it.", - "The Pencil tool with Alt key toggles to Smooth Tool on: with Alt held before a stroke begins to draw, and through a drag that smooths.", - "The Paintbrush tool with Alt held before a press while a path is selected that the Smooth tool can act on (an editable path, not a guide, with three or more anchors on one of its subpaths), and through a drag that smooths.", - "The Blob Brush tool with Alt held before a press, or before the drag has moved from the press point, and through a drag that smooths.", + "The Smooth tool while a path is selected that it can act on (an editable path, not a guide, with three or more anchors on one of its subpaths), wherever the pointer is: a drag along the path smooths it. With no such path selected, Not Allowed shows.", + "The Pencil tool with Alt key toggles to Smooth Tool on and such a path selected: with Alt held before a stroke begins to draw, and through a drag that smooths.", + "The Paintbrush tool with Alt held before a press while such a path is selected, and through a drag that smooths.", + "The Blob Brush tool with such a path selected: with Alt held before a press, or before the drag has moved from the press point, and through a drag that smooths.", ] hotspot = "The tip." diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index 14f7f85881..ff99091153 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -344,10 +344,19 @@ impl DimensionTool { _ => Orientation::Aligned, }; } - d.place(p); + // A dimension dragged out from art starts with placeholder points. Read the art's points + // before placing the dimension at the pointer. Clear the offset first: an out-of-range + // offset from the last pointer position fails the read. + if !matches!(d.mode, DimensionMode::Radius | DimensionMode::Diameter) { + d.offset = 0.0; + } if d.resolve(cx.doc).is_err() { return vec![]; } + d.place(p); + if d.validate().is_err() { + return vec![]; + } let mut actions = vec![]; if !self.began { actions.push(Action::Begin("Create Dimension".into())); @@ -675,6 +684,53 @@ mod tests { assert!(matches!(placed.last(), Some(Action::Commit)), "{placed:?}"); } + /// A pointer position too far away to place the dimension shows no preview, and the preview + /// comes back where the pointer returns. + #[test] + fn placement_recovers_after_a_position_out_of_range() { + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let mut t = DimensionTool::default(); + for (x, y) in [(400.0, 400.0), (450.0, 400.0)] { + t.pointer(&c, &PointerEvent::new(PointerKind::Down, x, y)); + t.pointer(&c, &PointerEvent::new(PointerKind::Up, x, y)); + } + assert!(t.pointer(&c, &PointerEvent::new(PointerKind::Move, 420.0, 3.0e6)).is_empty()); + let acts = t.pointer(&c, &PointerEvent::new(PointerKind::Move, 420.0, 450.0)); + let Some(Action::Preview(_, params)) = acts.last() else { panic!("{acts:?}") }; + assert_eq!(params["offset"], json!(50.0)); + } + + /// Dragging out from a segment previews the dimension at the pointer from the first drag on. + #[test] + fn the_first_preview_of_a_segment_drag_is_at_the_pointer() { + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let mut t = DimensionTool::default(); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 150.0, 100.0)); + let acts = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 150.0, 60.0)); + let Some(Action::Preview(_, params)) = acts.last() else { panic!("{acts:?}") }; + assert_eq!(params["offset"], json!(-40.0), "40 pt above the top edge"); + } + + /// Dragging out from a corner previews the angle at the pointer's distance from the corner + /// from the first drag on. + #[test] + fn the_first_preview_of_a_corner_drag_is_at_the_pointer() { + let (d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let c = cx(&d, &s, &p); + let mut t = DimensionTool::default(); + t.set_option("mode", &json!("angular")); + t.pointer(&c, &PointerEvent::new(PointerKind::Down, 100.0, 100.0)); + let acts = t.pointer(&c, &PointerEvent::new(PointerKind::Drag, 130.0, 140.0)); + let Some(Action::Preview(_, params)) = acts.last() else { panic!("{acts:?}") }; + assert_eq!(params["vertex"], json!([100.0, 100.0])); + assert_eq!(params["offset"], json!(50.0), "50 pt from the corner"); + } + /// A Linear press on an anchor picks that anchor even when the pointer moves a few pixels /// before the release: it does not drag out the dimension of a segment that ends there. Both /// picks keep their links to the path, so the dimension measures between the two anchors. diff --git a/crates/tools/src/draw2/family.rs b/crates/tools/src/draw2/family.rs index 8058101b1c..2e93888d02 100644 --- a/crates/tools/src/draw2/family.rs +++ b/crates/tools/src/draw2/family.rs @@ -477,7 +477,8 @@ impl Tool for FamilyTool { } "slope" => self.slope = v.as_f64().filter(|n| n.is_finite()).map_or(self.slope, |n| n.clamp(-100.0, 100.0)), "fillArc" => self.fill_arc = v.as_bool().unwrap_or(self.fill_arc), - "decay" => self.decay = v.as_f64().unwrap_or(self.decay).clamp(5.0, 150.0), + // Report and persist the decay that shapes::spiral can actually draw. + "decay" => self.decay = v.as_f64().unwrap_or(self.decay).clamp(5.0, 99.99), "segments" => self.segments = v.as_u64().unwrap_or(10).clamp(2, 1000) as u32, "clockwise" => self.clockwise = v.as_bool().unwrap_or(self.clockwise), "rows" | "concentric" => self.rows = v.as_u64().unwrap_or(5).min(999) as u32, @@ -534,6 +535,55 @@ mod tests { use crate::testutil::*; use vectorcraft_doc::Selection; + #[test] + fn spiral_reports_the_decay_its_command_draws() { + let mut t = FamilyTool::new("spiral"); + assert_eq!(t.options()["decay"], json!(80.0)); + for (requested, expected) in [(-10.0, 5.0), (5.0, 5.0), (80.0, 80.0), (99.99, 99.99), (100.0, 99.99), (150.0, 99.99), (200.0, 99.99)] { + t.set_option("decay", &json!(requested)); + assert_eq!(t.options()["decay"], json!(expected)); + let (id, params) = t.command(Point::ZERO, Point::new(100.0, 0.0), Mods::default()); + assert_eq!(id, "shape.spiral"); + assert_eq!(params["decay"], json!(expected)); + // Inspect the actual adjacent radii, not a second copy of the tool's clamp. Decay is per full + // wind and a segment is a quarter turn, so four segments give the decay. + let path = vectorcraft_geom::shapes::spiral(Point::ZERO, 100.0, params["decay"].as_f64().unwrap(), 2, true); + let anchors = &path.subpaths[0].anchors; + let outer = anchors[2].p.distance(Point::ZERO); + let next = anchors[1].p.distance(Point::ZERO); + assert!((100.0 * (next / outer).powi(4) - expected).abs() < 1e-9); + } + for invalid in [Value::Null, json!("80"), json!(false), json!({})] { + t.set_option("decay", &invalid); + assert_eq!(t.options()["decay"], json!(99.99)); + } + } + + #[test] + fn normalized_spiral_decay_preserves_existing_capped_paths_within_roundoff() { + for requested in [100.0, 150.0] { + let mut t = FamilyTool::new("spiral"); + t.set_option("decay", &json!(requested)); + for clockwise in [false, true] { + for segments in [2, 10, 1000] { + for radius in [1.0, 100.0, 1e6] { + let previous = vectorcraft_geom::shapes::spiral(Point::ZERO, radius, requested, segments, clockwise); + let normalized = vectorcraft_geom::shapes::spiral(Point::ZERO, radius, t.decay, segments, clockwise); + let old = &previous.subpaths[0].anchors; + let new = &normalized.subpaths[0].anchors; + assert_eq!(old.len(), new.len()); + for (a, b) in old.iter().zip(new) { + assert_eq!(a.kind, b.kind); + for (p, q) in [(a.p, b.p), (a.h_in, b.h_in), (a.h_out, b.h_out)] { + assert!(p.distance(q) <= 1e-10 * (1.0 + radius), "{requested}% / {segments} / {radius}: {p:?} != {q:?}"); + } + } + } + } + } + } + } + #[test] fn grid_drag_and_arrows() { let (d, _) = doc_with_rect(); diff --git a/crates/tools/src/draw2/gesture.rs b/crates/tools/src/draw2/gesture.rs index 9aed6f545b..61396e01d9 100644 --- a/crates/tools/src/draw2/gesture.rs +++ b/crates/tools/src/draw2/gesture.rs @@ -777,7 +777,8 @@ fn has_selected_smooth_path(cx: &ToolContext) -> bool { cx.selection.objects.iter().filter_map(|id| cx.doc.node(*id)).any(|n| { let mut found = false; n.walk(&mut |child| { - if matches!(&child.kind, NodeKind::Path { guide: false, path, .. } if path.control_bounds().is_some() && path.subpaths.iter().any(smoothable)) + if !found + && matches!(&child.kind, NodeKind::Path { guide: false, path, .. } if path.control_bounds().is_some() && path.subpaths.iter().any(smoothable)) && editable(child.id) { found = true; @@ -787,6 +788,13 @@ fn has_selected_smooth_path(cx: &ToolContext) -> bool { }) } +/// The Smooth tool's cursor: Not Allowed when no selected path can be smoothed, since a drag then +/// changes nothing. A selected path anywhere on the canvas is enough, so the cursor does not depend +/// on where the pointer is. +fn smooth_cursor(cx: &ToolContext) -> Cursor { + if has_selected_smooth_path(cx) { Cursor::Smooth } else { Cursor::NotAllowed } +} + impl GestureTool { pub fn new(id: &str) -> Self { let id: &'static str = match id { @@ -1173,7 +1181,7 @@ impl GestureTool { let tol = cx.tol(self.edit_within); let radius = cx.tol(SMOOTH_RADIUS); if self.smoothing { - if has_sel && pts.len() >= 2 { + if pts.len() >= 2 && has_selected_smooth_path(cx) { return vec![Action::Exec( "path.smoothRegion".into(), json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.smooth_fidelity)}), @@ -1225,7 +1233,7 @@ impl GestureTool { }), )], "knife" if pts.len() >= 2 => vec![Action::Exec("path.knife".into(), json!({"points": points_json(pts)}))], - "smooth" if has_sel && pts.len() >= 2 => { + "smooth" if pts.len() >= 2 && has_selected_smooth_path(cx) => { vec![Action::Exec( "path.smoothRegion".into(), json!({"points": points_json(pts), "radius": radius, "fidelity": cx.tol(self.fidelity)}), @@ -1534,13 +1542,15 @@ impl Tool for GestureTool { } fn cursor(&self, cx: &ToolContext, p: Point, m: Mods) -> Cursor { // An active smoothing drag, or Alt before a press that would switch the Pencil, Paintbrush - // or Blob Brush to Smooth. A Paintbrush stroke already drawing keeps drawing with Alt. + // or Blob Brush to Smooth. A Paintbrush stroke already drawing keeps drawing with Alt. With + // no selected path to smooth, the Pencil and the Blob Brush show Not Allowed, as the Smooth + // tool does. if self.smoothing || (self.id == "pencil" && self.alt_smooth && m.alt && !self.began) || (!self.active && self.id == "paintbrush" && m.alt && has_selected_smooth_path(cx)) || self.blob_alt_smooths(m) { - return Cursor::Smooth; + return smooth_cursor(cx); } // Before a press that would draw a straight line: over an end of a selected open path, // the line continues that path from the end (`PointerKind::Down`). @@ -1563,7 +1573,7 @@ impl Tool for GestureTool { "blobBrush" => Cursor::BlobBrush, "eraser" => Cursor::Eraser, "knife" => Cursor::Knife, - "smooth" => Cursor::Smooth, + "smooth" => smooth_cursor(cx), "pathEraser" => Cursor::PathEraser, "join" => Cursor::Join, // Before a press that draws a new path the Pencil shows its star; over a selected path diff --git a/crates/tools/src/draw2/gesture/tests.rs b/crates/tools/src/draw2/gesture/tests.rs index 4703305d85..ece7a369bb 100644 --- a/crates/tools/src/draw2/gesture/tests.rs +++ b/crates/tools/src/draw2/gesture/tests.rs @@ -369,7 +369,7 @@ fn the_freehand_tools_want_every_sample() { #[test] fn alt_shows_the_closing_cursor_and_a_release_with_alt_closes() { - let (d, _) = doc_with_rect(); + let (d, rect) = doc_with_rect(); let s = Selection::default(); let p = paint(); let cx = cx(&d, &s, &p); @@ -396,18 +396,26 @@ fn alt_shows_the_closing_cursor_and_a_release_with_alt_closes() { } // With Alt key toggles to Smooth Tool on, Alt lends the Pencil the Smooth tool instead, until // a stroke has begun to draw: Alt then neither smooths nor closes, and the cursor stays the Pencil's. + // With nothing selected to smooth, the Smooth tool it lends shows Not Allowed. let mut t = GestureTool::new("pencil"); t.set_option("altSmooth", &json!(true)); - assert_eq!(t.cursor(&cx, at, alt), Cursor::Smooth); + assert_eq!(t.cursor(&cx, at, alt), Cursor::NotAllowed); t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0)); t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 10.0, 5.0)); assert_eq!(t.cursor(&cx, at, alt), Cursor::Pencil, "a stroke that has begun"); let acts = t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 20.0, 0.0).with_mods(alt)); assert!(matches!(&acts[0], Action::Preview(_, v) if v["closed"] == false), "{acts:?}"); - // A smoothing drag keeps the Smooth cursor when Alt is let go. - t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0).with_mods(alt)); - t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 10.0, 5.0).with_mods(alt)); - assert_eq!(t.cursor(&cx, at, Mods::default()), Cursor::Smooth, "a smoothing drag"); + // A smoothing drag keeps the lent cursor when Alt is let go: Smooth with a selected path, Not + // Allowed without one. + let mut selected = Selection::default(); + selected.set([rect]); + for (sel, c) in [(&s, Cursor::NotAllowed), (&selected, Cursor::Smooth)] { + let cx = crate::testutil::cx(&d, sel, &p); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0).with_mods(alt)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 10.0, 5.0).with_mods(alt)); + assert_eq!(t.cursor(&cx, at, Mods::default()), c, "a smoothing drag"); + t.pointer(&cx, &PointerEvent::new(PointerKind::Up, 20.0, 0.0).with_mods(alt)); + } } #[test] @@ -2531,6 +2539,117 @@ fn smooth_needs_selection_and_brackets_resize() { assert_eq!(b.options()["size"], 11.0); } +/// The Smooth tool shows Not Allowed while no selected path can be smoothed: nothing selected, only +/// type, a path of two anchors or a locked path. A selected path anywhere, alone or in a selected +/// group, gives the Smooth cursor wherever the pointer is, and the cursor follows the selection while +/// the tool stays chosen. +#[test] +fn smooth_shows_not_allowed_without_a_selected_path_to_smooth() { + use std::sync::Arc; + let (mut d, rect) = doc_with_rect(); + let layer = d.layers[0].id; + let line_id = d.alloc_id(); + let line = vectorcraft_geom::PathData::from_bezpath(&vectorcraft_geom::BezPath::from_vec(vec![ + vectorcraft_geom::PathEl::MoveTo(Point::new(300.0, 300.0)), + vectorcraft_geom::PathEl::LineTo(Point::new(400.0, 300.0)), + ])); + d.insert(Some(layer), 1, vectorcraft_doc::Node::path(line_id, line, vectorcraft_doc::Appearance::default_art())).unwrap(); + let square = vectorcraft_geom::shapes::rectangle(vectorcraft_geom::Rect::new(300.0, 350.0, 350.0, 400.0)); + let inner = vectorcraft_doc::Node::path(d.alloc_id(), square, vectorcraft_doc::Appearance::default_art()); + let group = vectorcraft_doc::Node::group(d.alloc_id(), vec![Arc::new(inner)]); + let group_id = group.id; + d.insert(Some(layer), 2, group).unwrap(); + let (text_doc, text) = doc_with_area_type(); + let mut locked = d.clone(); + locked.node_mut(rect).unwrap().locked = true; + let p = paint(); + let sel = |ids: &[NodeId]| { + let mut s = Selection::default(); + s.set(ids.iter().copied()); + s + }; + let t = GestureTool::new("smooth"); + let far = Point::new(480.0, 20.0); + let cases: [(&vectorcraft_doc::Document, Selection, Cursor, &str); 7] = [ + (&d, Selection::default(), Cursor::NotAllowed, "nothing selected"), + (&text_doc, sel(&[text]), Cursor::NotAllowed, "type"), + (&d, sel(&[line_id]), Cursor::NotAllowed, "a two-anchor path"), + (&locked, sel(&[rect]), Cursor::NotAllowed, "a locked path"), + (&d, sel(&[rect]), Cursor::Smooth, "a path away from the pointer"), + (&d, sel(&[line_id, rect]), Cursor::Smooth, "a path beside one it cannot smooth"), + (&d, sel(&[group_id]), Cursor::Smooth, "a group holding a path"), + ]; + for (doc, s, c, what) in &cases { + assert_eq!(t.cursor(&cx(doc, s, &p), far, Mods::default()), *c, "{what}"); + } + // The cursor changes as the selection does, with the same tool. + let (none, one) = (Selection::default(), sel(&[rect])); + for (s, c) in [(&none, Cursor::NotAllowed), (&one, Cursor::Smooth), (&none, Cursor::NotAllowed)] { + assert_eq!(t.cursor(&cx(&d, s, &p), Point::new(150.0, 150.0), Mods::default()), c); + } + // A drag with Not Allowed showing sends nothing. + let mut t = GestureTool::new("smooth"); + let acts = drag(&mut t, &cx(&d, &none, &p), &[(50.0, 150.0), (150.0, 150.0), (250.0, 150.0)], Mods::default()); + assert!(acts.iter().all(|a| a.is_empty()), "{acts:?}"); +} + +/// The Blob Brush's Alt shows Not Allowed with no selected path to smooth, and the Smooth cursor with +/// one; the Paintbrush's Alt without one keeps the closing cursor, since its release closes the stroke. +#[test] +fn borrowed_smooth_shows_not_allowed_without_a_selected_path_to_smooth() { + let (d, rect) = doc_with_rect(); + let none = Selection::default(); + let mut one = Selection::default(); + one.set([rect]); + let p = paint(); + let alt = Mods { alt: true, ..Default::default() }; + let at = Point::new(400.0, 400.0); + let blob = GestureTool::new("blobBrush"); + assert_eq!(blob.cursor(&cx(&d, &none, &p), at, alt), Cursor::NotAllowed); + assert_eq!(blob.cursor(&cx(&d, &one, &p), at, alt), Cursor::Smooth); + assert_eq!(blob.cursor(&cx(&d, &none, &p), at, Mods::default()), Cursor::BlobBrush); + let mut pencil = GestureTool::new("pencil"); + pencil.set_option("altSmooth", &json!(true)); + assert_eq!(pencil.cursor(&cx(&d, &none, &p), at, alt), Cursor::NotAllowed); + assert_eq!(pencil.cursor(&cx(&d, &one, &p), at, alt), Cursor::Smooth); + let brush = GestureTool::new("paintbrush"); + assert_eq!(brush.cursor(&cx(&d, &none, &p), at, alt), Cursor::PaintbrushClose); + assert_eq!(brush.cursor(&cx(&d, &one, &p), at, alt), Cursor::Smooth); +} + +/// A Smooth release sends no command while the selection holds no path it can smooth, from the +/// Smooth tool and from the Blob Brush and Pencil with Alt; with a path selected it smooths. +#[test] +fn smoothing_release_sends_nothing_without_a_selected_path_to_smooth() { + let (text_doc, text) = doc_with_area_type(); + let (d, rect) = doc_with_rect(); + let mut type_only = Selection::default(); + type_only.set([text]); + let mut one = Selection::default(); + one.set([rect]); + let p = paint(); + let alt = Mods { alt: true, ..Default::default() }; + let stroke = [(50.0, 150.0), (150.0, 150.0), (250.0, 160.0)]; + let smooths = |acts: &[Vec]| acts.iter().flatten().any(|a| matches!(a, Action::Exec(c, _) if c == "path.smoothRegion")); + for (id, mods) in [("smooth", Mods::default()), ("blobBrush", alt), ("pencil", alt)] { + let tool = || { + let mut t = GestureTool::new(id); + if id == "pencil" { + t.set_option("altSmooth", &json!(true)); + } + t + }; + let mut c = cx(&text_doc, &type_only, &p); + c.smart_guides = false; + let acts = drag_held(&mut tool(), &c, &stroke, mods); + assert!(!smooths(&acts), "{id} with only type selected: {acts:?}"); + let mut c = cx(&d, &one, &p); + c.smart_guides = false; + let acts = drag_held(&mut tool(), &c, &stroke, mods); + assert!(smooths(&acts), "{id} with a path selected: {acts:?}"); + } +} + #[test] fn pencil_alt_toggles_to_smooth_when_enabled_and_closes_when_disabled() { let (d, id) = doc_with_rect(); diff --git a/crates/tools/src/guides/targets.rs b/crates/tools/src/guides/targets.rs index fa31174afa..e3e6abeef6 100644 --- a/crates/tools/src/guides/targets.rs +++ b/crates/tools/src/guides/targets.rs @@ -36,7 +36,8 @@ pub struct Targets { pub(super) xs: Vec<(f64, Point, Kind)>, pub(super) ys: Vec<(f64, Point, Kind)>, /// Path segments and their control bounds, which a point lands on ("path"): gathered only for - /// dragged anchors ([`Self::for_anchor_drag`]). + /// dragged anchors ([`Self::for_anchor_drag`]) and selections moved by an anchor + /// ([`Self::for_move_by_anchor`]). pub(super) segments: Vec<(Rect, PathSeg)>, /// Ruler guides, which pull a point into line where they run (Snap to Point). pub(super) rulers: Vec, @@ -170,7 +171,18 @@ impl Targets { /// Guides › Snap to Last Location, a move (not a copy, which has nothing in `exclude`) goes back /// to where it began when it comes near ([`Self::snap_back`]), unless Snap to Pixel snaps moves. pub fn for_move(cx: &ToolContext, exclude: &[NodeId]) -> Self { - let mut t = Self::collect(cx.doc, exclude, None).styled(cx); + Self::moving(cx, exclude, Gather::Bounds) + } + + /// [`Self::for_move`]'s targets for a selection moved by one of its anchors (#7411): the path + /// segments of the art but `exclude` too, which that anchor lands on ([`Self::snap_onto_path`]), + /// as a dragged anchor does with Direct Selection. + pub fn for_move_by_anchor(cx: &ToolContext, exclude: &[NodeId]) -> Self { + Self::moving(cx, exclude, Gather::Segments) + } + + fn moving(cx: &ToolContext, exclude: &[NodeId], gather: Gather) -> Self { + let mut t = Self::collect_inner(cx.doc, exclude, None, None, gather).styled(cx); if cx.spacing_guides { t.boxes = object_boxes(cx.doc, &cx.selection.objects); } @@ -858,6 +870,21 @@ impl Targets { self.line(from, q).into_iter().chain(self.label(q, "align")).collect() } + /// A point `p` near no target anchor or center landed where two target paths cross + /// ("intersect"), else on the nearest target path ("path"), within `tol`: the point and its + /// label, as [`Self::snap_point`] lands it. The ruler guides of `rulers` count as paths that + /// cross ([`Self::rulers`]). None when no path is in reach, or the targets hold no segments. + pub(crate) fn snap_onto_path(&self, p: Point, tol: f64, rulers: Option<&Targets>) -> Option<(Point, Vec)> { + if self.segments.is_empty() { + return None; + } + if let Some(q) = self.crossing_with(p, tol, rulers.map_or(&self.rulers, |r| &r.rulers)) { + return Some((q, self.label(q, "intersect").into_iter().collect())); + } + let q = self.on_segment(p, tol)?; + Some((q, self.label(q, Kind::Edge.label()).into_iter().collect())) + } + /// The nearest point within `tol` of `p` on a target segment. fn on_segment(&self, p: Point, tol: f64) -> Option { self.segments @@ -872,6 +899,11 @@ impl Targets { /// Where two target paths, a path and a ruler guide, or two ruler guides cross, the crossing /// nearest `p` within `tol` ("intersect", #1602). fn crossing(&self, p: Point, tol: f64) -> Option { + self.crossing_with(p, tol, &self.rulers) + } + + /// [`Self::crossing`] with the ruler guides `rulers`. + fn crossing_with(&self, p: Point, tol: f64, rulers: &[Ruler]) -> Option { // A ruler guide running past, as a short line through the reach of `p`. let ruler = |r: &Ruler| { let (pos, ..) = r.line_at(p, tol)?; @@ -885,7 +917,7 @@ impl Targets { .iter() .filter(|(b, c)| b.inflate(tol, tol).contains(p) && c.nearest(p, 1e-6).distance_sq <= tol * tol) .map(|(_, c)| *c) - .chain(self.rulers.iter().filter_map(ruler)) + .chain(rulers.iter().filter_map(ruler)) // shortcut: the first 32 lines in reach are paired, raise it if busier crossings matter .take(32) .collect(); diff --git a/crates/tools/src/guides/tests.rs b/crates/tools/src/guides/tests.rs index 1b6ddbaa12..16b46f6fb9 100644 --- a/crates/tools/src/guides/tests.rs +++ b/crates/tools/src/guides/tests.rs @@ -714,6 +714,81 @@ fn pen_click_near_a_glyph_anchor_lands_on_it() { assert!(q.distance(anchor) > 1e-3, "{q:?} landed on the glyph anchor with Smart Guides off"); } +/// Snap to Glyph: the Parametric Shape tool's center (a drag and a double-click) and the point +/// dragged out from it, and the Slice tool's corners, land on a glyph's anchor point as a Pen +/// click does, with the guides shown while hovering, and not with Snap to Glyph off. +#[test] +fn parametric_shape_and_slice_points_land_on_a_glyph_anchor() { + use crate::addons::parametric_shape::ParametricShapeTool; + use crate::slice::SliceTool; + use crate::{Action, PointerEvent, PointerKind, Tool}; + let (d, t) = glyph_doc("H", 0.0); + let lay = layout_text(FontDb::global(), &t); + let g = lay.glyphs.iter().find(|g| !g.outline.elements().is_empty()).expect("a glyph with an outline"); + // An anchor inside the glyph's bounds, which no glyph bounds line passes through. + let bb = g.outline.bounding_box(); + let inside = |p: Point| p.x > bb.x0 + 1.0 && p.x < bb.x1 - 1.0 && p.y > bb.y0 + 1.0 && p.y < bb.y1 - 1.0; + let anchor = t.xf * g.outline.segments().map(|s| s.start()).find(|p| inside(*p)).expect("an anchor inside the glyph"); + let (s, p) = (Selection::default(), paint()); + let click = anchor + Vec2::new(1.5, -1.0); + let ev = |kind, q: Point| PointerEvent::new(kind, q.x, q.y); + let center = |v: &serde_json::Value| Point::new(v["center"][0].as_f64().unwrap(), v["center"][1].as_f64().unwrap()); + // A press away from the type, for drags that end at the click. + let away = anchor + Vec2::new(-83.3, -61.7); + for glyphs in [true, false] { + let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &s, &p) }; + let lands = |q: Point| q.distance(anchor) < 1e-9; + // A Parametric Shape drawn out from the click. + let mut tool = ParametricShapeTool::default(); + tool.pointer(&c, &ev(PointerKind::Down, click)); + let acts = tool.pointer(&c, &ev(PointerKind::Drag, click + Vec2::new(80.0, 60.0))); + let Some(Action::Preview(_, v)) = acts.first() else { panic!("{acts:?}") }; + assert_eq!(lands(center(v)), glyphs, "drag, Snap to Glyph {glyphs}: {:?} vs {anchor:?}", center(v)); + // A Parametric Shape dragged out to the click is sized and turned as one dragged out to + // the anchor itself. + let drawn_to = |q: Point| { + let mut tool = ParametricShapeTool::default(); + tool.pointer(&c, &ev(PointerKind::Down, away)); + tool.pointer(&c, &ev(PointerKind::Drag, q)) + }; + assert_eq!(drawn_to(click) == drawn_to(anchor), glyphs, "dragged point, Snap to Glyph {glyphs}"); + // A click 3 px from the anchor draws nothing, though its center snaps onto the anchor. + let near = anchor + Vec2::new(2.5, -1.5); + let mut tool = ParametricShapeTool::default(); + tool.pointer(&c, &ev(PointerKind::Down, near)); + let acts = tool.pointer(&c, &ev(PointerKind::Drag, near)); + let Some(Action::Preview(_, v)) = acts.first() else { panic!("{acts:?}") }; + assert_eq!(lands(center(v)), glyphs, "click, Snap to Glyph {glyphs}: {:?} vs {anchor:?}", center(v)); + assert_eq!(tool.pointer(&c, &ev(PointerKind::Up, near)), vec![Action::Cancel], "click, Snap to Glyph {glyphs}"); + // One placed with a double-click. + let mut tool = ParametricShapeTool::default(); + let acts = tool.pointer(&c, &ev(PointerKind::DoubleClick, click)); + let Some(Action::Exec(_, v)) = acts.first() else { panic!("{acts:?}") }; + assert_eq!(lands(center(v)), glyphs, "double-click, Snap to Glyph {glyphs}: {:?} vs {anchor:?}", center(v)); + // The pointer hovering at the click shows the guides of the anchor it would land on. + let mut tool = ParametricShapeTool::default(); + tool.pointer(&c, &ev(PointerKind::Move, click)); + assert_eq!(!tool.overlays(&c).is_empty(), glyphs, "hover, Snap to Glyph {glyphs}"); + // A slice dragged from the click down and to the right starts at its top-left corner. + let mut tool = SliceTool::default(); + tool.pointer(&c, &ev(PointerKind::Move, click)); + assert_eq!(!tool.overlays(&c).is_empty(), glyphs, "slice hover, Snap to Glyph {glyphs}"); + tool.pointer(&c, &ev(PointerKind::Down, click)); + let acts = tool.pointer(&c, &ev(PointerKind::Drag, click + Vec2::new(80.0, 60.0))); + let Some(Action::Preview(_, v)) = acts.get(1) else { panic!("{acts:?}") }; + let corner = Point::new(v["x"].as_f64().unwrap(), v["y"].as_f64().unwrap()); + assert_eq!(lands(corner), glyphs, "slice, Snap to Glyph {glyphs}: {corner:?} vs {anchor:?}"); + // One dragged from up and to the left ends at its bottom-right corner. + let mut tool = SliceTool::default(); + tool.pointer(&c, &ev(PointerKind::Down, away)); + let acts = tool.pointer(&c, &ev(PointerKind::Drag, click)); + let Some(Action::Preview(_, v)) = acts.get(1) else { panic!("{acts:?}") }; + let f = |k: &str| v[k].as_f64().unwrap(); + let end = Point::new(f("x") + f("width"), f("y") + f("height")); + assert_eq!(end.distance(anchor) < 1e-6, glyphs, "slice end, Snap to Glyph {glyphs}: {end:?} vs {anchor:?}"); + } +} + /// Snap to Glyph: a single line of type has an x-height guide; a paragraph shows glyph bounds only. #[test] fn drawn_points_line_up_with_the_x_height_of_a_single_line() { @@ -953,6 +1028,124 @@ fn a_drawn_point_lands_on_a_corner_of_a_glyphs_bounds() { } } +/// Snap to Glyph: both ends of a gradient vector drawn on the art with the Gradient tool, a click +/// that applies one, and its dragged start and end handles, land on a glyph's anchor point as a +/// Pen click does, with the guides shown while hovering, and not with Snap to Glyph off. A drawn +/// end also lands on a slanted path's segment, which no bounds line passes along, and on a +/// construction guide through its start, and with Shift on an anchor along its 45° step. With nothing +/// selected, hovering off the art shows no guides. A press that snaps still starts a drag only +/// after the pointer moves 3 px from where it was pressed. +#[test] +fn gradient_vector_ends_land_on_a_glyph_anchor() { + use crate::xform::GradientTool; + use crate::{Action, PointerEvent, PointerKind, Tool}; + use vectorcraft_color::{Gradient, GradientGeom, GradientPaint, Paint}; + use vectorcraft_doc::Appearance; + use vectorcraft_geom::shapes; + let (mut d, t) = glyph_doc("H", 0.0); + let lay = layout_text(FontDb::global(), &t); + let g = lay.glyphs.iter().find(|g| !g.outline.elements().is_empty()).expect("a glyph with an outline"); + // An anchor inside the glyph's bounds, which no glyph bounds line passes through. + let bb = g.outline.bounding_box(); + let inside = |p: Point| p.x > bb.x0 + 1.0 && p.x < bb.x1 - 1.0 && p.y > bb.y0 + 1.0 && p.y < bb.y1 - 1.0; + let anchor = t.xf * g.outline.segments().map(|s| s.start()).find(|p| inside(*p)).expect("an anchor inside the glyph"); + let type_id = d.children(Some(d.layers[0].id)).unwrap()[0].id; + // A rectangle away from the type, with a gradient from (300, 100) to (400, 100). + let (l, rect) = (d.layers[0].id, d.alloc_id()); + d.insert(Some(l), 0, Node::path(rect, shapes::rectangle(Rect::new(300.0, 50.0, 400.0, 150.0)), Appearance::default_art())).unwrap(); + let mut gp = GradientPaint::new(Gradient::default()); + gp.geom = Some(GradientGeom { start: Point::new(300.0, 100.0), end: Point::new(400.0, 100.0), aspect: 1.0, focal: None }); + d.node_mut(rect).unwrap().appearance.set_fill(Paint::Gradient(Box::new(gp))); + // A slanted line, its middle far from its bounds' edges. + let (a0, a1) = (Point::new(200.0, 420.0), Point::new(280.0, 480.0)); + let line = d.alloc_id(); + d.insert(Some(l), 0, Node::path(line, shapes::line(a0, a1), Appearance::default_art())).unwrap(); + let mut on_type = Selection::default(); + on_type.add(type_id); + let mut on_rect = Selection::default(); + on_rect.add(rect); + let p = paint(); + let click = anchor + Vec2::new(1.5, -1.0); + let away = anchor + Vec2::new(-83.3, -61.7); + let ev = |kind, q: Point| PointerEvent::new(kind, q.x, q.y); + let preview = |acts: &[Action]| { + acts.iter().find_map(|a| if let Action::Preview(_, v) = a { Some(v.clone()) } else { None }).unwrap_or_else(|| panic!("{acts:?}")) + }; + let at = |v: &serde_json::Value| Point::new(v[0].as_f64().unwrap(), v[1].as_f64().unwrap()); + for glyphs in [true, false] { + let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &on_type, &p) }; + let lands = |q: Point| q.distance(anchor) < 1e-9; + // The pointer hovering at the click shows the guides of the anchor a vector would start on. + let mut tool = GradientTool::default(); + tool.pointer(&c, &ev(PointerKind::Move, click)); + assert_eq!(!tool.overlays(&c).is_empty(), glyphs, "hover, Snap to Glyph {glyphs}"); + // A vector drawn from the click starts on the anchor. + tool.pointer(&c, &ev(PointerKind::Down, click)); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click + Vec2::new(80.0, 60.0)))); + assert_eq!(lands(at(&v["start"])), glyphs, "start, Snap to Glyph {glyphs}: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, click + Vec2::new(80.0, 60.0))); + // One drawn to beside the slanted line, a quarter of the way along (15 pt or more from its + // bounds' edges, centre and anchors), ends on the line. + let dir = (a1 - a0) / (a1 - a0).hypot(); + let quarter = a0 + (a1 - a0) * 0.25; + tool.pointer(&c, &ev(PointerKind::Down, away)); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, quarter + Vec2::new(-dir.y, dir.x) * 2.0))); + assert!((at(&v["end"]) - a0).cross(dir).abs() < 1e-6, "end on the line: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, quarter)); + // One drawn to the click ends on it. + tool.pointer(&c, &ev(PointerKind::Down, away)); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click))); + assert_eq!(lands(at(&v["end"])), glyphs, "end, Snap to Glyph {glyphs}: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, click)); + // A click at the click applies a gradient that starts on the anchor. + tool.pointer(&c, &ev(PointerKind::Down, click)); + let acts = tool.pointer(&c, &ev(PointerKind::Up, click)); + let v = acts.iter().find_map(|a| if let Action::Exec(_, v) = a { Some(v.clone()) } else { None }).unwrap_or_else(|| panic!("{acts:?}")); + assert_eq!(lands(at(&v["start"])), glyphs, "click, Snap to Glyph {glyphs}: {v}"); + // One drawn to 2 px below the horizontal through its start, far from any target, ends on + // that construction guide, as a Line Segment's end does. + tool.pointer(&c, &ev(PointerKind::Down, away)); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, away + Vec2::new(150.0, 2.0)))); + assert!((at(&v["end"]).y - away.y).abs() < 1e-9, "end on the construction guide: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, away + Vec2::new(150.0, 2.0))); + // With Shift, one drawn at 45° toward the line's first anchor slides along that step onto it. + let shift = |kind, q: Point| PointerEvent { mods: crate::Mods { shift: true, ..Default::default() }, ..ev(kind, q) }; + tool.pointer(&c, &shift(PointerKind::Down, a0 + Vec2::new(60.0, -60.0))); + let v = preview(&tool.pointer(&c, &shift(PointerKind::Drag, a0 + Vec2::new(-1.5, 0.5)))); + assert!(at(&v["end"]).distance(a0) < 1e-9, "Shift end on the anchor: {v}"); + tool.pointer(&c, &shift(PointerKind::Up, a0)); + // A press 3 px from the anchor, then a move of 2 px away from it: no drag yet. + let near = anchor + Vec2::new(2.5, -1.5); + tool.pointer(&c, &ev(PointerKind::Down, near)); + let acts = tool.pointer(&c, &ev(PointerKind::Drag, near + Vec2::new(1.5, -1.0))); + assert!(acts.is_empty(), "drag start, Snap to Glyph {glyphs}: {acts:?}"); + tool.pointer(&c, &ev(PointerKind::Up, near + Vec2::new(1.5, -1.0))); + // The end handle of the rectangle's gradient dragged to the click lands on the anchor. + let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &on_rect, &p) }; + let mut tool = GradientTool::default(); + // Hovering over the handle (on the rectangle's edge) shows no guides. + tool.pointer(&c, &ev(PointerKind::Move, Point::new(400.0, 100.0))); + assert!(!tool.overlays(&c).iter().any(|o| matches!(o, Overlay::Label { .. })), "hover over the handle"); + tool.pointer(&c, &ev(PointerKind::Down, Point::new(400.0, 100.0))); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click))); + assert_eq!(lands(at(&v["end"])), glyphs, "end handle, Snap to Glyph {glyphs}: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, click)); + // The start handle dragged to the click lands on the anchor. + tool.pointer(&c, &ev(PointerKind::Down, Point::new(300.0, 100.0))); + let v = preview(&tool.pointer(&c, &ev(PointerKind::Drag, click))); + assert_eq!(lands(at(&v["start"])), glyphs, "start handle, Snap to Glyph {glyphs}: {v}"); + tool.pointer(&c, &ev(PointerKind::Up, click)); + // With nothing selected, hovering beside the rectangle (off the art and its 1 pt stroke, + // where a press draws nothing, but within the snapping tolerance of its edge) shows no + // guides. + let none = Selection::default(); + let c = ToolContext { snap_to_glyph: glyphs, ..cx(&d, &none, &p) }; + let mut tool = GradientTool::default(); + tool.pointer(&c, &ev(PointerKind::Move, Point::new(296.2, 75.0))); + assert!(tool.overlays(&c).is_empty(), "hover off the art: {:?}", tool.overlays(&c)); + } +} + /// With Smart Guides off, View → Snap to Point still pulls a drawn point onto an anchor, but /// draws no Smart Guides: no "anchor" label, no lines. #[test] diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs index 3ee1d48256..1119bb0764 100644 --- a/crates/tools/src/lib.rs +++ b/crates/tools/src/lib.rs @@ -624,8 +624,16 @@ mod cursor_tests { /// Use Precise Cursors turns it into the crosshair. #[test] fn drawing_tools_show_their_own_cursor() { - let (d, _) = doc_with_rect(); + let (d, rect) = doc_with_rect(); let away = Point::new(400.0, 400.0); + // The Smooth tool shows its own cursor only with a selected path (Not Allowed without one). + let mut selected = Selection::default(); + selected.set([rect]); + let paint = paint(); + let cursor_of = |id: &str| match id { + "smooth" => create(id).cursor(&cx(&d, &selected, &paint), away, Mods::default()), + _ => cursor_at(id, &d, away), + }; for (id, c) in [ ("lasso", Cursor::Lasso), (addons::enclosing_lasso::ID, Cursor::Lasso), @@ -651,7 +659,7 @@ mod cursor_tests { ("symbolStyler", Cursor::SymbolStyler), ("mesh", Cursor::MeshAdd), ] { - assert_eq!(cursor_at(id, &d, away), c, "{id}"); + assert_eq!(cursor_of(id), c, "{id}"); assert_eq!(c.precise(), Cursor::Crosshair, "{id}"); // The Blob Brush's and the Eraser's dot is drawn: their tip outline goes round it. The // Live Paint Bucket's bucket is drawn. diff --git a/crates/tools/src/select.rs b/crates/tools/src/select.rs index 70060ebc2b..76e4a5c977 100644 --- a/crates/tools/src/select.rs +++ b/crates/tools/src/select.rs @@ -94,6 +94,9 @@ enum State { /// The point that snaps, moving with the pointer: `start`, or where a press on a path's /// stroke or beside its edge took hold of the path ([`hold_point`]). hold: Point, + /// The press grabbed the selection by an anchor (`start`): it snaps as + /// [`MoveSnap::by_anchor`] says. + by_anchor: bool, began: bool, /// Shift-pressed on this selected object: released without a drag, it leaves the /// selection. @@ -247,13 +250,24 @@ pub(crate) struct MoveSnap { impl MoveSnap { pub(crate) fn new(cx: &ToolContext) -> Self { + Self::gather(cx, Targets::for_move) + } + + /// [`Self::new`] for a selection grabbed by one of its anchors: with Smart Guides, that anchor + /// also lands on the other art's paths and where they cross (#7411), as Direct Selection lands + /// an anchor it drags. + pub(crate) fn by_anchor(cx: &ToolContext) -> Self { + Self::gather(cx, Targets::for_move_by_anchor) + } + + fn gather(cx: &ToolContext, for_move: fn(&ToolContext, &[NodeId]) -> Targets) -> Self { let guides = cx.smart_guides && !cx.snap_to_grid; let points = |exclude: &[NodeId]| if cx.snap_to_grid { None } else { Targets::snap_to_point(cx, exclude) }; Self { bounds: selection_bounds(cx), - targets: guides.then(|| Targets::for_move(cx, &cx.selection.objects)), + targets: guides.then(|| for_move(cx, &cx.selection.objects)), points: points(&cx.selection.objects), - copy_targets: guides.then(|| Targets::for_move(cx, &[])), + copy_targets: guides.then(|| for_move(cx, &[])), copy_points: points(&[]), rulers: (guides && cx.snap_to_point).then(|| Targets::rulers(cx)), } @@ -286,6 +300,9 @@ impl MoveSnap { } // The axes (x, y) Smart Guides already put in line with other art. let mut taken = [false; 2]; + // The grabbed anchor landed on a path or a crossing, which a ruler guide does not pull + // it off. + let mut on_path = false; if let (Some(t), Some(b)) = (targets, self.bounds) { // The point the selection was grabbed by, near another object's anchor or centre, // lands on it, rather than the bounds lining up a little beside it (#955). @@ -294,6 +311,13 @@ impl MoveSnap { d = q - start; guides = ov; taken = [true; 2]; + } else if let Some((q, ov)) = t.snap_onto_path(start + d, cx.snap_tol(), self.rulers.as_ref()) { + // Grabbed by an anchor ([`Self::by_anchor`]), it lands on a path near it, or where + // the path crosses another or a ruler guide, instead of lining the bounds up. + d = q - start; + guides = ov; + taken = [true; 2]; + on_path = true; } else { let (adj, ov, axes) = t.snap_rects_axes(&[b + d], cx.snap_tol()); d += adj; @@ -304,7 +328,7 @@ impl MoveSnap { // A ruler guide within reach of the grabbed point wins over lining the bounds up; on an // axis without one that Smart Guides left free, the bounds line up with the ruler guides // (#5746), alongside the Smart Guides. - if let Some(t) = &self.rulers { + if let Some(t) = self.rulers.as_ref().filter(|_| !on_path) { let (adj, ov, held) = t.snap_moved_to_rulers(start + d, self.bounds.map(|b| b + d), cx.snap_tol(), taken); if adj != Vec2::ZERO { d += adj; @@ -681,6 +705,15 @@ impl SelectionTool { }) } + /// The point a press `ev` grabs the selection by ([`Self::hover_point`]), and whether it is an + /// anchor. Nothing for other pointer events. + fn grabbed_at(cx: &ToolContext, ev: &PointerEvent) -> (Option, bool) { + match ev.kind { + PointerKind::Down => Self::hover_point(cx, ev.pos).map_or((None, false), |(q, label)| (Some(q), label == "anchor")), + _ => (None, false), + } + } + /// On a press, notes the text the pointer is loaded with ([`Self::loaded_at_press`]); a /// release clears it. fn note_loaded_at_press(&mut self, kind: PointerKind) { @@ -913,7 +946,7 @@ impl Tool for SelectionTool { let m = ev.mods; // A press near a centre or an anchor grabs the object by it. self.hover = None; - let grabbed = if matches!(ev.kind, PointerKind::Down) { Self::hover_point(cx, p).map(|(q, _)| q) } else { None }; + let (grabbed, by_anchor) = Self::grabbed_at(cx, ev); let grab = grabbed.unwrap_or(p); if matches!(ev.kind, PointerKind::Move) && matches!(self.state, State::Idle) { self.hover = Self::hover_point(cx, p); @@ -939,7 +972,7 @@ impl Tool for SelectionTool { { let several = cx.selection.objects.len() > 1 || !cx.selection.guides.is_empty(); let (deselect, key) = if m.shift { (Some(id), None) } else { (None, (several && !m.alt).then_some(id)) }; - self.state = State::Moving { start: p, press: p, hold: center, began: false, deselect, key, exclude: None }; + self.state = State::Moving { start: p, press: p, hold: center, by_anchor: false, began: false, deselect, key, exclude: None }; return vec![]; } // 3. Objects: Cmd/Ctrl-click selects the one under the selected one (cycling). @@ -947,7 +980,8 @@ impl Tool for SelectionTool { && cx.select_behind && let Some(behind) = object_behind(cx, p) { - self.state = State::Moving { start: p, press: p, hold: p, began: false, deselect: None, key: None, exclude: None }; + self.state = + State::Moving { start: p, press: p, hold: p, by_anchor: false, began: false, deselect: None, key: None, exclude: None }; return vec![Action::Exec("select.set".into(), json!({ "ids": [behind.0] }))]; } let (hit, scope) = match selected_source_hit(cx, p) { @@ -969,17 +1003,17 @@ impl Tool for SelectionTool { // Grabbed by no anchor or centre, a press on a path's stroke or beside its // edge holds the path there, and that point of it snaps (#3701). let hold = if grabbed.is_some() { grab } else { hold_point(cx, &h, p) }; - self.state = State::Moving { start: grab, press: p, hold, began: false, deselect, key, exclude }; + self.state = State::Moving { start: grab, press: p, hold, by_anchor, began: false, deselect, key, exclude }; out } None => { - self.press_nothing(cx, p, grab, m); + self.press_nothing(cx, p, grab, by_anchor, m); vec![] } } } - (PointerKind::Drag, State::Moving { start, press, hold, began, exclude, .. }) => { - self.drag_moving(cx, p, m, ev.backquote, (start, press, hold, began), exclude) + (PointerKind::Drag, State::Moving { start, press, hold, by_anchor, began, exclude, .. }) => { + self.drag_moving(cx, p, m, ev.backquote, (start, press, hold, by_anchor, began), exclude) } (PointerKind::Drag, State::Scaling { handle, bx, areas }) => { self.last_backquote = ev.backquote; @@ -1679,9 +1713,10 @@ impl SelectionTool { /// A press at `p` that hits no object starts a marquee, except where a clipping mask hides /// the art of a selected object (picked in the Layers panel, say): there, without Shift, it /// grabs the selection by that art (at `grab`), as a press on its visible part does. - fn press_nothing(&mut self, cx: &ToolContext, p: Point, grab: Point, m: Mods) { + /// `by_anchor`: `grab` is an anchor of it. + fn press_nothing(&mut self, cx: &ToolContext, p: Point, grab: Point, by_anchor: bool, m: Mods) { self.state = if !m.shift && selected_hidden_at(cx.doc, p, cx.selection_hit_options(), &cx.selection.objects).is_some() { - State::Moving { start: grab, press: p, hold: grab, began: false, deselect: None, key: None, exclude: None } + State::Moving { start: grab, press: p, hold: grab, by_anchor, began: false, deselect: None, key: None, exclude: None } } else { State::Marquee { start: p, cur: p, toggle: m.shift, enclosed: false, directional_inside: false } }; @@ -1693,7 +1728,7 @@ impl SelectionTool { p: Point, m: Mods, backquote: bool, - (start, press, hold, began): (Point, Point, Point, bool), + (start, press, hold, by_anchor, began): (Point, Point, Point, bool, bool), exclude: Option<(NodeId, NodeId)>, ) -> Vec { let mut out = vec![]; @@ -1701,6 +1736,7 @@ impl SelectionTool { if p.distance(press) < Self::drag_threshold(cx) { return out; } + let gather = if by_anchor { MoveSnap::by_anchor } else { MoveSnap::new }; // A Shift-drag from a highlighted object of the Global Edit selects it and moves it // with the selection: its snap targets are gathered for the selection with it. self.moving = Some(match exclude { @@ -1708,9 +1744,9 @@ impl SelectionTool { out.push(Action::Exec("select.toggle".into(), json!({ "id": top.0 }))); let mut selection = cx.selection.clone(); selection.add(top); - MoveSnap::new(&ToolContext { selection: &selection, ..*cx }) + gather(&ToolContext { selection: &selection, ..*cx }) } - None => MoveSnap::new(cx), + None => gather(cx), }); out.push(Action::Begin(if m.alt { "Copy".into() } else { "Move".into() })); } @@ -1721,7 +1757,7 @@ impl SelectionTool { } // Shift has already constrained `d`: any change is a snap. self.snapped = (d - unsnapped).hypot() > 1e-9; - self.state = State::Moving { start, press, hold, began: true, deselect: None, key: None, exclude: None }; + self.state = State::Moving { start, press, hold, by_anchor, began: true, deselect: None, key: None, exclude: None }; self.measure = cx.measurement_labels.then(|| (p, cx.offset_label(d.x, d.y))); let mut params = json!({ "matrix": matrix_json(Affine::translate(d)), "copy": m.alt }); if backquote { diff --git a/crates/tools/src/select/tests.rs b/crates/tools/src/select/tests.rs index 63ca697c7d..b7af316571 100644 --- a/crates/tools/src/select/tests.rs +++ b/crates/tools/src/select/tests.rs @@ -171,6 +171,94 @@ fn a_move_grabbed_by_an_anchor_lands_it_on_another_anchor() { assert!((200.0 + x - 350.3).abs() < 1e-9 && (200.0 + y - 250.0).abs() < 1e-9, "the corner lands at ({}, {})", 200.0 + x, 200.0 + y); } +/// A document with the rectangle of [`doc_with_rect`] (100..200 square) and a straight path from +/// `a` to `b` for each pair, and the rectangle's id. +fn doc_with_rect_and_lines(lines: &[(Point, Point)]) -> (vectorcraft_doc::Document, NodeId) { + let (mut d, id) = doc_with_rect(); + let l = d.layers[0].id; + for &(a, b) in lines { + let n = d.alloc_id(); + let path = vectorcraft_geom::PathData::single(vectorcraft_geom::SubPath::polyline(&[a, b], false)); + d.insert(Some(l), 1, vectorcraft_doc::Node::path(n, path, vectorcraft_doc::Appearance::default_art())).unwrap(); + } + (d, id) +} + +/// The rectangle of `d` grabbed at `(gx, gy)` (hovered first, so a press near an anchor grabs it) +/// and dragged to `to`, with Smart Guides on or off (`smart`): the point it was grabbed at after the +/// move, and the label shown. +fn grabbed_and_dragged(d: &vectorcraft_doc::Document, id: NodeId, smart: bool, (gx, gy): (f64, f64), to: (f64, f64)) -> (Point, Option) { + let (none, mut picked, p) = (Selection::default(), Selection::default(), paint()); + picked.add(id); + let (before, after) = (ToolContext { smart_guides: smart, ..cx(d, &none, &p) }, ToolContext { smart_guides: smart, ..cx(d, &picked, &p) }); + let mut t = SelectionTool::default(); + t.pointer(&before, &ev(PointerKind::Move, gx, gy)); + t.pointer(&before, &ev(PointerKind::Down, gx, gy)); + let a = t.pointer(&after, &ev(PointerKind::Drag, to.0, to.1)); + let Some(Action::Preview(_, v)) = a.iter().find(|a| matches!(a, Action::Preview(..))) else { panic!("{a:?}") }; + let start = SelectionTool::hover_point(&before, Point::new(gx, gy)).map_or(Point::new(gx, gy), |(q, _)| q); + let label = t.overlays(&after).iter().find_map(|o| match o { + Overlay::Label { text, .. } => Some(text.clone()), + _ => None, + }); + (start + Vec2::new(v["matrix"][4].as_f64().unwrap(), v["matrix"][5].as_f64().unwrap()), label) +} + +/// #7411: grabbed by an anchor and dropped near a point along another path, away from its anchors +/// and center, the anchor lands on the path ("path") with Smart Guides. A selection grabbed +/// elsewhere, or with Smart Guides off, does not land on the path. +#[test] +fn a_move_grabbed_by_an_anchor_lands_it_on_another_path() { + let (a, b) = (Point::new(300.0, 400.0), Point::new(500.0, 300.0)); + let (d, id) = doc_with_rect_and_lines(&[(a, b)]); + let off_line = |q: Point| ((b - a).cross(q - a) / (b - a).hypot()).abs(); + // Grab the rectangle by its bottom-right corner (200, 200) and drop it half a point beside + // the line, at (430, 335) on it. + let (corner, label) = grabbed_and_dragged(&d, id, true, (201.0, 201.0), (430.0, 335.5)); + assert!(off_line(corner) < 1e-9, "the corner lands at {corner:?}, {} off the line", off_line(corner)); + assert!((corner.x - 430.0).abs() < 0.5, "{corner:?}"); + assert_eq!(label.as_deref(), Some("path")); + // Grabbed by its fill instead, the pointer stays half a point beside the line. + let (grip, _) = grabbed_and_dragged(&d, id, true, (150.0, 170.0), (430.0, 335.5)); + assert!(off_line(grip) > 0.4, "the grip lands at {grip:?}"); + // With Smart Guides off, the corner stays where it was dragged. + let (corner, _) = grabbed_and_dragged(&d, id, false, (201.0, 201.0), (430.0, 335.5)); + assert!(off_line(corner) > 0.4, "the corner lands at {corner:?}"); +} + +/// #7411: a selection grabbed by an anchor lands it where two other paths cross ("intersect"), and +/// on another object's anchor near the path rather than on the path. +#[test] +fn a_move_grabbed_by_an_anchor_lands_it_where_paths_cross() { + let (d, id) = + doc_with_rect_and_lines(&[(Point::new(300.0, 400.0), Point::new(500.0, 300.0)), (Point::new(460.0, 250.0), Point::new(460.0, 420.0))]); + let (corner, label) = grabbed_and_dragged(&d, id, true, (201.0, 201.0), (460.4, 320.5)); + assert!(corner.distance(Point::new(460.0, 320.0)) < 1e-9, "the corner lands at {corner:?}"); + assert_eq!(label.as_deref(), Some("intersect")); + // The end of the upright path (460, 250) is an anchor: the corner lands on it. + let (corner, label) = grabbed_and_dragged(&d, id, true, (201.0, 201.0), (460.5, 251.0)); + assert!(corner.distance(Point::new(460.0, 250.0)) < 1e-9, "the corner lands at {corner:?}"); + assert_eq!(label.as_deref(), Some("anchor")); +} + +/// #7411: a selection grabbed by an anchor lands it where another path crosses a ruler guide +/// ("intersect"), and a ruler guide running past does not pull it off a path it landed on. +#[test] +fn a_move_grabbed_by_an_anchor_lands_it_where_a_path_crosses_a_ruler_guide() { + let (a, b) = (Point::new(300.0, 400.0), Point::new(500.0, 300.0)); + let (mut d, id) = doc_with_rect_and_lines(&[(a, b)]); + d.add_ruler_guide(&vectorcraft_doc::Guide::new(true, 440.0)); + let (corner, label) = grabbed_and_dragged(&d, id, true, (201.0, 201.0), (440.5, 330.5)); + assert!(corner.distance(Point::new(440.0, 330.0)) < 1e-9, "the corner lands at {corner:?}"); + assert_eq!(label.as_deref(), Some("intersect")); + // Beyond reach of the crossing, the corner stays on the path with the guide 3.7 points beside + // it. + let off_line = |q: Point| ((b - a).cross(q - a) / (b - a).hypot()).abs(); + let (corner, label) = grabbed_and_dragged(&d, id, true, (201.0, 201.0), (436.43, 332.12)); + assert!(off_line(corner) < 1e-9, "the corner lands at {corner:?}"); + assert_eq!(label.as_deref(), Some("path")); +} + /// #3716: a press a few pixels from an anchor grabs the object by that anchor, but the drag /// threshold counts from where the pointer went down. A click that wobbles by a pixel selects /// the object without moving it, instead of jumping the anchor onto the pointer. diff --git a/crates/tools/src/slice.rs b/crates/tools/src/slice.rs index 0f804a8ef6..c4062123e8 100644 --- a/crates/tools/src/slice.rs +++ b/crates/tools/src/slice.rs @@ -14,7 +14,7 @@ use vectorcraft_doc::{NodeId, OrientedBox, SliceSource}; use vectorcraft_geom::{Affine, Point, Rect, Vec2}; use crate::bbox::{Handle, hit_handle, move_delta, scale_for_drag}; -use crate::guides::{PointSnap, Targets}; +use crate::guides::{DrawSnap, PointSnap, Targets}; use crate::shape::drag_rect; use crate::xform::{BLUE, polygon, rect_corners}; use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey, json_ids}; @@ -37,9 +37,26 @@ fn has_area(r: Rect) -> bool { r.width() > 1e-6 && r.height() > 1e-6 } -/// Snap `p` as the drawing tools do, then to the nearest ruler guide within reach (guides win). -fn snap(cx: &ToolContext, p: Point) -> (Point, Vec) { - let (mut q, ov) = crate::guides::snap_draw(cx, p, &[]); +/// When the Slice tool snaps a point. +#[derive(Clone, Copy, PartialEq)] +enum Phase { + /// The pointer hovers before a press. + Hover, + /// The first corner is pressed: the targets are gathered afresh. + Press, + /// The other corner is dragged: the press's targets are kept. + Drag, +} + +/// Snap `p` as the drawing tools do ([`DrawSnap`]), then to the nearest ruler guide within reach +/// (guides win, and the Smart Guides are then not shown). +fn snap(draw: &mut DrawSnap, cx: &ToolContext, p: Point, phase: Phase) -> (Point, Vec) { + let mut q = match phase { + Phase::Hover => draw.hover(cx, p, &[], None), + Phase::Press => draw.press(cx, p, &[], None), + Phase::Drag => draw.drag(cx, p, None), + }; + let mut ov = draw.guides().to_vec(); let tol = cx.tol(5.0); let guides = cx.doc.ruler_guides(); let nearest = |vertical: bool, v: f64| { @@ -50,9 +67,11 @@ fn snap(cx: &ToolContext, p: Point) -> (Point, Vec) { }; if let Some(g) = nearest(true, p.x) { q.x = g.pos; + ov.clear(); } if let Some(g) = nearest(false, p.y) { q.y = g.pos; + ov.clear(); } (q, ov) } @@ -64,6 +83,8 @@ pub struct SliceTool { last: Point, began: bool, guides: Vec, + /// Smart Guides for the slice's corners, and for the pointer hovering before a press. + snap: DrawSnap, } impl Tool for SliceTool { @@ -77,14 +98,20 @@ impl Tool for SliceTool { fn pointer(&mut self, cx: &ToolContext, ev: &PointerEvent) -> Vec { match ev.kind { + PointerKind::Move => { + if self.start.is_none() { + self.guides = snap(&mut self.snap, cx, ev.pos, Phase::Hover).1; + } + vec![] + } PointerKind::Down => { - let (p, _) = snap(cx, ev.pos); - (self.start, self.last, self.began) = (Some(p), p, false); + let (p, guides) = snap(&mut self.snap, cx, ev.pos, Phase::Press); + (self.start, self.last, self.began, self.guides) = (Some(p), p, false, guides); vec![] } PointerKind::Drag => { let Some(start) = self.start else { return vec![] }; - let (p, guides) = snap(cx, ev.pos); + let (p, guides) = snap(&mut self.snap, cx, ev.pos, Phase::Drag); (self.last, self.guides) = (p, guides); let mut out = vec![]; if !self.began { @@ -102,6 +129,7 @@ impl Tool for SliceTool { } PointerKind::Up => { self.guides.clear(); + self.snap.clear(); let began = std::mem::take(&mut self.began); if self.start.take().is_some() && began { vec![Action::Commit] } else { vec![] } } @@ -123,6 +151,8 @@ impl Tool for SliceTool { } o } + // The hovering pointer's Smart Guides. + None => self.guides.clone(), _ => vec![], } } @@ -134,6 +164,7 @@ impl Tool for SliceTool { fn deactivate(&mut self, _cx: &ToolContext) -> Vec { self.start = None; self.guides.clear(); + self.snap.clear(); if std::mem::take(&mut self.began) { vec![Action::Cancel] } else { vec![] } } } @@ -152,8 +183,8 @@ impl Drag { } } -/// What a user slice's handle snaps to, gathered when it is pressed: what the Slice tool's drag -/// snaps to ([`snap`]), the art through [`PointSnap`] and the ruler guides on their own. +/// What a user slice's handle snaps to, gathered when it is pressed: the art's bounds through +/// [`PointSnap`], as a bounding-box handle snaps, and the ruler guides on their own. struct ResizeSnap { art: PointSnap, rulers: Targets, @@ -164,10 +195,10 @@ impl ResizeSnap { Self { art: PointSnap::scaling(cx, || Targets::collect(cx.doc, &[], None)), rulers: Targets::rulers(cx) } } - /// Snap the resize `a` ([`scale_for_drag`]) of the slice `rect` by `handle` as [`snap`] snaps - /// a drawn slice's corner: the handle snaps as a bounding-box handle does - /// ([`PointSnap::snap_scale`]), then a ruler guide within 5 px of where that leaves it takes - /// what the handle moves on its axis. Returns the scale and the guides showing why. + /// Snap the resize `a` ([`scale_for_drag`]) of the slice `rect` by `handle`: the handle snaps + /// as a bounding-box handle does ([`PointSnap::snap_scale`]), then a ruler guide within 5 px of + /// where that leaves it takes what the handle moves on its axis, as [`snap`] does for a drawn + /// slice's corner. Returns the scale and the guides showing why. fn scale(&self, cx: &ToolContext, rect: Rect, handle: Handle, a: Affine, m: Mods) -> (Affine, Vec) { let bx = OrientedBox::aligned(rect); let (a, ov) = self.art.snap_scale(cx, &bx, handle, a, m.shift, m.alt); diff --git a/crates/tools/src/symbolism.rs b/crates/tools/src/symbolism.rs index 1618d6e7d6..580e61d4fd 100644 --- a/crates/tools/src/symbolism.rs +++ b/crates/tools/src/symbolism.rs @@ -238,10 +238,15 @@ impl Default for BrushPaintTool { } impl BrushPaintTool { + /// The tool's brush, else the document's current brush, skipping a name the document's brush + /// library no longer has (a deleted brush), so the stroke is drawn without it. fn brush_name(&self, cx: &ToolContext) -> Option { - self.brush.clone().or_else(|| cx.doc.unknown.get("currentBrush").and_then(Value::as_str).map(str::to_string)) + [self.brush.clone(), vectorcraft_brush::current(cx.doc)].into_iter().flatten().find(|n| vectorcraft_brush::find(cx.doc, n).is_some()) } fn map(&self, cx: &ToolContext, acts: Vec) -> Vec { + if !acts.iter().any(|a| matches!(a, Action::Preview(c, _) if c == "path.freehand")) { + return acts; + } let Some(b) = self.brush_name(cx) else { return acts }; acts.into_iter() .map(|a| match a { @@ -403,4 +408,23 @@ mod tests { t.set_option("brush", &json!("Dots")); assert_eq!(t.options()["brush"], "Dots"); } + + #[test] + fn paintbrush_skips_a_brush_the_document_does_not_have() { + let (mut d, _) = doc_with_rect(); + let (s, p) = (Selection::default(), paint()); + let drag = |d: &vectorcraft_doc::Document, t: &mut BrushPaintTool| { + let cx = cx(d, &s, &p); + t.pointer(&cx, &PointerEvent::new(PointerKind::Down, 0.0, 0.0)); + t.pointer(&cx, &PointerEvent::new(PointerKind::Drag, 30.0, 0.0)).swap_remove(1) + }; + d.unknown.insert("currentBrush".into(), json!("Charcoal")); + let mut t = BrushPaintTool::default(); + t.set_option("brush", &json!("Deleted")); + let a = drag(&d, &mut t); + assert!(matches!(&a, Action::Preview(c, v) if c == "brush.freehand" && v["brush"] == "Charcoal"), "the current brush: {a:?}"); + d.unknown.insert("currentBrush".into(), json!("Also deleted")); + let a = drag(&d, &mut BrushPaintTool::default()); + assert!(matches!(&a, Action::Preview(c, v) if c == "path.freehand" && v.get("brush").is_none()), "no brush: {a:?}"); + } } diff --git a/crates/tools/src/text.rs b/crates/tools/src/text.rs index bd0c229ddf..763325f90e 100644 --- a/crates/tools/src/text.rs +++ b/crates/tools/src/text.rs @@ -134,7 +134,7 @@ fn text_hash(s: &str) -> u64 { h.finish() } -/// The edited text's layout, keyed by the font database's generation and the text. +/// The edited text's layout, keyed by [`vectorcraft_text::layout_inputs`] and the text. type CachedLayout = ((u64, TextObject), Arc); /// Process-global Type-tool edit-session counter: the IME target's replacement epoch. @@ -281,9 +281,9 @@ impl TypeTool { } /// Layout of `t`, cached by content (overlays run every frame) and by the fonts available (the - /// web build adds fonts after startup). + /// web build adds fonts after startup) and the hyphenation exceptions. fn layout(&self, t: &TextObject) -> Arc { - let fonts = FontDb::global().generation(); + let fonts = vectorcraft_text::layout_inputs(); let mut c = self.cache.lock().unwrap_or_else(|e| e.into_inner()); if let Some(((g, k), l)) = c.as_ref() && *g == fonts diff --git a/crates/tools/src/text/ports.rs b/crates/tools/src/text/ports.rs index 554a1cd611..6928fbe6f0 100644 --- a/crates/tools/src/text/ports.rs +++ b/crates/tools/src/text/ports.rs @@ -167,7 +167,8 @@ pub(crate) fn port_near(cx: &ToolContext, p: Point) -> Option<(NodeId, Port, f64 } /// Which selected text overflows, for [`thread_ports`]: each text object's layout verdict kept -/// with the object and the fonts it was made from, as overlays run every frame. +/// with the object and the layout inputs it was made with (fonts and hyphenation exceptions, +/// [`vectorcraft_text::layout_inputs`]), as overlays run every frame. #[derive(Default)] pub struct PortMarks { seen: std::collections::HashMap, @@ -178,7 +179,7 @@ pub struct PortMarks { /// port whether text is hidden by the size of its frame, whatever tool is active. None when more /// than [`PORTS_MAX`] of them are selected. pub fn thread_ports(marks: &mut PortMarks, cx: &ToolContext) -> Vec { - let fonts = FontDb::global().generation(); + let fonts = vectorcraft_text::layout_inputs(); let mut o = Vec::new(); let mut kept = std::collections::HashMap::new(); if !ports_shown(cx.doc, &cx.selection.objects) { diff --git a/crates/tools/src/text/tests.rs b/crates/tools/src/text/tests.rs index a7f302db65..94063166bc 100644 --- a/crates/tools/src/text/tests.rs +++ b/crates/tools/src/text/tests.rs @@ -1538,6 +1538,36 @@ fn selected_type_shows_its_ports_in_each_state() { assert!(thread_ports(&mut marks, &cx(&d, &sel, &p)).is_empty(), "only selected type shows them"); } +/// The out port shows whether the text fits as the hyphenation exceptions lay it out now: when +/// Preferences › Hyphenation › Exceptions change, the selected type is laid out again. +#[test] +fn the_out_port_follows_the_hyphenation_exceptions() { + struct Clear; + impl Drop for Clear { + fn drop(&mut self) { + vectorcraft_text::set_hyphenation_exceptions(""); + } + } + let _clear = Clear; + const WORDS: &str = "Extraordinarily comprehensive typographical considerations notwithstanding everything."; + const NEVER: &str = "extraordinarily, comprehensive, typographical, considerations, notwithstanding"; + let (mut d, id) = crate::testutil::doc_with_area_type(); + // A 70 by 170 pt frame holds the hyphenated text, and the text without those breaks overflows + // it. + let Some(NodeKind::Text(t)) = d.node_mut(id).map(|n| &mut n.kind) else { panic!("not text") }; + t.runs = vec![TextRun::new(WORDS, CharStyle { size: 14.0, ..Default::default() })]; + t.para.hyphenate = true; + t.kind = TextKind::Area { frame: vectorcraft_geom::PathData::from_bezpath(&Rect::new(0.0, 0.0, 70.0, 170.0).to_path(0.1)) }; + let (mut sel, p) = (Selection::default(), paint()); + sel.set([id]); + let mut marks = PortMarks::default(); + let red = |ov: &[Overlay]| ov.iter().filter(|o| matches!(o, Overlay::Path { color: [230, 30, 30], .. })).count(); + vectorcraft_text::set_hyphenation_exceptions(""); + assert_eq!(red(&thread_ports(&mut marks, &cx(&d, &sel, &p))), 0, "the hyphenated text fits"); + vectorcraft_text::set_hyphenation_exceptions(NEVER); + assert_eq!(red(&thread_ports(&mut marks, &cx(&d, &sel, &p))), 1, "the text without those breaks does not"); +} + /// Past [`PORTS_MAX`] selected frames (select all of an opened PDF) no ports are drawn or clicked: /// they would bury the canvas in boxes; up to it every frame has its two. #[test] diff --git a/crates/tools/src/touchtype.rs b/crates/tools/src/touchtype.rs index 172487c197..018a65aefc 100644 --- a/crates/tools/src/touchtype.rs +++ b/crates/tools/src/touchtype.rs @@ -99,7 +99,7 @@ struct Drag { began: bool, } -/// The type object's layout, keyed by the font database's generation and the object. +/// The type object's layout, keyed by [`vectorcraft_text::layout_inputs`] and the object. type CachedLayout = ((u64, TextObject), Arc); #[derive(Default)] @@ -196,9 +196,10 @@ fn char_box(t: &TextObject, lay: &TextLayout, gi: usize) -> Option { } impl TouchTypeTool { - /// Layout of `t`, cached by content (overlays run every frame) and by the fonts available. + /// Layout of `t`, cached by content (overlays run every frame), by the fonts available and by + /// the hyphenation exceptions. fn layout(&self, t: &TextObject) -> Arc { - let fonts = FontDb::global().generation(); + let fonts = vectorcraft_text::layout_inputs(); let mut c = self.cache.lock().unwrap_or_else(|e| e.into_inner()); if let Some(((g, k), l)) = c.as_ref() && *g == fonts diff --git a/crates/tools/src/xform/gradient.rs b/crates/tools/src/xform/gradient.rs index 9c8881b580..9a61c98591 100644 --- a/crates/tools/src/xform/gradient.rs +++ b/crates/tools/src/xform/gradient.rs @@ -7,8 +7,10 @@ //! //! The annotator is a bar from a round start handle to a square end handle. Drag the start handle //! (or the bar) to move the gradient, the end handle to change its length and angle, and just past -//! the end to rotate it. Dragged handles snap to anchors, edges and smart guides; Shift instead -//! constrains the vector to 45° steps from the Constrain Angle preference. Colour stops sit under the bar: click the bar to add +//! the end to rotate it. A vector drawn on the art, a click that applies one, and the dragged +//! handles snap as drawn points do (the anchors and paths of the art, and with Snap to Glyph the +//! guides of live type); Shift keeps the dragged end or handle at 45° steps from the Constrain Angle +//! preference, snapping along that step. Colour stops sit under the bar: click the bar to add //! one, drag one to move it (Alt drags a copy), drag it off the bar to delete it, and drag a //! diamond above the bar to move a midpoint. Double-clicking a stop opens its popover. The //! selected stop (`gradient.selectStop`) is shared with the Gradient and Color panels: Delete or @@ -43,7 +45,7 @@ use vectorcraft_geom::{Affine, Point, Shape, Vec2, constrain_angle_from}; use super::freeform::{self, Annotator as FreeformAnnotator}; use super::paint_owner; -use crate::guides::snap_draw; +use crate::guides::{DrawSnap, Leave}; use crate::{Action, Cursor, Mods, Overlay, PointerEvent, PointerKind, Tool, ToolContext, ToolKey}; const BAR: [u8; 3] = [0x20, 0x20, 0x20]; @@ -239,6 +241,8 @@ struct Gesture { grab: Grab, /// Where the press happened. at: Point, + /// Where a vector drawn on the art starts: the press, snapped. + start: Point, /// Moved past the drag threshold (an interaction is open). began: bool, /// The vector drawn so far (Art drags). @@ -255,8 +259,9 @@ pub struct GradientTool { free: Option, /// The line Lines mode is drawing on a freeform gradient. lines: freeform::Lines, - /// Smart-guide feedback of the handle being dragged. - guides: Vec, + /// Smart Guides for the vector being drawn or the handle being dragged, and for the pointer + /// hovering over the art. + snap: DrawSnap, } /// Overlays of an annotator: the bar, the handles, the midpoint diamonds and a chip per stop; a @@ -378,18 +383,40 @@ impl GradientTool { Some((a, Part::Aspect)) => Grab::Aspect(GradientGeom { aspect: a.geom.aspect.abs(), ..a.geom }), None => { if cx.selection.is_empty() { - let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else { return out }; + let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else { + self.snap.clear(); + return out; + }; out.push(Action::Exec("select.set".into(), json!({ "ids": [paint_owner(cx.doc, h.leaf).0] }))); } Grab::Art } }; - // A vector drawn on the art starts on the snapped point. - let at = if grab == Grab::Art { snap_draw(cx, p, &[]).0 } else { p }; - self.gesture = Some(Gesture { grab, at, began: false, vector: None, stop: None }); + // The targets are gathered for a drag that snaps. A vector drawn on the art starts on the + // snapped point; the drag threshold still counts from the press. + let snaps = matches!(grab, Grab::Art | Grab::Move { .. } | Grab::End(_)); + let snapped = if snaps { self.snap.press(cx, p, &[], None) } else { p }; + let start = if grab == Grab::Art { snapped } else { p }; + if grab != Grab::Art { + self.snap.clear(); + } + self.gesture = Some(Gesture { grab, at: p, start, began: false, vector: None, stop: None }); out } + /// Snap the pointer hovering where a press would draw a vector (anywhere with art selected, + /// over art with nothing selected), to show where the vector starts; no guides over the + /// annotator, elsewhere with nothing selected, or during a press. + fn hover(&mut self, cx: &ToolContext, p: Point) { + let on_annotator = || Annotator::of(cx).is_some_and(|a| a.hit(cx, p).is_some()); + let off_art = || cx.selection.is_empty() && hit_test(cx.doc, p, cx.hit_options()).is_none(); + if self.gesture.is_some() || self.free.is_some() || FreeformAnnotator::of(cx).is_some() || on_annotator() || off_art() { + self.snap.clear(); + } else { + self.snap.hover(cx, p, &[], None); + } + } + fn drag(&mut self, cx: &ToolContext, p: Point, mods: Mods) -> Vec { let Some(g) = &mut self.gesture else { return vec![] }; let mut out = vec![]; @@ -401,23 +428,16 @@ impl GradientTool { out.push(Action::Begin("Gradient".into())); } let constrain = |v: Vec2| constrain_angle_from(v, 45.0, cx.constrain_angle); - // Where a handle dragged to `to` lands: Shift constrains the vector from `from`, else it - // snaps (keeping the guides to show). - let mut guides = vec![]; - let mut place = |from: Point, to: Point| { - if mods.shift { - from + constrain(to - from) - } else { - let (q, o) = snap_draw(cx, to, &[]); - guides = o; - q - } - }; + // Where a handle dragged to `to` lands: it snaps as a drawn segment's end leaving `from` + // does, Shift keeping it at 45° steps from `from` (keeping the guides to show). + let snap = &mut self.snap; + snap.clear(); + let mut place = |from: Point, to: Point| snap.drag(cx, to, Some(&Leave::segment(cx, from, mods.shift))); let (cmd, params) = match &g.grab { Grab::Art => { - let end = place(g.at, p); - g.vector = Some((g.at, end)); - ("paint.setGradientGeom", Self::geom_params(cx, g.at, end)) + let end = place(g.start, p); + g.vector = Some((g.start, end)); + ("paint.setGradientGeom", Self::geom_params(cx, g.start, end)) } Grab::Move { geom, .. } => { // The start handle snaps; Shift constrains the move. @@ -469,13 +489,12 @@ impl GradientTool { ("paint.editGradient", Self::stops_params(cx, &set_midpoint(stops, *index, m))) } }; - self.guides = guides; out.push(Action::Preview(cmd.into(), params)); out } fn release(&mut self, cx: &ToolContext, p: Point) -> Vec { - self.guides.clear(); + self.snap.clear(); let Some(g) = self.gesture.take() else { return vec![] }; if g.began { let mut out = vec![Action::Commit]; @@ -494,12 +513,12 @@ impl GradientTool { let (stops, i) = insert_stop(&a.gradient, t); vec![Action::Exec("paint.editGradient".into(), Self::stops_params(cx, &stops)), Self::select_stop(i)] } - // A click inside selected art applies the gradient from that point. + // A click inside selected art applies the gradient from that point, snapped. Grab::Art => { let Some(h) = hit_test(cx.doc, p, cx.hit_options()) else { return vec![] }; let id = paint_owner(cx.doc, h.leaf); let Some(v) = cx.selection.objects.contains(&id).then(|| click_vector(cx, id)).flatten() else { return vec![] }; - let mut params = Self::geom_params(cx, p, p + v); + let mut params = Self::geom_params(cx, g.start, g.start + v); // Without `ids`, the engine refuses the gradient while an object of a dynamic symbol // instance's art is selected. if cx.selection.symbol_part.is_some() { @@ -550,6 +569,9 @@ impl Tool for GradientTool { } _ => {} } + if matches!(ev.kind, PointerKind::Move) { + self.hover(cx, ev.pos); + } match ev.kind { PointerKind::Down => self.press(cx, ev.pos, ev.mods), PointerKind::Drag => self.drag(cx, ev.pos, ev.mods), @@ -579,14 +601,19 @@ impl Tool for GradientTool { return self.key(cx, ToolKey::Escape, Mods::default()); } (self.gesture, self.free) = (None, None); - self.guides.clear(); + self.snap.clear(); + vec![] + } + + fn deactivate(&mut self, _cx: &ToolContext) -> Vec { + self.snap.clear(); vec![] } fn key(&mut self, cx: &ToolContext, key: ToolKey, mods: Mods) -> Vec { if key == ToolKey::Escape && self.busy() { self.gesture = None; - self.guides.clear(); + self.snap.clear(); return self.free.take().map_or_else(|| vec![Action::Cancel], |g| freeform::cancel(&g)); } if self.busy() || !self.claims_key(cx, key) { @@ -626,7 +653,7 @@ impl Tool for GradientTool { } _ => vec![], }; - o.extend(self.guides.iter().cloned()); + o.extend(self.snap.guides().iter().cloned()); o } diff --git a/crates/trace/src/logo/pipeline.rs b/crates/trace/src/logo/pipeline.rs index 766cf242dd..16bb1b3b08 100644 --- a/crates/trace/src/logo/pipeline.rs +++ b/crates/trace/src/logo/pipeline.rs @@ -6,7 +6,7 @@ use super::march::{area2, contours}; use super::outline::{Stats, Style, fit_outline}; use super::palette::{WHITE_MIN, auto_palette, flat_fraction, fold_tones, parse_hex, unexplained_colours}; use super::restore::RestoreParams; -use super::unmix::{Px, count_ambiguous, unmix}; +use super::unmix::{Px, Switched, count_ambiguous, unmix}; use crate::{Raster, TraceError, TraceParams, TraceResult, TracedPath}; use vectorcraft_geom::{Anchor, AnchorKind, PathData, Point, SubPath}; @@ -20,7 +20,7 @@ const FIELD_CELLS_MAX: usize = 6_000_000; const MIN_FLAT: f64 = 0.93; /// Most outlines of one colour (above the noise threshold) we will fit; more is refused, not truncated. const MAX_LOOPS_PER_CLASS: usize = if cfg!(test) { 500 } else { 20_000 }; -/// Most distinct pixel values `unmix` may have to work on (those that are not exactly one color). A busier image is +/// Most distinct pixel values `unmix` may have to work on (`count_ambiguous`). A busier image is /// averaged down further first, which bounds the time on pathological input. const EDGE_BUDGET: usize = 150_000; /// Palette colours closer than this (RGB distance) are one colour. @@ -320,27 +320,33 @@ fn keep_shape(s: &Shape, map: &ToSource, kept: &mut Vec, anchors_made: &mu /// A hard-edged source (a GIF, say) has no anti-aliasing to read an edge position from, and its /// outlines would follow the pixel staircase. Blurring the coverage by under a pixel gives the -/// outline a smooth edge to find. Sources with plenty of blended edge pixels are left alone. -fn soften_if_aliased(planes: &mut [Vec], w: usize, h: usize) -> bool { +/// outline a smooth edge to find. Sources with plenty of blended edge pixels are left alone. The +/// pixels that took another mix than their best one (`switched`) are judged by their best mix. +fn soften_if_aliased(planes: &mut [Vec], switched: &Switched, w: usize, h: usize) -> bool { let n = w * h; - let dominant: Vec = - (0..n).map(|i| (0..planes.len()).max_by(|&a, &b| plane_at(planes, a, i).total_cmp(&plane_at(planes, b, i))).unwrap_or(0)).collect(); - let (mut boundary, mut blended) = (0usize, 0usize); - for y in 0..h { - for x in 0..w { - let i = y * w + x; - let d = dominant.get(i).copied().unwrap_or(0); - let strongest = (0..planes.len()).map(|c| plane_at(planes, c, i)).fold(0.0f32, f32::max); - if strongest < 0.9 { - blended += 1; - } - let differs = |j: usize| dominant.get(j).is_some_and(|&o| o != d); - if (x + 1 < w && differs(i + 1)) || (y + 1 < h && differs(i + w)) { - boundary += 1; + let aliased = { + let at = |c: usize, i: usize| match switched.binary_search_by_key(&i, |&(j, _)| j) { + Ok(s) => switched.get(s).and_then(|(_, col)| col.get(c)).copied().unwrap_or(0.0), + Err(_) => plane_at(planes, c, i), + }; + let dominant: Vec = (0..n).map(|i| (0..planes.len()).max_by(|&a, &b| at(a, i).total_cmp(&at(b, i))).unwrap_or(0)).collect(); + let (mut boundary, mut blended) = (0usize, 0usize); + for y in 0..h { + for x in 0..w { + let i = y * w + x; + let d = dominant.get(i).copied().unwrap_or(0); + let strongest = (0..planes.len()).map(|c| at(c, i)).fold(0.0f32, f32::max); + if strongest < 0.9 { + blended += 1; + } + let differs = |j: usize| dominant.get(j).is_some_and(|&o| o != d); + if (x + 1 < w && differs(i + 1)) || (y + 1 < h && differs(i + w)) { + boundary += 1; + } } } - } - let aliased = boundary > 0 && blended * 4 < boundary; + boundary > 0 && blended * 4 < boundary + }; if aliased { for p in planes.iter_mut() { blur_plane(p, w, h, 0.8); @@ -437,26 +443,27 @@ pub(crate) fn trace_logo(img: &Raster, params: &TraceParams, max_anchors: usize) let mut classes = classes_for(&palette, own_white || merge_white.is_some()); // A very busy image is averaged down further until the unmixing work is bounded. for _ in 0..6 { - if count_ambiguous(&pix, &classes) <= EDGE_BUDGET || w * h <= 16_384 { + if count_ambiguous(&pix, w, h, &classes) <= EDGE_BUDGET || w * h <= 16_384 { break; } (pix, w, h, factor) = working_copy(img, factor * 2); } - let (mut planes, residual) = unmix(&pix, w, h, &classes); - let mut planes = if params.logo_colors.is_empty() && palette.len() < MAX_COLOURS { + let (mut planes, residual, switched) = unmix(&pix, w, h, &classes); + let (mut planes, mut switched) = if params.logo_colors.is_empty() && palette.len() < MAX_COLOURS { // Colours too small to be found at first show up as pixels nothing explains: add them. let extra = unexplained_colours(&pix, w, h, &residual, &palette); if extra.is_empty() { - planes + (planes, switched) } else { palette.extend(extra.into_iter().take(MAX_COLOURS - palette.len())); // (A colour nothing explained may be one more tone of a colour that is there.) palette = fold_tones(&pix, palette); classes = classes_for(&palette, own_white); - unmix(&pix, w, h, &classes).0 + let (planes, _, switched) = unmix(&pix, w, h, &classes); + (planes, switched) } } else { - std::mem::take(&mut planes) + (std::mem::take(&mut planes), switched) }; if let Some(to) = merge_white && palette.len() < planes.len() @@ -467,10 +474,18 @@ pub(crate) fn trace_logo(img: &Raster, params: &TraceParams, max_anchors: usize) *t += *v; } } + for (_, col) in &mut switched { + if palette.len() < col.len() { + let white_weight = col.remove(palette.len()); + if let Some(t) = col.get_mut(to) { + *t += white_weight; + } + } + } } // Without a white class, `white` is an index no class has. let (white, transparent) = if own_white { (palette.len(), palette.len() + 1) } else { (usize::MAX, palette.len()) }; - let aliased = soften_if_aliased(&mut planes, w, h); + let aliased = soften_if_aliased(&mut planes, &switched, w, h); if own_white { fill_knockouts(&mut planes, w, h, white, transparent); } diff --git a/crates/trace/src/logo/tests.rs b/crates/trace/src/logo/tests.rs index 168ba05d7f..33ab678a1f 100644 --- a/crates/trace/src/logo/tests.rs +++ b/crates/trace/src/logo/tests.rs @@ -919,3 +919,242 @@ fn an_outline_fitted_without_area_is_left_out() { } } } + +/// A black disc and a gray square on white, the gray lying on the line from black to white: the +/// disc's edge pixels are blends of black and white, so the gray is one shape (the square) and no +/// gray lines the disc. Colors found and named exactly, the darker gray also named 52 levels off; +/// sharp and soft edges. +#[test] +fn a_gray_between_black_and_white_is_one_shape() { + const INK: [u8; 3] = [4, 4, 3]; + for gray in [[230u8, 230, 230], [200, 200, 200]] { + for blur in [0.0, 0.6] { + let img = render(120, 60, blur, |x, y| { + Some(if (x - 30.0).hypot(y - 30.0) <= 20.0 { + INK + } else if (60.0..=110.0).contains(&x) && (10.0..=50.0).contains(&y) { + gray + } else { + WHITE + }) + }); + // (A gray of 230 named 52 levels darker lies nearer white than its name, and is traced as white.) + let offs: &[Option] = if gray[0] == 200 { &[None, Some(0), Some(52)] } else { &[None, Some(0)] }; + for &by in offs { + let (p, gray_name) = match by { + None => (logo_params(), gray), + Some(by) => { + // Each name moved `by` levels toward mid-gray: the black lighter, the gray darker. + let names = [INK.map(|v| v.saturating_add(by)), gray.map(|v| v.saturating_sub(by))]; + let logo_colors = names.iter().map(|c| format!("#{:02X}{:02X}{:02X}", c[0], c[1], c[2])).collect(); + (TraceParams { logo_colors, ..logo_params() }, names[1]) + } + }; + let what = format!("gray {gray:?}, blur {blur}, names moved {by:?}"); + let res = trace(&img, &p); + let grays = res.paths.iter().filter(|t| t.color == gray_name).count(); + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + assert_eq!(grays, 1, "{what}: {grays} gray paths; {paths:?}"); + assert_eq!(top_color(&res, Point::new(85.0, 30.0)), Some(gray_name), "{what}: the square"); + for k in 0..16 { + let a = f64::from(k) * std::f64::consts::TAU / 16.0; + let at = Point::new(30.0 + 20.0 * a.cos(), 30.0 + 20.0 * a.sin()); + assert_ne!(top_color(&res, at), Some(gray_name), "{what}: the disc's edge at {at:?}"); + } + } + } + } +} + +/// A one-pixel gray line between flat black and flat white, with the three colors named, stays a +/// gray line along its whole length, beside a black disc whose edge pixels are as light as the gray. +#[test] +fn a_one_pixel_gray_line_between_black_and_white_stays_gray() { + const INK: [u8; 3] = [4, 4, 3]; + for gray in [[230u8, 230, 230], [200, 200, 200], [128, 128, 128]] { + let img = render(120, 80, 0.0, |x, y| { + Some(if x < 40.0 || (x - 90.0).hypot(y - 40.0) <= 15.0 { + INK + } else if x < 41.0 { + gray + } else { + WHITE + }) + }); + let logo_colors = vec!["#040403".into(), format!("#{:02X}{:02X}{:02X}", gray[0], gray[1], gray[2]), "#FFFFFF".into()]; + let res = trace(&img, &TraceParams { logo_colors, ..logo_params() }); + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + for y in 2..78 { + let at = Point::new(40.5, f64::from(y) + 0.5); + assert_eq!(top_color(&res, at), Some(gray), "gray {gray:?}: the line at {at:?}; {paths:?}"); + } + for k in 0..16 { + let a = f64::from(k) * std::f64::consts::TAU / 16.0; + let at = Point::new(90.0 + 15.0 * a.cos(), 40.0 + 15.0 * a.sin()); + assert_ne!(top_color(&res, at), Some(gray), "gray {gray:?}: the disc's edge at {at:?}"); + } + } +} + +/// A gray stroke 12 pixels long touching a black disc on white, with the three colors named: the +/// stroke's pixels join the disc's edge pixels that are as light as the gray, but no gray lines the +/// rest of the disc's edge, and a sharp stroke stays gray. Strokes two and three pixels wide outside +/// the disc, on and off the pixel grid, sharp and soft. A soft stroke about two pixels wide that +/// touches black is traced as black and white, and one about three pixels wide in part, so the +/// stroke's own color is checked on sharp strokes. +#[test] +fn a_gray_stroke_touching_a_black_disc_leaves_its_edge_black_and_white() { + const INK: [u8; 3] = [4, 4, 3]; + for gray in [[230u8, 230, 230], [200, 200, 200], [128, 128, 128]] { + for blur in [0.0, 0.6] { + // The disc reaches x = 42 to 43 along the stroke's rows; each stroke starts inside it. + for (sx, wide) in [(41.0, 4.0), (41.5, 4.0), (41.0, 5.0)] { + let img = render(120, 60, blur, |x, y| { + Some(if (x - 25.0).hypot(y - 28.0) <= 18.0 { + INK + } else if (sx..sx + wide).contains(&x) && (22.0..34.0).contains(&y) { + gray + } else { + WHITE + }) + }); + let logo_colors = vec!["#040403".into(), format!("#{:02X}{:02X}{:02X}", gray[0], gray[1], gray[2]), "#FFFFFF".into()]; + let res = trace(&img, &TraceParams { logo_colors, ..logo_params() }); + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + let what = format!("gray {gray:?}, blur {blur}, stroke at {sx} {wide} px wide"); + if blur == 0.0 { + for y in 24..32 { + let at = Point::new(sx + wide - 1.0, f64::from(y) + 0.5); + assert_eq!(top_color(&res, at), Some(gray), "{what}: the stroke at {at:?}; {paths:?}"); + } + } + // Points on the disc's edge more than 30 degrees from the stroke (which spans about 20). + for k in 6..=58 { + let a = f64::from(k) * std::f64::consts::TAU / 64.0; + let at = Point::new(25.0 + 18.0 * a.cos(), 28.0 + 18.0 * a.sin()); + assert_ne!(top_color(&res, at), Some(gray), "{what}: the disc's edge at {at:?}; {paths:?}"); + } + } + } + } +} + +/// Stripes on white (black, a dark gray with a black disc on it, a light gray), with the colors +/// named 52 levels off: each gray then lies on the line between two other names, and the dark +/// stripe's rows beside white keep the stripe's color above and below the disc. Sharp and soft edges, +/// with and without white named. +#[test] +fn a_gray_stripe_beside_white_keeps_its_color_beside_a_black_disc() { + const INK: [u8; 3] = [5, 5, 3]; + for blur in [0.0, 0.6] { + let img = render(300, 160, blur, |x, y| { + let inside = |x0: f64, y0: f64, x1: f64, y1: f64| (x0..x1).contains(&x) && (y0..y1).contains(&y); + Some(if (x - 150.0).hypot(y - 80.0) <= 12.0 || inside(20.0, 20.0, 280.0, 50.0) { + INK + } else if inside(20.0, 65.0, 280.0, 95.0) { + [100, 100, 100] + } else if inside(20.0, 110.0, 280.0, 140.0) { + [190, 190, 190] + } else { + WHITE + }) + }); + for white in [false, true] { + let mut logo_colors: Vec = ["#393937", "#989898", "#8A8A8A"].iter().map(|s| (*s).to_string()).collect(); + if white { + logo_colors.push("#FFFFFF".into()); + } + let res = trace(&img, &TraceParams { logo_colors, ..logo_params() }); + let what = format!("blur {blur}, white named {white}"); + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + let stripe = top_color(&res, Point::new(60.0, 80.0)); + assert_ne!(stripe, Some([0x39, 0x39, 0x37]), "{what}: the stripe; {paths:?}"); + for x in [140.0, 145.0, 150.0, 155.0, 160.0] { + for y in [65.5, 94.5] { + assert_eq!(top_color(&res, Point::new(x, y)), stripe, "{what}: ({x}, {y}); {paths:?}"); + } + } + if blur == 0.0 { + let inks = res.paths.iter().filter(|t| t.color == [0x39, 0x39, 0x37]).count(); + assert_eq!(inks, 2, "{what}: {inks} paths in the black's name; {paths:?}"); + } + } + } +} + +/// Gray strokes two and three pixels wide on white (whole pixels of the gray), 3 and 4 px from a +/// black disc, and a two-pixel stroke six pixels long, fewer pixels than a line needs to keep its +/// class, 2 to 4.5 px from the disc: the strokes' pixels are blends of black and white too, but nothing +/// darker than the gray lies beside them, and they stay gray. +#[test] +fn thin_gray_strokes_beside_black_stay_gray() { + const INK: [u8; 3] = [4, 4, 3]; + for gray in [[230u8, 230, 230], [200, 200, 200]] { + for wide in [2.0, 3.0] { + let img = render(120, 60, 0.0, |x, y| { + Some(if (x - 25.0).hypot(y - 28.0) <= 18.0 { + INK + } else if ((47.0..47.0 + wide).contains(&x) && (8.0..50.0).contains(&y)) + || ((8.0..110.0).contains(&x) && (49.0..49.0 + wide).contains(&y)) + || ((44.0..46.0).contains(&x) && (16.0..22.0).contains(&y)) + { + gray + } else { + WHITE + }) + }); + let logo_colors = vec!["#040403".into(), format!("#{:02X}{:02X}{:02X}", gray[0], gray[1], gray[2])]; + let res = trace(&img, &TraceParams { logo_colors, ..logo_params() }); + let what = format!("gray {gray:?}, {wide} px strokes"); + let short = (17..21).map(|y| Point::new(45.0, f64::from(y) + 0.5)); + let long = [Point::new(47.0 + wide / 2.0, 20.0), Point::new(47.0 + wide / 2.0, 30.0), Point::new(25.0, 49.0 + wide / 2.0)]; + for at in long.into_iter().chain(short) { + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + assert_eq!(top_color(&res, at), Some(gray), "{what}: {at:?}; {paths:?}"); + } + } + } +} + +/// A sharp black disc and a mid-gray square on white, with up to 2 levels of noise added to each +/// pixel: the edge pixels as light as the gray, read as blends of black and white, still count as +/// unblended when judging whether the source is aliased, so the trace is softened as without them +/// and no gray lines the disc. +#[test] +fn a_noisy_hard_edged_gray_between_black_and_white_is_one_shape() { + const GRAY: [u8; 3] = [128, 128, 128]; + let mut img = render(120, 60, 0.0, |x, y| { + Some(if (x - 30.0).hypot(y - 30.0) <= 20.0 { + [0, 0, 0] + } else if (60.0..=110.0).contains(&x) && (10.0..=50.0).contains(&y) { + GRAY + } else { + WHITE + }) + }); + for (i, px) in img.rgba.chunks_mut(4).enumerate() { + let mut h = (i as u64 ^ 0x9E37_79B9_7F4A_7C15).wrapping_mul(0x2545_F491_4F6C_DD1D); + h ^= h >> 29; + let d = (h % 5) as i32 - 2; + for c in px.iter_mut().take(3) { + *c = (i32::from(*c) + d).clamp(0, 255) as u8; + } + } + for named in [false, true] { + let p = if named { + TraceParams { logo_colors: vec!["#000000".into(), "#808080".into(), "#FFFFFF".into()], ..logo_params() } + } else { + logo_params() + }; + let res = trace(&img, &p); + let paths: Vec<_> = res.paths.iter().map(|t| (t.color, t.pixels)).collect(); + let grays = res.paths.iter().filter(|t| t.color == GRAY).count(); + assert_eq!(grays, 1, "named {named}: {grays} gray paths; {paths:?}"); + assert_eq!(top_color(&res, Point::new(85.0, 30.0)), Some(GRAY), "named {named}: the square"); + for k in 0..16 { + let a = f64::from(k) * std::f64::consts::TAU / 16.0; + let at = Point::new(30.0 + 20.0 * a.cos(), 30.0 + 20.0 * a.sin()); + assert_ne!(top_color(&res, at), Some(GRAY), "named {named}: the disc's edge at {at:?}; {paths:?}"); + } + } +} diff --git a/crates/trace/src/logo/unmix.rs b/crates/trace/src/logo/unmix.rs index cdfdfe52fd..3268c9c20a 100644 --- a/crates/trace/src/logo/unmix.rs +++ b/crates/trace/src/logo/unmix.rs @@ -3,7 +3,10 @@ //! An edge pixel of an anti-aliased logo is a blend of the colours that meet there. Reading it as //! "the nearest colour" throws away exactly the sub-pixel information that says where the edge //! runs, so each pixel is instead explained as a mix of at most three classes, whichever mix -//! reproduces the pixel best. +//! reproduces the pixel best. When another mix also reproduces it (with a gray between black and +//! white among the classes, a black-to-white edge pixel is a mix of black and gray as well as of +//! black and white), the pixel takes the mix whose classes lie nearest it in the flat areas around it, +//! when its neighbors show an edge between those classes. use std::collections::{HashMap, HashSet}; @@ -13,6 +16,20 @@ pub(crate) type Px = [f32; 4]; const LAMBDA: f64 = 30.0; /// Pixels this close (in 0..1 premultiplied RGBA) to a class are taken as exactly that class. const PURE: f64 = 4.0 / 255.0; +/// A mix whose squared error is at most this reproduces the pixel: it comes within [`PURE`] of it, +/// as a pixel taken as exactly one class does. +const REPRODUCES: f64 = PURE * PURE; +/// How far (in pixels, each way) a class is looked for around a pixel that two mixes reproduce. +const NEARBY: usize = 6; +/// A pixel whose neighbors are all this close to it (in 0..1 premultiplied RGBA) lies in a flat area. +const FLAT: f64 = 1.5 / 255.0; +/// How many joined pixels within [`PURE`] of one class are taken as art of that class, such as a +/// one-pixel line. The edge pixels of a curve that come within `PURE` of a class join in far fewer. +/// A straight edge whose anti-aliased pixels come within `PURE` of +/// a class gives the same pixels as a line of that class, and keeps the class too. A one-pixel line +/// between two classes that is shorter, falls between pixels or is blurred is read as a blend of +/// those two classes. +const LINE: usize = 2 * NEARBY + 1; struct Subset { idx: [usize; 3], @@ -90,21 +107,33 @@ fn subsets(classes: &[[f64; 4]]) -> Vec { out } -/// How many distinct pixel values are not (nearly) exactly one class: the ones `unmix` has to work -/// on. A flat area whose color is near but not exactly a class counts once, however large it is. -pub(crate) fn count_ambiguous(pix: &[Px], classes: &[[f64; 4]]) -> usize { +/// How many distinct pixel values `unmix` has to work on: the values not (nearly) exactly one class, +/// and the values that are, at pixels outside a flat area ([`in_flat_area`]). A flat area whose color +/// is near but not exactly a class counts once, however large it is. +pub(crate) fn count_ambiguous(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4]]) -> usize { let mut seen = HashSet::new(); - for px in pix { + for (i, px) in pix.iter().take(width.saturating_mul(height)).enumerate() { let p = [f64::from(px[0]), f64::from(px[1]), f64::from(px[2]), f64::from(px[3])]; - if !classes.iter().any(|cv| (0..4).map(|j| (p[j] - cv[j]).powi(2)).sum::().sqrt() < PURE) { - seen.insert(px.map(f32::to_bits)); + let key = px.map(f32::to_bits); + if seen.contains(&key) { + continue; + } + if !classes.iter().any(|cv| (0..4).map(|j| (p[j] - cv[j]).powi(2)).sum::().sqrt() < PURE) + || !in_flat_area(pix, width, height, i % width, i / width) + { + seen.insert(key); } } seen.len() } -/// Coverage planes, one `width × height` plane per class (each pixel's weights sum to 1). -pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4]]) -> (Vec>, Vec) { +/// The pixels that took another mix than their best one, in pixel order, each with every class's +/// weight before it did. +pub(crate) type Switched = Vec<(usize, Vec)>; + +/// Coverage planes, one `width × height` plane per class (each pixel's weights sum to 1), the +/// squared error each pixel's best mix leaves, and the pixels that took another mix ([`Switched`]). +pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4]]) -> (Vec>, Vec, Switched) { let k = classes.len(); let n = width.saturating_mul(height); let mut planes = vec![vec![0.0f32; n]; k]; @@ -113,46 +142,384 @@ pub(crate) fn unmix(pix: &[Px], width: usize, height: usize, classes: &[[f64; 4] let subs = subsets(classes); // Each distinct pixel value is mixed once: a flat area that is near but not exactly a class // repeats one value. - let mut mixed: HashMap<[u32; 4], Mix> = HashMap::new(); + let mut mixed: HashMap<[u32; 4], Mixes> = HashMap::new(); + // The class each pixel stands for (the class nearest it, when every other class is at least + // twice as far). + let mut stands_for: Vec> = vec![None; n]; + // The class each pixel comes within `PURE` of, where it does. + let mut pure: Vec> = vec![None; n]; + // The pixels outside a flat area that another mix also reproduces, with their values. + let mut tied: Vec<(usize, [u32; 4])> = Vec::new(); for (i, px) in pix.iter().take(n).enumerate() { let p = [f64::from(px[0]), f64::from(px[1]), f64::from(px[2]), f64::from(px[3])]; // Fast path: a pixel that is (nearly) exactly one class. let mut near = (f64::MAX, 0usize); + let mut second = f64::MAX; for (c, cv) in classes.iter().enumerate() { let d: f64 = (0..4).map(|j| (p[j] - cv[j]).powi(2)).sum(); if d < near.0 { + second = near.0; near = (d, c); + } else if d < second { + second = d; } } + if let Some(q) = stands_for.get_mut(i) { + // (Squared distances: twice as far is four times the square.) + *q = (4.0 * near.0 <= second).then_some(near.1); + } + let key = px.map(f32::to_bits); if near.0.sqrt() < PURE { if let Some(v) = planes.get_mut(near.1).and_then(|pl| pl.get_mut(i)) { *v = 1.0; } + if let Some(q) = pure.get_mut(i) { + *q = Some(near.1); + } + // (An edge pixel can come within `PURE` of a class it holds none of: a black-to-white + // edge pixel as light as a gray class.) + if !in_flat_area(pix, width, height, i % width, i / width) + && !mixed.entry(key).or_insert_with(|| best_mixes(p, near, &subs)).tied.is_empty() + { + tied.push((i, key)); + } continue; } - let (res, weights) = mixed.entry(px.map(f32::to_bits)).or_insert_with(|| best_mix(p, near, &subs)); + let mixes = mixed.entry(key).or_insert_with(|| best_mixes(p, near, &subs)); if let Some(r) = residual.get_mut(i) { - *r = *res; + *r = mixes.residual; } - for &(c, wv) in weights.iter() { - if let Some(v) = planes.get_mut(c).and_then(|pl| pl.get_mut(i)) { - *v = wv; + set_weights(&mut planes, i, &mixes.best, 1.0); + // (A pixel in a flat area has no neighbor far enough from it for `across_edge`.) + if !mixes.tied.is_empty() && !in_flat_area(pix, width, height, i % width, i / width) { + tied.push((i, key)); + } + } + let mut switched = Vec::new(); + if tied.is_empty() { + return (planes, residual, switched); + } + // A pixel two mixes reproduce takes another mix of two classes whose farthest class lies nearer + // it than the best mix's does, in the flat areas around it ([`flat_classes`], [`RowDistances::around`]), + // when the pixel lies on an edge between that mix's classes ([`across_edge`]). For the best mix, + // the classes held by flat areas between two classes count as well ([`between_classes`]). A + // pixel within `PURE` of a class that is joined to at least [`LINE`] such pixels of that class + // (itself included) keeps it ([`pure_runs`]), as a one-pixel line of gray between black and white. + let flat = flat_classes(pix, &stands_for, width, height); + let between = between_classes(pix, &flat, &mixed, width, height); + let runs = pure_runs(&pure, width, height); + let mut flat_rows = RowDistances::new(|j| [flat.get(j).copied().flatten(), None], width, height, k); + let mut between_rows = (!between.is_empty()).then(|| RowDistances::new(|j| between.get(j).copied().unwrap_or([None; 2]), width, height, k)); + let mut dist = vec![NEARBY + 1; k]; + let mut kept = vec![NEARBY + 1; k]; + for (i, key) in tied { + if pure.get(i).copied().flatten().is_some() && runs.get(i).is_some_and(|&r| r >= LINE) { + continue; + } + let Some(mixes) = mixed.get(&key) else { continue }; + let edges: Vec<&Weights> = mixes.tied.iter().filter(|m| across_edge(pix, width, height, i, classes, &mixes.best, m)).collect(); + if edges.is_empty() { + continue; + } + flat_rows.around(i, &mut dist); + kept.copy_from_slice(&dist); + if let Some(rows) = &mut between_rows { + rows.around(i, &mut kept); + for (h, &d) in kept.iter_mut().zip(&dist) { + *h = (*h).min(d); + } + } + let now = farthest(&mixes.best, &kept); + let other = edges.into_iter().filter(|m| farthest(m, &dist) < now).min_by_key(|m| farthest(m, &dist)); + if let Some(other) = other { + switched.push((i, planes.iter().map(|pl| pl.get(i).copied().unwrap_or(0.0)).collect())); + // (`residual` keeps the best mix's error; the mix taken comes within `REPRODUCES` of the + // pixel as well.) + set_weights(&mut planes, i, &mixes.best, 0.0); + set_weights(&mut planes, i, other, 1.0); + } + } + (planes, residual, switched) +} + +/// Whether pixel `i` lies on an edge between the two classes of `other`, rather than in an area of +/// a class of `best` that `other` leaves out: for each such class, the pixel has a neighbor beyond +/// it toward each class of `other`, along the line between them. (A black-to-white edge pixel as +/// light as a gray has a darker neighbor and a lighter one; a gray stroke on white has no neighbor +/// darker than the gray.) +fn across_edge(pix: &[Px], width: usize, height: usize, i: usize, classes: &[[f64; 4]], best: &Weights, other: &Weights) -> bool { + let [(a, _), (b, _)] = other.as_slice() else { return false }; + let (Some(ca), Some(cb)) = (classes.get(*a), classes.get(*b)) else { return false }; + let ab: [f64; 4] = std::array::from_fn(|j| cb[j] - ca[j]); + let len2: f64 = ab.iter().map(|v| v * v).sum(); + if len2 <= 1e-12 { + return false; + } + let len = len2.sqrt(); + // Where `v` lies along the line from `a` to `b` (0 at `a`, 1 at `b`), and how far off it. + let place = |v: [f64; 4]| { + let t = (0..4).map(|j| (v[j] - ca[j]) * ab[j]).sum::() / len2; + let off = (0..4).map(|j| (v[j] - ca[j] - t * ab[j]).powi(2)).sum::().sqrt(); + (t, off) + }; + let (x, y) = (i % width.max(1), i / width.max(1)); + let neighbors: Vec = (y.saturating_sub(1)..(y + 2).min(height)) + .flat_map(|yy| (x.saturating_sub(1)..(x + 2).min(width)).map(move |xx| yy * width + xx)) + .filter(|&j| j != i) + .filter_map(|j| pix.get(j)) + .map(|q| place([f64::from(q[0]), f64::from(q[1]), f64::from(q[2]), f64::from(q[3])])) + .filter(|&(_, off)| off <= 2.0 * PURE) + .map(|(t, _)| t) + .collect(); + let left_out: Vec = best.iter().filter(|&&(c, w)| w > 0.0 && c != *a && c != *b).map(|&(c, _)| c).collect(); + !left_out.is_empty() + && left_out.iter().all(|&c| { + let Some(&cv) = classes.get(c) else { return false }; + let (tc, _) = place(cv); + neighbors.iter().any(|&t| (tc - t) * len > PURE) && neighbors.iter().any(|&t| (t - tc) * len > PURE) + }) +} + +/// How far the farthest class of `mix` lies, by the distances `dist` ([`RowDistances::around`]). +fn farthest(mix: &Weights, dist: &[usize]) -> usize { + mix.iter().filter(|&&(_, w)| w > 0.0).map(|&(c, _)| dist.get(c).copied().unwrap_or(NEARBY + 1)).max().unwrap_or(0) +} + +/// Sets pixel `i` of each class's plane in `weights` to the class's weight times `scale`. +fn set_weights(planes: &mut [Vec], i: usize, weights: &[(usize, f32)], scale: f32) { + for &(c, wv) in weights { + if let Some(v) = planes.get_mut(c).and_then(|pl| pl.get_mut(i)) { + *v = wv * scale; + } + } +} + +/// A class's weight in the mix of a flat area that stands for no class, from which the area +/// counts as holding that class. +const HOLDS: f32 = 0.25; + +/// The class each pixel stands for (`stands_for`) where the pixel lies in a flat area +/// ([`in_flat_area`]), and `None` elsewhere. +fn flat_classes(pix: &[Px], stands_for: &[Option], width: usize, height: usize) -> Vec> { + (0..width.saturating_mul(height)) + .map(|i| stands_for.get(i).copied().flatten().filter(|_| in_flat_area(pix, width, height, i % width, i / width))) + .collect() +} + +/// The classes held by flat areas that stand for no class (a flat color between two classes, as +/// with colors named some levels off): the classes of at least [`HOLDS`] weight in the area's mix +/// (at most two, the heaviest), held also by the pixels of exactly its color joined to it, flat or +/// not (its rows beside another color, where a soft edge or a shape close by leaves no flat pixel). +/// Empty when there is no such area. +fn between_classes(pix: &[Px], flat: &[Option], mixed: &HashMap<[u32; 4], Mixes>, width: usize, height: usize) -> Vec<[Option; 2]> { + let mut held = Vec::new(); + // Pixels holding classes, from which the pixels of their color are reached. + let mut reach: Vec = Vec::new(); + for (i, f) in flat.iter().enumerate() { + if f.is_some() || !in_flat_area(pix, width, height, i % width, i / width) { + continue; + } + let Some(mixes) = pix.get(i).and_then(|px| mixed.get(&px.map(f32::to_bits))) else { continue }; + let mut heavy: Vec<(usize, f32)> = mixes.best.iter().copied().filter(|&(_, w)| w >= HOLDS).collect(); + heavy.sort_by(|a, b| b.1.total_cmp(&a.1)); + if heavy.is_empty() { + continue; + } + if held.is_empty() { + held = vec![[None; 2]; width.saturating_mul(height)]; + } + if let Some(slot) = held.get_mut(i) { + *slot = [heavy.first().map(|&(c, _)| c), heavy.get(1).map(|&(c, _)| c)]; + reach.push(i); + } + } + while let Some(i) = reach.pop() { + let (Some(&classes), Some(key)) = (held.get(i), pix.get(i).map(|px| px.map(f32::to_bits))) else { continue }; + let (x, y) = (i % width, i / width); + for yy in y.saturating_sub(1)..(y + 2).min(height) { + for xx in x.saturating_sub(1)..(x + 2).min(width) { + let j = yy * width + xx; + if let (Some(slot @ [None, None]), Some(q)) = (held.get_mut(j), pix.get(j)) + && q.map(f32::to_bits) == key + { + *slot = classes; + reach.push(j); + } } } } - (planes, residual) + held } -/// A pixel's mix: the squared error it leaves and each class's weight. -type Mix = (f32, Vec<(usize, f32)>); +/// For each of `k` classes, how far along each row the nearest pixel holding that class (`at`, the +/// classes pixel `j` holds) lies from each pixel, up to `NEARBY + 1` when none lies within +/// [`NEARBY`]. A row is worked out when it is first asked for, so a few pixels cost a few rows. +struct RowDistances { + at: F, + width: usize, + k: usize, + /// Per row, once worked out: the distance for pixel `x` and class `c` at `x * k + c`. + rows: Vec>>, +} + +impl [Option; 2]> RowDistances { + const NONE: u8 = (NEARBY + 1) as u8; + + fn new(at: F, width: usize, height: usize, k: usize) -> Self { + Self { at, width, k, rows: vec![None; height] } + } + + fn row(&mut self, y: usize) -> &[u8] { + if self.rows.get(y).is_some_and(Option::is_none) { + let built = self.build(y); + if let Some(slot) = self.rows.get_mut(y) { + *slot = Some(built); + } + } + self.rows.get(y).and_then(Option::as_deref).unwrap_or(&[]) + } + + fn build(&self, y: usize) -> Vec { + let (width, k) = (self.width, self.k); + let mut row = vec![Self::NONE; width.saturating_mul(k)]; + // Toward the right, then toward the left, each from the last pixel holding the class. + let mut last = vec![Self::NONE; k]; + for x in 0..width { + let held = (self.at)(y * width + x); + for (c, d) in last.iter_mut().enumerate() { + *d = if held.contains(&Some(c)) { 0 } else { d.saturating_add(1).min(Self::NONE) }; + if let Some(r) = row.get_mut(x * k + c) { + *r = *d; + } + } + } + last.fill(Self::NONE); + for x in (0..width).rev() { + for (c, d) in last.iter_mut().enumerate() { + let Some(r) = row.get_mut(x * k + c) else { continue }; + *d = if *r == 0 { 0 } else { d.saturating_add(1).min(Self::NONE) }; + *r = (*r).min(*d); + } + } + row + } + + /// For each class, how far (in pixels, the larger of the two axes) the nearest pixel holding + /// that class lies from pixel `i`, into `dist` (one entry per class); `NEARBY + 1` when none + /// lies within [`NEARBY`]. + fn around(&mut self, i: usize, dist: &mut [usize]) { + let (width, k, height) = (self.width.max(1), self.k, self.rows.len()); + let (x, y) = (i % width, i / width); + dist.fill(NEARBY + 1); + for yy in y.saturating_sub(NEARBY)..(y + NEARBY + 1).min(height) { + let dy = yy.abs_diff(y); + let row = self.row(yy); + for (c, d) in dist.iter_mut().enumerate().take(k) { + if let Some(&r) = row.get(x * k + c) { + *d = (*d).min(usize::from(r).max(dy)); + } + } + } + } +} + +/// For each pixel within [`PURE`] of a class (`pure`), how many pixels within `PURE` of the same +/// class are joined to it (itself included, through the eight neighbors); 0 for other pixels. +fn pure_runs(pure: &[Option], width: usize, height: usize) -> Vec { + let n = width.saturating_mul(height); + let mut size = vec![0usize; n]; + let mut seen = vec![false; n]; + let mut stack = Vec::new(); + let mut members = Vec::new(); + for start in 0..n { + let Some(c) = pure.get(start).copied().flatten() else { continue }; + if seen.get(start).copied().unwrap_or(true) { + continue; + } + if let Some(s) = seen.get_mut(start) { + *s = true; + } + stack.push(start); + members.clear(); + while let Some(i) = stack.pop() { + members.push(i); + let (x, y) = (i % width, i / width); + for yy in y.saturating_sub(1)..(y + 2).min(height) { + for xx in x.saturating_sub(1)..(x + 2).min(width) { + let j = yy * width + xx; + if pure.get(j).copied().flatten() == Some(c) + && let Some(s) = seen.get_mut(j) + && !*s + { + *s = true; + stack.push(j); + } + } + } + } + for &i in &members { + if let Some(s) = size.get_mut(i) { + *s = members.len(); + } + } + } + size +} + +/// Whether every neighbor of the pixel at (`x`, `y`) inside the image lies within [`FLAT`] of it. +fn in_flat_area(pix: &[Px], width: usize, height: usize, x: usize, y: usize) -> bool { + let Some(p) = pix.get(y * width + x) else { return false }; + (y.saturating_sub(1)..(y + 2).min(height)).all(|yy| { + (x.saturating_sub(1)..(x + 2).min(width)).all(|xx| { + pix.get(yy * width + xx).is_some_and(|q| (0..4).map(|j| (f64::from(p[j]) - f64::from(q[j])).powi(2)).sum::().sqrt() <= FLAT) + }) + }) +} + +/// Each class's weight in a pixel's mix. +type Weights = Vec<(usize, f32)>; + +/// A mix tried for a pixel: its squared error with its penalty, the penalty, and its classes with +/// their weights (the first `n`). +#[derive(Clone, Copy)] +struct Candidate { + res: f64, + penalty: f64, + idx: [usize; 3], + w: [f64; 3], + n: usize, +} + +impl Candidate { + fn weights(&self) -> Weights { + self.idx.iter().zip(self.w).take(self.n).map(|(&c, w)| (c, w as f32)).collect() + } +} + +/// How a pixel value is mixed: the squared error the best mix leaves, each class's weight in it, +/// and the other mixes of two classes that reproduce the value ([`REPRODUCES`]). +struct Mixes { + residual: f32, + best: Weights, + tied: Vec, +} /// The mix of at most three classes that reproduces `p` best, starting from the nearest single -/// class `near` (squared distance, class). -fn best_mix(p: [f64; 4], near: (f64, usize), subs: &[Subset]) -> Mix { +/// class `near` (squared distance, class), and the other mixes that also reproduce it. +fn best_mixes(p: [f64; 4], near: (f64, usize), subs: &[Subset]) -> Mixes { + let reproduces = |m: &Candidate| m.res - m.penalty <= REPRODUCES; // Best single class is the starting point; try every two- and three-class mix. - let mut best = (near.0, vec![(near.1, 1.0f64)]); - let mut best_penalty = 0.0; - for s in subs { + let mut top = Candidate { res: near.0, penalty: 0.0, idx: [near.1, 0, 0], w: [1.0, 0.0, 0.0], n: 1 }; + // The other mixes of two classes that reproduce the pixel, also when the best mix does not (a + // single class carries no penalty and can come nearer than an exact mix of two): only a mix of + // two is switched to ([`across_edge`]). A mix holding the nearest class when that class alone + // reproduces the pixel adds a class of next to no weight to it, and is left out. (At most one + // candidate per pair of classes, so the list stays small with many classes.) Each is kept with + // its subset's index, and the best mix found is left out of them at the end. + let single = reproduces(&top).then_some(near.1); + let mut top_at = None; + let mut pairs: Vec<(usize, Candidate)> = Vec::new(); + for (at, s) in subs.iter().enumerate() { let mut rhs = [0.0f64; 3]; for (j, r) in rhs.iter_mut().enumerate().take(s.n) { *r = (0..4).map(|c| s.cols[j][c] * p[c]).sum::() + LAMBDA * LAMBDA; @@ -180,12 +547,17 @@ fn best_mix(p: [f64; 4], near: (f64, usize), subs: &[Subset]) -> Mix { let m: f64 = (0..s.n).map(|j| w[j] * s.cols[j][c]).sum(); res += (pc - m).powi(2); } - if res < best.0 { - best = (res, (0..s.n).map(|j| (s.idx[j], w[j])).collect()); - best_penalty = s.penalty; + let m = Candidate { res, penalty: s.penalty, idx: s.idx, w, n: s.n }; + if m.n == 2 && reproduces(&m) && single.is_none_or(|c| m.idx[0] != c && m.idx[1] != c) { + pairs.push((at, m)); + } + if res < top.res { + top = m; + top_at = Some(at); } } - ((best.0 - best_penalty).max(0.0) as f32, best.1.into_iter().map(|(c, w)| (c, w as f32)).collect()) + let tied = pairs.iter().filter(|&&(at, _)| Some(at) != top_at).map(|(_, m)| m.weights()).collect(); + Mixes { residual: (top.res - top.penalty).max(0.0) as f32, best: top.weights(), tied } } #[cfg(test)] @@ -199,7 +571,7 @@ mod tests { #[test] fn pure_pixels_are_exact() { let pix = vec![[1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0]]; - let (pl, _) = unmix(&pix, 2, 1, &classes()); + let (pl, _, _) = unmix(&pix, 2, 1, &classes()); assert_eq!((pl[0][0], pl[2][1]), (1.0, 1.0)); } @@ -207,7 +579,7 @@ mod tests { fn a_blend_of_two_colours_recovers_its_proportions() { // 30% red over 70% blue. let pix = vec![[0.3, 0.0, 0.7, 1.0]]; - let (pl, _) = unmix(&pix, 1, 1, &classes()); + let (pl, _, _) = unmix(&pix, 1, 1, &classes()); assert!((pl[0][0] - 0.3).abs() < 0.02, "red {}", pl[0][0]); assert!((pl[1][0] - 0.7).abs() < 0.02, "blue {}", pl[1][0]); } @@ -216,7 +588,7 @@ mod tests { fn a_half_transparent_edge_is_half_covered() { // Red at 40% coverage over nothing: premultiplied (0.4, 0, 0, 0.4). let pix = vec![[0.4, 0.0, 0.0, 0.4]]; - let (pl, _) = unmix(&pix, 1, 1, &classes()); + let (pl, _, _) = unmix(&pix, 1, 1, &classes()); assert!((pl[0][0] - 0.4).abs() < 0.02 && (pl[2][0] - 0.6).abs() < 0.02, "{:?}", (pl[0][0], pl[2][0])); } @@ -224,7 +596,7 @@ mod tests { fn a_colour_no_class_can_explain_leaves_a_large_residual() { // Green is none of red, blue or transparent, nor any blend of them. let pix = vec![[0.0, 0.8, 0.0, 1.0], [0.3, 0.0, 0.7, 1.0]]; - let (_, res) = unmix(&pix, 2, 1, &classes()); + let (_, res, _) = unmix(&pix, 2, 1, &classes()); assert!(res[0] > 0.1, "unexplained pixel residual {}", res[0]); assert!(res[1] < 1e-3, "an explained blend residual {}", res[1]); } @@ -235,8 +607,12 @@ mod tests { let off = [0.97, 0.02, 0.02, 1.0]; let mut pix = vec![off; 1000]; pix.extend([[0.3, 0.0, 0.7, 1.0], [1.0, 0.0, 0.0, 1.0], [0.0, 0.0, 0.0, 0.0]]); - assert_eq!(count_ambiguous(&pix, &classes()), 2); - let (pl, res) = unmix(&pix, pix.len(), 1, &classes()); + // (The pure red and transparent pixels lie outside a flat area, so they count too: `unmix` + // checks whether another mix reproduces them.) + assert_eq!(count_ambiguous(&pix, pix.len(), 1, &classes()), 4); + // Pure pixels in a flat area do not count. + assert_eq!(count_ambiguous(&[[1.0, 0.0, 0.0, 1.0]; 9], 3, 3, &classes()), 0); + let (pl, res, _) = unmix(&pix, pix.len(), 1, &classes()); assert!(pl[0][0] > 0.95, "red {}", pl[0][0]); for i in 1..1000 { assert_eq!((pl[0][i], pl[1][i], pl[2][i], res[i]), (pl[0][0], pl[1][0], pl[2][0], res[0]), "pixel {i}"); @@ -244,10 +620,89 @@ mod tests { assert!((pl[0][1000] - 0.3).abs() < 0.02 && (pl[1][1000] - 0.7).abs() < 0.02); } + #[test] + fn an_edge_pixel_two_mixes_reproduce_takes_the_classes_beside_it() { + // A light gray lies on the line from black to white. A row of flat black, one edge pixel, + // flat white: the edge pixel is a blend of black and white, with no gray in it, also when + // it comes within `PURE` of the gray (0.905), and when the gray alone, which carries no + // penalty, comes nearer it than any mix of two does without reproducing it (0.91). + let classes = vec![[0.9, 0.9, 0.9, 1.0], [0.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]]; + let row = |left: [f32; 4], v: f32| { + let mut pix = vec![left; 5]; + pix.push([v, v, v, 1.0]); + pix.extend([[1.0f32, 1.0, 1.0, 1.0]; 5]); + pix + }; + for v in [0.1f32, 0.3, 0.7, 0.85, 0.905, 0.91, 0.95, 0.98] { + let (pl, _, _) = unmix(&row([0.0, 0.0, 0.0, 1.0], v), 11, 1, &classes); + assert_eq!(pl[0][5], 0.0, "gray in a {v} edge pixel"); + assert!((pl[2][5] - v).abs() < 0.02 && (pl[1][5] - (1.0 - v)).abs() < 0.02, "{v}: black {} white {}", pl[1][5], pl[2][5]); + } + // Beside flat gray, a gray-to-white edge pixel keeps its gray. + let (pl, _, _) = unmix(&row([0.9, 0.9, 0.9, 1.0], 0.95), 11, 1, &classes); + assert!((pl[0][5] - 0.5).abs() < 0.02 && pl[1][5] == 0.0, "gray {} black {}", pl[0][5], pl[1][5]); + // A gray pixel between white ones, flat black four pixels off: a gray stroke, kept. + let mut pix = vec![[0.0f32, 0.0, 0.0, 1.0]; 4]; + pix.extend([[1.0f32, 1.0, 1.0, 1.0]; 2]); + pix.push([0.9, 0.9, 0.9, 1.0]); + pix.extend([[1.0f32, 1.0, 1.0, 1.0]; 5]); + let (pl, _, _) = unmix(&pix, 12, 1, &classes); + assert_eq!((pl[0][6], pl[1][6]), (1.0, 0.0), "the stroke"); + } + + #[test] + fn a_column_of_pixels_as_light_as_a_class_keeps_it() { + // Flat black, one column at the gray's value, flat white. In `LINE` rows or more the column + // is gray art (a one-pixel line, or a straight edge giving the same pixels); in fewer rows it + // is an edge between black and white. + let classes = vec![[0.9, 0.9, 0.9, 1.0], [0.0, 0.0, 0.0, 1.0], [1.0, 1.0, 1.0, 1.0], [0.0, 0.0, 0.0, 0.0]]; + for (rows, gray) in [(LINE, 1.0), (LINE + 10, 1.0), (LINE - 1, 0.0), (3, 0.0)] { + let mut pix = Vec::new(); + for _ in 0..rows { + pix.extend([[0.0f32, 0.0, 0.0, 1.0]; 5]); + pix.push([0.9, 0.9, 0.9, 1.0]); + pix.extend([[1.0f32, 1.0, 1.0, 1.0]; 5]); + } + let (pl, _, _) = unmix(&pix, 11, rows, &classes); + for y in 0..rows { + assert_eq!(pl[0][y * 11 + 5], gray, "{rows} rows: gray in row {y}"); + } + } + } + + #[test] + fn row_distances_match_a_scan_of_the_window_around_each_pixel() { + // Three classes scattered over 23 x 17 pixels, some pixels holding two, most none. + let (w, h, k) = (23usize, 17usize, 3usize); + let at = |j: usize| -> [Option; 2] { + match (j * 7919) % 97 { + 0..=2 => [Some(0), None], + 3 => [Some(1), Some(2)], + 4 | 5 => [None, Some(2)], + _ => [None; 2], + } + }; + let mut rows = RowDistances::new(at, w, h, k); + let mut dist = vec![0; k]; + for i in 0..w * h { + let (x, y) = (i % w, i / w); + let mut want = vec![NEARBY + 1; k]; + for yy in y.saturating_sub(NEARBY)..(y + NEARBY + 1).min(h) { + for xx in x.saturating_sub(NEARBY)..(x + NEARBY + 1).min(w) { + for c in at(yy * w + xx).into_iter().flatten() { + want[c] = want[c].min(xx.abs_diff(x).max(yy.abs_diff(y))); + } + } + } + rows.around(i, &mut dist); + assert_eq!(dist, want, "pixel ({x}, {y})"); + } + } + #[test] fn weights_sum_to_one() { let pix = vec![[0.2, 0.1, 0.5, 0.8], [0.9, 0.0, 0.05, 0.95]]; - let (pl, _) = unmix(&pix, 2, 1, &classes()); + let (pl, _, _) = unmix(&pix, 2, 1, &classes()); for i in 0..2 { let s: f32 = pl.iter().map(|p| p[i]).sum(); assert!((s - 1.0).abs() < 1e-4, "pixel {i} sums to {s}"); diff --git a/crates/trace/src/quantize/cut_edge.rs b/crates/trace/src/quantize/cut_edge.rs index 99b3c42845..27b7727b38 100644 --- a/crates/trace/src/quantize/cut_edge.rs +++ b/crates/trace/src/quantize/cut_edge.rs @@ -283,11 +283,11 @@ pub(super) fn settled_wide(mut q: Quantized, img: &Raster, own: &[bool], gray: b /// channels within 8 levels of each other) is therefore also continuous tone when eight colors /// stay more than 0.065 as far as a single color does. So is a sepia, single-hue or duotone /// picture whose tones follow one curve through the color cube (19 in 20 of its opaque pixels on -/// it, see [`on_one_curve`]). Neither is when sixteen colors stay at most a fifth as far as eight -/// do. That exception holds for flat art of up to sixteen clean levels, gray or tinted, where -/// sixteen colors come within about a level of every pixel. On gray and tinted photos sixteen -/// colors stay 0.18 to 0.57 as far as eight do, and on most anti-aliased or noisy gray flat art -/// 0.24 to 0.5 as far, so the exception holds for neither. +/// it, see [`on_one_curve`]). Neither is, however far eight colors stay, when sixteen colors stay +/// at most a fifth as far as eight do. That exception holds for flat art of up to sixteen clean +/// levels, gray or tinted, where sixteen colors come within about a level of every pixel. On gray +/// and tinted photos sixteen colors stay 0.18 to 0.57 as far as eight do, and on most anti-aliased +/// or noisy gray flat art 0.24 to 0.5 as far, so the exception holds for neither. pub(crate) fn continuous_tone(img: &Raster) -> bool { let hk = HistKey::new(img); let mut bins = vec![Bin::default(); 1 << 15]; @@ -318,10 +318,14 @@ pub(crate) fn continuous_tone(img: &Raster) -> bool { return false; } let one = unsaid(1); - if eight > 0.1 * one { - return true; + if eight <= 0.065 * one { + return false; } - eight > 0.065 * one && unsaid(16) > 0.2 * eight && (20 * neutral >= 19 * opaque || 20 * on_one_curve(img) >= 19 * opaque) + let one_line = || 20 * neutral >= 19 * opaque || 20 * on_one_curve(img) >= 19 * opaque; + if eight > 0.1 * one { + return !(unsaid(16) <= 0.2 * eight && one_line()); + } + unsaid(16) > 0.2 * eight && one_line() } /// How far (levels) a pixel may lie from the tone curve of its picture and still count as on it, diff --git a/crates/trace/src/tests.rs b/crates/trace/src/tests.rs index 3b4e84989a..2bf9e1e2b6 100644 --- a/crates/trace/src/tests.rs +++ b/crates/trace/src/tests.rs @@ -2206,6 +2206,59 @@ fn tinted_flat_art_stays_flat_art() { } } +/// `levels` clean gray bands 20 px wide, evenly spaced from black to white. +fn even_gray_bands(levels: u32) -> Raster { + Raster::from_fn(levels * 20, 60, |x, _| { + let v = (x / 20 * 255 / (levels - 1)) as u8; + [v, v, v, 255] + }) +} + +#[test] +fn flat_art_of_up_to_sixteen_clean_levels_stays_flat_art() { + // Equal bands: eight colors leave more than a tenth of what a single color leaves. + let tints: [(&str, &[[f64; 3]]); 4] = [("gray", &GRAY_RAMP), ("sepia", &SEPIA), ("blue", &BLUE), ("duotone", &DUOTONE)]; + let mut smoothed = vec![]; + for (name, stops) in tints { + for levels in [10, 12, 14, 16] { + let bands = tinted(&even_gray_bands(levels), stops, 0.0); + if quantize::continuous_tone(&bands) { + smoothed.push(format!("{levels} {name} bands")); + } + if quantize::continuous_tone(&beside_transparent_colors(&bands)) { + smoothed.push(format!("{levels} {name} bands beside transparent colors")); + } + } + } + assert!(smoothed.is_empty(), "continuous tone: {smoothed:?}"); +} + +#[test] +fn thin_lines_on_flat_art_of_up_to_sixteen_clean_levels_are_traced() { + for levels in [12, 16] { + for (name, stops) in [("gray", &GRAY_RAMP[..]), ("sepia", &SEPIA[..])] { + let bands = even_gray_bands(levels); + // A 1 px black line across the bands at y = 30, and a 1 px white line down the second + // band at x = 25. + let lined = Raster::from_fn(bands.width, bands.height, |x, y| { + if y == 30 { + [0, 0, 0, 255] + } else if x == 25 { + [255, 255, 255, 255] + } else { + let i = ((y * bands.width + x) * 4) as usize; + [bands.rgba[i], bands.rgba[i + 1], bands.rgba[i + 2], 255] + } + }); + let res = trace(&tinted(&lined, stops, 0.0), &sixteen_colors()); + assert_eq!(res.palette.len(), levels as usize, "{levels} {name} bands: {:?}", res.palette); + // The black band with the black line; the white band above and below the line; the + // white line above and below it; the second band in four; each other band in two. + assert_eq!(res.paths.len(), 1 + 2 + 2 + 4 + 2 * (levels as usize - 3), "{levels} {name} bands"); + } + } +} + #[test] fn pictures_without_tones_are_not_continuous_tone() { let photo = tinted(&photo_scene(6.0, true), &SEPIA, 2.0); diff --git a/crates/trace/tests/quality/centre_lines.rs b/crates/trace/tests/quality/centre_lines.rs index 4cc8eb3321..c32d7dd362 100644 --- a/crates/trace/tests/quality/centre_lines.rs +++ b/crates/trace/tests/quality/centre_lines.rs @@ -425,7 +425,7 @@ pub fn report() -> String { } } let mut md = String::from( - "## Centre lines\n\nCode-drawn scenes only: 23 scenes, each anti-aliased (8×8 coverage samples) and hard (that coverage thresholded at 0.5). Coordinates, widths and scene Stroke values are fixed; junction/letter/crossing coordinates include the 0.27/0.41 px offset. Create Fills and Strokes are on, Stroke is the scene's limit (13 px, mix 6 px, varying 12 px), Black and White threshold 128, Noise 4, Ignore White on, other settings at their defaults. Today's tracer has no minimum-length setting (the dashed scenes specify 0 for future use).\n\nDistances use dense exact centre samples (≤0.25 px), emitted curves sampled at ≤0.5 px control-polygon steps, and nearest-point searches capped at 30 px. Found is the fraction of true samples within 1.5 px; width errors use output samples within 2 px of a true stroke. Samples inside exact fills are excluded. Topology is recovered from emitted subpath endpoints and intersections, merging coincident positions within 0.05 px; an endpoint contributes one arm, an interior two. Junction matching radius is local true width + 3 px; ends use half-width + 4 px. Each match is used once. Free ends exclude true junctions, corners, other strokes and fills; unmatched emitted ends are spurs. Junctions/ends within 2 px of fills are excluded. End error is distance, with signed error along the outward tangent in parentheses. Coverage is a union of painted output at pixel centres (0.02 px flattening tolerance, actual emitted caps), compared with the exact swept shape at pixel centres, for both input variants. Area error is signed relative to exact area. Anchors counts stroke anchors, including all compound subpaths; paths counts stroked + filled paths. Time covers tracing only, one scene at a time. Profile-dependent columns are unavailable (–).\n\n### Centre line and width (px)\n\n| scene | input | paths | out→true mean / p95 | true→out mean / p95 | found % | width err uniform mean / p95 | variable mean / p95 | profile mean |\n|---|---|---|---|---|---|---|---|---|\n", + "## Centre lines\n\nCode-drawn scenes only: 24 scenes, each anti-aliased (8×8 coverage samples) and hard (that coverage thresholded at 0.5). Coordinates, widths and scene Stroke values are fixed; junction/letter/crossing/mixed-width body coordinates include the 0.27/0.41 px offset. Create Fills and Strokes are on, Stroke is the scene's limit (13 px, mix and mixed-width body 6 px, varying 12 px), Black and White threshold 128, Noise 4, Ignore White on, other settings at their defaults. Today's tracer has no minimum-length setting (the dashed scenes specify 0 for future use).\n\nDistances use dense exact centre samples (≤0.25 px), emitted curves sampled at ≤0.5 px control-polygon steps, and nearest-point searches capped at 30 px. Found is the fraction of true samples within 1.5 px; width errors use output samples within 2 px of a true stroke. Samples inside exact fills are excluded. Topology is recovered from emitted subpath endpoints and intersections, merging coincident positions within 0.05 px; an endpoint contributes one arm, an interior two. Junction matching radius is local true width + 3 px; ends use half-width + 4 px. Each match is used once. Free ends exclude true junctions, corners, other strokes and fills; unmatched emitted ends are spurs. Junctions/ends within 2 px of fills are excluded. End error is distance, with signed error along the outward tangent in parentheses. Coverage is a union of painted output at pixel centres (0.02 px flattening tolerance, actual emitted caps), compared with the exact swept shape at pixel centres, for both input variants. Area error is signed relative to exact area. Anchors counts stroke anchors, including all compound subpaths; paths counts stroked + filled paths. Time covers tracing only, one scene at a time. Profile-dependent columns are unavailable (–).\n\n### Centre line and width (px)\n\n| scene | input | paths | out→true mean / p95 | true→out mean / p95 | found % | width err uniform mean / p95 | variable mean / p95 | profile mean |\n|---|---|---|---|---|---|---|---|---|\n", ); for m in &rows { writeln!( @@ -544,7 +544,44 @@ fn known_geometry_measures_junctions_ends_missing_ink_and_caps() { let square = render(&TraceResult { paths: vec![TracedPath { square_caps: true, ..diagonal }], ..Default::default() }, 50, 50, false); assert!(square.iter().filter(|p| **p).count() > round.iter().filter(|p| **p).count()); // Preserve the exact catalogue and special scene limits. - assert_eq!(scenes::all().len(), 23); - assert_eq!((scenes::mix().wmax, scenes::varying().wmax, scenes::dashed(2.0).min_len), (6.0, 12.0, 0.0)); + assert_eq!(scenes::all().len(), 24); + assert_eq!((scenes::mix().wmax, scenes::mixed_width_body().wmax, scenes::varying().wmax, scenes::dashed(2.0).min_len), (6.0, 6.0, 12.0, 0.0)); assert_eq!(scenes::junctions(4.0).junctions[0].0, P::new(60.27, 40.41)); } + +#[test] +fn mixed_width_body_is_one_shape_traced_as_a_fill_and_strokes() { + let sc = scenes::mixed_width_body(); + assert_eq!((sc.fills.len(), sc.strokes.len(), sc.junctions.len(), sc.corners.len()), (1, 3, 0, 0)); + let cov = sc.rasterise(); + let hard: Vec = cov.iter().map(|&c| if c >= 0.5 { 1.0 } else { 0.0 }).collect(); + // The inked pixels form one 8-connected component. + let ink: Vec = hard.iter().map(|&c| c > 0.0).collect(); + let start = ink.iter().position(|&v| v).unwrap(); + let mut seen = vec![false; ink.len()]; + let mut stack = vec![start]; + seen[start] = true; + let mut reached = 0; + while let Some(i) = stack.pop() { + reached += 1; + let (x, y) = ((i % sc.w) as i64, (i / sc.w) as i64); + for (dx, dy) in [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)] { + let (nx, ny) = (x + dx, y + dy); + if nx < 0 || ny < 0 || nx >= sc.w as i64 || ny >= sc.h as i64 { + continue; + } + let j = ny as usize * sc.w + nx as usize; + if ink[j] && !seen[j] { + seen[j] = true; + stack.push(j); + } + } + } + assert_eq!(reached, ink.iter().filter(|&&v| v).count()); + // Create Strokes splits the shape: its body is one fill and each arm is a stroke reaching its free end. + for (input, c) in [("aa", &cov), ("hard", &hard)] { + let m = evaluate(&sc, input, c); + assert_eq!((m.strokes, m.fills, m.ends_gt, m.ends_found), (3, 1, 3, 3), "{m:?}"); + assert!(m.complete > 0.95 && m.fill_as_fill > 0.95, "{m:?}"); + } +} diff --git a/crates/trace/tests/quality/centre_scenes.rs b/crates/trace/tests/quality/centre_scenes.rs index 38e4eb3f73..7c1956b2a6 100644 --- a/crates/trace/tests/quality/centre_scenes.rs +++ b/crates/trace/tests/quality/centre_scenes.rs @@ -388,6 +388,19 @@ pub fn mix() -> Scene { s } +/// One connected shape: a wide disc with three thin arms of 2, 3 and 5 px reaching out of it, +/// and nothing else; Stroke width 6. +pub fn mixed_width_body() -> Scene { + let mut s = Scene::new("mixed-width body", 260, 220, 6.0); + s.offset = P::new(0.27, 0.41); + let c = P::new(100.0, 100.0); + s.fills.push(GtFill::Disc(c + s.offset, 24.0)); + s.line(&[c, P::new(220.0, 100.0)], 3.0); + s.line(&[c, P::new(100.0, 20.0)], 5.0); + s.line(&[c, P::new(25.0, 185.0)], 2.0); + s +} + /// Strokes whose width varies: tapers, a lens, a swelling brush curve; Stroke width 12. pub fn varying() -> Scene { let mut s = Scene::new("varying", 480, 300, 12.0); @@ -441,6 +454,7 @@ pub fn all() -> Vec { v.push(letters(w)); } v.push(mix()); + v.push(mixed_width_body()); v.push(varying()); v } diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 5888b6dfcb..412dbcb4ef 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -136,6 +136,7 @@ impl VectorcraftApp { custom_titlebar: false, caption_layout: Default::default(), desktop_frame: false, + desktop_keeps_frame: false, last_window_title: String::new(), fullscreen_for_mode: false, graphics_adapter: None, diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 50c7b1be30..6d40499106 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -457,5 +457,6 @@ impl VectorcraftApp { /// Show a transient status message. pub fn status(&mut self, s: impl Into) { self.ui.status = s.into(); + self.ui.status_sets = self.ui.status_sets.wrapping_add(1); } } diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index a947dde852..486c70de88 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -186,6 +186,11 @@ pub(crate) fn dragging(ctx: &egui::Context) -> bool { ctx.data(|d| d.get_temp::(drag_id()).is_some()) } +/// Whether the canvas is holding a Zoom tool drag: a marquee, which Space moves, or an animated zoom. +pub(crate) fn dragging_zoom(ctx: &egui::Context) -> bool { + ctx.data(|d| matches!(d.get_temp::(drag_id()), Some(Drag::ZoomBox { .. } | Drag::ZoomScrub { .. }))) +} + /// The part of `outer` inside the scroll bars, and the part of that inside the rulers, which shows /// the document. Normal Screen Mode and Full Screen Mode with Menu Bar keep the scroll bars along /// the right and bottom edges; Full Screen and Presentation Mode have none. diff --git a/crates/ui-egui/src/canvas/home.rs b/crates/ui-egui/src/canvas/home.rs index cd2ac9c44a..bffab8f06c 100644 --- a/crates/ui-egui/src/canvas/home.rs +++ b/crates/ui-egui/src/canvas/home.rs @@ -22,7 +22,7 @@ pub(super) fn home(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { }); } -/// The Home screen's column: welcome, New / Open, Recent Files, presets and community links. +/// The Home screen's column: welcome, New / Open, Recent Files, Learn, presets and community links. fn home_content(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); // The welcome and the New / Open buttons sit centred, as PhotoCraft's Home screen does (#4684). @@ -46,6 +46,7 @@ fn home_content(app: &mut VectorcraftApp, ui: &mut Ui) { }); }); recent(app, ui); + learn(app, ui); ui.add_space(28.0); ui.label(egui::RichText::new(tl!("Quickly start a new file")).font(theme::semibold(14.0)).color(t.text)); ui.add_space(10.0); @@ -68,6 +69,40 @@ fn home_content(app: &mut VectorcraftApp, ui: &mut Ui) { }); } +/// The id of the Home screen's Quick skill guide card. +const LEARN_GUIDE_ID: &str = "home-quick-skill-guide"; + +/// The Home screen's Learn section: the Quick skill guide card, which shows the Learn panel's list +/// of skills, and the Learn panel's tutorials under their skills, each a button that shows the +/// panel at its steps (`learn.show`). Neither opens, closes or switches a document, and the panel +/// shows beside the Home screen. +fn learn(app: &mut VectorcraftApp, ui: &mut Ui) { + use crate::panels::learn::{catalog, guide_card}; + let t = Tokens::get(ui.ctx()); + ui.add_space(28.0); + ui.label(egui::RichText::new(tl!("Learn")).font(theme::semibold(14.0)).color(t.text)); + ui.add_space(10.0); + guide_card(app, ui, egui::Id::unique(LEARN_GUIDE_ID), t.panel); + let mut open = None; + for skill in catalog::SKILLS { + ui.add_space(10.0); + ui.label(egui::RichText::new(skill.title).size(12.0).color(t.text_dim)); + ui.add_space(4.0); + ui.horizontal_wrapped(|ui| { + for tutorial in skill.tutorials { + if widgets::secondary_button(ui, tutorial.title).clicked() { + open = Some(tutorial.id); + } + } + }); + } + if let Some(id) = open + && let Err(e) = app.run("learn.show", json!({ "tutorial": id })) + { + app.status(e); + } +} + /// The Home screen's Recent Files (#663): the first of File › Open Recent Files, each its name and /// folder; a click opens it. Nothing when there are none. fn recent(app: &mut VectorcraftApp, ui: &mut Ui) { diff --git a/crates/ui-egui/src/canvas/input.rs b/crates/ui-egui/src/canvas/input.rs index 4d121eb2a3..57dbef9ff8 100644 --- a/crates/ui-egui/src/canvas/input.rs +++ b/crates/ui-egui/src/canvas/input.rs @@ -373,7 +373,7 @@ fn drag_held(app: &mut VectorcraftApp, ui: &Ui, f: &Pointing, d: Drag, p: Pos2) } } Drag::ZoomBox { start } => { - let start = zoom_marquee_start(ui, start, before, p, space); + let start = zoom_marquee_start(ui, start, before, p); ui.data_mut(|dd| dd.insert_temp(drag_id(), Drag::ZoomBox { start })); marquee(ui.painter(), egui::Rect::from_two_pos(start, p)); } @@ -480,7 +480,7 @@ fn drag_released(app: &mut VectorcraftApp, ui: &Ui, f: &Pointing, d: Drag, p: Po let ui_zoom = app.canvas_ui_zoom; match d { Drag::ZoomBox { start } => { - let start = zoom_marquee_start(ui, start, before, p, space); + let start = zoom_marquee_start(ui, start, before, p); ui.data_mut(|dd| dd.remove::(zoom_space_free_id())); let r = egui::Rect::from_two_pos(start, p); if let Some(vm) = app.view_mut() { @@ -612,22 +612,25 @@ fn zoom_space_free_id() -> egui::Id { /// sizes the marquee until it is let go. A marquee with no size yet is sized by the movement, so /// Space pressed before the pointer moves does not keep it at the press point. The frame's pointer /// moves and Space presses and releases are taken in the order they came, so each move follows the -/// Space state it came with. -fn zoom_marquee_start(ui: &Ui, start: Pos2, before: Option, p: Pos2, space: bool) -> Pos2 { +/// Space state it came with. The Space key counts as held whatever the modifiers, so a marquee that +/// Cmd+Space started while the Type tool edits text follows the same rules once Cmd is let go. +fn zoom_marquee_start(ui: &Ui, start: Pos2, before: Option, p: Pos2) -> Pos2 { enum Step { Space(bool), Move(Pos2), } let id = zoom_space_free_id(); - let steps: Vec = ui.input(|i| { - i.events + let (steps, space): (Vec, bool) = ui.input(|i| { + let steps = i + .events .iter() .filter_map(|e| match e { egui::Event::Key { key: egui::Key::Space, pressed, repeat: false, .. } => Some(Step::Space(*pressed)), egui::Event::PointerMoved(q) => Some(Step::Move(*q)), _ => None, }) - .collect() + .collect(); + (steps, i.key_down(egui::Key::Space)) }); // Space as it was when the frame began: the opposite of its first press or release, else as it is now. let mut held = steps.iter().find_map(|s| if let Step::Space(down) = s { Some(!down) } else { None }).unwrap_or(space); diff --git a/crates/ui-egui/src/canvas/panes.rs b/crates/ui-egui/src/canvas/panes.rs index 76fb599fda..0a26f26843 100644 --- a/crates/ui-egui/src/canvas/panes.rs +++ b/crates/ui-egui/src/canvas/panes.rs @@ -107,17 +107,16 @@ impl Panes { } let current = self.shown.get(&slot).is_some_and(|(k, _)| *k == key) || self.pending.get(&slot) == Some(&key); if !current { + // The document draws through its own assigned profiles, not the front document's, on + // the worker too. + let cms = vectorcraft_engine::cmd::colormgmt::doc_cms(&doc); let mut queued = false; if let Some(worker) = &self.worker { - let (job_doc, job_opts, job_display) = (doc.clone(), opts.clone(), display.clone()); + let (job_doc, job_opts, job_display, job_cms) = (doc.clone(), opts.clone(), display.clone(), cms.clone()); queued = worker.submit( slot, (slot, key.clone()), - Box::new(move |r| { - let mut img = r.render(&job_doc, w, h, view, &job_opts); - crate::display_profile::convert(job_display.as_deref(), &mut img.pixels); - Some(img) - }), + Box::new(move |r| Some(render_pane(r, (&job_doc, w, h, view, &job_opts), job_display.as_deref(), job_cms))), ); if queued { self.pending.insert(slot, key.clone()); @@ -126,8 +125,8 @@ impl Panes { } } if !queued { - let mut img = self.renderer.get_or_insert_with(vectorcraft_render::Renderer::new).render(&doc, w, h, view, &opts); - crate::display_profile::convert(display.as_deref(), &mut img.pixels); + let r = self.renderer.get_or_insert_with(vectorcraft_render::Renderer::new); + let img = render_pane(r, (&doc, w, h, view, &opts), display.as_deref(), cms); self.upload(ctx, slot, key, &img); } } @@ -146,6 +145,19 @@ impl Panes { } } +/// Render `doc` (`w` × `h` pixels through `view`, with `opts`) through the color settings `cms`, +/// then convert it into the display profile `display`. +fn render_pane( + r: &mut vectorcraft_render::Renderer, + (doc, w, h, view, opts): (&vectorcraft_doc::Document, u32, u32, Affine, &vectorcraft_render::RenderOptions), + display: Option<&vectorcraft_color::cms::display::DisplayTransform>, + cms: Arc, +) -> vectorcraft_render::Rendered { + let mut img = vectorcraft_color::cms::with_active(cms, || r.render(doc, w, h, view, opts)); + crate::display_profile::convert(display, &mut img.pixels); + img +} + /// The grid of `n` panes in `area`, filled row by row: as many columns as the square root of `n` /// rounded up, and as many rows as those columns need. The panes meet edge to edge and cover /// `area`; the spare cells of the last row stay empty. @@ -294,8 +306,16 @@ fn fit_pane(v: &mut View, doc: &vectorcraft_doc::Document, rect: egui::Rect, ui_ /// art, grid, artboards, guides and selected objects, and its rulers and the room of the canvas's /// scroll bars, so the document stays where it is when the pane becomes the canvas. True when a /// press in the pane asks for its window to become the current one. A floating window draws its -/// view with this too ([`crate::doc_windows`]). +/// view with this too ([`crate::doc_windows`]). The document's colors, its paper and transparency +/// grid included, draw through its own assigned profiles, not the front document's. pub(crate) fn pane(app: &mut VectorcraftApp, ui: &Ui, w: Win, cell: egui::Rect) -> bool { + let Some(st) = app.session.documents().get(w.0) else { return false }; + let cms = vectorcraft_engine::cmd::colormgmt::doc_cms(&st.doc); + vectorcraft_color::cms::with_active(cms, || draw_pane(app, ui, w, cell)) +} + +/// [`pane`], drawn through the color settings in place. +fn draw_pane(app: &mut VectorcraftApp, ui: &Ui, w: Win, cell: egui::Rect) -> bool { let t = Tokens::get(ui.ctx()); let ppp = ui.ctx().pixels_per_point(); let (full, rect) = view_rects(app, cell, ppp); diff --git a/crates/ui-egui/src/canvas/panes/tests.rs b/crates/ui-egui/src/canvas/panes/tests.rs index cb1394f612..005b930d01 100644 --- a/crates/ui-egui/src/canvas/panes/tests.rs +++ b/crates/ui-egui/src/canvas/panes/tests.rs @@ -358,3 +358,147 @@ fn a_resized_window_fits_the_tiled_documents_again_unless_one_was_zoomed() { } assert_eq!(app.views[1].zoom, zoomed.zoom, "the zoomed document keeps its zoom"); } + +/// The RGB of the middle pixel of the render that document `i`'s pane uploaded in `out`. +fn pane_middle(app: &VectorcraftApp, out: &egui::FullOutput, i: usize) -> [u8; 3] { + let uid = app.session.documents()[i].uid; + let id = app.canvas.panes.shown.iter().find(|(slot, _)| slot.0 == uid).map(|(_, (_, tex))| tex.id()).unwrap(); + let image = out.textures_delta.set.iter().find(|(t, _)| **t == id).and_then(|(_, d)| d.last()).map(|d| d.image.clone()).unwrap(); + let egui::ImageData::Color(img) = image; + let p = img.pixels[img.size[1] / 2 * img.size[0] + img.size[0] / 2]; + [p.r(), p.g(), p.b()] +} + +#[test] +fn other_panes_draw_through_their_documents_profiles() { + const CHILD: &str = "VECTORCRAFT_TEST_PANE_PROFILES"; + if std::env::var_os(CHILD).is_none() { + // Color settings are process-wide: assign profiles in a separate test process. + let output = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "canvas::panes::tests::other_panes_draw_through_their_documents_profiles", "--nocapture"]) + .env(CHILD, "1") + .output() + .unwrap(); + let stdout = String::from_utf8_lossy(&output.stdout); + assert!( + output.status.success() && stdout.contains("test result: ok. 1 passed; 0 failed;"), + "isolated pane profile test failed:\n{stdout}\n{}", + String::from_utf8_lossy(&output.stderr), + ); + return; + } + use vectorcraft_color::cms::{self, Cms, ColorSettings}; + let mut app = app_with(2); + app.session.prefs.monitor_profile_display = false; + // Each document is covered by one RGB rectangle; the second is assigned Display P3. + for i in 0..2 { + app.run("document.activate", json!({"index": i})).unwrap(); + app.run("shape.rectangle", json!({"x": -50, "y": -50, "width": 500, "height": 400})).unwrap(); + app.run("paint.setFill", json!({"color": "#339966"})).unwrap(); + } + app.run("edit.assignProfile", json!({"rgb": cms::DISPLAY_P3})).unwrap(); + // Its simulated paper shows in another color. + app.run("document.setup", json!({"gridColors": ["#cc6633", "#ffffff"], "simulatePaper": true})).unwrap(); + let in_p3 = |r: u8, g: u8, b: u8| { + let color = vectorcraft_color::Color::Rgb { r: r as f32 / 255.0, g: g as f32 / 255.0, b: b as f32 / 255.0 }; + let p3 = Cms::new(&ColorSettings { rgb: cms::DISPLAY_P3.into(), ..cms::working_settings() }).unwrap().display_rgb(&color); + (color, p3.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8)) + }; + let (color, p3) = in_p3(0x33, 0x99, 0x66); + let srgb = [0x33, 0x99, 0x66]; + assert_ne!(p3, srgb, "Display P3 draws the color differently"); + let (_, paper_p3) = in_p3(0xcc, 0x66, 0x33); + let near = |a: [u8; 3], b: [u8; 3]| a.iter().zip(b).all(|(x, y)| x.abs_diff(y) <= 1); + // Whether `out` fills a shape with the RGB `rgb`, give or take one. + let fills = |out: &egui::FullOutput, rgb: [u8; 3]| { + fn any(s: &Shape, f: &dyn Fn(Color32) -> bool) -> bool { + match s { + Shape::Vec(v) => v.iter().any(|s| any(s, f)), + Shape::Path(p) => f(p.fill), + _ => false, + } + } + out.shapes.iter().any(|c| any(&c.shape, &|c: Color32| c.a() == 255 && near([c.r(), c.g(), c.b()], rgb))) + }; + let ctx = egui::Context::default(); + let raw = || egui::RawInput { + screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(1200.0, 800.0))), + max_texture_side: Some(8192), + ..Default::default() + }; + app.run("window.arrange.tile", json!({})).unwrap(); + // The first document in front: the second one's pane draws through Display P3, its paper too. + app.run("document.activate", json!({"index": 0})).unwrap(); + let mut out = ctx.run_ui(raw(), |ui| app.canvas_area(ui)); + let shown = pane_middle(&app, &out, 1); + assert!(fills(&out, paper_p3), "the back document's paper draws through its Display P3: {paper_p3:?}"); + assert!(!fills(&out, [0xcc, 0x66, 0x33]), "the back document's paper does not draw through the working space"); + out.textures_delta.clear(); + assert!(near(shown, p3), "the back document draws through its Display P3: {shown:?}, not {p3:?}"); + // The same in a floating window. + app.run("window.arrange.consolidateAllWindows", json!({})).unwrap(); + app.run("document.activate", json!({"index": 1})).unwrap(); + app.run("window.arrange.floatInWindow", json!({})).unwrap(); + app.run("document.activate", json!({"index": 0})).unwrap(); + let floating = |app: &mut VectorcraftApp| { + ctx.run_ui(raw(), |ui| { + app.canvas_area(ui); + crate::doc_windows::show(app, ui.ctx()); + }) + }; + // The window takes its place in the first frame and fades in over the next few. + for _ in 0..30 { + floating(&mut app).textures_delta.clear(); + } + app.canvas.panes.clear(); + let mut out = floating(&mut app); + let shown = pane_middle(&app, &out, 1); + assert!(fills(&out, paper_p3), "the floating document's paper draws through its Display P3: {paper_p3:?}"); + out.textures_delta.clear(); + assert!(near(shown, p3), "the floating document draws through its Display P3: {shown:?}, not {p3:?}"); + app.run("window.arrange.consolidateAllWindows", json!({})).unwrap(); + app.run("window.arrange.tile", json!({})).unwrap(); + app.canvas.panes.clear(); + // The second document in front: the first one's pane draws through the working sRGB. + app.run("document.activate", json!({"index": 1})).unwrap(); + let mut out = ctx.run_ui(raw(), |ui| app.canvas_area(ui)); + let shown = pane_middle(&app, &out, 0); + out.textures_delta.clear(); + assert!(near(shown, srgb), "the back document draws through the working space: {shown:?}, not {srgb:?}"); + // The same off the UI thread. + app.canvas.panes.clear(); + app.canvas.panes.worker = crate::thumb_worker::ThumbWorker::start(&ctx, "test-panes"); + app.canvas.panes.worker_started = true; + ctx.run_ui(raw(), |ui| app.canvas_area(ui)).textures_delta.clear(); + let done = app.canvas.panes.worker.as_ref().unwrap().wait().unwrap(); + assert_eq!(done.key.0.0, app.session.documents()[0].uid); + let img = done.img.unwrap(); + let at = ((img.height / 2 * img.width + img.width / 2) * 4) as usize; + let shown = [img.pixels[at], img.pixels[at + 1], img.pixels[at + 2]]; + assert!(near(shown, srgb), "the worker draws the back document through the working space: {shown:?}, not {srgb:?}"); + // A CMYK document behind the front one draws through its own assigned CMYK profile. + app.run("document.activate", json!({"index": 0})).unwrap(); + let steps = json!([ + {"command": "edit.assignProfile", "params": {"cmyk": cms::DEVICE_CMYK}}, + {"command": "file.documentColorMode", "params": {"mode": "cmyk"}}, + ]); + app.run("command.batch", json!({"commands": steps})).unwrap(); + app.run("select.all", json!({})).unwrap(); + app.run("paint.setFill", json!({"color": {"c": 60, "m": 10, "y": 80, "k": 0}})).unwrap(); + app.run("document.activate", json!({"index": 1})).unwrap(); + let ink = vectorcraft_color::Color::cmyk(0.6, 0.1, 0.8, 0.0); + let to_u8 = |c: [f32; 3]| c.map(|v| (v.clamp(0.0, 1.0) * 255.0).round() as u8); + let device = to_u8(Cms::new(&ColorSettings { cmyk: cms::DEVICE_CMYK.into(), ..cms::working_settings() }).unwrap().display_rgb(&ink)); + let front = to_u8(cms::active().display_rgb(&ink)); + let close = |a: [u8; 3], b: [u8; 3]| a.iter().zip(b).all(|(x, y)| x.abs_diff(y) <= 3); + assert!(!close(device, front), "the two CMYK profiles draw the color differently: {device:?}, {front:?}"); + app.canvas.panes.clear(); + ctx.run_ui(raw(), |ui| app.canvas_area(ui)).textures_delta.clear(); + let done = app.canvas.panes.worker.as_ref().unwrap().wait().unwrap(); + assert_eq!(done.key.0.0, app.session.documents()[0].uid); + let img = done.img.unwrap(); + let at = ((img.height / 2 * img.width + img.width / 2) * 4) as usize; + let shown = [img.pixels[at], img.pixels[at + 1], img.pixels[at + 2]]; + assert!(close(shown, device), "the back CMYK document draws through its Device CMYK: {shown:?}, not {device:?} (front: {front:?})"); + assert!(near(cms::active().display_rgb(&color).map(|v| (v * 255.0).round() as u8), p3), "the front document's profile stays active"); +} diff --git a/crates/ui-egui/src/canvas/task_bar.rs b/crates/ui-egui/src/canvas/task_bar.rs index d606f630d5..b49b50881a 100644 --- a/crates/ui-egui/src/canvas/task_bar.rs +++ b/crates/ui-egui/src/canvas/task_bar.rs @@ -55,6 +55,42 @@ fn selection_tool_with_selection(app: &VectorcraftApp) -> bool { && app.session.active().is_some_and(|st| !st.selection.is_empty()) } +/// Whether the bar shows its blank canvas actions, Draw (Pencil) and Place Image: a selection tool is +/// in use and the active document has no artwork, only layers and guides. +fn blank_canvas(app: &VectorcraftApp) -> bool { + fn no_art(nodes: &[std::sync::Arc]) -> bool { + nodes.iter().all(|n| n.is_guide() || (n.is_layer() && n.children().is_none_or(|c| no_art(c)))) + } + matches!(app.session.tool_id(), "selection" | "directSelection" | "groupSelection") + && app.session.active().is_some_and(|st| st.selection.is_empty() && no_art(&st.doc.layers)) +} + +/// Where the bar's top edge centers, on screen: under the lowest corner on screen of the selected +/// artboards or the selection, centered on them (the view may be rotated); on a blank canvas, which +/// has no selection, [`blank_canvas_anchor`]. None with nothing to sit under. +fn bar_anchor(app: &mut VectorcraftApp, xf: &Xf, on_artboards: bool, blank: bool) -> Option { + if blank { + return Some(blank_canvas_anchor(app, xf)); + } + let b = if on_artboards { picked_artboards_bounds(app) } else { app.selection_bounds() }?; + let lowest = xf.quad(b).iter().map(|c| c.y).fold(f32::NEG_INFINITY, f32::max); + Some(pos2(xf.to_screen(b.center()).x, lowest)) +} + +/// Where the blank canvas bar's top edge centers, on screen: under the bottom of the active artboard +/// when part of it is in view, else the canvas's center. +fn blank_canvas_anchor(app: &VectorcraftApp, xf: &Xf) -> Pos2 { + let board = app.session.active().and_then(|st| { + let last = st.doc.artboards.len().checked_sub(1)?; + st.doc.artboards.get(app.view().map_or(0, |v| v.artboard).min(last)).map(|a| a.rect) + }); + let shown = board.map(|b| (b, xf.quad(b))).filter(|(_, q)| egui::Rect::from_points(q).intersects(xf.rect)); + match shown { + Some((b, q)) => pos2(xf.to_screen(b.center()).x, q.iter().map(|c| c.y).fold(f32::NEG_INFINITY, f32::max)), + None => xf.rect.center(), + } +} + /// Whether a Type tool edits type, or has type selected: its bar then shows only the text /// formatting controls. fn type_tool_on_type(app: &VectorcraftApp) -> bool { @@ -75,6 +111,8 @@ pub(crate) fn task_bar_shows_type(app: &VectorcraftApp) -> bool { /// While a Type tool edits type, or has type selected, the bar shows only those controls and the /// Fill. When one row would be wider than the canvas, the font controls take a row of their own, /// narrowed to fit it, and the actions wrap onto rows under the handle's ([`bar_layout`]). +/// On a blank canvas, a document with no artwork and a selection tool in use, it sits under the +/// active artboard and offers Draw (Pencil) and Place Image. /// Its handle drags it anywhere on the canvas; unpinned it keeps that offset as it follows the /// selection, pinned it stays put ([`crate::state::TaskBarPlace`]). pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { @@ -83,13 +121,15 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { // Text added with a Type tool shows its formatting controls, as the help page describes // (). let typing = type_tool_on_type(app); - if !(on_artboards || typing || selection_tool_with_selection(app)) { + // A blank canvas offers Draw (Pencil) and Place Image, as the same help page describes. + let blank = !on_artboards && blank_canvas(app); + if !(on_artboards || typing || blank || selection_tool_with_selection(app)) { return; } // Selected type has the font controls too, as the help page describes // (). let fonts = task_bar_shows_type(app); - let Some(b) = (if on_artboards { picked_artboards_bounds(app) } else { app.selection_bounds() }) else { return }; + let Some(anchor) = bar_anchor(app, xf, on_artboards, blank) else { return }; let Some(st) = app.session.active() else { return }; let n = st.selection.len(); let first = st.selection.objects.first().and_then(|id| st.doc.node(*id)); @@ -137,6 +177,10 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { items.push((tl!("Rearrange All"), "dc-rearrange", TASK_BAR_REARRANGE_ARTBOARDS, none())); } items.push((tl!("Export"), "share-2", "file.exportForScreens", none())); + } else if blank { + // Draw (Pencil) switches to the Pencil tool; Place Image picks files for the Place dialog. + items.push((tl!("Draw (Pencil)"), "pencil", "tool.select", json!({"tool": "pencil"}))); + items.push((tl!("Place Image"), "image", "file.place", none())); } else if !typing { // The selection tools' object actions. A Type tool's bar leaves them out, Create Outlines // and the type conversions included. @@ -163,8 +207,8 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { items.push((tl!("Remove Anchor Points"), "pen-tool-delete", "path.removeAnchors", none())); items.push((tl!("Connect"), "dc-join", "path.join", none())); items.push((tl!("Cut Path"), "scissors", "path.cutAtAnchors", none())); - items.push((tl!("Corner"), "dc-anchor", TASK_BAR_TO_CORNER, none())); - items.push((tl!("Smooth"), "dc-anchor-smooth", TASK_BAR_TO_SMOOTH, none())); + items.push((tl!("Convert Selected Anchor Points to Corner"), "dc-anchor", TASK_BAR_TO_CORNER, none())); + items.push((tl!("Convert Selected Anchor Points to Smooth"), "dc-anchor-smooth", TASK_BAR_TO_SMOOTH, none())); } // As in the reference app, open paths offer Join and Edit Path, compound paths and clipping // masks their Release, images selected with vector art Make Clipping Mask, type converts @@ -213,14 +257,17 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { } else if is_image { // Offset Path and Simplify don't apply to an image. } else if !anchors && direct { - // Corner and Smooth convert every anchor of a path selected whole; Remove and Cut - // need anchors picked out, so they wait for them. + // The two convert buttons convert every anchor of a path selected whole; Remove and Cut + // need anchors picked out, so they wait for them. Simplify and Smooth open their + // sliders, as Object › Path › Simplify… and Smooth… do; the page above names Smooth as + // adjusting the path's curvature, apart from converting its anchor points. if open_path { items.push((tl!("Connect"), "dc-join", "path.join", none())); } - items.push((tl!("Corner"), "dc-anchor", TASK_BAR_TO_CORNER, none())); - items.push((tl!("Smooth"), "dc-anchor-smooth", TASK_BAR_TO_SMOOTH, none())); + items.push((tl!("Convert Selected Anchor Points to Corner"), "dc-anchor", TASK_BAR_TO_CORNER, none())); + items.push((tl!("Convert Selected Anchor Points to Smooth"), "dc-anchor-smooth", TASK_BAR_TO_SMOOTH, none())); items.push((tl!("Simplify"), "spline", "object.path.simplify", none())); + items.push((tl!("Smooth"), "dc-smooth", "object.path.smooth", none())); } else if !anchors { if open_path { items.push((tl!("Join"), "dc-join", "path.join", none())); @@ -234,28 +281,21 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { let paints = chip_paints(app, ui.ctx()); let colored = has_colors(&st.doc, &st.selection.objects); let doc = st.uid; - // Under the selection's lowest corner on screen, centered on the selection (the view may be - // rotated). - let lowest = xf.quad(b).iter().map(|c| c.y).fold(f32::NEG_INFINITY, f32::max); - let anchor = pos2(xf.to_screen(b.center()).x, lowest); let bounds = xf.rect.shrink(8.0); // The canvas's width less the frame's margins and stroke. let room = bounds.width() - BAR_FRAME; // On a canvas too narrow for the type controls at their narrowest, the bar leaves them out. let fonts = fonts && room >= crate::panels::character::task_bar_min_room(); // The selected objects' Fill, Stroke, Recolor Artwork (when they have colours to recolour) and - // Lock (a basic shape's properties instead), left out with the Artboard tool. A Type tool's bar - // has the Fill alone. - let chips: Vec = [ - (!on_artboards, Chip::Fill), - (!on_artboards && !typing, Chip::Stroke), - (!on_artboards && !typing && colored, Chip::Recolor), - (!on_artboards && !typing, Chip::Lock), - ] - .into_iter() - .filter_map(|(shown, chip)| shown.then_some(chip)) - .collect(); - let widths: Vec = items.iter().map(|(label, ..)| action_width(ui, label)).collect(); + // Lock (a basic shape's properties instead), left out with the Artboard tool and on a blank + // canvas, which have no selected objects. A Type tool's bar has the Fill alone. + let objects = !on_artboards && !blank; + let chips: Vec = + [(objects, Chip::Fill), (objects && !typing, Chip::Stroke), (objects && !typing && colored, Chip::Recolor), (objects && !typing, Chip::Lock)] + .into_iter() + .filter_map(|(shown, chip)| shown.then_some(chip)) + .collect(); + let widths: Vec = items.iter().map(|(label, _, cmd, _)| if icon_only(cmd) { BAR_MORE } else { action_width(ui, label) }).collect(); let font_w = fonts.then(|| { let w = crate::panels::character::TASK_BAR_WIDTHS; w.iter().sum::() + BAR_GAP * (w.len() - 1) as f32 @@ -330,7 +370,17 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { } } for ((label, icon, cmd, params), at) in items.iter().zip(&layout.actions) { - if *at == Some(row) && action_button(ui, &t, label, icon) { + if *at != Some(row) { + continue; + } + // The convert buttons show their icon alone, named by their hover text, as + // the Control bar's do. + let clicked = if icon_only(cmd) { + widgets::icon_button(ui, icon, label, false, BAR_MORE).clicked() + } else { + action_button(ui, &t, label, icon) + }; + if clicked { run = Some((*cmd, params.clone())); } } @@ -422,7 +472,7 @@ pub(super) fn task_bar(app: &mut VectorcraftApp, ui: &mut Ui, xf: &Xf) { Some((TASK_BAR_ARTBOARD_OPTIONS, _)) => crate::menus::invoke(app, "tool.options", json!({"tool": "artboard"})), Some((TASK_BAR_DUPLICATE_ARTBOARDS, _)) => crate::panels::artboards::duplicate_picked(app), Some((TASK_BAR_REARRANGE_ARTBOARDS, _)) => crate::panels::artboards::open_rearrange(app), - // Corner and Smooth convert the direct-selected anchors, as the Control bar's buttons do. + // The convert buttons convert the direct-selected anchors, as the Control bar's buttons do. Some((TASK_BAR_TO_CORNER, _)) => crate::menus::invoke(app, "path.convertAnchors", json!({"to": "corner"})), Some((TASK_BAR_TO_SMOOTH, _)) => crate::menus::invoke(app, "path.convertAnchors", json!({"to": "smooth"})), Some((c, p)) => crate::menus::invoke(app, c, p), @@ -627,6 +677,11 @@ fn paint_or_object_chip( } } +/// Whether the bar's item that runs `cmd` shows its icon alone: the anchor convert buttons. +fn icon_only(cmd: &str) -> bool { + matches!(cmd, TASK_BAR_TO_CORNER | TASK_BAR_TO_SMOOTH) +} + /// The paints the Fill and Stroke chips show, and whether each is mixed ("?"): the proxies', or /// while a Type tool edits type, the edited characters' fill, which a swatch picked then paints. pub(crate) fn chip_paints(app: &VectorcraftApp, ctx: &egui::Context) -> (vectorcraft_color::Paint, vectorcraft_color::Paint, bool, bool) { @@ -677,8 +732,11 @@ const TASK_BAR_DUPLICATE_ARTBOARDS: &str = "taskBar.duplicateArtboards"; /// The Contextual Task Bar's Rearrange All button with the Artboard tool. const TASK_BAR_REARRANGE_ARTBOARDS: &str = "taskBar.rearrangeArtboards"; -/// The Contextual Task Bar's Corner button for direct-selected anchors. +/// The Contextual Task Bar's Convert Selected Anchor Points to Corner button, for direct-selected +/// anchors or a path selected whole with Direct Selection. const TASK_BAR_TO_CORNER: &str = "taskBar.toCorner"; -/// The Contextual Task Bar's Smooth button for direct-selected anchors. +/// The Contextual Task Bar's Convert Selected Anchor Points to Smooth button, for direct-selected +/// anchors or a path selected whole with Direct Selection. The bar's Smooth button runs +/// `object.path.smooth` instead. const TASK_BAR_TO_SMOOTH: &str = "taskBar.toSmooth"; diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 2a7162f9a1..d5dfe4e307 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -7416,6 +7416,73 @@ fn space_types_a_space_while_editing_text_and_does_not_pan() { assert_eq!(plain(&app, id), "a ", "the text is as typed"); } +/// While the Type tool edits text, a zoom marquee that Cmd+Space started keeps its Space rules once +/// Cmd is let go: Space held since the press sizes it, and Space pressed again moves it on every +/// frame it stays held, without typing a space. With no marquee, Space types a space again, and +/// during an animated zoom drag it types none. +#[test] +fn space_moves_a_text_edit_zoom_marquee_after_cmd_is_let_go() { + use egui::{Event, Modifiers}; + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.prefs.placeholder_text = false; + app.run("prefs.set", json!({"key": "animatedZoom", "value": false})).unwrap(); + let ctx = egui::Context::default(); + let id = start_typing(&mut app, &ctx); + let rect = app.canvas_rect.unwrap(); + let at = rect.center() - vec2(100.0, 50.0); + let space = |pressed, modifiers| Event::Key { key: egui::Key::Space, physical_key: None, pressed, repeat: false, modifiers }; + let button = |pos, pressed, modifiers| Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers }; + let corners = |app: &mut VectorcraftApp| -> (Pos2, Pos2) { + let lines: Vec> = shapes(app, &ctx) + .into_iter() + .filter_map(|s| match s { + Shape::Path(p) if p.stroke.color == egui::epaint::ColorMode::Solid(Color32::from_white_alpha(230)) => Some(p.points), + _ => None, + }) + .collect(); + let [line] = &lines[..] else { panic!("one marquee: {lines:?}") }; + (line[0], line[2]) + }; + typing_frame(&mut app, &ctx, vec![Event::Text("a".into())]); + let z0 = app.view().unwrap().zoom; + // Space held since the Cmd+Space press sizes the marquee, also once Cmd is let go. + typing_frame(&mut app, &ctx, vec![Event::ModifiersChanged(Modifiers::COMMAND), space(true, Modifiers::COMMAND), Event::PointerMoved(at)]); + typing_frame(&mut app, &ctx, vec![button(at, true, Modifiers::COMMAND)]); + typing_frame(&mut app, &ctx, vec![Event::PointerMoved(at + vec2(50.0, 25.0))]); + typing_frame(&mut app, &ctx, vec![Event::ModifiersChanged(Modifiers::NONE), Event::PointerMoved(at + vec2(80.0, 40.0))]); + typing_frame(&mut app, &ctx, vec![Event::PointerMoved(at + vec2(100.0, 50.0))]); + assert_eq!(corners(&mut app), (at, at + vec2(100.0, 50.0)), "Space held since the press sizes it"); + // Let go and pressed again, Space moves the marquee on this frame and the frames after it. + typing_frame(&mut app, &ctx, vec![space(false, Modifiers::NONE)]); + typing_frame(&mut app, &ctx, vec![space(true, Modifiers::NONE), Event::Text(" ".into()), Event::PointerMoved(at + vec2(120.0, 60.0))]); + typing_frame(&mut app, &ctx, vec![Event::PointerMoved(at + vec2(140.0, 70.0))]); + assert_eq!(corners(&mut app), (at + vec2(40.0, 20.0), at + vec2(140.0, 70.0)), "Space moves it and keeps its 100 × 50 size"); + assert_eq!(plain(&app, id), "a", "the Space that moves the marquee types nothing"); + typing_frame(&mut app, &ctx, vec![space(false, Modifiers::NONE)]); + typing_frame(&mut app, &ctx, vec![space(true, Modifiers::NONE), Event::Ime(egui::ImeEvent::Commit(" ".into()))]); + assert_eq!(plain(&app, id), "a", "nor does a space an input method commits for it"); + // Let go, the drag sizes it again, and the release zooms to the moved marquee. + typing_frame(&mut app, &ctx, vec![space(false, Modifiers::NONE), Event::PointerMoved(at + vec2(180.0, 95.0))]); + assert_eq!(corners(&mut app), (at + vec2(40.0, 20.0), at + vec2(180.0, 95.0)), "let go, the drag sizes it again"); + typing_frame(&mut app, &ctx, vec![button(at + vec2(180.0, 95.0), false, Modifiers::NONE)]); + let want = z0 * f64::from((rect.width() / 140.0).min(rect.height() / 75.0)); + assert!((app.view().unwrap().zoom - want).abs() < 1e-6, "{z0} → {}, not {want}", app.view().unwrap().zoom); + assert!(app.session.tool_wants_text(), "editing goes on"); + // With no marquee, Space types a space. + typing_frame(&mut app, &ctx, vec![space(true, Modifiers::NONE), Event::Text(" ".into())]); + typing_frame(&mut app, &ctx, vec![space(false, Modifiers::NONE)]); + assert_eq!(plain(&app, id), "a ", "Space types a space"); + // With Animated Zoom, Space during the Cmd+Space drag does not type a space either. + app.run("prefs.set", json!({"key": "animatedZoom", "value": true})).unwrap(); + typing_frame(&mut app, &ctx, vec![Event::ModifiersChanged(Modifiers::COMMAND), space(true, Modifiers::COMMAND), Event::PointerMoved(at)]); + typing_frame(&mut app, &ctx, vec![button(at, true, Modifiers::COMMAND)]); + typing_frame(&mut app, &ctx, vec![Event::ModifiersChanged(Modifiers::NONE), space(false, Modifiers::NONE)]); + typing_frame(&mut app, &ctx, vec![space(true, Modifiers::NONE), Event::Text(" ".into())]); + typing_frame(&mut app, &ctx, vec![button(at, false, Modifiers::NONE)]); + typing_frame(&mut app, &ctx, vec![space(false, Modifiers::NONE)]); + assert_eq!(plain(&app, id), "a ", "the text is as typed"); +} + #[test] fn space_shift_drag_rotates_the_view_whatever_the_tool() { use egui::{Event, Modifiers}; @@ -10333,7 +10400,7 @@ fn task_bar_labels(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<(String /// With the Artboard tool, the Contextual Task Bar sits under the selected artboards and offers /// Resize, Duplicate, Rearrange All (with two or more artboards) and Export instead of the /// selected objects' actions. With the Selection tool it offers the objects' actions again, and -/// with nothing selected it doesn't show. +/// with nothing in the document the blank canvas actions. #[test] fn the_task_bar_offers_the_artboard_tools_actions() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); @@ -10341,7 +10408,7 @@ fn the_task_bar_offers_the_artboard_tools_actions() { app.select_tool("selection"); let ctx = egui::Context::default(); let names = |app: &mut VectorcraftApp| task_bar_labels(app, &ctx).into_iter().map(|(t, _)| t).collect::>(); - assert!(names(&mut app).is_empty() && task_bar_rect(&ctx).is_none(), "nothing selected: no bar"); + assert_eq!(names(&mut app), ["Draw (Pencil)", "Place Image"], "a blank canvas"); app.select_tool("artboard"); crate::panels::artboards::select(&mut app, 1); @@ -10447,9 +10514,34 @@ fn the_artboard_tools_task_bar_buttons_act_on_the_selected_artboards() { assert_eq!(boards(&app), before, "one undo step"); } +/// The names and places of the buttons the Contextual Task Bar draws, from the accessibility tree +/// (`ctx` has it enabled): an icon-only button is named by its hover text. +fn task_bar_buttons(app: &mut VectorcraftApp, ctx: &egui::Context) -> Vec<(String, egui::Rect)> { + frame(app, ctx, vec![]); + let raw = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, vec2(800.0, 600.0))), ..Default::default() }; + let mut out = ctx.run_ui(raw, |ui| show(app, ui)); + out.textures_delta.clear(); + let Some(bar) = task_bar_rect(ctx) else { return vec![] }; + let Some(update) = out.platform_output.accesskit_update.as_ref() else { return vec![] }; + let mut v: Vec<(String, egui::Rect)> = update + .nodes + .iter() + .filter(|(_, n)| n.role() == egui::accesskit::Role::Button) + .filter_map(|(_, n)| { + let b = n.bounds()?; + let r = egui::Rect::from_min_max(Pos2::new(b.x0 as f32, b.y0 as f32), Pos2::new(b.x1 as f32, b.y1 as f32)); + let label = n.label()?; + bar.contains(r.center()).then(|| (label.to_string(), r)) + }) + .collect(); + v.sort_by(|a, b| a.1.left().total_cmp(&b.1.left())); + v +} + /// With anchors direct-selected, the Contextual Task Bar offers Remove Anchor Points, Connect, -/// Cut Path, Corner and Smooth. Smooth and Corner convert the selected anchor, Cut Path opens -/// the path there and Connect closes it again, as the Control bar's anchor buttons do. +/// Cut Path and the two convert buttons, which show their icons alone. Converting to smooth and to +/// corner changes the selected anchor, Cut Path opens the path there and Connect closes it again, +/// as the Control bar's anchor buttons do. #[test] fn the_task_bar_connects_cuts_and_converts_direct_selected_anchors() { let mut app = VectorcraftApp::new(Session::new(), Default::default()); @@ -10458,10 +10550,21 @@ fn the_task_bar_connects_cuts_and_converts_direct_selected_anchors() { app.select_tool("directSelection"); app.run("select.anchors", json!({"id": id, "anchors": [[0, 1]]})).unwrap(); let ctx = egui::Context::default(); + ctx.enable_accesskit(); let names = |app: &mut VectorcraftApp| task_bar_labels(app, &ctx).into_iter().map(|(t, _)| t).collect::>(); - assert_eq!(names(&mut app), ["Remove Anchor Points", "Connect", "Cut Path", "Corner", "Smooth", "Duplicate"]); + assert_eq!(names(&mut app), ["Remove Anchor Points", "Connect", "Cut Path", "Duplicate"]); + let buttons = task_bar_buttons(&mut app, &ctx).into_iter().map(|(t, _)| t).collect::>(); + let expected = [ + "Remove Anchor Points", + "Connect", + "Cut Path", + "Convert Selected Anchor Points to Corner", + "Convert Selected Anchor Points to Smooth", + "Duplicate", + ]; + assert_eq!(buttons[..expected.len()], expected, "{buttons:?}"); let press = |app: &mut VectorcraftApp, label: &str| { - let labels = task_bar_labels(app, &ctx); + let labels = task_bar_buttons(app, &ctx); let at = labels.iter().find(|(t, _)| t == label).unwrap_or_else(|| panic!("{label} in {labels:?}")).1.center(); let button = |pressed| egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: Default::default() }; frame(app, &ctx, vec![egui::Event::PointerMoved(at)]); @@ -10471,11 +10574,11 @@ fn the_task_bar_connects_cuts_and_converts_direct_selected_anchors() { let subpath = |app: &VectorcraftApp| app.session.active().unwrap().doc.node(vectorcraft_doc::NodeId(id)).unwrap().path_data().unwrap().subpaths[0].clone(); let last_undo = |app: &VectorcraftApp| app.session.active().unwrap().history.undo.last().unwrap().label.clone(); - press(&mut app, "Smooth"); + press(&mut app, "Convert Selected Anchor Points to Smooth"); let a = subpath(&app).anchors[1]; assert!(a.has_in() && a.has_out(), "smooth: {a:?}"); assert_eq!(last_undo(&app), "Convert Anchor Points"); - press(&mut app, "Corner"); + press(&mut app, "Convert Selected Anchor Points to Corner"); let a = subpath(&app).anchors[1]; assert!(!a.has_in() && !a.has_out(), "corner: {a:?}"); press(&mut app, "Cut Path"); diff --git a/crates/ui-egui/src/chrome/control_bar.rs b/crates/ui-egui/src/chrome/control_bar.rs index 5ac4025c24..fc06926247 100644 --- a/crates/ui-egui/src/chrome/control_bar.rs +++ b/crates/ui-egui/src/chrome/control_bar.rs @@ -30,7 +30,8 @@ pub fn anchor_controls(app: &VectorcraftApp) -> AnchorControls { /// What the Control bar and the Properties panel offer for selected anchors ([`anchor_controls`]): /// "Convert:" corner or smooth, then "Anchors:" remove, connect (Join) and cut. Each group is a -/// row of its own: inline in the Control bar, one under the other in a panel. +/// row of its own: inline in the Control bar, one under the other in a panel. In the Control bar's +/// row, a group shows only while the row has room for its label and all its buttons. pub fn anchor_buttons(app: &mut VectorcraftApp, ui: &mut Ui, controls: AnchorControls) { let t = Tokens::get(ui.ctx()); let mut run = None; @@ -56,9 +57,14 @@ pub fn anchor_buttons(app: &mut VectorcraftApp, ui: &mut Ui, controls: AnchorCon AnchorControls::Convert => 1, AnchorControls::All => groups.len(), }; + let in_row = ui.layout().main_dir() == egui::Direction::LeftToRight; for (label, buttons) in groups.into_iter().take(shown) { + let text = egui::RichText::new(label).size(12.0).color(t.text); + if in_row && ui.available_width() < row_width(ui, &[widgets::text_width(ui, text.clone())]) + buttons_width(ui, buttons.len()) { + break; + } ui.horizontal(|ui| { - ui.label(egui::RichText::new(label).size(12.0).color(t.text)); + ui.label(text); for &(icon, tip, id, to) in buttons { if widgets::icon_button(ui, icon, tip, false, 24.0).clicked() { run = Some((id, to.map_or_else(|| json!({}), |to| json!({ "to": to })))); @@ -78,6 +84,12 @@ pub(super) const ISOLATION_BUTTON: &str = "cb-isolation"; /// less, the menu is left out so those controls still fit the narrowest window. const ARTBOARD_SNAPPING_WIDTH: f32 = 900.0; +/// The width of [`snapping_menu`]'s button: its label, as a button draws it, and the button's padding. +fn snapping_width(ui: &Ui) -> f32 { + let label = egui::WidgetText::from(tl!("Snapping")).into_galley(ui, Some(egui::TextWrapMode::Extend), f32::INFINITY, egui::TextStyle::Button); + label.size().x + 2.0 * ui.spacing().button_padding.x +} + /// The Control bar's snapping quick access; every change uses its existing command, and Pixel /// Snapping Options… opens the dialog of `view.snapToPixel.options`. fn snapping_menu(app: &mut VectorcraftApp, ui: &mut Ui) { @@ -115,9 +127,10 @@ fn snapping_menu(app: &mut VectorcraftApp, ui: &mut Ui) { /// while a symbol's art is the isolated layer. Otherwise, with one object selected that /// [`vectorcraft_tools::select::isolates`], it is Isolate Selected Object, which also isolates a /// path inside a group that Direct Selection selected. An envelope's contents get no button: the -/// envelope's Edit Envelope and Edit Contents buttons show instead. +/// envelope's Edit Envelope and Edit Contents buttons show instead. It is left out when the bar has +/// no room left for it. fn isolation_button(app: &mut VectorcraftApp, ui: &mut Ui) { - let Some(st) = app.session.active() else { return }; + let Some(st) = app.session.active().filter(|_| ui.available_width() >= BUTTON) else { return }; let (icon, tip, id) = if st.isolation.is_some() { if st.doc.pattern_edit.is_some() { return; @@ -151,9 +164,9 @@ const GLOBAL_EDIT_OPTIONS_WIDTH: f32 = 24.0; /// It opens the Properties panel's Global Edit Options, which set the same session options, and is /// off and closed while Global Edit is on, as that panel's dropdown is. It sits after Recolor /// Artwork, ahead of the X/Y/W/H fields that the bar leaves out when it runs short of room, and is -/// left out only when no room is left for it. -fn global_edit_options(app: &mut VectorcraftApp, ui: &mut Ui) { - if !crate::menus::enabled(app, "select.globalEdit") || ui.available_width() < GLOBAL_EDIT_OPTIONS_WIDTH { +/// left out when the room left, less `reserve` ([`transform_reserve`]), cannot hold it. +fn global_edit_options(app: &mut VectorcraftApp, ui: &mut Ui, reserve: f32) { + if !crate::menus::enabled(app, "select.globalEdit") || ui.available_width() < row_width(ui, &[GLOBAL_EDIT_OPTIONS_WIDTH]) + reserve { return; } let on = app.session.active().is_some_and(|d| d.global_edit.is_some()); @@ -204,8 +217,27 @@ fn buttons_width(ui: &Ui, n: usize) -> f32 { (BUTTON + ui.spacing().item_spacing.x) * n as f32 } +/// The room controls `widths` wide take side by side in the bar's row, with the spacing after each. +fn row_width(ui: &Ui, widths: &[f32]) -> f32 { + widths.iter().map(|w| w + ui.spacing().item_spacing.x).sum() +} + +/// The size of the Control bar's Fill, Stroke and Graphic Style chips. +const PAINT_CHIP: f32 = 22.0; + +/// The width each of those chips takes with the chevron after it. +const CHIP_WIDTH: f32 = PAINT_CHIP + 16.0; + +/// The widths of the Control bar's stroke weight and Opacity fields. +const WEIGHT_FIELD_WIDTH: f32 = 100.0; +const OPACITY_FIELD_WIDTH: f32 = 56.0; + /// The separator that ends a group of the Control bar's controls, as [`group_end_width`] measures it. +/// It is left out when the bar has no room left for it. fn group_end(ui: &mut Ui) { + if ui.available_width() < group_end_width(ui) { + return; + } ui.add_space(GROUP_GAP); boundary(ui, separator); } @@ -256,8 +288,11 @@ fn boundary(ui: &mut Ui, draw: impl FnOnce(&mut Ui)) { } /// The separator that ends a group of the Control bar's controls, drawn as `ui.separator()` draws -/// one, and left out when no control follows it ([`boundary`]). +/// one, and left out when no control follows it ([`boundary`]) or the row has no room left for it. pub(crate) fn group_separator(ui: &mut Ui) { + if ui.layout().main_dir() == egui::Direction::LeftToRight && ui.available_width() < separator_width(ui) { + return; + } boundary(ui, |ui| { ui.separator(); }); @@ -298,20 +333,30 @@ fn end_width(app: &VectorcraftApp, ui: &Ui, nothing_selected: bool) -> f32 { } } +/// The room the Control bar's Fill and Stroke, Opacity, Graphic Style and Character groups leave +/// for the Transform link: the link and the gap and separator ahead of it, while something is +/// `selected` and the panel menu has the Transform group on, or none. Those groups show each control +/// only while this room is left after it, so the bar leaves them out before the link. +fn transform_reserve(app: &VectorcraftApp, ui: &Ui, selected: bool) -> f32 { + if selected && group_on(app, "transform") { group_end_width(ui) + crate::panels::transform::link_width(ui) } else { 0.0 } +} + /// Draws the Control bar's groups between its Character controls and the Transform link, and /// returns whether the Transform link and X/Y/W/H follow (false: nothing is selected, and Document /// Setup and Preferences, drawn here, end the bar, or the Transform group is off). The groups are /// the Paragraph section and area type's vertical alignment (#3759), then the Align buttons, the /// Align To menu and, for two or more objects, the Distribute buttons (a single object keeps the bar /// as it was); each shows only while the end of the bar keeps its room. Groups the panel menu has -/// off are left out, and take no room. -fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize) -> bool { +/// off are left out, and take no room. Without `room` (the Character group had none), all of these +/// groups are left out, so the bar trims them from its right end before the Character group. +fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize, room: bool) -> bool { let nothing = objects == 0; let end = end_width(app, ui, nothing); - if group_on(app, "paragraph") && crate::panels::paragraph::control_bar(app, ui, BUTTON, |ui| group_end_width(ui) + end) { + if room && group_on(app, "paragraph") && crate::panels::paragraph::control_bar(app, ui, BUTTON, |ui| group_end_width(ui) + end) { group_end(ui); } - if group_on(app, "verticalAlignment") + if room + && group_on(app, "verticalAlignment") && crate::panels::properties::vertical_align::shown(app).is_some() && ui.available_width() >= buttons_width(ui, 4) + group_end_width(ui) + end && crate::panels::properties::vertical_align::buttons(app, ui, BUTTON) @@ -319,11 +364,13 @@ fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize group_end(ui); } if nothing { + // Each button shows only while the bar has room left for it, so Preferences can show + // when Document Setup did not fit. if group_on(app, "documentOptions") { - if widgets::flat_button(ui, tl!("Document Setup"), DOCUMENT_SETUP_WIDTH).clicked() { + if ui.available_width() >= DOCUMENT_SETUP_WIDTH && widgets::flat_button(ui, tl!("Document Setup"), DOCUMENT_SETUP_WIDTH).clicked() { app.run("file.documentSetup", json!({})).ok(); } - if widgets::flat_button(ui, tl!("Preferences"), PREFERENCES_WIDTH).clicked() { + if ui.available_width() >= PREFERENCES_WIDTH && widgets::flat_button(ui, tl!("Preferences"), PREFERENCES_WIDTH).clicked() { app.run("edit.preferences", json!({})).ok(); } } @@ -331,7 +378,7 @@ fn groups_before_transform(app: &mut VectorcraftApp, ui: &mut Ui, objects: usize } let transform = group_on(app, "transform"); let end = if transform { separator_width(ui) + end } else { 0.0 }; - if group_on(app, "alignDistribute") && ui.available_width() >= buttons_width(ui, 7) + end { + if room && group_on(app, "alignDistribute") && ui.available_width() >= buttons_width(ui, 7) + end { crate::panels::align::align_buttons(app, ui, BUTTON); if ui.available_width() >= crate::panels::align::align_to_menu_width(BUTTON) + ui.spacing().item_spacing.x + end { crate::panels::align::align_to_menu(app, ui, BUTTON); @@ -545,55 +592,80 @@ fn panel_menu(app: &mut VectorcraftApp, ui: &mut Ui, rect: egui::Rect) { /// The Control bar's Fill and Stroke group: the fill and stroke chips, the Stroke link, the weight /// and the width profile, and the separator after them while a control follows ([`group_separator`]). -fn fill_and_stroke(app: &mut VectorcraftApp, ui: &mut Ui) { +/// Short of room, the bar leaves out the width profile first, then the Stroke link with the weight, +/// then the two chips; each shows only while the bar has room for all of it and `reserve` after it +/// ([`transform_reserve`]). +fn fill_and_stroke(app: &mut VectorcraftApp, ui: &mut Ui, reserve: f32) { + if ui.available_width() < row_width(ui, &[CHIP_WIDTH, CHIP_WIDTH]) + reserve { + return; + } let shown_stroke = crate::panels::current_stroke(app); let mixed = crate::panels::stroke_mixed(app, ui.ctx()); let weight = stroke_panel::shown_weight(app, shown_stroke.as_ref(), &mixed); - crate::panels::paint_chip(app, ui, false, 22.0, true); - crate::panels::paint_chip(app, ui, true, 22.0, true); + crate::panels::paint_chip(app, ui, false, PAINT_CHIP, true); + crate::panels::paint_chip(app, ui, true, PAINT_CHIP, true); // The link opens the Stroke panel as a popover under it; then the weight spinner // (with presets) and the width profile. - stroke_panel::link(app, ui, tl!("Stroke:")); - stroke_panel::weight_field(app, ui, "cb-stroke", weight, 100.0); - if let Some(id) = stroke_panel::profile_dropdown(app, ui, shown_stroke.as_ref().and_then(|s| s.profile.as_ref())) { - app.run("stroke.set", json!({"profile": id})).ok(); + let link = widgets::text_width(ui, stroke_panel::link_text(ui, tl!("Stroke:"))); + if ui.available_width() >= row_width(ui, &[link, WEIGHT_FIELD_WIDTH]) + reserve { + stroke_panel::link(app, ui, tl!("Stroke:")); + stroke_panel::weight_field(app, ui, "cb-stroke", weight, WEIGHT_FIELD_WIDTH); + if ui.available_width() >= row_width(ui, &[stroke_panel::PROFILE_DROPDOWN_WIDTH]) + reserve + && let Some(id) = stroke_panel::profile_dropdown(app, ui, shown_stroke.as_ref().and_then(|s| s.profile.as_ref())) + { + app.run("stroke.set", json!({"profile": id})).ok(); + } } - ui.add_space(4.0); - group_separator(ui); + group_end(ui); } /// The Control bar's Opacity group (its link and field, showing `opacity`) and, with something /// `selected`, its Graphic Style group (Style, Recolor Artwork and Global Edit Options), each while -/// the panel menu has it on, and the separator after them while a control follows. -fn opacity_and_style(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, opacity: f32, selected: bool) { +/// the panel menu has it on, and the separator after them while a control follows. Short of room, +/// the bar leaves out Global Edit Options first, then Recolor Artwork, then the Style link with its +/// chip. The Opacity link with its field and the Style link with its chip each show only while the +/// bar has room for all of it and `reserve` after it ([`transform_reserve`]), so the narrower Style +/// part can show without the Opacity part. +fn opacity_and_style(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, opacity: f32, selected: bool, reserve: f32) { let (opacity_on, style_on) = (group_on(app, "opacity"), group_on(app, "graphicStyle") && selected); + let mut drawn = false; if opacity_on { - // A click opens the Transparency panel; a drag scrubs the field (#4088). - if crate::scrub::link_label(ui, egui::RichText::new(tl!("Opacity:")).size(12.0).color(t.text).underline()).clicked() { - app.ui.open_panel = Some("transparency".into()); - } - if let Some(o) = widgets::plain_field(ui, "cb-opacity", opacity as f64 * 100.0, "%", 0, 56.0) - && selected - { - app.run("transparency.set", json!({"opacity": o.clamp(0.0, 100.0)})).ok(); + let text = egui::RichText::new(tl!("Opacity:")).size(12.0).color(t.text).underline(); + if ui.available_width() >= row_width(ui, &[widgets::text_width(ui, text.clone()), OPACITY_FIELD_WIDTH]) + reserve { + // A click opens the Transparency panel; a drag scrubs the field (#4088). + if crate::scrub::link_label(ui, text).clicked() { + app.ui.open_panel = Some("transparency".into()); + } + if let Some(o) = widgets::plain_field(ui, "cb-opacity", opacity as f64 * 100.0, "%", 0, OPACITY_FIELD_WIDTH) + && selected + { + app.run("transparency.set", json!({"opacity": o.clamp(0.0, 100.0)})).ok(); + } + drawn = true; } } - if style_on { + let text = egui::RichText::new(tl!("Style:")).size(12.0).color(t.text).underline(); + if style_on && ui.available_width() >= GROUP_GAP + row_width(ui, &[widgets::text_width(ui, text.clone()), CHIP_WIDTH]) + reserve { // Style picker: the selection's graphic style; its menu applies another. - ui.add_space(4.0); - if ui.link(egui::RichText::new(tl!("Style:")).size(12.0).color(t.text).underline()).clicked() { + ui.add_space(GROUP_GAP); + if ui.link(text).clicked() { app.ui.open_panel = Some("graphicStyles".into()); } - let resp = widgets::chip_button_named(ui, 22.0, true, tl!("Graphic Style"), |ui, r| crate::panels::graphic_styles::paint_linked(app, ui, r)); + let resp = + widgets::chip_button_named(ui, PAINT_CHIP, true, tl!("Graphic Style"), |ui, r| crate::panels::graphic_styles::paint_linked(app, ui, r)); egui::Popup::menu(&resp).show(|ui| crate::panels::graphic_styles::picker(app, ui)); // Recolor Artwork, when the selection has colours to recolour. let colored = app.session.active().is_some_and(|st| crate::canvas::has_colors(&st.doc, &st.selection.objects)); - if colored && widgets::icon_button(ui, "palette", tl!("Recolor Artwork"), false, 24.0).clicked() { + if colored + && ui.available_width() >= buttons_width(ui, 1) + reserve + && widgets::icon_button(ui, "palette", tl!("Recolor Artwork"), false, BUTTON).clicked() + { crate::menus::invoke(app, "ui.recolorDialog", json!({})); } - global_edit_options(app, ui); + global_edit_options(app, ui, reserve); + drawn = true; } - if opacity_on || style_on { + if drawn { group_separator(ui); } } @@ -709,11 +781,16 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, } gripper(app, ui, t, bar, dock_room); if app.session.active().is_none() { - ui.label(egui::RichText::new(tl!("No Document")).color(t.text_dim)); + let text = egui::RichText::new(tl!("No Document")).color(t.text_dim); + if ui.available_width() >= widgets::text_width(ui, text.clone()) { + ui.label(text); + } return; } // The Artboard tool's controls fill the narrowest window, so they keep it to themselves there. - if group_on(app, "snapping") && (app.session.tool_id() != "artboard" || ui.available_width() >= ARTBOARD_SNAPPING_WIDTH) { + // Any other tool's bar shows the menu while it has room for it. + let snapping_room = if app.session.tool_id() == "artboard" { ARTBOARD_SNAPPING_WIDTH } else { snapping_width(ui) }; + if group_on(app, "snapping") && ui.available_width() >= snapping_room { snapping_menu(app, ui); } let Some(st) = app.session.active() else { return }; @@ -739,7 +816,10 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, _ => tl!(crate::panels::appearance::object_label(app)), }; let has_first = first.is_some(); - ui.label(egui::RichText::new(label).font(theme::semibold(12.0)).color(t.text)); + let label = egui::RichText::new(label).font(theme::semibold(12.0)).color(t.text); + if ui.available_width() >= widgets::text_width(ui, label.clone()) { + ui.label(label); + } // With the Artboard tool in use, the bar shows the active artboard's controls in place // of the object controls. let (artboard_options, transform) = (group_on(app, "artboardOptions"), group_on(app, "transform")); @@ -755,7 +835,9 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, if object_options { isolation_button(app, ui); } - ui.add_space(6.0); + if ui.available_width() >= 6.0 { + ui.add_space(6.0); + } // An image or an Image Trace object shows its own controls in place of Fill and Stroke, // and leaves Fill and Stroke out while the Image Options group is off too. let image = if group_on(app, "imageOptions") { @@ -771,19 +853,26 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect, crate::panels::symbols::control_bar(app, ui); } let opacity = if has_first { crate::panels::current_transparency(app).map_or(1.0, |t| t.0) } else { 1.0 }; + let reserve = transform_reserve(app, ui, !sel.is_empty()); if !image && group_on(app, "fillStroke") { - fill_and_stroke(app, ui); + fill_and_stroke(app, ui, reserve); } - opacity_and_style(app, ui, t, opacity, !sel.is_empty()); - if group_on(app, "character") { - crate::panels::character::control_bar(app, ui); - } - if !groups_before_transform(app, ui, sel.len()) { + opacity_and_style(app, ui, t, opacity, !sel.is_empty(), reserve); + // The Character group shows whole, with the Transform link's room left after it, or not at + // all; left out, it leaves out the groups between it and the link too. + let room = !group_on(app, "character") || crate::panels::character::control_bar(app, ui, reserve); + if !groups_before_transform(app, ui, sel.len(), room) { erase_trailing(ui); return; } // The Transform link opens the whole Transform panel (reference point, rotate, - // shear, options) in a popover; X/Y/W/H follow inline while the bar has room. + // shear, options) in a popover; X/Y/W/H follow inline while the bar has room. The + // groups from Fill and Stroke on keep its room, but the controls ahead of them can + // still take it. + if ui.available_width() < crate::panels::transform::link_width(ui) { + erase_trailing(ui); + return; + } crate::panels::transform::link(app, ui); // The bounding box, rotated with rotated objects: its centre and its own sides. if let Some(b) = app.selection_box() diff --git a/crates/ui-egui/src/chrome/tests.rs b/crates/ui-egui/src/chrome/tests.rs index 052c7ec230..be37f10a29 100644 --- a/crates/ui-egui/src/chrome/tests.rs +++ b/crates/ui-egui/src/chrome/tests.rs @@ -3037,6 +3037,127 @@ fn no_separator_is_left_at_the_end_of_the_control_bar() { assert!(stray.is_empty(), "a separator with nothing after it: {stray:#?}"); } +/// The shapes of the Control bar's controls drawn in window `screen` that reach past the left edge +/// of its panel menu button, or past the room a floating bar clips its controls to, or `None` when +/// the bar leaves the button out. +fn control_bar_overflow(app: &mut crate::VectorcraftApp, ctx: &egui::Context, screen: egui::Rect) -> Option> { + control_bar_frame_in(app, ctx, screen, vec![]); + let out = ctx.run_ui(egui::RawInput { screen_rect: Some(screen), ..Default::default() }, |ui| super::control_bar(app, ui)); + let nodes: Vec<_> = out.platform_output.accesskit_update.map(|u| u.nodes.into_iter().map(|(_, n)| n).collect()).unwrap_or_default(); + let menu_left = nodes.iter().find(|n| n.label().is_some_and(|l| l == "Panel menu")).and_then(|n| n.bounds())?.x0 as f32; + // The bar's frame spans the whole bar, the panel menu button included. + let bar_width = if app.ui.control_bar_floating { screen.width().min(800.0) } else { screen.width() }; + let shapes = out.shapes.iter().filter_map(|cs| { + let r = cs.shape.visual_bounding_rect(); + let control = r.is_finite() && cs.clip_rect.intersects(r) && r.width() < bar_width - 4.0 && r.min.x < menu_left - 0.5; + let clipped = cs.clip_rect.right() < menu_left && r.right() > cs.clip_rect.right() + 0.5; + (control && (r.right() > menu_left + 0.5 || clipped)).then_some(r) + }); + Some(shapes.collect()) +} + +/// In a narrow window, the Control bar leaves out a control it has no room for, Fill and Stroke, +/// Opacity and Character included: every control it shows is drawn whole, left of the panel menu button, which +/// shows in every width, with the bar docked to the top or the bottom or floating. +#[test] +fn the_control_bar_s_controls_stay_inside_the_bar_in_a_narrow_window() { + use crate::tests_removeanchors::{control_frame, has}; + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let mut faults = vec![]; + let mut check = |app: &mut crate::VectorcraftApp, case: &str| { + for (bottom, floating) in [(false, false), (true, false), (false, true)] { + (app.ui.control_bar_bottom, app.ui.control_bar_floating) = (bottom, floating); + for w in (150..=1500).step_by(9) { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(w as f32, 300.0)); + match control_bar_overflow(app, &ctx, screen) { + None => faults.push(format!("{case}, bottom {bottom}, floating {floating}, {w} wide: no panel menu")), + Some(over) if !over.is_empty() => faults.push(format!("{case}, bottom {bottom}, floating {floating}, {w} wide: {over:?}")), + Some(_) => continue, + } + break; + } + } + (app.ui.control_bar_bottom, app.ui.control_bar_floating) = (false, false); + }; + app.run("select.set", json!({ "ids": [id] })).unwrap(); + let bar = control_frame(&mut app, &ctx, vec![]); + assert!(has(&bar, "Stroke:") && has(&bar, "Opacity:"), "Fill and Stroke and Opacity show in a wide window: {bar:?}"); + check(&mut app, "a rectangle selected"); + app.select_tool("directSelection"); + app.run("select.anchors", json!({"id": id, "anchors": [[0, 0]]})).unwrap(); + check(&mut app, "an anchor selected"); + app.select_tool("selection"); + let text = app.run("text.create", json!({"x": 20, "y": 120, "text": "Point"})).unwrap()["id"].clone(); + app.run("select.set", json!({ "ids": [text] })).unwrap(); + let bar = control_frame(&mut app, &ctx, vec![]); + assert!(has(&bar, "Character:"), "the Character group shows in a wide window: {bar:?}"); + check(&mut app, "type selected"); + app.run("select.set", json!({ "ids": [] })).unwrap(); + check(&mut app, "nothing selected"); + assert!(faults.is_empty(), "a control drawn past the bar's room: {faults:#?}"); +} + +/// With Opacity and Graphic Style on, a bar too narrow for the Opacity link and its field still +/// shows the narrower Style link and its chip when it has room for them. +#[test] +fn a_narrow_control_bar_shows_the_style_link_without_the_opacity_field() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + let id = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone(); + app.run("select.set", json!({ "ids": [id] })).unwrap(); + app.run("window.control.options", json!({"group": "fillStroke", "visible": false})).unwrap(); + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let shows = |nodes: &[egui::accesskit::Node], name: &str| nodes.iter().any(|n| n.label().is_some_and(|l| l == name)); + let (mut both, mut style_only) = (false, false); + for w in (150..=900).step_by(2) { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(w as f32, 300.0)); + control_bar_frame_in(&mut app, &ctx, screen, vec![]); + let nodes = control_bar_frame_in(&mut app, &ctx, screen, vec![]); + let (opacity, style) = (shows(&nodes, "Opacity:"), shows(&nodes, "Style:")); + both |= opacity && style; + style_only |= style && !opacity; + } + assert!(both, "a wide bar shows the Opacity and Style links"); + assert!(style_only, "some width has room for the Style link and its chip but not the Opacity link and its field"); +} + +/// With nothing selected, a bar too narrow for the Document Setup button still shows the narrower +/// Preferences button when it has room for it. +#[test] +fn a_narrow_control_bar_shows_preferences_without_document_setup() { + crate::i18n::set_current(crate::i18n::Lang::EN); + let mut app = crate::VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 200})).unwrap(); + app.run("select.set", json!({ "ids": [] })).unwrap(); + for group in ["fillStroke", "opacity", "graphicStyle"] { + app.run("window.control.options", json!({"group": group, "visible": false})).unwrap(); + } + let ctx = egui::Context::default(); + ctx.enable_accesskit(); + crate::theme::install_fonts(&ctx); + let shows = |nodes: &[egui::accesskit::Node], name: &str| nodes.iter().any(|n| n.label().is_some_and(|l| l == name)); + let (mut both, mut preferences_only) = (false, false); + for w in (150..=900).step_by(2) { + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(w as f32, 300.0)); + control_bar_frame_in(&mut app, &ctx, screen, vec![]); + let nodes = control_bar_frame_in(&mut app, &ctx, screen, vec![]); + let (setup, preferences) = (shows(&nodes, "Document Setup"), shows(&nodes, "Preferences")); + both |= setup && preferences; + preferences_only |= preferences && !setup; + } + assert!(both, "a wide bar shows Document Setup and Preferences"); + assert!(preferences_only, "some width has room for Preferences but not Document Setup"); +} + /// The Anchor Points group holds Convert and Anchors for direct-selected anchors; off, the bar keeps /// its Anchor Point label. #[test] diff --git a/crates/ui-egui/src/control.rs b/crates/ui-egui/src/control.rs index 61dc9bc6a4..acc642cc0d 100644 --- a/crates/ui-egui/src/control.rs +++ b/crates/ui-egui/src/control.rs @@ -1291,7 +1291,9 @@ pub fn handle(app: &mut VectorcraftApp, ctx: &egui::Context, req: &ControlReques /// Hides in `reply` the libraries hidden now and in `before`, and the paths outside the read root that /// `sent`, the request's params, holds ([`handle`]), and the recovery folders outside the read root -/// that are in use or that a failure message named. The `path` and `files` entries of the reply's +/// that are in use or that a failure message named, with each folder on the way to one that the reply +/// writes as a whole path ([`writes_whole_path`]): a failure names a file or a missing folder there. +/// The `path` and `files` entries of the reply's /// `result`, at any depth, that name a file the request gave inside the write roots, the file it /// wrote, stay as given ([`written_paths`]). fn hide_in_reply(app: &VectorcraftApp, reply: &mut Value, sent: &Value, before: Hiding) { @@ -1305,16 +1307,42 @@ fn hide_in_reply(app: &VectorcraftApp, reply: &mut Value, sent: &Value, before: hiding.merge(before); let mut paths = Vec::new(); sent_paths(sent, &mut paths); - // The status text of a recovery copy that failed names the recovery folder it went to. + // The status text of a recovery copy that failed names the recovery folder it went to, or the + // first folder on the way to it that is a file or is missing. let current = vectorcraft_engine::cmd::recovery::folder(&app.session).map(|(f, _)| f); for folder in app.recovery.named.iter().chain(current.as_ref()) { collect_sent_paths(&json!(folder), ParamsPlace::top(None), true, &mut paths); + for on_the_way in std::path::Path::new(folder).ancestors().skip(1).map(|p| p.to_string_lossy()) { + if !on_the_way.is_empty() && writes_whole_path(reply, &on_the_way) { + collect_sent_paths(&json!(on_the_way), ParamsPlace::top(None), true, &mut paths); + } + } } hiding.set_hidden(paths, cfg!(windows)); hide_library_ids(reply, &hiding); restore_written_paths(reply, kept); } +/// Does `v` write `path` in a string or a key at any depth with no path text before it (a letter, a +/// digit, `_`, `-`, `.`, `~` or a separator) or after it ([`continues_path`]), a Windows path +/// ([`splits_at_backslash`]) with either separator and in any case of ASCII letters too? Only the text +/// is compared: nothing on disk is looked up. +fn writes_whole_path(v: &Value, path: &str) -> bool { + let windows = splits_at_backslash(path); + let path_before = + |before: &str| before.chars().next_back().is_some_and(|c| c.is_alphanumeric() || matches!(c, '_' | '-' | '.' | '~' | '/' | '\\')); + let whole = |s: &str| { + let spellings = if windows { vec![path.replace('\\', "/"), path.replace('/', "\\")] } else { vec![path.to_string()] }; + spellings.iter().any(|p| occurrences(s, p, windows).into_iter().any(|at| !path_before(&s[..at]) && !continues_path(&s[at + p.len()..]))) + }; + match v { + Value::String(s) => whole(s), + Value::Array(items) => items.iter().any(|item| writes_whole_path(item, path)), + Value::Object(fields) => fields.iter().any(|(key, item)| whole(key) || writes_whole_path(item, path)), + _ => false, + } +} + /// The strings that `v`'s path params hold at any depth, as the command they are for reads them /// ([`ParamsPlace`]), that name a file inside the write roots; `v`, found at `place`, is a path /// param's value when `path_param` is set. diff --git a/crates/ui-egui/src/control/tests.rs b/crates/ui-egui/src/control/tests.rs index b17fbc072d..7aa73e8a7e 100644 --- a/crates/ui-egui/src/control/tests.rs +++ b/crates/ui-egui/src/control/tests.rs @@ -538,6 +538,36 @@ fn a_recovery_folder_outside_the_read_root_is_hidden_in_the_status() { assert_eq!(inspect(&mut app, format!("Copies go to {inside}")), json!(format!("Copies go to {inside}"))); } +/// `ui.inspect` shows a file on the way to a recovery folder outside the read root, which a failed +/// recovery copy names, by its name, and a missing folder on the way too. A path that only begins or +/// only ends with a folder on the way stays. +#[test] +fn a_file_on_the_way_to_a_recovery_folder_outside_the_read_root_is_hidden_in_the_status() { + let mut app = VectorcraftApp::new(Session::new(), Services::default()); + let outside = crate::tests_folder::Folder::new("recovery-in-the-way"); + let file = outside.file("private", b"a file"); + let folder = std::path::Path::new(&file).join("recovery").to_string_lossy().into_owned(); + app.session.recovery.set_default_folder(Some(folder)); + let root = crate::tests_folder::Folder::new("recovery-in-the-way-root"); + let roots = vectorcraft_engine::file_access::AutomationRoots::new(&[root.as_path()], &[]).unwrap(); + let inspect = |app: &mut VectorcraftApp, status: String| { + app.ui.status = status; + let reply = vectorcraft_engine::file_access::confine(roots.as_ref(), || input_request(app, "ui.inspect", json!({}))); + reply["result"]["ui"]["status"].clone() + }; + let status = format!("Couldn't save recovery data: {file} is not a folder"); + assert_eq!(inspect(&mut app, status), "Couldn't save recovery data: private is not a folder"); + let missing = outside.join("gone"); + let folder = missing.join("recovery").to_string_lossy().into_owned(); + app.session.recovery.set_default_folder(Some(folder)); + let status = format!("Couldn't save recovery data: couldn't make {}", missing.display()); + assert_eq!(inspect(&mut app, status), "Couldn't save recovery data: couldn't make gone"); + let under = format!("Copies go near {}", outside.join("other.svg").display()); + assert_eq!(inspect(&mut app, under.clone()), json!(under)); + let longer = format!("Copies go near /work{}", missing.display()); + assert_eq!(inspect(&mut app, longer.clone()), json!(longer)); +} + /// A path outside the read root that a request sent is shown by its file name in a reply that succeeded /// as in one that failed. #[test] diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 1f3a01528c..5afad21b0d 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -153,7 +153,7 @@ pub use color_picker::open as open_color_picker; pub use document_setup::open as open_document_setup; pub use effect::open as open_effect_dialog; pub(crate) use effect::{FILM_GRAIN_FIELDS, PAINT_DAUB_BRUSH_TYPE_LABELS, SHADES, shown_choices}; -pub use export_as::open as open_export_as; +pub use export_as::{export_selection, open as open_export_as}; pub(crate) use export_for_screens::drop_unread_screen_settings; pub use export_for_screens::open as open_export_for_screens; pub(crate) use export_for_screens::{ @@ -719,7 +719,8 @@ pub fn confirm(app: &mut VectorcraftApp) -> DialogResult { /// After a dialog closes, and each frame: a Missing Fonts dialog that another dialog replaced waits /// for its turn again, the search a Missing Fonts or Find Linked Files dialog started stops once /// that dialog is gone, and with no dialog open the choice about a stopped plug-in that another -/// dialog replaced opens again, else the next document's Missing Fonts dialog (one dialog at a +/// dialog replaced opens again, else the questions about the next restored document's linked files +/// ([`crate::recovery::ask_next`]), else the next document's Missing Fonts dialog (one dialog at a /// time). pub(crate) fn settle(app: &mut VectorcraftApp) { crate::placing::settle_swatch_paste(app); @@ -727,6 +728,7 @@ pub(crate) fn settle(app: &mut VectorcraftApp) { missing_fonts::stop_when_closed(app); find_links::stop_when_closed(app); safe_mode::reopen(app); + crate::recovery::ask_next(app); missing_fonts::open_next(app); } @@ -945,6 +947,8 @@ mod tests_accessibility; #[cfg(test)] mod tests_export; #[cfg(test)] +mod tests_export_selection; +#[cfg(test)] mod tests_import_pdf; #[cfg(test)] mod tests_package; diff --git a/crates/ui-egui/src/dialogs/char_style_options.rs b/crates/ui-egui/src/dialogs/char_style_options.rs index f34363e5b7..e807df7b01 100644 --- a/crates/ui-egui/src/dialogs/char_style_options.rs +++ b/crates/ui-egui/src/dialogs/char_style_options.rs @@ -26,9 +26,10 @@ const NUMBERS: &[&str] = &["size", "leading", "kerning", "tracking"]; /// The on, off or unset checkboxes. const SWITCHES: &[&str] = &["underline", "strikethrough", "standardVerticalRoman"]; /// The attributes of Advanced Character Formats, in the order the section shows them. -const ADVANCED: &[&str] = &["h_scale", "v_scale", "baseline_shift", "tcyUpDown", "tcyLeftRight", "rotation", "akiLeft", "akiRight", "language"]; +const ADVANCED: &[&str] = + &["h_scale", "v_scale", "baseline_shift", "tcyUpDown", "tcyLeftRight", "rotation", "akiLeft", "akiRight", "tsume", "language"]; /// The number fields of Advanced Character Formats. -const ADVANCED_NUMBERS: &[&str] = &["h_scale", "v_scale", "baseline_shift", "tcyUpDown", "tcyLeftRight", "rotation", "akiLeft", "akiRight"]; +const ADVANCED_NUMBERS: &[&str] = &["h_scale", "v_scale", "baseline_shift", "tcyUpDown", "tcyLeftRight", "rotation", "akiLeft", "akiRight", "tsume"]; /// The Insert Aki Left and Right fields, which take the Character panel's presets and stop at /// [`vectorcraft_doc::text::MAX_AKI`]. const AKI: [&str; 2] = ["akiLeft", "akiRight"]; @@ -86,6 +87,7 @@ pub(super) const SPEC: DialogSpec = DialogSpec { "rotation", "akiLeft", "akiRight", + "tsume", "language", "fill", "fill_tint", @@ -275,6 +277,7 @@ fn optional_number(d: &Dialog, key: &str) -> Result, String> { "rotation" => tl!("Character Rotation"), "akiLeft" => tl!("Insert Aki Left"), "akiRight" => tl!("Insert Aki Right"), + "tsume" => tl!("Tsume"), "fill_tint" => tl!("Fill Tint"), "stroke_tint" => tl!("Stroke Tint"), "stroke_width" => tl!("Weight"), @@ -322,6 +325,8 @@ fn optional_number(d: &Dialog, key: &str) -> Result, String> { // Insert Aki stops at 0 and at the largest value the style takes, as the Character // panel's fields do. let n = if AKI.contains(&key) { n.clamp(0.0, vectorcraft_doc::text::MAX_AKI) } else { n }; + // Tsume stops at 0% and 100% the same way. + let n = if key == "tsume" { n.clamp(0.0, vectorcraft_doc::text::MAX_TSUME) } else { n }; Ok(Some(json!(n))) } } @@ -600,7 +605,7 @@ pub(crate) fn reset_basic(d: &mut Dialog) { } } -/// Reset Panel in Advanced Character Formats: its nine attributes become unset. +/// Reset Panel in Advanced Character Formats: its ten attributes become unset. pub(crate) fn reset_advanced(d: &mut Dialog) { d.fields.insert("__resetAdvanced".into(), json!(true)); for key in ADVANCED_NUMBERS { @@ -755,8 +760,8 @@ pub(crate) fn basic_body(ui: &mut egui::Ui, d: &mut Dialog) { } /// Advanced Character Formats: Horizontal Scale, Vertical Scale, Baseline Shift, the Tate-chu-yoko -/// Up/Down and Left/Right, Character Rotation, Insert Aki Left and Right (with the Character -/// panel's presets) and Language, each empty (unset) or set. +/// Up/Down and Left/Right, Character Rotation, Insert Aki Left and Right and Tsume (with the +/// Character panel's presets) and Language, each empty (unset) or set. pub(crate) fn advanced_body(ui: &mut egui::Ui, d: &mut Dialog) { egui::Grid::new("character-style-advanced").num_columns(2).spacing([18.0, 8.0]).show(ui, |ui| { for (key, caption, unit) in [ @@ -787,6 +792,17 @@ pub(crate) fn advanced_body(ui: &mut egui::Ui, d: &mut Dialog) { } ui.end_row(); } + let presets: Vec = crate::panels::character::TSUME_PRESETS.iter().map(f64::to_string).collect(); + let presets: Vec<&str> = presets.iter().map(String::as_str).collect(); + let row = ui.label(tl!("Tsume")); + let value = if d.fields.get("tsume").is_none_or(Value::is_null) { String::new() } else { d.str("tsume") }; + ui.horizontal(|ui| { + if let Some(v) = ui.label_inputs_by(row.id, |ui| crate::widgets::text_presets(ui, (KIND, "tsume"), &value, &presets, 160.0)) { + d.fields.insert("tsume".into(), json!(v)); + } + ui.label("%"); + }); + ui.end_row(); let row = ui.label(tl!("Language:")); let names: Vec<&str> = std::iter::once(" ").chain(vectorcraft_doc::setup::LANGUAGES.iter().map(|(name, _, _)| *name)).collect(); let current = d.fields.get("language").and_then(Value::as_str).unwrap_or("").to_string(); @@ -1847,6 +1863,50 @@ mod tests { assert!(t.runs.iter().all(|r| (r.style.aki_left, r.style.aki_right) == (250.0, 1000.0))); } + /// Tsume in Advanced Character Formats: empty is unset, an explicit 0 stays set, a typed value + /// stops at 0 and 100, Reset Panel unsets it, and the field is drawn and commits to the style + /// and the text set in it. + #[test] + fn tsume_field_shows_sets_resets_and_commits() { + let d = dialog_for(json!({"size": 12.0})); + assert_eq!(d.fields["tsume"], json!("")); + let mut d = dialog_for(json!({"tsume": 50.0})); + assert_eq!(d.fields["tsume"], json!(50.0)); + for (typed, kept) in [("0", 0.0), ("25.5", 25.5), ("150", 100.0), ("-5", 0.0)] { + d.fields.insert("tsume".into(), json!(typed)); + assert_eq!(edited_attrs(&d).unwrap(), attrs(json!({"tsume": kept})), "{typed}"); + } + d.fields.insert("tsume".into(), json!("")); + assert_eq!(edited_attrs(&d).unwrap(), attrs(json!({}))); + d.fields.insert("tsume".into(), json!("tight")); + assert_eq!(edited_attrs(&d).unwrap_err(), "Tsume must be a number"); + let mut d = dialog_for(json!({"tsume": 50.0, "size": 12.0})); + d.fields.insert("section".into(), json!("advanced")); + reset_section(&mut d); + assert_eq!(edited_attrs(&d).unwrap(), attrs(json!({"size": 12.0}))); + + let mut app = app(); + app.run("charStyle.new", json!({"name": "Body", "attrs": {"size": 24.0}})).unwrap(); + let id = app.run("text.create", json!({"x": 10, "y": 40, "text": "Text"})).unwrap()["id"].as_u64().unwrap(); + app.run("charStyle.apply", json!({"name": "Body", "id": id})).unwrap(); + open(&mut app, "Body").unwrap(); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let screen = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 900.0)); + let mut d = app.ui.dialog.clone().unwrap(); + let input = egui::RawInput { screen_rect: Some(screen), ..Default::default() }; + let mut out = ctx.run_ui(input, |ui| advanced_body(ui, &mut d)); + let texts = texts_of(&out); + out.textures_delta.clear(); + assert!(texts.iter().any(|(text, _)| text == "Tsume"), "Tsume is drawn: {texts:?}"); + app.ui.dialog.as_mut().unwrap().fields.insert("tsume".into(), json!("75")); + super::super::confirm(&mut app).unwrap(); + let state = app.session.doc().unwrap(); + assert_eq!(state.doc.char_styles[0].attrs, attrs(json!({"size": 24.0, "tsume": 75.0}))); + let vectorcraft_doc::NodeKind::Text(t) = &state.doc.node(vectorcraft_doc::NodeId(id)).unwrap().kind else { panic!("text") }; + assert!(t.runs.iter().all(|r| r.style.tsume == 75.0)); + } + /// The negated tags of the twenty stylistic sets: an explicit empty Stylistic Sets choice. fn no_sets() -> Vec { vectorcraft_text::EXTRA_FEATURES[..20].iter().map(|s| format!("-{s}")).collect() diff --git a/crates/ui-egui/src/dialogs/dxf_options.rs b/crates/ui-egui/src/dialogs/dxf_options.rs index 498d854fe9..2e0aefc54c 100644 --- a/crates/ui-egui/src/dialogs/dxf_options.rs +++ b/crates/ui-egui/src/dialogs/dxf_options.rs @@ -158,8 +158,11 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } }); ui.add_space(4.0); + // Hidden for Export Selection, which writes the selected art alone. let selection = app.session.active().is_some_and(|st| !st.selection.is_empty()); - if widgets::check(ui, tl!("Export Selected Art Only"), d.bool("selectedOnly") && selection, selection) { + if !d.bool(super::export_as::SELECTION_FIELD) + && widgets::check(ui, tl!("Export Selected Art Only"), d.bool("selectedOnly") && selection, selection) + { d.fields.insert("selectedOnly".into(), json!(!d.bool("selectedOnly"))); } check(ui, d, "alterPaths", tl!("Alter Paths for Appearance")); @@ -227,5 +230,5 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { app.ui.dxf_options = Value::Object(remembered.into_iter().flatten().collect()); app.ui.dialog = None; let path = d.fields.get("path").and_then(Value::as_str).map(str::to_string); - io::export(app, Some("dxf"), path, ¶ms) + io::export(app, Some("dxf"), path, &super::export_as::exported(d, params)) } diff --git a/crates/ui-egui/src/dialogs/eps_options.rs b/crates/ui-egui/src/dialogs/eps_options.rs index 3a20a6799b..8d34706df4 100644 --- a/crates/ui-egui/src/dialogs/eps_options.rs +++ b/crates/ui-egui/src/dialogs/eps_options.rs @@ -30,7 +30,7 @@ pub(super) const SPEC: DialogSpec = DialogSpec { }; /// Fields that are not remembered between exports (they belong to one export). -const PER_EXPORT: [&str; 7] = ["format", "path", "useArtboards", "range", "artboard", "artboards", "selectedOnly"]; +const PER_EXPORT: [&str; 8] = ["format", "path", "useArtboards", "range", "artboard", "artboards", "selectedOnly", super::export_as::SELECTION_FIELD]; /// The options a first EPS Options dialog starts from (the export's defaults). fn defaults() -> Map { @@ -133,5 +133,5 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { Value::Object(d.fields.iter().filter(|(k, _)| !PER_EXPORT.contains(&k.as_str())).map(|(k, v)| (k.clone(), v.clone())).collect()); app.ui.dialog = None; let path = d.fields.get("path").and_then(Value::as_str).map(str::to_string); - io::export(app, Some("eps"), path, ¶ms) + io::export(app, Some("eps"), path, &super::export_as::exported(d, params)) } diff --git a/crates/ui-egui/src/dialogs/export_as.rs b/crates/ui-egui/src/dialogs/export_as.rs index bd9ee6ca49..add0fbed73 100644 --- a/crates/ui-egui/src/dialogs/export_as.rs +++ b/crates/ui-egui/src/dialogs/export_as.rs @@ -4,8 +4,10 @@ //! picks the file, then the format's options dialog follows (PNG/JPEG/WebP/PNG-8/GIF Options, SVG //! Options, Text Export Options, DXF Options, EPS Options, and Save PDF), //! else the file is written. DWG is listed, greyed out, with what to use instead. The formats of -//! installed exporter plug-ins come after the built-in ones: they write the whole document, and one -//! with parameters asks for them before writing (`plugin::open_export`). +//! installed exporter plug-ins come after the built-in ones: they write the whole document (from +//! Export Selection, the selection), and one with parameters asks for them before writing +//! (`plugin::open_export`). Export Selection ([`export_selection`]) takes the same route after its +//! save panel, and every format then writes the selection alone, cropped to it. use std::sync::LazyLock; @@ -144,12 +146,52 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { app.ui.dialog = None; let path = io::export_path(app, None, f)?; let range = if all { "all".to_string() } else { range }; - let r = options_or_write(app, f, plugin, path, use_artboards, all, range); + let r = options_or_write(app, f, plugin, path, Pages { use_artboards, all, range, selection: false }); // The options follow the save panel: the Enter that closed it isn't theirs (as in Save As). super::opened_by_panel(app); r } +/// The options dialogs' field that is true when Export Selection opened them: OK then writes the +/// selection alone ([`exported`]). Not remembered with the dialog's options. +pub(super) const SELECTION_FIELD: &str = "__selection"; + +/// `params` of an options dialog `d` for [`io::export`]: with [`io::EXPORT_SELECTION`] when +/// Export Selection opened `d`. +pub(super) fn exported(d: &Dialog, mut params: Value) -> Value { + if d.bool(SELECTION_FIELD) + && let Some(o) = params.as_object_mut() + { + o.insert(io::EXPORT_SELECTION.into(), json!(true)); + } + params +} + +/// File › Export Selection (`document.exportSelection` without params): the save panel picks the +/// file and its format, then the format's options dialog follows as in Export As, else the file is +/// written. Each route writes the selected objects alone, cropped to them. Nothing selected to +/// export stops before the save panel. +pub fn export_selection(app: &mut VectorcraftApp) -> Result { + let st = app.session.active().ok_or("no document")?; + fileio::selection_doc(st, "document.exportSelection", false).map_err(|e| e.to_string())?; + let path = io::selection_path(app)?; + let f = fileio::writable_format(None, Some(&path))?; + let plugin = vectorcraft_plugins::export::by_format(f.id); + let pages = Pages { use_artboards: false, all: true, range: String::new(), selection: true }; + let r = options_or_write(app, f, plugin, path, pages); + super::opened_by_panel(app); + r +} + +/// What an export writes: with `use_artboards` the artboards (`all`, else the 1-based `range`), +/// else the bounds of the visible art, or with `selection` the selection alone. +struct Pages { + use_artboards: bool, + all: bool, + range: String, + selection: bool, +} + /// After the save panel picked `path`: the options dialog of format `f` (or of its exporter /// plug-in), else the file written. fn options_or_write( @@ -157,11 +199,10 @@ fn options_or_write( f: &'static Format, plugin: Option>, path: String, - use_artboards: bool, - all: bool, - range: String, + pages: Pages, ) -> Result { - match f.id { + let Pages { use_artboards, all, range, selection } = pages; + let r = match f.id { "svg" | "svgz" => { svg_options::open(app, svg_options::Mode::Export, Some(&path)); if let Some(o) = app.ui.dialog.as_mut() { @@ -169,24 +210,33 @@ fn options_or_write( } Ok(Value::Null) } - // Save PDF writes the artboards as pages, or one page of the art's bounds. + // Save PDF writes the artboards as pages, or one page of the art's bounds or the selection. "pdf" if use_artboards => save_pdf::open(app, &json!({ "path": path, "range": (!all).then_some(range) })), "pdf" => save_pdf::open(app, &json!({ "path": path, "useArtboards": false })), "txt" => { text_export::open(app, &path); + if let Some(o) = app.ui.dialog.as_mut().filter(|_| selection) { + o.fields.insert("selectionOnly".into(), json!(true)); + } Ok(Value::Null) } _ => { let mut params = json!({ "format": f.id, "path": path }); // A format that holds the whole document (a template) has no Use Artboards: the // export is not given the option, which its warnings would name as not used. - if plugin.is_some() || f.options.iter().any(|o| o.name == "useArtboards") { + if !selection && (plugin.is_some() || f.options.iter().any(|o| o.name == "useArtboards")) { params["useArtboards"] = json!(use_artboards); if use_artboards { params["range"] = json!(range); } } - if let Some(plugin) = plugin.filter(|p| !p.manifest().params.is_empty()) { + let plugin = plugin.filter(|p| !p.manifest().params.is_empty()); + let dialog = plugin.is_none() && (f.raster || matches!(f.id, "dxf" | "eps")); + if selection { + // An options dialog keeps the mark as a field of its own, which OK hands on. + params[if dialog { SELECTION_FIELD } else { io::EXPORT_SELECTION }] = json!(true); + } + if let Some(plugin) = plugin { plugin::open_export(app, &plugin, params); return Ok(Value::Null); } @@ -202,7 +252,12 @@ fn options_or_write( eps_options::open(app, ¶ms); return Ok(Value::Null); } - io::export(app, Some(f.id), Some(path), ¶ms) + return io::export(app, Some(f.id), Some(path), ¶ms); } + }; + // Export Selection's mark on the options dialog that opened. + if let Some(o) = app.ui.dialog.as_mut().filter(|_| selection) { + o.fields.insert(SELECTION_FIELD.into(), json!(true)); } + r } diff --git a/crates/ui-egui/src/dialogs/graph_data.rs b/crates/ui-egui/src/dialogs/graph_data.rs index 16d22d4430..32d8dcb2e9 100644 --- a/crates/ui-egui/src/dialogs/graph_data.rs +++ b/crates/ui-egui/src/dialogs/graph_data.rs @@ -32,6 +32,8 @@ const MAX_COLS: usize = MAX_GRAPH_SERIES + 1; const MIN_ROWS: usize = 8; const MIN_COLS: usize = 6; const MAX_CELL: usize = 256; +/// The largest file Import Data reads, 1 MB (1,048,576 bytes), the same as Import Data Sets'. +const MAX_IMPORT_BYTES: usize = 1 << 20; /// The Cell Style limits (Adjust column width and decimal digits). const MAX_DECIMALS: u64 = 10; const MAX_WIDTH: u64 = 20; @@ -332,9 +334,16 @@ fn revert(app: &mut VectorcraftApp, d: &mut Dialog) -> Result<(), String> { fn import(app: &mut VectorcraftApp, d: &mut Dialog) -> Result<(), String> { let pick = crate::FilePick { filters: vec![crate::FilePick::filter("Text", &["txt", "tsv", "csv"])], ..Default::default() }; let path = crate::picks::open(app, &pick).ok_or("cancelled")?; - // The button is off where files can't be read. - let Some(read) = app.services.read.as_ref() else { return Ok(()) }; - let bytes = read(&path)?; + // One byte past the limit tells a larger file apart without reading all of it. + let bytes = match (&app.services.read_head, &app.services.read) { + (Some(read_head), _) => read_head(&path, MAX_IMPORT_BYTES + 1)?, + (None, Some(read)) => read(&path)?, + // The button is off where files can't be read. + (None, None) => return Ok(()), + }; + if bytes.len() > MAX_IMPORT_BYTES { + return Err("the file is larger than 1 MB".into()); + } replace_grid(d, grid_from_text(&decode(&bytes))); Ok(()) } @@ -527,6 +536,46 @@ mod tests { assert_eq!(p["series"].as_array().unwrap().len(), MAX_COLS - 1); } + /// Import Data reads a file no further than one byte past 1 MB where the host can read part of + /// a file: a larger file is refused with the sheet left as it was, and a file at the limit is + /// read. Where the host only reads whole files, a larger file is refused too. + #[test] + fn import_data_refuses_a_file_larger_than_its_limit() { + use std::{cell::RefCell, collections::HashMap, rc::Rc}; + let (mut app, _) = app_with(",a\nQ1,1", "column"); + open(&mut app).unwrap(); + let mut d = app.ui.dialog.clone().unwrap(); + let at_limit = [b"\tb\nQ2\t2\n".as_slice(), &vec![b' '; MAX_IMPORT_BYTES - 8]].concat(); + let files: HashMap> = + [("/big.txt".to_string(), vec![b'1'; MAX_IMPORT_BYTES + 1]), ("/limit.txt".to_string(), at_limit)].into(); + let files = Rc::new(files); + let picked = Rc::new(RefCell::new(String::new())); + let p = picked.clone(); + app.services.pick_open = Some(Box::new(move |_: &crate::FilePick| Some(p.borrow().clone()))); + app.services.read = Some(Box::new(|_: &str| Err("the whole file was read".to_string()))); + let asked = Rc::new(RefCell::new(vec![])); + let (f, a) = (files.clone(), asked.clone()); + app.services.read_head = Some(Box::new(move |path: &str, max: usize| { + a.borrow_mut().push(max); + Ok(f.get(path).ok_or("no such file")?.iter().copied().take(max).collect()) + })); + let before = grid(&d); + *picked.borrow_mut() = "/big.txt".into(); + assert_eq!(import(&mut app, &mut d), Err("the file is larger than 1 MB".to_string())); + assert_eq!(grid(&d), before, "the sheet is left as it was"); + *picked.borrow_mut() = "/limit.txt".into(); + import(&mut app, &mut d).unwrap(); + assert_eq!((cell_at(&d, 0, 1), cell_at(&d, 1, 0)), ("b", "Q2")); + assert_eq!(*asked.borrow(), [MAX_IMPORT_BYTES + 1; 2], "each read stops one byte past the limit"); + // A host that reads only whole files. + app.services.read_head = None; + let f = files.clone(); + app.services.read = Some(Box::new(move |path: &str| Ok(f.get(path).ok_or("no such file")?.clone()))); + *picked.borrow_mut() = "/big.txt".into(); + assert_eq!(import(&mut app, &mut d), Err("the file is larger than 1 MB".to_string())); + assert_eq!(cell_at(&d, 0, 1), "b"); + } + #[test] fn transpose_switch_and_moves() { assert_eq!(transpose(&g(&[&["", "a", "b"], &["Q1", "1", "2"]])), g(&[&["", "Q1"], &["a", "1"], &["b", "2"]])); diff --git a/crates/ui-egui/src/dialogs/missing_links.rs b/crates/ui-egui/src/dialogs/missing_links.rs index 70c2370f1b..28a6e57828 100644 --- a/crates/ui-egui/src/dialogs/missing_links.rs +++ b/crates/ui-egui/src/dialogs/missing_links.rs @@ -43,26 +43,27 @@ fn ids(rows: &[Value]) -> Vec { /// then about its modified ones, then about the fonts it opened without /// ([`super::missing_fonts`]). The web reads no linked files, so missing ones just show their /// previews there. The status bar shows what it says about the linked files followed by the open's -/// `notes` ([`crate::io::show_opened`]). +/// `notes` ([`crate::io::show_opened`]). On the web, with both missing and modified files and +/// Update Links not asking, the line about the missing files comes first and the line about the +/// modified ones is the first of the notes. pub fn after_open(app: &mut VectorcraftApp, r: &Value, notes: Vec) { after_open_for(app, r, notes, cfg!(target_arch = "wasm32")); } -fn after_open_for(app: &mut VectorcraftApp, r: &Value, notes: Vec, web: bool) { +fn after_open_for(app: &mut VectorcraftApp, r: &Value, mut notes: Vec, web: bool) { // The fonts' dialog waits for these questions (one dialog at a time). super::missing_fonts::after_open(app, r); let rows = |k: &str| r[k].as_array().cloned().unwrap_or_default(); let (missing, modified) = (rows("missingLinks"), ids(&rows("modifiedLinks"))); let notice = if missing.is_empty() || web { - let unreadable = (!missing.is_empty()).then(|| { - crate::i18n::msg_n( - missing.len() as u64, - "{n} linked file can't be read here: its preview shows", - "{n} linked files can't be read here: their previews show", - &[], - ) - }); - ask_update(app, modified).or(unreadable) + let unreadable = (!missing.is_empty()).then(|| unreadable_status(missing.len())); + match (ask_update(app, modified), unreadable) { + (Some(changed), Some(unreadable)) => { + notes.insert(0, changed); + Some(unreadable) + } + (changed, unreadable) => changed.or(unreadable), + } } else { open(app, missing, modified, ¬es); None @@ -71,6 +72,40 @@ fn after_open_for(app: &mut VectorcraftApp, r: &Value, notes: Vec, web: super::settle(app); } +/// The status bar's line for `n` linked files the web can't read. +fn unreadable_status(n: usize) -> String { + crate::i18n::msg_n( + n as u64, + "{n} linked file can't be read here: its preview shows", + "{n} linked files can't be read here: their previews show", + &[], + ) +} + +/// What the linked files of a document that opened (`document.open`'s result `r`) need, without +/// asking yet → the status bar's lines about them, the missing files to ask about and the ids of +/// the modified images to offer for update ([`ask_next`]). The web reads no linked files, so the +/// missing ones get a line there; without Update Links: Ask When Modified the modified ones get a +/// line instead of the offer. +pub(crate) fn questions(app: &VectorcraftApp, r: &Value) -> (Vec, Vec, Vec) { + questions_for(app, r, cfg!(target_arch = "wasm32")) +} + +fn questions_for(app: &VectorcraftApp, r: &Value, web: bool) -> (Vec, Vec, Vec) { + let rows = |k: &str| r[k].as_array().cloned().unwrap_or_default(); + let (mut missing, mut modified) = (rows("missingLinks"), ids(&rows("modifiedLinks"))); + let mut lines = vec![]; + if web && !missing.is_empty() { + lines.push(unreadable_status(missing.len())); + missing.clear(); + } + if !modified.is_empty() && app.session.prefs.update_links != "askWhenModified" { + lines.push(changed_on_disk_status(modified.len())); + modified.clear(); + } + (lines, missing, modified) +} + fn open(app: &mut VectorcraftApp, missing: Vec, modified: Vec, notes: &[String]) { let fields = json!({ "missing": missing, "modified": modified, "notes": notes, "applyToAll": false, "path": "" }); app.ui.dialog = Some(Dialog::new(KIND, fields)); @@ -85,7 +120,7 @@ pub(super) fn notes(d: &Dialog) -> Vec { /// Ask about the missing files `rest`, one at a time, then offer the modified ones `modified` for /// update. A line about the modified files is followed by the open's `notes` /// ([`crate::io::show_opened`]). -pub(super) fn ask_next(app: &mut VectorcraftApp, rest: Vec, modified: Vec, notes: Vec) { +pub(crate) fn ask_next(app: &mut VectorcraftApp, rest: Vec, modified: Vec, notes: Vec) { if rest.is_empty() { app.ui.dialog = None; if let Some(notice) = ask_update(app, modified) { @@ -309,6 +344,23 @@ mod tests { let _ = std::fs::remove_dir_all(dir); } + /// A restored document's linked files: the web gets a line about the missing ones, and + /// without Update Links: Ask When Modified the modified ones get a line; the rest are asked + /// about. + #[test] + fn the_questions_about_linked_files_wait_or_become_lines() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + let r = json!({ "missingLinks": [{"name": "a.png", "path": "/x/a.png", "ids": [1]}], "modifiedLinks": [{"ids": [2]}, {"ids": [3]}] }); + app.session.prefs.update_links = "askWhenModified".into(); + assert_eq!(questions_for(&app, &r, false), (vec![], r["missingLinks"].as_array().unwrap().clone(), vec![json!(2), json!(3)])); + let changed = "2 linked images changed on disk: Update Links shows the new versions".to_string(); + app.session.prefs.update_links = "manually".into(); + assert_eq!(questions_for(&app, &r, false), (vec![changed.clone()], r["missingLinks"].as_array().unwrap().clone(), vec![])); + let unreadable = "1 linked file can't be read here: its preview shows".to_string(); + assert_eq!(questions_for(&app, &r, true), (vec![unreadable, changed], vec![], vec![])); + assert!(app.ui.dialog.is_none(), "nothing is asked yet"); + } + /// The question about modified linked files uses the form the language's plural rule picks for /// the count. #[test] @@ -346,6 +398,43 @@ mod tests { assert_eq!((app.ui.status.as_str(), &app.ui.status_notes), (notice, &None)); } + /// On the web, an open with linked files it can't read and modified ones, with Update Links + /// not asking: the status bar shows the line about the unreadable files and counts the line + /// about the modified ones as the first note, ahead of the open's notes, and keeps them all + /// for its hover. With Ask When Modified the update question opens and the line about the + /// unreadable files stays. + #[test] + fn a_web_open_with_unreadable_and_modified_links_keeps_both_lines() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.session.prefs.update_links = "manually".into(); + let missing = json!([{ "name": "a.png", "path": "/gone/a.png", "ids": [1] }, { "name": "b.png", "path": "/gone/b.png", "ids": [2] }]); + let r = json!({ "missingLinks": missing, "modifiedLinks": [{ "ids": [3] }] }); + let unreadable = "2 linked files can't be read here: their previews show"; + let changed = changed_on_disk_status(1); + + let notes = vec!["a note".to_string(), "another note".to_string()]; + after_open_for(&mut app, &r, notes.clone(), true); + let kept = [vec![changed.clone()], notes].concat(); + assert_eq!(app.ui.status, crate::io::opened_after_notice(unreadable, 3, &changed)); + assert_eq!(app.ui.status_notes, Some((app.ui.status.clone(), kept))); + assert!(app.ui.dialog.is_none()); + + after_open_for(&mut app, &r, vec![], true); + assert_eq!(app.ui.status, crate::io::opened_after_notice(unreadable, 1, &changed)); + assert_eq!(app.ui.status_notes, Some((app.ui.status.clone(), vec![changed.clone()]))); + + // One kind of line alone shows as before. + after_open_for(&mut app, &json!({ "modifiedLinks": [{ "ids": [3] }] }), vec![], true); + assert_eq!((app.ui.status.clone(), &app.ui.status_notes), (changed, &None)); + + app.session.prefs.update_links = "askWhenModified".into(); + after_open_for(&mut app, &r, vec![], true); + let d = app.ui.dialog.as_ref().expect("asks"); + assert_eq!((d.kind.as_str(), d.str("__command")), (super::super::confirm::KIND, "links.update".to_string())); + assert_eq!((app.ui.status.as_str(), &app.ui.status_notes), (unreadable, &None)); + } + /// The line about modified linked files that follows the Linked File Not Found dialog keeps the /// notes of that open, also when another message was shown meanwhile. An open without notes /// shows the line alone, even while the status bar shows an earlier open's notes, and a later diff --git a/crates/ui-egui/src/dialogs/png_options.rs b/crates/ui-egui/src/dialogs/png_options.rs index 04257bc64d..98d6225c17 100644 --- a/crates/ui-egui/src/dialogs/png_options.rs +++ b/crates/ui-egui/src/dialogs/png_options.rs @@ -53,7 +53,11 @@ fn format_of(d: &Dialog) -> Option<&'static Format> { /// Open the options of raster format `f` for an export whose params (format, path, artboard /// choice) are `params`. pub fn open(app: &mut VectorcraftApp, f: &Format, mut params: Value) { - let size = app.session.active().and_then(|st| export_size(&st.doc, ¶ms)); + let selection = params[super::export_as::SELECTION_FIELD] == true; + let size = app.session.active().and_then(|st| match selection { + true => vectorcraft_engine::cmd::fileio::selection_doc(st, "document.exportSelection", false).ok().map(|(_, r)| (r.width(), r.height())), + false => export_size(&st.doc, ¶ms), + }); if let Some(o) = params.as_object_mut() { o.insert("ppi".into(), json!(72)); o.extend(defaults(app, f)); @@ -340,5 +344,5 @@ pub(super) fn choice(ui: &mut egui::Ui, d: &mut Dialog, key: &str, ids: &[&str], fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let (format, path) = (d.str("format"), d.str("path")); app.ui.dialog = None; - io::export(app, Some(&format), Some(path), &form::params(d)) + io::export(app, Some(&format), Some(path), &super::export_as::exported(d, form::params(d))) } diff --git a/crates/ui-egui/src/dialogs/save_options.rs b/crates/ui-egui/src/dialogs/save_options.rs index 5dfb886044..974854a6c3 100644 --- a/crates/ui-egui/src/dialogs/save_options.rs +++ b/crates/ui-egui/src/dialogs/save_options.rs @@ -253,7 +253,7 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { } // Version first; the legacy version takes only its own options. let legacy = legacy_ai(d); - let mut rows: Vec<&FormatOption> = shown(f).filter(|o| LEGACY_ONLY.contains(&o.name) == legacy || o.name == "aiVersion").collect(); + let mut rows: Vec<&FormatOption> = shown(f).filter(|o| fileio::file_reads(f, legacy, o.name)).collect(); // EPS's PostScript level comes last, as in Export's EPS Options. rows.sort_by_key(|o| (o.name != "aiVersion", f.id == "eps" && o.name == "level")); for o in rows { @@ -269,10 +269,6 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { false } -/// The `.ai` options only the legacy version takes (and the only ones it takes, besides the -/// version). -const LEGACY_ONLY: &[&str] = &["transparentImages", "hiddenObjects", "outlineText"]; - /// Is a `.ai` file to be saved in the legacy version 7 (`aiVersion: "7"`)? fn legacy_ai(d: &Dialog) -> bool { d.str("format") == "ai" && d.str("aiVersion").trim() == "7" @@ -615,9 +611,13 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> DialogResult { return Err("name the file".into()); } let path = if d.bool("__pick") { with_extension(path.trim(), f) } else { path }; + // Only the options the file reads: a `.ai` file's version takes its own (when the document's + // own file is a `.ai`, the save remembers the others as they were). + let legacy = legacy_ai(d); let mut options: Map = f .options .iter() + .filter(|o| fileio::file_reads(f, legacy, o.name)) .filter_map(|o| d.fields.get(o.name).filter(|v| !v.is_null() && v.as_str() != Some("")).map(|v| (o.name.to_string(), v.clone()))) .collect(); if uncompressed(d) { diff --git a/crates/ui-egui/src/dialogs/save_options/tests.rs b/crates/ui-egui/src/dialogs/save_options/tests.rs index 7a1aeb3849..286550bac7 100644 --- a/crates/ui-egui/src/dialogs/save_options/tests.rs +++ b/crates/ui-egui/src/dialogs/save_options/tests.rs @@ -125,6 +125,33 @@ fn save_as_ai_version_7_writes_a_file_per_artboard() { assert_eq!((st.save_options["hiddenObjects"].clone(), st.save_options["outlineText"].clone()), (json!("visible"), json!(true))); } +/// Save Options sends a `.ai` save only the options its version reads, so a person's save gets no +/// note about an option the file doesn't read, and the other version's choices stay as the last +/// save left them. +#[test] +fn ai_save_options_send_only_the_options_the_version_reads() { + let (mut app, _, _) = desktop("art.ai"); + for (round, legacy) in [true, false, true].into_iter().enumerate() { + assert_eq!(app.run("file.saveAs", json!({})).unwrap()["pending"], KIND); + frame(&mut app, false); + match round { + 1 => assert!(dialog(&app).bool("outlineText"), "the legacy choice is shown as last saved"), + 2 => assert!(!dialog(&app).bool("editingData"), "the PDF-compatible choice is shown as last saved"), + _ => {} + } + let d = app.ui.dialog.as_mut().unwrap(); + d.fields.insert("aiVersion".into(), json!(if legacy { "7" } else { "pdf" })); + let (key, value) = if legacy { ("outlineText", true) } else { ("editingData", false) }; + d.fields.insert(key.into(), json!(value)); + let d = d.clone(); + app.ui.dialog = None; + let r = confirm(&mut app, &d).unwrap(); + assert!(!r["warnings"].to_string().contains("was not used"), "round {round}: {r}"); + } + let st = app.session.active().unwrap(); + assert_eq!((st.save_options["outlineText"].clone(), st.save_options["editingData"].clone()), (json!(true), json!(false))); +} + /// An Illustrator file opened, then saved as `.ai`: the options dialog stays open through the /// Enter that closed the save panel, and only an Enter after it is let go confirms it. #[test] diff --git a/crates/ui-egui/src/dialogs/save_pdf.rs b/crates/ui-egui/src/dialogs/save_pdf.rs index 2e19375994..225c2cee52 100644 --- a/crates/ui-egui/src/dialogs/save_pdf.rs +++ b/crates/ui-egui/src/dialogs/save_pdf.rs @@ -6,7 +6,8 @@ //! `ui.dialog.set`. OK runs `document.exportPdf` through [`io::export_pdf`]; the Summary is //! `document.pdfSettings`. Save Preset… names the settings as a preset (`pdf.preset.save`). //! Opened from Export As with Use Artboards off (`__artBounds`), the dialog has no Artboards -//! section, and OK writes one page of the visible art's bounds through [`io::export`]. +//! section, and OK writes one page of the visible art's bounds through [`io::export`]; opened +//! from Export Selection (`__selection` too), the page is the selection's crop. //! //! The same dialog edits a preset (kind `pdfPreset`, from Edit → PDF Presets): a `name` and //! `description` instead of the preset and artboards, and OK saves the preset. @@ -154,7 +155,7 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { } let r = match SaveMode::of(&d.str("__save")) { Some(mode) => io::save_pdf(app, mode, params(d)), - None if d.bool(ART_BOUNDS) => export_art(app, params(d)), + None if d.bool(ART_BOUNDS) => export_art(app, d), None => io::export_pdf(app, params(d)), }; // A question the write asked (replace the file the document was opened from?) stays open. @@ -164,12 +165,14 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { r } -/// A page of the art's bounds (Export As with Use Artboards off): written as Export As writes -/// other formats ([`io::export`]), with the dialog's options and a saved preset written out. -fn export_art(app: &mut VectorcraftApp, mut p: Value) -> Result { +/// A page of the art's bounds (Export As with Use Artboards off), or of the selection's crop +/// (Export Selection): written as Export As writes other formats ([`io::export`]), with the +/// dialog's options and a saved preset written out. +fn export_art(app: &mut VectorcraftApp, d: &Dialog) -> Result { + let mut p = params(d); let path = p.as_object_mut().and_then(|o| o.remove("path")).and_then(|v| v.as_str().map(str::to_string)); let p = pdf::expand_preset(&app.session, "file.exportAs", &p).map_err(|e| e.to_string())?.into_owned(); - io::export(app, Some("pdf"), path, &p) + io::export(app, Some("pdf"), path, &super::export_as::exported(d, p)) } /// The settings as `pdf.preset.save` params (without the artboards and path). diff --git a/crates/ui-egui/src/dialogs/svg_options.rs b/crates/ui-egui/src/dialogs/svg_options.rs index ac568dbace..b477bb35c0 100644 --- a/crates/ui-egui/src/dialogs/svg_options.rs +++ b/crates/ui-egui/src/dialogs/svg_options.rs @@ -129,15 +129,23 @@ fn options(d: &Dialog) -> Value { fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { let opts = options(d); - if Mode::of(d) == Mode::Export && d.bool("useArtboards") { + let selection = d.bool(super::export_as::SELECTION_FIELD); + if Mode::of(d) == Mode::Export && d.bool("useArtboards") && !selection { let n = app.session.active().map_or(0, |st| st.doc.artboards.len()); let pick: vectorcraft_engine::cmd::fileio::ArtboardPick = serde_json::from_value(opts.clone()).map_err(|e| e.to_string())?; pick.resolve(n)?; } - // Remembered for next time, without the document's artboard range. + // Remembered for next time, without the document's artboard range. Export Selection shows no + // Use Artboards, so the one remembered before stays. let mut last = opts.clone(); if let Some(o) = last.as_object_mut() { o.remove("range"); + if selection { + match app.ui.svg_options.get("useArtboards") { + Some(v) => o.insert("useArtboards".into(), v.clone()), + None => o.remove("useArtboards"), + }; + } } app.ui.svg_options = last; app.ui.dialog = None; @@ -145,6 +153,7 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { if let Some(p) = d.fields.get("path").filter(|p| p.is_string()) { params["path"] = p.clone(); } + let params = super::export_as::exported(d, params); let id = match Mode::of(d) { Mode::Export => "file.export.svg", Mode::Save => "file.saveAs", @@ -177,8 +186,11 @@ fn check(ui: &mut egui::Ui, d: &mut Dialog, key: &str, label: &str, enabled: boo fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { option_fields(ui, d, false); + // Export Selection writes the selection's crop, without artboards to choose. if Mode::of(d) == Mode::Export { - artboards(app, ui, d); + if !d.bool(super::export_as::SELECTION_FIELD) { + artboards(app, ui, d); + } } else { check(ui, d, "preserveEditing", tl!("Preserve Editing Capabilities"), true); } diff --git a/crates/ui-egui/src/dialogs/tests_export_selection.rs b/crates/ui-egui/src/dialogs/tests_export_selection.rs new file mode 100644 index 0000000000..15fe559974 --- /dev/null +++ b/crates/ui-egui/src/dialogs/tests_export_selection.rs @@ -0,0 +1,238 @@ +//! Export Selection (`document.exportSelection` without params): the picked format's options +//! dialog follows the save panel, as in Export As, and writes the selection alone. + +use std::cell::Cell; +use std::rc::Rc; + +use serde_json::json; +use vectorcraft_plugins::wat::{self as tpl, Echo}; + +use super::tests_export::{Written, app_saving, frame, kind, names, set}; +use super::*; + +/// The last file written, as text. +fn last_text(written: &Written) -> String { + String::from_utf8_lossy(&written.borrow().last().unwrap().1).into_owned() +} + +/// The width and height in a PNG's header. +fn png_size(png: &[u8]) -> (u32, u32) { + let n = |at: usize| u32::from_be_bytes([png[at], png[at + 1], png[at + 2], png[at + 3]]); + (n(16), n(20)) +} + +/// Pick `path` in the next save panels. +fn picking(app: &mut VectorcraftApp, path: &str) { + let picked = path.to_string(); + app.services.pick_save = Some(Box::new(move |_| Some(picked.clone()))); +} + +/// How many paths a native document's JSON (or the input an exporter plug-in is given) holds. +fn paths_in(bytes: &[u8]) -> usize { + String::from_utf8_lossy(vectorcraft_format::json_part(bytes)).matches("\"anchors\"").count() +} + +/// A PDF continues in Save PDF, without its artboard choice, and its options apply: the page is +/// the selected 10 m rectangle's crop (not the art's bounds, which take in the ellipse), with a +/// `UserUnit` once "Write pages longer than 200 in at full size in points" is turned off. +#[test] +fn export_selection_to_pdf_continues_in_save_pdf() { + let (mut app, written) = app_saving(2, |_| "/out/sel.pdf".into()); + app.run("shape.rectangle", json!({"x": 0, "y": 100, "width": 28_346.46, "height": 50})).unwrap(); + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(kind(&app), Some("savePdf"), "the PDF options follow"); + let d = app.ui.dialog.as_ref().unwrap(); + assert_eq!(d.str("path"), "/out/sel.pdf"); + assert!(d.bool("__artBounds") && d.bool(export_as::SELECTION_FIELD)); + assert!(written.borrow().is_empty(), "nothing is written before OK"); + set(&mut app, "longPagesInPoints", json!(false)); + frame(&mut app); + assert_eq!(confirm(&mut app).unwrap()["path"], "/out/sel.pdf"); + assert!(app.ui.dialog.is_none()); + let bytes = written.borrow()[0].1.clone(); + assert!(String::from_utf8_lossy(&bytes).contains("/UserUnit"), "the dialog's option applies"); + let pdf = vectorcraft_pdf::import(&bytes).unwrap(); + assert_eq!(pdf.artboards.len(), 1); + let page = pdf.artboards[0].rect; + assert!((28_346.0..28_350.0).contains(&page.width()), "{}", page.width()); + assert_eq!(page.height().round(), 50.0, "the selection's crop"); +} + +/// Every format with an options dialog shows it after the save panel, and OK writes the +/// selection alone, cropped to the selected 10×5 pt rectangle: the PNG at 72 ppi, the SVG's view +/// box, the EPS bounding box and the DXF's extents. The mark is not kept with the options +/// remembered for the next export. +#[test] +fn export_selection_continues_in_each_format_s_options() { + let (mut app, written) = app_saving(2, |_| String::new()); + app.run("shape.rectangle", json!({"x": 40, "y": 30, "width": 10, "height": 5})).unwrap(); + for (ext, options) in [("svg", "svgOptions"), ("png", "pngOptions"), ("eps", "epsOptions"), ("dxf", "dxfOptions")] { + let path = format!("/out/sel.{ext}"); + picking(&mut app, &path); + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(kind(&app), Some(options), "{ext}"); + assert!(app.ui.dialog.as_ref().unwrap().bool(export_as::SELECTION_FIELD), "{ext}"); + if ext == "png" { + assert_eq!(app.ui.dialog.as_ref().unwrap().fields["__size"], json!([10.0, 5.0]), "the selection's size"); + } + frame(&mut app); + confirm(&mut app).unwrap(); + assert!(app.ui.dialog.is_none(), "{ext}"); + assert_eq!(names(&written).last(), Some(&path), "{ext}"); + let text = last_text(&written); + match ext { + "png" => assert_eq!(png_size(&written.borrow().last().unwrap().1), (10, 5), "10×5 pt at 72 ppi"), + "svg" => assert!(text.contains(r#"viewBox="0 0 10 5""#), "{text}"), + "eps" => assert!(text.contains("%%BoundingBox: 0 0 10 5"), "{text}"), + _ => { + let at = text.find("$EXTMAX").unwrap_or_else(|| panic!("no extents: {text}")); + let max: Vec = text[at..].lines().skip(1).collect::>().chunks(2).take(2).map(|c| c[1].trim().parse().unwrap()).collect(); + // In millimeters, DXF Options' default unit: 10×5 pt. + assert!((max[0] - 10.0 * 25.4 / 72.0).abs() < 1e-3 && (max[1] - 5.0 * 25.4 / 72.0).abs() < 1e-3, "the selection's extents: {max:?}"); + } + } + } + assert_eq!(names(&written).len(), 4, "one file each"); + assert!(app.ui.eps_options.get(export_as::SELECTION_FIELD).is_none(), "EPS Options does not remember the mark"); + assert!(app.ui.svg_options.get(export_as::SELECTION_FIELD).is_none()); +} + +/// Text Export Options opens with Selection Only on, and OK writes the selected type alone. +#[test] +fn export_selection_to_text_writes_the_selected_type() { + let (mut app, written) = app_saving(1, |_| "/out/sel.txt".into()); + app.run("text.create", json!({"x": 10, "y": 10, "text": "Left out"})).unwrap(); + app.run("text.create", json!({"x": 10, "y": 30, "text": "Selected"})).unwrap(); + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(kind(&app), Some("txtOptions")); + assert!(app.ui.dialog.as_ref().unwrap().bool("selectionOnly")); + frame(&mut app); + confirm(&mut app).unwrap(); + assert_eq!(names(&written), ["/out/sel.txt"]); + assert_eq!(last_text(&written), "Selected\n"); +} + +/// SVG Options opened by Export Selection hides Use Artboards, and its OK leaves the Use +/// Artboards setting that the next Export As SVG starts from as it was. +#[test] +fn export_selection_to_svg_keeps_the_remembered_use_artboards() { + let (mut app, _) = app_saving(2, |_| "/out/sel.svg".into()); + app.run("file.export.svg", json!({})).unwrap(); + set(&mut app, "useArtboards", json!(true)); + confirm(&mut app).unwrap(); + assert_eq!(app.ui.svg_options["useArtboards"], true); + app.run("shape.rectangle", json!({"x": 40, "y": 30, "width": 10, "height": 5})).unwrap(); + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(kind(&app), Some("svgOptions")); + confirm(&mut app).unwrap(); + assert_eq!(app.ui.svg_options["useArtboards"], true, "{}", app.ui.svg_options); +} + +/// A format without an options dialog (a native document) and an exporter plug-in, with or +/// without parameters, are given the selection alone: fewer paths than the whole document. +#[test] +fn export_selection_without_a_dialog_and_to_plug_ins_writes_the_selection() { + let (mut app, written) = app_saving(1, |_| String::new()); + app.run("shape.rectangle", json!({"x": 40, "y": 30, "width": 10, "height": 5})).unwrap(); + app.run("file.exportAs", json!({"path": "/out/all.vectorcraft"})).unwrap(); + let all = paths_in(&written.borrow().last().unwrap().1); + picking(&mut app, "/out/sel.vectorcraft"); + app.run("document.exportSelection", json!({})).unwrap(); + assert!(app.ui.dialog.is_none(), "written at once"); + assert_eq!(names(&written).last().map(String::as_str), Some("/out/sel.vectorcraft")); + let selected = paths_in(&written.borrow().last().unwrap().1); + assert!(selected >= 1 && selected < all, "{selected} of {all} paths"); + + for (id, ext, params) in + [("test.ui.selwhole", "tsw", "{}"), ("test.ui.selparams", "tsp", r#"{"density":{"type":"number","min":0,"max":10,"default":4}}"#)] + { + let wasm = wat::parse_str(tpl::echo_exporter(&tpl::exporter(id, &format!(r#"["{ext}"]"#), params), Echo::Input)).unwrap(); + app.run("plugin.install", json!({"dataBase64": vectorcraft_format::base64_encode(&wasm)})).unwrap(); + picking(&mut app, &format!("/out/sel.{ext}")); + app.run("document.exportSelection", json!({})).unwrap(); + if params != "{}" { + assert_eq!(kind(&app), Some(plugin::EXPORT_KIND), "{id} asks for its parameters"); + frame(&mut app); + confirm(&mut app).unwrap(); + } + assert!(app.ui.dialog.is_none(), "{id}"); + assert_eq!(names(&written).last(), Some(&format!("/out/sel.{ext}"))); + let given = paths_in(&written.borrow().last().unwrap().1); + app.run("plugin.remove", json!({"id": id})).unwrap(); + assert_eq!(given, selected, "{id} is given the selection"); + } +} + +/// The question before replacing the file the document was opened from runs the export again as +/// an Export Selection: the PNG written after OK is the selection's. +#[test] +fn export_selection_after_the_question_before_losing_writes_the_selection() { + let (mut app, written) = app_saving(1, |_| "/out/sel.png".into()); + app.run("shape.rectangle", json!({"x": 40, "y": 30, "width": 10, "height": 5})).unwrap(); + let st = app.session.doc_mut().unwrap(); + st.imported_from = Some("/out/sel.png".into()); + st.import_losses = vec!["hidden type".into()]; + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(kind(&app), Some("pngOptions")); + frame(&mut app); + assert_eq!(confirm(&mut app).unwrap()["pending"], super::confirm::KIND); + assert!(written.borrow().is_empty(), "nothing is written before OK"); + confirm(&mut app).unwrap(); + assert_eq!(names(&written), ["/out/sel.png"]); + assert_eq!(png_size(&written.borrow()[0].1), (10, 5), "the selection's crop"); +} + +/// `file.exportAs {path, exportSelection: true}` writes the selection without a dialog; a value +/// that is not true or false is refused. +#[test] +fn export_as_with_export_selection_writes_the_selection() { + let (mut app, written) = app_saving(1, |_| String::new()); + app.run("shape.rectangle", json!({"x": 40, "y": 30, "width": 10, "height": 5})).unwrap(); + app.run("file.exportAs", json!({"path": "/out/sel.png", "exportSelection": true, "useArtboards": true})).unwrap(); + assert_eq!(png_size(&written.borrow()[0].1), (10, 5)); + let e = app.run("file.exportAs", json!({"path": "/out/sel.png", "exportSelection": "yes"})).unwrap_err(); + assert!(e.contains("exportSelection must be true or false"), "{e}"); + assert_eq!(names(&written).len(), 1); +} + +/// Appearance of Black › Printing / Exporting set to rich black draws a CMYK black as RGB black in +/// a PNG from Export As and from Export Selection, as `document.export` draws it. +#[test] +fn rich_black_reaches_files_from_the_export_dialogs() { + let (mut app, written) = app_saving(1, |_| "/out/sel.png".into()); + app.run("file.new", json!({"width": 40, "height": 30, "colorMode": "cmyk"})).unwrap(); + app.run("paint.setStroke", json!({"none": true})).unwrap(); + app.run("paint.setFill", json!({"color": {"c": 0, "m": 0, "y": 0, "k": 1}})).unwrap(); + app.run("shape.rectangle", json!({"x": 0, "y": 0, "width": 40, "height": 30})).unwrap(); + let px = |w: &Written| { + let w = w.borrow(); + image::load_from_memory(&w.last().unwrap().1).unwrap().to_rgba8().get_pixel(10, 10).0 + }; + app.run("file.exportAs", json!({"path": "/out/all.png"})).unwrap(); + let accurate = px(&written); + assert!(accurate[0] > 10, "accurate: dark grey, {accurate:?}"); + app.session.prefs.black_output = "rich".into(); + app.run("file.exportAs", json!({"path": "/out/all.png"})).unwrap(); + assert_eq!(px(&written), [0, 0, 0, 255], "Export As"); + app.run("document.exportSelection", json!({})).unwrap(); + frame(&mut app); + confirm(&mut app).unwrap(); + assert_eq!(names(&written).last().map(String::as_str), Some("/out/sel.png")); + assert_eq!(px(&written), [0, 0, 0, 255], "Export Selection"); +} + +/// With nothing selected, Export Selection stops before the save panel. +#[test] +fn nothing_selected_stops_before_the_save_panel() { + let (mut app, written) = app_saving(1, |_| "/out/sel.pdf".into()); + app.run("select.none", json!({})).unwrap(); + let asked = Rc::new(Cell::new(false)); + let a = asked.clone(); + app.services.pick_save = Some(Box::new(move |_| { + a.set(true); + Some("/out/sel.pdf".into()) + })); + let e = app.run("document.exportSelection", json!({})).unwrap_err(); + assert!(e.contains("select something to export"), "{e}"); + assert!(!asked.get() && app.ui.dialog.is_none() && written.borrow().is_empty()); +} diff --git a/crates/ui-egui/src/dialogs/tests_screens.rs b/crates/ui-egui/src/dialogs/tests_screens.rs index 7ae09dbdf6..1bd4f10afc 100644 --- a/crates/ui-egui/src/dialogs/tests_screens.rs +++ b/crates/ui-egui/src/dialogs/tests_screens.rs @@ -88,6 +88,39 @@ fn opens_on_defaults_and_draws_every_view() { assert_eq!((spec(export_for_screens::KIND).ok_label.unwrap())(&app), "Export Artboard"); } +/// The dialog's own request, with a row of every format its Format menu offers and every format's +/// settings as it opens, gets no note about an option a file doesn't read. +#[test] +fn the_dialogs_own_rows_and_settings_get_no_unused_option_notes() { + let (mut app, _) = app(1, true); + open(&mut app); + let rows: Vec = [ + json!({"format": "png"}), + json!({"format": "png8"}), + json!({"format": "jpg", "quality": 100}), + json!({"format": "webp"}), + json!({"format": "gif"}), + json!({"format": "tiff"}), + json!({"format": "svg"}), + json!({"format": "pdf"}), + json!({"format": "pdf", "marks": {"trim": true}, "suffix": "-print"}), + json!({"format": "eps"}), + json!({"format": "ai"}), + json!({"format": "vectorcraft"}), + ] + .into_iter() + .map(|mut r| { + r["scale"] = json!("1x"); + r + }) + .collect(); + set(&mut app, "formats", json!(rows)); + let p = export_for_screens::params(&app, app.ui.dialog.as_ref().unwrap()).unwrap(); + let r = app.session.execute("document.exportForScreens", &p).unwrap(); + let unused: Vec<&str> = r["warnings"].as_array().unwrap().iter().filter_map(Value::as_str).filter(|w| w.contains("was not used")).collect(); + assert!(unused.is_empty(), "{unused:?}"); +} + #[test] fn checked_artboards_read_as_a_range() { let (mut app, _) = app(5, false); diff --git a/crates/ui-egui/src/dialogs/text_export.rs b/crates/ui-egui/src/dialogs/text_export.rs index 6701fd65d7..12e7b5d425 100644 --- a/crates/ui-egui/src/dialogs/text_export.rs +++ b/crates/ui-egui/src/dialogs/text_export.rs @@ -1,5 +1,6 @@ -//! Export As → Text: the Text Export Options (encoding, line endings, selection only) for a -//! picked `.txt` path. Fields are `document.export` params (`format`, `path`…). +//! Export As → Text and Export Selection to `.txt`: the Text Export Options (encoding, line +//! endings, selection only) for a picked `.txt` path. Fields are `document.export` params +//! (`format`, `path`…). use serde_json::{Value, json}; @@ -39,14 +40,25 @@ fn body(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) -> bool { ui.end_row(); }); ui.add_space(8.0); - let selected = app.session.active().is_some_and(|st| !st.selection.objects.is_empty()); + // Export Selection keeps Selection Only on. + let selected = app.session.active().is_some_and(|st| !st.selection.objects.is_empty()) && !d.bool(super::export_as::SELECTION_FIELD); ui.add_enabled_ui(selected, |ui| form::check(ui, d, "selectionOnly", tl!("Selection Only"))); false } -/// Write the text file (the command runs first, so a bad option keeps the dialog open). +/// Write the text file (the command runs first, so a bad option keeps the dialog open). Opened by +/// Export Selection, it writes `document.exportSelection`'s text. fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result { - let path = io::save_command_output(app, "document.export", "txt", form::params(d))?; + let mut params = form::params(d); + let id = if d.bool(super::export_as::SELECTION_FIELD) { + if let Some(o) = params.as_object_mut() { + o.remove("selectionOnly"); + } + "document.exportSelection" + } else { + "document.export" + }; + let path = io::save_command_output(app, id, "txt", params)?; app.ui.dialog = None; Ok(json!({ "path": path })) } diff --git a/crates/ui-egui/src/document_drag.rs b/crates/ui-egui/src/document_drag.rs index 2784f29eef..b44d09b5c3 100644 --- a/crates/ui-egui/src/document_drag.rs +++ b/crates/ui-egui/src/document_drag.rs @@ -1,8 +1,10 @@ //! A selection dragged across document tabs remains editable and leaves its source intact. +use std::sync::Arc; + use egui::{Context, Id, Response}; use serde_json::json; -use vectorcraft_doc::NodeId; +use vectorcraft_doc::{Document, NodeId}; use vectorcraft_geom::Point; use crate::{VectorcraftApp, canvas, widgets}; @@ -19,7 +21,11 @@ struct Origin { struct Artwork { origin: Origin, ids: Vec, - revision: u64, + /// The source document when the drag left it. The drag ends when the source's content differs + /// from it ([`vectorcraft_engine::DocState::same_content`]). A redraw that raises its revision + /// (another document's assigned color profiles brought to the front) and a change that is not + /// an edit (its type measured again) keep it. + source: Arc, target: u64, } @@ -75,7 +81,7 @@ pub(crate) fn cleanup(app: &VectorcraftApp, ctx: &Context) { } }); if let Some(art) = egui::DragAndDrop::payload::(ctx) { - let valid = app.session.documents().iter().any(|d| d.uid == art.origin.uid && d.revision == art.revision) + let valid = app.session.documents().iter().any(|d| d.uid == art.origin.uid && d.same_content(&art.source)) && app.session.active().is_some_and(|d| d.uid == art.target); let cancel = ctx.input(|i| { !i.focused @@ -143,13 +149,14 @@ pub(crate) fn hover_tab(app: &mut VectorcraftApp, resp: &Response, win: crate::d return true; } // Alt-drag previews use temporary duplicate ids; only the restored originals travel. - let ids = app.session.active().map(|d| d.selection.objects.clone()).unwrap_or_default(); + let Some((ids, source)) = app.session.active().map(|d| (d.selection.objects.clone(), d.doc.clone())) else { + return true; + }; if ids.is_empty() { return true; } canvas::end_document_drag(ctx); - let revision = app.session.active().map(|d| d.revision).unwrap_or_default(); - egui::DragAndDrop::set_payload(ctx, Artwork { origin, ids, revision, target: uid }); + egui::DragAndDrop::set_payload(ctx, Artwork { origin, ids, source, target: uid }); } if transfer && let Some(art) = egui::DragAndDrop::payload::(ctx) { let mut art = (*art).clone(); diff --git a/crates/ui-egui/src/font_menu.rs b/crates/ui-egui/src/font_menu.rs index 554eb9229f..9b829114c2 100644 --- a/crates/ui-egui/src/font_menu.rs +++ b/crates/ui-egui/src/font_menu.rs @@ -1691,7 +1691,7 @@ pub(crate) fn end_stale_preview(app: &mut VectorcraftApp, ctx: &egui::Context) { } /// What the font menus preview on and apply to: the Type tool's selected range while it edits -/// text (the whole text when nothing is selected), else the selected text objects. +/// text (the whole text when nothing is selected), else every frame of each selected story. pub(crate) fn apply(app: &mut VectorcraftApp, ctx: &egui::Context, pick: FontPick) { let previewing = crate::panels::pstate::(ctx, PREVIEWING); match pick { @@ -1791,7 +1791,11 @@ fn font_command(app: &VectorcraftApp, family: &str, style: Option<&str>) -> (&'s } ("text.setRangeStyle", p) } - None => ("text.setStyle", p), + None => { + // With the Selection tool: every frame of each selected story. + crate::panels::character::target_selected_stories(app, &mut p); + ("text.setStyle", p) + } } } diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 9d15012784..8db6de2f96 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -97,7 +97,7 @@ fn plural_polish(n: u64) -> usize { } /// The registry. English first: it is the fallback and the source language. -pub static LANGUAGES: [LangInfo; 28] = [ +pub static LANGUAGES: [LangInfo; 29] = [ LangInfo { code: "en", name: "English", source: "", plural: plural_one_other, complete_menus: false, catalog: OnceLock::new() }, // Hindi shares the integer zero/one rule with French. Desktop UI fonts are loaded lazily // from installed faces by ui_fonts; the web needs a Devanagari font in its font set. @@ -109,6 +109,18 @@ pub static LANGUAGES: [LangInfo; 28] = [ complete_menus: true, catalog: OnceLock::new(), }, + // Gujarati: menus and dialogs, with partial status/error message coverage and loanwords + // transliterated into Gujarati script; zero/one singular plurals. Gujarati text is drawn with an installed system font + // (Gujarati Sangam MN, Nirmala UI, Shruti) or a craft-fonts face tagged `Gujr`. Web selection + // requires a bundled Gujarati interface face; otherwise `gu-*` locales use the fallback. + LangInfo { + code: "gu", + name: "ગુજરાતી", + source: include_str!("i18n/gu.tsv"), + plural: plural_french, + complete_menus: true, + catalog: OnceLock::new(), + }, // Greek: the whole interface and the status and error messages, keeping the same names in // English as Spanish; every `el-*` locale (including `el-GR` and `el-CY`) resolves here. LangInfo { @@ -355,6 +367,16 @@ pub static LANGUAGES: [LangInfo; 28] = [ ]; impl LangInfo { + fn available(&self) -> bool { + self.available_with_fonts(cfg!(target_arch = "wasm32"), vectorcraft_text::CRAFT_FONTS.iter().any(|f| f.scripts.contains(&"Gujr"))) + } + + fn available_with_fonts(&self, web: bool, gujarati_font: bool) -> bool { + // Browsers cannot use the native installed-font fallback. Do not offer a language + // whose text would be missing-glyph boxes, including when restoring a preference. + self.code != "gu" || !web || gujarati_font + } + fn catalog(&self) -> &Catalog { self.catalog.get_or_init(|| Catalog::parse(self.source)) } @@ -387,7 +409,7 @@ impl Lang { /// A language by its exact code. pub fn from_code(code: &str) -> Option { - LANGUAGES.iter().find(|l| l.code.eq_ignore_ascii_case(code)).map(Lang) + LANGUAGES.iter().find(|l| l.code.eq_ignore_ascii_case(code) && l.available()).map(Lang) } /// Resolve the `interfaceLanguage` preference: a language code, or `auto` (and anything @@ -396,12 +418,12 @@ impl Lang { Lang::from_code(pref).unwrap_or_else(system_lang) } - /// Every registered language. + /// Every language available in this build. pub fn all() -> impl Iterator { - LANGUAGES.iter().map(Lang) + LANGUAGES.iter().filter(|l| l.available()).map(Lang) } - /// Every registered language in the order a picker lists them: English first (the source + /// Every available language in the order a picker lists them: English first (the source /// language and the fallback), then the rest by their own name with accents folded, so /// Čeština sits under C rather than after Z. Names in other scripts follow the Latin ones in /// code point order: Greek, Cyrillic, Arabic, then the CJK languages. @@ -676,7 +698,7 @@ fn message_at(lang: Lang, s: &str, depth: usize) -> String { if depth <= 1 || quoted(v) { v.to_string() } else if v.starts_with(['{', '[']) { - lang.catalog().exact_message(v).unwrap_or(v).to_string() + exact_translation(lang.catalog(), v).unwrap_or_else(|| v.to_string()) } else { message_at(lang, v, depth - 1) } @@ -686,6 +708,12 @@ fn message_at(lang: Lang, s: &str, depth: usize) -> String { fill_once(template, &args) } +/// The translation of a message with an exact `@msg` row in `catalog`, its `{{` and `}}` shown as +/// `{` and `}`. +fn exact_translation(catalog: &Catalog, s: &str) -> Option { + catalog.exact_message(s).map(|tr| fill_once(tr, &[])) +} + /// Fill `{name}` placeholders in one pass: a value that holds `{name}` text stays as it is. /// Unknown placeholders are left as written. `{{` and `}}` are a literal `{` and `}`. pub(crate) fn fill_once(template: &str, args: &[(&str, &str)]) -> String { diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 1f469c69c9..28944173dd 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -691,6 +691,8 @@ font-technology Variable Променливи Crop Image Изрязване на изображение Image Tools Инструменти за изображения Remove Background… Премахване на фона… + Draw (Pencil) Рисуване (Молив) + Place Image Вмъкване на изображение Remove Background Премахване на фона Background Фон Edge Color Цвят на ръба @@ -2586,6 +2588,7 @@ font-technology Variable Променливи Proportional Metrics Пропорционални метрики Insert Aki Left Вмъкване на аки отляво Insert Aki Right Вмъкване на аки отдясно + Tsume Цуме Character Direction Посока на знаците Digits Цифри Arabic Арабски @@ -4702,11 +4705,11 @@ axis Both И двете @msg unknown effect `{id}` непознат ефект `{id}` @msg unknown format непознат формат @msg unknown format `{f}` (Save writes {_1}) непознат формат `{f}` (Запазването записва {_1}) -@msg unknown freeform mode `{m}` (points, lines) непознат режим на свободна форма `{m}` (точки, линии) -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) непознат вид градиент `{k}` (линеен, радиален, конусен, ромбовиден, свободна форма) +@msg unknown freeform mode `{m}` (points, lines) непознат режим на свободна форма `{m}` (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) непознат вид градиент `{k}` (linear, radial, conic, diamond, freeform) @msg unknown highlight `{h}` непознат акцент `{h}` @msg unknown option `{path}.{k}` непозната опция `{path}.{k}` -@msg unknown overprints `{o}` (preserve, simulate or discard) непознати надписи `{o}` (запазване, симулиране или отхвърляне) +@msg unknown overprints `{o}` (preserve, simulate or discard) непознати надписи `{o}` (preserve, simulate или discard) @msg unknown panel `{raw}` непознат панел `{raw}` @msg unknown preference `{key}` непозната настройка `{key}` @msg Preferences imported. Настройките са импортирани. @@ -4724,7 +4727,7 @@ axis Both И двете @msg `{key}` must be an object `{key}` трябва да бъде обект @msg `prefs.import` runs on its own, not as a batch step `prefs.import` се изпълнява самостоятелно, а не като стъпка от пакет @msg unknown preset (one of {_1}) непозната предварителна настройка (една от {_1}) -@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) непозната предварителна настройка `{name}` (висока, средна, ниска или запазена: вижте flattener.presets.list) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) непозната предварителна настройка `{name}` (high, medium, low или запазена: вижте flattener.presets.list) @msg unknown preset `{name}` (see flattener.presets.list) непозната предварителна настройка `{name}` (вижте flattener.presets.list) @msg unknown preset `{name}` (see webExport.presets.list) непозната предварителна настройка `{name}` (вижте webExport.presets.list) @msg unknown side `{other}` (left|right|top|bottom) непозната страна `{other}` (left|right|top|bottom) @@ -5027,6 +5030,7 @@ effect Soft Меко VectorCraft Title Bar on Every Desktop Заглавна лента на VectorCraft на всеки работен плот The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Докато е зададена, променливата на средата VECTORCRAFT_TITLEBAR избира заглавната лента. System Title Bar takes precedence over this option while it is on. Докато е включена, „Заглавна лента на системата“ има предимство пред тази опция. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Докато „Заглавна лента на VectorCraft на всеки работен плот“ е изключена, този работен плот изчертава заглавната лента на прозореца независимо дали тази опция е включена. Value Axis Ос на стойностите On Left Side От лявата страна On Right Side От дясната страна @@ -6057,6 +6061,8 @@ axis Y Axis Y ос Action Options… Опции на действието… Action Options Опции на действието Playback Options… Опции за възпроизвеждане… + Button Mode Режим с бутони + No actions. Няма действия. Insert Stop… Вмъкване на спиране… Insert Stop Вмъкване на спиране Record Stop Записване на спиране @@ -6859,6 +6865,12 @@ breakText Glyphs Глифи @msg open the practice sample of `{id}` first (see learn.openSample) първо отворете примерния файл за упражнение на `{id}` (вижте learn.openSample) @msg finish `{id}` first (see learn.finish) първо завършете `{id}` (вижте learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` е последният урок в своето умение + Reset progress Нулиране на напредъка + Mark Tutorial Step Отбелязване на стъпка от урока + Reset Learn Progress Нулиране на напредъка в обучението +@msg missing `step` (see learn.show) липсва `step` (вижте learn.show) +@msg `step` must be a step number from 0 to {last} `step` трябва да е номер на стъпка от 0 до {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` е завършен (вижте learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Обновяване на отложените ефекти diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index a23133933a..01b90e5148 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -201,6 +201,8 @@ Crop Image Izreži sliku Image Tools Alati za slike Remove Background… Ukloni pozadinu… + Draw (Pencil) Crtaj (olovka) + Place Image Postavi sliku Remove Background Ukloni pozadinu Background Pozadina Edge Color Boja ruba @@ -982,6 +984,7 @@ VectorCraft Title Bar on Every Desktop Naslovna traka VectorCrafta na svakoj radnoj površini The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Dok je varijabla okruženja VECTORCRAFT_TITLEBAR postavljena, ona bira naslovnu traku. System Title Bar takes precedence over this option while it is on. Dok je uključena, Sistemska naslovna traka ima prednost pred ovom opcijom. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Dok je Naslovna traka VectorCrafta na svakoj radnoj površini isključena, ova radna površina crta naslovnu traku prozora bez obzira na to je li ova opcija uključena. Exit Izlaz Distort Izobliči Diffuse Glow… Difuzni sjaj… @@ -1570,6 +1573,7 @@ lighting Light Svjetlo Proportional Metrics Proporcionalna metrika Insert Aki Left Umetni aki lijevo Insert Aki Right Umetni aki desno + Tsume Tsume Character Direction Smjer znakova Digits Cifre Arabic Arapski @@ -6099,6 +6103,8 @@ axis Y Axis Y osa Action Options… Opcije akcije… Action Options Opcije akcije Playback Options… Opcije reprodukcije… + Button Mode Način dugmadi + No actions. Nema akcija. Insert Stop… Umetni zaustavljanje… Insert Stop Umetni zaustavljanje Record Stop Snimi zaustavljanje @@ -6485,7 +6491,7 @@ anchor Points: Tačke: Stop on Errors Zaustavi pri greškama Yonroku-ban Yonroku-ban @msg image '{key}' has no pixels and was left out slika '{key}' nema piksela i izostavljena je -@msg not an RTF file: it doesn't start with {\\rtf nije RTF datoteka: ne počinje s {\\rtf +@msg not an RTF file: it doesn't start with {{\\rtf nije RTF datoteka: ne počinje s {{\\rtf @msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), which can't be opened yet: save it as PDF, PDF-compatible .ai or SVG ovo je PostScript datoteka (.ai sačuvan u starijem formatu ili bez PDF kompatibilnosti, ili EPS datoteka), koja se još ne može otvoriti: sačuvajte je kao PDF, .ai kompatibilan s PDF-om ili SVG font-script Japanese Japansko swatch [None] [Nijedna] @@ -6912,6 +6918,12 @@ shape Open Otvoren @msg open the practice sample of `{id}` first (see learn.openSample) prvo otvorite uzorak za vježbu tutorijala `{id}` (vidi learn.openSample) @msg finish `{id}` first (see learn.finish) prvo završite `{id}` (vidi learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` je posljednji tutorijal u svojoj vještini + Reset progress Vrati napredak na početno + Mark Tutorial Step Označi korak tutorijala + Reset Learn Progress Vrati napredak učenja na početno +@msg missing `step` (see learn.show) nedostaje `step` (vidi learn.show) +@msg `step` must be a step number from 0 to {last} `step` mora biti broj koraka od 0 do {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` je završen (vidi learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Osvježi odgođene efekte diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 373eb0b79d..4ddd1d5605 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -1006,6 +1006,8 @@ antiAlias Sharp Nítid Crop Image Retalla la imatge Image Tools Eines d’imatge Remove Background… Elimina el fons… + Draw (Pencil) Dibuixa (llapis) + Place Image Col·loca una imatge Remove Background Elimina el fons Background Fons Edge Color Color de la vora @@ -3356,6 +3358,7 @@ digits Malayalam Malaiàlam Proportional Metrics Mètriques proporcionals Insert Aki Left Insereix aki a l'esquerra Insert Aki Right Insereix aki a la dreta + Tsume Tsume Proportional Lining Xifres proporcionals alineades Position: Posició: Default Position Posició predeterminada @@ -4095,6 +4098,8 @@ digits Malayalam Malaiàlam Action Options… Opcions de l’acció… Action Options Opcions de l’acció Playback Options… Opcions de reproducció… + Button Mode Mode de botons + No actions. No hi ha accions. Insert Stop… Insereix una aturada… Insert Stop Insereix una aturada Record Stop Enregistra una aturada @@ -4613,6 +4618,7 @@ digits Malayalam Malaiàlam VectorCraft Title Bar on Every Desktop Barra de títol de VectorCraft a tots els escriptoris The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Mentre està definida, la variable d’entorn VECTORCRAFT_TITLEBAR determina la barra de títol. System Title Bar takes precedence over this option while it is on. Mentre està activada, Barra de títol del sistema té prioritat sobre aquesta opció. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Mentre Barra de títol de VectorCraft a tots els escriptoris està desactivada, aquest escriptori dibuixa la barra de títol de la finestra tant si aquesta opció està activada com si no. Tab Tabulació Tab Stops Aturades de tabulació Table Taula @@ -5289,6 +5295,7 @@ digits Malayalam Malaiàlam @msg `{key}` must be a #rrggbb colour `{key}` ha de ser un color #rrggbb @msg `{key}` must be a number `{key}` ha de ser un nombre @msg `{key}` must be a number not below 0 `{key}` ha de ser un nombre no inferior a 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` han de ser quatre nombres no inferiors a 0: [tl, tr, br, bl] @msg `{key}` must be a number, not {v} `{key}` ha de ser un nombre, no {v} @msg `{key}` must be a string `{key}` ha de ser una cadena @msg `{key}` must be a profile name or null `{key}` ha de ser un nom de perfil o null @@ -5869,6 +5876,7 @@ digits Malayalam Malaiàlam @msg no action set to save no hi ha cap conjunt d’accions per desar @msg the action set file can't be read in full el fitxer de conjunt d’accions no es pot llegir sencer @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out S’ha carregat “{name}”: s’ha omès {n} pas|S’ha carregat “{name}”: s’han omès {n} passos +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` S’ha carregat “{name}”: {n} pas té una ordre desconeguda i s’ha conservat: “{action}”, pas {step}, `{command}`|S’ha carregat “{name}”: {n} passos tenen ordres desconegudes i s’han conservat; el primer: “{action}”, pas {step}, `{command}` @msg not an action set file no és un fitxer de conjunt d’accions @msg the action set file is larger than 8 MiB el fitxer de conjunt d’accions supera els 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: la referència superaria els {MAX_BYTES} bytes @@ -5927,7 +5935,7 @@ digits Malayalam Malaiàlam @msg not an HP-GL file no és un fitxer HP-GL @msg not a PICT file no és un fitxer PICT @msg `pens` must be an array of 1 to 255 #rrggbb colors `pens` ha de ser una matriu d’1 a 255 colors #rrggbb -@msg not an RTF file: it doesn't start with {\\rtf no és un fitxer RTF: no comença amb {\\rtf +@msg not an RTF file: it doesn't start with {{\\rtf no és un fitxer RTF: no comença amb {{\\rtf @msg not found no s’ha trobat @msg not in pattern editing mode no esteu en mode d’edició de motius @msg finish editing the pattern first acabeu primer l’edició del motiu @@ -6360,6 +6368,7 @@ digits Malayalam Malaiàlam @msg truncated truncat @msg Unembedded to {_1} S’ha desincrustat a {_1} @msg unknown command `{0}` ordre desconeguda `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` el pas {step} de “{action}” executa l’ordre desconeguda `{command}` @msg unknown command `{0}`; did you mean `{1}`? ordre desconeguda `{0}`; volies dir `{1}`? @msg unknown control `{name}`: fillStroke, coloring, drawMode or screenMode control desconegut `{name}`: fillStroke, coloring, drawMode o screenMode @msg Unknown dimension mode Mode de dimensió desconegut @@ -6492,8 +6501,8 @@ digits Malayalam Malaiàlam @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` un exportador declara d’1 a {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` com a màxim {MAX_UNGROUPED} paràmetres fora de grups: doneu un `group` als altres @msg can't encode the input no es pot codificar l’entrada -@msg expected {"dataBase64"} s’esperava {"dataBase64"} -@msg expected {"objects"} s’esperava {"objects"} +@msg expected {{"dataBase64": "…"}} s’esperava {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} s’esperava {{"objects": [...]}} @msg export `{name}`: {e} exportació del mòdul `{name}`: {e} @msg extension {e} is listed twice l’extensió {e} apareix dues vegades @msg extension {e}: use 1-16 lower-case letters and digits, without the dot extensió {e}: feu servir 1-16 lletres minúscules i dígits, sense el punt @@ -6557,11 +6566,11 @@ digits Malayalam Malaiàlam @msg a painted live effect returns only `objects` un efecte dinàmic de pintura només retorna `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` una peça d’un efecte dinàmic de pintura només té `path`, `fillRule`, `fills` i `strokes` @msg a read-only object was left out s’ha omès un objecte de només lectura -@msg a read-only object was left out: return it, as {"id"} alone or as it was given s’ha omès un objecte de només lectura: retorneu-lo com a {"id"} sol o tal com s’ha rebut +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given s’ha omès un objecte de només lectura: retorneu-lo com a {{"id": …}} sol o tal com s’ha rebut @msg a string una cadena @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` un traç només té `paint`, `width`, `join`, `cap` i `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} un traç ha de ser {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} un efecte ha de ser {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} un traç ha de ser {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} un efecte ha de ser {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` un efecte en un farciment només retorna `fills` @msg an effect on a stroke returns only `strokes` un efecte en un traç només retorna `strokes` @msg an object must be a JSON object un objecte ha de ser un objecte JSON @@ -7444,6 +7453,12 @@ breakText Glyphs Glifs @msg open the practice sample of `{id}` first (see learn.openSample) obriu primer la mostra de pràctica de `{id}` (vegeu learn.openSample) @msg finish `{id}` first (see learn.finish) acabeu primer `{id}` (vegeu learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` és l’últim tutorial de la seva habilitat + Reset progress Restableix el progrés + Mark Tutorial Step Marca el pas del tutorial + Reset Learn Progress Restableix el progrés d’aprenentatge +@msg missing `step` (see learn.show) falta `step` (vegeu learn.show) +@msg `step` must be a step number from 0 to {last} `step` ha de ser un número de pas de 0 a {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` està acabat (vegeu learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Actualitza els efectes ajornats @@ -7473,3 +7488,119 @@ breakText Glyphs Glifs Grommets Ullets Grommet Inset Distància dels ullets a la vora Diameter Diàmetre +# Status and error messages of image export, color profiles and libraries, 3D effects, path operations and scripts. +@msg 3D effects require finite coordinates within 100 million points Els efectes 3D requereixen coordenades finites dins de 100 milions de punts +@msg 3D effects require one to ten lights Els efectes 3D requereixen d’un a deu llums +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Profunditat BMP {_1}: 1, 4, 8, 16, 24 o 32 bits per píxel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer La codificació BMP ha fallat: {width} × {height} píxels no caben al format ni a la memòria intermèdia de píxels +@msg GIF encoding failed: the palette image is malformed La codificació GIF ha fallat: la imatge de paleta està mal formada +@msg GIF encoding failed: {e} La codificació GIF ha fallat: {e} +@msg JPEG colour profile: {e} Perfil de color JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size La codificació JPEG ha fallat: la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg JPEG encoding failed: {e} La codificació JPEG ha fallat: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size La codificació PNG ha fallat: la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg PNG encoding failed: the palette image is malformed La codificació PNG ha fallat: la imatge de paleta està mal formada +@msg PNG encoding failed: {e} La codificació PNG ha fallat: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size La codificació PNG ha fallat: {width} × {height} píxels no és una mida d’imatge vàlida +@msg PSD colour profile: {e} Perfil de color PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size La codificació PSD ha fallat: la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg Revolve profile contains invalid coordinates El perfil de Revolució conté coordenades no vàlides +@msg Revolve profile is too complex El perfil de Revolució és massa complex +@msg Revolve projection is not finite La projecció de Revolució no és finita +@msg Revolve requires finite profile coordinates within 100 million points Revolució requereix coordenades de perfil finites dins de 100 milions de punts +@msg Revolve surface is too complex; reduce Segments or simplify the profile La superfície de Revolució és massa complexa; redueix Segments o simplifica el perfil +@msg Revolve surface is too complex; simplify the profile La superfície de Revolució és massa complexa; simplifica el perfil +@msg Revolve visibility cannot split the projected boundary La visibilitat de Revolució no pot dividir el contorn projectat +@msg Revolve visibility creates too many fragments La visibilitat de Revolució crea massa fragments +@msg Revolve visibility creates too many vector anchors La visibilitat de Revolució crea massa punts d’ancoratge vectorials +@msg Revolve visibility exceeds its geometry work limit La visibilitat de Revolució supera el seu límit de treball geomètric +@msg Revolve visibility exceeds its spatial index limit La visibilitat de Revolució supera el seu límit d’índex espacial +@msg Revolve visibility has too many boundary crossings La visibilitat de Revolució té massa encreuaments de contorn +@msg Revolve visibility has too many input anchors La visibilitat de Revolució té massa punts d’ancoratge d’entrada +@msg Revolve visibility requires convex cap sectors La visibilitat de Revolució requereix sectors de tapa convexos +@msg Revolve visibility requires finite projected faces La visibilitat de Revolució requereix cares projectades finites +@msg SVG options: {e} Opcions SVG: {e} +@msg Save for Web settings: {e} Paràmetres de Desa per a web: {e} +@msg TIFF colour profile: {e} Perfil de color TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size La codificació TIFF ha fallat: la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg TIFF encoding failed: {e} La codificació TIFF ha fallat: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Profunditat Targa {_1}: 16, 24 o 32 bits per píxel +@msg Targa encoding failed: the pixel buffer doesn't match the image size La codificació Targa ha fallat: la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg The 3D projection is not finite La projecció 3D no és finita +@msg The 3D shadow is too complex; turn Shadows off or simplify the art L’ombra 3D és massa complexa; desactiva Ombres o simplifica la il·lustració +@msg The shape contains invalid coordinates La forma conté coordenades no vàlides +@msg Too many Revolve faces for visibility evaluation Massa cares de Revolució per avaluar-ne la visibilitat +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft llegeix com a màxim {ASE_MAX_ENTRIES} colors i grups d’un fitxer d’intercanvi de mostres, i aquesta biblioteca en té {entries} +@msg WebP encoding failed: {e} La codificació WebP ha fallat: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `index` must be a whole number `index` ha de ser un nombre enter +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` és smallThumb, mediumThumb, largeThumb, smallList o largeList +@msg a line can't run from a point to itself una línia no pot anar d’un punt a ell mateix +@msg a line needs at least two points una línia necessita almenys dos punts +@msg a number cannot be read no es pot llegir un número +@msg a swatch exchange block is too long un bloc d’intercanvi de mostres és massa llarg +@msg a swatch exchange name is too long un nom d’intercanvi de mostres és massa llarg +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels una imatge de {sw} × {sh} no es pot redimensionar a {width} × {height} píxels +@msg a {width} × {height} image is too large una imatge de {width} × {height} és massa gran +@msg a {width} × {height} image: {e} una imatge de {width} × {height}: {e} +@msg an image could not be written: {e} no s’ha pogut escriure una imatge: {e} +@msg an image that couldn't be read was left out s’ha omès una imatge que no s’ha pogut llegir +@msg can't open “{name}”: {e} no es pot obrir “{name}”: {e} +@msg cannot align zip entries to {align} bytes no es poden alinear les entrades del zip a {align} bytes +@msg cannot open the automation {kind} root `{_1}`: {e} no es pot obrir l’arrel {kind} de l’automatització `{_1}`: {e} +@msg cannot read profile: {0} no es pot llegir el perfil: {0} +@msg color book version {version} isn't supported (only 1) la versió {version} del llibre de colors no és compatible (només 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) els llibres de colors en l’espai de color {other} no són compatibles (només RGB, CMYK i Lab) +@msg file name too long to zip: {_1} nom de fitxer massa llarg per afegir-lo al zip: {_1} +@msg file name too long to zip: {name} nom de fitxer massa llarg per afegir-lo al zip: {name} +@msg freeform line {i}: {e} línia de forma lliure {i}: {e} +@msg freeform point {i}: {e} punt de forma lliure {i}: {e} +@msg give `{key}` or `{other}`, not both indiqueu `{key}` o `{other}`, no tots dos +@msg grayscale profiles can't be working spaces yet els perfils d’escala de grisos encara no poden ser espais de treball +@msg input contains NaN or infinite coordinates l’entrada conté coordenades NaN o infinites +@msg input path could not be closed no s’ha pogut tancar el traçat d’entrada +@msg invalid ICC profile: {0} perfil ICC no vàlid: {0} +@msg invalid scale {scale} escala no vàlida {scale} +@msg its localized names take more than {_1} KB els seus noms localitzats ocupen més de {_1} KB +@msg its objects are nested too deep ({e}) els seus objectes estan imbricats massa profundament ({e}) +@msg its tag table lists the `{_1}` tag more than once la seva taula d’etiquetes inclou l’etiqueta `{_1}` més d’una vegada +@msg not a graphic style library: {e} no és una biblioteca d’estils gràfics: {e} +@msg not a swatch library (.vcswatches or .gpl) no és una biblioteca de mostres (.vcswatches o .gpl) +@msg not a swatch library (format `{_1}`) no és una biblioteca de mostres (format `{_1}`) +@msg not a swatch library: {e} no és una biblioteca de mostres: {e} +@msg not an action set file ({e}) no és un fitxer de conjunt d’accions ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray l’espai de color del perfil, {other}, no és RGB, CMYK ni Gray +@msg regular expression too large expressió regular massa gran +@msg script file is not UTF-8 text: {value} el fitxer de l’script no és text UTF-8: {value} +@msg stop {i}: {e} la parada {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) la versió {major}.{minor} del fitxer d’intercanvi de mostres no és compatible (només 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors el llibre de colors conté més de {ASE_MAX_ENTRIES} colors +@msg the color book is cut short el llibre de colors està tallat +@msg the color book's names take more than {_1} MB els noms del llibre de colors ocupen més de {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution la imatge faria {w} × {h} píxels; les exportacions ràster estan limitades a {MAX_RASTER_SIDE} píxels per costat i {_1} megapíxels: reduïu l’escala o la resolució +@msg the optimised image can't be read back: {e} la imatge optimitzada no es pot tornar a llegir: {e} +@msg the pixel buffer doesn't match the image size la memòria intermèdia de píxels no coincideix amb la mida de la imatge +@msg the preview: {e} la previsualització: {e} +@msg the request may not read the New Document profiles folder la sol·licitud no pot llegir la carpeta de perfils de document nou +@msg the shapes are too degenerate to combine les formes són massa degenerades per combinar-les +@msg the shapes cross themselves and each other too often to combine les formes es creuen amb si mateixes i entre elles massa vegades per combinar-les +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups el fitxer d’intercanvi de mostres conté més de {ASE_MAX_ENTRIES} colors i grups +@msg the swatch exchange file is cut short el fitxer d’intercanvi de mostres està tallat +@msg the {_1} plate can't be read: {e} la planxa {_1} no es pot llegir: {e} +@msg this binary DXF file is damaged or cut short aquest fitxer DXF binari està malmès o tallat +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that aquest és un dibuix DWG, que no es pot llegir: desa’l des de l’aplicació CAD com a DXF i obre’l +@msg too many classes massa classes +@msg too many groups massa grups +@msg too many layers for PSD (at most 32767) massa capes per a PSD (com a màxim 32767) +@msg too many swatch exchange blocks massa blocs d’intercanvi de mostres +@msg unknown colour profile: {0} perfil de color desconegut: {0} +@msg {_1} clashes with a built-in profile name {_1} coincideix amb el nom d’un perfil integrat +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} píxels és massa gran per a GIF (com a màxim 65535 píxels per costat): reduïu la resolució +@msg {_1}: no usable transform to/from sRGB {_1}: no hi ha cap transformació utilitzable a sRGB o des de sRGB +@msg {name} is not a CMYK profile {name} no és un perfil CMYK +@msg {name} is not an RGB profile {name} no és un perfil RGB +@msg {path}: could not be read {path}: no s’ha pogut llegir +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} píxels és massa gran per a JPEG (com a màxim 65535 píxels per costat): reduïu la resolució +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} píxels és massa gran per a Targa (com a màxim 65535 píxels per costat): reduïu la resolució +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} píxels és massa gran per a PSD (com a màxim {MAX_SIDE} píxels per costat): reduïu la resolució diff --git a/crates/ui-egui/src/i18n/catalog.rs b/crates/ui-egui/src/i18n/catalog.rs index ab3abff6f5..f2fab1fcfa 100644 --- a/crates/ui-egui/src/i18n/catalog.rs +++ b/crates/ui-egui/src/i18n/catalog.rs @@ -13,7 +13,8 @@ pub struct Catalog { ids: HashMap, /// plural messages: `one|other` → forms plurals: HashMap>, - /// status and error messages without placeholders (`@msg`): English → translation + /// status and error messages without placeholders (`@msg`): English, its `{{` and `}}` read as + /// `{` and `}` → translation, as written messages: HashMap, /// status and error messages with `{name}` placeholders (`@msg`, and each English form of a /// `@msgplural` row), most specific first @@ -193,13 +194,20 @@ impl Catalog { "@plural" => { c.plurals.insert(src, tr.split('|').map(str::to_string).collect()); } - "@msg" => { - if src.contains('{') || src.contains("}}") { - c.templates.extend(Template::parse(&src, vec![tr], false)); - } else { - c.messages.insert(src, tr); - } + "@msg" if !src.contains(['{', '}']) => { + c.messages.insert(src, tr); } + "@msg" => match Template::parse(&src, vec![tr], false) { + // A row without placeholders is an exact message, under its text with `{{` and + // `}}` read as literal braces. + Some(Template { pieces, mut forms, .. }) if matches!(pieces.as_slice(), [Piece::Text(_)]) => { + if let (Some(Piece::Text(text)), Some(tr)) = (pieces.into_iter().next(), forms.pop()) { + c.messages.insert(text, tr); + } + } + Some(template) => c.templates.push(template), + None => {} + }, "@msgplural" => { let forms: Vec = tr.split('|').map(str::to_string).collect(); c.templates.extend(src.split('|').filter_map(|english| Template::parse(english, forms.clone(), true))); @@ -249,8 +257,8 @@ impl Catalog { self.templates.iter().find_map(|t| t.captures(s).map(|caps| (t.forms.as_slice(), caps))) } - /// The translation of a status or error message that has an exact `@msg` entry; templates are - /// not tried. + /// The translation of a status or error message that has an exact `@msg` entry, as written in + /// the catalog (`{{` and `}}` for literal braces); templates are not tried. pub fn exact_message(&self, s: &str) -> Option<&str> { self.messages.get(s).map(String::as_str) } diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 7178be3143..211982f086 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -207,6 +207,8 @@ Crop Image Oříznout obraz Image Tools Nástroje obrazu Remove Background… Odstranit pozadí… + Draw (Pencil) Kreslit (tužka) + Place Image Umístit obraz Remove Background Odstranit pozadí Background Pozadí Edge Color Barva okraje @@ -1001,6 +1003,7 @@ VectorCraft Title Bar on Every Desktop Záhlaví okna VectorCraftu v každém desktopovém prostředí The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Dokud je proměnná prostředí VECTORCRAFT_TITLEBAR nastavena, záhlaví okna volí ona. System Title Bar takes precedence over this option while it is on. Dokud je Systémové záhlaví okna zapnuté, má přednost před touto volbou. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Dokud je Záhlaví okna VectorCraftu v každém desktopovém prostředí vypnuté, toto desktopové prostředí kreslí záhlaví okna bez ohledu na to, zda je tato volba zapnutá. Exit Ukončit Distort Zkreslení Diffuse Glow… Rozptýlená záře… @@ -1598,6 +1601,7 @@ lighting Light Světlo Proportional Metrics Proporcionální metrika Insert Aki Left Vložit aki vlevo Insert Aki Right Vložit aki vpravo + Tsume Tsume Character Direction Směr znaků Digits Číslice Arabic Arabské @@ -4798,6 +4802,7 @@ imageTrace Outline Obrys @msg `select` must be true or false `select` musí být true nebo false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` a `maxAnchors` musí být celá čísla @msg `{key}` must be a number not below 0 `{key}` musí být číslo nejméně 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` musí být čtyři čísla nejméně 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` musí být [x, y, width, height]: čtyři konečná čísla, šířka a výška nesmí být záporné @msg `{min_key}` is greater than `{max_key}` `{min_key}` je větší než `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` zadejte alespoň jeden z parametrů `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -5050,6 +5055,7 @@ imageTrace Outline Obrys @msg no action set to save žádná sada akcí k uložení @msg the action set file can't be read in full soubor sady akcí nelze přečíst celý @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Načteno „{name}“: vynechán {n} krok|Načteno „{name}“: vynechány {n} kroky|Načteno „{name}“: vynecháno {n} kroků +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Načteno „{name}“: {n} krok má neznámý příkaz a byl ponechán: „{action}“, krok {step}, `{command}`|Načteno „{name}“: {n} kroky mají neznámé příkazy a byly ponechány; první: „{action}“, krok {step}, `{command}`|Načteno „{name}“: {n} kroků má neznámé příkazy a bylo ponecháno; první: „{action}“, krok {step}, `{command}` @msg not an action set file není to soubor sady akcí @msg the action set file is larger than 8 MiB soubor sady akcí je větší než 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: reference by byla větší než {MAX_BYTES} bajtů @@ -5290,6 +5296,7 @@ imageTrace Outline Obrys @msg tool shortcuts must be a single key (optionally with Shift) zkratky nástrojů musí být jediná klávesa (volitelně se Shift) @msg truncated zkráceno @msg unknown command `{0}` neznámý příkaz `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` krok {step} akce „{action}“ spouští neznámý příkaz `{command}` @msg unknown command `{0}`; did you mean `{1}`? neznámý příkaz `{0}`; mysleli jste `{1}`? @msg unknown effect `{id}` neznámý efekt `{id}` @msg unknown format neznámý formát @@ -6389,8 +6396,8 @@ axis Y Axis osa Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` exportní zásuvný modul deklaruje 1 až {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` mimo skupiny smí být nejvýše {MAX_UNGROUPED} parametrů: ostatním přiřaďte `group` @msg can't encode the input vstup nelze zakódovat -@msg expected {"dataBase64"} očekáváno {"dataBase64"} -@msg expected {"objects"} očekáváno {"objects"} +@msg expected {{"dataBase64": "…"}} očekáváno {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} očekáváno {{"objects": [...]}} @msg export `{name}`: {e} export `{name}`: {e} @msg extension {e} is listed twice přípona {e} je uvedena dvakrát @msg extension {e}: use 1-16 lower-case letters and digits, without the dot přípona {e}: použijte 1-16 malých písmen a číslic, bez tečky @@ -6454,11 +6461,11 @@ axis Y Axis osa Y @msg a painted live effect returns only `objects` malující živý efekt vrací jen `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` část malujícího živého efektu má jen `path`, `fillRule`, `fills` a `strokes` @msg a read-only object was left out objekt jen pro čtení byl vynechán -@msg a read-only object was left out: return it, as {"id"} alone or as it was given objekt jen pro čtení byl vynechán: vraťte ho jako samotné {"id"} nebo tak, jak byl předán +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given objekt jen pro čtení byl vynechán: vraťte ho jako samotné {{"id": …}} nebo tak, jak byl předán @msg a string řetězec @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` tah má jen `paint`, `width`, `join`, `cap` a `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} tah musí být {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} efekt musí být {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} tah musí být {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} efekt musí být {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` efekt na výplni vrací jen `fills` @msg an effect on a stroke returns only `strokes` efekt na tahu vrací jen `strokes` @msg an object must be a JSON object objekt musí být objekt JSON @@ -6600,6 +6607,8 @@ axis Y Axis osa Y Action Options… Možnosti akce… Action Options Možnosti akce Playback Options… Možnosti přehrávání… + Button Mode Režim tlačítek + No actions. Žádné akce. Insert Stop… Vložit zastavení… Insert Stop Vložit zastavení Record Stop Zaznamenat zastavení @@ -7436,6 +7445,122 @@ breakText Glyphs Glyfy @plural {n} line cut|{n} lines cut {n} řádek zkrácen|{n} řádky zkráceny|{n} řádků zkráceno @msg `first` and `last` must be numbers of lines the console holds, first before last `first` a `last` musí být čísla řádků, které konzole uchovává, `first` před `last` +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D efekty vyžadují konečné souřadnice v rozsahu 100 milionů bodů +@msg 3D effects require one to ten lights 3D efekty vyžadují jedno až deset světel +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel hloubka BMP {_1}: 1, 4, 8, 16, 24 nebo 32 bitů na obrazový bod +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer kódování BMP selhalo: {width} × {height} obrazových bodů neodpovídá formátu ani vyrovnávací paměti obrazových bodů +@msg GIF encoding failed: the palette image is malformed kódování GIF selhalo: obraz s paletou je chybně utvořený +@msg GIF encoding failed: {e} kódování GIF selhalo: {e} +@msg JPEG colour profile: {e} barevný profil JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size kódování JPEG selhalo: vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg JPEG encoding failed: {e} kódování JPEG selhalo: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size kódování PNG selhalo: vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg PNG encoding failed: the palette image is malformed kódování PNG selhalo: obraz s paletou je chybně utvořený +@msg PNG encoding failed: {e} kódování PNG selhalo: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size kódování PNG selhalo: {width} × {height} obrazových bodů není platná velikost obrazu +@msg PSD colour profile: {e} barevný profil PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size kódování PSD selhalo: vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg Revolve profile contains invalid coordinates Profil rotačního tělesa obsahuje neplatné souřadnice +@msg Revolve profile is too complex Profil rotačního tělesa je příliš složitý +@msg Revolve projection is not finite Projekce rotačního tělesa není konečná +@msg Revolve requires finite profile coordinates within 100 million points Rotační těleso vyžaduje konečné souřadnice profilu v rozsahu 100 milionů bodů +@msg Revolve surface is too complex; reduce Segments or simplify the profile Povrch rotačního tělesa je příliš složitý; snižte Segmenty nebo zjednodušte profil +@msg Revolve surface is too complex; simplify the profile Povrch rotačního tělesa je příliš složitý; zjednodušte profil +@msg Revolve visibility cannot split the projected boundary Výpočet viditelnosti rotačního tělesa nedokáže rozdělit promítnutou hranici +@msg Revolve visibility creates too many fragments Výpočet viditelnosti rotačního tělesa vytváří příliš mnoho fragmentů +@msg Revolve visibility creates too many vector anchors Výpočet viditelnosti rotačního tělesa vytváří příliš mnoho vektorových kotevních bodů +@msg Revolve visibility exceeds its geometry work limit Výpočet viditelnosti rotačního tělesa překračuje svůj limit geometrických výpočtů +@msg Revolve visibility exceeds its spatial index limit Výpočet viditelnosti rotačního tělesa překračuje svůj limit prostorového indexu +@msg Revolve visibility has too many boundary crossings Výpočet viditelnosti rotačního tělesa má příliš mnoho průsečíků hranic +@msg Revolve visibility has too many input anchors Výpočet viditelnosti rotačního tělesa má příliš mnoho vstupních kotevních bodů +@msg Revolve visibility requires convex cap sectors Výpočet viditelnosti rotačního tělesa vyžaduje konvexní výseče podstav +@msg Revolve visibility requires finite projected faces Výpočet viditelnosti rotačního tělesa vyžaduje konečné promítnuté stěny +@msg SVG options: {e} Možnosti SVG: {e} +@msg Save for Web settings: {e} Nastavení Uložit pro web: {e} +@msg TIFF colour profile: {e} barevný profil TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size kódování TIFF selhalo: vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg TIFF encoding failed: {e} kódování TIFF selhalo: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel hloubka Targa {_1}: 16, 24 nebo 32 bitů na obrazový bod +@msg Targa encoding failed: the pixel buffer doesn't match the image size kódování Targa selhalo: vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg The 3D projection is not finite 3D projekce není konečná +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D stín je příliš složitý; vypněte Stíny nebo zjednodušte kresbu +@msg The shape contains invalid coordinates Tvar obsahuje neplatné souřadnice +@msg Too many Revolve faces for visibility evaluation Rotační těleso má příliš mnoho stěn pro výpočet viditelnosti +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft čte ze souboru pro výměnu vzorníku nejvýše {ASE_MAX_ENTRIES} barev a skupin a tato knihovna jich má {entries} +@msg WebP encoding failed: {e} kódování WebP selhalo: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` je smallThumb, mediumThumb, largeThumb, smallList nebo largeList +@msg a line can't run from a point to itself čára nemůže vést z bodu zpět do téhož bodu +@msg a line needs at least two points čára potřebuje alespoň dva body +@msg a number cannot be read číslo nelze přečíst +@msg a swatch exchange block is too long blok souboru pro výměnu vzorníku je příliš dlouhý +@msg a swatch exchange name is too long název v souboru pro výměnu vzorníku je příliš dlouhý +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels velikost obrazu {sw} × {sh} nelze změnit na {width} × {height} obrazových bodů +@msg a {width} × {height} image is too large obraz {width} × {height} je příliš velký +@msg a {width} × {height} image: {e} obraz {width} × {height}: {e} +@msg an image could not be written: {e} obraz se nepodařilo zapsat: {e} +@msg an image that couldn't be read was left out obraz, který nešlo přečíst, byl vynechán +@msg can't open “{name}”: {e} nelze otevřít „{name}“: {e} +@msg cannot align zip entries to {align} bytes položky zipu nelze zarovnat na {align} bajtů +@msg cannot open the automation {kind} root `{_1}`: {e} nelze otevřít kořen automatizace pro {kind} `{_1}`: {e} +@msg cannot read profile: {0} profil nelze přečíst: {0} +@msg color book version {version} isn't supported (only 1) verze barevné knihy {version} není podporována (pouze 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) barevné knihy v barevném prostoru {other} nejsou podporovány (pouze RGB, CMYK a Lab) +@msg file name too long to zip: {_1} název souboru je pro zip příliš dlouhý: {_1} +@msg file name too long to zip: {name} název souboru je pro zip příliš dlouhý: {name} +@msg freeform line {i}: {e} volná čára {i}: {e} +@msg freeform point {i}: {e} volný bod {i}: {e} +@msg give `{key}` or `{other}`, not both zadejte `{key}` nebo `{other}`, ne obojí +@msg grayscale profiles can't be working spaces yet profily ve stupních šedi zatím nemohou být pracovními prostory +@msg input contains NaN or infinite coordinates vstup obsahuje souřadnice NaN nebo nekonečné souřadnice +@msg input path could not be closed vstupní cestu se nepodařilo uzavřít +@msg invalid ICC profile: {0} neplatný profil ICC: {0} +@msg invalid scale {scale} neplatné měřítko {scale} +@msg its localized names take more than {_1} KB jeho lokalizované názvy zabírají více než {_1} KB +@msg its objects are nested too deep ({e}) jeho objekty jsou vnořené příliš hluboko ({e}) +@msg its tag table lists the `{_1}` tag more than once jeho tabulka značek uvádí značku `{_1}` více než jednou +@msg not a graphic style library: {e} nejde o knihovnu grafických stylů: {e} +@msg not a swatch library (.vcswatches or .gpl) nejde o knihovnu vzorníku (.vcswatches nebo .gpl) +@msg not a swatch library (format `{_1}`) nejde o knihovnu vzorníku (formát `{_1}`) +@msg not a swatch library: {e} nejde o knihovnu vzorníku: {e} +@msg not an action set file ({e}) nejde o soubor sady akcí ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray barevný prostor profilu {other} není RGB, CMYK ani Gray +@msg regular expression too large regulární výraz je příliš velký +@msg script file is not UTF-8 text: {value} soubor skriptu není text v kódování UTF-8: {value} +@msg stop {i}: {e} zarážka {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) verze souboru pro výměnu vzorníku {major}.{minor} není podporována (pouze 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors barevná kniha obsahuje více než {ASE_MAX_ENTRIES} barev +@msg the color book is cut short barevná kniha je useknutá +@msg the color book's names take more than {_1} MB názvy barevné knihy zabírají více než {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution obraz by měl {w} × {h} obrazových bodů; rastrové exporty jsou omezeny na {MAX_RASTER_SIDE} obrazových bodů na stranu a {_1} megapixelů: snižte měřítko nebo rozlišení +@msg the optimised image can't be read back: {e} optimalizovaný obraz nelze zpětně přečíst: {e} +@msg the pixel buffer doesn't match the image size vyrovnávací paměť obrazových bodů neodpovídá velikosti obrazu +@msg the preview: {e} náhled: {e} +@msg the request may not read the New Document profiles folder požadavek nesmí číst složku profilů nového dokumentu +@msg the shapes are too degenerate to combine tvary jsou příliš degenerované na sloučení +@msg the shapes cross themselves and each other too often to combine tvary protínají samy sebe i sebe navzájem příliš často na sloučení +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups soubor pro výměnu vzorníku obsahuje více než {ASE_MAX_ENTRIES} barev a skupin +@msg the swatch exchange file is cut short soubor pro výměnu vzorníku je useknutý +@msg the {_1} plate can't be read: {e} výtažek {_1} nelze přečíst: {e} +@msg this binary DXF file is damaged or cut short tento binární soubor DXF je poškozený nebo useknutý +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that toto je výkres DWG, který nelze přečíst: uložte jej v aplikaci CAD jako DXF a otevřete ten +@msg too many classes příliš mnoho tříd znaků +@msg too many groups příliš mnoho skupin +@msg too many layers for PSD (at most 32767) příliš mnoho vrstev pro PSD (nejvýše 32767) +@msg too many swatch exchange blocks příliš mnoho bloků souboru pro výměnu vzorníku +@msg unknown colour profile: {0} neznámý barevný profil: {0} +@msg {_1} clashes with a built-in profile name {_1} koliduje s názvem vestavěného profilu +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} obrazových bodů je pro GIF příliš mnoho (nejvýše 65535 obrazových bodů na stranu): snižte rozlišení +@msg {_1}: no usable transform to/from sRGB {_1}: žádná použitelná transformace do sRGB nebo ze sRGB +@msg {name} is not a CMYK profile {name} není profil CMYK +@msg {name} is not an RGB profile {name} není profil RGB +@msg {path}: could not be read {path}: nelze přečíst +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} obrazových bodů je pro JPEG příliš mnoho (nejvýše 65535 obrazových bodů na stranu): snižte rozlišení +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} obrazových bodů je pro Targa příliš mnoho (nejvýše 65535 obrazových bodů na stranu): snižte rozlišení +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} obrazových bodů je pro PSD příliš mnoho (nejvýše {MAX_SIDE} obrazových bodů na stranu): snižte rozlišení + # Learn panel Learn Výuka Explore tutorials Prozkoumat výukové kurzy @@ -7463,6 +7588,12 @@ breakText Glyphs Glyfy @msg open the practice sample of `{id}` first (see learn.openSample) nejprve otevřete cvičnou ukázku kurzu `{id}` (viz learn.openSample) @msg finish `{id}` first (see learn.finish) nejprve dokončete `{id}` (viz learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` je poslední výukový kurz své dovednosti + Reset progress Obnovit postup + Mark Tutorial Step Označit krok výukového kurzu + Reset Learn Progress Obnovit postup učení +@msg missing `step` (see learn.show) chybí `step` (viz learn.show) +@msg `step` must be a step number from 0 to {last} `step` musí být číslo kroku od 0 do {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` je dokončen (viz learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Obnovit odložené efekty @@ -7492,3 +7623,1816 @@ breakText Glyphs Glyfy Grommets Průchodky Grommet Inset Odstup průchodek od okraje Diameter Průměr +@msg 'caller', 'callee' and 'arguments' cannot be used on strict mode functions 'caller', 'callee' a 'arguments' nelze použít u funkcí ve striktním režimu +@msg A profile supports one Revolve effect. Edit the existing effect's options instead. Profil podporuje jeden efekt Rotační těleso. Upravte místo toho volby stávajícího efektu. +@msg Add Points at Crossings: a path went missing Přidat body v křížení: jedna cesta se ztratila +@msg Alignment must be one of the choices Zarovnání musí být jedna z nabízených voleb +@msg Boolean.prototype.{name} was called on a value that is not a Boolean Boolean.prototype.{name} byla zavolána na hodnotě, která není Boolean +@msg CMYK images whose samples couldn't be read in CMYK were imported in RGB Obrazy CMYK, jejichž vzorky nešlo přečíst v CMYK, byly importovány v RGB +@msg CSS options: {e} Volby CSS: {e} +@msg CSV has a header but no data rows CSV má záhlaví, ale žádné řádky dat +@msg CSV holds NUL bytes: save it as UTF-8, or as UTF-16 with a byte-order mark CSV obsahuje bajty NUL: uložte ho jako UTF-8, nebo jako UTF-16 se značkou pořadí bajtů +@msg CSV is empty CSV je prázdné +@msg CSV is larger than {MAX_CSV_BYTES} bytes CSV je větší než {MAX_CSV_BYTES} bajtů +@msg CSV is not UTF-16 CSV není v UTF-16 +@msg CSV is not UTF-8 CSV není v UTF-8 +@msg CSV would be larger than {MAX_CSV_BYTES} bytes CSV by bylo větší než {MAX_CSV_BYTES} bajtů +@msg Cannot write to the location of “{name}”; choose where to save it Do umístění souboru „{name}“ nelze zapisovat; zvolte, kam ho uložit +@msg Choose original artwork, not a dimension's generated paths Zvolte původní kresbu, ne cesty vytvořené kótou +@msg Contour: select paths or shapes Obrys: vyberte cesty nebo tvary +@msg Contour: the Offset Path effect is not available Obrys: efekt Odsadit cestu není dostupný +@msg Create needs fills, strokes or both Vytvořit vyžaduje výplně, tahy nebo obojí +@msg DCS files can only be placed linked: use File › Place with Link on Soubory DCS lze umístit jen jako propojené: použijte Soubor › Umístit se zapnutou volbou Propojení +@msg DXF options: {e} Volby DXF: {e} +@msg DXF scale must be a positive number up to {_1}, not {scale} Měřítko DXF musí být kladné číslo nejvýše {_1}, ne {scale} +@msg DXF {field} `{s}`: {allowed} DXF {field} `{s}`: {allowed} +@msg Date.prototype method called on a value that is not a Date object Metoda Date.prototype byla zavolána na hodnotě, která není objekt Date +@msg Dimension is locked or hidden Kóta je zamknutá nebo skrytá +@msg Dimension mode does not match its source Režim kóty neodpovídá jejímu zdroji +@msg Draw Inside needs exactly one selected path, compound path or text Kreslit dovnitř vyžaduje právě jednu vybranou cestu, složenou cestu nebo text +@msg EPS Save writes all artwork: use document.export for selected-only EPS Uložení EPS zapisuje celou kresbu: pro EPS jen z výběru použijte document.export +@msg EPS flattener: {e} Sloučení průhlednosti EPS: {e} +@msg EPS options: {e} Volby EPS: {e} +@msg EPS {field} `{s}`: {allowed} EPS {field} `{s}`: {allowed} +@msg Error.prototype.toString was called on a value that is not an object Error.prototype.toString byla zavolána na hodnotě, která není objekt +@msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft Exportovat pro obrazovky zapisuje png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai nebo vectorcraft +@msg Flare click coordinates must be finite numbers Souřadnice kliknutí pro Odlesk musí být konečná čísla +@msg Function.prototype.toString was called on a value that is not a function Function.prototype.toString byla zavolána na hodnotě, která není funkce +@msg HTML Text applies to object slices of type only Text HTML se týká jen řezů objektů s textem +@msg Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces) Identifikovat objekty podle je nastaveno na XML ID: název musí být platné XML ID (začíná písmenem, podtržítkem nebo dvojtečkou; bez mezer) +@msg Image Trace failed: internal error: its thread stopped (please report this bug) Vektorizace obrazu selhala: vnitřní chyba: její vlákno se zastavilo (nahlaste prosím tuto chybu) +@msg Image Trace failed: {e} Vektorizace obrazu selhala: {e} +@msg Image Trace finished, but its document was closed Vektorizace obrazu skončila, ale její dokument byl zavřen +@msg Image Trace finished, but the image or its settings changed meanwhile: trace it again Vektorizace obrazu skončila, ale obraz nebo jeho nastavení se mezitím změnily: vektorizujte ho znovu +@msg Import SVG Filter reads SVG files, not SVGZ Importovat filtr SVG čte soubory SVG, ne SVGZ +@msg Invalid dimension offset Neplatné odsazení kóty +@msg Invalid point Neplatný bod +@msg JSON.parse: {why} (at offset {at}) JSON.parse: {why} (na pozici {at}) +@msg JSON.stringify cannot write a structure that contains itself JSON.stringify nemůže zapsat strukturu, která obsahuje sama sebe +@msg Join: a subpath went missing Spojit: jedna dílčí cesta se ztratila +@msg Line Gap must be a number Mezera řádků musí být číslo +@msg Lock Workspace is not available in VectorCraft Zamknout pracovní prostor není ve VectorCraft dostupné +@msg Move Panel to New Window is not available: floating panels stay in the main window Přesunout panel do nového okna není dostupné: plovoucí panely zůstávají v hlavním okně +@msg Namespace.prototype.toString needs a Namespace Namespace.prototype.toString vyžaduje Namespace +@msg New Document profiles need the preferences folder, which this run doesn't have Profily nového dokumentu vyžadují složku předvoleb, kterou toto spuštění nemá +@msg Number.prototype.{name} was called on a value that is not a number Number.prototype.{name} byla zavolána na hodnotě, která není číslo +@msg Object.create's prototype must be an object or null Prototyp pro Object.create musí být objekt nebo null +@msg Object.{function} was given a value that is not an object Object.{function} dostala hodnotu, která není objekt +@msg Offset Path: the path is too complex to offset Odsadit cestu: cesta je příliš složitá na odsazení +@msg Offset Path: {e} Odsadit cestu: {e} +@msg PDF content is incomplete or exceeds the reader's limits; no document was imported Obsah PDF je neúplný nebo překračuje limity čtení; žádný dokument nebyl importován +@msg PDF flattener: {e} Sloučení průhlednosti PDF: {e} +@msg PDF options: {e} Volby PDF: {e} +@msg QName.prototype.toString needs a QName QName.prototype.toString vyžaduje QName +@msg Recolor Artwork is no longer open Přebarvit kresbu už není otevřené +@msg RegExp.prototype.{name} was called on a value that is not a RegExp object RegExp.prototype.{name} byla zavolána na hodnotě, která není objekt RegExp +@msg SVG is not UTF-8, UTF-16 or ISO 8859-1 SVG není v UTF-8, UTF-16 ani ISO 8859-1 +@msg Save writes one artboard: name one, or export several with document.export Uložit zapisuje jednu pracovní plochu: uveďte jednu, nebo jich několik exportujte pomocí document.export +@msg Select a dimension first Nejprve vyberte kótu +@msg Select dimensions to update Vyberte kóty k aktualizaci +@msg Select only dimensions Vyberte jen kóty +@msg Select two or more objects, or a group Vyberte dva nebo více objektů, nebo skupinu +@msg Shaper needs 1–64 source paths Shaper vyžaduje 1–64 zdrojových cest +@msg Stencil Bridges: the selected art is too large or too detailed to bridge Můstky šablony: vybraná kresba je příliš velká nebo příliš podrobná na přemostění +@msg String.prototype.toString was called on a value that is not a string String.prototype.toString byla zavolána na hodnotě, která není řetězec +@msg Switch x/y is for scatter graphs Prohodit x/y je určeno pro bodové grafy +@msg Text options: {e} Volby textu: {e} +@msg The {name} profile could not be read, so the new document has the default settings: {reason} Profil {name} nešlo přečíst, takže nový dokument má výchozí nastavení: {reason} +@msg Trap: more than {_1} pairs of objects lie close enough to trap, or too many objects share a horizontal range; trap fewer objects at a time Přesah barev: více než {_1} dvojic objektů leží dost blízko pro přesah, nebo příliš mnoho objektů sdílí vodorovný rozsah; zpracujte najednou méně objektů +@msg Weed Box and Lines: no weeding line fits outside the art, and the weed box is off Rámeček a linie pro vybírání: mimo kresbu se nevejde žádná linie pro vybírání a rámeček je vypnutý +@msg \ at end of pattern \ na konci vzoru +@msg `alignOn` cannot be empty `alignOn` nesmí být prázdné +@msg `alignOn` must be a string `alignOn` musí být řetězec +@msg `align` is start, center or end `align` je start, center nebo end +@msg `align` must be a string `align` musí být řetězec +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` musí být pole dvojic [subpath, anchor] +@msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` musí uvádět indexy kotevních bodů (0, 1, 2…), ne {k} +@msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` musí uvádět indexy kotevních bodů (0, 1, 2…), ne {v} +@msg `answer` for this {kind} dialog must be one of: {_1} `answer` pro tento dialog {kind} musí být jedna z hodnot: {_1} +@msg `answers` has more than {MAX_ANSWERS} answers `answers` má více než {MAX_ANSWERS} odpovědí +@msg `answers` is larger than 1 MiB `answers` je větší než 1 MiB +@msg `answers` must be a list of answers `answers` musí být seznam odpovědí +@msg `artboard` must be the index of an artboard of the document `artboard` musí být index pracovní plochy dokumentu +@msg `artboardsAt` must be [x, y] `artboardsAt` musí být [x, y] +@msg `artboards` must be a list of artboard indices `artboards` musí být seznam indexů pracovních ploch +@msg `artboards` names an artboard the document does not have `artboards` uvádí pracovní plochu, kterou dokument nemá +@msg `artboards` names an artboard twice `artboards` uvádí některou pracovní plochu dvakrát +@msg `asset` is the asset id (see assets.list) `asset` je ID prvku (viz assets.list) +@msg `at` must be [x, y] (got {at}) `at` musí být [x, y] (zadáno {at}) +@msg `at` must be a byte offset `at` musí být bajtový posun +@msg `at` must be a point [x, y] `at` musí být bod [x, y] +@msg `autoLeading` must be a number `autoLeading` musí být číslo +@msg `background` must be "", "matte" or #rrggbb `background` musí být "", "matte" nebo #rrggbb +@msg `beside` needs `side` `beside` vyžaduje `side` +@msg `burasagari` must be "none", "standard" or "forced" `burasagari` musí být "none", "standard" nebo "forced" +@msg `center` must be [x, y] `center` musí být [x, y] +@msg `charAlign` must be "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" or "icfBottom" `charAlign` musí být "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" nebo "icfBottom" +@msg `charDirection` must be "default", "leftToRight" or "rightToLeft" `charDirection` musí být "default", "leftToRight" nebo "rightToLeft" +@msg `clearStroke` requires `stroke: false`, `ids: []` and no `stop` `clearStroke` vyžaduje `stroke: false`, `ids: []` a žádné `stop` +@msg `clear` must be a list of type object ids, not {v} `clear` musí být seznam ID textových objektů, ne {v} +@msg `clear` must list type objects; {_1} is not one `clear` musí uvádět textové objekty; {_1} jím není +@msg `clear` must not list `id` `clear` nesmí uvádět `id` +@msg `code` must be a whole number `code` musí být celé číslo +@msg `colorMode` must be one of rgb, cmyk `colorMode` musí být jedna z hodnot rgb, cmyk +@msg `color` needs a `rule` to make the theme from `color` vyžaduje `rule`, podle kterého se motiv vytvoří +@msg `colors` does not apply to the {name} reduction `colors` se netýká redukce {name} +@msg `colors` is empty `colors` je prázdné +@msg `colors` must be a whole number from 2 to 256 `colors` musí být celé číslo od 2 do 256 +@msg `colors` must be at least 9 for the uniform reduction `colors` musí být pro rovnoměrnou redukci nejméně 9 +@msg `colors` must be between 1 and {MAX_THEME_COLORS} (got {n}) `colors` musí být mezi 1 a {MAX_THEME_COLORS} (zadáno {n}) +@msg `columnType` is vertical, uniform, repeating or sliding `columnType` je vertical, uniform, repeating nebo sliding +@msg `columns` must be a whole number 1..50 `columns` musí být celé číslo 1..50 +@msg `commands` must not be empty `commands` nesmí být prázdné +@msg `contents` goes with `to` `contents` patří k `to` +@msg `corners` must be sharp, round or square, not `{other}` `corners` musí být sharp, round nebo square, ne `{other}` +@msg `corners` must list anchor indices (0, 1, 2…), not {v} `corners` musí uvádět indexy kotevních bodů (0, 1, 2…), ne {v} +@msg `count` must be a whole number from 0 to {MAX_COUNT} `count` musí být celé číslo od 0 do {MAX_COUNT} +@msg `count` must be a whole number from 1 to 100 `count` musí být celé číslo od 1 do 100 +@msg `dataBase64` is larger than the module limit `dataBase64` je větší než limit modulu +@msg `dataBase64` is not valid base64 `dataBase64` není platný base64 +@msg `defaultsOnly` cannot be combined with `ids`, `reverse` or `append` `defaultsOnly` nelze kombinovat s `ids`, `reverse` ani `append` +@msg `depth` and `childLimit` slice the summary: pass `summary: true` `depth` a `childLimit` omezují souhrn: předejte `summary: true` +@msg `design` is a design name, or null for plain columns `design` je název návrhu, nebo null pro obyčejné sloupce +@msg `design` is a design name, or null for the default marker `design` je název návrhu, nebo null pro výchozí značku +@msg `destinationFolder` is required when destination is `folder` `destinationFolder` je povinné, když je cíl `folder` +@msg `destination` must be `none`, `saveAndClose` or `folder` `destination` musí být `none`, `saveAndClose` nebo `folder` +@msg `diameter` must be from 0.1 to 2500 pt `diameter` musí být od 0.1 do 2500 pt +@msg `digits` must be one of {_1} `digits` musí být jedna z hodnot {_1} +@msg `dimImages` is a percentage or false `dimImages` je procento nebo false +@msg `direction` must be "auto", "leftToRight" or "rightToLeft" `direction` musí být "auto", "leftToRight" nebo "rightToLeft" +@msg `ditherAmount` must be a number from 0 to 100 `ditherAmount` musí být číslo od 0 do 100 +@msg `each` is the value one design stands for, more than 0 `each` je hodnota, kterou představuje jeden návrh, větší než 0 +@msg `end` must be "start" or "end" `end` musí být "start" nebo "end" +@msg `ends` applies to joining exactly two paths `ends` se týká spojení právě dvou cest +@msg `event` must be one of {_1} `event` musí být jedna z hodnot {_1} +@msg `every` must be "all", "odd" or "even", not {v} `every` musí být "all", "odd" nebo "even", ne {v} +@msg `expand` must be true or false `expand` musí být true nebo false +@msg `fidelity` must be from {lo} to {hi} pt `fidelity` musí být od {lo} do {hi} pt +@msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` musí být 1 až 1000 cest k souborům písem, které našlo poslední hledání text.findFontFiles +@msg `focal` and `radius` cannot be used together `focal` a `radius` nelze použít společně +@msg `focal` must be an array of [subpath, anchor] pairs `focal` musí být pole dvojic [subpath, anchor] +@msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal` uvádí [{si}, {ai}], což není kotevní bod cesty +@msg `folder` must be an absolute folder path `folder` musí být absolutní cesta ke složce +@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` musí být objekt se značkami os a hodnotami, například {"wght"} +@msg `format` must be a string `format` musí být řetězec +@msg `format` must be one of {_1} `format` musí být jedna z hodnot {_1} +@msg `fractions` is chop or scale `fractions` je chop nebo scale +@msg `from` and `to` must differ `from` a `to` se musí lišit +@msg `from` has an empty frame `from` má prázdný rámec +@msg `from` must be a non-negative integer `from` musí být nezáporné celé číslo +@msg `from` must be area type or type on a path `from` musí být text v oblasti nebo text na cestě +@msg `gid` must be a glyph id, not {v} `gid` musí být ID glyfu, ne {v} +@msg `glyphAlternate` belongs to one character, not to a character style (text.setGlyphAlternate sets it) `glyphAlternate` patří jednomu znaku, ne stylu znaků (nastavuje ho text.setGlyphAlternate) +@msg `glyphAlternate` takes only null, which takes a glyph choice away (text.setGlyphAlternate makes one) `glyphAlternate` přijímá jen null, které volbu glyfu odebere (volbu nastavuje text.setGlyphAlternate) +@msg `group` must be one of {_1} `group` musí být jedna z hodnot {_1} +@msg `group` must be the Objects on Path group of `member` and `target` `group` musí být skupina Objekty na cestě, do které patří `member` a `target` +@msg `guide` must be a guide index (guide.list) `guide` musí být index vodítka (guide.list) +@msg `hAlign` must be default, left, center or right `hAlign` musí být default, left, center nebo right +@msg `id` is an object id, not {v} `id` je ID objektu, ne {v} +@msg `id` must be a node id `id` musí být ID uzlu +@msg `id` must be an object id, not {v} `id` musí být ID objektu, ne {v} +@msg `ids` must name Objects on Path groups or objects in them `ids` musí uvádět skupiny Objekty na cestě nebo objekty v nich +@msg `ids` takes at most {MAX_INSPECT_IDS} ids `ids` přijímá nejvýše {MAX_INSPECT_IDS} ID +@msg `imageMap` must be none, rectangle or polygon `imageMap` musí být none, rectangle nebo polygon +@msg `includeArtboardFill` must be true or false `includeArtboardFill` musí být true nebo false +@msg `includeSubdirs` must be true or false `includeSubdirs` musí být true nebo false +@msg `index` must be a point index `index` musí být index bodu +@msg `index` must be a whole number or null `index` musí být celé číslo nebo null +@msg `indices` must be a non-empty array of item indices `indices` musí být neprázdné pole indexů položek +@msg `item` needs `index` `item` vyžaduje `index` +@msg `items` is a list of {kind, item} `items` je seznam {kind, item} +@msg `items` is empty `items` je prázdné +@msg `items` must be a list of {id, points} `items` musí být seznam {id, points} +@msg `items` must be a list of {{id, anchors?}}, not {v} `items` musí být seznam {{id, anchors?}}, ne {v} +@msg `items` must be an array of {id, anchors} `items` musí být pole {id, anchors} +@msg `items` must be an array of {{id, corners?}}, not {v} `items` musí být pole {{id, corners?}}, ne {v} +@msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` musí být "none", "short", "medium", "long" nebo "stylistic" +@msg `kerningBefore` belongs to a line's first character, not to a character style (text.setRangeStyle sets it) `kerningBefore` patří prvnímu znaku řádku, ne stylu znaků (nastavuje ho text.setRangeStyle) +@msg `kind` is one of {_1} `kind` je jedna z hodnot {_1} +@msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind` musí být "round", "invertedRound" nebo "chamfer", ne {v} +@msg `kind` must be `text`, `visibility`, `image` or `graph` `kind` musí být `text`, `visibility`, `image` nebo `graph` +@msg `kind` must be a string `kind` musí být řetězec +@msg `kind` must be image, noImage or htmlText `kind` musí být image, noImage nebo htmlText +@msg `kinsokuType` must be "pushInFirst", "pushOutFirst" or "pushOutOnly" `kinsokuType` musí být "pushInFirst", "pushOutFirst" nebo "pushOutOnly" +@msg `kinsoku` must be "none", "hard" or "soft" `kinsoku` musí být "none", "hard" nebo "soft" +@msg `label` must be a non-empty name of at most 200 characters `label` musí být neprázdný název o nejvýše 200 znacích +@msg `language` must be a language name or tag, such as "Turkish" or "tr" `language` musí být název nebo značka jazyka, například "Turkish" nebo "tr" +@msg `leader` must be a string `leader` musí být řetězec +@msg `leadingModel` must be "romanBaseline" or "emBoxTop" `leadingModel` musí být "romanBaseline" nebo "emBoxTop" +@msg `leading` must be from 0.1 to 5000, or null for Auto `leading` musí být od 0.1 do 5000, nebo null pro Automaticky +@msg `length` must be a number of at most 1000000 pt either way `length` musí být číslo nejvýše 1000000 pt v obou směrech +@msg `line` must be true or false `line` musí být true nebo false +@msg `max` must be 1 to {MAX_SUGGESTIONS} `max` musí být 1 až {MAX_SUGGESTIONS} +@msg `minAngle` ({min_angle}°) can't be more than `maxAngle` ({max_angle}°) `minAngle` ({min_angle}°) nemůže být větší než `maxAngle` ({max_angle}°) +@msg `mode` must be "handles", "straight" or "smooth" `mode` musí být "handles", "straight" nebo "smooth" +@msg `mode` must be "straight", "bezier" or "arc" `mode` musí být "straight", "bezier" nebo "arc" +@msg `mode` must be one of {_1} `mode` musí být jedna z hodnot {_1} +@msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi` musí být "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" nebo "lineEndHalf" +@msg `name` must be a name that is not empty `name` musí být název, který není prázdný +@msg `name` must not be empty `name` nesmí být prázdné +@msg `names` is a list of preset names `names` je seznam názvů přednastavení +@msg `names` lists preset names `names` uvádí názvy přednastavení +@msg `names` must be a list of names `names` musí být seznam názvů +@msg `names` must be a list of swatch names `names` musí být seznam názvů položek vzorníku +@msg `names` must be an array of style names `names` musí být pole názvů stylů +@msg `new` is a design name, or true `new` je název návrhu, nebo true +@msg `origin` must be [x, y] in points `origin` musí být [x, y] v bodech +@msg `path` must be a folder `path` musí být složka +@msg `path` must be a path object `path` musí být objekt cesty +@msg `picks` must be an array (got {v}) `picks` musí být pole (zadáno {v}) +@msg `picks` must hold 1 to {MAX_PICKS} picks (got {_1}) `picks` musí obsahovat 1 až {MAX_PICKS} voleb (zadáno {_1}) +@msg `pivot` must be a whole number from 0 to 8 `pivot` musí být celé číslo od 0 do 8 +@msg `points` must be a list of [x, y] points `points` musí být seznam bodů [x, y] +@msg `points` must be a list of point indexes `points` musí být seznam indexů bodů +@msg `points` must be an array of point indices `points` musí být pole indexů bodů +@msg `points` must be point indexes `points` musí být indexy bodů +@msg `points` must hold from 2 to 100000 points `points` musí obsahovat 2 až 100000 bodů +@msg `port` must be "in" or "out" `port` musí být "in" nebo "out" +@msg `position` is above or below `position` je above nebo below +@msg `preset` must be a string `preset` musí být řetězec +@msg `radius` must be 0 or more `radius` musí být 0 nebo více +@msg `ratio` must be from 0.1 to 0.5 `ratio` musí být od 0.1 do 0.5 +@msg `rect` must be [x, y, width, height] `rect` musí být [x, y, width, height] +@msg `rect` must be [x, y, width, height] with a positive size `rect` musí být [x, y, width, height] s kladnou velikostí +@msg `rect` must be [x0, y0, x1, y1] (got {r}) `rect` musí být [x0, y0, x1, y1] (zadáno {r}) +@msg `relation` must be overlap, inside or outside `relation` musí být overlap, inside nebo outside +@msg `replace` must be a string `replace` musí být řetězec +@msg `reversed` must be true or false `reversed` musí být true nebo false +@msg `rotate` must be a finite number `rotate` musí být konečné číslo +@msg `rows` must be lists of numbers or nulls, not {r} `rows` musí být seznamy čísel nebo hodnot null, ne {r} +@msg `rule` must be nonZero or evenOdd `rule` musí být nonZero nebo evenOdd +@msg `scale` must be a number from 0.001 to 1000 `scale` musí být číslo od 0.001 do 1000 +@msg `scale` must be a number in (0, 100] `scale` musí být číslo v rozsahu (0, 100] +@msg `scope.{key}` must be a non-empty array `scope.{key}` musí být neprázdné pole +@msg `scope` must be "document", {artboards} or {layers} `scope` musí být "document", {artboards} nebo {layers} +@msg `scope` must be "selection" or "document", not {other} `scope` musí být "selection" nebo "document", ne {other} +@msg `script` must be a string `script` musí být řetězec +@msg `seriesIndexes` is a non-empty list of series indexes `seriesIndexes` je neprázdný seznam indexů řad +@msg `seriesIndexes` needs a `type` or a `valueAxis` `seriesIndexes` vyžaduje `type` nebo `valueAxis` +@msg `shift` must be a number of points `shift` musí být počet bodů +@msg `showCenter` must be true or false `showCenter` musí být true nebo false +@msg `side` must be "left", "right", "top" or "bottom" `side` musí být "left", "right", "top" nebo "bottom" +@msg `side` places the artboard: leave out x, y, width and height `side` umísťuje pracovní plochu: vynechte x, y, width a height +@msg `singleWordJustification` must be "fullJustify", "alignLeft", "alignCenter" or "alignRight" `singleWordJustification` musí být "fullJustify", "alignLeft", "alignCenter" nebo "alignRight" +@msg `size` is a percentage of the base text's size, 1 to 100 `size` je procento velikosti základního textu, 1 až 100 +@msg `source` and `target` are the same object `source` a `target` jsou tentýž objekt +@msg `source` is the only path in series group `target` `source` je jediná cesta ve skupině řady `target` +@msg `source` must be `folder` or `datasets` `source` musí být `folder` nebo `datasets` +@msg `spacing` makes more than {MAX_COUNT} lines across the box `spacing` vytvoří napříč rámečkem více než {MAX_COUNT} linií +@msg `spacing` must be a number `spacing` musí být číslo +@msg `spacing` must be a number of points, 0 or more, or "auto" `spacing` musí být počet bodů, 0 nebo více, nebo "auto" +@msg `spacing` must be more than 0 and at most {MAX_DISTANCE} pt `spacing` musí být více než 0 a nejvýše {MAX_DISTANCE} pt +@msg `start` must be a finite number `start` musí být konečné číslo +@msg `starts` must be an array of anchor indices (or nulls) `starts` musí být pole indexů kotevních bodů (nebo hodnot null) +@msg `status` must be linked, embedded, missing or modified, or a list of them `status` musí být linked, embedded, missing nebo modified, nebo jejich seznam +@msg `stop` must be a stop index `stop` musí být index zarážky +@msg `story` styles the whole story: give no `start` or `end` `story` nastavuje styl celého článku: nezadávejte `start` ani `end` +@msg `story` takes the whole story: give no `start` or `end` `story` zahrnuje celý článek: nezadávejte `start` ani `end` +@msg `strokeMode` applies to strokes (stroke: true) `strokeMode` platí pro tahy (stroke: true) +@msg `style` must be roman or japanese `style` musí být roman nebo japanese +@msg `subpaths` must be two integer indices `subpaths` musí být dva celočíselné indexy +@msg `symbol` must be a symbol name `symbol` musí být název symbolu +@msg `target` must be "object" or "contents", not {v} `target` musí být "object" nebo "contents", ne {v} +@msg `target` must be an object of the same Objects on Path group as `member` `target` musí být objekt ze stejné skupiny Objekty na cestě jako `member` +@msg `tint` applies to global and spot colours `tint` platí pro globální a přímé barvy +@msg `tint` goes with a global or spot `swatch` `tint` patří ke globální nebo přímé barvě v `swatch` +@msg `tint` must be a number (%) `tint` musí být číslo (%) +@msg `tint` needs a global or spot colour `tint` vyžaduje globální nebo přímou barvu +@msg `to` is already threaded `to` je už zřetězené +@msg `to` is the design's new name `to` je nový název návrhu +@msg `to` must be [x, y] `to` musí být [x, y] +@msg `to` must be a closed path, area type or type on a path other than `from` `to` musí být uzavřená cesta, text v oblasti nebo text na cestě jiný než `from` +@msg `to` must be a whole number `to` musí být celé číslo +@msg `to` takes the rows of one object's stack, not aligned rows `to` přijímá řádky zásobníku jednoho objektu, ne zarovnané řádky +@msg `tolerance` must be from 0 to 100 pt `tolerance` musí být od 0 do 100 pt +@msg `useLab` must be true or false `useLab` musí být true nebo false +@msg `vAlign` must be default, top, middle, baseline or bottom `vAlign` musí být default, top, middle, baseline nebo bottom +@msg `values` must be a list `values` musí být seznam +@msg `values` must be an object `values` musí být objekt +@msg `values` must name hex, rgb, cmyk, lab or gray `values` musí uvádět hex, rgb, cmyk, lab nebo gray +@msg `values` names a kind twice `values` uvádí některý druh dvakrát +@msg `version` must be 0 or {_1} `version` musí být 0 nebo {_1} +@msg `version` must be 0 or {newest} `version` musí být 0 nebo {newest} +@msg `warichuAlign` must be one of {_1} `warichuAlign` musí být jedna z hodnot {_1} +@msg `warichuLines` must be a whole number from {_1} to {_2} `warichuLines` musí být celé číslo od {_1} do {_2} +@msg `weight` must be from 0.01 to 1000 pt `weight` musí být od 0.01 do 1000 pt +@msg `weights` must be a list of {_1} numbers, one per row (got {v}) `weights` musí být seznam {_1} čísel, jedno na řádek (zadáno {v}) +@msg `xml` must be a string `xml` musí být řetězec +@msg `{KEY}` entry {n} gives the paragraph at byte {start} of {_1} other indents than an entry before it položka {n} v `{KEY}` dává odstavci na bajtu {start} objektu {_1} jiná odsazení než některá položka před ní +@msg `{KEY}` entry {n} must be an object položka {n} v `{KEY}` musí být objekt +@msg `{KEY}` entry {n} sets neither `leftIndent` nor `firstLineIndent` položka {n} v `{KEY}` nenastavuje `leftIndent` ani `firstLineIndent` +@msg `{KEY}` entry {n}: `id` must be an object id položka {n} v `{KEY}`: `id` musí být ID objektu +@msg `{KEY}` entry {n}: `start` must be a byte offset položka {n} v `{KEY}`: `start` musí být bajtový posun +@msg `{KEY}` entry {n}: `{k}` must be a number from -{MAX_PARA} to {MAX_PARA} pt položka {n} v `{KEY}`: `{k}` musí být číslo od -{MAX_PARA} do {MAX_PARA} pt +@msg `{KEY}` entry {n}: no paragraph of {_1} starts at byte {start} položka {n} v `{KEY}`: žádný odstavec objektu {_1} nezačíná na bajtu {start} +@msg `{KEY}` entry {n}: unknown key `{k}` položka {n} v `{KEY}`: neznámý klíč `{k}` +@msg `{KEY}` entry {n}: {_1} is not a type object položka {n} v `{KEY}`: {_1} není textový objekt +@msg `{KEY}` is empty `{KEY}` je prázdné +@msg `{KEY}` must be a list `{KEY}` musí být seznam +@msg `{KEY}` takes at most {MAX_PARAGRAPH_INDENTS} entries (got {_1}) `{KEY}` přijímá nejvýše {MAX_PARAGRAPH_INDENTS} položek (zadáno {_1}) +@msg `{KEY}` takes no `{other}` beside it `{KEY}` vedle sebe nepřijímá `{other}` +@msg `{_1}` can't be edited or removed `{_1}` nelze upravit ani odebrat +@msg `{_1}` is built in and always listed `{_1}` je vestavěné a je uvedeno vždy +@msg `{_1}` is not a font file the last text.findFontFiles search found `{_1}` není soubor písma, který našlo poslední hledání text.findFontFiles +@msg `{_1}` would be overwritten by the package: choose a different folder or name `{_1}` by balíček přepsal: zvolte jinou složku nebo název +@msg `{base}` is larger than {_1} MB `{base}` je větší než {_1} MB +@msg `{base}` is not in the DCS file's folder `{base}` není ve složce souboru DCS +@msg `{file}` has no art to place `{file}` nemá žádnou kresbu k umístění +@msg `{file}` is over {_1} MB `{file}` má více než {_1} MB +@msg `{f}` belongs to a VectorCraft that is running `{f}` patří běžící aplikaci VectorCraft +@msg `{f}` is the copy of a document open now `{f}` je kopie právě otevřeného dokumentu +@msg `{id}` is no writable format (see document.formats) `{id}` není formát, který lze zapisovat (viz document.formats) +@msg `{id}` isn't a loaded library `{id}` není načtená knihovna +@msg `{key}` has no colours `{key}` neobsahuje žádné barvy +@msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` obsahuje více než {MAX_EDIT_WORDS} slov +@msg `{key}` is a design name `{key}` je název návrhu +@msg `{key}` is a design name or a list of them `{key}` je název návrhu nebo jejich seznam +@msg `{key}` is longer than {MAX_NAME} characters `{key}` je delší než {MAX_NAME} znaků +@msg `{key}` is out of range `{key}` je mimo rozsah +@msg `{key}` must be 0 or more `{key}` musí být 0 nebo více +@msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}` musí být [min, desired, max] nebo {{min?, desired?, max?}}, v procentech +@msg `{key}` must be [x, y] numbers `{key}` musí být čísla [x, y] +@msg `{key}` must be a list of words `{key}` musí být seznam slov +@msg `{key}` must be a list, not {v} `{key}` musí být seznam, ne {v} +@msg `{key}` must be a non-negative integer `{key}` musí být nezáporné celé číslo +@msg `{key}` must be a number or null, not {v} `{key}` musí být číslo nebo null, ne {v} +@msg `{key}` must be a number {_1}..{_2} `{key}` musí být číslo {_1}..{_2} +@msg `{key}` must be a whole number of 0 or more `{key}` musí být celé číslo 0 nebo větší +@msg `{key}` must be a whole number of at least 0, not {n} `{key}` musí být celé číslo nejméně 0, ne {n} +@msg `{key}` must be an appearance item index (paint order) or null `{key}` musí být index položky vzhledu (pořadí vykreslení) nebo null +@msg `{key}` must be an array of asset ids (see assets.list) `{key}` musí být pole ID prvků (viz assets.list) +@msg `{key}` must be from 0 to 180 degrees, not {a} `{key}` musí být od 0 do 180 stupňů, ne {a} +@msg `{key}` must be from 0 to {MAX_DISTANCE} pt `{key}` musí být od 0 do {MAX_DISTANCE} pt +@msg `{key}` must be from {_1} to {shift_max} `{key}` musí být od {_1} do {shift_max} +@msg `{key}` must be from {lo} to {hi}, not {v} `{key}` musí být od {lo} do {hi}, ne {v} +@msg `{key}` must be one of auto, always, never `{key}` musí být jedna z hodnot auto, always, never +@msg `{key}` must be one of miter, round, bevel `{key}` musí být jedna z hodnot miter, round, bevel +@msg `{key}` must be one word of at most {_1} characters `{key}` musí být jedno slovo o nejvýše {_1} znacích +@msg `{key}` must hold single words of at most {_1} characters `{key}` musí obsahovat jednotlivá slova o nejvýše {_1} znacích +@msg `{key}` must name an object attached to the path of an Objects on Path group `{key}` musí uvádět objekt připojený k cestě skupiny Objekty na cestě +@msg `{key}` names an object that is hidden or locked `{key}` uvádí objekt, který je skrytý nebo zamknutý +@msg `{key}`: not a colour: {v} `{key}`: není barva: {v} +@msg `{k}.family` is required `{k}.family` je povinné +@msg `{k}` is a number 0..1 `{k}` je číslo 0..1 +@msg `{k}` is true or false `{k}` je true nebo false +@msg `{k}` isn't an export setting: {_1} `{k}` není nastavení exportu: {_1} +@msg `{k}` must be a byte offset `{k}` musí být bajtový posun +@msg `{k}` must be a number `{k}` musí být číslo +@msg `{k}` must be a number of points `{k}` musí být počet bodů +@msg `{k}` must be a string `{k}` musí být řetězec +@msg `{k}` must be a whole number `{k}` musí být celé číslo +@msg `{k}` must be from {lo} to {hi} for {key} `{k}` musí být pro {key} od {lo} do {hi} +@msg `{k}` must be {what}, not {v} `{k}` musí být {what}, ne {v} +@msg `{l}` isn't a global or spot colour `{l}` není globální ani přímá barva +@msg `{m}` isn't a bitmap: use clipboard.importSvg, importPdf or importText `{m}` není bitmapa: použijte clipboard.importSvg, importPdf nebo importText +@msg `{name}` can't be deleted `{name}` nelze odstranit +@msg `{name}` can't be duplicated `{name}` nelze duplikovat +@msg `{name}` can't be edited `{name}` nelze upravit +@msg `{name}` can't be edited this way `{name}` nelze tímto způsobem upravit +@msg `{name}` can't be renamed `{name}` nelze přejmenovat +@msg `{name}` can't name a folder `{name}` nemůže být názvem složky +@msg `{name}` has no art to place `{name}` nemá žádnou kresbu k umístění +@msg `{name}` has no text to place `{name}` nemá žádný text k umístění +@msg `{name}` in the Word document is not UTF-8 or UTF-16 text `{name}` v dokumentu Word není text v UTF-8 ani UTF-16 +@msg `{name}` in the Word document is not well-formed XML: {e} `{name}` v dokumentu Word není správně utvořené XML: {e} +@msg `{name}` in the Word document nests elements more than {MAX_NESTING} deep `{name}` v dokumentu Word vnořuje prvky hlouběji než {MAX_NESTING} úrovní +@msg `{name}` is a built-in preset and is read-only: save it under another name `{name}` je vestavěné přednastavení jen pro čtení: uložte ho pod jiným názvem +@msg `{name}` is a built-in preset: save under another name `{name}` je vestavěné přednastavení: uložte ho pod jiným názvem +@msg `{name}` is a built-in profile and stays `{name}` je vestavěný profil a zůstává +@msg `{name}` is a file of its own, which can only be found next to the DCS file's path `{name}` je samostatný soubor, který lze najít jen vedle cesty souboru DCS +@msg `{name}` is a tint of `{base}`: edit `{base}` (a tint swatch only takes a new name) `{name}` je tón barvy `{base}`: upravte `{base}` (položce vzorníku s tónem lze dát jen nový název) +@msg `{name}` is a working space: choose another with edit.colorSettings first `{name}` je pracovní barevný prostor: nejprve zvolte jiný pomocí edit.colorSettings +@msg `{name}` is built in and stays `{name}` je vestavěné a zůstává +@msg `{name}` takes a paint of its own kind (colour, gradient or pattern) `{name}` přijímá nátěr svého druhu (barvu, přechod nebo vzorek) +@msg `{name}`: {_1}: {e} `{name}`: {_1}: {e} +@msg `{n}` can't be deleted `{n}` nelze odstranit +@msg `{n}` can't be merged `{n}` nelze sloučit +@msg `{n}` can't be moved `{n}` nelze přesunout +@msg `{n}` is not a colour swatch `{n}` není barevná položka vzorníku +@msg `{n}` isn't a solid colour `{n}` není plná barva +@msg `{n}`: colour groups hold solid colours only `{n}`: skupiny barev obsahují jen plné barvy +@msg `{other}` doesn't trace an image `{other}` nevektorizuje obraz +@msg `{s}`: the step's references copy in more than {_1} MB of values `{s}`: odkazy kroku by zkopírovaly více než {_1} MB hodnot +@msg `{tag}` is not an axis tag: a tag is four characters, such as "wght" `{tag}` není značka osy: značka má čtyři znaky, například "wght" +@msg `{to}` is empty or already used `{to}` je prázdné nebo už použité +@msg `{u}` is no Unicode character `{u}` není znak Unicode +@msg `{what}` is longer than {MAX_TEXT} bytes `{what}` je delší než {MAX_TEXT} bajtů +@msg `{what}` must be text `{what}` musí být text +@msg `{word}` isn't in the custom dictionary `{word}` není ve vlastním slovníku +@msg a CMap has too many mappings CMap má příliš mnoho mapování +@msg a DXF drawing has one origin: pass useArtboards: true for one drawing per artboard výkres DXF má jeden počátek: předejte useArtboards: true pro jeden výkres na každou pracovní plochu +@msg a PDF presets file with over {_1} presets soubor přednastavení PDF s více než {_1} přednastaveními +@msg a \u escape needs four hexadecimal digits sekvence \u vyžaduje čtyři šestnáctkové číslice +@msg a batch preview cannot switch documents náhled dávky nemůže přepínat dokumenty +@msg a brush named `{nn}` exists štětec s názvem `{nn}` už existuje +@msg a comma in an XPath expression must separate function arguments čárka ve výrazu XPath musí oddělovat argumenty funkce +@msg a container of the listed objects is gone kontejner uvedených objektů už neexistuje +@msg a content stream can't be read proud obsahu nelze přečíst +@msg a content stream isn't a stream proud obsahu není proud +@msg a design holds at most {_1} objects návrh obsahuje nejvýše {_1} objektů +@msg a design needs a name návrh potřebuje název +@msg a dictionary grew too large slovník se příliš zvětšil +@msg a document holds at most {_1} SVG filters dokument obsahuje nejvýše {_1} filtrů SVG +@msg a document keeps at most {_1} graph designs dokument uchovává nejvýše {_1} návrhů grafu +@msg a document keeps at most {_1} saved selections dokument uchovává nejvýše {_1} uložených výběrů +@msg a document keeps at most {_1} views dokument uchovává nejvýše {_1} zobrazení +@msg a document links at most {MAX_SVG_SCRIPTS} JavaScript files dokument odkazuje na nejvýše {MAX_SVG_SCRIPTS} souborů JavaScript +@msg a document with unsaved changes has no recovery copy dokument s neuloženými změnami nemá záložní kopii +@msg a feConvolveMatrix filter's order is {x}×{y}, which overflows the kernel-size multiply usvg makes řád filtru feConvolveMatrix je {x}×{y}, což přeteče při násobení velikosti jádra, které provádí usvg +@msg a font's data is too large data písma jsou příliš velká +@msg a font's subroutines are too large podprogramy písma jsou příliš velké +@msg a function declaration without a name deklarace funkce bez názvu +@msg a gradient preset is already called {n} některé přednastavení přechodu se už jmenuje {n} +@msg a graph has at most {_1} series, so it transposes with at most that many categories graf má nejvýše {_1} řad, takže ho lze transponovat nejvýše s tolika kategoriemi +@msg a host value has too many entries hodnota hostitele má příliš mnoho položek +@msg a host value is nested too deep hodnota hostitele je vnořena příliš hluboko +@msg a layer can't be merged into its own sublayer vrstvu nelze sloučit do její vlastní podvrstvy +@msg a layer's form box isn't an array rámeček formuláře vrstvy není pole +@msg a layer's form can't be read formulář vrstvy nelze přečíst +@msg a layer's form has no box formulář vrstvy nemá rámeček +@msg a layer's form has no dictionary formulář vrstvy nemá slovník +@msg a legend draws at most {MAX_CHIPS} swatches legenda vykreslí nejvýše {MAX_CHIPS} barevných políček +@msg a name names one asset: give multiple: false, or one object název určuje jeden prvek: zadejte multiple: false, nebo jeden objekt +@msg a namespace declaration uses a reserved prefix or URI deklarace jmenného prostoru používá vyhrazenou předponu nebo URI +@msg a namespace qualifier is undefined kvalifikátor jmenného prostoru není definován +@msg a namespace with an empty URI cannot have a prefix jmenný prostor s prázdným URI nemůže mít předponu +@msg a number has no digits číslo nemá žádné číslice +@msg a number's exponent has no digits exponent čísla nemá žádné číslice +@msg a number's fraction has no digits zlomková část čísla nemá žádné číslice +@msg a page can't be read stránku nelze přečíst +@msg a page object is used by something else objekt stránky používá něco jiného +@msg a page thumbnail must be RGB pixels, 1 to {THUMBNAIL_SIZE} a side (got {w} × {h}) miniatura stránky musí být z obrazových bodů RGB, 1 až {THUMBNAIL_SIZE} na stranu (zadáno {w} × {h}) +@msg a pattern layer doesn't end what it starts vrstva vzorku neukončuje to, co začíná +@msg a pattern layer's colors hold something else barvy vrstvy vzorku obsahují něco jiného +@msg a pattern named `{n}` exists vzorek s názvem `{n}` už existuje +@msg a plug-in with id {_1} is already installed zásuvný modul s ID {_1} je už nainstalován +@msg a preset named `{n}` exists přednastavení s názvem `{n}` už existuje +@msg a print presets file with over {_1} presets soubor přednastavení tisku s více než {_1} přednastaveními +@msg a profile is already called {n} některý profil se už jmenuje {n} +@msg a property descriptor cannot have both a value or writable and a get or set popisovač vlastnosti nemůže mít zároveň value nebo writable a get nebo set +@msg a property descriptor must be an object popisovač vlastnosti musí být objekt +@msg a property's {name} must be a function or undefined {name} vlastnosti musí být funkce nebo undefined +@msg a row can't go into itself řádek nelze vložit do sebe samého +@msg a series goes on the left or the right value axis řada patří na levou nebo pravou osu hodnot +@msg a start must be an anchor index ≥ 0 or null začátek musí být index kotevního bodu ≥ 0 nebo null +@msg a stream in it would decode to more than 256 MB, or its decode parameters can't be applied některý proud v něm by se dekódoval na více než 256 MB, nebo nelze použít jeho parametry dekódování +@msg a string holds a control character řetězec obsahuje řídicí znak +@msg a string holds an escape sequence JSON does not have řetězec obsahuje řídicí sekvenci, kterou JSON nezná +@msg a string is not closed řetězec není uzavřen +@msg a style named `{name}` already exists styl s názvem `{name}` už existuje +@msg a style named `{to}` already exists styl s názvem `{to}` už existuje +@msg a swatch needs a colour, gradient or pattern položka vzorníku potřebuje barvu, přechod nebo vzorek +@msg a symbol named `{n}` already exists symbol s názvem `{n}` už existuje +@msg a theme has 1 to {THEME_SIZE} colours motiv má 1 až {THEME_SIZE} barev +@msg a theme is already called {name} (replace: "{name}" overwrites it) některý motiv se už jmenuje {name} (replace: "{name}" ho přepíše) +@msg a toolbar name has at most {MAX_NAME} characters název panelu nástrojů má nejvýše {MAX_NAME} znaků +@msg a view named `{_1}` exists zobrazení s názvem `{_1}` už existuje +@msg a view named `{name}` exists zobrazení s názvem `{name}` už existuje +@msg a workspace keeps at most {MAX} toolbars pracovní prostor uchovává nejvýše {MAX} panelů nástrojů +@msg a {_1} series can't go in a {_2} graph řadu typu {_1} nelze vložit do grafu typu {_2} +@msg aiVersion {v}: "pdf" (PDF-compatible, the default) or "7" (legacy .ai, version 7) aiVersion {v}: "pdf" (kompatibilní s PDF, výchozí) nebo "7" (starší .ai, verze 7) +@msg already editing an opacity mask maska krytí se už upravuje +@msg already editing another object's opacity mask už se upravuje maska krytí jiného objektu +@msg already in pattern editing mode režim úprav vzorku je už aktivní +@msg an SVG filter is named by its id: give `xml` with `name` filtr SVG je pojmenován svým ID: zadejte `xml` spolu s `name` +@msg an XML element has two attributes with the same name prvek XML má dva atributy se stejným názvem +@msg an XML value cannot be inserted into itself or its descendants hodnotu XML nelze vložit do sebe samé ani do jejích potomků +@msg an XML value's children cannot be assigned by position potomky hodnoty XML nelze přiřazovat podle pozice +@msg an XML value's children cannot be deleted by position potomky hodnoty XML nelze odstraňovat podle pozice +@msg an XMLList converts to XML only when it has one item XMLList se převede na XML, jen když má jednu položku +@msg an XPath node test is missing chybí test uzlu XPath +@msg an XPath operand is missing chybí operand XPath +@msg an XPath operator is missing chybí operátor XPath +@msg an XPath predicate or step cannot follow here predikát ani krok XPath zde nemůže následovat +@msg an XPath predicate or step follows a value that is not a node-set predikát nebo krok XPath následuje za hodnotou, která není množina uzlů +@msg an XPath step is missing chybí krok XPath +@msg an artboard is listed twice některá pracovní plocha je uvedena dvakrát +@msg an empty artboard has no width or height to scale to prázdná pracovní plocha nemá šířku ani výšku, na kterou by šlo měnit velikost +@msg an image couldn't be decoded and is missing from the picture obraz nešlo dekódovat a v obrázku chybí +@msg an image is too large for DXF and was left out obraz je pro DXF příliš velký a byl vynechán +@msg an image of {_1} MB, at most {_2} MB obraz o velikosti {_1} MB, nejvýše {_2} MB +@msg an image of {declared_w} × {declared_h} pixels is too large to draw obraz o rozměrech {declared_w} × {declared_h} obrazových bodů je příliš velký na vykreslení +@msg an image of {width} × {height} pixels is too large to draw obraz o rozměrech {width} × {height} obrazových bodů je příliš velký na vykreslení +@msg an image of {w} × {h} pixels is too large to convert (at most {_1} pixels) obraz o rozměrech {w} × {h} obrazových bodů je příliš velký na převod (nejvýše {_1} obrazových bodů) +@msg an index must be a whole number index musí být celé číslo +@msg an inline graphic has no glyphs vložená grafika v textu nemá žádné glyfy +@msg an invisible text form can't be read formulář neviditelného textu nelze přečíst +@msg an object is missing chybí objekt +@msg an object's header is missing chybí záhlaví objektu +@msg an overprinting form can't be read formulář s přetiskem nelze přečíst +@msg an unread object has no readable bounds nepřečtený objekt nemá čitelné hranice +@msg an unread object holds a frame of threaded type nepřečtený objekt obsahuje rámec zřetězeného textu +@msg an unread object is missing from its layer nepřečtený objekt chybí ve své vrstvě +@msg anchor `smooth` must be true or false `smooth` kotevního bodu musí být true nebo false +@msg anchor `{key}` must be [x, y] `{key}` kotevního bodu musí být [x, y] +@msg anchor `{key}` must be a number `{key}` kotevního bodu musí být číslo +@msg angle and roundness must be finite úhel a zaoblení musí být konečné +@msg angles must be a list as long as pins (degrees or null) angles musí být seznam stejně dlouhý jako pins (stupně nebo null) +@msg appearance must be flat|center|edge appearance musí být flat|center|edge +@msg apply is "fill" or "stroke", not `{other}` apply je "fill" nebo "stroke", ne `{other}` +@msg apply was called on a value that is not a function apply byla zavolána na hodnotě, která není funkce +@msg area must be a closed polygon of 3 to 100000 [x, y] points area musí být uzavřený mnohoúhelník o 3 až 100000 bodech [x, y] +@msg area type in a thread cannot use Dynamic Text: {frames} text v oblasti ve zřetězeném textu nemůže používat dynamický text: {frames} +@msg area type needs a path that encloses an area text v oblasti vyžaduje cestu, která uzavírá plochu +@msg area type {_1} is named twice text v oblasti {_1} je uveden dvakrát +@msg array literal too long literál pole je příliš dlouhý +@msg arrowAlign must be extend|tip, got {o} arrowAlign musí být extend|tip, zadáno {o} +@msg arrowScale must be [start, end] arrowScale musí být [start, end] +@msg artboard is a 0-based index artboard je index počítaný od 0 +@msg artboard must be a 0-based index artboard musí být index počítaný od 0 +@msg artboard {i} doesn't print pracovní plocha {i} se netiskne +@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout musí být {layout?, columns?, spacing?, rightToLeft?} +@msg artboardLayout.columns must be 1 or more artboardLayout.columns musí být 1 nebo více +@msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout musí být gridByRow, gridByColumn, row nebo column +@msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft musí být true nebo false +@msg artboardLayout.spacing must be 0–{MAX_SPACING} pt artboardLayout.spacing musí být 0–{MAX_SPACING} pt +@msg artboards must be a non-empty list artboards musí být neprázdný seznam +@msg artboards must be a number artboards musí být číslo +@msg asset `{_1}` has no art to export prvek `{_1}` nemá žádnou kresbu k exportu +@msg assignment to a constant binding přiřazení do konstantní vazby +@msg at least one row that isn't excluded needs a weight above 0 alespoň jeden nevyloučený řádek potřebuje váhu větší než 0 +@msg at most {MAX_KEYWORDS} keywords nejvýše {MAX_KEYWORDS} klíčových slov +@msg at most {MAX_MATCHES} matches are kept uchovává se nejvýše {MAX_MATCHES} shod +@msg at most {MAX_POINTS} points nejvýše {MAX_POINTS} bodů +@msg at most {MAX_QUEUE} files nejvýše {MAX_QUEUE} souborů +@msg at must be [x, y] at musí být [x, y] +@msg at/rect lie outside the canvas at/rect leží mimo plátno +@msg attribute must be size|leading|tracking|kerning|baselineShift attribute musí být size|leading|tracking|kerning|baselineShift +@msg attrs must be an object attrs musí být objekt +@msg automation path rejected: the folder's name isn't valid text cesta automatizace byla odmítnuta: název složky není platný text +@msg automation path rejected: {_1} isn't valid text cesta automatizace byla odmítnuta: {_1} není platný text +@msg automation path rejected: {why}: {path} cesta automatizace byla odmítnuta: {why}: {path} +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{given}` axis musí být "vertical", "horizontal" nebo úhel ve stupních, ne `{given}` +@msg backgroundContents must be transparent or white backgroundContents musí být transparent nebo white +@msg bad AES key chybný klíč AES +@msg bad `runs`: {e} chybné `runs`: {e} +@msg bad arrowScale chybné arrowScale +@msg bad base64 chybný base64 +@msg bad color {c} chybná barva {c} +@msg bad colour chybná barva +@msg bad colour in `colors` chybná barva v `colors` +@msg bad colour {v} chybná barva {v} +@msg bad colour {v} in groupColors chybná barva {v} v groupColors +@msg bad cross-reference entry chybná položka křížových odkazů +@msg bad cross-reference table chybná tabulka křížových odkazů +@msg bad current colour {v} chybná aktuální barva {v} +@msg bad dataBase64 chybné dataBase64 +@msg bad edit chybná úprava +@msg bad fill {v} chybná výplň {v} +@msg bad fit: {e} chybné přizpůsobení: {e} +@msg bad model {other} (keep, new or document) chybný model {other} (keep, new nebo document) +@msg bad new colour {v} chybná nová barva {v} +@msg bad object chybný objekt +@msg bad object number chybné číslo objektu +@msg bad offset chybný posun +@msg bad path data: {e} chybná data cesty: {e} +@msg bad point {v}: expected [x, y] chybný bod {v}: očekáváno [x, y] +@msg bad point {v}: expected [x, y] or [x, y, pressure] chybný bod {v}: očekáváno [x, y] nebo [x, y, pressure] +@msg bad reference chybný odkaz +@msg bad trailer size chybná velikost v zakončení +@msg bad {k} colour chybná barva {k} +@msg batches cannot nest dávky nelze vnořovat +@msg bind something to a variable first nejprve něco svažte s proměnnou +@msg bleed must be 0–{MAX_BLEED} pt: a number, [top, bottom, left, right] or {{top, bottom, left, right}} bleed musí být 0–{MAX_BLEED} pt: číslo, [top, bottom, left, right] nebo {{top, bottom, left, right}} +@msg blend must be a mode name blend musí být název režimu +@msg both sides of an XPath | must select nodes obě strany operátoru | v XPath musí vybírat uzly +@msg brush must be a name or null brush musí být název nebo null +@msg by must be a number by musí být číslo +@msg can't add page thumbnails: {why} miniatury stránek nelze přidat: {why} +@msg can't add the editing data for other apps: {why} data pro úpravy v jiných aplikacích nelze přidat: {why} +@msg can't edit the written PDF: {why} zapsané PDF nelze upravit: {why} +@msg can't encrypt the PDF: {why} PDF nelze zašifrovat: {why} +@msg can't linearise the PDF: {why} PDF nelze linearizovat: {why} +@msg can't open `{_1}`: {_2} `{_1}` nelze otevřít: {_2} +@msg can't open `{_1}`: {e} `{_1}` nelze otevřít: {e} +@msg can't open `{name}`: not a format VectorCraft reads (see document.formats) `{name}` nelze otevřít: nejde o formát, který VectorCraft čte (viz document.formats) +@msg can't place `{name}`: not a format VectorCraft reads (see document.formats) `{name}` nelze umístit: nejde o formát, který VectorCraft čte (viz document.formats) +@msg can't read back the written PDF: {e} zapsané PDF nelze znovu načíst: {e} +@msg can't read this Word document: {why} tento dokument Word nelze přečíst: {why} +@msg can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp obrázky .{e} nelze zapisovat: použijte .png, .jpg, .gif, .webp, .tif nebo .bmp +@msg can't write PDF layers, overprint or invisible text: {why} vrstvy PDF, přetisk ani neviditelný text nelze zapsat: {why} +@msg can't write the file's copyright: {why} údaj o autorských právech souboru nelze zapsat: {why} +@msg can't write the file's modification date: {why} datum změny souboru nelze zapsat: {why} +@msg can't write the pages' user units: {why} uživatelské jednotky stránek nelze zapsat: {why} +@msg canceled zrušeno +@msg cannot convert the object to a primitive value objekt nelze převést na primitivní hodnotu +@msg cannot convert undefined or null to an object undefined ani null nelze převést na objekt +@msg cannot distort a zero-size or non-finite bounding box ohraničovací rámeček s nulovou nebo nekonečnou velikostí nelze deformovat +@msg cannot move an object into itself objekt nelze přesunout do sebe samého +@msg case must be upper|lower|title|sentence case musí být upper|lower|title|sentence +@msg category `{c}`: one of {_1} kategorie `{c}`: jedna z hodnot {_1} +@msg center must be [x, y] center musí být [x, y] +@msg character dimensions cannot be represented with the source text transform rozměry znaků nelze vyjádřit transformací zdrojového textu +@msg character dimensions cannot be represented with the target text transform rozměry znaků nelze vyjádřit transformací cílového textu +@msg choose at least one artboard zvolte alespoň jednu pracovní plochu +@msg choose at least one status zvolte alespoň jeden stav +@msg clip must be true or false clip musí být true nebo false +@msg clippingMask must be true or false clippingMask musí být true nebo false +@msg closed must be a boolean closed musí být logická hodnota +@msg collapsed must be true or false collapsed musí být true nebo false +@msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile: žádný profil RGB ani CMYK se nejmenuje „{profile}“ +@msg colorMode must be rgb or cmyk, not `{m}` colorMode musí být rgb nebo cmyk, ne `{m}` +@msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel musí být {own} (režim dokumentu), grayscale nebo bitmap +@msg colour groups can't go into colour groups skupiny barev nelze vkládat do skupin barev +@msg colour, mode and spot apply to solid-colour swatches only colour, mode a spot platí jen pro položky vzorníku s plnou barvou +@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read sloupec {column}: `{cell}` je sloupec `%` pro soubory dat grafu, které se nečtou +@msg column {column}: `{cell}` names `{name}`, which is a {_1} variable sloupec {column}: `{cell}` uvádí `{name}`, což je proměnná typu {_1} +@msg column {column}: `{cell}` names no variable sloupec {column}: `{cell}` neuvádí žádnou proměnnou +@msg column {column}: the variable name is longer than {MAX_NAME} characters sloupec {column}: název proměnné je delší než {MAX_NAME} znaků +@msg column: true floats the whole column and takes no onto, above or below column: true uvolní celý sloupec jako plovoucí a nepřijímá onto, above ani below +@msg command must be a shape.* command command musí být příkaz shape.* +@msg commands[{i}]: missing `command` commands[{i}]: chybí `command` +@msg composer must be "singleLine" or "everyLine" composer musí být "singleLine" nebo "everyLine" +@msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes složené tvary přijímají cesty, složené cesty, skupiny, složené tvary, text, prolnutí a obálky +@msg compound {_1} must contain exactly one open path to join složený objekt {_1} musí ke spojení obsahovat právě jednu otevřenou cestu +@msg connect needs a path other than the one extended connect vyžaduje jinou cestu než tu prodlužovanou +@msg connect needs id connect vyžaduje id +@msg connect path has no open end cesta v connect nemá žádný otevřený konec +@msg continuation must be an array of path chunks continuation musí být pole úseků cesty +@msg continuation requires points continuation vyžaduje points +@msg copy needs path: the file to copy into the document's folder copy vyžaduje path: soubor, který se má zkopírovat do složky dokumentu +@msg copy takes images only: relink placed documents where their files are copy přijímá jen obrázky: umístěné dokumenty znovu propojte tam, kde jsou jejich soubory +@msg copying a file isn't available on the web kopírování souboru není na webu dostupné +@msg copyrightStatus must be unknown, copyrighted or publicDomain copyrightStatus musí být unknown, copyrighted nebo publicDomain +@msg copyrightUrl must be a URL (no spaces, at most 2048 characters) copyrightUrl musí být adresa URL (bez mezer, nejvýše 2048 znaků) +@msg corners must be 4 [x, y] points (TL, TR, BR, BL) corners musí být 4 body [x, y] (TL, TR, BR, BL) +@msg counterPer `{c}`: item or file counterPer `{c}`: item nebo file +@msg crop `{_1}`: only PDF pages have art, trim, bleed and media boxes; use "crop" or "bounding" crop `{_1}`: rámečky art, trim, bleed a media mají jen stránky PDF; použijte "crop" nebo "bounding" +@msg crop rectangle doesn't overlap the image ořezový obdélník se nepřekrývá s obrazem +@msg cross-reference and object streams aren't supported proudy křížových odkazů a proudy objektů nejsou podporovány +@msg damaged compressed data: {e} poškozená komprimovaná data: {e} +@msg dash lengths must be numbers, got {v} délky čárek musí být čísla, zadáno {v} +@msg dash must be a list of lengths or null, got {v} dash musí být seznam délek nebo null, zadáno {v} +@msg data key `{k}`: letters, digits, -, _ and . (not name or vc-…) klíč dat `{k}`: písmena, číslice, -, _ a . (ne name ani vc-…) +@msg data must be an object of key: value, not {v} data musí být objekt ve tvaru klíč: hodnota, ne {v} +@msg data set `{name}` holds a value for `{var}`, which the library doesn't declare sada dat `{name}` obsahuje hodnotu pro `{var}`, kterou knihovna nedeklaruje +@msg data set `{name}` holds two values for `{var}` sada dat `{name}` obsahuje dvě hodnoty pro `{var}` +@msg data set `{name}` is declared twice sada dat `{name}` je deklarována dvakrát +@msg data takes at most {MAX_DATA} keys at once data přijímá najednou nejvýše {MAX_DATA} klíčů +@msg dataset `{name}` already exists sada dat `{name}` už existuje +@msg dataset `{to}` already exists sada dat `{to}` už existuje +@msg date `{d}`: YYYY-MM-DD datum `{d}`: YYYY-MM-DD +@msg decoded data is too large dekódovaná data jsou příliš velká +@msg define a variable first nejprve definujte proměnnou +@msg detect must be true or false detect musí být true nebo false +@msg direct-select anchor points of a path vyberte kotevní body cesty přímým výběrem +@msg distance must be > 0 distance musí být > 0 +@msg dx and dy give the arrow's direction dx a dy udávají směr šipky +@msg dx and dy must be numbers dx a dy musí být čísla +@msg dxf fitTo must be [width, height], positive dxf fitTo musí být [width, height], kladné +@msg dxf must be an object of DXF import options dxf musí být objekt s volbami importu DXF +@msg dxf scale must be a positive number up to {_1}, not {s} dxf scale musí být kladné číslo nejvýše {_1}, ne {s} +@msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf unit `{u}`: jednotka jako mm, cm, in nebo pt +@msg dxf: {e} dxf: {e} +@msg each format is an object {format, scale?, suffix?} každý formát je objekt {format, scale?, suffix?} +@msg each item needs an id každá položka potřebuje id +@msg each match needs `kind` každá shoda potřebuje `kind` +@msg each match needs a `name` každá shoda potřebuje `name` +@msg each of `fonts` is {family, style?}; 1 to 1000 of them každá položka `fonts` je {family, style?}; 1 až 1000 položek +@msg each of `items` is {kind, item} každá položka `items` je {kind, item} +@msg each of `items` is {{id, corners?}} with an object id, not {it} každá položka `items` je {{id, corners?}} s ID objektu, ne {it} +@msg each path chunk must contain 1 to 4096 points každý úsek cesty musí obsahovat 1 až 4096 bodů +@msg each pick is {{at: [x, y]}} or {{rect: [x0, y0, x1, y1]}} (got {v}) každá volba je {{at: [x, y]}} nebo {{rect: [x0, y0, x1, y1]}} (zadáno {v}) +@msg each row needs `from` každý řádek potřebuje `from` +@msg each stop needs a position každá zarážka potřebuje pozici +@msg each subpath needs an anchors array každá dílčí cesta potřebuje pole anchors +@msg each weight must be a number of 0 or more (got {v}) každá váha musí být číslo 0 nebo větší (zadáno {v}) +@msg easingType must be easeIn, easeOut, easeInOut or easeOutIn easingType musí být easeIn, easeOut, easeInOut nebo easeOutIn +@msg editingData must be true or false editingData musí být true nebo false +@msg editingData must be true, false or "always" editingData musí být true, false nebo "always" +@msg edits overlap úpravy se překrývají +@msg effects of objects whose appearances differ can't be moved together efekty objektů s odlišným vzhledem nelze přesouvat společně +@msg empty header in column {_1} prázdné záhlaví ve sloupci {_1} +@msg encoding `{_1}`: utf8 or utf16 kódování `{_1}`: utf8 nebo utf16 +@msg ends must be two of "first" and "last" ends musí být dvě z hodnot "first" a "last" +@msg every numbered name for the result is taken každý číslovaný název pro výsledek je už obsazen +@msg expanded SVG styles exceed the import size limit rozvinuté styly SVG překračují limit velikosti importu +@msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes soubor přednastavení exportu je větší než {MAX_PRESET_FILE_BYTES} bajtů +@msg exportText must be editable or appearance exportText musí být editable nebo appearance +@msg exportType must be movieClip or graphic, not `{s}` exportType musí být movieClip nebo graphic, ne `{s}` +@msg extend needs id extend vyžaduje id +@msg featureChanges lists at most {MAX_FEATURE_CHANGES} tags featureChanges uvádí nejvýše {MAX_FEATURE_CHANGES} značek +@msg featureChanges must be a list of tags featureChanges musí být seznam značek +@msg features must be a list of tags features musí být seznam značek +@msg fidelity must be 0..100 fidelity musí být 0..100 +@msg files must be {name, dataBase64} files musí být {name, dataBase64} +@msg finally table {t} out of range tabulka finally {t} je mimo rozsah +@msg fit must be none|autoHeight|shrinkText|block, got {id} fit musí být none|autoHeight|shrinkText|block, zadáno {id} +@msg flags cannot be given with a RegExp object příznaky nelze zadat spolu s objektem RegExp +@msg flattener: {e} sloučení průhlednosti: {e} +@msg flattenerPreset `{name}`: high, medium, low or a saved one (see flattener.presets.list) flattenerPreset `{name}`: high, medium, low nebo uložené přednastavení (viz flattener.presets.list) +@msg flipProfile must be along|across, got {o} flipProfile musí být along|across, zadáno {o} +@msg folders `{f}`: none, rows, format, item or itemFormat folders `{f}`: none, rows, format, item nebo itemFormat +@msg folders deeper than {MAX_BATCH_DEPTH} levels složky hlubší než {MAX_BATCH_DEPTH} úrovní +@msg folders deeper than {MAX_DEPTH} levels složky hlubší než {MAX_DEPTH} úrovní +@msg font family `{family}` is not available rodina písma `{family}` není dostupná +@msg font family `{tf}` is not available rodina písma `{tf}` není dostupná +@msg format `{f}`: pdf or postscript formát `{f}`: pdf nebo postscript +@msg format `{f}`: text or json formát `{f}`: text nebo json +@msg format is `{format}` formát je `{format}` +@msg formats must be an array of rows, not {v} formats musí být pole řádků, ne {v} +@msg frequency must be between 1 and 300 lines per inch frequency musí být mezi 1 a 300 linkami na palec +@msg from and to must be finite from a to musí být konečné +@msg from must be [x0, y0, x1, y1] from musí být [x0, y0, x1, y1] +@msg function declaration index out of range index deklarace funkce je mimo rozsah +@msg give `before` or `after`, not both zadejte `before` nebo `after`, ne obojí +@msg give `char`, `text`, `code` or `unicode` zadejte `char`, `text`, `code` nebo `unicode` +@msg give `colors`, or `color` and `rule` zadejte `colors`, nebo `color` a `rule` +@msg give `count` or `spacing`, not both zadejte `count` nebo `spacing`, ne obojí +@msg give `event`, such as onclick zadejte `event`, například onclick +@msg give `file`, the JavaScript file's path or URL zadejte `file`, cestu nebo adresu URL souboru JavaScript +@msg give `fill` and/or `stroke` zadejte `fill` a/nebo `stroke` +@msg give `fill`, `stroke` or both zadejte `fill`, `stroke` nebo obojí +@msg give `folder` zadejte `folder` +@msg give `fonts`, or open a document zadejte `fonts`, nebo otevřete dokument +@msg give `from` or `indices`, not both zadejte `from` nebo `indices`, ne obojí +@msg give `id` (no text is being edited) zadejte `id` (žádný text se právě neupravuje) +@msg give `id` and `anchors`, or `items`, not both zadejte `id` a `anchors`, nebo `items`, ne obojí +@msg give `id` or `guide`, not both zadejte `id` nebo `guide`, ne obojí +@msg give `length` or `to` zadejte `length` nebo `to` +@msg give `matches`: [{kind, name, target}] zadejte `matches`: [{kind, name, target}] +@msg give `name` (or edit a pattern) zadejte `name` (nebo upravujte vzorek) +@msg give `name` or `names` zadejte `name` nebo `names` +@msg give `name`, an SVG filter's name zadejte `name`, název filtru SVG +@msg give `path` (a .wasm file) or `dataBase64` (the module) zadejte `path` (soubor .wasm) nebo `dataBase64` (modul) +@msg give `path`, `data` or `dataBase64` zadejte `path`, `data` nebo `dataBase64` +@msg give `path`, `data`, `dataBase64` or `csv` zadejte `path`, `data`, `dataBase64` nebo `csv` +@msg give `path`, `xml` or `dataBase64` zadejte `path`, `xml` nebo `dataBase64` +@msg give `path`, an SVG file, or `svg`, SVG text zadejte `path`, soubor SVG, nebo `svg`, text SVG +@msg give `script`, the JavaScript the event runs ("" removes the event) zadejte `script`, JavaScript, který událost spustí ("" událost odebere) +@msg give `text` (the reading) or `remove` zadejte `text` (čtení) nebo `remove` +@msg give `x` and `y` (and a `tolerance` of 0 or more) zadejte `x` a `y` (a `tolerance` 0 nebo více) +@msg give `xml`, one SVG element zadejte `xml`, jeden prvek SVG +@msg give a mode or r/g/b, c/m/y/k, gray or tint adjustments zadejte režim nebo úpravy r/g/b, c/m/y/k, gray či tint +@msg give a name, or paint the active proxy with a saved preset zadejte název, nebo aktivní výplň či tah nastavte uloženým přednastavením +@msg give a name, or select a stroke with a saved profile zadejte název, nebo vyberte tah s uloženým profilem +@msg give a pattern name or select an object painted with a pattern zadejte název vzorku nebo vyberte objekt vybarvený vzorkem +@msg give at least one of clip, invert, disabled, linked zadejte alespoň jedno z clip, invert, disabled, linked +@msg give color, none, swatch or gradient zadejte color, none, swatch nebo gradient +@msg give dataBase64 zadejte dataBase64 +@msg give either at (a click) or area (a path drawn around the overlaps) zadejte buď at (kliknutí), nebo area (cestu nakreslenou kolem překryvů) +@msg give exactly one of `at`, `rect` and `points` zadejte právě jedno z `at`, `rect` a `points` +@msg give exactly one of `path`, `data` and `dataBase64` zadejte právě jedno z `path`, `data` a `dataBase64` +@msg give formats or a preset, not both zadejte formats nebo přednastavení, ne obojí +@msg give index or indexes, not both zadejte index nebo indexes, ne obojí +@msg give newName or delete zadejte newName nebo delete +@msg give offset or by zadejte offset nebo by +@msg give one element zadejte jeden prvek +@msg give one of `to`, `rect` or `at` zadejte jedno z `to`, `rect` nebo `at` +@msg give one of assets, layers, selection or fullDocument zadejte jedno z assets, layers, selection nebo fullDocument +@msg give only one of onto, above, below, icon and a column place zadejte jen jedno z onto, above, below, icon a umístění ve sloupci +@msg give opacity or blend zadejte opacity nebo blend +@msg give origin: [x, y], or reset: true zadejte origin: [x, y], nebo reset: true +@msg give overprintFill, overprintStroke, showCenter, imageMap, url or note zadejte overprintFill, overprintStroke, showCenter, imageMap, url nebo note +@msg give path (a file) or folder zadejte path (soubor) nebo folder +@msg give path, or name and dataBase64 zadejte path, nebo name a dataBase64 +@msg give paths or files zadejte paths nebo files +@msg give rows, rowHeight, columns or columnWidth zadejte rows, rowHeight, columns nebo columnWidth +@msg give svg, or dataBase64 of an SVG or SVGZ file zadejte svg, nebo dataBase64 souboru SVG či SVGZ +@msg give text zadejte text +@msg give the asset a name pojmenujte prvek +@msg give the preset a `name` zadejte pro přednastavení `name` +@msg give the preset a name pojmenujte přednastavení +@msg give the preset a name (1–64 characters) pojmenujte přednastavení (1–64 znaků) +@msg give the settings to change, e.g. {"formats"}]} zadejte nastavení, která se mají změnit, např. {"formats"}]} +@msg give the style a name pojmenujte styl +@msg give two or more style `names` zadejte v `names` dva nebo více stylů +@msg give two or more swatches zadejte dvě nebo více položek vzorníku +@msg give x, y, or a handle's length or angle zadejte x, y, nebo délku či úhel úchytu +@msg give {key, value} or {values} zadejte {key, value} nebo {values} +@msg global must be true or false global musí být true nebo false +@msg glyph {_1} is not drawn for {ch} with the character's style (such as All Caps, Small Caps or a numeral system) glyf {_1} se pro {ch} se stylem znaku nevykresluje (například Verzálky, Kapitálky nebo číselná soustava) +@msg glyph {g} is not an alternate of {ch} in {_1} {_2} glyf {g} není alternativou znaku {ch} v písmu {_1} {_2} +@msg gradient must be "objects" or "mesh" gradient musí být "objects" nebo "mesh" +@msg grays must be "profile" or "black", not `{g}` grays musí být "profile" nebo "black", ne `{g}` +@msg gridColors must be a preset name or two colours gridColors musí být název přednastavení nebo dvě barvy +@msg gridSize must be small, medium or large gridSize musí být small, medium nebo large +@msg guide {g} is not selected vodítko {g} není vybráno +@msg handle must be 0..3 handle musí být 0..3 +@msg handler at {_1} expects {_2} values but its range starts with {d} obslužná rutina na pozici {_1} očekává {_2} hodnot, ale její rozsah začíná s {d} +@msg handler depth too large hloubka obslužné rutiny je příliš velká +@msg handler range {_1}..{_2} out of range rozsah obslužné rutiny {_1}..{_2} je mimo rozsah +@msg hiddenLayers must be true or false hiddenLayers musí být true nebo false +@msg hiddenObjects {v}: "layer" (the default), "omit" or "visible" hiddenObjects {v}: "layer" (výchozí), "omit" nebo "visible" +@msg highlight a layer to merge into zvýrazněte vrstvu, do které se má sloučit +@msg highlight two or more rows in one layer or group zvýrazněte dva nebo více řádků v jedné vrstvě nebo skupině +@msg highlight two or more rows to merge zvýrazněte dva nebo více řádků ke sloučení +@msg hvcC hvcC +@msg icon docks a panel in the icon column: use window.panel.dock icon ukotví panel ve sloupci ikon: použijte window.panel.dock +@msg id must be a dimension id id musí být ID kóty +@msg image has no bounds obraz nemá hranice +@msg image {_1} is linked already obraz {_1} je už propojený +@msg imageMap `{m}`: none, client or server imageMap `{m}`: none, client nebo server +@msg images in a spot ink whose samples couldn't be read were imported in RGB obrazy v přímé barvě, jejichž vzorky nešlo přečíst, byly importovány v RGB +@msg images past the most pixels one file may hold were left out obrazy nad největší počet obrazových bodů, který smí jeden soubor obsahovat, byly vynechány +@msg images too large to read were left out obrazy příliš velké na přečtení byly vynechány +@msg index out of range index je mimo rozsah +@msg indexes may hold at most {MAX_GUIDE_INDEXES} entries indexes smí obsahovat nejvýše {MAX_GUIDE_INDEXES} položek +@msg indexes must be an array of guide indexes indexes musí být pole indexů vodítek +@msg instances must be 1..1000 instances musí být 1..1000 +@msg instruction out of range instrukce je mimo rozsah +@msg instruction {pc} ({op}) pops below the stack instrukce {pc} ({op}) odebírá pod dno zásobníku +@msg instruction {pc} reached with stack depths {seen} and {d} instrukce {pc} byla dosažena s hloubkami zásobníku {seen} a {d} +@msg invalid `color` neplatné `color` +@msg invalid anchor index {v}: expected a non-negative integer neplatný index kotevního bodu {v}: očekáváno nezáporné celé číslo +@msg invalid anchor reference {v}: expected [subpath, anchor] neplatný odkaz na kotevní bod {v}: očekáváno [subpath, anchor] +@msg invalid angle neplatný úhel +@msg invalid array length neplatná délka pole +@msg invalid brush: {e} neplatný štětec: {e} +@msg invalid color neplatná barva +@msg invalid colour {c} neplatná barva {c} +@msg invalid delta neplatný rozdíl +@msg invalid group neplatná skupina +@msg invalid object id {v}: expected a non-negative integer neplatné ID objektu {v}: očekáváno nezáporné celé číslo +@msg invalid point neplatný bod +@msg invalid regular expression flag '{_1}' neplatný příznak regulárního výrazu '{_1}' +@msg invalid regular expression: {m} neplatný regulární výraz: {m} +@msg invalid size neplatná velikost +@msg invalid t neplatné t +@msg invalid time value neplatná hodnota času +@msg invalid tolerance neplatná tolerance +@msg is a confirm's answer, whose `value` must be true or false je odpověď na potvrzení, jejíž `value` musí být true nebo false +@msg is a prompt's answer, whose `value` must be a string or null je odpověď na výzvu, jejíž `value` musí být řetězec nebo null +@msg is an alert's answer, whose `value` must be "ok" je odpověď na upozornění, jejíž `value` musí být "ok" +@msg is longer than 16 KiB je delší než 16 KiB +@msg it draws its image through a clipping path vykresluje svůj obraz přes ořezovou cestu +@msg it draws no image nevykresluje žádný obraz +@msg it is larger than {MAX_DICTIONARY_FILE_BYTES} bytes je větší než {MAX_DICTIONARY_FILE_BYTES} bajtů +@msg it isn't a file není to soubor +@msg it names {_1} plates, and at most {MAX_PLATES} are read uvádí {_1} výtažků a čte se jich nejvýše {MAX_PLATES} +@msg its art is too long or too detailed for a head jeho kresba je na hrot příliš dlouhá nebo příliš podrobná +@msg its art paints nothing jeho kresba nic nevykresluje +@msg its artboards all lie beyond the canvas (more than {_1} pt from the origin) všechny jeho pracovní plochy leží mimo plátno (více než {_1} pt od počátku) +@msg its clipping masks are nested too deeply jeho ořezové masky jsou vnořeny příliš hluboko +@msg its image is too large to read jeho obraz je příliš velký na přečtení +@msg its metadata has no description jeho metadata nemají popis +@msg its metadata has no direct length jeho metadata nemají přímou délku +@msg its plates are too large: more than {MAX_SAMPLES} pixels together jeho výtažky jsou příliš velké: dohromady více než {MAX_SAMPLES} obrazových bodů +@msg its plates are too large: {_1} plates of {w} × {h} pixels jeho výtažky jsou příliš velké: {_1} výtažků o {w} × {h} obrazových bodech +@msg its plates can't be kept together jeho výtažky nelze udržet pohromadě +@msg its shapes could not be combined into one jeho tvary nešlo spojit do jednoho +@msg join two different paths spojte dvě různé cesty +@msg jump to {pc}, past the end skok na {pc}, za konec +@msg justify must be auto|left|center|right|justifyAll justify musí být auto|left|center|right|justifyAll +@msg kbps must be a positive number, not {kbps} kbps musí být kladné číslo, ne {kbps} +@msg keywords must be a list of words or a comma-separated string keywords musí být seznam slov nebo řetězec oddělený čárkami +@msg keywords must be at most {MAX_KEYWORD} characters, without control characters keywords smí mít nejvýše {MAX_KEYWORD} znaků, bez řídicích znaků +@msg kind must be 1, 2 or 3, or give a preset `name` (see perspective.presets.list) kind musí být 1, 2 nebo 3, nebo zadejte `name` přednastavení (viz perspective.presets.list) +@msg kind must be graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle or paraStyle kind musí být graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle nebo paraStyle +@msg knockout must be "on", "off", "neutral" or a bool, not {v} knockout musí být "on", "off", "neutral" nebo logická hodnota, ne {v} +@msg layer `{name}` has no art to export vrstva `{name}` nemá žádnou kresbu k exportu +@msg layer must name a layer or sublayer layer musí uvádět vrstvu nebo podvrstvu +@msg layers can't be intertwined: select the objects in them vrstvy nelze proplést: vyberte objekty v nich +@msg layers go only at the top level or in layers, objects in layers and groups vrstvy mohou být jen na nejvyšší úrovni nebo ve vrstvách, objekty ve vrstvách a skupinách +@msg layers must be true or false layers musí být true nebo false +@msg layout must be gridByRow, gridByColumn, row or column layout musí být gridByRow, gridByColumn, row nebo column +@msg leading must be a number or "auto" leading musí být číslo nebo "auto" +@msg left/right must be non-negative widths left/right musí být nezáporné šířky +@msg legacyNameEncoding must be one of {_1} legacyNameEncoding musí být jedna z hodnot {_1} +@msg level `{t}`: 2 or 3 úroveň `{t}`: 2 nebo 3 +@msg line {line}: more than {MAX_CSV_COLS} columns řádek {line}: více než {MAX_CSV_COLS} sloupců +@msg line {line}: unclosed quote řádek {line}: neuzavřená uvozovka +@msg line {line}: value for `{var}` must match its variable kind řádek {line}: hodnota pro `{var}` musí odpovídat druhu její proměnné +@msg lineEndings `{other}`: lf or crlf lineEndings `{other}`: lf nebo crlf +@msg loading profiles from disk isn't available in the browser načítání profilů z disku není v prohlížeči dostupné +@msg localize: the first argument must be a localization object or a string localize: první argument musí být lokalizační objekt nebo řetězec +@msg margin: a {m} pt margin leaves no imageable area on the paper okraj: okraj {m} pt nenechá na papíře žádnou tisknutelnou plochu +@msg matrix must be finite and invertible, depth finite matrix musí být konečná a invertovatelná, depth konečná +@msg matte: {e} matte: {e} +@msg member is for order front, forward, backward or back member se používá s order front, forward, backward nebo back +@msg missing `artboards` chybí `artboards` +@msg missing `at` [x, y] chybí `at` [x, y] +@msg missing `attrs` chybí `attrs` +@msg missing `color` or `opacity` chybí `color` nebo `opacity` +@msg missing `colors` chybí `colors` +@msg missing `commands` chybí `commands` +@msg missing `destinationFolder` chybí `destinationFolder` +@msg missing `effect` id chybí ID `effect` +@msg missing `family` chybí `family` +@msg missing `find` chybí `find` +@msg missing `gid` (a glyph id, or null for the default glyph) chybí `gid` (ID glyfu, nebo null pro výchozí glyf) +@msg missing `group` chybí `group` +@msg missing `id` chybí `id` +@msg missing `id`: give one, or select one type object chybí `id`: zadejte ho, nebo vyberte jeden textový objekt +@msg missing `index` (a point index, or null to clear) chybí `index` (index bodu, nebo null pro vymazání) +@msg missing `index` (a stop index, or null to clear) chybí `index` (index zarážky, nebo null pro vymazání) +@msg missing `index` (an item index or null) chybí `index` (index položky nebo null) +@msg missing `item` chybí `item` +@msg missing `library` chybí `library` +@msg missing `library` (see graphicStyle.libraries) chybí `library` (viz graphicStyle.libraries) +@msg missing `library` (see swatch.library.list) chybí `library` (viz swatch.library.list) +@msg missing `map` (rows [{from, to}] or {current}) chybí `map` (řádky [{from, to}] nebo {current}) +@msg missing `matrix` [a,b,c,d,e,f] chybí `matrix` [a,b,c,d,e,f] +@msg missing `name` (see gradient.presets.list) chybí `name` (viz gradient.presets.list) +@msg missing `offset` (a distance in points) chybí `offset` (vzdálenost v bodech) +@msg missing `path` chybí `path` +@msg missing `path` (a path object id) chybí `path` (ID objektu cesty) +@msg missing `picks` chybí `picks` +@msg missing `rule` chybí `rule` +@msg missing `source` id chybí ID `source` +@msg missing `start` (the byte offset of a character) chybí `start` (bajtový posun znaku) +@msg missing `status`: linked, embedded, missing or modified chybí `status`: linked, embedded, missing nebo modified +@msg missing `target` id chybí ID `target` +@msg missing `text` chybí `text` +@msg missing `to` chybí `to` +@msg missing `to` (an index) chybí `to` (index) +@msg missing `to`: a non-negative integer chybí `to`: nezáporné celé číslo +@msg missing `type` chybí `type` +@msg missing `value` chybí `value` +@msg missing `word` chybí `word` +@msg missing `{key}` chybí `{key}` +@msg missing `{k}` chybí `{k}` +@msg missing anchor chybí kotevní bod +@msg missing anchors chybí kotevní body +@msg missing anchors [[subpath, anchor]…] chybí kotevní body [[subpath, anchor]…] +@msg missing array `{key}` chybí pole `{key}` +@msg missing case chybí case +@msg missing color chybí barva +@msg missing commands chybí příkazy +@msg missing destination folder chybí cílová složka +@msg missing from chybí from +@msg missing group chybí skupina +@msg missing id or ids chybí id nebo ids +@msg missing ids chybí ids +@msg missing indexes chybí indexes +@msg missing matrix [a,b,c,d,e,f] chybí matrix [a,b,c,d,e,f] +@msg missing name chybí název +@msg missing op chybí op +@msg missing or invalid `color` chybějící nebo neplatné `color` +@msg missing or unknown `tool` chybějící nebo neznámé `tool` +@msg missing point chybí bod +@msg missing point [x,y] chybí bod [x,y] +@msg missing point `{key}` ([x, y]) chybí bod `{key}` ([x, y]) +@msg missing points chybí body +@msg missing points [[x,y]…] chybí body [[x,y]…] +@msg missing segment chybí segment +@msg missing stops chybí zarážky +@msg missing subpaths chybí dílčí cesty +@msg missing target chybí cíl +@msg missing to chybí to +@msg missing x, y chybí x, y +@msg mode is set, add or toggle, not `{other}` mode je set, add nebo toggle, ne `{other}` +@msg mode must be "cmyk" or "rgb" mode musí být "cmyk" nebo "rgb" +@msg mode must be area|onPath, got {o} mode musí být area|onPath, zadáno {o} +@msg more than 10000 linked files: package dependencies in smaller parts více než 10000 propojených souborů: zabalte závislosti po menších částech +@msg more than 256 commands více než 256 příkazů +@msg more than {MAX_BATCH_FILES} data sets více než {MAX_BATCH_FILES} sad dat +@msg more than {MAX_BATCH_FILES} files více než {MAX_BATCH_FILES} souborů +@msg more than {MAX_CSV_ROWS} data rows více než {MAX_CSV_ROWS} řádků dat +@msg more than {MAX_FILES} images více než {MAX_FILES} obrázků +@msg more than {MAX_IMPORT} presets více než {MAX_IMPORT} přednastavení +@msg moved must be [[x,y]…] moved musí být [[x,y]…] +@msg must be an object with `kind` and `value` musí být objekt s `kind` a `value` +@msg must have `kind` alert, confirm or prompt musí mít `kind` alert, confirm nebo prompt +@msg must have exactly `kind` and `value` musí mít právě `kind` a `value` +@msg name (a toolbar's name) is required name (název panelu nástrojů) je povinné +@msg name (a toolbar's name) must be a string name (název panelu nástrojů) musí být řetězec +@msg name must be a toolbar's name name musí být název panelu nástrojů +@msg names is empty names je prázdné +@msg names must be an array of symbol names names musí být pole názvů symbolů +@msg need `anchor` or `segment` + `t` je potřeba `anchor` nebo `segment` + `t` +@msg need at least one anchor je potřeba alespoň jeden kotevní bod +@msg need at least one point je potřeba alespoň jeden bod +@msg need at least two points jsou potřeba alespoň dva body +@msg needs a closing quote after the name vyžaduje za názvem uzavírací uvozovku +@msg needs a name vyžaduje název +@msg needs a name of at most 64 bytes vyžaduje název o nejvýše 64 bajtech +@msg needs a name of letters, digits and _, or a quoted name vyžaduje název z písmen, číslic a _, nebo název v uvozovkách +@msg needs a name without control characters vyžaduje název bez řídicích znaků +@msg needs points vyžaduje body +@msg nesting too deep příliš hluboké vnoření +@msg nineSlice must be true or false nineSlice musí být true nebo false +@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides musí být [left, top, right, bottom], každá hodnota -16..16, přičemž left + right < 1 a top + bottom < 1 +@msg no HP-GL format žádný formát HP-GL +@msg no New Document profile called `{shown}` ({_1}) žádný profil nového dokumentu se nejmenuje `{shown}` ({_1}) +@msg no PDF preset named `{n}` přednastavení PDF s názvem `{n}` neexistuje +@msg no SVG filter at index {k} na indexu {k} není žádný filtr SVG +@msg no action set is current žádná sada akcí není aktuální +@msg no active data set žádná aktivní sada dat +@msg no appearance item {index} položka vzhledu {index} neexistuje +@msg no arrowheads file here zde není žádný soubor šipek +@msg no artboard {_1} pracovní plocha {_1} neexistuje +@msg no artboard {artboard} (0-based; the document has {_1}) pracovní plocha {artboard} neexistuje (počítáno od 0; dokument jich má {_1}) +@msg no asset {id} prvek {id} neexistuje +@msg no asset {id} (see assets.list) prvek {id} neexistuje (viz assets.list) +@msg no assets to export žádné prvky k exportu +@msg no assets yet: collect art for export first (assets.add) zatím žádné prvky: nejprve shromážděte kresbu pro export (assets.add) +@msg no brush named `{n}` štětec s názvem `{n}` neexistuje +@msg no character at byte {start} na bajtu {start} není žádný znak +@msg no character has code {code} žádný znak nemá kód {code} +@msg no colour žádná barva +@msg no colour group `{group}` skupina barev `{group}` neexistuje +@msg no colour group `{name}` skupina barev `{name}` neexistuje +@msg no custom arrowhead {name} (see stroke.arrowheads.list) vlastní šipka {name} neexistuje (viz stroke.arrowheads.list) +@msg no data sets žádné sady dat +@msg no dataset named `{from}` sada dat s názvem `{from}` neexistuje +@msg no dataset named `{name}` sada dat s názvem `{name}` neexistuje +@msg no datasets žádné sady dat +@msg no design named `{name}` návrh s názvem `{name}` neexistuje +@msg no design named `{n}` návrh s názvem `{n}` neexistuje +@msg no design named `{old}` návrh s názvem `{old}` neexistuje +@msg no encoder for {_1} yet pro {_1} zatím není žádný kodér +@msg no export preset `{name}` (see document.exportPresets.list) přednastavení exportu `{name}` neexistuje (viz document.exportPresets.list) +@msg no file to open žádný soubor k otevření +@msg no folder: pass `path` or set Preferences › Plug-ins & Scratch Disks › Additional Plug-ins Folder žádná složka: předejte `path` nebo nastavte Předvolby › Zásuvné moduly a odkládací disky › Další složka zásuvných modulů +@msg no fonts to look for: they are all available žádná písma k hledání: všechna jsou dostupná +@msg no formats to export žádné formáty k exportu +@msg no gradient preset `{name}` (see gradient.presets.list) přednastavení přechodu `{name}` neexistuje (viz gradient.presets.list) +@msg no graphic style `{n}` in `{_1}` grafický styl `{n}` v `{_1}` neexistuje +@msg no graphic style library `{key}` (see graphicStyle.libraries) knihovna grafických stylů `{key}` neexistuje (viz graphicStyle.libraries) +@msg no guide selected není vybráno žádné vodítko +@msg no guide selected (or give an index) není vybráno žádné vodítko (nebo zadejte index) +@msg no guide {i} vodítko {i} neexistuje +@msg no images in the folder ve složce nejsou žádné obrázky +@msg no instructions žádné instrukce +@msg no item at index {_1} na indexu {_1} není žádná položka +@msg no item at index {from} na indexu {from} není žádná položka +@msg no item at one of the indices {idx} na některém z indexů {idx} není žádná položka +@msg no layer žádná vrstva +@msg no layer to rename žádná vrstva k přejmenování +@msg no layer {id} (see layer.list) vrstva {id} neexistuje (viz layer.list) +@msg no layers to export žádné vrstvy k exportu +@msg no library `{key}` knihovna `{key}` neexistuje +@msg no metafile format žádný formát metasouboru +@msg no object {_1} objekt {_1} neexistuje +@msg no objects žádné objekty +@msg no parent layer žádná nadřazená vrstva +@msg no perspective grid preset named `{b}` (see perspective.presets.list) přednastavení perspektivní mřížky s názvem `{b}` neexistuje (viz perspective.presets.list) +@msg no perspective grid preset named `{n}` přednastavení perspektivní mřížky s názvem `{n}` neexistuje +@msg no point selected (give `index`) není vybrán žádný bod (zadejte `index`) +@msg no preset called `{from}` (see file.newPresets) přednastavení s názvem `{from}` neexistuje (viz file.newPresets) +@msg no preset called `{name}` (see file.newPresets) přednastavení s názvem `{name}` neexistuje (viz file.newPresets) +@msg no preset named `{n}` přednastavení s názvem `{n}` neexistuje +@msg no print preset named `{b}` (see print.presets.list) přednastavení tisku s názvem `{b}` neexistuje (viz print.presets.list) +@msg no print preset named `{name}` (presets: {_1}) přednastavení tisku s názvem `{name}` neexistuje (přednastavení: {_1}) +@msg no print preset named `{n}` přednastavení tisku s názvem `{n}` neexistuje +@msg no profile named `{name}` profil s názvem `{name}` neexistuje +@msg no random numbers ({e}) náhodná čísla nejsou k dispozici ({e}) +@msg no readable files in the folder ve složce nejsou žádné čitelné soubory +@msg no recovery copy `{f}` (see file.recovery.list) záložní kopie `{f}` neexistuje (viz file.recovery.list) +@msg no rows žádné řádky +@msg no saved PDF preset named `{name}` uložené přednastavení PDF s názvem `{name}` neexistuje +@msg no saved export preset `{name}` uložené přednastavení exportu `{name}` neexistuje +@msg no saved gradient preset called {name} uložené přednastavení přechodu s názvem {name} neexistuje +@msg no saved gradient presets žádná uložená přednastavení přechodu +@msg no saved preset called `{name}` uložené přednastavení s názvem `{name}` neexistuje +@msg no saved presets to export (name [Default] in `names` to export it) žádná uložená přednastavení k exportu (chcete-li exportovat [Default], uveďte ho v `names`) +@msg no saved presets to export (name built-in ones in `names`) žádná uložená přednastavení k exportu (vestavěná uveďte v `names`) +@msg no saved print preset named `{name}` uložené přednastavení tisku s názvem `{name}` neexistuje +@msg no saved profile called {name} uložený profil s názvem {name} neexistuje +@msg no saved selection `{name}` uložený výběr `{name}` neexistuje +@msg no saved theme called {name} (see colorTheme.list) uložený motiv s názvem {name} neexistuje (viz colorTheme.list) +@msg no saved views žádná uložená zobrazení +@msg no selected or given object has a visible 3D effect žádný vybraný ani zadaný objekt nemá viditelný 3D efekt +@msg no series {i} řada {i} neexistuje +@msg no slice {n} in the image (see slice.list) řez {n} v obrazu neexistuje (viz slice.list) +@msg no source art žádná zdrojová kresba +@msg no stop {i} (the gradient has {n}) zarážka {i} neexistuje (přechod jich má {n}) +@msg no style `{name}` styl `{name}` neexistuje +@msg no such artboard {v} taková pracovní plocha neexistuje: {v} +@msg no such assets (see assets.list) takové prvky neexistují (viz assets.list) +@msg no such frame anchor, or the frame would reach past the canvas takový kotevní bod rámce neexistuje, nebo by rámec přesáhl plátno +@msg no such objects takové objekty neexistují +@msg no such path anchor, or the path would reach past the canvas takový kotevní bod cesty neexistuje, nebo by cesta přesáhla plátno +@msg no such rows takové řádky neexistují +@msg no swatch `{keep}` položka vzorníku `{keep}` neexistuje +@msg no swatch `{n}` položka vzorníku `{n}` neexistuje +@msg no swatch `{n}` (swatches and colour groups move separately) položka vzorníku `{n}` neexistuje (položky vzorníku a skupiny barev se přesouvají zvlášť) +@msg no swatch library `{key}` (see swatch.library.list) knihovna vzorníku `{key}` neexistuje (viz swatch.library.list) +@msg no swatch library `{key}` (see swatch.library.list; "document": the document's swatches) knihovna vzorníku `{key}` neexistuje (viz swatch.library.list; "document": vzorník dokumentu) +@msg no swatch library `{key}` (see swatch.library.list; "{DOCUMENT_SWATCHES}": the document's swatches) knihovna vzorníku `{key}` neexistuje (viz swatch.library.list; "{DOCUMENT_SWATCHES}": vzorník dokumentu) +@msg no swatch named `{n}` položka vzorníku s názvem `{n}` neexistuje +@msg no swatch or colour group `{n}` položka vzorníku ani skupina barev `{n}` neexistuje +@msg no swatch or colour group `{n}` in `{_1}` položka vzorníku ani skupina barev `{n}` v `{_1}` neexistuje +@msg no symbol named `{_1}` symbol s názvem `{_1}` neexistuje +@msg no symbol named `{name}` symbol s názvem `{name}` neexistuje +@msg no text objects selected nejsou vybrány žádné textové objekty +@msg no toolbar named `{_1}` panel nástrojů s názvem `{_1}` neexistuje +@msg no toolbar named `{name}` panel nástrojů s názvem `{name}` neexistuje +@msg no tracing preset `{preset}` (see imageTrace.presets) přednastavení vektorizace `{preset}` neexistuje (viz imageTrace.presets) +@msg no user library folder here (save with a path, or without one to get the data) zde není žádná složka uživatelských knihoven (uložte s cestou, nebo bez ní, chcete-li získat data) +@msg no variable named `{from}` proměnná s názvem `{from}` neexistuje +@msg no variable named `{name}` proměnná s názvem `{name}` neexistuje +@msg no variable named `{var}` proměnná s názvem `{var}` neexistuje +@msg no variable named `{v}` proměnná s názvem `{v}` neexistuje +@msg no view named `{name}` zobrazení s názvem `{name}` neexistuje +@msg node {_1} already has the text variable `{_2}` uzel {_1} už má textovou proměnnou `{_2}` +@msg node {_1} is not a graph uzel {_1} není graf +@msg node {_1} is not an image uzel {_1} není obraz +@msg node {_1} is not type uzel {_1} není text +@msg not a DCS file nejde o soubor DCS +@msg not a PDF presets file (format `{_1}`) nejde o soubor přednastavení PDF (formát `{_1}`) +@msg not a PDF presets file: {e} nejde o soubor přednastavení PDF: {e} +@msg not a RegExp object nejde o objekt RegExp +@msg not a Word document: its WordDocument stream doesn't start with a file information block nejde o dokument Word: jeho proud WordDocument nezačíná blokem informací o souboru +@msg not a Word document: its compound file has no WordDocument stream nejde o dokument Word: jeho složený soubor nemá proud WordDocument +@msg not a Word document: its main part is not a WordprocessingML document nejde o dokument Word: jeho hlavní část není dokument WordprocessingML +@msg not a Word document: its package has no main document part nejde o dokument Word: jeho balíček nemá hlavní část dokumentu +@msg not a closed path nejde o uzavřenou cestu +@msg not a flattener presets file (format `{_1}`) nejde o soubor přednastavení sloučení průhlednosti (formát `{_1}`) +@msg not a flattener presets file: {e} nejde o soubor přednastavení sloučení průhlednosti: {e} +@msg not a layer or group nejde o vrstvu ani skupinu +@msg not a library file: {e} nejde o soubor knihovny: {e} +@msg not a mesh envelope point nejde o bod síťové obálky +@msg not a perspective grid presets file (format `{_1}`) nejde o soubor přednastavení perspektivní mřížky (formát `{_1}`) +@msg not a perspective grid presets file: {e} nejde o soubor přednastavení perspektivní mřížky: {e} +@msg not a print presets file (format `{_1}`) nejde o soubor přednastavení tisku (formát `{_1}`) +@msg not a print presets file: {e} nejde o soubor přednastavení tisku: {e} +@msg not a regular expression nejde o regulární výraz +@msg not a stored or deflated central record nejde o uložený ani komprimovaný centrální záznam +@msg not a valid SVGZ file: {e} nejde o platný soubor SVGZ: {e} +@msg not an RTF file: it doesn't start with {\rtf nejde o soubor RTF: nezačíná na {\rtf +@msg not an action set: the text doesn't start with /version and a number nejde o sadu akcí: text nezačíná na /version a číslo +@msg not an image VectorCraft reads (see document.formats) nejde o obrázek, který VectorCraft čte (viz document.formats) +@msg not area type (text in a frame) outside perspective nejde o text v oblasti (text v rámci) mimo perspektivu +@msg not editing an opacity mask maska krytí se neupravuje +@msg not type on a path outside perspective nejde o text na cestě mimo perspektivu +@msg nothing prints nic se netiskne +@msg nothing to bind není co svázat +@msg nothing to change není co změnit +@msg nothing to change: give dx, dy, hScale, vScale or rotation není co změnit: zadejte dx, dy, hScale, vScale nebo rotation +@msg nothing to crop není co oříznout +@msg nothing to export není co exportovat +@msg nothing to export: the document has no visible art není co exportovat: dokument nemá žádnou viditelnou kresbu +@msg nothing to mark není co označit +@msg nothing to print: every artboard picked is blank není co tisknout: každá zvolená pracovní plocha je prázdná +@msg nothing to print: the document has no art that prints není co tisknout: dokument nemá žádnou kresbu, která se tiskne +@msg nothing to repeat není co opakovat +@msg numbers out of order in {_1} quantifier čísla v kvantifikátoru {_1} jsou ve špatném pořadí +@msg object is not a path objekt není cesta +@msg object transparency cannot be sampled onto highlighted characters; disable Transparency in Eyedropper Options or select the whole object průhlednost objektu nelze nabrat na zvýrazněné znaky; vypněte Průhlednost ve volbách kapátka nebo vyberte celý objekt +@msg object {_1} can't be set as point type objekt {_1} nelze nastavit jako bodový text +@msg object {_1} has lost its file's contents: relink it objekt {_1} ztratil obsah svého souboru: propojte ho znovu +@msg object {_1} has no path objekt {_1} nemá cestu +@msg object {_1} has no size objekt {_1} nemá velikost +@msg object {_1} is hidden or locked, or on a locked artboard objekt {_1} je skrytý nebo zamknutý, nebo je na zamknuté pracovní ploše +@msg object {_1} is not a placed document objekt {_1} není umístěný dokument +@msg object {_1} is not an Intertwine group objekt {_1} není skupina propletení +@msg object {_1} is not an image objekt {_1} není obraz +@msg object {_1} is not an image or a linked file objekt {_1} není obraz ani propojený soubor +@msg object {_1} is not an image or a placed document objekt {_1} není obraz ani umístěný dokument +@msg object {_1} is not in this Intertwine group objekt {_1} není v této skupině propletení +@msg object {_1} needs a 3D effect objekt {_1} vyžaduje 3D efekt +@msg object {_1} needs a 3D effect at index {index} objekt {_1} vyžaduje 3D efekt na indexu {index} +@msg object {_1}: a hollow Extrude & Bevel has no caps: turn on Cap to map a graphic objekt {_1}: duté Vysunutí a zkosení nemá zakončení: chcete-li mapovat grafiku, zapněte Zakončení +@msg object {_1}: with a depth of 0 the object has one face: map its graphics onto the front objekt {_1}: při hloubce 0 má objekt jednu plochu: mapujte jeho grafiku na přední stranu +@msg object {_1}: {_2} objekt {_1}: {_2} +@msg object {_1}: {e} objekt {_1}: {e} +@msg object {_1}: {name} at index {index} has no lighting presets; set its lights with effect.setParams objekt {_1}: {name} na indexu {index} nemá žádná přednastavení osvětlení; světla nastavte pomocí effect.setParams +@msg object {id} has anchors 0–{_1} for `corners`, not {past} objekt {id} má pro `corners` kotevní body 0–{_1}, ne {past} +@msg object {id} has {n} anchors, so no anchor {past} objekt {id} má {n} kotevních bodů, takže kotevní bod {past} neexistuje +@msg objects must be none, move or copy objects musí být none, move nebo copy +@msg objects were left out objekty byly vynechány +@msg offset out of range posun je mimo rozsah +@msg on must be true or false on musí být true nebo false +@msg only groups, layers, type and images have a Contents (Characters) row řádek Obsah (Znaky) mají jen skupiny, vrstvy, text a obrazy +@msg only interior mesh lines can be deleted odstranit lze jen vnitřní linie sítě +@msg only solid colours can be added (not gradients or patterns) přidat lze jen plné barvy (ne přechody ani vzorky) +@msg only solid-colour swatches can be spot colours přímými barvami mohou být jen položky vzorníku s plnou barvou +@msg only this Affinity file's embedded preview could be read: use File › Open to see it with its warning, or export SVG or PDF from Affinity first z tohoto souboru Affinity šlo přečíst jen vložený náhled: pomocí Soubor › Otevřít ho zobrazíte s varováním, nebo nejprve exportujte SVG či PDF z Affinity +@msg only this Affinity file's embedded preview could be read; use File › Open to see it with its warning z tohoto souboru Affinity šlo přečíst jen vložený náhled; pomocí Soubor › Otevřít ho zobrazíte s varováním +@msg onto, above, below, icon and a column place belong to window.panel.float and window.panel.dock onto, above, below, icon a umístění ve sloupci patří k window.panel.float a window.panel.dock +@msg onto, above, below, icon and a column place take no anchor, side, zone or before onto, above, below, icon a umístění ve sloupci nepřijímají anchor, side, zone ani before +@msg onto, above, below, icon and a column place take no x, y, width or height onto, above, below, icon a umístění ve sloupci nepřijímají x, y, width ani height +@msg opacity must be a number opacity musí být číslo +@msg open a document to look for its linked files otevřete dokument, jehož propojené soubory se mají hledat +@msg operand too large operand je příliš velký +@msg options must be an object (see file.formatOptions) options musí být objekt (viz file.formatOptions) +@msg order is a whole number from 0 to {others}, not `{v}` order je celé číslo od 0 do {others}, ne `{v}` +@msg order must be leftToRight or rightToLeft order musí být leftToRight nebo rightToLeft +@msg orientation must be portrait or landscape, not `{o}` orientation musí být portrait nebo landscape, ne `{o}` +@msg outlineText {v}: true or false outlineText {v}: true nebo false +@msg output intent profile: {e} profil výstupního záměru: {e} +@msg output.destination: no RGB or CMYK profile is called “{name}” output.destination: žádný profil RGB ani CMYK se nejmenuje „{name}“ +@msg output.destination: {_1} files are CMYK, and “{name}” is an RGB profile output.destination: soubory {_1} jsou CMYK a „{name}“ je profil RGB +@msg output.destination: {e} output.destination: {e} +@msg output.inks: no ink is set to print output.inks: žádná tisková barva není nastavena k tisku +@msg output.outputIntent: no profile is called “{name}”, and a {std} output intent embeds its profile output.outputIntent: žádný profil se nejmenuje „{name}“ a výstupní záměr {std} svůj profil vkládá +@msg output.outputIntent: no profile is called “{name}”: a {std} output intent embeds a profile, or names a registered printing condition (outputConditionId and registry) output.outputIntent: žádný profil se nejmenuje „{name}“: výstupní záměr {std} profil vkládá, nebo uvádí registrovanou tiskovou podmínku (outputConditionId a registry) +@msg output.outputIntent: {std} files print in CMYK, and “{name}” is an RGB profile output.outputIntent: soubory {std} se tisknou v CMYK a „{name}“ je profil RGB +@msg output.outputIntent: “{name}” is a grey profile, which can't be a {std} output intent output.outputIntent: „{name}“ je profil odstínů šedi, který nemůže být výstupním záměrem {std} +@msg overlap: {o} pt is half a tile or more překrytí: {o} pt je polovina dlaždice nebo více +@msg overlapping Shaper paths must be in the same layer or group překrývající se cesty Shaper musí být ve stejné vrstvě nebo skupině +@msg overlapping edits překrývající se úpravy +@msg page art conflicts with image data for {key} kresba stránky je v rozporu s obrazovými daty pro {key} +@msg page art conflicts with pattern {name} kresba stránky je v rozporu se vzorkem {name} +@msg page art conflicts with swatch {name} kresba stránky je v rozporu s položkou vzorníku {name} +@msg page art is missing image data for {key} kresbě stránky chybí obrazová data pro {key} +@msg page art is missing pattern {name} kresbě stránky chybí vzorek {name} +@msg page art is missing swatch {name} kresbě stránky chybí položka vzorníku {name} +@msg page must be a whole number from 1 page musí být celé číslo od 1 +@msg page thumbnail: {e} miniatura stránky: {e} +@msg page {page} of the PDF has no objects stránka {page} dokumentu PDF nemá žádné objekty +@msg page {page}: `{file}` has {n} {artboards} stránka {page}: `{file}` má {n} {artboards} +@msg page {page}: `{name}` has {n} {pages} stránka {page}: `{name}` má {n} {pages} +@msg pages must be a range such as "2-3" or a page number, not {v} pages musí být rozsah jako "2-3" nebo číslo stránky, ne {v} +@msg pages: {e} pages: {e} +@msg panel position must be finite pozice panelu musí být konečná +@msg parameters must be an object parametry musí být objekt +@msg params must be an object params musí být objekt +@msg passwords can have up to {MAX_PASSWORD} bytes hesla mohou mít nejvýše {MAX_PASSWORD} bajtů +@msg path chunks must share their boundary point úseky cesty musí sdílet svůj hraniční bod +@msg path has no open end cesta nemá žádný otevřený konec +@msg paths must be strings paths musí být řetězce +@msg pdfCompatible: false needs every artboard to keep the editable artwork pdfCompatible: false vyžaduje všechny pracovní plochy, aby se zachovala upravitelná kresba +@msg pdfCompatible: false needs the artboards to keep the editable artwork when useArtboards is false pdfCompatible: false vyžaduje pracovní plochy, aby se zachovala upravitelná kresba, když je useArtboards false +@msg pdfs `{m}`: single or multiple pdfs `{m}`: single nebo multiple +@msg pickColorFrom is "artwork" or "swatches", not {v} pickColorFrom je "artwork" nebo "swatches", ne {v} +@msg pins and moved must be non-empty lists of the same length pins a moved musí být neprázdné seznamy stejné délky +@msg pins must be [[x,y]…] pins musí být [[x,y]…] +@msg pins must be finite pins musí být konečné +@msg place is above, below or inside, not `{other}` place je above, below nebo inside, ne `{other}` +@msg plane must be left|right|ground plane musí být left|right|ground +@msg plane must be left|right|ground|none plane musí být left|right|ground|none +@msg point is outside the mesh bod je mimo síť +@msg point x must be a number x bodu musí být číslo +@msg point y must be a number y bodu musí být číslo +@msg points must be [t, left, right] with non-negative widths points musí být [t, left, right] s nezápornými šířkami +@msg points must be [x,y] pairs points musí být dvojice [x,y] +@msg points must be a non-empty [[x,y,pressure?]…] list points musí být neprázdný seznam [[x,y,pressure?]…] +@msg points must be a non-empty list of finite [x,y] points musí být neprázdný seznam konečných [x,y] +@msg points must be an array or null points musí být pole nebo null +@msg points must be finite points musí být konečné +@msg points must be finite [x,y] pairs points musí být konečné dvojice [x,y] +@msg points must be finite canvas points points musí být konečné body plátna +@msg points must contain 1–4096 coordinates points musí obsahovat 1–4096 souřadnic +@msg position must be normal, superscript or subscript position musí být normal, superscript nebo subscript +@msg position must be topLeft, topRight, bottomLeft or bottomRight position musí být topLeft, topRight, bottomLeft nebo bottomRight +@msg positions must be between 0 and 100000 pt positions musí být mezi 0 a 100000 pt +@msg ppi must be a positive number, not {ppi} ppi musí být kladné číslo, ne {ppi} +@msg ppi must be between 1 and 2400 ppi musí být mezi 1 a 2400 +@msg preserve `{v}` is not transforms|bounds|fileDimensions|fit|fill preserve `{v}` není transforms|bounds|fileDimensions|fit|fill +@msg preserveShape must be clippingMask|transparency preserveShape musí být clippingMask|transparency +@msg preset `{id}`: mobile or density přednastavení `{id}`: mobile nebo density +@msg preset must be standard, diffuse, topLeft or right preset musí být standard, diffuse, topLeft nebo right +@msg preset must be the name of a print preset preset musí být název přednastavení tisku +@msg previewMode must be default, pixel or overprint previewMode musí být default, pixel nebo overprint +@msg print settings: {e} nastavení tisku: {e} +@msg procedures nest too deeply procedury jsou vnořeny příliš hluboko +@msg procedures nested too deeply procedury byly vnořeny příliš hluboko +@msg quotes must be {double?, single?} quotes musí být {double?, single?} +@msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k} musí být otevírací a uzavírací uvozovka, např. "“”" +@msg range out of order in character class rozsah ve třídě znaků je ve špatném pořadí +@msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi musí být 1–2400 (72 obrazovka, 150 střední, 300 vysoké) +@msg rating must be a whole number from 0 to {MAX_RATING} rating musí být celé číslo od 0 do {MAX_RATING} +@msg rect and {k} contradict each other: give the area or the artboards rect a {k} si odporují: zadejte oblast, nebo pracovní plochy +@msg rect applies to raster formats, not {_1} rect platí pro rastrové formáty, ne pro {_1} +@msg rect is [x, y, width, height] in points rect je [x, y, width, height] v bodech +@msg rect must be [x, y, width, height] rect musí být [x, y, width, height] +@msg rect must be [x, y, width, height] with a positive width and height rect musí být [x, y, width, height] s kladnou šířkou a výškou +@msg rect needs finite numbers and a positive width and height rect vyžaduje konečná čísla a kladnou šířku a výšku +@msg redraw needs id redraw vyžaduje id +@msg redraw within must be a finite distance of 0 or more within v redraw musí být konečná vzdálenost 0 nebo větší +@msg reduce of an empty array with no initial value reduce prázdného pole bez počáteční hodnoty +@msg registration must be 0..8 registration musí být 0..8 +@msg regular expression flag '{_1}' given twice příznak regulárního výrazu '{_1}' je zadán dvakrát +@msg release a layer or a group uvolněte vrstvu nebo skupinu +@msg replace keeps the replaced object's place and transform: drop template, at and rect replace zachová umístění a transformaci nahrazeného objektu: vynechte template, at a rect +@msg replace: select the one object to replace replace: vyberte jeden objekt, který se má nahradit +@msg resolution must be a number or screen|medium|high resolution musí být číslo nebo screen|medium|high +@msg resolution must be between 1 and 2400 ppi resolution musí být mezi 1 a 2400 ppi +@msg rotation must be a number of degrees rotation musí být počet stupňů +@msg rotation must be finite rotation musí být konečné +@msg rows and cols must be 1..50 rows a cols musí být 1..50 +@msg rows and columns must be 1..500 rows a columns musí být 1..500 +@msg rows of objects whose appearances differ can't be reordered together řádky objektů s odlišným vzhledem nelze přeskupovat společně +@msg sampled text would exceed the canvas (coordinates out of range) nabraný text by přesáhl plátno (souřadnice mimo rozsah) +@msg save the document first: Package collects a saved document nejprve dokument uložte: Balíček shromažďuje uložený dokument +@msg save the document first: copy puts the file in its folder nejprve dokument uložte: copy vloží soubor do jeho složky +@msg savedPreset: {e} savedPreset: {e} +@msg scale `{s}`: a factor such as 2x, a width (100w), a height (100h) or a resolution (72ppi) scale `{s}`: násobek jako 2x, šířka (100w), výška (100h) nebo rozlišení (72ppi) +@msg scale must be a number above 0, at most 64 scale musí být číslo větší než 0, nejvýše 64 +@msg scale must be non-zero scale nesmí být nula +@msg scope must be selection or all (got {other}) scope musí být selection nebo all (zadáno {other}) +@msg scribble is too long čmáranice je příliš dlouhá +@msg segment does not exist segment neexistuje +@msg select a Shaper group vyberte skupinu Shaper +@msg select a blend to set easing or color shift vyberte prolnutí, u kterého se má nastavit náběh nebo posun barev +@msg select a compound shape vyberte složený tvar +@msg select a graph vyberte graf +@msg select a group or layer with visible, unlocked members vyberte skupinu nebo vrstvu s viditelnými odemknutými členy +@msg select a layer vyberte vrstvu +@msg select a text object vyberte textový objekt +@msg select an SVG filter vyberte filtr SVG +@msg select an image (or an Image Trace group) vyberte obraz (nebo skupinu vektorizace obrazu) +@msg select an image, or pass id vyberte obraz, nebo předejte id +@msg select an object (or pass `id`) vyberte objekt (nebo předejte `id`) +@msg select an object with a 3D effect vyberte objekt s 3D efektem +@msg select an object with a 3D effect, or give its id in ids vyberte objekt s 3D efektem, nebo zadejte jeho ID v ids +@msg select an object with a freeform gradient vyberte objekt s volným přechodem +@msg select an object with an opacity mask vyberte objekt s maskou krytí +@msg select area type vyberte text v oblasti +@msg select area type (text in a frame) vyberte text v oblasti (text v rámci) +@msg select area type and closed paths (at least one area type object) vyberte text v oblasti a uzavřené cesty (alespoň jeden objekt textu v oblasti) +@msg select area type whose first line can fit its frame vyberte text v oblasti, jehož první řádek se vejde do rámce +@msg select artwork to add its colours vyberte kresbu, jejíž barvy se mají přidat +@msg select artwork to make a group of its colours vyberte kresbu, z jejíchž barev se má vytvořit skupina +@msg select artwork to recolour, or give a colour `group` vyberte kresbu k přebarvení, nebo zadejte skupinu barev v `group` +@msg select exactly two path ends to join vyberte právě dva konce cest ke spojení +@msg select members of a compound shape vyberte členy složeného tvaru +@msg select objects or give ids vyberte objekty nebo zadejte ids +@msg select objects to align to the guide vyberte objekty, které se mají zarovnat k vodítku +@msg select one Intertwine group vyberte jednu skupinu propletení +@msg select one image or pass id vyberte jeden obraz nebo předejte id +@msg select one layer, group or object to rename vyberte jednu vrstvu, skupinu nebo objekt k přejmenování +@msg select paths vyberte cesty +@msg select paths or compound paths vyberte cesty nebo složené cesty +@msg select rows or objects to collect vyberte řádky nebo objekty ke shromáždění +@msg select something to export vyberte něco k exportu +@msg select something to export (or turn off selectedOnly) vyberte něco k exportu (nebo vypněte selectedOnly) +@msg select text to redefine the style from vyberte text, podle kterého se má styl předefinovat +@msg select the art and, on top of it, the mask object vyberte kresbu a nad ní objekt masky +@msg select the art for the design vyberte kresbu pro návrh +@msg select the art for the pattern tile vyberte kresbu pro dlaždici vzorku +@msg select the art to add first nejprve vyberte kresbu, která se má přidat +@msg select the art to collect (or give its ids) vyberte kresbu ke shromáždění (nebo zadejte její ids) +@msg select the art to weed vyberte kresbu pro vybírání +@msg select the content and a path on top vyberte obsah a cestu nad ním +@msg select the images to relink, or pass ids vyberte obrazy k novému propojení, nebo předejte ids +@msg select the images, or pass ids vyberte obrazy, nebo předejte ids +@msg select the linked images or placed documents, or pass ids vyberte propojené obrazy nebo umístěné dokumenty, nebo předejte ids +@msg select the object to copy from vyberte objekt, ze kterého se má kopírovat +@msg select the objects (or give their ids) vyberte objekty (nebo zadejte jejich ids) +@msg select the objects to attach to the path vyberte objekty, které se mají připojit k cestě +@msg select the objects to bind vyberte objekty, které se mají svázat +@msg select two or more objects to intertwine vyberte dva nebo více objektů k propletení +@msg select two or more slices to combine vyberte dva nebo více řezů ke spojení +@msg select type on a path vyberte text na cestě +@msg select type on a path or area type vyberte text na cestě nebo text v oblasti +@msg selection `{m}`: one or each selection `{m}`: one nebo each +@msg settings is an object of document.exportForScreens params settings je objekt s parametry document.exportForScreens +@msg settings must be an object settings musí být objekt +@msg show `{show}`: all, missing, modified or embedded show `{show}`: all, missing, modified nebo embedded +@msg show must be true or false show musí být true nebo false +@msg side is left or right, not `{v}` side je left nebo right, ne `{v}` +@msg size must be "small", "medium", "large" or a number of points over 0 up to {_1} size musí být "small", "medium", "large" nebo počet bodů větší než 0 a nejvýše {_1} +@msg size must be positive size musí být kladné +@msg sizeMode is "fixed" or "pressure", not `{other}` sizeMode je "fixed" nebo "pressure", ne `{other}` +@msg sizeMode is "fixed" or "pressure", not {other} sizeMode je "fixed" nebo "pressure", ne {other} +@msg sizeVariation must be 0 or more sizeVariation musí být 0 nebo více +@msg smallCaps must be true or false smallCaps musí být true nebo false +@msg sort `{x}`: name, kind or status sort `{x}`: name, kind nebo status +@msg source paths are too large for Shaper zdrojové cesty jsou pro Shaper příliš velké +@msg source text transform is collapsed or unrepresentable transformace zdrojového textu je zborcená nebo ji nelze vyjádřit +@msg spot, mode and group apply to solid colours only spot, mode a group platí jen pro plné barvy +@msg status `{s}`: linked, embedded, missing or modified status `{s}`: linked, embedded, missing nebo modified +@msg steps must be 1..1000 steps musí být 1..1000 +@msg steps must be 1..{MAX_STEPS} steps musí být 1..{MAX_STEPS} +@msg stop {i}: `plates` must be four numbers from 0 to 1 (C, M, Y, K) zarážka {i}: `plates` musí být čtyři čísla od 0 do 1 (C, M, Y, K) +@msg stopped before the archive was finished zastaveno před dokončením archivu +@msg strokeMode must be within|along|across, got {m} strokeMode musí být within|along|across, zadáno {m} +@msg strokeOptions must be an object of stroke.set options strokeOptions musí být objekt s volbami stroke.set +@msg strokeWidth must be a positive number of pixels strokeWidth musí být kladný počet obrazových bodů +@msg subpath {si} is not an open subpath dílčí cesta {si} není otevřená dílčí cesta +@msg subpaths required when joining the same path při spojování téže cesty je vyžadováno subpaths +@msg swatchConflict must be "merge" or "add", not {v} swatchConflict musí být "merge" nebo "add", ne {v} +@msg table must be true or false table musí být true nebo false +@msg takes one name přijímá jeden název +@msg target text transform is collapsed or unrepresentable transformace cílového textu je zborcená nebo ji nelze vyjádřit +@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text musí být {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} +@msg text transform is collapsed or unrepresentable transformace textu je zborcená nebo ji nelze vyjádřit +@msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces musí být celé číslo od 2 do 100 +@msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}`: použijte "{_1}" nebo "{_2}" +@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage: zadejte {path} nebo {name, dataBase64} souboru obrázku, nebo texturu tak, jak ji vrací effect.list +@msg textureImage: {e} textureImage: {e} +@msg that makes more than {MAX_PIECES} slices tím vznikne více než {MAX_PIECES} řezů +@msg that makes too many pieces (at most 100000) or dash steps: simplify the dash pattern or make the dashes longer tím vznikne příliš mnoho dílů (nejvýše 100000) nebo kroků čárkování: zjednodušte vzor čárkování nebo prodlužte čárky +@msg that object is not in the overlap tento objekt není v překryvu +@msg the Affinity document has no page with a size dokument Affinity nemá žádnou stránku s velikostí +@msg the CMYK image couldn't be written obraz CMYK nešlo zapsat +@msg the Layers panel is not shown panel Vrstvy není zobrazen +@msg the Layers panel's search, filter or Show Layers Only hides its row jeho řádek skrývá hledání, filtr nebo volba Zobrazit pouze vrstvy v panelu Vrstvy +@msg the Objects on Path group is hidden or locked skupina Objekty na cestě je skrytá nebo zamknutá +@msg the PDF security settings were saved without their passwords: give openPassword or permissionsPassword again, or security without passwordRequired to export unprotected nastavení zabezpečení PDF bylo uloženo bez hesel: zadejte znovu openPassword nebo permissionsPassword, nebo pro export bez ochrany zadejte security bez passwordRequired +@msg the RTF file has too many paragraphs or formatting changes to place as type (at most {MAX_PARAGRAPHS} paragraphs and {MAX_RUNS} runs) soubor RTF má příliš mnoho odstavců nebo změn formátování na umístění jako text (nejvýše {MAX_PARAGRAPHS} odstavců a {MAX_RUNS} úseků) +@msg the RTF file is too large to place as type (at most {_1} MB) soubor RTF je příliš velký na umístění jako text (nejvýše {_1} MB) +@msg the SVG expands to more than {0} nested SVG images SVG se rozvine na více než {0} vnořených obrázků SVG +@msg the SVG expands to more than {0} objects SVG se rozvine na více než {0} objektů +@msg the SVG file is larger than {MAX_IMPORT_BYTES} bytes soubor SVG je větší než {MAX_IMPORT_BYTES} bajtů +@msg the SVG has no drawable objects SVG nemá žádné vykreslitelné objekty +@msg the SVGZ file unpacks to more than {_1} MB soubor SVGZ se rozbalí na více než {_1} MB +@msg the Word document has more than {MAX_PAGES} pages of properties, too many to place dokument Word má více než {MAX_PAGES} stránek vlastností, což je na umístění příliš mnoho +@msg the Word document has more than {MAX_RUNS} runs of character or paragraph properties, too many to place dokument Word má více než {MAX_RUNS} úseků vlastností znaků nebo odstavců, což je na umístění příliš mnoho +@msg the Word document has more than {_1} MB of formatting properties, too many to place dokument Word má více než {_1} MB vlastností formátování, což je na umístění příliš mnoho +@msg the Word document has too much text or formatting to place as type (at most {MAX_PARAGRAPHS} paragraphs, {MAX_RUNS} runs and {_1} MB of text) dokument Word má příliš mnoho textu nebo formátování na umístění jako text (nejvýše {MAX_PARAGRAPHS} odstavců, {MAX_RUNS} úseků a {_1} MB textu) +@msg the Word document has too much text to place as type (at most {_1} MB) dokument Word má příliš mnoho textu na umístění jako text (nejvýše {_1} MB) +@msg the Word document is encrypted or protected with a password; save it without one to place it dokument Word je zašifrovaný nebo chráněný heslem; chcete-li ho umístit, uložte ho bez hesla +@msg the Word document is too large to place (its {name} stream holds more than {_1} MB) dokument Word je příliš velký na umístění (jeho proud {name} obsahuje více než {_1} MB) +@msg the Word document was last saved with fast save, which VectorCraft doesn't read; save it again with fast save turned off dokument Word byl naposledy uložen rychlým ukládáním, které VectorCraft nečte; uložte ho znovu s vypnutým rychlým ukládáním +@msg the Word document was saved by Word 6.0 or Word 95, which VectorCraft doesn't read; save it as a Word 97-2003 document dokument Word byl uložen ve Wordu 6.0 nebo Wordu 95, což VectorCraft nečte; uložte ho jako dokument Word 97-2003 +@msg the Word document's text is made of more than {MAX_PIECES} pieces, too many to place text dokumentu Word se skládá z více než {MAX_PIECES} částí, což je na umístění příliš mnoho +@msg the XML operation needs an XML or XMLList value operace XML vyžaduje hodnotu XML nebo XMLList +@msg the XPath expression does not evaluate to a node-set výraz XPath se nevyhodnotí na množinu uzlů +@msg the XPath expression ends early výraz XPath končí předčasně +@msg the XPath expression has an unmatched ) výraz XPath obsahuje nespárovanou ) +@msg the XPath expression has an unmatched ] výraz XPath obsahuje nespárovanou ] +@msg the XPath expression has an unmatched closing bracket výraz XPath obsahuje nespárovanou uzavírací závorku +@msg the XPath expression selects a namespace node, which is not an XML value výraz XPath vybírá uzel jmenného prostoru, což není hodnota XML +@msg the XPath expression selects the root node, which is not an XML value výraz XPath vybírá kořenový uzel, což není hodnota XML +@msg the XPath function {name} needs a node-set funkce XPath {name} vyžaduje množinu uzlů +@msg the XPath function {name} takes the wrong number of arguments funkce XPath {name} dostala nesprávný počet argumentů +@msg the XPath name functions need a node-set funkce XPath pro názvy vyžadují množinu uzlů +@msg the XPath prefix {shown} is not bound to a namespace předpona XPath {shown} není svázána se jmenným prostorem +@msg the XPath variable ${shown} is not bound proměnná XPath ${shown} není svázána +@msg the action set ids are not a list ID sad akcí nejsou seznam +@msg the active paint is not a gradient aktivní nátěr není přechod +@msg the argument list is not an object seznam argumentů není objekt +@msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size pracovní plochy se nevejdou na plátno: zvolte méně pracovních ploch, menší rozestup nebo menší velikost +@msg the artwork is too large for EPS: what follows 256 MB of PostScript was left out kresba je pro EPS příliš velká: vše, co následuje po 256 MB PostScriptu, bylo vynecháno +@msg the bitmaps hold more pixels than one file may bitmapy obsahují více obrazových bodů, než smí mít jeden soubor +@msg the character's size can't be measured velikost znaku nelze změřit +@msg the code runs past its last instruction kód běží za svou poslední instrukci +@msg the compound shape is too complex to expand složený tvar je příliš složitý na rozložení +@msg the container of the listed objects is gone kontejner uvedených objektů už neexistuje +@msg the copy `{user_id}` can't be read as a library kopii `{user_id}` nelze přečíst jako knihovnu +@msg the copy would leave the canvas kopie by opustila plátno +@msg the curve tolerance must be from 0.01 to 10 points tolerance křivky musí být od 0.01 do 10 bodů +@msg the custom dictionary couldn't be saved to {_1}: {e} vlastní slovník nešlo uložit do {_1}: {e} +@msg the custom dictionary {_1} can't be read ({why}), so it is left as it is vlastní slovník {_1} nelze přečíst ({why}), proto zůstává beze změny +@msg the cut cannot be made on this art: {e} řez na této kresbě nelze provést: {e} +@msg the data isn't an EMF or WMF picture data nejsou obrázek EMF ani WMF +@msg the data isn't an EPS or PostScript picture data nejsou obrázek EPS ani PostScript +@msg the deferred paste is no longer available odložené vložení už není dostupné +@msg the design is too big to draw at every data point of this graph návrh je příliš velký na vykreslení v každém datovém bodě tohoto grafu +@msg the design is too big to draw in every column of this graph návrh je příliš velký na vykreslení v každém sloupci tohoto grafu +@msg the dialog it was opened over is no longer open dialog, nad kterým byl otevřen, už není otevřený +@msg the dictionary stack overflowed zásobník slovníků přetekl +@msg the document already has an SVG filter named {name} dokument už má filtr SVG s názvem {name} +@msg the document has another SVG filter named {name}: use svgFilter.apply, or svgFilter.define with `replace` to edit it dokument má jiný filtr SVG s názvem {name}: použijte svgFilter.apply, nebo ho upravte pomocí svgFilter.define s `replace` +@msg the document has no SVG filter named {name} dokument nemá žádný filtr SVG s názvem {name} +@msg the document has no SVG filter named {r} dokument nemá žádný filtr SVG s názvem {r} +@msg the document has no color swatches dokument nemá žádné barevné položky vzorníku +@msg the document's swatches hold {_1} colors; the document reduction takes at most 255 vzorník dokumentu obsahuje {_1} barev; redukce podle dokumentu jich přijímá nejvýše 255 +@msg the editing data's hash has no place pro hash dat pro úpravy není místo +@msg the entities the document declares expand to too much text entity, které dokument deklaruje, se rozvinou na příliš mnoho textu +@msg the envelope's content has no bounds obsah obálky nemá hranice +@msg the envelope's mesh is malformed síť obálky je poškozená +@msg the file holds no `variableSets` element soubor neobsahuje žádný prvek `variableSets` +@msg the file is larger than {_1} MB soubor je větší než {_1} MB +@msg the file is too large soubor je příliš velký +@msg the file isn't valid SVG: {e} soubor není platné SVG: {e} +@msg the file names no plate soubor neuvádí žádný výtažek +@msg the file was updated or encrypted already soubor už byl aktualizován nebo zašifrován +@msg the first character of a line has no character before it to kern: it moves only up and down (dy) první znak řádku nemá před sebou znak, vůči kterému by se vyrovnával: posouvá se jen nahoru a dolů (dy) +@msg the font {_1} is not available písmo {_1} není dostupné +@msg the format has no file extension formát nemá příponu souboru +@msg the function's prototype is not an object prototyp funkce není objekt +@msg the graphic can't be read: {e} grafiku nelze přečíst: {e} +@msg the graphic is empty grafika je prázdná +@msg the graphic's data is damaged data grafiky jsou poškozená +@msg the graphic's document has no artboard dokument grafiky nemá žádnou pracovní plochu +@msg the guide is hidden or locked vodítko je skryté nebo zamknuté +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them záhlaví `{cell}` pro `{name}` by se zpětně načetlo jako proměnná `{other}`: jednu z nich přejmenujte +@msg the image `{path}` isn't followed: {r} obrázek `{path}` se nenačítá: {r} +@msg the image has no embedded pixels obraz nemá žádné vložené obrazové body +@msg the image is empty obraz je prázdný +@msg the image is fully transparent obraz je zcela průhledný +@msg the image is not on an artboard; pass rect obraz není na pracovní ploše; předejte rect +@msg the image's pixels are missing chybí obrazové body obrazu +@msg the image's pixels aren't in the document obrazové body obrazu nejsou v dokumentu +@msg the image's pixels can't be read: {e} obrazové body obrazu nelze přečíst: {e} +@msg the image's transparency doesn't fit it průhlednost obrazu k němu nepasuje +@msg the job would print more than {MAX_PAGES} pages úloha by vytiskla více než {MAX_PAGES} stránek +@msg the job would print more than {_1} pages úloha by vytiskla více než {_1} stránek +@msg the layers hold no art to mask vrstvy neobsahují žádnou kresbu k maskování +@msg the layout moved rozvržení se posunulo +@msg the library has a group `{name}` already knihovna už má skupinu `{name}` +@msg the library has no group `{name}` knihovna nemá skupinu `{name}` +@msg the library has no item `{item}` knihovna nemá položku `{item}` +@msg the library has no item `{other}` knihovna nemá položku `{other}` +@msg the library holds {MAX_GROUPS} groups already knihovna už obsahuje {MAX_GROUPS} skupin +@msg the library holds {MAX_ITEMS} items of this kind already knihovna už obsahuje {MAX_ITEMS} položek tohoto druhu +@msg the library's file is outside the read roots soubor knihovny je mimo kořenové složky pro čtení +@msg the line is too long, or the paths it passes too many, to check čára je příliš dlouhá, nebo prochází přes příliš mnoho cest, takže ji nelze zkontrolovat +@msg the method needs an XML value metoda vyžaduje hodnotu XML +@msg the name is empty název je prázdný +@msg the object has no fill, stroke or effect objekt nemá výplň, tah ani efekt +@msg the object has no graphic style (pass `name`) objekt nemá grafický styl (předejte `name`) +@msg the objects don't match the plan objekty neodpovídají plánu +@msg the open and permissions passwords must differ heslo pro otevření a heslo pro oprávnění se musí lišit +@msg the operand stack overflowed zásobník operandů přetekl +@msg the page has no area stránka nemá plochu +@msg the page's type in an unread object's box isn't in its page art text stránky v rámečku nepřečteného objektu není v kresbě jeho stránky +@msg the paint behind the proxy is not a gradient nátěr za aktivním políčkem není přechod +@msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) nátěr není volný přechod (použijte ho pomocí paint.editGradient {kind}) +@msg the parameters or body do not form one function parametry nebo tělo netvoří jednu funkci +@msg the parent must be a layer or sublayer nadřazený prvek musí být vrstva nebo podvrstva +@msg the pasted SVG filter {name} draws differently from the document's filter of that name, and no free name fits it vložený filtr SVG {name} se vykresluje jinak než filtr dokumentu s tímto názvem a nehodí se pro něj žádný volný název +@msg the path can't be extended cestu nelze prodloužit +@msg the path can't be inside one of the objects to attach cesta nemůže být uvnitř některého z připojovaných objektů +@msg the path has no segments to measure cesta nemá žádné segmenty k měření +@msg the path is empty cesta je prázdná +@msg the path is too short to shorten that much cesta je příliš krátká na takové zkrácení +@msg the paths are too many or too tangled to find where they cross cest je příliš mnoho nebo jsou příliš zamotané, takže nelze najít, kde se kříží +@msg the pen table holds more than 255 pens tabulka per obsahuje více než 255 per +@msg the picture has no objects obrázek nemá žádné objekty +@msg the plates can't be kept výtažky nelze zachovat +@msg the position table does not match the instructions tabulka pozic neodpovídá instrukcím +@msg the program runs too long program běží příliš dlouho +@msg the program uses too much memory program používá příliš mnoho paměti +@msg the prompt's text is longer than {MAX_PROMPT_BYTES} bytes text výzvy je delší než {MAX_PROMPT_BYTES} bajtů +@msg the radix must be between 2 and 36 základ soustavy musí být mezi 2 a 36 +@msg the rectangle must have a width and a height obdélník musí mít šířku a výšku +@msg the rectangle needs a size and must lie on the canvas obdélník potřebuje velikost a musí ležet na plátně +@msg the rectangle or line reaches too many paths to check obdélník nebo čára zasahuje příliš mnoho cest, takže je nelze zkontrolovat +@msg the right side of 'in' is not an object pravá strana operátoru 'in' není objekt +@msg the right side of 'instanceof' is not a function pravá strana operátoru 'instanceof' není funkce +@msg the selected art has no width vybraná kresba nemá šířku +@msg the selected art is nested more than {MAX_DEPTH} levels deep vybraná kresba je vnořena hlouběji než {MAX_DEPTH} úrovní +@msg the selected art is too large to measure vybraná kresba je příliš velká na změření +@msg the selection draws nothing výběr nic nevykresluje +@msg the selection has no area výběr nemá plochu +@msg the selection has no art to export výběr nemá žádnou kresbu k exportu +@msg the selection has no bounds výběr nemá hranice +@msg the selection has no graphic style výběr nemá grafický styl +@msg the selection has no outlines to weed around výběr nemá žádné obrysy, kolem kterých by šlo vybírat +@msg the slice would leave the canvas řez by opustil plátno +@msg the spot colour couldn't be added přímou barvu nešlo přidat +@msg the subpath has no ends to extend (it is closed or a single point) dílčí cesta nemá konce k prodloužení (je uzavřená nebo je to jediný bod) +@msg the symbols are nested too deeply to expand their instances symboly jsou vnořeny příliš hluboko na rozložení jejich instancí +@msg the text file is too large to place as type (at most {_1} MB) textový soubor je příliš velký na umístění jako text (nejvýše {_1} MB) +@msg the text is empty text je prázdný +@msg the text is over {_1} MB text má více než {_1} MB +@msg the top object must be a path horní objekt musí být cesta +@msg the trace was cancelled vektorizace byla zrušena +@msg the trailer has no size zakončení nemá velikost +@msg the type object is flattened to nothing textový objekt se sloučením změní v nic +@msg the value bind was called on is not a function hodnota, na které byla zavolána bind, není funkce +@msg the value is not a constructor hodnota není konstruktor +@msg the value is not a function hodnota není funkce +@msg the value is not a valid XML name hodnota není platný název XML +@msg the value is not an XML attribute name hodnota není název atributu XML +@msg the value is not an XML name hodnota není název XML +@msg the value of axis `{tag}` must be a number or null hodnota osy `{tag}` musí být číslo nebo null +@msg the variable library declares more than {MAX_LIBRARY_DATASETS} data sets knihovna proměnných deklaruje více než {MAX_LIBRARY_DATASETS} sad dat +@msg the variable library declares more than {MAX_LIBRARY_ENTITIES} entities knihovna proměnných deklaruje více než {MAX_LIBRARY_ENTITIES} entit +@msg the variable library declares more than {MAX_LIBRARY_VARIABLES} variables knihovna proměnných deklaruje více než {MAX_LIBRARY_VARIABLES} proměnných +@msg the variable library declares no variables knihovna proměnných nedeklaruje žádné proměnné +@msg the variable library is larger than {MAX_LIBRARY_BYTES} bytes knihovna proměnných je větší než {MAX_LIBRARY_BYTES} bajtů +@msg the variable library is not UTF-8 knihovna proměnných není v UTF-8 +@msg the variable library is not well-formed XML: {e} knihovna proměnných není správně utvořené XML: {e} +@msg the variable library nests elements more than {MAX_LIBRARY_NESTING} deep knihovna proměnných vnořuje prvky hlouběji než {MAX_LIBRARY_NESTING} úrovní +@msg the variable library's document type declaration holds something other than entities of plain text deklarace typu dokumentu knihovny proměnných obsahuje něco jiného než entity s prostým textem +@msg the variable library's entities expand to more than {MAX_LIBRARY_BYTES} bytes entity knihovny proměnných se rozvinou na více než {MAX_LIBRARY_BYTES} bajtů +@msg the weeding lines cross the art's outlines too many times to measure; use fewer lines linie pro vybírání kříží obrysy kresby tolikrát, že je nelze změřit; použijte méně linií +@msg the weeding lines pass too close to too many outline segments to measure; use fewer lines or a smaller gap linie pro vybírání procházejí příliš blízko příliš mnoha segmentů obrysu, takže je nelze změřit; použijte méně linií nebo menší mezeru +@msg the weeding lines would be more than {max_pieces} pieces linie pro vybírání by tvořily více než {max_pieces} dílů +@msg the window has no dock okno nemá žádný dok +@msg the written PDF has no catalog zapsané PDF nemá katalog +@msg the written PDF has no cross-reference table zapsané PDF nemá tabulku křížových odkazů +@msg the written PDF's metadata can't be edited metadata zapsaného PDF nelze upravit +@msg the {_1} plate lies outside the file výtažek {_1} leží mimo soubor +@msg there are no colour swatches to draw nejsou žádné barevné položky vzorníku k vykreslení +@msg there is already a design named `{name}` návrh s názvem `{name}` už existuje +@msg there is already a design named `{to}` návrh s názvem `{to}` už existuje +@msg there is already a toolbar named `{name}` panel nástrojů s názvem `{name}` už existuje +@msg there is already a toolbar named `{to}` panel nástrojů s názvem `{to}` už existuje +@msg there is no library: create one first žádná knihovna neexistuje: nejprve ji vytvořte +@msg these paths are too degenerate for Shaper tyto cesty jsou pro Shaper příliš degenerované +@msg this is a binary DXF file, which can't be read: save it from the CAD app as an ASCII DXF and open that toto je binární soubor DXF, který nelze přečíst: uložte ho z aplikace CAD jako ASCII DXF a otevřete ten +@msg this warp's points can't be edited: use Reset with Mesh first body této deformace nelze upravovat: nejprve použijte Obnovit se sítí +@msg thumbnail: no page {v} (the {what} has {count}) miniatura: stránka {v} neexistuje ({what} jich má {count}) +@msg tileRange of {what}: {e} tileRange pro {what}: {e} +@msg title can't be empty title nesmí být prázdné +@msg to (the new name) is required to (nový název) je povinné +@msg to must be fill or stroke to musí být fill nebo stroke +@msg to must be smooth or corner to musí být smooth nebo corner +@msg toExponential() digits must be between 0 and 20 počet číslic pro toExponential() musí být mezi 0 a 20 +@msg toFixed() digits must be between 0 and 20 počet číslic pro toFixed() musí být mezi 0 a 20 +@msg toISOString is not a function toISOString není funkce +@msg toPrecision() argument must be between 1 and 21 argument toPrecision() musí být mezi 1 a 21 +@msg toSource: a getter cannot be written as source toSource: getter nelze zapsat jako zdrojový kód +@msg toSource: an array with properties besides its elements, a property that is not enumerable or another prototype cannot be written as source toSource: pole s vlastnostmi mimo své prvky, s vlastností, která není výčtová, nebo s jiným prototypem nelze zapsat jako zdrojový kód +@msg toSource: an object with a property that is not enumerable, or whose prototype is not Object.prototype, cannot be written as source toSource: objekt s vlastností, která není výčtová, nebo jehož prototyp není Object.prototype, nelze zapsat jako zdrojový kód +@msg toSource: the source is too long toSource: zdrojový kód je příliš dlouhý +@msg toSource: the value contains itself toSource: hodnota obsahuje sama sebe +@msg toSource: the value has too many entries toSource: hodnota má příliš mnoho položek +@msg toSource: the value is nested too deep toSource: hodnota je vnořena příliš hluboko +@msg toString is not a function toString není funkce +@msg too large for a zip archive: package to a folder příliš velké pro archiv zip: zabalte do složky +@msg too many Shaper edits příliš mnoho úprav Shaper +@msg too many `points` (at most 100000) příliš mnoho `points` (nejvýše 100000) +@msg too many arguments příliš mnoho argumentů +@msg too many characters: at most {MAX_CHARS} příliš mnoho znaků: nejvýše {MAX_CHARS} +@msg too many dots for this size: lower the frequency příliš mnoho bodů pro tuto velikost: snižte frekvenci +@msg too many filters over one file příliš mnoho filtrů nad jedním souborem +@msg too many overlapping paths for Shaper příliš mnoho překrývajících se cest pro Shaper +@msg too many quantifiers příliš mnoho kvantifikátorů +@msg too many saved clips příliš mnoho uložených ořezů +@msg too many saved graphics states příliš mnoho uložených grafických stavů +@msg toolbar (a toolbar's name) must be a string toolbar (název panelu nástrojů) musí být řetězec +@msg toolbar name can't be empty název panelu nástrojů nesmí být prázdný +@msg transparentImages {v}: "flatten" (the default) or "omit" transparentImages {v}: "flatten" (výchozí) nebo "omit" +@msg two saved selections would be named `{_1}` dva uložené výběry by se jmenovaly `{_1}` +@msg type dimension cannot be represented with this text transform rozměr textu nelze vyjádřit touto transformací textu +@msg type dimension must be finite rozměr textu musí být konečný +@msg unexpected resources neočekávané prostředky +@msg unknown CMYK profile `{name}` neznámý profil CMYK `{name}` +@msg unknown File Info field `{k}` neznámé pole informací o souboru `{k}` +@msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; prefix - to turn off; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take an alternate's number as `tag=N` with N from 0 to {_1}, as `salt=2`) neznámá funkce OpenType `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; předpona - funkci vypne; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom a aalt přijímají číslo alternativy jako `tag=N` s N od 0 do {_1}, například `salt=2`) +@msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) neznámá funkce OpenType `{t}` ve featureChanges (značky, které přijímá `features`) +@msg unknown PDF preset `{name}` (presets: {_1}) neznámé přednastavení PDF `{name}` (přednastavení: {_1}) +@msg unknown Warp style neznámý styl deformace +@msg unknown alignToPath `{a}` neznámé alignToPath `{a}` +@msg unknown arrowhead {v} neznámá šipka {v} +@msg unknown artboardLayout key `{k}` (layout, columns, spacing, rightToLeft) neznámý klíč artboardLayout `{k}` (layout, columns, spacing, rightToLeft) +@msg unknown attribute `{attribute}` neznámý atribut `{attribute}` +@msg unknown attribute `{k}` neznámý atribut `{k}` +@msg unknown axis `{other}` (vertical|horizontal|free) neznámá osa `{other}` (vertical|horizontal|free) +@msg unknown blend mode `{b}` neznámý režim míchání `{b}` +@msg unknown blend mode {b} neznámý režim míchání {b} +@msg unknown brush type `{o}` neznámý typ štětce `{o}` +@msg unknown category `{c}` neznámá kategorie `{c}` +@msg unknown category `{c}` ({_1}) neznámá kategorie `{c}` ({_1}) +@msg unknown character `{c}` neznámý znak `{c}` +@msg unknown character style number field neznámé číselné pole stylu znaků +@msg unknown dither `{d}` (diffusion, pattern, noise or none) neznámý rozklad barev `{d}` (diffusion, pattern, noise nebo none) +@msg unknown effect `{e}` neznámý efekt `{e}` +@msg unknown end {e} neznámý konec {e} +@msg unknown flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution or a saved one: see flattener.presets.list) neznámé flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution nebo uložené přednastavení: viz flattener.presets.list) +@msg unknown format `{f}` (vcswatches, gpl, ase or css) neznámý formát `{f}` (vcswatches, gpl, ase nebo css) +@msg unknown from {f} neznámé from {f} +@msg unknown graph type `{t}` neznámý typ grafu `{t}` +@msg unknown grid colours `{name}` (one of {_1}) neznámé barvy mřížky `{name}` (jedna z hodnot {_1}) +@msg unknown gridType `{t}` neznámé gridType `{t}` +@msg unknown highlight `{v}` neznámé zvýraznění `{v}` +@msg unknown intent `{i}` neznámý záměr `{i}` +@msg unknown issue kind {id} neznámý druh problému {id} +@msg unknown issue kind {v} neznámý druh problému {v} +@msg unknown knockout state {k} neznámý stav vykrojení {k} +@msg unknown language `{language}` (one of {_1}) neznámý jazyk `{language}` (jeden z {_1}) +@msg unknown language `{l}` (one of {_1}) neznámý jazyk `{l}` (jeden z {_1}) +@msg unknown method `{m}` ({_1}) neznámá metoda `{m}` ({_1}) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) neznámý režim `{other}` (gray, rgb, hsb, lab, cmyk nebo web) +@msg unknown mode `{other}` (mono|cmyk) neznámý režim `{other}` (mono|cmyk) +@msg unknown mode `{other}` (rgb|cmyk|gray|global) neznámý režim `{other}` (rgb|cmyk|gray|global) +@msg unknown mode `{other}` (set, add, subtract) neznámý režim `{other}` (set, add, subtract) +@msg unknown mode `{o}` neznámý režim `{o}` +@msg unknown mode {m} neznámý režim {m} +@msg unknown model `{other}` neznámý model `{other}` +@msg unknown model `{other}` (keep, new or document) neznámý model `{other}` (keep, new nebo document) +@msg unknown op {o} neznámé op {o} +@msg unknown order `{o}`: toggle, front, forward, backward or back neznámé pořadí `{o}`: toggle, front, forward, backward nebo back +@msg unknown overprints `{v}` (preserve, simulate or discard) neznámé overprints `{v}` (preserve, simulate nebo discard) +@msg unknown panel neznámý panel +@msg unknown panel `{panel}` neznámý panel `{panel}` +@msg unknown parameter `{key}` neznámý parametr `{key}` +@msg unknown parameter `{within}settings.{format}`; {why} neznámý parametr `{within}settings.{format}`; {why} +@msg unknown parameter `{within}{key}`; {why} neznámý parametr `{within}{key}`; {why} +@msg unknown pieLegend `{v}` (none, standard or wedges) neznámé pieLegend `{v}` (none, standard nebo wedges) +@msg unknown piePosition `{v}` (even, ratio or stacked) neznámé piePosition `{v}` (even, ratio nebo stacked) +@msg unknown pieSort `{v}` (none, all or first) neznámé pieSort `{v}` (none, all nebo first) +@msg unknown plate `{n}` neznámý výtažek `{n}` +@msg unknown preference `{k}` neznámá předvolba `{k}` +@msg unknown profile {id} (see stroke.widthProfile.list) neznámý profil {id} (viz stroke.widthProfile.list) +@msg unknown proof target `{t}` neznámý cíl nátisku `{t}` +@msg unknown quotes key `{k}` (double, single) neznámý klíč quotes `{k}` (double, single) +@msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) neznámá redukce `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform nebo document) +@msg unknown resolution `{v}` neznámé rozlišení `{v}` +@msg unknown rule `{rule}` ({_1}) neznámé pravidlo `{rule}` ({_1}) +@msg unknown rule `{r}` (see color.harmony) neznámé pravidlo `{r}` (viz color.harmony) +@msg unknown setting `{k}` neznámé nastavení `{k}` +@msg unknown shape `{v}` (circle|ellipse|square|diamond|line) neznámý tvar `{v}` (circle|ellipse|square|diamond|line) +@msg unknown spacing `{o}` (smooth|steps|distance) neznámé rozestupy `{o}` (smooth|steps|distance) +@msg unknown tileType `{t}` ({_1}) neznámé tileType `{t}` ({_1}) +@msg unknown units neznámé jednotky +@msg unknown units `{u}` neznámé jednotky `{u}` +@msg unknown value axis `{v}` (left, right or both) neznámá osa hodnot `{v}` (left, right nebo both) +@msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) neznámá variace `{v}` (tintsShades|warmCool|vividMuted) +@msg unknown warp style `{s}` neznámý styl deformace `{s}` +@msg unknown {key} `{v}` (none, short or full) neznámé {key} `{v}` (none, short nebo full) +@msg unknown {key} profile `{n}` neznámý profil {key} `{n}` +@msg unknown {k} key `{key}` (size, position) neznámý klíč {k} `{key}` (size, position) +@msg unmatched ')' nespárovaná ')' +@msg unreadable object nečitelný objekt +@msg unsafe destination file name nebezpečný název cílového souboru +@msg unterminated character class neukončená třída znaků +@msg unterminated group neukončená skupina +@msg use paths or compound paths použijte cesty nebo složené cesty +@msg useArtboards must be true or false, not {v} useArtboards musí být true nebo false, ne {v} +@msg value for `{var}` must match its variable kind hodnota pro `{var}` musí odpovídat druhu její proměnné +@msg variable `{_1}` is already defined proměnná `{_1}` je už definována +@msg variable `{name}` has no `trait` proměnná `{name}` nemá `trait` +@msg variable `{name}` is already defined proměnná `{name}` je už definována +@msg variable `{name}` is declared twice proměnná `{name}` je deklarována dvakrát +@msg variable `{to}` already exists proměnná `{to}` už existuje +@msg view is required view je povinné +@msg view must be one of {_1} view musí být jedna z hodnot {_1} +@msg warpStyle can only edit an applied Warp effect warpStyle může upravit jen použitý efekt Deformace +@msg width and height must be more than 0 and at most {limit} width a height musí být více než 0 a nejvýše {limit} +@msg width factors must be finite koeficienty šířky musí být konečné +@msg width must be positive width musí být kladné +@msg width out of range šířka je mimo rozsah +@msg width/height must be > 0 width/height musí být > 0 +@msg wordGap and lineGap need area type in the selection wordGap a lineGap vyžadují ve výběru text v oblasti +@msg x and y must be finite numbers x a y musí být konečná čísla +@msg x and y must be given together x a y je nutné zadat společně +@msg xpath needs its variables as an object xpath vyžaduje své proměnné jako objekt +@msg xpath needs the expression as a string xpath vyžaduje výraz jako řetězec +@msg zone needs an anchor: dock beside a panel with anchor, or in a new dock column with side (Start or End) zone vyžaduje kotvu: ukotvěte vedle panelu pomocí anchor, nebo do nového sloupce doku pomocí side (Start nebo End) +@msg zoom must be positive zoom musí být kladné +@msg {C}: no effect at index {list} {C}: na indexu {list} není žádný efekt +@msg {DEFAULT_PRESET} is protected and stays {DEFAULT_PRESET} je chráněné a zůstává +@msg {DEFAULT_PRESET} is protected: save the settings under another name {DEFAULT_PRESET} je chráněné: uložte nastavení pod jiným názvem +@msg {GRANT_NOT_REMOVED}, and its settings and cache can't be moved back from {_1} to {_2}: {e} {GRANT_NOT_REMOVED} a jeho nastavení a mezipaměť nelze přesunout zpět z {_1} do {_2}: {e} +@msg {LABEL} produced an empty result {LABEL} vytvořilo prázdný výsledek +@msg {_1} MB of document, at most {_2} MB {_1} MB dokumentu, nejvýše {_2} MB +@msg {_1} MB of images, at most {_2} MB {_1} MB obrázků, nejvýše {_2} MB +@msg {_1} bytes of RGBA data for a {width} × {height} image {_1} bajtů dat RGBA pro obraz {width} × {height} +@msg {_1} can't be read, or changed since it was read: relink or update it first {_1} nelze přečíst, nebo se od přečtení změnil: nejprve ho znovu propojte nebo aktualizujte +@msg {_1} can't go into {into} {_1} nelze vložit do {into} +@msg {_1} can't limit printing to low resolution: choose PDF 1.4 or later, or allow high-resolution printing {_1} nemůže omezit tisk na nízké rozlišení: zvolte PDF 1.4 nebo novější, nebo povolte tisk ve vysokém rozlišení +@msg {_1} files can't be opened yet soubory {_1} zatím nelze otevřít +@msg {_1} files can't be password-protected: remove the passwords or choose no standard soubory {_1} nelze chránit heslem: odeberte hesla nebo nezvolte žádný standard +@msg {_1} files can't be {_2} soubory {_1} nemohou být {_2} +@msg {_1} files can't carry editing data: turn off preserveEditing soubory {_1} nemohou obsahovat data pro úpravy: vypněte preserveEditing +@msg {_1} files can't have PDF layers: turn off createLayers soubory {_1} nemohou mít vrstvy PDF: vypněte createLayers +@msg {_1} files need a creation date, and this platform has no clock to give one soubory {_1} vyžadují datum vytvoření a tato platforma nemá hodiny, které by ho poskytly +@msg {_1} is not a folder: {e} {_1} není složka: {e} +@msg {_1} isn't a path {_1} není cesta +@msg {_1} options: {e} volby {_1}: {e} +@msg {_1} paints nothing to rasterize {_1} nevykresluje nic, co by šlo rastrovat +@msg {_1} passwords can have up to {MAX_LEGACY_PASSWORD} ASCII characters (PDF 1.7 and later take any) hesla {_1} mohou mít nejvýše {MAX_LEGACY_PASSWORD} znaků ASCII (PDF 1.7 a novější přijímají libovolné znaky) +@msg {_1} with linked images or an image map writes several files: use document.export {_1} s propojenými obrázky nebo obrazovou mapou zapisuje několik souborů: použijte document.export +@msg {_1} writes one file per artboard here: use document.export, or name one artboard {_1} zde zapisuje jeden soubor na každou pracovní plochu: použijte document.export, nebo uveďte jednu pracovní plochu +@msg {_1} × {_2} pixels is too large for {_3} (at most {max} pixels a side): lower the scale {_1} × {_2} obrazových bodů je pro {_3} příliš mnoho (nejvýše {max} obrazových bodů na stranu): zmenšete měřítko +@msg {_1}: belongs to another account {_1}: patří jinému účtu +@msg {_1}: not a folder of its own {_1}: nejde o jeho vlastní složku +@msg {_1}: not a plain file {_1}: nejde o obyčejný soubor +@msg {_1}: {_2} and {_3} are in the way {_1}: překáží {_2} a {_3} +@msg {code}: {0} {code}: {0} +@msg {dest}: {e} {dest}: {e} +@msg {dir}: {e} {dir}: {e} +@msg {doc} has no folder {doc} nemá složku +@msg {file} isn't linked {file} není propojený +@msg {file} names more than one linked JavaScript file {file} uvádí více než jeden propojený soubor JavaScript +@msg {folder} is not a package folder {folder} není složka balíčku +@msg {folder}: more than {max} files and folders {folder}: více než {max} souborů a složek +@msg {folder}: {e} {folder}: {e} +@msg {g} is not a Live Paint group {g} není skupina živé malby +@msg {id} is not a slice {id} není řez +@msg {key} must be 0–{MAX_ADD_AROUND} pt {key} musí být 0–{MAX_ADD_AROUND} pt +@msg {key} must be [x,y] {key} musí být [x,y] +@msg {key} must be a percentage {min}..100 {key} musí být procento {min}..100 +@msg {key} must be a positive number, not {n} {key} musí být kladné číslo, ne {n} +@msg {key} must be a positive number, not {v} {key} musí být kladné číslo, ne {v} +@msg {key} must be one of {_1} {key} musí být jedna z hodnot {_1} +@msg {key} must be {_1}, got {s} {key} musí být {_1}, zadáno {s} +@msg {key} must name a floating panel {key} musí uvádět plovoucí panel +@msg {key} must name a panel in another group {key} musí uvádět panel v jiné skupině +@msg {key} must name a panel that shows {key} musí uvádět panel, který je zobrazen +@msg {key} must name a registered panel {key} musí uvádět registrovaný panel +@msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) soubory {kind} nemají průhlednost a soubor by obsahoval {what}: nejprve ji slučte (object.flattenTransparency) +@msg {kind} images can't be opened (see document.formats) obrázky {kind} nelze otevřít (viz document.formats) +@msg {k} `{v}` is not one of the choices {k} `{v}` není jedna z nabízených voleb +@msg {k} has control characters{_1} {k} obsahuje řídicí znaky{_1} +@msg {k} is too long (at most {MAX_TEXT} characters) {k} je příliš dlouhé (nejvýše {MAX_TEXT} znaků) +@msg {k} must be > 0 {k} musí být > 0 +@msg {k} must be a number (pt) or a length such as "210 mm" {k} musí být číslo (pt) nebo délka jako "210 mm" +@msg {k} must be a number from {min} to {max} {k} musí být číslo od {min} do {max} +@msg {k} must be a number or "auto" {k} musí být číslo nebo "auto" +@msg {k} must be a string {k} musí být řetězec +@msg {k} must be text {k} musí být text +@msg {k} must be true or false {k} musí být true nebo false +@msg {k} must be {{size?, position?}} {k} musí být {{size?, position?}} +@msg {k}: a custom arrowhead's path needs an area to fill and at most {most} anchors and {most} subpaths, each anchor within {far} head units of its tip {k}: cesta vlastní šipky potřebuje plochu k vyplnění a nejvýše {most} kotevních bodů a {most} dílčích cest, každý kotevní bod nejdále {far} jednotek hrotu od její špičky +@msg {k}: bad custom arrowhead path: {e} {k}: chybná cesta vlastní šipky: {e} +@msg {k}: bad custom arrowhead: {e} {k}: chybná vlastní šipka: {e} +@msg {k}: can't read `{s}` as a length {k}: `{s}` nelze přečíst jako délku +@msg {k}: custom must be a name {k}: custom musí být název +@msg {label} must be a number at most {max} {label} musí být číslo nejvýše {max} +@msg {label} must be a number from -1296 to 1296 {label} musí být číslo od -1296 do 1296 +@msg {label} must be a number from 1 to 10000 {label} musí být číslo od 1 do 10000 +@msg {name} `{s}`: {ids} {name} `{s}`: {ids} +@msg {name} is built in and can't be deleted {name} je vestavěné a nelze ho odstranit +@msg {name} must be a number {name} musí být číslo +@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} musí být {lo}–{hi}{unit} (zadáno {v}) +@msg {name}: CRC or size mismatch {name}: nesouhlasí CRC nebo velikost +@msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: z tohoto souboru Affinity šlo přečíst jen vložený náhled; pomocí Soubor › Otevřít ho zobrazíte s varováním, nebo před umístěním exportujte SVG či PDF z Affinity +@msg {name}: {e} {name}: {e} +@msg {native}; its embedded preview can't be read either ({e}) {native}; jeho vložený náhled také nelze přečíst ({e}) +@msg {path}: copy takes a DCS file only when its plates are inside it; relink to it where its plate files are {path}: copy přijímá soubor DCS, jen když jsou jeho výtažky uvnitř něj; propojte ho znovu tam, kde jsou soubory jeho výtažků +@msg {path}: larger than {_1} MB {path}: větší než {_1} MB +@msg {shown} is not an XPath 1.0 function {shown} není funkce XPath 1.0 +@msg {std} files are CMYK, and the file would have colours in {_1} soubory {std} jsou CMYK a soubor by obsahoval barvy v {_1} +@msg {std} files embed their fonts, and the file would have one that isn't soubory {std} vkládají svá písma a soubor by obsahoval písmo, které vložené není +@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway {target} je soubor, ze kterého byl tento dokument načten, a při čtení bylo něco vynecháno ({what}): přepsáním by se to nenávratně ztratilo. Zapište místo toho jiný soubor, nebo předejte acknowledgeLoss: true, chcete-li ho přesto nahradit +@msg {ty} brushes need selected art (or params.{k}) štětce typu {ty} vyžadují vybranou kresbu (nebo params.{k}) +@msg {v} is not an asset id {v} není ID prvku +@msg {v} names no layer or sublayer {v} neuvádí žádnou vrstvu ani podvrstvu +@msg {what} can't be intertwined {what} nelze proplést +@msg {what} doesn't fit the paper with its bleed and marks {what} se na papír se spadávkou a značkami nevejde +@msg {what} is not a function {what} není funkce +@msg {what} would print more than {MAX_COPIES_PER_SHEET} copies on a sheet: scale it up {what} by vytisklo více než {MAX_COPIES_PER_SHEET} kopií na arch: zvětšete měřítko +@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} by se vytisklo na více než {MAX_TILES} dlaždic: zmenšete měřítko +@msg {what} {i} out of range {what} {i} je mimo rozsah +@msg `{key}` must be from 0.01 to 1000 pt `{key}` musí být od 0.01 do 1000 pt +@msg select the banner, or mark every artboard vyberte banner, nebo označte každou pracovní plochu +@msg the banner has no width or height banner nemá šířku nebo výšku +@msg the grommet inset is too large for the banner odstup průchodek od okraje je pro banner příliš velký +@msg the hem is too deep for the banner lem je pro banner příliš hluboký +@msg the spacing makes more than {MAX_GROMMETS} grommets při tomto rozestupu vznikne více než {MAX_GROMMETS} průchodek +@msg there is no banner to mark není žádný banner k označení +@msg turn on at least one side zapněte alespoň jednu stranu +@msg with no hem and no grommets there is nothing to mark bez lemu a bez průchodek není co označit +@msg {saving} failed: {e} {saving} se nezdařilo: {e} diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 433c6af3d6..b3de0ae89a 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -194,6 +194,8 @@ Crop Image Beskær billede Image Tools Billedværktøjer Remove Background… Fjern baggrund… + Draw (Pencil) Tegn (blyant) + Place Image Placér billede Remove Background Fjern baggrund Background Baggrund Edge Color Kantfarve @@ -924,6 +926,7 @@ VectorCraft Title Bar on Every Desktop VectorCrafts titellinje på alle skriveborde The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Miljøvariablen VECTORCRAFT_TITLEBAR vælger titellinjen, så længe den er angivet. System Title Bar takes precedence over this option while it is on. Systemtitellinje har forrang for denne indstilling, så længe den er slået til. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Så længe VectorCrafts titellinje på alle skriveborde er slået fra, tegner dette skrivebord vinduets titellinje, uanset om denne indstilling er slået til eller fra. Exit Afslut Distort Forvræng Diffuse Glow… Diffus glød… @@ -1506,6 +1509,7 @@ lighting Light Lys Proportional Metrics Proportionale metrikker Insert Aki Left Indsæt aki til venstre Insert Aki Right Indsæt aki til højre + Tsume Tsume Character Direction Tegnretning Digits Cifre Arabic Arabisk @@ -4795,11 +4799,11 @@ imageTrace Outline Kontur @msg unknown effect `{id}` ukendt effekt `{id}` @msg unknown format ukendt format @msg unknown format `{f}` (Save writes {_1}) ukendt format `{f}` (Gem skriver {_1}) -@msg unknown freeform mode `{m}` (points, lines) ukendt freeform-tilstand `{m}` (punkter, linjer) -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) ukendt gradienttype `{k}` (lineær, radial, konisk, diamant, freeform) +@msg unknown freeform mode `{m}` (points, lines) ukendt freeform-tilstand `{m}` (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) ukendt gradienttype `{k}` (linear, radial, conic, diamond, freeform) @msg unknown highlight `{h}` ukendt fremhævning `{h}` @msg unknown option `{path}.{k}` ukendt indstilling `{path}.{k}` -@msg unknown overprints `{o}` (preserve, simulate or discard) ukendt overprint `{o}` (bevar, simulér eller forkast) +@msg unknown overprints `{o}` (preserve, simulate or discard) ukendt overprint `{o}` (preserve, simulate eller discard) @msg unknown panel `{raw}` ukendt panel `{raw}` @msg unknown preference `{key}` ukendt præference `{key}` @msg Preferences imported. Præferencerne er importeret. @@ -4817,10 +4821,10 @@ imageTrace Outline Kontur @msg `{key}` must be an object `{key}` skal være et objekt @msg `prefs.import` runs on its own, not as a batch step `prefs.import` køres alene, ikke som et trin i en batch @msg unknown preset (one of {_1}) ukendt forudindstilling (én af {_1}) -@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) ukendt forudindstilling `{name}` (høj, mellem, lav eller en gemt: se flattener.presets.list) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) ukendt forudindstilling `{name}` (high, medium, low eller en gemt: se flattener.presets.list) @msg unknown preset `{name}` (see flattener.presets.list) ukendt forudindstilling `{name}` (se flattener.presets.list) @msg unknown preset `{name}` (see webExport.presets.list) ukendt forudindstilling `{name}` (se webExport.presets.list) -@msg unknown side `{other}` (left|right|top|bottom) ukendt side `{other}` (venstre|højre|top|bund) +@msg unknown side `{other}` (left|right|top|bottom) ukendt side `{other}` (left|right|top|bottom) @msg unknown tool `{tool}` ukendt værktøj `{tool}` @msg unknown tool `{t}` ukendt værktøj `{t}` @msg unknown tool or command `{key}` ukendt værktøj eller kommando `{key}` @@ -6073,6 +6077,8 @@ axis Y Axis Y-akse Action Options… Indstillinger for handling… Action Options Indstillinger for handling Playback Options… Afspilningsindstillinger… + Button Mode Knaptilstand + No actions. Ingen handlinger. Insert Stop… Indsæt stop… Insert Stop Indsæt stop Record Stop Optag stop @@ -6874,6 +6880,12 @@ breakText Glyphs Glyffer @msg open the practice sample of `{id}` first (see learn.openSample) åbn først øvelseseksemplet til `{id}` (se learn.openSample) @msg finish `{id}` first (see learn.finish) afslut først `{id}` (se learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` er den sidste vejledning i sin færdighed + Reset progress Nulstil fremskridt + Mark Tutorial Step Markér trin i vejledning + Reset Learn Progress Nulstil læringsfremskridt +@msg missing `step` (see learn.show) `step` mangler (se learn.show) +@msg `step` must be a step number from 0 to {last} `step` skal være et trinnummer fra 0 til {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` er afsluttet (se learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Opdatér udskudte effekter diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 951f6f9c37..d0610144ef 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -684,6 +684,8 @@ font-technology Variable Variabel Crop Image Bild beschneiden Image Tools Bildwerkzeuge Remove Background… Hintergrund entfernen… + Draw (Pencil) Zeichnen (Buntstift) + Place Image Bild platzieren Remove Background Hintergrund entfernen Background Hintergrund Edge Color Randfarbe @@ -2630,6 +2632,7 @@ mark-style Japanese Japanisch Proportional Metrics Proportionale Metrik Insert Aki Left Aki links einfügen Insert Aki Right Aki rechts einfügen + Tsume Tsume Character Direction Zeichenrichtung Digits Ziffern Arabic Arabisch @@ -4412,6 +4415,7 @@ theme Appearance Erscheinungsbild @msg `select` must be true or false `select` muss true oder false sein @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` und `maxAnchors` müssen ganze Zahlen sein @msg `{key}` must be a number not below 0 `{key}` muss eine Zahl nicht kleiner als 0 sein +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` muss aus vier Zahlen nicht kleiner als 0 bestehen: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` muss [x, y, width, height] sein: vier endliche Zahlen, Breite und Höhe nicht negativ @msg `{min_key}` is greater than `{max_key}` `{min_key}` ist größer als `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` geben Sie mindestens einen der Parameter `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` an @@ -4665,6 +4669,7 @@ theme Appearance Erscheinungsbild @msg no action set to save kein Aktionssatz zum Speichern @msg the action set file can't be read in full die Aktionssatzdatei kann nicht vollständig gelesen werden @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out „{name}“ geladen: {n} Schritt wurde ausgelassen|„{name}“ geladen: {n} Schritte wurden ausgelassen +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` „{name}“ geladen: {n} Schritt hat einen unbekannten Befehl und wurde behalten: „{action}“, Schritt {step}, `{command}`|„{name}“ geladen: {n} Schritte haben unbekannte Befehle und wurden behalten; der erste: „{action}“, Schritt {step}, `{command}` @msg not an action set file keine Aktionssatzdatei @msg the action set file is larger than 8 MiB die Aktionssatzdatei ist größer als 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: die Referenz wäre größer als {MAX_BYTES} Byte @@ -4906,6 +4911,7 @@ theme Appearance Erscheinungsbild @msg tool shortcuts must be a single key (optionally with Shift) Tastaturbefehle für Werkzeuge müssen aus einer einzelnen Taste bestehen (optional mit Shift) @msg truncated abgeschnitten @msg unknown command `{0}` unbekannter Befehl `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` Schritt {step} von „{action}“ führt den unbekannten Befehl `{command}` aus @msg unknown command `{0}`; did you mean `{1}`? unbekannter Befehl `{0}`; meinten Sie `{1}`? @msg unknown effect `{id}` unbekannter Effekt `{id}` @msg unknown format unbekanntes Format @@ -5219,6 +5225,7 @@ theme Appearance Erscheinungsbild VectorCraft Title Bar on Every Desktop VectorCraft-Titelleiste auf jedem Desktop The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Solange die Umgebungsvariable VECTORCRAFT_TITLEBAR gesetzt ist, bestimmt sie die Titelleiste. System Title Bar takes precedence over this option while it is on. Solange Systemtitelleiste eingeschaltet ist, hat sie Vorrang vor dieser Option. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Solange VectorCraft-Titelleiste auf jedem Desktop ausgeschaltet ist, zeichnet dieser Desktop die Titelleiste des Fensters, ob diese Option ein- oder ausgeschaltet ist. # Brush Options: Scatter, Art and Pattern brushes. Scatter Brush Options Optionen für Spezialpinsel Art Brush Options Optionen für Bildpinsel @@ -5981,8 +5988,8 @@ axis Y Axis Y-Achse @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` ein Export-Plug-in gibt 1 bis {MAX_EXTENSIONS} `extensions` an @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` höchstens {MAX_UNGROUPED} Parameter außerhalb von Gruppen: Geben Sie den anderen eine `group` @msg can't encode the input die Eingabe kann nicht codiert werden -@msg expected {"dataBase64"} erwartet: {"dataBase64"} -@msg expected {"objects"} erwartet: {"objects"} +@msg expected {{"dataBase64": "…"}} erwartet: {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} erwartet: {{"objects": [...]}} @msg export `{name}`: {e} Modulexport `{name}`: {e} @msg extension {e} is listed twice die Dateiendung {e} ist doppelt aufgeführt @msg extension {e}: use 1-16 lower-case letters and digits, without the dot Dateiendung {e}: Verwenden Sie 1-16 Kleinbuchstaben und Ziffern, ohne Punkt @@ -6046,11 +6053,11 @@ axis Y Axis Y-Achse @msg a painted live effect returns only `objects` ein malender Live-Effekt gibt nur `objects` zurück @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` ein Teil eines malenden Live-Effekts hat nur `path`, `fillRule`, `fills` und `strokes` @msg a read-only object was left out ein schreibgeschütztes Objekt wurde weggelassen -@msg a read-only object was left out: return it, as {"id"} alone or as it was given ein schreibgeschütztes Objekt wurde weggelassen: Geben Sie es zurück, als {"id"} allein oder so, wie es übergeben wurde +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given ein schreibgeschütztes Objekt wurde weggelassen: Geben Sie es zurück, als {{"id": …}} allein oder so, wie es übergeben wurde @msg a string eine Zeichenkette @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` eine Kontur hat nur `paint`, `width`, `join`, `cap` und `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} eine Kontur muss {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} sein -@msg an effect must be {"id", "params"?, "visible"?} ein Effekt muss {"id", "params"?, "visible"?} sein +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} eine Kontur muss {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} sein +@msg an effect must be {{"id", "params"?, "visible"?}} ein Effekt muss {{"id", "params"?, "visible"?}} sein @msg an effect on a fill returns only `fills` ein Effekt auf einer Fläche gibt nur `fills` zurück @msg an effect on a stroke returns only `strokes` ein Effekt auf einer Kontur gibt nur `strokes` zurück @msg an object must be a JSON object ein Objekt muss ein JSON-Objekt sein @@ -6192,6 +6199,8 @@ axis Y Axis Y-Achse Action Options… Aktionsoptionen… Action Options Aktionsoptionen Playback Options… Wiedergabeoptionen… + Button Mode Schaltflächenmodus + No actions. Keine Aktionen. Insert Stop… Stopp einfügen… Insert Stop Stopp einfügen Record Stop Stopp aufzeichnen @@ -7059,6 +7068,12 @@ breakText Glyphs Glyphen @msg open the practice sample of `{id}` first (see learn.openSample) öffnen Sie zuerst die Übungsdatei von `{id}` (siehe learn.openSample) @msg finish `{id}` first (see learn.finish) schließen Sie zuerst `{id}` ab (siehe learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` ist das letzte Lernprogramm seiner Fertigkeit + Reset progress Fortschritt zurücksetzen + Mark Tutorial Step Schritt des Lernprogramms markieren + Reset Learn Progress Lernfortschritt zurücksetzen +@msg missing `step` (see learn.show) `step` fehlt (siehe learn.show) +@msg `step` must be a step number from 0 to {last} `step` muss eine Schrittnummer von 0 bis {last} sein +@msg `{id}` is finished (see learn.resetProgress) `{id}` ist abgeschlossen (siehe learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Zurückgestellte Effekte aktualisieren @@ -8887,6 +8902,134 @@ breakText Glyphs Glyphen @msg the paths are too many or too tangled to find where they cross die Pfade sind zu zahlreich oder zu verschlungen, um ihre Kreuzungen zu finden @msg the rectangle or line reaches too many paths to check das Rechteck oder die Linie erreicht zu viele Pfade, um sie zu prüfen @msg {name} must be a number {name} muss eine Zahl sein +# Messages no catalog translated yet: image export and color profiles, color books and swatch exchange files, 3D and Revolve, and script and file errors. +@msg 3D effects require finite coordinates within 100 million points 3D-Effekte erfordern endliche Koordinaten innerhalb von 100 Millionen Punkt +@msg 3D effects require one to ten lights 3D-Effekte erfordern ein bis zehn Lichter +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP-Farbtiefe {_1}: 1, 4, 8, 16, 24 oder 32 Bit pro Pixel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP-Kodierung fehlgeschlagen: {width} × {height} Pixel passen nicht zum Format oder zum Pixelpuffer +@msg GIF encoding failed: the palette image is malformed GIF-Kodierung fehlgeschlagen: Das Palettenbild ist fehlerhaft +@msg GIF encoding failed: {e} GIF-Kodierung fehlgeschlagen: {e} +@msg JPEG colour profile: {e} JPEG-Farbprofil: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG-Kodierung fehlgeschlagen: Der Pixelpuffer passt nicht zur Bildgröße +@msg JPEG encoding failed: {e} JPEG-Kodierung fehlgeschlagen: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG-Kodierung fehlgeschlagen: Der Pixelpuffer passt nicht zur Bildgröße +@msg PNG encoding failed: the palette image is malformed PNG-Kodierung fehlgeschlagen: Das Palettenbild ist fehlerhaft +@msg PNG encoding failed: {e} PNG-Kodierung fehlgeschlagen: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG-Kodierung fehlgeschlagen: {width} × {height} Pixel sind keine gültige Bildgröße +@msg PSD colour profile: {e} PSD-Farbprofil: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD-Kodierung fehlgeschlagen: Der Pixelpuffer passt nicht zur Bildgröße +@msg Revolve profile contains invalid coordinates Kreiseln: Das Profil enthält ungültige Koordinaten +@msg Revolve profile is too complex Kreiseln: Das Profil ist zu komplex +@msg Revolve projection is not finite Kreiseln: Die Projektion ist nicht endlich +@msg Revolve requires finite profile coordinates within 100 million points Kreiseln erfordert endliche Profilkoordinaten innerhalb von 100 Millionen Punkt +@msg Revolve surface is too complex; reduce Segments or simplify the profile Kreiseln: Die Oberfläche ist zu komplex; verringern Sie „Segmente“ oder vereinfachen Sie das Profil +@msg Revolve surface is too complex; simplify the profile Kreiseln: Die Oberfläche ist zu komplex; vereinfachen Sie das Profil +@msg Revolve visibility cannot split the projected boundary Kreiseln: Die Sichtbarkeitsberechnung kann die projizierte Begrenzung nicht teilen +@msg Revolve visibility creates too many fragments Kreiseln: Die Sichtbarkeitsberechnung erzeugt zu viele Fragmente +@msg Revolve visibility creates too many vector anchors Kreiseln: Die Sichtbarkeitsberechnung erzeugt zu viele Vektor-Ankerpunkte +@msg Revolve visibility exceeds its geometry work limit Kreiseln: Die Sichtbarkeitsberechnung überschreitet ihre Grenze für den Geometrieaufwand +@msg Revolve visibility exceeds its spatial index limit Kreiseln: Die Sichtbarkeitsberechnung überschreitet ihre Grenze für den räumlichen Index +@msg Revolve visibility has too many boundary crossings Kreiseln: Die Sichtbarkeitsberechnung hat zu viele Kreuzungen der Begrenzung +@msg Revolve visibility has too many input anchors Kreiseln: Die Sichtbarkeitsberechnung hat zu viele Eingabe-Ankerpunkte +@msg Revolve visibility requires convex cap sectors Kreiseln: Die Sichtbarkeitsberechnung erfordert konvexe Sektoren der Deckflächen +@msg Revolve visibility requires finite projected faces Kreiseln: Die Sichtbarkeitsberechnung erfordert endliche projizierte Flächen +@msg SVG options: {e} SVG-Optionen: {e} +@msg Save for Web settings: {e} Einstellungen für „Für Web speichern“: {e} +@msg TIFF colour profile: {e} TIFF-Farbprofil: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF-Kodierung fehlgeschlagen: Der Pixelpuffer passt nicht zur Bildgröße +@msg TIFF encoding failed: {e} TIFF-Kodierung fehlgeschlagen: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa-Farbtiefe {_1}: 16, 24 oder 32 Bit pro Pixel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa-Kodierung fehlgeschlagen: Der Pixelpuffer passt nicht zur Bildgröße +@msg The 3D projection is not finite Die 3D-Projektion ist nicht endlich +@msg The 3D shadow is too complex; turn Shadows off or simplify the art Der 3D-Schatten ist zu komplex; schalten Sie „Schatten“ aus oder vereinfachen Sie die Grafik +@msg The shape contains invalid coordinates Die Form enthält ungültige Koordinaten +@msg Too many Revolve faces for visibility evaluation Zu viele Kreiseln-Flächen für die Sichtbarkeitsberechnung +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft liest höchstens {ASE_MAX_ENTRIES} Farben und Gruppen aus einer Farbfeld-Austauschdatei, und diese Bibliothek hat {entries} +@msg WebP encoding failed: {e} WebP-Kodierung fehlgeschlagen: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` ist smallThumb, mediumThumb, largeThumb, smallList oder largeList +@msg a line can't run from a point to itself eine Linie kann nicht von einem Punkt zu sich selbst verlaufen +@msg a line needs at least two points eine Linie braucht mindestens zwei Punkte +@msg a linked JavaScript file is outside the read roots eine verknüpfte JavaScript-Datei liegt außerhalb der Lesestammordner +@msg a number cannot be read eine Zahl kann nicht gelesen werden +@msg a swatch exchange block is too long ein Block der Farbfeld-Austauschdatei ist zu lang +@msg a swatch exchange name is too long ein Name in der Farbfeld-Austauschdatei ist zu lang +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels ein Bild mit {sw} × {sh} Pixeln kann nicht auf {width} × {height} Pixel skaliert werden +@msg a {width} × {height} image is too large ein Bild mit {width} × {height} Pixeln ist zu groß +@msg a {width} × {height} image: {e} ein Bild mit {width} × {height} Pixeln: {e} +@msg an image could not be written: {e} ein Bild konnte nicht geschrieben werden: {e} +@msg an image that couldn't be read was left out ein Bild, das nicht gelesen werden konnte, wurde ausgelassen +@msg can't open “{name}”: {e} „{name}“ kann nicht geöffnet werden: {e} +@msg cannot align zip entries to {align} bytes die ZIP-Einträge können nicht auf {align} Byte ausgerichtet werden +@msg cannot open the automation {kind} root `{_1}`: {e} der Automatisierungs-Stammordner ({kind}) `{_1}` kann nicht geöffnet werden: {e} +@msg cannot read profile: {0} das Profil kann nicht gelesen werden: {0} +@msg color book version {version} isn't supported (only 1) die Farbbuchversion {version} wird nicht unterstützt (nur 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) Farbbücher im Farbraum {other} werden nicht unterstützt (nur RGB, CMYK und Lab) +@msg file name too long to zip: {_1} der Dateiname ist zu lang für ein ZIP-Archiv: {_1} +@msg file name too long to zip: {name} der Dateiname ist zu lang für ein ZIP-Archiv: {name} +@msg freeform line {i}: {e} Freiformlinie {i}: {e} +@msg freeform point {i}: {e} Freiformpunkt {i}: {e} +@msg give `{key}` or `{other}`, not both geben Sie `{key}` oder `{other}` an, nicht beides +@msg grayscale profiles can't be working spaces yet Graustufenprofile können noch keine Arbeitsfarbräume sein +@msg input contains NaN or infinite coordinates die Eingabe enthält NaN oder unendliche Koordinaten +@msg input path could not be closed der Eingabepfad konnte nicht geschlossen werden +@msg invalid ICC profile: {0} ungültiges ICC-Profil: {0} +@msg invalid scale {scale} ungültige Skalierung {scale} +@msg its localized names take more than {_1} KB seine lokalisierten Namen belegen mehr als {_1} KB +@msg its objects are nested too deep ({e}) seine Objekte sind zu tief verschachtelt ({e}) +@msg its tag table lists the `{_1}` tag more than once seine Tag-Tabelle führt das Tag `{_1}` mehr als einmal auf +@msg not a graphic style library: {e} keine Grafikstil-Bibliothek: {e} +@msg not a swatch library (.vcswatches or .gpl) keine Farbfeldbibliothek (.vcswatches oder .gpl) +@msg not a swatch library (format `{_1}`) keine Farbfeldbibliothek (Format `{_1}`) +@msg not a swatch library: {e} keine Farbfeldbibliothek: {e} +@msg not an action set file ({e}) keine Aktionssatzdatei ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray der Farbraum {other} des Profils ist nicht RGB, CMYK oder Graustufen +@msg regular expression too large regulärer Ausdruck zu groß +@msg script file is not UTF-8 text: {value} die Skriptdatei ist kein UTF-8-Text: {value} +@msg stop {i}: {e} Farbstopp {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) die Version {major}.{minor} der Farbfeld-Austauschdatei wird nicht unterstützt (nur 1.x) +@msg the art of a graph design in a graph series is drawn again from the design: edit the design to change it die Grafik eines Diagrammdesigns in einer Diagrammreihe wird aus dem Design neu gezeichnet: Bearbeiten Sie das Design, um sie zu ändern +@msg the color book holds more than {ASE_MAX_ENTRIES} colors das Farbbuch enthält mehr als {ASE_MAX_ENTRIES} Farben +@msg the color book is cut short das Farbbuch ist unvollständig +@msg the color book's names take more than {_1} MB die Namen des Farbbuchs belegen mehr als {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution das Bild hätte {w} × {h} Pixel; Rasterexporte sind auf {MAX_RASTER_SIDE} Pixel pro Seite und {_1} Megapixel begrenzt: Verringern Sie die Skalierung oder die Auflösung +@msg the optimised image can't be read back: {e} das optimierte Bild kann nicht zurückgelesen werden: {e} +@msg the pixel buffer doesn't match the image size der Pixelpuffer passt nicht zur Bildgröße +@msg the preview: {e} die Vorschau: {e} +@msg the request may not read the New Document profiles folder die Anfrage darf den Ordner der Profile für neue Dokumente nicht lesen +@msg the shapes are too degenerate to combine die Formen sind zu entartet, um sie zu kombinieren +@msg the shapes cross themselves and each other too often to combine die Formen überschneiden sich selbst und einander zu oft, um sie zu kombinieren +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups die Farbfeld-Austauschdatei enthält mehr als {ASE_MAX_ENTRIES} Farben und Gruppen +@msg the swatch exchange file is cut short die Farbfeld-Austauschdatei ist unvollständig +@msg the {_1} plate can't be read: {e} der Farbauszug {_1} kann nicht gelesen werden: {e} +@msg this binary DXF file is damaged or cut short diese binäre DXF-Datei ist beschädigt oder unvollständig +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that dies ist eine DWG-Zeichnung, die nicht gelesen werden kann: Speichern Sie sie in der CAD-App als DXF und öffnen Sie diese Datei +@msg too many classes zu viele Zeichenklassen +@msg too many groups zu viele Gruppen +@msg too many layers for PSD (at most 32767) zu viele Ebenen für PSD (höchstens 32767) +@msg too many swatch exchange blocks zu viele Blöcke in der Farbfeld-Austauschdatei +@msg unknown colour profile: {0} unbekanntes Farbprofil: {0} +@msg {_1} clashes with a built-in profile name {_1} kollidiert mit dem Namen eines integrierten Profils +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} Pixel ist zu groß für GIF (höchstens 65535 Pixel pro Seite): Verringern Sie die Auflösung +@msg {_1}: no usable transform to/from sRGB {_1}: keine verwendbare Transformation von/nach sRGB +@msg {name} is not a CMYK profile {name} ist kein CMYK-Profil +@msg {name} is not an RGB profile {name} ist kein RGB-Profil +@msg {path}: could not be read {path}: konnte nicht gelesen werden +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} Pixel ist zu groß für JPEG (höchstens 65535 Pixel pro Seite): Verringern Sie die Auflösung +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} Pixel ist zu groß für Targa (höchstens 65535 Pixel pro Seite): Verringern Sie die Auflösung +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} Pixel ist zu groß für PSD (höchstens {MAX_SIDE} Pixel pro Seite): Verringern Sie die Auflösung +# Messages other catalogs translate and German did not: Banner Hems and Grommets and recovery data. +@msg `{key}` must be from 0.01 to 1000 pt `{key}` muss zwischen 0,01 und 1000 pt liegen +@msg select the banner, or mark every artboard wählen Sie das Banner aus oder markieren Sie alle Zeichenflächen +@msg the banner has no width or height das Banner hat keine Breite oder Höhe +@msg the grommet inset is too large for the banner der Randabstand der Ösen ist zu groß für das Banner +@msg the hem is too deep for the banner der Saum ist zu tief für das Banner +@msg the spacing makes more than {MAX_GROMMETS} grommets der Abstand ergibt mehr als {MAX_GROMMETS} Ösen +@msg there is no banner to mark es gibt kein Banner zum Markieren +@msg turn on at least one side aktivieren Sie mindestens eine Seite +@msg with no hem and no grommets there is nothing to mark ohne Saum und ohne Ösen gibt es nichts zu markieren +@msg {saving} failed: {e} {saving} fehlgeschlagen: {e} Banner Hems and Grommets… Bannersäume und Ösen… Banner Hems and Grommets Bannersäume und Ösen Hem Saum diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 62e3adc491..d03f8c6958 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -665,6 +665,8 @@ font-technology Variable Μεταβλητές Crop Image Περικοπή εικόνας Image Tools Εργαλεία εικόνας Remove Background… Αφαίρεση φόντου… + Draw (Pencil) Σχεδίαση (μολύβι) + Place Image Τοποθέτηση εικόνας Remove Background Αφαίρεση φόντου Background Φόντο Edge Color Χρώμα άκρης @@ -2559,6 +2561,7 @@ axis Both Και τα δύο @msg `select` must be true or false Το `select` πρέπει να είναι true ή false @msg `minAnchors` and `maxAnchors` must be whole numbers Τα `minAnchors` και `maxAnchors` πρέπει να είναι ακέραιοι αριθμοί @msg `{key}` must be a number not below 0 Το `{key}` πρέπει να είναι αριθμός όχι μικρότερος από 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] Το `{key}` πρέπει να είναι τέσσερις αριθμοί όχι μικρότεροι από 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative Το `{key}` πρέπει να είναι [x, y, width, height]: τέσσερις πεπερασμένοι αριθμοί, με πλάτος και ύψος όχι αρνητικά @msg `{min_key}` is greater than `{max_key}` Το `{min_key}` είναι μεγαλύτερο από το `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` δώστε τουλάχιστον ένα από τα `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -3425,6 +3428,7 @@ theme Appearance Εμφάνιση Proportional Metrics Αναλογικές μετρικές Insert Aki Left Εισαγωγή aki αριστερά Insert Aki Right Εισαγωγή aki δεξιά + Tsume Tsume Arabic Αραβικά Hindi Χίντι Farsi Περσικά @@ -4697,6 +4701,7 @@ digits Malayalam Μαλαγιάλαμ @msg no action set to save δεν υπάρχει σύνολο ενεργειών για αποθήκευση @msg the action set file can't be read in full το αρχείο συνόλου ενεργειών δεν μπορεί να διαβαστεί ολόκληρο @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Φορτώθηκε το «{name}»: παραλείφθηκε {n} βήμα|Φορτώθηκε το «{name}»: παραλείφθηκαν {n} βήματα +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Φορτώθηκε το «{name}»: {n} βήμα έχει άγνωστη εντολή και διατηρήθηκε: «{action}», βήμα {step}, `{command}`|Φορτώθηκε το «{name}»: {n} βήματα έχουν άγνωστες εντολές και διατηρήθηκαν· το πρώτο: «{action}», βήμα {step}, `{command}` @msg not an action set file δεν είναι αρχείο συνόλου ενεργειών @msg the action set file is larger than 8 MiB το αρχείο συνόλου ενεργειών είναι μεγαλύτερο από 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: η αναφορά θα ήταν μεγαλύτερη από {MAX_BYTES} byte @@ -4931,6 +4936,7 @@ digits Malayalam Μαλαγιάλαμ @msg tool shortcuts must be a single key (optionally with Shift) οι συντομεύσεις εργαλείων πρέπει να περιλαμβάνουν ένα πλήκτρο (προαιρετικά με Shift) @msg truncated περικομμένο @msg unknown command `{0}` άγνωστη εντολή `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` το βήμα {step} της ενέργειας «{action}» εκτελεί την άγνωστη εντολή `{command}` @msg unknown command `{0}`; did you mean `{1}`? άγνωστη εντολή `{0}`· μήπως εννοείτε `{1}`; @msg unknown effect `{id}` άγνωστο εφέ `{id}` @msg unknown format άγνωστη μορφή @@ -5234,6 +5240,7 @@ digits Malayalam Μαλαγιάλαμ VectorCraft Title Bar on Every Desktop Γραμμή τίτλου του VectorCraft σε κάθε επιφάνεια εργασίας The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Όσο είναι ορισμένη, η μεταβλητή περιβάλλοντος VECTORCRAFT_TITLEBAR επιλέγει τη γραμμή τίτλου. System Title Bar takes precedence over this option while it is on. Όσο είναι ενεργή, η Γραμμή τίτλου συστήματος υπερισχύει αυτής της επιλογής. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Όσο η Γραμμή τίτλου του VectorCraft σε κάθε επιφάνεια εργασίας είναι ανενεργή, αυτή η επιφάνεια εργασίας σχεδιάζει τη γραμμή τίτλου του παραθύρου, είτε αυτή η επιλογή είναι ενεργή είτε όχι. Value Axis Άξονας τιμών On Left Side Στην αριστερή πλευρά On Right Side Στη δεξιά πλευρά @@ -6341,8 +6348,8 @@ axis Y Axis Άξονας Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` ένα πρόσθετο εξαγωγής δηλώνει 1 έως {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` το πολύ {MAX_UNGROUPED} παράμετροι εκτός ομάδων: δώστε στις υπόλοιπες ένα `group` @msg can't encode the input η είσοδος δεν μπορεί να κωδικοποιηθεί -@msg expected {"dataBase64"} αναμενόταν {"dataBase64"} -@msg expected {"objects"} αναμενόταν {"objects"} +@msg expected {{"dataBase64": "…"}} αναμενόταν {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} αναμενόταν {{"objects": [...]}} @msg export `{name}`: {e} εξαγωγή `{name}`: {e} @msg extension {e} is listed twice η επέκταση {e} αναφέρεται δύο φορές @msg extension {e}: use 1-16 lower-case letters and digits, without the dot επέκταση {e}: χρησιμοποιήστε 1-16 πεζά γράμματα και ψηφία, χωρίς την τελεία @@ -6406,11 +6413,11 @@ axis Y Axis Άξονας Y @msg a painted live effect returns only `objects` ένα ζωντανό εφέ βαφής επιστρέφει μόνο `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` ένα κομμάτι ζωντανού εφέ βαφής έχει μόνο `path`, `fillRule`, `fills` και `strokes` @msg a read-only object was left out παραλείφθηκε ένα αντικείμενο μόνο για ανάγνωση -@msg a read-only object was left out: return it, as {"id"} alone or as it was given παραλείφθηκε ένα αντικείμενο μόνο για ανάγνωση: επιστρέψτε το ως {"id"} μόνο ή όπως δόθηκε +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given παραλείφθηκε ένα αντικείμενο μόνο για ανάγνωση: επιστρέψτε το ως {{"id": …}} μόνο ή όπως δόθηκε @msg a string συμβολοσειρά @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` ένα περίγραμμα έχει μόνο `paint`, `width`, `join`, `cap` και `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} ένα περίγραμμα πρέπει να είναι {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} ένα εφέ πρέπει να είναι {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} ένα περίγραμμα πρέπει να είναι {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} ένα εφέ πρέπει να είναι {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` ένα εφέ σε γέμισμα επιστρέφει μόνο `fills` @msg an effect on a stroke returns only `strokes` ένα εφέ σε περίγραμμα επιστρέφει μόνο `strokes` @msg an object must be a JSON object ένα αντικείμενο πρέπει να είναι αντικείμενο JSON @@ -6552,6 +6559,8 @@ axis Y Axis Άξονας Y Action Options… Επιλογές ενέργειας… Action Options Επιλογές ενέργειας Playback Options… Επιλογές αναπαραγωγής… + Button Mode Λειτουργία κουμπιών + No actions. Δεν υπάρχουν ενέργειες. Insert Stop… Εισαγωγή διακοπής… Insert Stop Εισαγωγή διακοπής Record Stop Καταγραφή διακοπής @@ -7416,6 +7425,12 @@ breakText Glyphs Γλύφοι @msg open the practice sample of `{id}` first (see learn.openSample) ανοίξτε πρώτα το δείγμα εξάσκησης του `{id}` (δείτε learn.openSample) @msg finish `{id}` first (see learn.finish) ολοκληρώστε πρώτα το `{id}` (δείτε learn.finish) @msg `{id}` is the last tutorial in its skill το `{id}` είναι ο τελευταίος οδηγός εκμάθησης της δεξιότητάς του + Reset progress Επαναφορά προόδου + Mark Tutorial Step Σήμανση βήματος οδηγού εκμάθησης + Reset Learn Progress Επαναφορά προόδου εκμάθησης +@msg missing `step` (see learn.show) λείπει το `step` (δείτε learn.show) +@msg `step` must be a step number from 0 to {last} το `step` πρέπει να είναι αριθμός βήματος από 0 έως {last} +@msg `{id}` is finished (see learn.resetProgress) το `{id}` έχει ολοκληρωθεί (δείτε learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Ανανέωση εφέ σε αναμονή @@ -7445,3 +7460,120 @@ breakText Glyphs Γλύφοι Grommets Τρουκς Grommet Inset Απόσταση τρουκς από την άκρη Diameter Διάμετρος + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books, DXF import and PDF export. +@msg 3D effects require finite coordinates within 100 million points Τα εφέ 3D απαιτούν πεπερασμένες συντεταγμένες εντός 100 εκατομμυρίων τυπογραφικών στιγμών +@msg 3D effects require one to ten lights Τα εφέ 3D απαιτούν από ένα έως δέκα φώτα +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Βάθος BMP {_1}: 1, 4, 8, 16, 24 ή 32 bit ανά εικονοστοιχείο +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Η κωδικοποίηση BMP απέτυχε: τα {width} × {height} εικονοστοιχεία δεν ταιριάζουν στη μορφή ή στην προσωρινή μνήμη εικονοστοιχείων +@msg GIF encoding failed: the palette image is malformed Η κωδικοποίηση GIF απέτυχε: η εικόνα παλέτας είναι κακοσχηματισμένη +@msg GIF encoding failed: {e} Η κωδικοποίηση GIF απέτυχε: {e} +@msg JPEG colour profile: {e} Προφίλ χρώματος JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Η κωδικοποίηση JPEG απέτυχε: η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg JPEG encoding failed: {e} Η κωδικοποίηση JPEG απέτυχε: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Η κωδικοποίηση PNG απέτυχε: η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg PNG encoding failed: the palette image is malformed Η κωδικοποίηση PNG απέτυχε: η εικόνα παλέτας είναι κακοσχηματισμένη +@msg PNG encoding failed: {e} Η κωδικοποίηση PNG απέτυχε: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Η κωδικοποίηση PNG απέτυχε: τα {width} × {height} εικονοστοιχεία δεν είναι έγκυρο μέγεθος εικόνας +@msg PSD colour profile: {e} Προφίλ χρώματος PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Η κωδικοποίηση PSD απέτυχε: η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg Revolve profile contains invalid coordinates Το προφίλ της περιστροφής γύρω από άξονα περιέχει μη έγκυρες συντεταγμένες +@msg Revolve profile is too complex Το προφίλ της περιστροφής γύρω από άξονα είναι πολύ σύνθετο +@msg Revolve projection is not finite Η προβολή της περιστροφής γύρω από άξονα δεν είναι πεπερασμένη +@msg Revolve requires finite profile coordinates within 100 million points Η περιστροφή γύρω από άξονα απαιτεί πεπερασμένες συντεταγμένες προφίλ εντός 100 εκατομμυρίων τυπογραφικών στιγμών +@msg Revolve surface is too complex; reduce Segments or simplify the profile Η επιφάνεια περιστροφής είναι πολύ σύνθετη· μειώστε τα «Τμήματα» ή απλοποιήστε το προφίλ +@msg Revolve surface is too complex; simplify the profile Η επιφάνεια περιστροφής είναι πολύ σύνθετη· απλοποιήστε το προφίλ +@msg Revolve visibility cannot split the projected boundary Ο έλεγχος ορατότητας της περιστροφής δεν μπορεί να διαιρέσει το προβαλλόμενο όριο +@msg Revolve visibility creates too many fragments Ο έλεγχος ορατότητας της περιστροφής δημιουργεί πάρα πολλά κομμάτια +@msg Revolve visibility creates too many vector anchors Ο έλεγχος ορατότητας της περιστροφής δημιουργεί πάρα πολλά διανυσματικά σημεία αγκύρωσης +@msg Revolve visibility exceeds its geometry work limit Ο έλεγχος ορατότητας της περιστροφής υπερβαίνει το όριο γεωμετρικών υπολογισμών του +@msg Revolve visibility exceeds its spatial index limit Ο έλεγχος ορατότητας της περιστροφής υπερβαίνει το όριο του χωρικού ευρετηρίου του +@msg Revolve visibility has too many boundary crossings Ο έλεγχος ορατότητας της περιστροφής έχει πάρα πολλές διασταυρώσεις ορίων +@msg Revolve visibility has too many input anchors Ο έλεγχος ορατότητας της περιστροφής έχει πάρα πολλά σημεία αγκύρωσης εισόδου +@msg Revolve visibility requires convex cap sectors Ο έλεγχος ορατότητας της περιστροφής απαιτεί κυρτούς τομείς καλυμμάτων +@msg Revolve visibility requires finite projected faces Ο έλεγχος ορατότητας της περιστροφής απαιτεί πεπερασμένες προβαλλόμενες έδρες +@msg SVG options: {e} Επιλογές SVG: {e} +@msg Save for Web settings: {e} Ρυθμίσεις αποθήκευσης για ιστό: {e} +@msg TIFF colour profile: {e} Προφίλ χρώματος TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Η κωδικοποίηση TIFF απέτυχε: η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg TIFF encoding failed: {e} Η κωδικοποίηση TIFF απέτυχε: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Βάθος Targa {_1}: 16, 24 ή 32 bit ανά εικονοστοιχείο +@msg Targa encoding failed: the pixel buffer doesn't match the image size Η κωδικοποίηση Targa απέτυχε: η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg The 3D projection is not finite Η προβολή 3D δεν είναι πεπερασμένη +@msg The 3D shadow is too complex; turn Shadows off or simplify the art Η σκιά 3D είναι πολύ σύνθετη· απενεργοποιήστε τις «Σκιές» ή απλοποιήστε το σχέδιο +@msg The shape contains invalid coordinates Το σχήμα περιέχει μη έγκυρες συντεταγμένες +@msg Too many Revolve faces for visibility evaluation Πάρα πολλές έδρες περιστροφής για τον έλεγχο ορατότητας +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} Το VectorCraft διαβάζει το πολύ {ASE_MAX_ENTRIES} χρώματα και ομάδες από ένα αρχείο ανταλλαγής δειγμάτων, και αυτή η βιβλιοθήκη έχει {entries} +@msg WebP encoding failed: {e} Η κωδικοποίηση WebP απέτυχε: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `index` must be a whole number Το `index` πρέπει να είναι ακέραιος αριθμός +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList Το `view` είναι smallThumb, mediumThumb, largeThumb, smallList ή largeList +@msg a line can't run from a point to itself μια γραμμή δεν μπορεί να ξεκινά και να καταλήγει στο ίδιο σημείο +@msg a line needs at least two points μια γραμμή χρειάζεται τουλάχιστον δύο σημεία +@msg a number cannot be read ένας αριθμός δεν μπορεί να διαβαστεί +@msg a swatch exchange block is too long ένα μπλοκ του αρχείου ανταλλαγής δειγμάτων είναι πολύ μεγάλο +@msg a swatch exchange name is too long ένα όνομα του αρχείου ανταλλαγής δειγμάτων είναι πολύ μεγάλο +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels μια εικόνα {sw} × {sh} δεν μπορεί να αλλάξει μέγεθος σε {width} × {height} εικονοστοιχεία +@msg a {width} × {height} image is too large μια εικόνα {width} × {height} είναι πολύ μεγάλη +@msg a {width} × {height} image: {e} μια εικόνα {width} × {height}: {e} +@msg an image could not be written: {e} μια εικόνα δεν μπόρεσε να γραφτεί: {e} +@msg an image that couldn't be read was left out παραλείφθηκε μια εικόνα που δεν μπόρεσε να διαβαστεί +@msg can't open “{name}”: {e} δεν είναι δυνατό το άνοιγμα του «{name}»: {e} +@msg cannot align zip entries to {align} bytes δεν είναι δυνατή η στοίχιση των καταχωρίσεων zip σε {align} byte +@msg cannot open the automation {kind} root `{_1}`: {e} δεν είναι δυνατό το άνοιγμα της ρίζας αυτοματισμού ({kind}) `{_1}`: {e} +@msg cannot read profile: {0} δεν είναι δυνατή η ανάγνωση του προφίλ: {0} +@msg color book version {version} isn't supported (only 1) η έκδοση {version} του βιβλίου χρωμάτων δεν υποστηρίζεται (μόνο 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) τα βιβλία χρωμάτων στον χρωματικό χώρο {other} δεν υποστηρίζονται (μόνο RGB, CMYK και Lab) +@msg file name too long to zip: {_1} το όνομα αρχείου είναι πολύ μεγάλο για συμπίεση zip: {_1} +@msg file name too long to zip: {name} το όνομα αρχείου είναι πολύ μεγάλο για συμπίεση zip: {name} +@msg freeform line {i}: {e} γραμμή ελεύθερης μορφής {i}: {e} +@msg freeform point {i}: {e} σημείο ελεύθερης μορφής {i}: {e} +@msg give `{key}` or `{other}`, not both δώστε `{key}` ή `{other}`, όχι και τα δύο +@msg grayscale profiles can't be working spaces yet τα προφίλ κλίμακας του γκρι δεν μπορούν ακόμη να είναι χρωματικοί χώροι εργασίας +@msg input contains NaN or infinite coordinates η είσοδος περιέχει συντεταγμένες NaN ή άπειρες συντεταγμένες +@msg input path could not be closed η διαδρομή εισόδου δεν μπόρεσε να κλείσει +@msg invalid ICC profile: {0} μη έγκυρο προφίλ ICC: {0} +@msg invalid scale {scale} μη έγκυρη κλίμακα {scale} +@msg its localized names take more than {_1} KB τα τοπικοποιημένα ονόματά του καταλαμβάνουν περισσότερα από {_1} KB +@msg its objects are nested too deep ({e}) τα αντικείμενά του είναι ένθετα σε πολύ μεγάλο βάθος ({e}) +@msg its tag table lists the `{_1}` tag more than once ο πίνακας ετικετών του περιέχει την ετικέτα `{_1}` περισσότερες από μία φορές +@msg knockout groups with too many overlapping translucent elements are written as PDF knockout groups: their translucent elements knock out what they cover fully οι ομάδες διάτρησης με πάρα πολλά επικαλυπτόμενα ημιδιαφανή στοιχεία γράφονται ως ομάδες διάτρησης PDF: τα ημιδιαφανή στοιχεία τους διατρυπούν πλήρως ό,τι καλύπτουν +@msg not a graphic style library: {e} δεν είναι βιβλιοθήκη στυλ γραφικών: {e} +@msg not a swatch library (.vcswatches or .gpl) δεν είναι βιβλιοθήκη δειγμάτων (.vcswatches ή .gpl) +@msg not a swatch library (format `{_1}`) δεν είναι βιβλιοθήκη δειγμάτων (μορφή `{_1}`) +@msg not a swatch library: {e} δεν είναι βιβλιοθήκη δειγμάτων: {e} +@msg not an action set file ({e}) δεν είναι αρχείο συνόλου ενεργειών ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray ο χρωματικός χώρος {other} του προφίλ δεν είναι RGB, CMYK ή Gray +@msg regular expression too large η κανονική έκφραση είναι πολύ μεγάλη +@msg script file is not UTF-8 text: {value} το αρχείο σεναρίου δεν είναι κείμενο UTF-8: {value} +@msg stop {i}: {e} σημείο χρώματος {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) η έκδοση {major}.{minor} του αρχείου ανταλλαγής δειγμάτων δεν υποστηρίζεται (μόνο 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors το βιβλίο χρωμάτων περιέχει περισσότερα από {ASE_MAX_ENTRIES} χρώματα +@msg the color book is cut short το βιβλίο χρωμάτων είναι περικομμένο +@msg the color book's names take more than {_1} MB τα ονόματα του βιβλίου χρωμάτων καταλαμβάνουν περισσότερα από {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution η εικόνα θα ήταν {w} × {h} εικονοστοιχεία· οι εξαγωγές raster περιορίζονται σε {MAX_RASTER_SIDE} εικονοστοιχεία ανά πλευρά και {_1} μεγαεικονοστοιχεία: μειώστε την κλίμακα ή την ανάλυση +@msg the optimised image can't be read back: {e} η βελτιστοποιημένη εικόνα δεν μπορεί να διαβαστεί ξανά: {e} +@msg the pixel buffer doesn't match the image size η προσωρινή μνήμη εικονοστοιχείων δεν αντιστοιχεί στο μέγεθος της εικόνας +@msg the preview: {e} η προεπισκόπηση: {e} +@msg the request may not read the New Document profiles folder το αίτημα δεν επιτρέπεται να διαβάσει τον φάκελο προφίλ νέου εγγράφου +@msg the shapes are too degenerate to combine τα σχήματα είναι πολύ εκφυλισμένα για να συνδυαστούν +@msg the shapes cross themselves and each other too often to combine τα σχήματα τέμνουν τον εαυτό τους και το ένα το άλλο πάρα πολλές φορές για να συνδυαστούν +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups το αρχείο ανταλλαγής δειγμάτων περιέχει περισσότερα από {ASE_MAX_ENTRIES} χρώματα και ομάδες +@msg the swatch exchange file is cut short το αρχείο ανταλλαγής δειγμάτων είναι περικομμένο +@msg the {_1} plate can't be read: {e} η πλάκα {_1} δεν μπορεί να διαβαστεί: {e} +@msg this binary DXF file is damaged or cut short αυτό το δυαδικό αρχείο DXF είναι κατεστραμμένο ή περικομμένο +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that αυτό είναι σχέδιο DWG και δεν μπορεί να διαβαστεί: αποθηκεύστε το ως DXF από την εφαρμογή CAD και ανοίξτε το +@msg too many classes υπερβολικά πολλές κλάσεις +@msg too many groups υπερβολικά πολλές ομάδες +@msg too many layers for PSD (at most 32767) πάρα πολλά επίπεδα για PSD (το πολύ 32767) +@msg too many swatch exchange blocks πάρα πολλά μπλοκ στο αρχείο ανταλλαγής δειγμάτων +@msg unknown colour profile: {0} άγνωστο προφίλ χρώματος: {0} +@msg {_1} clashes with a built-in profile name το {_1} συγκρούεται με το όνομα ενός ενσωματωμένου προφίλ +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution τα {_1} × {_2} εικονοστοιχεία είναι υπερβολικό μέγεθος για GIF (το πολύ 65535 εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση +@msg {_1}: no usable transform to/from sRGB {_1}: δεν υπάρχει χρησιμοποιήσιμος μετασχηματισμός προς/από sRGB +@msg {name} is not a CMYK profile το {name} δεν είναι προφίλ CMYK +@msg {name} is not an RGB profile το {name} δεν είναι προφίλ RGB +@msg {path}: could not be read {path}: δεν ήταν δυνατή η ανάγνωση +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution τα {width} × {height} εικονοστοιχεία είναι υπερβολικό μέγεθος για JPEG (το πολύ 65535 εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution τα {width} × {height} εικονοστοιχεία είναι υπερβολικό μέγεθος για Targa (το πολύ 65535 εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution τα {w} × {h} εικονοστοιχεία είναι υπερβολικό μέγεθος για PSD (το πολύ {MAX_SIDE} εικονοστοιχεία ανά πλευρά): μειώστε την ανάλυση diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index d1c6aa53af..3e8bd23752 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -705,6 +705,8 @@ font-technology Variable Variables Crop Image Recortar imagen Image Tools Herramientas de imagen Remove Background… Quitar fondo… + Draw (Pencil) Dibujar (Lápiz) + Place Image Colocar imagen Remove Background Quitar fondo Background Fondo Edge Color Color del borde @@ -2664,6 +2666,7 @@ font-technology Variable Variables Proportional Metrics Métrica proporcional Insert Aki Left Insertar aki a la izquierda Insert Aki Right Insertar aki a la derecha + Tsume Tsume Character Direction Dirección de caracteres Digits Dígitos Arabic Árabes @@ -4489,6 +4492,7 @@ axis Both Ambos @msg `select` must be true or false `select` debe ser true o false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` y `maxAnchors` deben ser números enteros @msg `{key}` must be a number not below 0 `{key}` debe ser un número no inferior a 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` debe ser cuatro números no inferiores a 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` debe ser [x, y, width, height]: cuatro números finitos, con anchura y altura no negativas @msg `{min_key}` is greater than `{max_key}` `{min_key}` es mayor que `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indica al menos uno de `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4741,6 +4745,7 @@ axis Both Ambos @msg no action set to save no hay ningún conjunto de acciones que guardar @msg the action set file can't be read in full el archivo de conjunto de acciones no se puede leer completo @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Se cargó “{name}”: se omitió {n} paso|Se cargó “{name}”: se omitieron {n} pasos +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Se cargó “{name}”: {n} paso tiene un comando desconocido y se conservó: “{action}”, paso {step}, `{command}`|Se cargó “{name}”: {n} pasos tienen comandos desconocidos y se conservaron; el primero: “{action}”, paso {step}, `{command}` @msg not an action set file no es un archivo de conjunto de acciones @msg the action set file is larger than 8 MiB el archivo de conjunto de acciones supera los 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: la referencia superaría los {MAX_BYTES} bytes @@ -4982,6 +4987,7 @@ axis Both Ambos @msg tool shortcuts must be a single key (optionally with Shift) los atajos de herramientas deben ser una sola tecla (opcionalmente con Shift) @msg truncated truncado @msg unknown command `{0}` comando desconocido `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` el paso {step} de “{action}” ejecuta el comando desconocido `{command}` @msg unknown command `{0}`; did you mean `{1}`? comando desconocido `{0}`; ¿quiso decir `{1}`? @msg unknown effect `{id}` efecto desconocido `{id}` @msg unknown format formato desconocido @@ -5323,6 +5329,7 @@ axis Both Ambos VectorCraft Title Bar on Every Desktop Barra de título de VectorCraft en todos los escritorios The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Mientras está definida, la variable de entorno VECTORCRAFT_TITLEBAR elige la barra de título. System Title Bar takes precedence over this option while it is on. Mientras está activada, Barra de título del sistema tiene prioridad sobre esta opción. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Mientras Barra de título de VectorCraft en todos los escritorios está desactivada, este escritorio dibuja la barra de título de la ventana tanto si esta opción está activada como si no. Value Axis Eje de valores On Left Side En el lado izquierdo On Right Side En el lado derecho @@ -6332,8 +6339,8 @@ axis Y Axis Eje Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` un plugin de exportación declara de 1 a {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` como máximo {MAX_UNGROUPED} parámetros fuera de grupos: asigna un `group` a los demás @msg can't encode the input no se puede codificar la entrada -@msg expected {"dataBase64"} se esperaba {"dataBase64"} -@msg expected {"objects"} se esperaba {"objects"} +@msg expected {{"dataBase64": "…"}} se esperaba {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} se esperaba {{"objects": [...]}} @msg export `{name}`: {e} exportación del módulo `{name}`: {e} @msg extension {e} is listed twice la extensión {e} aparece dos veces @msg extension {e}: use 1-16 lower-case letters and digits, without the dot extensión {e}: usa 1-16 letras minúsculas y dígitos, sin el punto @@ -6397,11 +6404,11 @@ axis Y Axis Eje Y @msg a painted live effect returns only `objects` un efecto dinámico de pintura solo devuelve `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` una pieza de un efecto dinámico de pintura solo tiene `path`, `fillRule`, `fills` y `strokes` @msg a read-only object was left out se omitió un objeto de solo lectura -@msg a read-only object was left out: return it, as {"id"} alone or as it was given se omitió un objeto de solo lectura: devuélvalo como {"id"} solo o tal como se recibió +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given se omitió un objeto de solo lectura: devuélvalo como {{"id": …}} solo o tal como se recibió @msg a string una cadena @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` un trazo solo tiene `paint`, `width`, `join`, `cap` y `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} un trazo debe ser {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} un efecto debe ser {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} un trazo debe ser {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} un efecto debe ser {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` un efecto en un relleno solo devuelve `fills` @msg an effect on a stroke returns only `strokes` un efecto en un trazo solo devuelve `strokes` @msg an object must be a JSON object un objeto debe ser un objeto JSON @@ -6543,6 +6550,8 @@ axis Y Axis Eje Y Action Options… Opciones de acción… Action Options Opciones de acción Playback Options… Opciones de reproducción… + Button Mode Modo de botones + No actions. No hay acciones. Insert Stop… Insertar parada… Insert Stop Insertar parada Record Stop Grabar parada @@ -7323,6 +7332,122 @@ breakText Glyphs Glifos @msg only an exporter or an importer declares `extensions` solo un plugin de exportación o de importación declara `extensions` @msg an importer always gets an import's budget: leave `budget` out un plugin de importación siempre recibe el presupuesto de una importación: omita `budget` +# Messages of the image encoders, color profiles, swatch exchange files and color books, 3D and Revolve, path operations, DXF import, the script engine and parameter checks. +@msg 3D effects require finite coordinates within 100 million points Los efectos 3D requieren coordenadas finitas dentro de 100 millones de puntos +@msg 3D effects require one to ten lights Los efectos 3D requieren de una a diez luces +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Profundidad de BMP {_1}: 1, 4, 8, 16, 24 o 32 bits por píxel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Error al codificar BMP: {width} × {height} píxeles no caben en el formato o no coinciden con el búfer de píxeles +@msg GIF encoding failed: the palette image is malformed Error al codificar GIF: la imagen con paleta está mal formada +@msg GIF encoding failed: {e} Error al codificar GIF: {e} +@msg JPEG colour profile: {e} Perfil de color de JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Error al codificar JPEG: el búfer de píxeles no coincide con el tamaño de la imagen +@msg JPEG encoding failed: {e} Error al codificar JPEG: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Error al codificar PNG: el búfer de píxeles no coincide con el tamaño de la imagen +@msg PNG encoding failed: the palette image is malformed Error al codificar PNG: la imagen con paleta está mal formada +@msg PNG encoding failed: {e} Error al codificar PNG: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Error al codificar PNG: {width} × {height} píxeles no es un tamaño de imagen válido +@msg PSD colour profile: {e} Perfil de color de PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Error al codificar PSD: el búfer de píxeles no coincide con el tamaño de la imagen +@msg Revolve profile contains invalid coordinates El perfil de Revolución contiene coordenadas no válidas +@msg Revolve profile is too complex El perfil de Revolución es demasiado complejo +@msg Revolve projection is not finite La proyección de Revolución no es finita +@msg Revolve requires finite profile coordinates within 100 million points Revolución requiere coordenadas de perfil finitas dentro de 100 millones de puntos +@msg Revolve surface is too complex; reduce Segments or simplify the profile La superficie de Revolución es demasiado compleja; reduce Segmentos o simplifica el perfil +@msg Revolve surface is too complex; simplify the profile La superficie de Revolución es demasiado compleja; simplifica el perfil +@msg Revolve visibility cannot split the projected boundary La visibilidad de Revolución no puede dividir el contorno proyectado +@msg Revolve visibility creates too many fragments La visibilidad de Revolución crea demasiados fragmentos +@msg Revolve visibility creates too many vector anchors La visibilidad de Revolución crea demasiados puntos de ancla vectoriales +@msg Revolve visibility exceeds its geometry work limit La visibilidad de Revolución supera su límite de trabajo geométrico +@msg Revolve visibility exceeds its spatial index limit La visibilidad de Revolución supera su límite de índice espacial +@msg Revolve visibility has too many boundary crossings La visibilidad de Revolución tiene demasiados cruces de contorno +@msg Revolve visibility has too many input anchors La visibilidad de Revolución tiene demasiados puntos de ancla de entrada +@msg Revolve visibility requires convex cap sectors La visibilidad de Revolución requiere sectores de tapa convexos +@msg Revolve visibility requires finite projected faces La visibilidad de Revolución requiere caras proyectadas finitas +@msg SVG options: {e} Opciones de SVG: {e} +@msg Save for Web settings: {e} Ajustes de Guardar para web: {e} +@msg TIFF colour profile: {e} Perfil de color de TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Error al codificar TIFF: el búfer de píxeles no coincide con el tamaño de la imagen +@msg TIFF encoding failed: {e} Error al codificar TIFF: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Profundidad de Targa {_1}: 16, 24 o 32 bits por píxel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Error al codificar Targa: el búfer de píxeles no coincide con el tamaño de la imagen +@msg The 3D projection is not finite La proyección 3D no es finita +@msg The 3D shadow is too complex; turn Shadows off or simplify the art La sombra 3D es demasiado compleja; desactiva Sombras o simplifica la ilustración +@msg The shape contains invalid coordinates La forma contiene coordenadas no válidas +@msg Too many Revolve faces for visibility evaluation Demasiadas caras de Revolución para evaluar la visibilidad +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft lee como máximo {ASE_MAX_ENTRIES} colores y grupos de un archivo de intercambio de muestras, y esta biblioteca tiene {entries} +@msg WebP encoding failed: {e} Error al codificar WebP: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` es smallThumb, mediumThumb, largeThumb, smallList o largeList +@msg a line can't run from a point to itself una línea no puede ir de un punto a sí mismo +@msg a line needs at least two points una línea necesita al menos dos puntos +@msg a number cannot be read no se puede leer un número +@msg a swatch exchange block is too long un bloque de intercambio de muestras es demasiado largo +@msg a swatch exchange name is too long un nombre de intercambio de muestras es demasiado largo +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels una imagen de {sw} × {sh} no se puede cambiar de tamaño a {width} × {height} píxeles +@msg a {width} × {height} image is too large una imagen de {width} × {height} es demasiado grande +@msg a {width} × {height} image: {e} una imagen de {width} × {height}: {e} +@msg an image could not be written: {e} no se pudo escribir una imagen: {e} +@msg an image that couldn't be read was left out se omitió una imagen que no se pudo leer +@msg can't open “{name}”: {e} no se puede abrir «{name}»: {e} +@msg cannot align zip entries to {align} bytes no se pueden alinear las entradas zip a {align} bytes +@msg cannot open the automation {kind} root `{_1}`: {e} no se puede abrir la carpeta raíz de automatización ({kind}) `{_1}`: {e} +@msg cannot read profile: {0} no se puede leer el perfil: {0} +@msg color book version {version} isn't supported (only 1) no se admite la versión {version} del libro de colores (solo 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) no se admiten libros de colores en el espacio de color {other} (solo RGB, CMYK y Lab) +@msg file name too long to zip: {_1} nombre de archivo demasiado largo para comprimirlo en zip: {_1} +@msg file name too long to zip: {name} nombre de archivo demasiado largo para comprimirlo en zip: {name} +@msg freeform line {i}: {e} línea de forma libre {i}: {e} +@msg freeform point {i}: {e} punto de forma libre {i}: {e} +@msg give `{key}` or `{other}`, not both indica `{key}` o `{other}`, no ambos +@msg grayscale profiles can't be working spaces yet los perfiles de escala de grises todavía no pueden ser espacios de trabajo +@msg input contains NaN or infinite coordinates la entrada contiene coordenadas NaN o infinitas +@msg input path could not be closed no se pudo cerrar el trazado de entrada +@msg invalid ICC profile: {0} perfil ICC no válido: {0} +@msg invalid scale {scale} escala no válida {scale} +@msg its localized names take more than {_1} KB sus nombres localizados ocupan más de {_1} KB +@msg its objects are nested too deep ({e}) sus objetos están anidados a demasiada profundidad ({e}) +@msg its tag table lists the `{_1}` tag more than once su tabla de etiquetas incluye la etiqueta `{_1}` más de una vez +@msg not a graphic style library: {e} no es una biblioteca de estilos gráficos: {e} +@msg not a swatch library (.vcswatches or .gpl) no es una biblioteca de muestras (.vcswatches o .gpl) +@msg not a swatch library (format `{_1}`) no es una biblioteca de muestras (formato `{_1}`) +@msg not a swatch library: {e} no es una biblioteca de muestras: {e} +@msg not an action set file ({e}) no es un archivo de conjunto de acciones ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray el espacio de color {other} del perfil no es RGB, CMYK ni Gray +@msg regular expression too large expresión regular demasiado grande +@msg script file is not UTF-8 text: {value} el archivo de script no es texto UTF-8: {value} +@msg stop {i}: {e} parada {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) no se admite la versión {major}.{minor} de intercambio de muestras (solo 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors el libro de colores contiene más de {ASE_MAX_ENTRIES} colores +@msg the color book is cut short el libro de colores está truncado +@msg the color book's names take more than {_1} MB los nombres del libro de colores ocupan más de {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution la imagen mediría {w} × {h} píxeles; las exportaciones de mapa de bits se limitan a {MAX_RASTER_SIDE} píxeles por lado y {_1} megapíxeles: baja la escala o la resolución +@msg the optimised image can't be read back: {e} la imagen optimizada no se puede volver a leer: {e} +@msg the pixel buffer doesn't match the image size el búfer de píxeles no coincide con el tamaño de la imagen +@msg the preview: {e} la previsualización: {e} +@msg the request may not read the New Document profiles folder la solicitud no puede leer la carpeta de perfiles de Nuevo documento +@msg the shapes are too degenerate to combine las formas están demasiado degeneradas para combinarlas +@msg the shapes cross themselves and each other too often to combine las formas se cruzan consigo mismas y entre sí demasiadas veces para combinarlas +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups el archivo de intercambio de muestras contiene más de {ASE_MAX_ENTRIES} colores y grupos +@msg the swatch exchange file is cut short el archivo de intercambio de muestras está truncado +@msg the {_1} plate can't be read: {e} no se puede leer la plancha {_1}: {e} +@msg this binary DXF file is damaged or cut short este archivo DXF binario está dañado o truncado +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that este es un dibujo DWG, que no se puede leer: guárdalo desde la aplicación de CAD como DXF y abre ese archivo +@msg too many classes demasiadas clases +@msg too many groups demasiados grupos +@msg too many layers for PSD (at most 32767) demasiadas capas para PSD (como máximo 32767) +@msg too many swatch exchange blocks demasiados bloques de intercambio de muestras +@msg unknown colour profile: {0} perfil de color desconocido: {0} +@msg {_1} clashes with a built-in profile name {_1} coincide con el nombre de un perfil integrado +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} píxeles es demasiado grande para GIF (como máximo 65535 píxeles por lado): baja la resolución +@msg {_1}: no usable transform to/from sRGB {_1}: no hay ninguna transformación utilizable a sRGB ni desde sRGB +@msg {name} is not a CMYK profile {name} no es un perfil CMYK +@msg {name} is not an RGB profile {name} no es un perfil RGB +@msg {path}: could not be read {path}: no se pudo leer +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} píxeles es demasiado grande para JPEG (como máximo 65535 píxeles por lado): baja la resolución +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} píxeles es demasiado grande para Targa (como máximo 65535 píxeles por lado): baja la resolución +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} píxeles es demasiado grande para PSD (como máximo {MAX_SIDE} píxeles por lado): baja la resolución + # Copy Troubleshooting Info Copy Troubleshooting Info Copiar información de solución de problemas @msg Copied the troubleshooting info Se copió la información de solución de problemas @@ -7407,6 +7532,12 @@ breakText Glyphs Glifos @msg open the practice sample of `{id}` first (see learn.openSample) abre primero la muestra de práctica de `{id}` (consulta learn.openSample) @msg finish `{id}` first (see learn.finish) termina primero `{id}` (consulta learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` es el último tutorial de su habilidad + Reset progress Restablecer progreso + Mark Tutorial Step Marcar paso del tutorial + Reset Learn Progress Restablecer progreso de aprendizaje +@msg missing `step` (see learn.show) falta `step` (consulta learn.show) +@msg `step` must be a step number from 0 to {last} `step` debe ser un número de paso de 0 a {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` está terminado (consulta learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Actualizar efectos aplazados diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index 45e47fd355..d408220f47 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -214,6 +214,8 @@ Crop Image Rajaa kuva Image Tools Kuvatyökalut Remove Background… Poista tausta… + Draw (Pencil) Piirrä (lyijykynä) + Place Image Sijoita kuva Remove Background Poista tausta Background Tausta Edge Color Reunan väri @@ -985,6 +987,7 @@ VectorCraft Title Bar on Every Desktop VectorCraftin otsikkorivi kaikissa työpöytäympäristöissä The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Ympäristömuuttuja VECTORCRAFT_TITLEBAR valitsee otsikkorivin niin kauan kuin se on asetettu. System Title Bar takes precedence over this option while it is on. Järjestelmän otsikkorivi ohittaa tämän asetuksen niin kauan kuin se on käytössä. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Niin kauan kuin VectorCraftin otsikkorivi kaikissa työpöytäympäristöissä ei ole käytössä, tämä työpöytäympäristö piirtää ikkunan otsikkorivin, oli tämä asetus käytössä tai ei. Exit Lopeta Distort Vääristä Diffuse Glow… Hajautettu hehku… @@ -1573,6 +1576,7 @@ lighting Light Valo Proportional Metrics Suhteelliset metriikat Insert Aki Left Lisää aki vasemmalle Insert Aki Right Lisää aki oikealle + Tsume Tsume Character Direction Merkkien suunta Digits Numerot Arabic Arabia @@ -4712,6 +4716,7 @@ imageTrace Outline Ääriviiva @msg `select` must be true or false `select` on oltava true tai false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` ja `maxAnchors` on oltava kokonaislukuja @msg `{key}` must be a number not below 0 `{key}` on oltava luku, joka on vähintään 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` on oltava neljä lukua, jotka ovat vähintään 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` on oltava [x, y, width, height]: neljä äärellistä lukua, joista leveys ja korkeus eivät ole negatiivisia @msg `{min_key}` is greater than `{max_key}` `{min_key}` on suurempi kuin `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` anna vähintään yksi parametreista `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4956,6 +4961,7 @@ imageTrace Outline Ääriviiva @msg no action set to save ei tallennettavaa toimintosarjaa @msg the action set file can't be read in full toimintosarjatiedostoa ei voi lukea kokonaan @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Ladattiin ”{name}”: jätettiin pois {n} vaihe|Ladattiin ”{name}”: jätettiin pois {n} vaihetta +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Ladattiin ”{name}”: {n} vaiheella on tuntematon komento, ja se säilytettiin: ”{action}”, vaihe {step}, `{command}`|Ladattiin ”{name}”: {n} vaiheella on tuntemattomia komentoja, ja ne säilytettiin; ensimmäinen: ”{action}”, vaihe {step}, `{command}` @msg not an action set file ei ole toimintosarjatiedosto @msg the action set file is larger than 8 MiB toimintosarjatiedosto on suurempi kuin 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: viite olisi suurempi kuin {MAX_BYTES} tavua @@ -5189,6 +5195,7 @@ imageTrace Outline Ääriviiva @msg tool shortcuts must be a single key (optionally with Shift) työkalujen pikanäppäinten on oltava yksittäinen näppäin (valinnaisesti Vaihto-näppäimen kanssa) @msg truncated katkaistu @msg unknown command `{0}` tuntematon komento `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` toiminnon ”{action}” vaihe {step} suorittaa tuntemattoman komennon `{command}` @msg unknown command `{0}`; did you mean `{1}`? tuntematon komento `{0}`; tarkoititko `{1}`? @msg unknown effect `{id}` tuntematon tehoste `{id}` @msg unknown format tuntematon muoto @@ -6419,8 +6426,8 @@ axis Y Axis Y-akseli @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` vientilaajennus ilmoittaa 1–{MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` ryhmien ulkopuolella saa olla enintään {MAX_UNGROUPED} parametria: anna muille `group` @msg can't encode the input syötettä ei voi koodata -@msg expected {"dataBase64"} odotettiin {"dataBase64"} -@msg expected {"objects"} odotettiin {"objects"} +@msg expected {{"dataBase64": "…"}} odotettiin {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} odotettiin {{"objects": [...]}} @msg export `{name}`: {e} moduulin vienti `{name}`: {e} @msg extension {e} is listed twice tunniste {e} on luettelossa kahdesti @msg extension {e}: use 1-16 lower-case letters and digits, without the dot tunniste {e}: käytä 1-16 pientä kirjainta ja numeroa ilman pistettä @@ -6484,11 +6491,11 @@ axis Y Axis Y-akseli @msg a painted live effect returns only `objects` maalaava live-tehoste palauttaa vain kentän `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` maalaavan live-tehosteen osalla on vain `path`, `fillRule`, `fills` ja `strokes` @msg a read-only object was left out vain luku -objekti jätettiin pois -@msg a read-only object was left out: return it, as {"id"} alone or as it was given vain luku -objekti jätettiin pois: palauta se pelkkänä {"id"}-muotona tai sellaisena kuin se annettiin +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given vain luku -objekti jätettiin pois: palauta se pelkkänä {{"id": …}}-muotona tai sellaisena kuin se annettiin @msg a string merkkijono @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` viivalla on vain `paint`, `width`, `join`, `cap` ja `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} viivan on oltava muotoa {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} tehosteen on oltava muotoa {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} viivan on oltava muotoa {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} tehosteen on oltava muotoa {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` täytön tehoste palauttaa vain kentän `fills` @msg an effect on a stroke returns only `strokes` viivan tehoste palauttaa vain kentän `strokes` @msg an object must be a JSON object objektin on oltava JSON-objekti @@ -6630,6 +6637,8 @@ axis Y Axis Y-akseli Action Options… Toiminnon asetukset… Action Options Toiminnon asetukset Playback Options… Toistoasetukset… + Button Mode Painiketila + No actions. Ei toimintoja. Insert Stop… Lisää pysäytys… Insert Stop Lisää pysäytys Record Stop Nauhoita pysäytys @@ -7498,6 +7507,12 @@ breakText Glyphs Merkit @msg open the practice sample of `{id}` first (see learn.openSample) avaa ensin opetusohjelman `{id}` harjoitustiedosto (ks. learn.openSample) @msg finish `{id}` first (see learn.finish) viimeistele ensin `{id}` (ks. learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` on taitonsa viimeinen opetusohjelma + Reset progress Palauta edistyminen + Mark Tutorial Step Merkitse opetusohjelman vaihe + Reset Learn Progress Palauta oppimisen edistyminen +@msg missing `step` (see learn.show) `step` puuttuu (ks. learn.show) +@msg `step` must be a step number from 0 to {last} `step` on oltava vaiheen numero, vähintään 0 ja enintään {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` on viimeistelty (ks. learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Päivitä lykätyt tehosteet @@ -7527,3 +7542,122 @@ breakText Glyphs Merkit Grommets Purjerenkaat Grommet Inset Purjerenkaiden etäisyys reunasta Diameter Halkaisija + +# Messages of the effects, 3D, image and PDF export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D-tehosteet vaativat äärelliset koordinaatit 100 miljoonan pisteen rajoissa +@msg 3D effects require one to ten lights 3D-tehosteet vaativat 1–10 valonlähdettä +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP-värisyvyys {_1}: 1, 4, 8, 16, 24 tai 32 bittiä pikseliä kohti +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP-koodaus epäonnistui: {width} × {height} pikseliä ei mahdu tiedostomuotoon tai pikselipuskuriin +@msg GIF encoding failed: the palette image is malformed GIF-koodaus epäonnistui: palettikuva on virheellinen +@msg GIF encoding failed: {e} GIF-koodaus epäonnistui: {e} +@msg JPEG colour profile: {e} JPEG-väriprofiili: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG-koodaus epäonnistui: pikselipuskuri ei vastaa kuvan kokoa +@msg JPEG encoding failed: {e} JPEG-koodaus epäonnistui: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG-koodaus epäonnistui: pikselipuskuri ei vastaa kuvan kokoa +@msg PNG encoding failed: the palette image is malformed PNG-koodaus epäonnistui: palettikuva on virheellinen +@msg PNG encoding failed: {e} PNG-koodaus epäonnistui: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG-koodaus epäonnistui: {width} × {height} pikseliä ei ole kelvollinen kuvakoko +@msg PSD colour profile: {e} PSD-väriprofiili: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD-koodaus epäonnistui: pikselipuskuri ei vastaa kuvan kokoa +@msg Revolve profile contains invalid coordinates Pyöräytä-tehosteen profiilissa on virheellisiä koordinaatteja +@msg Revolve profile is too complex Pyöräytä-tehosteen profiili on liian monimutkainen +@msg Revolve projection is not finite Pyöräytä-tehosteen projektio ei ole äärellinen +@msg Revolve requires finite profile coordinates within 100 million points Pyöräytä vaatii äärelliset profiilin koordinaatit 100 miljoonan pisteen rajoissa +@msg Revolve surface is too complex; reduce Segments or simplify the profile Pyöräytä-tehosteen pinta on liian monimutkainen; pienennä Segmentit-arvoa tai yksinkertaista profiilia +@msg Revolve surface is too complex; simplify the profile Pyöräytä-tehosteen pinta on liian monimutkainen; yksinkertaista profiilia +@msg Revolve visibility cannot split the projected boundary Pyöräytä-tehosteen näkyvyyslaskenta ei voi jakaa projisoitua reunaa +@msg Revolve visibility creates too many fragments Pyöräytä-tehosteen näkyvyyslaskenta tuottaa liikaa osia +@msg Revolve visibility creates too many vector anchors Pyöräytä-tehosteen näkyvyyslaskenta tuottaa liikaa vektorin ankkuripisteitä +@msg Revolve visibility exceeds its geometry work limit Pyöräytä-tehosteen näkyvyyslaskenta ylittää geometrialaskennan työmäärän rajan +@msg Revolve visibility exceeds its spatial index limit Pyöräytä-tehosteen näkyvyyslaskenta ylittää paikkaindeksin rajan +@msg Revolve visibility has too many boundary crossings Pyöräytä-tehosteen näkyvyyslaskennassa on liikaa reunan ylityksiä +@msg Revolve visibility has too many input anchors Pyöräytä-tehosteen näkyvyyslaskennassa on liikaa syötteen ankkuripisteitä +@msg Revolve visibility requires convex cap sectors Pyöräytä-tehosteen näkyvyyslaskenta vaatii kuperat päätysektorit +@msg Revolve visibility requires finite projected faces Pyöräytä-tehosteen näkyvyyslaskenta vaatii äärelliset projisoidut tahkot +@msg SVG options: {e} SVG-asetukset: {e} +@msg Save for Web settings: {e} Verkkotallennuksen asetukset: {e} +@msg TIFF colour profile: {e} TIFF-väriprofiili: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF-koodaus epäonnistui: pikselipuskuri ei vastaa kuvan kokoa +@msg TIFF encoding failed: {e} TIFF-koodaus epäonnistui: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa-värisyvyys {_1}: 16, 24 tai 32 bittiä pikseliä kohti +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa-koodaus epäonnistui: pikselipuskuri ei vastaa kuvan kokoa +@msg The 3D projection is not finite 3D-projektio ei ole äärellinen +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D-varjo on liian monimutkainen; poista Varjot käytöstä tai yksinkertaista kuvitusta +@msg The shape contains invalid coordinates Muodossa on virheellisiä koordinaatteja +@msg Too many Revolve faces for visibility evaluation Pyöräytä-tehosteessa on liian monta tahkoa näkyvyyden arviointiin +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft lukee värimallien vaihtotiedostosta enintään {ASE_MAX_ENTRIES} väriä ja ryhmää, ja tässä kirjastossa niitä on {entries} +@msg WebP encoding failed: {e} WebP-koodaus epäonnistui: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `index` must be a whole number `index` on oltava kokonaisluku +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` on smallThumb, mediumThumb, largeThumb, smallList tai largeList +@msg a line can't run from a point to itself viiva ei voi kulkea pisteestä samaan pisteeseen +@msg a line needs at least two points viiva tarvitsee vähintään kaksi pistettä +@msg a number cannot be read lukua ei voi lukea +@msg a swatch exchange block is too long värimallien vaihtotiedoston lohko on liian pitkä +@msg a swatch exchange name is too long värimallien vaihtotiedoston nimi on liian pitkä +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels {sw} × {sh} -kuvan kokoa ei voi muuttaa kokoon {width} × {height} pikseliä +@msg a {width} × {height} image is too large {width} × {height} -kuva on liian suuri +@msg a {width} × {height} image: {e} {width} × {height} -kuva: {e} +@msg an image could not be written: {e} kuvaa ei voitu kirjoittaa: {e} +@msg an image that couldn't be read was left out kuva, jota ei voitu lukea, jätettiin pois +@msg can't open “{name}”: {e} tiedostoa ”{name}” ei voi avata: {e} +@msg cannot align zip entries to {align} bytes zip-merkintöjä ei voi tasata {align} tavun rajoihin +@msg cannot open the automation {kind} root `{_1}`: {e} automaation {kind}-juurikansiota `{_1}` ei voi avata: {e} +@msg cannot read profile: {0} profiilia ei voi lukea: {0} +@msg color book version {version} isn't supported (only 1) värikirjan versiota {version} ei tueta (vain 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) väriavaruuden {other} värikirjoja ei tueta (vain RGB, CMYK ja Lab) +@msg file name too long to zip: {_1} tiedostonimi on liian pitkä zip-pakettiin: {_1} +@msg file name too long to zip: {name} tiedostonimi on liian pitkä zip-pakettiin: {name} +@msg freeform line {i}: {e} vapaamuotoinen viiva {i}: {e} +@msg freeform point {i}: {e} vapaamuotoinen piste {i}: {e} +@msg give `{key}` or `{other}`, not both anna `{key}` tai `{other}`, ei molempia +@msg grayscale profiles can't be working spaces yet harmaasävyprofiileja ei voi vielä käyttää työväriavaruuksina +@msg input contains NaN or infinite coordinates syötteessä on NaN-arvoja tai äärettömiä koordinaatteja +@msg input path could not be closed syötepolkua ei voitu sulkea +@msg invalid ICC profile: {0} virheellinen ICC-profiili: {0} +@msg invalid scale {scale} virheellinen skaalaus {scale} +@msg its localized names take more than {_1} KB sen lokalisoidut nimet vievät yli {_1} KB +@msg its objects are nested too deep ({e}) sen objektit ovat sisäkkäin liian monella tasolla ({e}) +@msg its tag table lists the `{_1}` tag more than once sen tunnistetaulukossa `{_1}`-tunniste on useammin kuin kerran +@msg knockout groups with too many overlapping translucent elements are written as PDF knockout groups: their translucent elements knock out what they cover fully poistoryhmät, joissa on liian monta päällekkäistä läpikuultavaa elementtiä, kirjoitetaan PDF-poistoryhminä: niiden läpikuultavat elementit poistavat peittämänsä alueen kokonaan +@msg knockout groups with brushed strokes over other translucent elements are written as PDF knockout groups: their translucent elements knock out what they cover fully poistoryhmät, joissa on sivellinviivoja muiden läpikuultavien elementtien päällä, kirjoitetaan PDF-poistoryhminä: niiden läpikuultavat elementit poistavat peittämänsä alueen kokonaan +@msg not a graphic style library: {e} ei grafiikkatyylikirjasto: {e} +@msg not a swatch library (.vcswatches or .gpl) ei värimallikirjasto (.vcswatches tai .gpl) +@msg not a swatch library (format `{_1}`) ei värimallikirjasto (muoto `{_1}`) +@msg not a swatch library: {e} ei värimallikirjasto: {e} +@msg not an action set file ({e}) ei toimintosarjatiedosto ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray profiilin väriavaruus {other} ei ole RGB, CMYK tai Gray +@msg regular expression too large säännöllinen lauseke on liian suuri +@msg script file is not UTF-8 text: {value} komentosarjatiedosto ei ole UTF-8-tekstiä: {value} +@msg stop {i}: {e} väripiste {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) värimallien vaihtotiedoston versiota {major}.{minor} ei tueta (vain 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors värikirjassa on yli {ASE_MAX_ENTRIES} väriä +@msg the color book is cut short värikirja on katkennut +@msg the color book's names take more than {_1} MB värikirjan nimet vievät yli {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution kuvasta tulisi {w} × {h} pikseliä; rasteriviennin raja on {MAX_RASTER_SIDE} pikseliä sivua kohti ja {_1} megapikseliä: pienennä skaalausta tai tarkkuutta +@msg the optimised image can't be read back: {e} optimoitua kuvaa ei voi lukea takaisin: {e} +@msg the pixel buffer doesn't match the image size pikselipuskuri ei vastaa kuvan kokoa +@msg the preview: {e} esikatselu: {e} +@msg the request may not read the New Document profiles folder pyyntö ei saa lukea uuden asiakirjan profiilien kansiota +@msg the shapes are too degenerate to combine muodot ovat liian surkastuneita yhdistettäviksi +@msg the shapes cross themselves and each other too often to combine muodot leikkaavat itseään ja toisiaan liian usein yhdistettäviksi +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups värimallien vaihtotiedostossa on yli {ASE_MAX_ENTRIES} väriä ja ryhmää +@msg the swatch exchange file is cut short värimallien vaihtotiedosto on katkennut +@msg the {_1} plate can't be read: {e} {_1}-painolevyä ei voi lukea: {e} +@msg this binary DXF file is damaged or cut short tämä binäärinen DXF-tiedosto on vioittunut tai katkennut +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that tämä on DWG-piirustus, jota ei voi lukea: tallenna se CAD-sovelluksesta DXF-muodossa ja avaa se +@msg too many classes liikaa luokkia +@msg too many groups liikaa ryhmiä +@msg too many layers for PSD (at most 32767) liikaa tasoja PSD-tiedostoon (enintään 32767) +@msg too many swatch exchange blocks liikaa värimallien vaihtotiedoston lohkoja +@msg unknown colour profile: {0} tuntematon väriprofiili: {0} +@msg {_1} clashes with a built-in profile name {_1} on ristiriidassa sisäisen profiilin nimen kanssa +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pikseliä on liian suuri GIF-kuvalle (enintään 65535 pikseliä sivua kohti): pienennä tarkkuutta +@msg {_1}: no usable transform to/from sRGB {_1}: ei käyttökelpoista muunnosta sRGB:hen tai sRGB:stä +@msg {name} is not a CMYK profile {name} ei ole CMYK-profiili +@msg {name} is not an RGB profile {name} ei ole RGB-profiili +@msg {path}: could not be read {path}: ei voitu lukea +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pikseliä on liian suuri JPEG-kuvalle (enintään 65535 pikseliä sivua kohti): pienennä tarkkuutta +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pikseliä on liian suuri Targa-kuvalle (enintään 65535 pikseliä sivua kohti): pienennä tarkkuutta +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pikseliä on liian suuri PSD-kuvalle (enintään {MAX_SIDE} pikseliä sivua kohti): pienennä tarkkuutta diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 057dce6872..318bbbeb44 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -707,6 +707,8 @@ font-technology Variable Variables Crop Image Recadrer l’image Image Tools Outils d’image Remove Background… Supprimer l’arrière-plan… + Draw (Pencil) Dessiner (Crayon) + Place Image Importer une image Remove Background Supprimer l’arrière-plan Background Arrière-plan Edge Color Couleur du bord @@ -2656,6 +2658,7 @@ font-technology Variable Variables Proportional Metrics Métrique proportionnelle Insert Aki Left Insérer un aki à gauche Insert Aki Right Insérer un aki à droite + Tsume Tsume Character Direction Direction des caractères Digits Chiffres Arabic Arabes @@ -4478,6 +4481,7 @@ axis Both Les deux @msg `select` must be true or false `select` doit valoir true ou false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` et `maxAnchors` doivent être des nombres entiers @msg `{key}` must be a number not below 0 `{key}` doit être un nombre supérieur ou égal à 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` doit être quatre nombres supérieurs ou égaux à 0 : [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` doit être [x, y, width, height] : quatre nombres finis, largeur et hauteur non négatives @msg `{min_key}` is greater than `{max_key}` `{min_key}` est supérieur à `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indiquez au moins l’un des paramètres `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4730,6 +4734,7 @@ axis Both Les deux @msg no action set to save aucun jeu de scripts à enregistrer @msg the action set file can't be read in full le fichier de jeu de scripts ne peut pas être lu en entier @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out « {name} » chargé : {n} étape a été ignorée|« {name} » chargé : {n} étapes ont été ignorées +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` « {name} » chargé : {n} étape a une commande inconnue et a été conservée : « {action} », étape {step}, `{command}`|« {name} » chargé : {n} étapes ont des commandes inconnues et ont été conservées ; la première : « {action} », étape {step}, `{command}` @msg not an action set file ce n’est pas un fichier de jeu de scripts @msg the action set file is larger than 8 MiB le fichier de jeu de scripts dépasse 8 Mio @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}` : la référence dépasserait {MAX_BYTES} octets @@ -4971,6 +4976,7 @@ axis Both Les deux @msg tool shortcuts must be a single key (optionally with Shift) les raccourcis d’outils doivent être une seule touche (éventuellement avec Maj) @msg truncated tronqué @msg unknown command `{0}` commande inconnue `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` l’étape {step} de « {action} » exécute la commande inconnue `{command}` @msg unknown command `{0}`; did you mean `{1}`? commande inconnue `{0}` ; vouliez-vous dire `{1}` ? @msg unknown effect `{id}` effet inconnu `{id}` @msg unknown format format inconnu @@ -5331,6 +5337,7 @@ effect Soft Doux VectorCraft Title Bar on Every Desktop Barre de titre de VectorCraft sur tous les bureaux The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Tant qu’elle est définie, la variable d’environnement VECTORCRAFT_TITLEBAR choisit la barre de titre. System Title Bar takes precedence over this option while it is on. Tant qu’elle est activée, Barre de titre du système a priorité sur cette option. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Tant que Barre de titre de VectorCraft sur tous les bureaux est désactivée, ce bureau dessine la barre de titre de la fenêtre, que cette option soit activée ou non. Value Axis Axe des valeurs On Left Side À gauche On Right Side À droite @@ -6384,8 +6391,8 @@ axis Y Axis Axe Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` un module externe d’exportation déclare de 1 à {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` {MAX_UNGROUPED} paramètres au plus hors des groupes : donnez un `group` aux autres @msg can't encode the input impossible d’encoder l’entrée -@msg expected {"dataBase64"} attendu : {"dataBase64"} -@msg expected {"objects"} attendu : {"objects"} +@msg expected {{"dataBase64": "…"}} attendu : {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} attendu : {{"objects": [...]}} @msg export `{name}`: {e} export du module `{name}` : {e} @msg extension {e} is listed twice l’extension {e} figure deux fois @msg extension {e}: use 1-16 lower-case letters and digits, without the dot extension {e} : utilisez 1-16 lettres minuscules et chiffres, sans le point @@ -6449,11 +6456,11 @@ axis Y Axis Axe Y @msg a painted live effect returns only `objects` un effet dynamique de peinture renvoie seulement `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` une pièce d’un effet dynamique de peinture a seulement `path`, `fillRule`, `fills` et `strokes` @msg a read-only object was left out un objet en lecture seule a été omis -@msg a read-only object was left out: return it, as {"id"} alone or as it was given un objet en lecture seule a été omis : renvoyez-le, sous la forme {"id"} seul ou tel qu’il a été fourni +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given un objet en lecture seule a été omis : renvoyez-le, sous la forme {{"id": …}} seul ou tel qu’il a été fourni @msg a string une chaîne @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` un contour a seulement `paint`, `width`, `join`, `cap` et `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} un contour doit être {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} un effet doit être {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} un contour doit être {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} un effet doit être {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` un effet sur un fond renvoie seulement `fills` @msg an effect on a stroke returns only `strokes` un effet sur un contour renvoie seulement `strokes` @msg an object must be a JSON object un objet doit être un objet JSON @@ -6595,6 +6602,8 @@ axis Y Axis Axe Y Action Options… Options de script… Action Options Options de script Playback Options… Options d’exécution… + Button Mode Mode Bouton + No actions. Aucun script. Insert Stop… Insérer un arrêt… Insert Stop Insérer un arrêt Record Stop Enregistrer un arrêt @@ -7458,6 +7467,12 @@ breakText Glyphs Glyphes @msg open the practice sample of `{id}` first (see learn.openSample) ouvrez d’abord le fichier d’exercice de `{id}` (voir learn.openSample) @msg finish `{id}` first (see learn.finish) terminez d’abord `{id}` (voir learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` est le dernier tutoriel de sa compétence + Reset progress Réinitialiser la progression + Mark Tutorial Step Marquer une étape du tutoriel + Reset Learn Progress Réinitialiser la progression d’apprentissage +@msg missing `step` (see learn.show) `step` manquant (voir learn.show) +@msg `step` must be a step number from 0 to {last} `step` doit être un numéro d’étape de 0 à {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` est terminé (voir learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Actualiser les effets différés @@ -7481,9 +7496,1929 @@ breakText Glyphs Glyphes Margin Marge Box Cadre Swatch Nuance +@msg 'caller', 'callee' and 'arguments' cannot be used on strict mode functions 'caller', 'callee' et 'arguments' ne peuvent pas être utilisés sur les fonctions en mode strict +@msg A profile supports one Revolve effect. Edit the existing effect's options instead. Un profil accepte un seul effet Révolution. Modifiez plutôt les options de l’effet existant. +@msg Add Points at Crossings: a path went missing Ajouter des points aux intersections : un tracé a disparu +@msg Boolean.prototype.{name} was called on a value that is not a Boolean Boolean.prototype.{name} a été appelé sur une valeur qui n’est pas un booléen +@msg CMYK images whose samples couldn't be read in CMYK were imported in RGB Les images CMJN dont les échantillons n’ont pas pu être lus en CMJN ont été importées en RVB +@msg CSS options: {e} Options CSS : {e} +@msg CSV has a header but no data rows Le fichier CSV a un en-tête mais aucune ligne de données +@msg CSV holds NUL bytes: save it as UTF-8, or as UTF-16 with a byte-order mark Le fichier CSV contient des octets NUL : enregistrez-le en UTF-8, ou en UTF-16 avec une marque d’ordre des octets +@msg CSV is empty Le fichier CSV est vide +@msg CSV is larger than {MAX_CSV_BYTES} bytes Le fichier CSV dépasse {MAX_CSV_BYTES} octets +@msg CSV is not UTF-16 Le fichier CSV n’est pas en UTF-16 +@msg CSV is not UTF-8 Le fichier CSV n’est pas en UTF-8 +@msg CSV would be larger than {MAX_CSV_BYTES} bytes Le fichier CSV dépasserait {MAX_CSV_BYTES} octets +@msg Cannot write to the location of “{name}”; choose where to save it Impossible d’écrire à l’emplacement de « {name} » ; choisissez où l’enregistrer +@msg Choose original artwork, not a dimension's generated paths Choisissez l’illustration d’origine, pas les tracés générés d’une cote +@msg Contour: select paths or shapes Contour : sélectionnez des tracés ou des formes +@msg Contour: the Offset Path effect is not available Contour : l’effet Décalage n’est pas disponible +@msg Create needs fills, strokes or both La création nécessite des fonds, des contours ou les deux +@msg DCS files can only be placed linked: use File › Place with Link on Les fichiers DCS ne peuvent être importés que liés : utilisez Fichier › Importer avec l’option Lien activée +@msg DXF options: {e} Options DXF : {e} +@msg DXF scale must be a positive number up to {_1}, not {scale} L’échelle DXF doit être un nombre positif d’au plus {_1}, pas {scale} +@msg DXF {field} `{s}`: {allowed} DXF {field} `{s}` : {allowed} +@msg Date.prototype method called on a value that is not a Date object Méthode de Date.prototype appelée sur une valeur qui n’est pas un objet Date +@msg Dimension is locked or hidden La cote est verrouillée ou masquée +@msg Dimension mode does not match its source Le mode de la cote ne correspond pas à sa source +@msg Draw Inside needs exactly one selected path, compound path or text Dessin intérieur nécessite exactement un tracé, un tracé transparent ou un texte sélectionné +@msg EPS Save writes all artwork: use document.export for selected-only EPS L’enregistrement EPS écrit toute l’illustration : utilisez document.export pour un EPS de la sélection seule +@msg EPS flattener: {e} Aplatissement EPS : {e} +@msg EPS options: {e} Options EPS : {e} +@msg EPS {field} `{s}`: {allowed} EPS {field} `{s}` : {allowed} +@msg Error.prototype.toString was called on a value that is not an object Error.prototype.toString a été appelé sur une valeur qui n’est pas un objet +@msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft Exporter pour les écrans écrit png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai ou vectorcraft +@msg Flare click coordinates must be finite numbers Les coordonnées du clic de l’halo doivent être des nombres finis +@msg Function.prototype.toString was called on a value that is not a function Function.prototype.toString a été appelé sur une valeur qui n’est pas une fonction +@msg HTML Text applies to object slices of type only Texte HTML s’applique uniquement aux tranches d’objet de texte +@msg Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces) Identifier les objets par est réglé sur ID XML : le nom doit être un ID XML valide (commençant par une lettre, un trait de soulignement ou deux-points ; sans espaces) +@msg Image Trace failed: internal error: its thread stopped (please report this bug) Échec de la vectorisation de l’image : erreur interne : son thread s’est arrêté (merci de signaler ce bogue) +@msg Image Trace failed: {e} Échec de la vectorisation de l’image : {e} +@msg Image Trace finished, but its document was closed La vectorisation de l’image est terminée, mais son document a été fermé +@msg Image Trace finished, but the image or its settings changed meanwhile: trace it again La vectorisation de l’image est terminée, mais l’image ou ses réglages ont changé entre-temps : vectorisez-la à nouveau +@msg Import SVG Filter reads SVG files, not SVGZ Importer un filtre SVG lit les fichiers SVG, pas SVGZ +@msg Invalid dimension offset Décalage de cote non valide +@msg Invalid point Point non valide +@msg JSON.parse: {why} (at offset {at}) JSON.parse : {why} (à la position {at}) +@msg JSON.stringify cannot write a structure that contains itself JSON.stringify ne peut pas écrire une structure qui se contient elle-même +@msg Join: a subpath went missing Joindre : un sous-tracé a disparu +@msg Lock Workspace is not available in VectorCraft Verrouiller l’espace de travail n’est pas disponible dans VectorCraft +@msg Move Panel to New Window is not available: floating panels stay in the main window Déplacer le panneau dans une nouvelle fenêtre n’est pas disponible : les panneaux flottants restent dans la fenêtre principale +@msg Namespace.prototype.toString needs a Namespace Namespace.prototype.toString nécessite un Namespace +@msg New Document profiles need the preferences folder, which this run doesn't have Les profils de nouveau document nécessitent le dossier des préférences, dont cette exécution ne dispose pas +@msg Number.prototype.{name} was called on a value that is not a number Number.prototype.{name} a été appelé sur une valeur qui n’est pas un nombre +@msg Object.create's prototype must be an object or null Le prototype d’Object.create doit être un objet ou null +@msg Object.{function} was given a value that is not an object Object.{function} a reçu une valeur qui n’est pas un objet +@msg Offset Path: the path is too complex to offset Décalage : le tracé est trop complexe pour être décalé +@msg Offset Path: {e} Décalage : {e} +@msg PDF content is incomplete or exceeds the reader's limits; no document was imported Le contenu PDF est incomplet ou dépasse les limites du lecteur ; aucun document n’a été importé +@msg PDF flattener: {e} Aplatissement PDF : {e} +@msg PDF options: {e} Options PDF : {e} +@msg QName.prototype.toString needs a QName QName.prototype.toString nécessite un QName +@msg Recolor Artwork is no longer open Redéfinir les couleurs de l’illustration n’est plus ouvert +@msg RegExp.prototype.{name} was called on a value that is not a RegExp object RegExp.prototype.{name} a été appelé sur une valeur qui n’est pas un objet RegExp +@msg SVG is not UTF-8, UTF-16 or ISO 8859-1 Le SVG n’est pas en UTF-8, UTF-16 ou ISO 8859-1 +@msg Save writes one artboard: name one, or export several with document.export L’enregistrement écrit un seul plan de travail : indiquez-en un, ou exportez-en plusieurs avec document.export +@msg Select a dimension first Sélectionnez d’abord une cote +@msg Select dimensions to update Sélectionnez les cotes à mettre à jour +@msg Select only dimensions Sélectionnez uniquement des cotes +@msg Select two or more objects, or a group Sélectionnez au moins deux objets, ou un groupe +@msg Shaper needs 1–64 source paths Shaper nécessite de 1 à 64 tracés source +@msg Stencil Bridges: the selected art is too large or too detailed to bridge Ponts de pochoir : l’illustration sélectionnée est trop grande ou trop détaillée pour être reliée +@msg String.prototype.toString was called on a value that is not a string String.prototype.toString a été appelé sur une valeur qui n’est pas une chaîne +@msg Switch x/y is for scatter graphs Permuter x/y s’applique aux graphes de dispersion +@msg Text options: {e} Options du texte : {e} +@msg The {name} profile could not be read, so the new document has the default settings: {reason} Le profil {name} n’a pas pu être lu, le nouveau document a donc les réglages par défaut : {reason} +@msg Trap: more than {_1} pairs of objects lie close enough to trap, or too many objects share a horizontal range; trap fewer objects at a time Recouvrement : plus de {_1} paires d’objets sont assez proches pour un recouvrement, ou trop d’objets partagent une même plage horizontale ; traitez moins d’objets à la fois +@msg Weed Box and Lines: no weeding line fits outside the art, and the weed box is off Cadre et lignes d’échenillage : aucune ligne d’échenillage ne tient hors de l’illustration, et le cadre d’échenillage est désactivé +@msg \ at end of pattern \ à la fin du motif +@msg `alignOn` cannot be empty `alignOn` ne peut pas être vide +@msg `alignOn` must be a string `alignOn` doit être une chaîne +@msg `align` is start, center or end `align` vaut start, center ou end +@msg `align` must be a string `align` doit être une chaîne +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` doit être une liste de paires [subpath, anchor] +@msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` doit lister des indices de points d’ancrage (0, 1, 2…), pas {k} +@msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` doit lister des indices de points d’ancrage (0, 1, 2…), pas {v} +@msg `answer` for this {kind} dialog must be one of: {_1} `answer` pour cette boîte de dialogue {kind} doit valoir l’une de ces valeurs : {_1} +@msg `answers` has more than {MAX_ANSWERS} answers `answers` contient plus de {MAX_ANSWERS} réponses +@msg `answers` is larger than 1 MiB `answers` dépasse 1 Mio +@msg `answers` must be a list of answers `answers` doit être une liste de réponses +@msg `artboard` must be the index of an artboard of the document `artboard` doit être l’indice d’un plan de travail du document +@msg `artboardsAt` must be [x, y] `artboardsAt` doit être [x, y] +@msg `artboards` must be a list of artboard indices `artboards` doit être une liste d’indices de plans de travail +@msg `artboards` names an artboard the document does not have `artboards` désigne un plan de travail que le document ne contient pas +@msg `artboards` names an artboard twice `artboards` désigne deux fois le même plan de travail +@msg `asset` is the asset id (see assets.list) `asset` est l’identifiant de la ressource (voir assets.list) +@msg `at` must be [x, y] (got {at}) `at` doit être [x, y] (reçu : {at}) +@msg `at` must be a byte offset `at` doit être une position en octets +@msg `autoLeading` must be a number `autoLeading` doit être un nombre +@msg `background` must be "", "matte" or #rrggbb `background` doit valoir "", "matte" ou #rrggbb +@msg `beside` needs `side` `beside` nécessite `side` +@msg `burasagari` must be "none", "standard" or "forced" `burasagari` doit valoir "none", "standard" ou "forced" +@msg `center` must be [x, y] `center` doit être [x, y] +@msg `charAlign` must be "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" or "icfBottom" `charAlign` doit valoir "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" ou "icfBottom" +@msg `charDirection` must be "default", "leftToRight" or "rightToLeft" `charDirection` doit valoir "default", "leftToRight" ou "rightToLeft" +@msg `clearStroke` requires `stroke: false`, `ids: []` and no `stop` `clearStroke` nécessite `stroke: false`, `ids: []` et aucun `stop` +@msg `clear` must be a list of type object ids, not {v} `clear` doit être une liste d’identifiants d’objets texte, pas {v} +@msg `clear` must list type objects; {_1} is not one `clear` doit lister des objets texte ; {_1} n’en est pas un +@msg `clear` must not list `id` `clear` ne doit pas lister `id` +@msg `code` must be a whole number `code` doit être un nombre entier +@msg `colorMode` must be one of rgb, cmyk `colorMode` doit valoir rgb ou cmyk +@msg `color` needs a `rule` to make the theme from `color` nécessite une règle `rule` à partir de laquelle créer le thème +@msg `colors` does not apply to the {name} reduction `colors` ne s’applique pas à la réduction {name} +@msg `colors` is empty `colors` est vide +@msg `colors` must be a whole number from 2 to 256 `colors` doit être un nombre entier compris entre 2 et 256 +@msg `colors` must be at least 9 for the uniform reduction `colors` doit valoir au moins 9 pour la réduction uniforme +@msg `colors` must be between 1 and {MAX_THEME_COLORS} (got {n}) `colors` doit être compris entre 1 et {MAX_THEME_COLORS} (reçu : {n}) +@msg `columnType` is vertical, uniform, repeating or sliding `columnType` vaut vertical, uniform, repeating ou sliding +@msg `columns` must be a whole number 1..50 `columns` doit être un nombre entier de 1 à 50 +@msg `commands` must not be empty `commands` ne doit pas être vide +@msg `contents` goes with `to` `contents` s’utilise avec `to` +@msg `corners` must be sharp, round or square, not `{other}` `corners` doit valoir sharp, round ou square, pas `{other}` +@msg `corners` must list anchor indices (0, 1, 2…), not {v} `corners` doit lister des indices de points d’ancrage (0, 1, 2…), pas {v} +@msg `count` must be a whole number from 0 to {MAX_COUNT} `count` doit être un nombre entier compris entre 0 et {MAX_COUNT} +@msg `count` must be a whole number from 1 to 100 `count` doit être un nombre entier compris entre 1 et 100 +@msg `dataBase64` is larger than the module limit `dataBase64` dépasse la limite des modules +@msg `dataBase64` is not valid base64 `dataBase64` n’est pas du base64 valide +@msg `defaultsOnly` cannot be combined with `ids`, `reverse` or `append` `defaultsOnly` ne peut pas être combiné avec `ids`, `reverse` ou `append` +@msg `depth` and `childLimit` slice the summary: pass `summary: true` `depth` et `childLimit` découpent le résumé : passez `summary: true` +@msg `design` is a design name, or null for plain columns `design` est un nom de motif, ou null pour des colonnes simples +@msg `design` is a design name, or null for the default marker `design` est un nom de motif, ou null pour le repère par défaut +@msg `destinationFolder` is required when destination is `folder` `destinationFolder` est obligatoire quand la destination est `folder` +@msg `destination` must be `none`, `saveAndClose` or `folder` `destination` doit valoir `none`, `saveAndClose` ou `folder` +@msg `diameter` must be from 0.1 to 2500 pt `diameter` doit être compris entre 0.1 et 2500 pt +@msg `digits` must be one of {_1} `digits` doit valoir l’une de ces valeurs : {_1} +@msg `dimImages` is a percentage or false `dimImages` est un pourcentage ou false +@msg `direction` must be "auto", "leftToRight" or "rightToLeft" `direction` doit valoir "auto", "leftToRight" ou "rightToLeft" +@msg `ditherAmount` must be a number from 0 to 100 `ditherAmount` doit être un nombre compris entre 0 et 100 +@msg `each` is the value one design stands for, more than 0 `each` est la valeur que représente un motif, supérieure à 0 +@msg `end` must be "start" or "end" `end` doit valoir "start" ou "end" +@msg `ends` applies to joining exactly two paths `ends` s’applique à la jonction d’exactement deux tracés +@msg `event` must be one of {_1} `event` doit valoir l’une de ces valeurs : {_1} +@msg `every` must be "all", "odd" or "even", not {v} `every` doit valoir "all", "odd" ou "even", pas {v} +@msg `expand` must be true or false `expand` doit valoir true ou false +@msg `fidelity` must be from {lo} to {hi} pt `fidelity` doit être compris entre {lo} et {hi} pt +@msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` doit contenir de 1 à 1000 chemins de fichiers de police trouvés par la dernière recherche text.findFontFiles +@msg `focal` and `radius` cannot be used together `focal` et `radius` ne peuvent pas être utilisés ensemble +@msg `focal` must be an array of [subpath, anchor] pairs `focal` doit être une liste de paires [subpath, anchor] +@msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal` désigne [{si}, {ai}], qui n’est pas un point d’ancrage du tracé +@msg `folder` must be an absolute folder path `folder` doit être le chemin absolu d’un dossier +@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` doit être un objet de balises d’axe et de valeurs, comme {"wght"} +@msg `format` must be a string `format` doit être une chaîne +@msg `format` must be one of {_1} `format` doit valoir l’une de ces valeurs : {_1} +@msg `fractions` is chop or scale `fractions` vaut chop ou scale +@msg `from` and `to` must differ `from` et `to` doivent être différents +@msg `from` has an empty frame `from` a un cadre vide +@msg `from` must be a non-negative integer `from` doit être un entier positif ou nul +@msg `from` must be area type or type on a path `from` doit être un texte captif ou un texte curviligne +@msg `gid` must be a glyph id, not {v} `gid` doit être un identifiant de glyphe, pas {v} +@msg `glyphAlternate` belongs to one character, not to a character style (text.setGlyphAlternate sets it) `glyphAlternate` concerne un seul caractère, pas un style de caractère (text.setGlyphAlternate le définit) +@msg `glyphAlternate` takes only null, which takes a glyph choice away (text.setGlyphAlternate makes one) `glyphAlternate` n’accepte que null, qui retire un choix de glyphe (text.setGlyphAlternate en crée un) +@msg `group` must be one of {_1} `group` doit valoir l’une de ces valeurs : {_1} +@msg `group` must be the Objects on Path group of `member` and `target` `group` doit être le groupe Objets sur tracé de `member` et `target` +@msg `guide` must be a guide index (guide.list) `guide` doit être un indice de repère (guide.list) +@msg `hAlign` must be default, left, center or right `hAlign` doit valoir default, left, center ou right +@msg `id` is an object id, not {v} `id` est un identifiant d’objet, pas {v} +@msg `id` must be a node id `id` doit être un identifiant de nœud +@msg `id` must be an object id, not {v} `id` doit être un identifiant d’objet, pas {v} +@msg `ids` must name Objects on Path groups or objects in them `ids` doit désigner des groupes Objets sur tracé ou des objets qu’ils contiennent +@msg `ids` takes at most {MAX_INSPECT_IDS} ids `ids` accepte au plus {MAX_INSPECT_IDS} identifiants +@msg `imageMap` must be none, rectangle or polygon `imageMap` doit valoir none, rectangle ou polygon +@msg `includeArtboardFill` must be true or false `includeArtboardFill` doit valoir true ou false +@msg `includeSubdirs` must be true or false `includeSubdirs` doit valoir true ou false +@msg `index` must be a point index `index` doit être un indice de point +@msg `index` must be a whole number or null `index` doit être un nombre entier ou null +@msg `indices` must be a non-empty array of item indices `indices` doit être une liste non vide d’indices d’éléments +@msg `item` needs `index` `item` nécessite `index` +@msg `items` is a list of {kind, item} `items` est une liste de {kind, item} +@msg `items` is empty `items` est vide +@msg `items` must be a list of {id, points} `items` doit être une liste de {id, points} +@msg `items` must be a list of {{id, anchors?}}, not {v} `items` doit être une liste de {{id, anchors?}}, pas {v} +@msg `items` must be an array of {id, anchors} `items` doit être une liste de {id, anchors} +@msg `items` must be an array of {{id, corners?}}, not {v} `items` doit être une liste de {{id, corners?}}, pas {v} +@msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` doit valoir "none", "short", "medium", "long" ou "stylistic" +@msg `kerningBefore` belongs to a line's first character, not to a character style (text.setRangeStyle sets it) `kerningBefore` concerne le premier caractère d’une ligne, pas un style de caractère (text.setRangeStyle le définit) +@msg `kind` is one of {_1} `kind` vaut l’une de ces valeurs : {_1} +@msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind` doit valoir "round", "invertedRound" ou "chamfer", pas {v} +@msg `kind` must be `text`, `visibility`, `image` or `graph` `kind` doit valoir `text`, `visibility`, `image` ou `graph` +@msg `kind` must be a string `kind` doit être une chaîne +@msg `kind` must be image, noImage or htmlText `kind` doit valoir image, noImage ou htmlText +@msg `kinsokuType` must be "pushInFirst", "pushOutFirst" or "pushOutOnly" `kinsokuType` doit valoir "pushInFirst", "pushOutFirst" ou "pushOutOnly" +@msg `kinsoku` must be "none", "hard" or "soft" `kinsoku` doit valoir "none", "hard" ou "soft" +@msg `label` must be a non-empty name of at most 200 characters `label` doit être un nom non vide d’au plus 200 caractères +@msg `language` must be a language name or tag, such as "Turkish" or "tr" `language` doit être un nom ou une balise de langue, comme "Turkish" ou "tr" +@msg `leader` must be a string `leader` doit être une chaîne +@msg `leadingModel` must be "romanBaseline" or "emBoxTop" `leadingModel` doit valoir "romanBaseline" ou "emBoxTop" +@msg `leading` must be from 0.1 to 5000, or null for Auto `leading` doit être compris entre 0.1 et 5000, ou null pour Auto +@msg `length` must be a number of at most 1000000 pt either way `length` doit être un nombre d’au plus 1000000 pt dans un sens ou dans l’autre +@msg `line` must be true or false `line` doit valoir true ou false +@msg `max` must be 1 to {MAX_SUGGESTIONS} `max` doit être compris entre 1 et {MAX_SUGGESTIONS} +@msg `minAngle` ({min_angle}°) can't be more than `maxAngle` ({max_angle}°) `minAngle` ({min_angle}°) ne peut pas dépasser `maxAngle` ({max_angle}°) +@msg `mode` must be "handles", "straight" or "smooth" `mode` doit valoir "handles", "straight" ou "smooth" +@msg `mode` must be "straight", "bezier" or "arc" `mode` doit valoir "straight", "bezier" ou "arc" +@msg `mode` must be one of {_1} `mode` doit valoir l’une de ces valeurs : {_1} +@msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi` doit valoir "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" ou "lineEndHalf" +@msg `name` must be a name that is not empty `name` doit être un nom non vide +@msg `name` must not be empty `name` ne doit pas être vide +@msg `names` is a list of preset names `names` est une liste de noms de paramètres prédéfinis +@msg `names` lists preset names `names` liste des noms de paramètres prédéfinis +@msg `names` must be a list of names `names` doit être une liste de noms +@msg `names` must be a list of swatch names `names` doit être une liste de noms de nuances +@msg `names` must be an array of style names `names` doit être une liste de noms de styles +@msg `new` is a design name, or true `new` est un nom de motif, ou true +@msg `origin` must be [x, y] in points `origin` doit être [x, y] en points +@msg `path` must be a folder `path` doit être un dossier +@msg `path` must be a path object `path` doit être un objet tracé +@msg `picks` must be an array (got {v}) `picks` doit être une liste (reçu : {v}) +@msg `picks` must hold 1 to {MAX_PICKS} picks (got {_1}) `picks` doit contenir de 1 à {MAX_PICKS} prélèvements (reçu : {_1}) +@msg `pivot` must be a whole number from 0 to 8 `pivot` doit être un nombre entier compris entre 0 et 8 +@msg `points` must be a list of [x, y] points `points` doit être une liste de points [x, y] +@msg `points` must be a list of point indexes `points` doit être une liste d’indices de points +@msg `points` must be an array of point indices `points` doit être une liste d’indices de points +@msg `points` must be point indexes `points` doit contenir des indices de points +@msg `port` must be "in" or "out" `port` doit valoir "in" ou "out" +@msg `position` is above or below `position` vaut above ou below +@msg `preset` must be a string `preset` doit être une chaîne +@msg `radius` must be 0 or more `radius` doit être supérieur ou égal à 0 +@msg `ratio` must be from 0.1 to 0.5 `ratio` doit être compris entre 0.1 et 0.5 +@msg `rect` must be [x, y, width, height] with a positive size `rect` doit être [x, y, width, height] avec une taille positive +@msg `rect` must be [x0, y0, x1, y1] (got {r}) `rect` doit être [x0, y0, x1, y1] (reçu : {r}) +@msg `relation` must be overlap, inside or outside `relation` doit valoir overlap, inside ou outside +@msg `replace` must be a string `replace` doit être une chaîne +@msg `reversed` must be true or false `reversed` doit valoir true ou false +@msg `rotate` must be a finite number `rotate` doit être un nombre fini +@msg `rows` must be lists of numbers or nulls, not {r} `rows` doit être des listes de nombres ou de null, pas {r} +@msg `rule` must be nonZero or evenOdd `rule` doit valoir nonZero ou evenOdd +@msg `scale` must be a number from 0.001 to 1000 `scale` doit être un nombre compris entre 0.001 et 1000 +@msg `scale` must be a number in (0, 100] `scale` doit être un nombre dans (0, 100] +@msg `scope.{key}` must be a non-empty array `scope.{key}` doit être une liste non vide +@msg `scope` must be "document", {artboards} or {layers} `scope` doit valoir "document", {artboards} ou {layers} +@msg `scope` must be "selection" or "document", not {other} `scope` doit valoir "selection" ou "document", pas {other} +@msg `script` must be a string `script` doit être une chaîne +@msg `seriesIndexes` is a non-empty list of series indexes `seriesIndexes` est une liste non vide d’indices de séries +@msg `seriesIndexes` needs a `type` or a `valueAxis` `seriesIndexes` nécessite un `type` ou un `valueAxis` +@msg `shift` must be a number of points `shift` doit être un nombre de points +@msg `showCenter` must be true or false `showCenter` doit valoir true ou false +@msg `side` must be "left", "right", "top" or "bottom" `side` doit valoir "left", "right", "top" ou "bottom" +@msg `side` places the artboard: leave out x, y, width and height `side` place le plan de travail : omettez x, y, width et height +@msg `singleWordJustification` must be "fullJustify", "alignLeft", "alignCenter" or "alignRight" `singleWordJustification` doit valoir "fullJustify", "alignLeft", "alignCenter" ou "alignRight" +@msg `size` is a percentage of the base text's size, 1 to 100 `size` est un pourcentage de la taille du texte de base, de 1 à 100 +@msg `source` and `target` are the same object `source` et `target` sont le même objet +@msg `source` is the only path in series group `target` `source` est le seul tracé du groupe de séries `target` +@msg `source` must be `folder` or `datasets` `source` doit valoir `folder` ou `datasets` +@msg `spacing` makes more than {MAX_COUNT} lines across the box `spacing` produit plus de {MAX_COUNT} lignes dans le cadre +@msg `spacing` must be a number `spacing` doit être un nombre +@msg `spacing` must be a number of points, 0 or more, or "auto" `spacing` doit être un nombre de points supérieur ou égal à 0, ou "auto" +@msg `spacing` must be more than 0 and at most {MAX_DISTANCE} pt `spacing` doit être supérieur à 0 et d’au plus {MAX_DISTANCE} pt +@msg `start` must be a finite number `start` doit être un nombre fini +@msg `starts` must be an array of anchor indices (or nulls) `starts` doit être une liste d’indices de points d’ancrage (ou de null) +@msg `status` must be linked, embedded, missing or modified, or a list of them `status` doit valoir linked, embedded, missing ou modified, ou une liste de ces valeurs +@msg `stop` must be a stop index `stop` doit être un indice d’arrêt +@msg `story` styles the whole story: give no `start` or `end` `story` met en forme tout l’article : n’indiquez ni `start` ni `end` +@msg `story` takes the whole story: give no `start` or `end` `story` prend tout l’article : n’indiquez ni `start` ni `end` +@msg `strokeMode` applies to strokes (stroke: true) `strokeMode` s’applique aux contours (stroke: true) +@msg `style` must be roman or japanese `style` doit valoir roman ou japanese +@msg `subpaths` must be two integer indices `subpaths` doit être deux indices entiers +@msg `symbol` must be a symbol name `symbol` doit être un nom de symbole +@msg `target` must be "object" or "contents", not {v} `target` doit valoir "object" ou "contents", pas {v} +@msg `target` must be an object of the same Objects on Path group as `member` `target` doit être un objet du même groupe Objets sur tracé que `member` +@msg `tint` applies to global and spot colours `tint` s’applique aux couleurs globales et aux tons directs +@msg `tint` goes with a global or spot `swatch` `tint` s’utilise avec une nuance `swatch` globale ou en ton direct +@msg `tint` must be a number (%) `tint` doit être un nombre (%) +@msg `tint` needs a global or spot colour `tint` nécessite une couleur globale ou un ton direct +@msg `to` is already threaded `to` est déjà chaîné +@msg `to` is the design's new name `to` est le nouveau nom du motif +@msg `to` must be [x, y] `to` doit être [x, y] +@msg `to` must be a closed path, area type or type on a path other than `from` `to` doit être un tracé fermé, un texte captif ou un texte curviligne autre que `from` +@msg `to` must be a whole number `to` doit être un nombre entier +@msg `to` takes the rows of one object's stack, not aligned rows `to` prend les lignes de la pile d’un seul objet, pas des lignes alignées +@msg `useLab` must be true or false `useLab` doit valoir true ou false +@msg `vAlign` must be default, top, middle, baseline or bottom `vAlign` doit valoir default, top, middle, baseline ou bottom +@msg `values` must be a list `values` doit être une liste +@msg `values` must be an object `values` doit être un objet +@msg `values` must name hex, rgb, cmyk, lab or gray `values` doit indiquer hex, rgb, cmyk, lab ou gray +@msg `values` names a kind twice `values` indique deux fois le même type +@msg `version` must be 0 or {_1} `version` doit valoir 0 ou {_1} +@msg `version` must be 0 or {newest} `version` doit valoir 0 ou {newest} +@msg `weight` must be from 0.01 to 1000 pt `weight` doit être compris entre 0.01 et 1000 pt +@msg `weights` must be a list of {_1} numbers, one per row (got {v}) `weights` doit être une liste de {_1} nombres, un par ligne (reçu : {v}) +@msg `xml` must be a string `xml` doit être une chaîne +@msg `{KEY}` entry {n} gives the paragraph at byte {start} of {_1} other indents than an entry before it l’entrée {n} de `{KEY}` donne au paragraphe à l’octet {start} de {_1} d’autres retraits qu’une entrée précédente +@msg `{KEY}` entry {n} must be an object l’entrée {n} de `{KEY}` doit être un objet +@msg `{KEY}` entry {n} sets neither `leftIndent` nor `firstLineIndent` l’entrée {n} de `{KEY}` ne définit ni `leftIndent` ni `firstLineIndent` +@msg `{KEY}` entry {n}: `id` must be an object id entrée {n} de `{KEY}` : `id` doit être un identifiant d’objet +@msg `{KEY}` entry {n}: `start` must be a byte offset entrée {n} de `{KEY}` : `start` doit être une position en octets +@msg `{KEY}` entry {n}: `{k}` must be a number from -{MAX_PARA} to {MAX_PARA} pt entrée {n} de `{KEY}` : `{k}` doit être un nombre compris entre -{MAX_PARA} et {MAX_PARA} pt +@msg `{KEY}` entry {n}: no paragraph of {_1} starts at byte {start} entrée {n} de `{KEY}` : aucun paragraphe de {_1} ne commence à l’octet {start} +@msg `{KEY}` entry {n}: unknown key `{k}` entrée {n} de `{KEY}` : clé inconnue `{k}` +@msg `{KEY}` entry {n}: {_1} is not a type object entrée {n} de `{KEY}` : {_1} n’est pas un objet texte +@msg `{KEY}` is empty `{KEY}` est vide +@msg `{KEY}` must be a list `{KEY}` doit être une liste +@msg `{KEY}` takes at most {MAX_PARAGRAPH_INDENTS} entries (got {_1}) `{KEY}` accepte au plus {MAX_PARAGRAPH_INDENTS} entrées (reçu : {_1}) +@msg `{KEY}` takes no `{other}` beside it `{KEY}` n’accepte pas `{other}` à côté de lui +@msg `{_1}` can't be edited or removed `{_1}` ne peut être ni modifié ni supprimé +@msg `{_1}` is built in and always listed `{_1}` est intégré et toujours listé +@msg `{_1}` is not a font file the last text.findFontFiles search found `{_1}` n’est pas un fichier de police trouvé par la dernière recherche text.findFontFiles +@msg `{_1}` would be overwritten by the package: choose a different folder or name `{_1}` serait écrasé par l’assemblage : choisissez un autre dossier ou un autre nom +@msg `{base}` is larger than {_1} MB `{base}` dépasse {_1} Mo +@msg `{base}` is not in the DCS file's folder `{base}` n’est pas dans le dossier du fichier DCS +@msg `{file}` has no art to place `{file}` ne contient aucune illustration à importer +@msg `{file}` is over {_1} MB `{file}` dépasse {_1} Mo +@msg `{f}` belongs to a VectorCraft that is running `{f}` appartient à une instance de VectorCraft en cours d’exécution +@msg `{f}` is the copy of a document open now `{f}` est la copie d’un document actuellement ouvert +@msg `{id}` is no writable format (see document.formats) `{id}` n’est pas un format inscriptible (voir document.formats) +@msg `{id}` isn't a loaded library `{id}` n’est pas une bibliothèque chargée +@msg `{key}` has no colours `{key}` ne contient aucune couleur +@msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` contient plus de {MAX_EDIT_WORDS} mots +@msg `{key}` is a design name `{key}` est un nom de motif +@msg `{key}` is a design name or a list of them `{key}` est un nom de motif ou une liste de noms de motifs +@msg `{key}` is longer than {MAX_NAME} characters `{key}` dépasse {MAX_NAME} caractères +@msg `{key}` is out of range `{key}` est hors limites +@msg `{key}` must be 0 or more `{key}` doit être supérieur ou égal à 0 +@msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}` doit être [min, desired, max] ou {{min?, desired?, max?}}, en pourcentage +@msg `{key}` must be [x, y] numbers `{key}` doit être des nombres [x, y] +@msg `{key}` must be a list of words `{key}` doit être une liste de mots +@msg `{key}` must be a list, not {v} `{key}` doit être une liste, pas {v} +@msg `{key}` must be a non-negative integer `{key}` doit être un entier positif ou nul +@msg `{key}` must be a number or null, not {v} `{key}` doit être un nombre ou null, pas {v} +@msg `{key}` must be a number {_1}..{_2} `{key}` doit être un nombre de {_1} à {_2} +@msg `{key}` must be a whole number of 0 or more `{key}` doit être un nombre entier supérieur ou égal à 0 +@msg `{key}` must be a whole number of at least 0, not {n} `{key}` doit être un nombre entier d’au moins 0, pas {n} +@msg `{key}` must be an appearance item index (paint order) or null `{key}` doit être un indice d’élément d’aspect (ordre de peinture) ou null +@msg `{key}` must be an array of asset ids (see assets.list) `{key}` doit être une liste d’identifiants de ressources (voir assets.list) +@msg `{key}` must be from 0 to 180 degrees, not {a} `{key}` doit être compris entre 0 et 180 degrés, pas {a} +@msg `{key}` must be from 0 to {MAX_DISTANCE} pt `{key}` doit être compris entre 0 et {MAX_DISTANCE} pt +@msg `{key}` must be from {_1} to {shift_max} `{key}` doit être compris entre {_1} et {shift_max} +@msg `{key}` must be from {lo} to {hi}, not {v} `{key}` doit être compris entre {lo} et {hi}, pas {v} +@msg `{key}` must be one of auto, always, never `{key}` doit valoir auto, always ou never +@msg `{key}` must be one of miter, round, bevel `{key}` doit valoir miter, round ou bevel +@msg `{key}` must be one word of at most {_1} characters `{key}` doit être un seul mot d’au plus {_1} caractères +@msg `{key}` must hold single words of at most {_1} characters `{key}` doit contenir des mots isolés d’au plus {_1} caractères +@msg `{key}` must name an object attached to the path of an Objects on Path group `{key}` doit désigner un objet attaché au tracé d’un groupe Objets sur tracé +@msg `{key}` names an object that is hidden or locked `{key}` désigne un objet masqué ou verrouillé +@msg `{key}`: not a colour: {v} `{key}` : ce n’est pas une couleur : {v} +@msg `{k}.family` is required `{k}.family` est obligatoire +@msg `{k}` is a number 0..1 `{k}` est un nombre de 0 à 1 +@msg `{k}` is true or false `{k}` vaut true ou false +@msg `{k}` isn't an export setting: {_1} `{k}` n’est pas un réglage d’export : {_1} +@msg `{k}` must be a byte offset `{k}` doit être une position en octets +@msg `{k}` must be a number `{k}` doit être un nombre +@msg `{k}` must be a number of points `{k}` doit être un nombre de points +@msg `{k}` must be a string `{k}` doit être une chaîne +@msg `{k}` must be a whole number `{k}` doit être un nombre entier +@msg `{k}` must be from {lo} to {hi} for {key} `{k}` doit être compris entre {lo} et {hi} pour {key} +@msg `{k}` must be {what}, not {v} `{k}` doit être {what}, pas {v} +@msg `{l}` isn't a global or spot colour `{l}` n’est ni une couleur globale ni un ton direct +@msg `{m}` isn't a bitmap: use clipboard.importSvg, importPdf or importText `{m}` n’est pas une image bitmap : utilisez clipboard.importSvg, importPdf ou importText +@msg `{name}` can't be deleted `{name}` ne peut pas être supprimé +@msg `{name}` can't be duplicated `{name}` ne peut pas être dupliqué +@msg `{name}` can't be edited `{name}` ne peut pas être modifié +@msg `{name}` can't be edited this way `{name}` ne peut pas être modifié de cette manière +@msg `{name}` can't be renamed `{name}` ne peut pas être renommé +@msg `{name}` can't name a folder `{name}` ne peut pas nommer un dossier +@msg `{name}` has no art to place `{name}` ne contient aucune illustration à importer +@msg `{name}` has no text to place `{name}` ne contient aucun texte à importer +@msg `{name}` in the Word document is not UTF-8 or UTF-16 text `{name}` dans le document Word n’est pas du texte UTF-8 ou UTF-16 +@msg `{name}` in the Word document is not well-formed XML: {e} `{name}` dans le document Word n’est pas du XML bien formé : {e} +@msg `{name}` in the Word document nests elements more than {MAX_NESTING} deep `{name}` dans le document Word imbrique des éléments sur plus de {MAX_NESTING} niveaux +@msg `{name}` is a built-in preset and is read-only: save it under another name `{name}` est un paramètre prédéfini intégré en lecture seule : enregistrez-le sous un autre nom +@msg `{name}` is a built-in preset: save under another name `{name}` est un paramètre prédéfini intégré : enregistrez sous un autre nom +@msg `{name}` is a built-in profile and stays `{name}` est un profil intégré et ne peut pas être retiré +@msg `{name}` is a file of its own, which can only be found next to the DCS file's path `{name}` est un fichier distinct, qui ne peut être trouvé qu’à côté du chemin du fichier DCS +@msg `{name}` is a tint of `{base}`: edit `{base}` (a tint swatch only takes a new name) `{name}` est une teinte de `{base}` : modifiez `{base}` (une nuance de teinte n’accepte qu’un nouveau nom) +@msg `{name}` is a working space: choose another with edit.colorSettings first `{name}` est un espace de travail colorimétrique : choisissez-en d’abord un autre avec edit.colorSettings +@msg `{name}` is built in and stays `{name}` est intégré et ne peut pas être retiré +@msg `{name}` takes a paint of its own kind (colour, gradient or pattern) `{name}` accepte une peinture de son propre type (couleur, dégradé ou motif) +@msg `{name}`: {_1}: {e} `{name}` : {_1} : {e} +@msg `{n}` can't be deleted `{n}` ne peut pas être supprimé +@msg `{n}` can't be merged `{n}` ne peut pas être fusionné +@msg `{n}` can't be moved `{n}` ne peut pas être déplacé +@msg `{n}` is not a colour swatch `{n}` n’est pas une nuance de couleur +@msg `{n}` isn't a solid colour `{n}` n’est pas une couleur unie +@msg `{n}`: colour groups hold solid colours only `{n}` : les groupes de couleurs ne contiennent que des couleurs unies +@msg `{other}` doesn't trace an image `{other}` ne vectorise pas une image +@msg `{s}`: the step's references copy in more than {_1} MB of values `{s}` : les références de l’étape copient plus de {_1} Mo de valeurs +@msg `{tag}` is not an axis tag: a tag is four characters, such as "wght" `{tag}` n’est pas une balise d’axe : une balise compte quatre caractères, comme "wght" +@msg `{to}` is empty or already used `{to}` est vide ou déjà utilisé +@msg `{u}` is no Unicode character `{u}` n’est pas un caractère Unicode +@msg `{what}` is longer than {MAX_TEXT} bytes `{what}` dépasse {MAX_TEXT} octets +@msg `{what}` must be text `{what}` doit être du texte +@msg `{word}` isn't in the custom dictionary `{word}` n’est pas dans le dictionnaire personnalisé +@msg a CMap has too many mappings une CMap contient trop de correspondances +@msg a DXF drawing has one origin: pass useArtboards: true for one drawing per artboard un dessin DXF a une seule origine : passez useArtboards: true pour un dessin par plan de travail +@msg a PDF presets file with over {_1} presets un fichier de paramètres prédéfinis PDF de plus de {_1} paramètres +@msg a \u escape needs four hexadecimal digits un échappement \u nécessite quatre chiffres hexadécimaux +@msg a batch preview cannot switch documents un aperçu de traitement par lots ne peut pas changer de document +@msg a brush named `{nn}` exists une forme nommée `{nn}` existe déjà +@msg a comma in an XPath expression must separate function arguments une virgule dans une expression XPath doit séparer des arguments de fonction +@msg a container of the listed objects is gone un conteneur des objets listés a disparu +@msg a content stream can't be read un flux de contenu ne peut pas être lu +@msg a content stream isn't a stream un flux de contenu n’est pas un flux +@msg a design holds at most {_1} objects un motif contient au plus {_1} objets +@msg a design needs a name un motif nécessite un nom +@msg a dictionary grew too large un dictionnaire est devenu trop grand +@msg a document holds at most {_1} SVG filters un document contient au plus {_1} filtres SVG +@msg a document keeps at most {_1} graph designs un document conserve au plus {_1} motifs de graphe +@msg a document keeps at most {_1} saved selections un document conserve au plus {_1} sélections enregistrées +@msg a document keeps at most {_1} views un document conserve au plus {_1} vues +@msg a document links at most {MAX_SVG_SCRIPTS} JavaScript files un document lie au plus {MAX_SVG_SCRIPTS} fichiers JavaScript +@msg a document with unsaved changes has no recovery copy un document comportant des modifications non enregistrées n’a pas de copie de récupération +@msg a feConvolveMatrix filter's order is {x}×{y}, which overflows the kernel-size multiply usvg makes l’ordre d’un filtre feConvolveMatrix est {x}×{y}, ce qui dépasse la capacité de la multiplication de taille de noyau effectuée par usvg +@msg a font's data is too large les données d’une police sont trop volumineuses +@msg a font's subroutines are too large les sous-programmes d’une police sont trop volumineux +@msg a function declaration without a name une déclaration de fonction sans nom +@msg a gradient preset is already called {n} un paramètre prédéfini de dégradé s’appelle déjà {n} +@msg a graph has at most {_1} series, so it transposes with at most that many categories un graphe a au plus {_1} séries, il se transpose donc avec au plus autant de catégories +@msg a host value has too many entries une valeur de l’hôte a trop d’entrées +@msg a host value is nested too deep une valeur de l’hôte est imbriquée trop profondément +@msg a layer can't be merged into its own sublayer un calque ne peut pas être fusionné dans son propre sous-calque +@msg a layer's form box isn't an array le cadre du formulaire d’un calque n’est pas un tableau +@msg a layer's form can't be read le formulaire d’un calque ne peut pas être lu +@msg a layer's form has no box le formulaire d’un calque n’a pas de cadre +@msg a layer's form has no dictionary le formulaire d’un calque n’a pas de dictionnaire +@msg a legend draws at most {MAX_CHIPS} swatches une légende dessine au plus {MAX_CHIPS} nuances +@msg a name names one asset: give multiple: false, or one object un nom désigne une seule ressource : indiquez multiple: false, ou un seul objet +@msg a namespace declaration uses a reserved prefix or URI une déclaration d’espace de noms utilise un préfixe ou un URI réservé +@msg a namespace qualifier is undefined un qualificateur d’espace de noms n’est pas défini +@msg a namespace with an empty URI cannot have a prefix un espace de noms dont l’URI est vide ne peut pas avoir de préfixe +@msg a number has no digits un nombre n’a aucun chiffre +@msg a number's exponent has no digits l’exposant d’un nombre n’a aucun chiffre +@msg a number's fraction has no digits la partie décimale d’un nombre n’a aucun chiffre +@msg a page can't be read une page ne peut pas être lue +@msg a page object is used by something else un objet de page est utilisé par autre chose +@msg a page thumbnail must be RGB pixels, 1 to {THUMBNAIL_SIZE} a side (got {w} × {h}) une vignette de page doit être en pixels RVB, de 1 à {THUMBNAIL_SIZE} de côté (reçu : {w} × {h}) +@msg a pattern layer doesn't end what it starts un calque de motif ne termine pas ce qu’il commence +@msg a pattern layer's colors hold something else les couleurs d’un calque de motif contiennent autre chose +@msg a pattern named `{n}` exists un motif nommé `{n}` existe déjà +@msg a plug-in with id {_1} is already installed un plug-in d’identifiant {_1} est déjà installé +@msg a preset named `{n}` exists un paramètre prédéfini nommé `{n}` existe déjà +@msg a print presets file with over {_1} presets un fichier de paramètres prédéfinis d’impression de plus de {_1} paramètres +@msg a profile is already called {n} un profil s’appelle déjà {n} +@msg a property descriptor cannot have both a value or writable and a get or set un descripteur de propriété ne peut pas avoir à la fois value ou writable et get ou set +@msg a property descriptor must be an object un descripteur de propriété doit être un objet +@msg a property's {name} must be a function or undefined le {name} d’une propriété doit être une fonction ou undefined +@msg a row can't go into itself une ligne ne peut pas être placée dans elle-même +@msg a series goes on the left or the right value axis une série se place sur l’axe des valeurs gauche ou droit +@msg a start must be an anchor index ≥ 0 or null un début doit être un indice de point d’ancrage ≥ 0 ou null +@msg a stream in it would decode to more than 256 MB, or its decode parameters can't be applied un de ses flux se décoderait en plus de 256 Mo, ou ses paramètres de décodage ne peuvent pas être appliqués +@msg a string holds a control character une chaîne contient un caractère de contrôle +@msg a string holds an escape sequence JSON does not have une chaîne contient une séquence d’échappement qui n’existe pas en JSON +@msg a string is not closed une chaîne n’est pas fermée +@msg a style named `{name}` already exists un style nommé `{name}` existe déjà +@msg a style named `{to}` already exists un style nommé `{to}` existe déjà +@msg a swatch needs a colour, gradient or pattern une nuance nécessite une couleur, un dégradé ou un motif +@msg a symbol named `{n}` already exists un symbole nommé `{n}` existe déjà +@msg a theme has 1 to {THEME_SIZE} colours un thème compte de 1 à {THEME_SIZE} couleurs +@msg a theme is already called {name} (replace: "{name}" overwrites it) un thème s’appelle déjà {name} (replace: "{name}" l’écrase) +@msg a toolbar name has at most {MAX_NAME} characters un nom de barre d’outils compte au plus {MAX_NAME} caractères +@msg a view named `{_1}` exists une vue nommée `{_1}` existe déjà +@msg a view named `{name}` exists une vue nommée `{name}` existe déjà +@msg a workspace keeps at most {MAX} toolbars un espace de travail conserve au plus {MAX} barres d’outils +@msg a {_1} series can't go in a {_2} graph une série {_1} ne peut pas aller dans un graphe {_2} +@msg aiVersion {v}: "pdf" (PDF-compatible, the default) or "7" (legacy .ai, version 7) aiVersion {v} : "pdf" (compatible PDF, par défaut) ou "7" (.ai ancien, version 7) +@msg already editing an opacity mask un masque d’opacité est déjà en cours de modification +@msg already editing another object's opacity mask le masque d’opacité d’un autre objet est déjà en cours de modification +@msg already in pattern editing mode déjà en mode d’édition de motif +@msg an SVG filter is named by its id: give `xml` with `name` un filtre SVG est nommé par son identifiant : indiquez `xml` avec `name` +@msg an XML element has two attributes with the same name un élément XML a deux attributs portant le même nom +@msg an XML value cannot be inserted into itself or its descendants une valeur XML ne peut pas être insérée dans elle-même ou dans ses descendants +@msg an XML value's children cannot be assigned by position les enfants d’une valeur XML ne peuvent pas être affectés par position +@msg an XML value's children cannot be deleted by position les enfants d’une valeur XML ne peuvent pas être supprimés par position +@msg an XMLList converts to XML only when it has one item un XMLList ne se convertit en XML que s’il contient un seul élément +@msg an XPath node test is missing un test de nœud XPath est manquant +@msg an XPath operand is missing un opérande XPath est manquant +@msg an XPath operator is missing un opérateur XPath est manquant +@msg an XPath predicate or step cannot follow here un prédicat ou une étape XPath ne peut pas suivre ici +@msg an XPath predicate or step follows a value that is not a node-set un prédicat ou une étape XPath suit une valeur qui n’est pas un ensemble de nœuds +@msg an XPath step is missing une étape XPath est manquante +@msg an artboard is listed twice un plan de travail est listé deux fois +@msg an empty artboard has no width or height to scale to un plan de travail vide n’a ni largeur ni hauteur à laquelle mettre à l’échelle +@msg an image couldn't be decoded and is missing from the picture une image n’a pas pu être décodée et manque dans l’illustration +@msg an image is too large for DXF and was left out une image est trop grande pour le DXF et a été omise +@msg an image of {_1} MB, at most {_2} MB une image de {_1} Mo, au plus {_2} Mo +@msg an image of {declared_w} × {declared_h} pixels is too large to draw une image de {declared_w} × {declared_h} pixels est trop grande pour être dessinée +@msg an image of {width} × {height} pixels is too large to draw une image de {width} × {height} pixels est trop grande pour être dessinée +@msg an image of {w} × {h} pixels is too large to convert (at most {_1} pixels) une image de {w} × {h} pixels est trop grande pour être convertie (au plus {_1} pixels) +@msg an index must be a whole number un indice doit être un nombre entier +@msg an inline graphic has no glyphs un graphique incorporé n’a aucun glyphe +@msg an invisible text form can't be read un formulaire de texte invisible ne peut pas être lu +@msg an object is missing un objet est manquant +@msg an object's header is missing l’en-tête d’un objet est manquant +@msg an overprinting form can't be read un formulaire en surimpression ne peut pas être lu +@msg an unread object has no readable bounds un objet non lu n’a pas de limites lisibles +@msg an unread object holds a frame of threaded type un objet non lu contient un cadre de texte chaîné +@msg an unread object is missing from its layer un objet non lu manque dans son calque +@msg anchor `smooth` must be true or false `smooth` d’un point d’ancrage doit valoir true ou false +@msg anchor `{key}` must be [x, y] `{key}` d’un point d’ancrage doit être [x, y] +@msg anchor `{key}` must be a number `{key}` d’un point d’ancrage doit être un nombre +@msg angle and roundness must be finite l’angle et l’arrondi doivent être finis +@msg angles must be a list as long as pins (degrees or null) angles doit être une liste aussi longue que pins (degrés ou null) +@msg appearance must be flat|center|edge appearance doit valoir flat|center|edge +@msg apply is "fill" or "stroke", not `{other}` apply vaut "fill" ou "stroke", pas `{other}` +@msg apply was called on a value that is not a function apply a été appelé sur une valeur qui n’est pas une fonction +@msg area must be a closed polygon of 3 to 100000 [x, y] points area doit être un polygone fermé de 3 à 100000 points [x, y] +@msg area type in a thread cannot use Dynamic Text: {frames} un texte captif chaîné ne peut pas utiliser le texte dynamique : {frames} +@msg area type needs a path that encloses an area le texte captif nécessite un tracé qui délimite une zone +@msg area type {_1} is named twice le texte captif {_1} est désigné deux fois +@msg array literal too long littéral de tableau trop long +@msg arrowAlign must be extend|tip, got {o} arrowAlign doit valoir extend|tip, reçu : {o} +@msg arrowScale must be [start, end] arrowScale doit être [start, end] +@msg artboard is a 0-based index artboard est un indice commençant à 0 +@msg artboard must be a 0-based index artboard doit être un indice commençant à 0 +@msg artboard {i} doesn't print le plan de travail {i} ne s’imprime pas +@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout doit être {layout?, columns?, spacing?, rightToLeft?} +@msg artboardLayout.columns must be 1 or more artboardLayout.columns doit être supérieur ou égal à 1 +@msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout doit valoir gridByRow, gridByColumn, row ou column +@msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft doit valoir true ou false +@msg artboardLayout.spacing must be 0–{MAX_SPACING} pt artboardLayout.spacing doit être compris entre 0 et {MAX_SPACING} pt +@msg artboards must be a non-empty list artboards doit être une liste non vide +@msg artboards must be a number artboards doit être un nombre +@msg asset `{_1}` has no art to export la ressource `{_1}` ne contient aucune illustration à exporter +@msg assignment to a constant binding affectation à une liaison constante +@msg at least one row that isn't excluded needs a weight above 0 au moins une ligne non exclue doit avoir un poids supérieur à 0 +@msg at most {MAX_KEYWORDS} keywords au plus {MAX_KEYWORDS} mots-clés +@msg at most {MAX_MATCHES} matches are kept au plus {MAX_MATCHES} correspondances sont conservées +@msg at most {MAX_POINTS} points au plus {MAX_POINTS} points +@msg at most {MAX_QUEUE} files au plus {MAX_QUEUE} fichiers +@msg at must be [x, y] at doit être [x, y] +@msg at/rect lie outside the canvas at/rect se trouvent en dehors de la zone de travail +@msg attribute must be size|leading|tracking|kerning|baselineShift attribute doit valoir size|leading|tracking|kerning|baselineShift +@msg attrs must be an object attrs doit être un objet +@msg automation path rejected: the folder's name isn't valid text chemin d’automatisation refusé : le nom du dossier n’est pas un texte valide +@msg automation path rejected: {_1} isn't valid text chemin d’automatisation refusé : {_1} n’est pas un texte valide +@msg automation path rejected: {why}: {path} chemin d’automatisation refusé : {why} : {path} +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{given}` axis doit valoir "vertical", "horizontal" ou un angle en degrés, pas `{given}` +@msg backgroundContents must be transparent or white backgroundContents doit valoir transparent ou white +@msg bad AES key clé AES incorrecte +@msg bad `runs`: {e} `runs` incorrect : {e} +@msg bad arrowScale arrowScale incorrect +@msg bad base64 base64 incorrect +@msg bad color {c} couleur incorrecte {c} +@msg bad colour couleur incorrecte +@msg bad colour in `colors` couleur incorrecte dans `colors` +@msg bad colour {v} couleur incorrecte {v} +@msg bad colour {v} in groupColors couleur incorrecte {v} dans groupColors +@msg bad cross-reference entry entrée de table de références croisées incorrecte +@msg bad cross-reference table table de références croisées incorrecte +@msg bad current colour {v} couleur actuelle incorrecte {v} +@msg bad dataBase64 dataBase64 incorrect +@msg bad edit modification incorrecte +@msg bad fill {v} fond incorrect {v} +@msg bad fit: {e} ajustement incorrect : {e} +@msg bad model {other} (keep, new or document) modèle incorrect {other} (keep, new ou document) +@msg bad new colour {v} nouvelle couleur incorrecte {v} +@msg bad object objet incorrect +@msg bad object number numéro d’objet incorrect +@msg bad offset position incorrecte +@msg bad path data: {e} données de tracé incorrectes : {e} +@msg bad point {v}: expected [x, y] or [x, y, pressure] point incorrect {v} : [x, y] ou [x, y, pressure] attendu +@msg bad reference référence incorrecte +@msg bad trailer size taille de trailer incorrecte +@msg bad {k} colour couleur {k} incorrecte +@msg batches cannot nest les traitements par lots ne peuvent pas être imbriqués +@msg bind something to a variable first liez d’abord quelque chose à une variable +@msg bleed must be 0–{MAX_BLEED} pt: a number, [top, bottom, left, right] or {{top, bottom, left, right}} bleed doit être compris entre 0 et {MAX_BLEED} pt : un nombre, [top, bottom, left, right] ou {{top, bottom, left, right}} +@msg blend must be a mode name blend doit être un nom de mode +@msg both sides of an XPath | must select nodes les deux côtés d’un | XPath doivent sélectionner des nœuds +@msg brush must be a name or null brush doit être un nom ou null +@msg by must be a number by doit être un nombre +@msg can't add page thumbnails: {why} impossible d’ajouter les vignettes de page : {why} +@msg can't add the editing data for other apps: {why} impossible d’ajouter les données d’édition destinées à d’autres applications : {why} +@msg can't edit the written PDF: {why} impossible de modifier le PDF écrit : {why} +@msg can't encrypt the PDF: {why} impossible de chiffrer le PDF : {why} +@msg can't linearise the PDF: {why} impossible de linéariser le PDF : {why} +@msg can't open `{_1}`: {_2} impossible d’ouvrir `{_1}` : {_2} +@msg can't open `{_1}`: {e} impossible d’ouvrir `{_1}` : {e} +@msg can't open `{name}`: not a format VectorCraft reads (see document.formats) impossible d’ouvrir `{name}` : ce n’est pas un format que VectorCraft lit (voir document.formats) +@msg can't place `{name}`: not a format VectorCraft reads (see document.formats) impossible d’importer `{name}` : ce n’est pas un format que VectorCraft lit (voir document.formats) +@msg can't read back the written PDF: {e} impossible de relire le PDF écrit : {e} +@msg can't read this Word document: {why} impossible de lire ce document Word : {why} +@msg can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp impossible d’écrire des images .{e} : utilisez .png, .jpg, .gif, .webp, .tif ou .bmp +@msg can't write PDF layers, overprint or invisible text: {why} impossible d’écrire les calques PDF, la surimpression ou le texte invisible : {why} +@msg can't write the file's copyright: {why} impossible d’écrire le copyright du fichier : {why} +@msg can't write the file's modification date: {why} impossible d’écrire la date de modification du fichier : {why} +@msg can't write the pages' user units: {why} impossible d’écrire les unités utilisateur des pages : {why} +@msg canceled annulé +@msg cannot convert the object to a primitive value impossible de convertir l’objet en valeur primitive +@msg cannot convert undefined or null to an object impossible de convertir undefined ou null en objet +@msg cannot distort a zero-size or non-finite bounding box impossible de déformer un cadre de sélection de taille nulle ou non fini +@msg cannot move an object into itself impossible de déplacer un objet dans lui-même +@msg case must be upper|lower|title|sentence case doit valoir upper|lower|title|sentence +@msg category `{c}`: one of {_1} catégorie `{c}` : l’une de ces valeurs : {_1} +@msg center must be [x, y] center doit être [x, y] +@msg character dimensions cannot be represented with the source text transform les dimensions des caractères ne peuvent pas être représentées avec la transformation du texte source +@msg character dimensions cannot be represented with the target text transform les dimensions des caractères ne peuvent pas être représentées avec la transformation du texte cible +@msg choose at least one artboard choisissez au moins un plan de travail +@msg choose at least one status choisissez au moins un état +@msg clip must be true or false clip doit valoir true ou false +@msg clippingMask must be true or false clippingMask doit valoir true ou false +@msg closed must be a boolean closed doit être un booléen +@msg collapsed must be true or false collapsed doit valoir true ou false +@msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile : aucun profil RVB ou CMJN ne s’appelle « {profile} » +@msg colorMode must be rgb or cmyk, not `{m}` colorMode doit valoir rgb ou cmyk, pas `{m}` +@msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel doit valoir {own} (le mode du document), grayscale ou bitmap +@msg colour groups can't go into colour groups un groupe de couleurs ne peut pas aller dans un groupe de couleurs +@msg colour, mode and spot apply to solid-colour swatches only couleur, mode et ton direct s’appliquent uniquement aux nuances de couleur unie +@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read colonne {column} : `{cell}` est une colonne `%` des fichiers de données de graphe, qui ne sont pas lus +@msg column {column}: `{cell}` names `{name}`, which is a {_1} variable colonne {column} : `{cell}` désigne `{name}`, qui est une variable {_1} +@msg column {column}: `{cell}` names no variable colonne {column} : `{cell}` ne désigne aucune variable +@msg column {column}: the variable name is longer than {MAX_NAME} characters colonne {column} : le nom de variable dépasse {MAX_NAME} caractères +@msg column: true floats the whole column and takes no onto, above or below column: true rend flottante toute la colonne et n’accepte ni onto, ni above, ni below +@msg command must be a shape.* command command doit être une commande shape.* +@msg commands[{i}]: missing `command` commands[{i}] : `command` manquant +@msg composer must be "singleLine" or "everyLine" composer doit valoir "singleLine" ou "everyLine" +@msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes les formes composées acceptent les tracés, tracés transparents, groupes, formes composées, textes, dégradés de formes et enveloppes +@msg compound {_1} must contain exactly one open path to join le tracé transparent {_1} doit contenir exactement un tracé ouvert à joindre +@msg connect end must be "start" or "end" l’extrémité de connect doit valoir "start" ou "end" +@msg connect needs a path other than the one extended connect nécessite un tracé autre que celui qui est prolongé +@msg connect needs id connect nécessite id +@msg connect path has no open end le tracé de connect n’a pas d’extrémité ouverte +@msg continuation must be an array of path chunks continuation doit être une liste de fragments de tracé +@msg continuation requires points continuation nécessite des points +@msg copy needs path: the file to copy into the document's folder copy nécessite path : le fichier à copier dans le dossier du document +@msg copy takes images only: relink placed documents where their files are copy n’accepte que des images : reliez les documents importés là où se trouvent leurs fichiers +@msg copying a file isn't available on the web la copie d’un fichier n’est pas disponible sur le Web +@msg copyrightStatus must be unknown, copyrighted or publicDomain copyrightStatus doit valoir unknown, copyrighted ou publicDomain +@msg copyrightUrl must be a URL (no spaces, at most 2048 characters) copyrightUrl doit être une URL (sans espaces, au plus 2048 caractères) +@msg corners must be 4 [x, y] points (TL, TR, BR, BL) corners doit être 4 points [x, y] (TL, TR, BR, BL) +@msg counterPer `{c}`: item or file counterPer `{c}` : item ou file +@msg crop `{_1}`: only PDF pages have art, trim, bleed and media boxes; use "crop" or "bounding" crop `{_1}` : seules les pages PDF ont des zones art, trim, bleed et media ; utilisez "crop" ou "bounding" +@msg crop rectangle doesn't overlap the image le rectangle de recadrage ne chevauche pas l’image +@msg cross-reference and object streams aren't supported les flux de références croisées et d’objets ne sont pas pris en charge +@msg damaged compressed data: {e} données compressées endommagées : {e} +@msg dash lengths must be numbers, got {v} les longueurs de tiret doivent être des nombres, reçu : {v} +@msg dash must be a list of lengths or null, got {v} dash doit être une liste de longueurs ou null, reçu : {v} +@msg data key `{k}`: letters, digits, -, _ and . (not name or vc-…) clé de données `{k}` : lettres, chiffres, -, _ et . (ni name ni vc-…) +@msg data must be an object of key: value, not {v} data doit être un objet clé: valeur, pas {v} +@msg data set `{name}` holds a value for `{var}`, which the library doesn't declare le jeu de données `{name}` contient une valeur pour `{var}`, que la bibliothèque ne déclare pas +@msg data set `{name}` holds two values for `{var}` le jeu de données `{name}` contient deux valeurs pour `{var}` +@msg data set `{name}` is declared twice le jeu de données `{name}` est déclaré deux fois +@msg data takes at most {MAX_DATA} keys at once data accepte au plus {MAX_DATA} clés à la fois +@msg dataset `{name}` already exists le jeu de données `{name}` existe déjà +@msg dataset `{to}` already exists le jeu de données `{to}` existe déjà +@msg date `{d}`: YYYY-MM-DD date `{d}` : AAAA-MM-JJ +@msg decoded data is too large les données décodées sont trop volumineuses +@msg define a variable first définissez d’abord une variable +@msg detect must be true or false detect doit valoir true ou false +@msg direct-select anchor points of a path sélectionnez des points d’ancrage d’un tracé avec l’outil Sélection directe +@msg distance must be > 0 distance doit être > 0 +@msg dx and dy give the arrow's direction dx et dy donnent la direction de la flèche +@msg dx and dy must be numbers dx et dy doivent être des nombres +@msg dxf fitTo must be [width, height], positive dxf fitTo doit être [width, height], positifs +@msg dxf must be an object of DXF import options dxf doit être un objet d’options d’import DXF +@msg dxf scale must be a positive number up to {_1}, not {s} l’échelle dxf doit être un nombre positif d’au plus {_1}, pas {s} +@msg dxf unit `{u}`: a unit such as mm, cm, in or pt unité dxf `{u}` : une unité comme mm, cm, in ou pt +@msg dxf: {e} dxf : {e} +@msg each format is an object {format, scale?, suffix?} chaque format est un objet {format, scale?, suffix?} +@msg each item needs an id chaque élément nécessite un identifiant +@msg each match needs `kind` chaque correspondance nécessite `kind` +@msg each match needs a `name` chaque correspondance nécessite un `name` +@msg each of `fonts` is {family, style?}; 1 to 1000 of them chaque élément de `fonts` est {family, style?} ; de 1 à 1000 éléments +@msg each of `items` is {kind, item} chaque élément de `items` est {kind, item} +@msg each of `items` is {{id, corners?}} with an object id, not {it} chaque élément de `items` est {{id, corners?}} avec un identifiant d’objet, pas {it} +@msg each path chunk must contain 1 to 4096 points chaque fragment de tracé doit contenir de 1 à 4096 points +@msg each pick is {{at: [x, y]}} or {{rect: [x0, y0, x1, y1]}} (got {v}) chaque prélèvement est {{at: [x, y]}} ou {{rect: [x0, y0, x1, y1]}} (reçu : {v}) +@msg each row needs `from` chaque ligne nécessite `from` +@msg each stop needs a position chaque taquet nécessite une position +@msg each subpath needs an anchors array chaque sous-tracé nécessite une liste anchors +@msg each weight must be a number of 0 or more (got {v}) chaque poids doit être un nombre supérieur ou égal à 0 (reçu : {v}) +@msg easingType must be easeIn, easeOut, easeInOut or easeOutIn easingType doit valoir easeIn, easeOut, easeInOut ou easeOutIn +@msg editingData must be true or false editingData doit valoir true ou false +@msg editingData must be true, false or "always" editingData doit valoir true, false ou "always" +@msg edits overlap des modifications se chevauchent +@msg effects of objects whose appearances differ can't be moved together les effets d’objets dont l’aspect diffère ne peuvent pas être déplacés ensemble +@msg empty header in column {_1} en-tête vide dans la colonne {_1} +@msg encoding `{_1}`: utf8 or utf16 encodage `{_1}` : utf8 ou utf16 +@msg ends must be two of "first" and "last" ends doit être deux valeurs parmi "first" et "last" +@msg every numbered name for the result is taken tous les noms numérotés pour le résultat sont pris +@msg expanded SVG styles exceed the import size limit les styles SVG développés dépassent la taille limite d’import +@msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes le fichier de paramètres prédéfinis d’export dépasse {MAX_PRESET_FILE_BYTES} octets +@msg exportText must be editable or appearance exportText doit valoir editable ou appearance +@msg exportType must be movieClip or graphic, not `{s}` exportType doit valoir movieClip ou graphic, pas `{s}` +@msg extend needs id extend nécessite id +@msg featureChanges lists at most {MAX_FEATURE_CHANGES} tags featureChanges liste au plus {MAX_FEATURE_CHANGES} balises +@msg featureChanges must be a list of tags featureChanges doit être une liste de balises +@msg features must be a list of tags features doit être une liste de balises +@msg fidelity must be 0..100 fidelity doit être compris entre 0 et 100 +@msg files must be {name, dataBase64} files doit être {name, dataBase64} +@msg finally table {t} out of range table finally {t} hors limites +@msg fit must be none|autoHeight|shrinkText|block, got {id} fit doit valoir none|autoHeight|shrinkText|block, reçu : {id} +@msg flags cannot be given with a RegExp object les indicateurs ne peuvent pas être fournis avec un objet RegExp +@msg flattener: {e} aplatissement : {e} +@msg flattenerPreset `{name}`: high, medium, low or a saved one (see flattener.presets.list) flattenerPreset `{name}` : high, medium, low ou un paramètre enregistré (voir flattener.presets.list) +@msg flipProfile must be along|across, got {o} flipProfile doit valoir along|across, reçu : {o} +@msg folders `{f}`: none, rows, format, item or itemFormat folders `{f}` : none, rows, format, item ou itemFormat +@msg folders deeper than {MAX_BATCH_DEPTH} levels dossiers de plus de {MAX_BATCH_DEPTH} niveaux de profondeur +@msg folders deeper than {MAX_DEPTH} levels dossiers de plus de {MAX_DEPTH} niveaux de profondeur +@msg font family `{family}` is not available la famille de polices `{family}` n’est pas disponible +@msg font family `{tf}` is not available la famille de polices `{tf}` n’est pas disponible +@msg format `{f}`: pdf or postscript format `{f}` : pdf ou postscript +@msg format `{f}`: text or json format `{f}` : text ou json +@msg format is `{format}` le format est `{format}` +@msg formats must be an array of rows, not {v} formats doit être une liste de lignes, pas {v} +@msg frequency must be between 1 and 300 lines per inch la linéature doit être comprise entre 1 et 300 lignes par pouce +@msg from and to must be finite from et to doivent être finis +@msg from must be [x0, y0, x1, y1] from doit être [x0, y0, x1, y1] +@msg function declaration index out of range indice de déclaration de fonction hors limites +@msg give `before` or `after`, not both indiquez `before` ou `after`, pas les deux +@msg give `char`, `text`, `code` or `unicode` indiquez `char`, `text`, `code` ou `unicode` +@msg give `colors`, or `color` and `rule` indiquez `colors`, ou `color` et `rule` +@msg give `count` or `spacing`, not both indiquez `count` ou `spacing`, pas les deux +@msg give `event`, such as onclick indiquez `event`, par exemple onclick +@msg give `file`, the JavaScript file's path or URL indiquez `file`, le chemin ou l’URL du fichier JavaScript +@msg give `fill` and/or `stroke` indiquez `fill` et/ou `stroke` +@msg give `fill`, `stroke` or both indiquez `fill`, `stroke` ou les deux +@msg give `folder` indiquez `folder` +@msg give `fonts`, or open a document indiquez `fonts`, ou ouvrez un document +@msg give `from` or `indices`, not both indiquez `from` ou `indices`, pas les deux +@msg give `id` (no text is being edited) indiquez `id` (aucun texte n’est en cours de modification) +@msg give `id` and `anchors`, or `items`, not both indiquez `id` et `anchors`, ou `items`, pas les deux +@msg give `id` or `guide`, not both indiquez `id` ou `guide`, pas les deux +@msg give `length` or `to` indiquez `length` ou `to` +@msg give `matches`: [{kind, name, target}] indiquez `matches` : [{kind, name, target}] +@msg give `name` (or edit a pattern) indiquez `name` (ou modifiez un motif) +@msg give `name` or `names` indiquez `name` ou `names` +@msg give `name`, an SVG filter's name indiquez `name`, le nom d’un filtre SVG +@msg give `path` (a .wasm file) or `dataBase64` (the module) indiquez `path` (un fichier .wasm) ou `dataBase64` (le module) +@msg give `path`, `data` or `dataBase64` indiquez `path`, `data` ou `dataBase64` +@msg give `path`, `data`, `dataBase64` or `csv` indiquez `path`, `data`, `dataBase64` ou `csv` +@msg give `path`, `xml` or `dataBase64` indiquez `path`, `xml` ou `dataBase64` +@msg give `path`, an SVG file, or `svg`, SVG text indiquez `path`, un fichier SVG, ou `svg`, du texte SVG +@msg give `script`, the JavaScript the event runs ("" removes the event) indiquez `script`, le code JavaScript exécuté par l’événement ("" supprime l’événement) +@msg give `text` (the reading) or `remove` indiquez `text` (la lecture) ou `remove` +@msg give `x` and `y` (and a `tolerance` of 0 or more) indiquez `x` et `y` (et une `tolerance` supérieure ou égale à 0) +@msg give `xml`, one SVG element indiquez `xml`, un seul élément SVG +@msg give a mode or r/g/b, c/m/y/k, gray or tint adjustments indiquez un mode ou des réglages r/g/b, c/m/y/k, gray ou tint +@msg give a name, or paint the active proxy with a saved preset indiquez un nom, ou peignez l’échantillon actif avec un paramètre prédéfini enregistré +@msg give a name, or select a stroke with a saved profile indiquez un nom, ou sélectionnez un contour doté d’un profil enregistré +@msg give a pattern name or select an object painted with a pattern indiquez un nom de motif ou sélectionnez un objet peint avec un motif +@msg give at least one of clip, invert, disabled, linked indiquez au moins l’un des paramètres clip, invert, disabled, linked +@msg give color, none, swatch or gradient indiquez color, none, swatch ou gradient +@msg give dataBase64 indiquez dataBase64 +@msg give either at (a click) or area (a path drawn around the overlaps) indiquez soit at (un clic), soit area (un tracé dessiné autour des chevauchements) +@msg give exactly one of `path`, `data` and `dataBase64` indiquez exactement un paramètre parmi `path`, `data` et `dataBase64` +@msg give formats or a preset, not both indiquez formats ou un paramètre prédéfini, pas les deux +@msg give index or indexes, not both indiquez index ou indexes, pas les deux +@msg give newName or delete indiquez newName ou delete +@msg give offset or by indiquez offset ou by +@msg give one element indiquez un seul élément +@msg give one of `to`, `rect` or `at` indiquez l’un des paramètres `to`, `rect` ou `at` +@msg give one of assets, layers, selection or fullDocument indiquez l’un des paramètres assets, layers, selection ou fullDocument +@msg give only one of onto, above, below, icon and a column place indiquez un seul paramètre parmi onto, above, below, icon et un emplacement de colonne +@msg give opacity or blend indiquez opacity ou blend +@msg give origin: [x, y], or reset: true indiquez origin: [x, y], ou reset: true +@msg give overprintFill, overprintStroke, showCenter, imageMap, url or note indiquez overprintFill, overprintStroke, showCenter, imageMap, url ou note +@msg give path (a file) or folder indiquez path (un fichier) ou folder +@msg give path, or name and dataBase64 indiquez path, ou name et dataBase64 +@msg give paths or files indiquez paths ou files +@msg give rows, rowHeight, columns or columnWidth indiquez rows, rowHeight, columns ou columnWidth +@msg give svg, or dataBase64 of an SVG or SVGZ file indiquez svg, ou le dataBase64 d’un fichier SVG ou SVGZ +@msg give text indiquez text +@msg give the asset a name donnez un nom à la ressource +@msg give the preset a `name` donnez un `name` au paramètre prédéfini +@msg give the preset a name donnez un nom au paramètre prédéfini +@msg give the preset a name (1–64 characters) donnez un nom au paramètre prédéfini (de 1 à 64 caractères) +@msg give the settings to change, e.g. {"formats"}]} indiquez les réglages à modifier, par exemple {"formats"}]} +@msg give the style a name donnez un nom au style +@msg give two or more style `names` indiquez au moins deux noms de styles `names` +@msg give two or more swatches indiquez au moins deux nuances +@msg give x, y, or a handle's length or angle indiquez x, y, ou la longueur ou l’angle d’une poignée +@msg give {key, value} or {values} indiquez {key, value} ou {values} +@msg global must be true or false global doit valoir true ou false +@msg glyph {_1} is not drawn for {ch} with the character's style (such as All Caps, Small Caps or a numeral system) le glyphe {_1} n’est pas dessiné pour {ch} avec le style du caractère (comme Tout en capitales, Petites capitales ou un système de chiffres) +@msg glyph {g} is not an alternate of {ch} in {_1} {_2} le glyphe {g} n’est pas une variante de {ch} dans {_1} {_2} +@msg gradient must be "objects" or "mesh" gradient doit valoir "objects" ou "mesh" +@msg grays must be "profile" or "black", not `{g}` grays doit valoir "profile" ou "black", pas `{g}` +@msg gridColors must be a preset name or two colours gridColors doit être un nom de paramètre prédéfini ou deux couleurs +@msg gridSize must be small, medium or large gridSize doit valoir small, medium ou large +@msg guide {g} is not selected le repère {g} n’est pas sélectionné +@msg handle must be 0..3 handle doit être compris entre 0 et 3 +@msg handler at {_1} expects {_2} values but its range starts with {d} le gestionnaire à {_1} attend {_2} valeurs, mais sa plage commence avec {d} +@msg handler depth too large profondeur de gestionnaire trop grande +@msg handler range {_1}..{_2} out of range plage de gestionnaire {_1}..{_2} hors limites +@msg hiddenLayers must be true or false hiddenLayers doit valoir true ou false +@msg hiddenObjects {v}: "layer" (the default), "omit" or "visible" hiddenObjects {v} : "layer" (par défaut), "omit" ou "visible" +@msg highlight a layer to merge into mettez en surbrillance un calque dans lequel fusionner +@msg highlight two or more rows in one layer or group mettez en surbrillance au moins deux lignes d’un même calque ou groupe +@msg highlight two or more rows to merge mettez en surbrillance au moins deux lignes à fusionner +@msg hvcC hvcC +@msg icon docks a panel in the icon column: use window.panel.dock icon ancre un panneau dans la colonne d’icônes : utilisez window.panel.dock +@msg id must be a dimension id id doit être un identifiant de cote +@msg image has no bounds l’image n’a pas de limites +@msg image {_1} is linked already l’image {_1} est déjà liée +@msg imageMap `{m}`: none, client or server imageMap `{m}` : none, client ou server +@msg images in a spot ink whose samples couldn't be read were imported in RGB les images en encre de ton direct dont les échantillons n’ont pas pu être lus ont été importées en RVB +@msg images past the most pixels one file may hold were left out les images dépassant le nombre maximal de pixels qu’un fichier peut contenir ont été omises +@msg images too large to read were left out les images trop grandes pour être lues ont été omises +@msg index out of range indice hors limites +@msg indexes may hold at most {MAX_GUIDE_INDEXES} entries indexes peut contenir au plus {MAX_GUIDE_INDEXES} entrées +@msg indexes must be an array of guide indexes indexes doit être une liste d’indices de repères +@msg instances must be 1..1000 instances doit être compris entre 1 et 1000 +@msg instruction out of range instruction hors limites +@msg instruction {pc} ({op}) pops below the stack l’instruction {pc} ({op}) dépile sous le bas de la pile +@msg instruction {pc} reached with stack depths {seen} and {d} instruction {pc} atteinte avec des profondeurs de pile {seen} et {d} +@msg invalid `color` `color` non valide +@msg invalid anchor index {v}: expected a non-negative integer indice de point d’ancrage non valide {v} : entier positif ou nul attendu +@msg invalid anchor reference {v}: expected [subpath, anchor] référence de point d’ancrage non valide {v} : [subpath, anchor] attendu +@msg invalid angle angle non valide +@msg invalid array length longueur de tableau non valide +@msg invalid brush: {e} forme non valide : {e} +@msg invalid color couleur non valide +@msg invalid colour {c} couleur non valide {c} +@msg invalid delta delta non valide +@msg invalid group groupe non valide +@msg invalid object id {v}: expected a non-negative integer identifiant d’objet non valide {v} : entier positif ou nul attendu +@msg invalid point point non valide +@msg invalid regular expression flag '{_1}' indicateur d’expression régulière non valide '{_1}' +@msg invalid regular expression: {m} expression régulière non valide : {m} +@msg invalid size taille non valide +@msg invalid t t non valide +@msg invalid time value valeur de temps non valide +@msg invalid tolerance tolérance non valide +@msg is a confirm's answer, whose `value` must be true or false est la réponse à une confirmation, dont `value` doit valoir true ou false +@msg is a prompt's answer, whose `value` must be a string or null est la réponse à une invite, dont `value` doit être une chaîne ou null +@msg is an alert's answer, whose `value` must be "ok" est la réponse à une alerte, dont `value` doit valoir "ok" +@msg is longer than 16 KiB dépasse 16 Kio +@msg it draws its image through a clipping path il dessine son image à travers un tracé de détourage +@msg it draws no image il ne dessine aucune image +@msg it is larger than {MAX_DICTIONARY_FILE_BYTES} bytes il dépasse {MAX_DICTIONARY_FILE_BYTES} octets +@msg it isn't a file ce n’est pas un fichier +@msg it names {_1} plates, and at most {MAX_PLATES} are read il désigne {_1} plaques, et au plus {MAX_PLATES} sont lues +@msg its art is too long or too detailed for a head son illustration est trop longue ou trop détaillée pour une pointe +@msg its art paints nothing son illustration ne peint rien +@msg its artboards all lie beyond the canvas (more than {_1} pt from the origin) tous ses plans de travail se trouvent au-delà de la zone de travail (à plus de {_1} pt de l’origine) +@msg its clipping masks are nested too deeply ses masques d’écrêtage sont imbriqués trop profondément +@msg its image is too large to read son image est trop grande pour être lue +@msg its metadata has no description ses métadonnées n’ont pas de description +@msg its metadata has no direct length ses métadonnées n’ont pas de longueur directe +@msg its plates are too large: more than {MAX_SAMPLES} pixels together ses plaques sont trop grandes : plus de {MAX_SAMPLES} pixels au total +@msg its plates are too large: {_1} plates of {w} × {h} pixels ses plaques sont trop grandes : {_1} plaques de {w} × {h} pixels +@msg its plates can't be kept together ses plaques ne peuvent pas être conservées ensemble +@msg its shapes could not be combined into one ses formes n’ont pas pu être combinées en une seule +@msg join two different paths joignez deux tracés différents +@msg jump to {pc}, past the end saut vers {pc}, au-delà de la fin +@msg justify must be auto|left|center|right|justifyAll justify doit valoir auto|left|center|right|justifyAll +@msg kbps must be a positive number, not {kbps} kbps doit être un nombre positif, pas {kbps} +@msg keywords must be a list of words or a comma-separated string keywords doit être une liste de mots ou une chaîne séparée par des virgules +@msg keywords must be at most {MAX_KEYWORD} characters, without control characters keywords doit compter au plus {MAX_KEYWORD} caractères, sans caractères de contrôle +@msg kind must be 1, 2 or 3, or give a preset `name` (see perspective.presets.list) kind doit valoir 1, 2 ou 3, ou indiquez un `name` de paramètre prédéfini (voir perspective.presets.list) +@msg kind must be graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle or paraStyle kind doit valoir graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle ou paraStyle +@msg knockout must be "on", "off", "neutral" or a bool, not {v} knockout doit valoir "on", "off", "neutral" ou un booléen, pas {v} +@msg layer `{name}` has no art to export le calque `{name}` ne contient aucune illustration à exporter +@msg layer must name a layer or sublayer layer doit désigner un calque ou un sous-calque +@msg layers can't be intertwined: select the objects in them les calques ne peuvent pas être entrelacés : sélectionnez les objets qu’ils contiennent +@msg layers go only at the top level or in layers, objects in layers and groups les calques vont uniquement au niveau supérieur ou dans des calques, les objets dans des calques et des groupes +@msg layers must be true or false layers doit valoir true ou false +@msg layout must be gridByRow, gridByColumn, row or column layout doit valoir gridByRow, gridByColumn, row ou column +@msg leading must be a number or "auto" leading doit être un nombre ou "auto" +@msg left/right must be non-negative widths left/right doivent être des largeurs positives ou nulles +@msg legacyNameEncoding must be one of {_1} legacyNameEncoding doit valoir l’une de ces valeurs : {_1} +@msg level `{t}`: 2 or 3 niveau `{t}` : 2 ou 3 +@msg line {line}: more than {MAX_CSV_COLS} columns ligne {line} : plus de {MAX_CSV_COLS} colonnes +@msg line {line}: unclosed quote ligne {line} : guillemet non fermé +@msg line {line}: value for `{var}` must match its variable kind ligne {line} : la valeur de `{var}` doit correspondre au type de sa variable +@msg lineEndings `{other}`: lf or crlf lineEndings `{other}` : lf ou crlf +@msg loading profiles from disk isn't available in the browser le chargement de profils depuis le disque n’est pas disponible dans le navigateur +@msg localize: the first argument must be a localization object or a string localize : le premier argument doit être un objet de localisation ou une chaîne +@msg margin: a {m} pt margin leaves no imageable area on the paper marge : une marge de {m} pt ne laisse aucune zone imprimable sur le papier +@msg matrix must be finite and invertible, depth finite matrix doit être finie et inversible, et depth finie +@msg matte: {e} cache : {e} +@msg member is for order front, forward, backward or back member s’utilise avec order front, forward, backward ou back +@msg missing `artboards` `artboards` manquant +@msg missing `at` [x, y] `at` [x, y] manquant +@msg missing `attrs` `attrs` manquant +@msg missing `color` or `opacity` `color` ou `opacity` manquant +@msg missing `colors` `colors` manquant +@msg missing `commands` `commands` manquant +@msg missing `destinationFolder` `destinationFolder` manquant +@msg missing `effect` id identifiant `effect` manquant +@msg missing `family` `family` manquant +@msg missing `find` `find` manquant +@msg missing `gid` (a glyph id, or null for the default glyph) `gid` manquant (un identifiant de glyphe, ou null pour le glyphe par défaut) +@msg missing `group` `group` manquant +@msg missing `id` `id` manquant +@msg missing `id`: give one, or select one type object `id` manquant : indiquez-en un, ou sélectionnez un objet texte +@msg missing `index` (a point index, or null to clear) `index` manquant (un indice de point, ou null pour effacer) +@msg missing `index` (a stop index, or null to clear) `index` manquant (un indice d’arrêt, ou null pour effacer) +@msg missing `index` (an item index or null) `index` manquant (un indice d’élément ou null) +@msg missing `item` `item` manquant +@msg missing `library` `library` manquant +@msg missing `library` (see graphicStyle.libraries) `library` manquant (voir graphicStyle.libraries) +@msg missing `library` (see swatch.library.list) `library` manquant (voir swatch.library.list) +@msg missing `map` (rows [{from, to}] or {current}) `map` manquant (lignes [{from, to}] ou {current}) +@msg missing `matrix` [a,b,c,d,e,f] `matrix` [a,b,c,d,e,f] manquant +@msg missing `name` (see gradient.presets.list) `name` manquant (voir gradient.presets.list) +@msg missing `offset` (a distance in points) `offset` manquant (une distance en points) +@msg missing `path` `path` manquant +@msg missing `path` (a path object id) `path` manquant (un identifiant d’objet tracé) +@msg missing `picks` `picks` manquant +@msg missing `rule` `rule` manquant +@msg missing `source` id identifiant `source` manquant +@msg missing `start` (the byte offset of a character) `start` manquant (la position en octets d’un caractère) +@msg missing `status`: linked, embedded, missing or modified `status` manquant : linked, embedded, missing ou modified +@msg missing `target` id identifiant `target` manquant +@msg missing `text` `text` manquant +@msg missing `to` `to` manquant +@msg missing `to` (an index) `to` manquant (un indice) +@msg missing `to`: a non-negative integer `to` manquant : un entier positif ou nul +@msg missing `type` `type` manquant +@msg missing `value` `value` manquant +@msg missing `word` `word` manquant +@msg missing `{key}` `{key}` manquant +@msg missing `{k}` `{k}` manquant +@msg missing anchor point d’ancrage manquant +@msg missing anchors points d’ancrage manquants +@msg missing anchors [[subpath, anchor]…] anchors [[subpath, anchor]…] manquant +@msg missing array `{key}` liste `{key}` manquante +@msg missing case case manquant +@msg missing color couleur manquante +@msg missing commands commandes manquantes +@msg missing destination folder dossier de destination manquant +@msg missing from from manquant +@msg missing group groupe manquant +@msg missing id or ids id ou ids manquant +@msg missing ids ids manquant +@msg missing indexes indexes manquant +@msg missing matrix [a,b,c,d,e,f] matrix [a,b,c,d,e,f] manquant +@msg missing name nom manquant +@msg missing op op manquant +@msg missing or invalid `color` `color` manquant ou non valide +@msg missing or unknown `tool` `tool` manquant ou inconnu +@msg missing point point manquant +@msg missing point [x,y] point [x,y] manquant +@msg missing point `{key}` ([x, y]) point `{key}` manquant ([x, y]) +@msg missing points points manquants +@msg missing points [[x,y]…] points [[x,y]…] manquants +@msg missing segment segment manquant +@msg missing stops taquets manquants +@msg missing subpaths sous-tracés manquants +@msg missing target cible manquante +@msg missing to to manquant +@msg missing x, y x, y manquants +@msg mode is set, add or toggle, not `{other}` mode vaut set, add ou toggle, pas `{other}` +@msg mode must be "cmyk" or "rgb" mode doit valoir "cmyk" ou "rgb" +@msg mode must be area|onPath, got {o} mode doit valoir area|onPath, reçu : {o} +@msg more than 10000 linked files: package dependencies in smaller parts plus de 10000 fichiers liés : assemblez les dépendances en plusieurs parties plus petites +@msg more than 256 commands plus de 256 commandes +@msg more than {MAX_BATCH_FILES} data sets plus de {MAX_BATCH_FILES} jeux de données +@msg more than {MAX_BATCH_FILES} files plus de {MAX_BATCH_FILES} fichiers +@msg more than {MAX_CSV_ROWS} data rows plus de {MAX_CSV_ROWS} lignes de données +@msg more than {MAX_FILES} images plus de {MAX_FILES} images +@msg more than {MAX_IMPORT} presets plus de {MAX_IMPORT} paramètres prédéfinis +@msg moved must be [[x,y]…] moved doit être [[x,y]…] +@msg must be an object with `kind` and `value` doit être un objet avec `kind` et `value` +@msg must have `kind` alert, confirm or prompt doit avoir `kind` alert, confirm ou prompt +@msg must have exactly `kind` and `value` doit avoir exactement `kind` et `value` +@msg name (a toolbar's name) is required name (le nom d’une barre d’outils) est obligatoire +@msg name (a toolbar's name) must be a string name (le nom d’une barre d’outils) doit être une chaîne +@msg name must be a toolbar's name name doit être le nom d’une barre d’outils +@msg names is empty names est vide +@msg names must be an array of symbol names names doit être une liste de noms de symboles +@msg need `anchor` or `segment` + `t` `anchor` ou `segment` + `t` nécessaire +@msg need at least one anchor au moins un point d’ancrage est nécessaire +@msg need at least one point au moins un point est nécessaire +@msg need at least two points au moins deux points sont nécessaires +@msg needs a closing quote after the name nécessite un guillemet fermant après le nom +@msg needs a name nécessite un nom +@msg needs a name of at most 64 bytes nécessite un nom d’au plus 64 octets +@msg needs a name of letters, digits and _, or a quoted name nécessite un nom composé de lettres, de chiffres et de _, ou un nom entre guillemets +@msg needs a name without control characters nécessite un nom sans caractères de contrôle +@msg needs points nécessite des points +@msg nesting too deep imbrication trop profonde +@msg nineSlice must be true or false nineSlice doit valoir true ou false +@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides doit être [left, top, right, bottom], chacun entre -16 et 16, avec left + right < 1 et top + bottom < 1 +@msg no HP-GL format aucun format HP-GL +@msg no New Document profile called `{shown}` ({_1}) aucun profil de nouveau document nommé `{shown}` ({_1}) +@msg no PDF preset named `{n}` aucun paramètre prédéfini PDF nommé `{n}` +@msg no SVG filter at index {k} aucun filtre SVG à l’indice {k} +@msg no action set is current aucun ensemble d’actions n’est actif +@msg no active data set aucun jeu de données actif +@msg no appearance item {index} aucun élément d’aspect {index} +@msg no arrowheads file here aucun fichier de pointes de flèche ici +@msg no artboard {_1} aucun plan de travail {_1} +@msg no artboard {artboard} (0-based; the document has {_1}) aucun plan de travail {artboard} (à partir de 0 ; le document en compte {_1}) +@msg no asset {id} aucune ressource {id} +@msg no asset {id} (see assets.list) aucune ressource {id} (voir assets.list) +@msg no assets to export aucune ressource à exporter +@msg no assets yet: collect art for export first (assets.add) aucune ressource pour l’instant : rassemblez d’abord des illustrations à exporter (assets.add) +@msg no brush named `{n}` aucune forme nommée `{n}` +@msg no character at byte {start} aucun caractère à l’octet {start} +@msg no character has code {code} aucun caractère n’a le code {code} +@msg no colour aucune couleur +@msg no colour group `{group}` aucun groupe de couleurs `{group}` +@msg no colour group `{name}` aucun groupe de couleurs `{name}` +@msg no custom arrowhead {name} (see stroke.arrowheads.list) aucune pointe de flèche personnalisée {name} (voir stroke.arrowheads.list) +@msg no data sets aucun jeu de données +@msg no dataset named `{from}` aucun jeu de données nommé `{from}` +@msg no dataset named `{name}` aucun jeu de données nommé `{name}` +@msg no datasets aucun jeu de données +@msg no design named `{name}` aucun motif nommé `{name}` +@msg no design named `{n}` aucun motif nommé `{n}` +@msg no design named `{old}` aucun motif nommé `{old}` +@msg no encoder for {_1} yet pas encore d’encodeur pour {_1} +@msg no export preset `{name}` (see document.exportPresets.list) aucun paramètre prédéfini d’export `{name}` (voir document.exportPresets.list) +@msg no file to open aucun fichier à ouvrir +@msg no folder: pass `path` or set Preferences › Plug-ins & Scratch Disks › Additional Plug-ins Folder aucun dossier : passez `path` ou définissez Préférences › Plug-ins et disques de travail › Dossier de plug-ins supplémentaire +@msg no fonts to look for: they are all available aucune police à rechercher : elles sont toutes disponibles +@msg no formats to export aucun format à exporter +@msg no gradient preset `{name}` (see gradient.presets.list) aucun paramètre prédéfini de dégradé `{name}` (voir gradient.presets.list) +@msg no graphic style `{n}` in `{_1}` aucun style graphique `{n}` dans `{_1}` +@msg no graphic style library `{key}` (see graphicStyle.libraries) aucune bibliothèque de styles graphiques `{key}` (voir graphicStyle.libraries) +@msg no guide selected aucun repère sélectionné +@msg no guide selected (or give an index) aucun repère sélectionné (ou indiquez un indice) +@msg no guide {i} aucun repère {i} +@msg no images in the folder aucune image dans le dossier +@msg no instructions aucune instruction +@msg no item at index {_1} aucun élément à l’indice {_1} +@msg no item at index {from} aucun élément à l’indice {from} +@msg no item at one of the indices {idx} aucun élément à l’un des indices {idx} +@msg no layer aucun calque +@msg no layer to rename aucun calque à renommer +@msg no layer {id} (see layer.list) aucun calque {id} (voir layer.list) +@msg no layers to export aucun calque à exporter +@msg no library `{key}` aucune bibliothèque `{key}` +@msg no metafile format aucun format de métafichier +@msg no object {_1} aucun objet {_1} +@msg no objects aucun objet +@msg no parent layer aucun calque parent +@msg no perspective grid preset named `{b}` (see perspective.presets.list) aucun paramètre prédéfini de grille de perspective nommé `{b}` (voir perspective.presets.list) +@msg no perspective grid preset named `{n}` aucun paramètre prédéfini de grille de perspective nommé `{n}` +@msg no point selected (give `index`) aucun point sélectionné (indiquez `index`) +@msg no preset called `{from}` (see file.newPresets) aucun paramètre prédéfini nommé `{from}` (voir file.newPresets) +@msg no preset called `{name}` (see file.newPresets) aucun paramètre prédéfini nommé `{name}` (voir file.newPresets) +@msg no preset named `{n}` aucun paramètre prédéfini nommé `{n}` +@msg no print preset named `{b}` (see print.presets.list) aucun paramètre prédéfini d’impression nommé `{b}` (voir print.presets.list) +@msg no print preset named `{name}` (presets: {_1}) aucun paramètre prédéfini d’impression nommé `{name}` (paramètres prédéfinis : {_1}) +@msg no print preset named `{n}` aucun paramètre prédéfini d’impression nommé `{n}` +@msg no profile named `{name}` aucun profil nommé `{name}` +@msg no random numbers ({e}) aucun nombre aléatoire ({e}) +@msg no readable files in the folder aucun fichier lisible dans le dossier +@msg no recovery copy `{f}` (see file.recovery.list) aucune copie de récupération `{f}` (voir file.recovery.list) +@msg no rows aucune ligne +@msg no saved PDF preset named `{name}` aucun paramètre prédéfini PDF enregistré nommé `{name}` +@msg no saved export preset `{name}` aucun paramètre prédéfini d’export enregistré `{name}` +@msg no saved gradient preset called {name} aucun paramètre prédéfini de dégradé enregistré nommé {name} +@msg no saved gradient presets aucun paramètre prédéfini de dégradé enregistré +@msg no saved preset called `{name}` aucun paramètre prédéfini enregistré nommé `{name}` +@msg no saved presets to export (name [Default] in `names` to export it) aucun paramètre prédéfini enregistré à exporter (indiquez [Default] dans `names` pour l’exporter) +@msg no saved presets to export (name built-in ones in `names`) aucun paramètre prédéfini enregistré à exporter (indiquez les paramètres intégrés dans `names`) +@msg no saved print preset named `{name}` aucun paramètre prédéfini d’impression enregistré nommé `{name}` +@msg no saved profile called {name} aucun profil enregistré nommé {name} +@msg no saved selection `{name}` aucune sélection enregistrée `{name}` +@msg no saved theme called {name} (see colorTheme.list) aucun thème enregistré nommé {name} (voir colorTheme.list) +@msg no saved views aucune vue enregistrée +@msg no selected or given object has a visible 3D effect aucun objet sélectionné ou indiqué n’a d’effet 3D visible +@msg no series {i} aucune série {i} +@msg no slice {n} in the image (see slice.list) aucune tranche {n} dans l’image (voir slice.list) +@msg no source art aucune illustration source +@msg no stop {i} (the gradient has {n}) aucun arrêt {i} (le dégradé en compte {n}) +@msg no style `{name}` aucun style `{name}` +@msg no such artboard {v} plan de travail {v} introuvable +@msg no such assets (see assets.list) ressources introuvables (voir assets.list) +@msg no such frame anchor, or the frame would reach past the canvas point d’ancrage de cadre introuvable, ou le cadre dépasserait la zone de travail +@msg no such objects objets introuvables +@msg no such path anchor, or the path would reach past the canvas point d’ancrage de tracé introuvable, ou le tracé dépasserait la zone de travail +@msg no such rows lignes introuvables +@msg no swatch `{keep}` aucune nuance `{keep}` +@msg no swatch `{n}` aucune nuance `{n}` +@msg no swatch `{n}` (swatches and colour groups move separately) aucune nuance `{n}` (les nuances et les groupes de couleurs se déplacent séparément) +@msg no swatch library `{key}` (see swatch.library.list) aucune bibliothèque de nuances `{key}` (voir swatch.library.list) +@msg no swatch library `{key}` (see swatch.library.list; "document": the document's swatches) aucune bibliothèque de nuances `{key}` (voir swatch.library.list ; "document" : les nuances du document) +@msg no swatch library `{key}` (see swatch.library.list; "{DOCUMENT_SWATCHES}": the document's swatches) aucune bibliothèque de nuances `{key}` (voir swatch.library.list ; "{DOCUMENT_SWATCHES}" : les nuances du document) +@msg no swatch named `{n}` aucune nuance nommée `{n}` +@msg no swatch or colour group `{n}` aucune nuance ni aucun groupe de couleurs `{n}` +@msg no swatch or colour group `{n}` in `{_1}` aucune nuance ni aucun groupe de couleurs `{n}` dans `{_1}` +@msg no symbol named `{_1}` aucun symbole nommé `{_1}` +@msg no symbol named `{name}` aucun symbole nommé `{name}` +@msg no text objects selected aucun objet texte sélectionné +@msg no toolbar named `{_1}` aucune barre d’outils nommée `{_1}` +@msg no toolbar named `{name}` aucune barre d’outils nommée `{name}` +@msg no tracing preset `{preset}` (see imageTrace.presets) aucun paramètre prédéfini de vectorisation `{preset}` (voir imageTrace.presets) +@msg no user library folder here (save with a path, or without one to get the data) aucun dossier de bibliothèques utilisateur ici (enregistrez avec un chemin, ou sans chemin pour obtenir les données) +@msg no variable named `{from}` aucune variable nommée `{from}` +@msg no variable named `{name}` aucune variable nommée `{name}` +@msg no variable named `{var}` aucune variable nommée `{var}` +@msg no variable named `{v}` aucune variable nommée `{v}` +@msg no view named `{name}` aucune vue nommée `{name}` +@msg node {_1} already has the text variable `{_2}` le nœud {_1} a déjà la variable de texte `{_2}` +@msg node {_1} is not a graph le nœud {_1} n’est pas un graphe +@msg node {_1} is not an image le nœud {_1} n’est pas une image +@msg node {_1} is not type le nœud {_1} n’est pas du texte +@msg not a DCS file ce n’est pas un fichier DCS +@msg not a PDF presets file (format `{_1}`) ce n’est pas un fichier de paramètres prédéfinis PDF (format `{_1}`) +@msg not a PDF presets file: {e} ce n’est pas un fichier de paramètres prédéfinis PDF : {e} +@msg not a RegExp object ce n’est pas un objet RegExp +@msg not a Word document: its WordDocument stream doesn't start with a file information block ce n’est pas un document Word : son flux WordDocument ne commence pas par un bloc d’informations de fichier +@msg not a Word document: its compound file has no WordDocument stream ce n’est pas un document Word : son fichier composé n’a pas de flux WordDocument +@msg not a Word document: its main part is not a WordprocessingML document ce n’est pas un document Word : sa partie principale n’est pas un document WordprocessingML +@msg not a Word document: its package has no main document part ce n’est pas un document Word : son package n’a pas de partie de document principale +@msg not a closed path ce n’est pas un tracé fermé +@msg not a flattener presets file (format `{_1}`) ce n’est pas un fichier de paramètres prédéfinis d’aplatissement (format `{_1}`) +@msg not a flattener presets file: {e} ce n’est pas un fichier de paramètres prédéfinis d’aplatissement : {e} +@msg not a layer or group ce n’est ni un calque ni un groupe +@msg not a library file: {e} ce n’est pas un fichier de bibliothèque : {e} +@msg not a mesh envelope point ce n’est pas un point d’enveloppe de maillage +@msg not a perspective grid presets file (format `{_1}`) ce n’est pas un fichier de paramètres prédéfinis de grille de perspective (format `{_1}`) +@msg not a perspective grid presets file: {e} ce n’est pas un fichier de paramètres prédéfinis de grille de perspective : {e} +@msg not a print presets file (format `{_1}`) ce n’est pas un fichier de paramètres prédéfinis d’impression (format `{_1}`) +@msg not a print presets file: {e} ce n’est pas un fichier de paramètres prédéfinis d’impression : {e} +@msg not a regular expression ce n’est pas une expression régulière +@msg not a stored or deflated central record ce n’est pas un enregistrement central stocké ou compressé +@msg not a valid SVGZ file: {e} ce n’est pas un fichier SVGZ valide : {e} +@msg not an RTF file: it doesn't start with {\rtf ce n’est pas un fichier RTF : il ne commence pas par {\rtf +@msg not an action set: the text doesn't start with /version and a number ce n’est pas un ensemble d’actions : le texte ne commence pas par /version et un nombre +@msg not an image VectorCraft reads (see document.formats) ce n’est pas une image que VectorCraft lit (voir document.formats) +@msg not area type (text in a frame) outside perspective ce n’est pas un texte captif (texte dans un cadre) hors perspective +@msg not editing an opacity mask aucun masque d’opacité en cours de modification +@msg not type on a path outside perspective ce n’est pas un texte curviligne hors perspective +@msg nothing prints rien ne s’imprime +@msg nothing to bind rien à lier +@msg nothing to change rien à modifier +@msg nothing to change: give dx, dy, hScale, vScale or rotation rien à modifier : indiquez dx, dy, hScale, vScale ou rotation +@msg nothing to crop rien à recadrer +@msg nothing to export rien à exporter +@msg nothing to export: the document has no visible art rien à exporter : le document n’a aucune illustration visible +@msg nothing to mark rien à marquer +@msg nothing to print: every artboard picked is blank rien à imprimer : chaque plan de travail choisi est vide +@msg nothing to print: the document has no art that prints rien à imprimer : le document n’a aucune illustration imprimable +@msg nothing to repeat rien à répéter +@msg numbers out of order in {_1} quantifier nombres dans le désordre dans le quantificateur {_1} +@msg object is not a path l’objet n’est pas un tracé +@msg object transparency cannot be sampled onto highlighted characters; disable Transparency in Eyedropper Options or select the whole object la transparence d’un objet ne peut pas être prélevée sur des caractères en surbrillance ; désactivez Transparence dans les options de la pipette ou sélectionnez l’objet entier +@msg object {_1} can't be set as point type l’objet {_1} ne peut pas être converti en texte de point +@msg object {_1} has lost its file's contents: relink it l’objet {_1} a perdu le contenu de son fichier : liez-le à nouveau +@msg object {_1} has no path l’objet {_1} n’a pas de tracé +@msg object {_1} has no size l’objet {_1} n’a pas de taille +@msg object {_1} is hidden or locked, or on a locked artboard l’objet {_1} est masqué ou verrouillé, ou sur un plan de travail verrouillé +@msg object {_1} is not a placed document l’objet {_1} n’est pas un document importé +@msg object {_1} is not an Intertwine group l’objet {_1} n’est pas un groupe Entrelacer +@msg object {_1} is not an image l’objet {_1} n’est pas une image +@msg object {_1} is not an image or a linked file l’objet {_1} n’est ni une image ni un fichier lié +@msg object {_1} is not an image or a placed document l’objet {_1} n’est ni une image ni un document importé +@msg object {_1} is not in this Intertwine group l’objet {_1} n’est pas dans ce groupe Entrelacer +@msg object {_1} needs a 3D effect l’objet {_1} nécessite un effet 3D +@msg object {_1} needs a 3D effect at index {index} l’objet {_1} nécessite un effet 3D à l’indice {index} +@msg object {_1}: a hollow Extrude & Bevel has no caps: turn on Cap to map a graphic objet {_1} : une extrusion et biseautage creuse n’a pas de fermetures : activez Fermeture pour placer un graphique +@msg object {_1}: with a depth of 0 the object has one face: map its graphics onto the front objet {_1} : avec une profondeur de 0, l’objet n’a qu’une face : placez ses graphiques sur l’avant +@msg object {_1}: {_2} objet {_1} : {_2} +@msg object {_1}: {e} objet {_1} : {e} +@msg object {_1}: {name} at index {index} has no lighting presets; set its lights with effect.setParams objet {_1} : {name} à l’indice {index} n’a pas de paramètres prédéfinis d’éclairage ; définissez ses éclairages avec effect.setParams +@msg object {id} has anchors 0–{_1} for `corners`, not {past} l’objet {id} a les points d’ancrage 0–{_1} pour `corners`, pas {past} +@msg object {id} has {n} anchors, so no anchor {past} l’objet {id} a {n} points d’ancrage, donc pas de point d’ancrage {past} +@msg objects must be none, move or copy objects doit valoir none, move ou copy +@msg objects were left out des objets ont été omis +@msg offset out of range décalage hors limites +@msg on must be true or false on doit valoir true ou false +@msg only groups, layers, type and images have a Contents (Characters) row seuls les groupes, calques, textes et images ont une ligne Contenu (Caractères) +@msg only interior mesh lines can be deleted seules les lignes de filet intérieures peuvent être supprimées +@msg only solid colours can be added (not gradients or patterns) seules les couleurs unies peuvent être ajoutées (pas les dégradés ni les motifs) +@msg only solid-colour swatches can be spot colours seules les nuances de couleur unie peuvent être des tons directs +@msg only this Affinity file's embedded preview could be read: use File › Open to see it with its warning, or export SVG or PDF from Affinity first seul l’aperçu incorporé de ce fichier Affinity a pu être lu : utilisez Fichier › Ouvrir pour l’afficher avec son avertissement, ou exportez d’abord en SVG ou PDF depuis Affinity +@msg only this Affinity file's embedded preview could be read; use File › Open to see it with its warning seul l’aperçu incorporé de ce fichier Affinity a pu être lu ; utilisez Fichier › Ouvrir pour l’afficher avec son avertissement +@msg onto, above, below, icon and a column place belong to window.panel.float and window.panel.dock onto, above, below, icon et un emplacement de colonne s’utilisent avec window.panel.float et window.panel.dock +@msg onto, above, below, icon and a column place take no anchor, side, zone or before onto, above, below, icon et un emplacement de colonne n’acceptent ni anchor, ni side, ni zone, ni before +@msg onto, above, below, icon and a column place take no x, y, width or height onto, above, below, icon et un emplacement de colonne n’acceptent ni x, ni y, ni width, ni height +@msg opacity must be a number opacity doit être un nombre +@msg open a document to look for its linked files ouvrez un document pour rechercher ses fichiers liés +@msg operand too large opérande trop grand +@msg options must be an object (see file.formatOptions) options doit être un objet (voir file.formatOptions) +@msg order is a whole number from 0 to {others}, not `{v}` order est un nombre entier de 0 à {others}, pas `{v}` +@msg order must be leftToRight or rightToLeft order doit valoir leftToRight ou rightToLeft +@msg orientation must be portrait or landscape, not `{o}` orientation doit valoir portrait ou landscape, pas `{o}` +@msg outlineText {v}: true or false outlineText {v} : true ou false +@msg output intent profile: {e} profil de mode de sortie : {e} +@msg output.destination: no RGB or CMYK profile is called “{name}” output.destination : aucun profil RVB ou CMJN ne s’appelle « {name} » +@msg output.destination: {_1} files are CMYK, and “{name}” is an RGB profile output.destination : les fichiers {_1} sont en CMJN, et « {name} » est un profil RVB +@msg output.destination: {e} output.destination : {e} +@msg output.inks: no ink is set to print output.inks : aucune encre n’est réglée pour l’impression +@msg output.outputIntent: no profile is called “{name}”, and a {std} output intent embeds its profile output.outputIntent : aucun profil ne s’appelle « {name} », et un mode de sortie {std} incorpore son profil +@msg output.outputIntent: no profile is called “{name}”: a {std} output intent embeds a profile, or names a registered printing condition (outputConditionId and registry) output.outputIntent : aucun profil ne s’appelle « {name} » : un mode de sortie {std} incorpore un profil, ou désigne une condition d’impression enregistrée (outputConditionId et registry) +@msg output.outputIntent: {std} files print in CMYK, and “{name}” is an RGB profile output.outputIntent : les fichiers {std} s’impriment en CMJN, et « {name} » est un profil RVB +@msg output.outputIntent: “{name}” is a grey profile, which can't be a {std} output intent output.outputIntent : « {name} » est un profil de niveaux de gris, qui ne peut pas être un mode de sortie {std} +@msg overlap: {o} pt is half a tile or more chevauchement : {o} pt représente la moitié d’une mosaïque ou plus +@msg overlapping Shaper paths must be in the same layer or group les tracés Shaper qui se chevauchent doivent être dans le même calque ou groupe +@msg overlapping edits modifications qui se chevauchent +@msg page art conflicts with image data for {key} l’illustration de la page est en conflit avec les données d’image de {key} +@msg page art conflicts with pattern {name} l’illustration de la page est en conflit avec le motif {name} +@msg page art conflicts with swatch {name} l’illustration de la page est en conflit avec la nuance {name} +@msg page art is missing image data for {key} il manque à l’illustration de la page les données d’image de {key} +@msg page art is missing pattern {name} il manque à l’illustration de la page le motif {name} +@msg page art is missing swatch {name} il manque à l’illustration de la page la nuance {name} +@msg page must be a whole number from 1 page doit être un nombre entier à partir de 1 +@msg page thumbnail: {e} vignette de page : {e} +@msg page {page} of the PDF has no objects la page {page} du PDF n’a aucun objet +@msg page {page}: `{file}` has {n} {artboards} page {page} : `{file}` contient {n} {artboards} +@msg page {page}: `{name}` has {n} {pages} page {page} : `{name}` contient {n} {pages} +@msg pages must be a range such as "2-3" or a page number, not {v} pages doit être une plage comme "2-3" ou un numéro de page, pas {v} +@msg pages: {e} pages : {e} +@msg panel position must be finite la position du panneau doit être finie +@msg parameters must be an object parameters doit être un objet +@msg params must be an object params doit être un objet +@msg passwords can have up to {MAX_PASSWORD} bytes les mots de passe peuvent compter jusqu’à {MAX_PASSWORD} octets +@msg path chunks must share their boundary point les fragments de tracé doivent partager leur point de jonction +@msg path has no open end le tracé n’a pas d’extrémité ouverte +@msg paths must be strings paths doit contenir des chaînes +@msg pdfCompatible: false needs every artboard to keep the editable artwork pdfCompatible: false nécessite que chaque plan de travail conserve l’illustration modifiable +@msg pdfCompatible: false needs the artboards to keep the editable artwork when useArtboards is false pdfCompatible: false nécessite que les plans de travail conservent l’illustration modifiable quand useArtboards vaut false +@msg pdfs `{m}`: single or multiple pdfs `{m}` : single ou multiple +@msg pickColorFrom is "artwork" or "swatches", not {v} pickColorFrom vaut "artwork" ou "swatches", pas {v} +@msg pins and moved must be non-empty lists of the same length pins et moved doivent être des listes non vides de même longueur +@msg pins must be [[x,y]…] pins doit être [[x,y]…] +@msg pins must be finite pins doit être fini +@msg place is above, below or inside, not `{other}` place vaut above, below ou inside, pas `{other}` +@msg plane must be left|right|ground plane doit valoir left|right|ground +@msg plane must be left|right|ground|none plane doit valoir left|right|ground|none +@msg point is outside the mesh le point est en dehors du filet +@msg point x must be a number le x du point doit être un nombre +@msg point y must be a number le y du point doit être un nombre +@msg points must be [t, left, right] with non-negative widths points doit être [t, left, right] avec des largeurs positives ou nulles +@msg points must be [x,y] pairs points doit être des paires [x,y] +@msg points must be a non-empty [[x,y,pressure?]…] list points doit être une liste [[x,y,pressure?]…] non vide +@msg points must be a non-empty list of finite [x,y] points doit être une liste non vide de [x,y] finis +@msg points must be an array or null points doit être une liste ou null +@msg points must be finite points doit être fini +@msg points must be finite [x,y] pairs points doit être des paires [x,y] finies +@msg points must be finite canvas points points doit être des points finis de la zone de travail +@msg points must contain 1–4096 coordinates points doit contenir de 1 à 4096 coordonnées +@msg position must be normal, superscript or subscript position doit valoir normal, superscript ou subscript +@msg position must be topLeft, topRight, bottomLeft or bottomRight position doit valoir topLeft, topRight, bottomLeft ou bottomRight +@msg positions must be between 0 and 100000 pt les positions doivent être comprises entre 0 et 100000 pt +@msg ppi must be a positive number, not {ppi} ppi doit être un nombre positif, pas {ppi} +@msg ppi must be between 1 and 2400 ppi doit être compris entre 1 et 2400 +@msg preserve `{v}` is not transforms|bounds|fileDimensions|fit|fill preserve `{v}` n’est pas transforms|bounds|fileDimensions|fit|fill +@msg preserveShape must be clippingMask|transparency preserveShape doit valoir clippingMask|transparency +@msg preset `{id}`: mobile or density preset `{id}` : mobile ou density +@msg preset must be standard, diffuse, topLeft or right preset doit valoir standard, diffuse, topLeft ou right +@msg preset must be the name of a print preset preset doit être le nom d’un paramètre prédéfini d’impression +@msg previewMode must be default, pixel or overprint previewMode doit valoir default, pixel ou overprint +@msg print settings: {e} réglages d’impression : {e} +@msg procedures nest too deeply les procédures sont imbriquées trop profondément +@msg procedures nested too deeply procédures imbriquées trop profondément +@msg quotes must be {double?, single?} quotes doit être {double?, single?} +@msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k} doit être un guillemet ouvrant et un guillemet fermant, par exemple "“”" +@msg range out of order in character class plage dans le désordre dans une classe de caractères +@msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi doit être compris entre 1 et 2400 (72 écran, 150 moyenne, 300 haute) +@msg rating must be a whole number from 0 to {MAX_RATING} rating doit être un nombre entier compris entre 0 et {MAX_RATING} +@msg rect and {k} contradict each other: give the area or the artboards rect et {k} se contredisent : indiquez la zone ou les plans de travail +@msg rect applies to raster formats, not {_1} rect s’applique aux formats pixellisés, pas à {_1} +@msg rect is [x, y, width, height] in points rect est [x, y, width, height] en points +@msg rect must be [x, y, width, height] rect doit être [x, y, width, height] +@msg rect must be [x, y, width, height] with a positive width and height rect doit être [x, y, width, height] avec une largeur et une hauteur positives +@msg rect needs finite numbers and a positive width and height rect nécessite des nombres finis et une largeur et une hauteur positives +@msg redraw needs id redraw nécessite id +@msg redraw within must be a finite distance of 0 or more within de redraw doit être une distance finie supérieure ou égale à 0 +@msg reduce of an empty array with no initial value reduce d’un tableau vide sans valeur initiale +@msg registration must be 0..8 registration doit être compris entre 0 et 8 +@msg regular expression flag '{_1}' given twice indicateur d’expression régulière '{_1}' fourni deux fois +@msg release a layer or a group libérez un calque ou un groupe +@msg replace keeps the replaced object's place and transform: drop template, at and rect replace conserve la position et la transformation de l’objet remplacé : retirez template, at et rect +@msg replace: select the one object to replace replace : sélectionnez le seul objet à remplacer +@msg resolution must be a number or screen|medium|high resolution doit être un nombre ou screen|medium|high +@msg resolution must be between 1 and 2400 ppi la résolution doit être comprise entre 1 et 2400 ppp +@msg rotation must be a number of degrees rotation doit être un nombre de degrés +@msg rotation must be finite rotation doit être finie +@msg rows and cols must be 1..50 rows et cols doivent être compris entre 1 et 50 +@msg rows and columns must be 1..500 rows et columns doivent être compris entre 1 et 500 +@msg rows of objects whose appearances differ can't be reordered together les lignes d’objets dont l’aspect diffère ne peuvent pas être réordonnées ensemble +@msg sampled text would exceed the canvas (coordinates out of range) le texte prélevé dépasserait la zone de travail (coordonnées hors limites) +@msg save the document first: Package collects a saved document enregistrez d’abord le document : Assemblage rassemble un document enregistré +@msg save the document first: copy puts the file in its folder enregistrez d’abord le document : copy place le fichier dans son dossier +@msg savedPreset: {e} savedPreset : {e} +@msg scale `{s}`: a factor such as 2x, a width (100w), a height (100h) or a resolution (72ppi) échelle `{s}` : un facteur comme 2x, une largeur (100w), une hauteur (100h) ou une résolution (72ppi) +@msg scale must be a number above 0, at most 64 scale doit être un nombre supérieur à 0, d’au plus 64 +@msg scale must be non-zero scale doit être non nul +@msg scope must be selection or all (got {other}) scope doit valoir selection ou all (reçu : {other}) +@msg scribble is too long le gribouillis est trop long +@msg segment does not exist le segment n’existe pas +@msg select a Shaper group sélectionnez un groupe Shaper +@msg select a blend to set easing or color shift sélectionnez un dégradé de formes pour régler l’accélération ou le décalage de couleur +@msg select a compound shape sélectionnez une forme composée +@msg select a graph sélectionnez un graphe +@msg select a group or layer with visible, unlocked members sélectionnez un groupe ou un calque dont les membres sont visibles et déverrouillés +@msg select a layer sélectionnez un calque +@msg select a text object sélectionnez un objet texte +@msg select an SVG filter sélectionnez un filtre SVG +@msg select an image (or an Image Trace group) sélectionnez une image (ou un groupe de vectorisation de l’image) +@msg select an image, or pass id sélectionnez une image, ou passez id +@msg select an object (or pass `id`) sélectionnez un objet (ou passez `id`) +@msg select an object with a 3D effect sélectionnez un objet doté d’un effet 3D +@msg select an object with a 3D effect, or give its id in ids sélectionnez un objet doté d’un effet 3D, ou indiquez son identifiant dans ids +@msg select an object with a freeform gradient sélectionnez un objet doté d’un dégradé de forme libre +@msg select an object with an opacity mask sélectionnez un objet doté d’un masque d’opacité +@msg select area type sélectionnez du texte captif +@msg select area type (text in a frame) sélectionnez du texte captif (texte dans un cadre) +@msg select area type and closed paths (at least one area type object) sélectionnez du texte captif et des tracés fermés (au moins un objet texte captif) +@msg select area type whose first line can fit its frame sélectionnez du texte captif dont la première ligne tient dans son cadre +@msg select artwork to add its colours sélectionnez l’illustration dont ajouter les couleurs +@msg select artwork to make a group of its colours sélectionnez l’illustration dont créer un groupe de couleurs +@msg select artwork to recolour, or give a colour `group` sélectionnez l’illustration dont redéfinir les couleurs, ou indiquez un groupe de couleurs `group` +@msg select exactly two path ends to join sélectionnez exactement deux extrémités de tracé à joindre +@msg select members of a compound shape sélectionnez des membres d’une forme composée +@msg select objects or give ids sélectionnez des objets ou indiquez ids +@msg select objects to align to the guide sélectionnez les objets à aligner sur le repère +@msg select one Intertwine group sélectionnez un seul groupe Entrelacer +@msg select one image or pass id sélectionnez une seule image ou passez id +@msg select one layer, group or object to rename sélectionnez un seul calque, groupe ou objet à renommer +@msg select paths sélectionnez des tracés +@msg select paths or compound paths sélectionnez des tracés ou des tracés transparents +@msg select rows or objects to collect sélectionnez les lignes ou objets à rassembler +@msg select something to export sélectionnez quelque chose à exporter +@msg select something to export (or turn off selectedOnly) sélectionnez quelque chose à exporter (ou désactivez selectedOnly) +@msg select text to redefine the style from sélectionnez le texte à partir duquel redéfinir le style +@msg select the art and, on top of it, the mask object sélectionnez l’illustration et, au-dessus, l’objet de masque +@msg select the art for the design sélectionnez l’illustration du motif +@msg select the art for the pattern tile sélectionnez l’illustration du carreau de motif +@msg select the art to add first sélectionnez d’abord l’illustration à ajouter +@msg select the art to collect (or give its ids) sélectionnez l’illustration à rassembler (ou indiquez ses identifiants) +@msg select the art to weed sélectionnez l’illustration à écheniller +@msg select the content and a path on top sélectionnez le contenu et un tracé au-dessus +@msg select the images to relink, or pass ids sélectionnez les images à lier à nouveau, ou passez ids +@msg select the images, or pass ids sélectionnez les images, ou passez ids +@msg select the linked images or placed documents, or pass ids sélectionnez les images liées ou les documents importés, ou passez ids +@msg select the object to copy from sélectionnez l’objet à partir duquel copier +@msg select the objects (or give their ids) sélectionnez les objets (ou indiquez leurs identifiants) +@msg select the objects to attach to the path sélectionnez les objets à attacher au tracé +@msg select the objects to bind sélectionnez les objets à lier +@msg select two or more objects to intertwine sélectionnez au moins deux objets à entrelacer +@msg select two or more slices to combine sélectionnez au moins deux tranches à combiner +@msg select type on a path sélectionnez du texte curviligne +@msg select type on a path or area type sélectionnez du texte curviligne ou captif +@msg selection `{m}`: one or each selection `{m}` : one ou each +@msg settings is an object of document.exportForScreens params settings est un objet de paramètres de document.exportForScreens +@msg settings must be an object settings doit être un objet +@msg show `{show}`: all, missing, modified or embedded show `{show}` : all, missing, modified ou embedded +@msg show must be true or false show doit valoir true ou false +@msg side is left or right, not `{v}` side vaut left ou right, pas `{v}` +@msg size must be "small", "medium", "large" or a number of points over 0 up to {_1} size doit valoir "small", "medium", "large" ou un nombre de points supérieur à 0 et d’au plus {_1} +@msg size must be positive size doit être positif +@msg sizeMode is "fixed" or "pressure", not `{other}` sizeMode vaut "fixed" ou "pressure", pas `{other}` +@msg sizeMode is "fixed" or "pressure", not {other} sizeMode vaut "fixed" ou "pressure", pas {other} +@msg sizeVariation must be 0 or more sizeVariation doit être supérieur ou égal à 0 +@msg smallCaps must be true or false smallCaps doit valoir true ou false +@msg sort `{x}`: name, kind or status sort `{x}` : name, kind ou status +@msg source paths are too large for Shaper les tracés source sont trop grands pour Shaper +@msg source text transform is collapsed or unrepresentable la transformation du texte source est écrasée ou impossible à représenter +@msg spot, mode and group apply to solid colours only spot, mode et group s’appliquent uniquement aux couleurs unies +@msg status `{s}`: linked, embedded, missing or modified status `{s}` : linked, embedded, missing ou modified +@msg steps must be 1..1000 steps doit être compris entre 1 et 1000 +@msg steps must be 1..{MAX_STEPS} steps doit être compris entre 1 et {MAX_STEPS} +@msg stop {i}: `plates` must be four numbers from 0 to 1 (C, M, Y, K) arrêt {i} : `plates` doit être quatre nombres compris entre 0 et 1 (C, M, Y, K) +@msg stopped before the archive was finished arrêté avant la fin de l’archive +@msg strokeMode must be within|along|across, got {m} strokeMode doit valoir within|along|across, reçu : {m} +@msg strokeOptions must be an object of stroke.set options strokeOptions doit être un objet d’options de stroke.set +@msg strokeWidth must be a positive number of pixels strokeWidth doit être un nombre positif de pixels +@msg subpath {si} is not an open subpath le sous-tracé {si} n’est pas un sous-tracé ouvert +@msg subpaths required when joining the same path subpaths est obligatoire pour joindre un même tracé +@msg swatchConflict must be "merge" or "add", not {v} swatchConflict doit valoir "merge" ou "add", pas {v} +@msg table must be true or false table doit valoir true ou false +@msg takes one name accepte un seul nom +@msg target text transform is collapsed or unrepresentable la transformation du texte cible est écrasée ou impossible à représenter +@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text doit être {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} +@msg text transform is collapsed or unrepresentable la transformation du texte est écrasée ou impossible à représenter +@msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces doit être un nombre entier compris entre 2 et 100 +@msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}` : utilisez "{_1}" ou "{_2}" +@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage : indiquez {path} ou {name, dataBase64} d’un fichier image, ou une texture telle que la donne effect.list +@msg textureImage: {e} textureImage : {e} +@msg that makes more than {MAX_PIECES} slices cela produit plus de {MAX_PIECES} tranches +@msg that makes too many pieces (at most 100000) or dash steps: simplify the dash pattern or make the dashes longer cela produit trop de morceaux (au plus 100000) ou d’étapes de tirets : simplifiez le motif de tirets ou allongez les tirets +@msg that object is not in the overlap cet objet n’est pas dans le chevauchement +@msg the Affinity document has no page with a size le document Affinity n’a aucune page dotée d’une taille +@msg the CMYK image couldn't be written l’image CMJN n’a pas pu être écrite +@msg the Layers panel is not shown le panneau Calques n’est pas affiché +@msg the Layers panel's search, filter or Show Layers Only hides its row la recherche, le filtre ou l’option Afficher les calques uniquement du panneau Calques masque sa ligne +@msg the Objects on Path group is hidden or locked le groupe Objets sur tracé est masqué ou verrouillé +@msg the PDF security settings were saved without their passwords: give openPassword or permissionsPassword again, or security without passwordRequired to export unprotected les réglages de sécurité PDF ont été enregistrés sans leurs mots de passe : indiquez à nouveau openPassword ou permissionsPassword, ou security sans passwordRequired pour exporter sans protection +@msg the RTF file has too many paragraphs or formatting changes to place as type (at most {MAX_PARAGRAPHS} paragraphs and {MAX_RUNS} runs) le fichier RTF a trop de paragraphes ou de changements de mise en forme pour être importé comme texte (au plus {MAX_PARAGRAPHS} paragraphes et {MAX_RUNS} segments) +@msg the RTF file is too large to place as type (at most {_1} MB) le fichier RTF est trop volumineux pour être importé comme texte (au plus {_1} Mo) +@msg the SVG expands to more than {0} nested SVG images le SVG se développe en plus de {0} images SVG imbriquées +@msg the SVG expands to more than {0} objects le SVG se développe en plus de {0} objets +@msg the SVG file is larger than {MAX_IMPORT_BYTES} bytes le fichier SVG dépasse {MAX_IMPORT_BYTES} octets +@msg the SVG has no drawable objects le SVG n’a aucun objet dessinable +@msg the SVGZ file unpacks to more than {_1} MB le fichier SVGZ se décompresse en plus de {_1} Mo +@msg the Word document has more than {MAX_PAGES} pages of properties, too many to place le document Word a plus de {MAX_PAGES} pages de propriétés, trop pour être importé +@msg the Word document has more than {MAX_RUNS} runs of character or paragraph properties, too many to place le document Word a plus de {MAX_RUNS} segments de propriétés de caractère ou de paragraphe, trop pour être importé +@msg the Word document has more than {_1} MB of formatting properties, too many to place le document Word a plus de {_1} Mo de propriétés de mise en forme, trop pour être importé +@msg the Word document has too much text or formatting to place as type (at most {MAX_PARAGRAPHS} paragraphs, {MAX_RUNS} runs and {_1} MB of text) le document Word a trop de texte ou de mise en forme pour être importé comme texte (au plus {MAX_PARAGRAPHS} paragraphes, {MAX_RUNS} segments et {_1} Mo de texte) +@msg the Word document has too much text to place as type (at most {_1} MB) le document Word a trop de texte pour être importé comme texte (au plus {_1} Mo) +@msg the Word document is encrypted or protected with a password; save it without one to place it le document Word est chiffré ou protégé par un mot de passe ; enregistrez-le sans mot de passe pour l’importer +@msg the Word document is too large to place (its {name} stream holds more than {_1} MB) le document Word est trop volumineux pour être importé (son flux {name} contient plus de {_1} Mo) +@msg the Word document was last saved with fast save, which VectorCraft doesn't read; save it again with fast save turned off le document Word a été enregistré en dernier avec l’enregistrement rapide, que VectorCraft ne lit pas ; enregistrez-le à nouveau avec l’enregistrement rapide désactivé +@msg the Word document was saved by Word 6.0 or Word 95, which VectorCraft doesn't read; save it as a Word 97-2003 document le document Word a été enregistré par Word 6.0 ou Word 95, que VectorCraft ne lit pas ; enregistrez-le en tant que document Word 97-2003 +@msg the Word document's text is made of more than {MAX_PIECES} pieces, too many to place le texte du document Word se compose de plus de {MAX_PIECES} morceaux, trop pour être importé +@msg the XML operation needs an XML or XMLList value l’opération XML nécessite une valeur XML ou XMLList +@msg the XPath expression does not evaluate to a node-set l’expression XPath ne donne pas un ensemble de nœuds +@msg the XPath expression ends early l’expression XPath se termine trop tôt +@msg the XPath expression has an unmatched ) l’expression XPath a une ) sans correspondance +@msg the XPath expression has an unmatched ] l’expression XPath a un ] sans correspondance +@msg the XPath expression has an unmatched closing bracket l’expression XPath a un crochet fermant sans correspondance +@msg the XPath expression selects a namespace node, which is not an XML value l’expression XPath sélectionne un nœud d’espace de noms, qui n’est pas une valeur XML +@msg the XPath expression selects the root node, which is not an XML value l’expression XPath sélectionne le nœud racine, qui n’est pas une valeur XML +@msg the XPath function {name} needs a node-set la fonction XPath {name} nécessite un ensemble de nœuds +@msg the XPath function {name} takes the wrong number of arguments la fonction XPath {name} reçoit un nombre d’arguments incorrect +@msg the XPath name functions need a node-set les fonctions de nom XPath nécessitent un ensemble de nœuds +@msg the XPath prefix {shown} is not bound to a namespace le préfixe XPath {shown} n’est lié à aucun espace de noms +@msg the XPath variable ${shown} is not bound la variable XPath ${shown} n’est pas liée +@msg the action set ids are not a list les identifiants des ensembles d’actions ne sont pas une liste +@msg the active paint is not a gradient la peinture active n’est pas un dégradé +@msg the argument list is not an object la liste d’arguments n’est pas un objet +@msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size les plans de travail ne tiennent pas dans la zone de travail : réduisez leur nombre, l’espacement ou la taille +@msg the artwork is too large for EPS: what follows 256 MB of PostScript was left out l’illustration est trop volumineuse pour l’EPS : ce qui suit 256 Mo de PostScript a été omis +@msg the bitmaps hold more pixels than one file may les images bitmap contiennent plus de pixels qu’un fichier ne peut en contenir +@msg the character's size can't be measured la taille du caractère ne peut pas être mesurée +@msg the code runs past its last instruction le code s’exécute au-delà de sa dernière instruction +@msg the compound shape is too complex to expand la forme composée est trop complexe pour être décomposée +@msg the container of the listed objects is gone le conteneur des objets listés a disparu +@msg the copy `{user_id}` can't be read as a library la copie `{user_id}` ne peut pas être lue comme une bibliothèque +@msg the copy would leave the canvas la copie sortirait de la zone de travail +@msg the curve tolerance must be from 0.01 to 10 points la tolérance de courbe doit être comprise entre 0.01 et 10 points +@msg the custom dictionary couldn't be saved to {_1}: {e} le dictionnaire personnalisé n’a pas pu être enregistré dans {_1} : {e} +@msg the custom dictionary {_1} can't be read ({why}), so it is left as it is le dictionnaire personnalisé {_1} ne peut pas être lu ({why}), il est donc laissé tel quel +@msg the cut cannot be made on this art: {e} la coupe ne peut pas être réalisée sur cette illustration : {e} +@msg the data isn't an EMF or WMF picture les données ne sont pas une image EMF ou WMF +@msg the data isn't an EPS or PostScript picture les données ne sont pas une image EPS ou PostScript +@msg the deferred paste is no longer available le collage différé n’est plus disponible +@msg the design is too big to draw at every data point of this graph le motif est trop grand pour être dessiné à chaque point de données de ce graphe +@msg the design is too big to draw in every column of this graph le motif est trop grand pour être dessiné dans chaque colonne de ce graphe +@msg the dialog it was opened over is no longer open la boîte de dialogue sur laquelle il a été ouvert n’est plus ouverte +@msg the dictionary stack overflowed la pile des dictionnaires a débordé +@msg the document already has an SVG filter named {name} le document a déjà un filtre SVG nommé {name} +@msg the document has another SVG filter named {name}: use svgFilter.apply, or svgFilter.define with `replace` to edit it le document a un autre filtre SVG nommé {name} : utilisez svgFilter.apply, ou svgFilter.define avec `replace` pour le modifier +@msg the document has no SVG filter named {name} le document n’a aucun filtre SVG nommé {name} +@msg the document has no SVG filter named {r} le document n’a aucun filtre SVG nommé {r} +@msg the document has no color swatches le document n’a aucune nuance de couleur +@msg the document's swatches hold {_1} colors; the document reduction takes at most 255 les nuances du document contiennent {_1} couleurs ; la réduction au document en accepte au plus 255 +@msg the editing data's hash has no place l’empreinte des données d’édition n’a pas d’emplacement +@msg the entities the document declares expand to too much text les entités déclarées par le document se développent en trop de texte +@msg the envelope's content has no bounds le contenu de l’enveloppe n’a pas de limites +@msg the envelope's mesh is malformed le filet de l’enveloppe est mal formé +@msg the file holds no `variableSets` element le fichier ne contient aucun élément `variableSets` +@msg the file is larger than {_1} MB le fichier dépasse {_1} Mo +@msg the file is too large le fichier est trop volumineux +@msg the file isn't valid SVG: {e} le fichier n’est pas un SVG valide : {e} +@msg the file names no plate le fichier ne désigne aucune plaque +@msg the file was updated or encrypted already le fichier a déjà été mis à jour ou chiffré +@msg the first character of a line has no character before it to kern: it moves only up and down (dy) le premier caractère d’une ligne n’a pas de caractère avant lui avec lequel créer un crénage : il se déplace uniquement vers le haut et le bas (dy) +@msg the font {_1} is not available la police {_1} n’est pas disponible +@msg the format has no file extension le format n’a pas d’extension de fichier +@msg the function's prototype is not an object le prototype de la fonction n’est pas un objet +@msg the graphic can't be read: {e} le graphique ne peut pas être lu : {e} +@msg the graphic is empty le graphique est vide +@msg the graphic's data is damaged les données du graphique sont endommagées +@msg the graphic's document has no artboard le document du graphique n’a pas de plan de travail +@msg the guide is hidden or locked le repère est masqué ou verrouillé +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them l’en-tête `{cell}` de `{name}` serait relu comme la variable `{other}` : renommez l’une des deux +@msg the image `{path}` isn't followed: {r} l’image `{path}` n’est pas suivie : {r} +@msg the image has no embedded pixels l’image n’a pas de pixels incorporés +@msg the image is empty l’image est vide +@msg the image is fully transparent l’image est entièrement transparente +@msg the image is not on an artboard; pass rect l’image n’est pas sur un plan de travail ; passez rect +@msg the image's pixels are missing les pixels de l’image sont manquants +@msg the image's pixels aren't in the document les pixels de l’image ne sont pas dans le document +@msg the image's pixels can't be read: {e} les pixels de l’image ne peuvent pas être lus : {e} +@msg the image's transparency doesn't fit it la transparence de l’image ne lui correspond pas +@msg the job would print more than {MAX_PAGES} pages la tâche imprimerait plus de {MAX_PAGES} pages +@msg the job would print more than {_1} pages la tâche imprimerait plus de {_1} pages +@msg the layers hold no art to mask les calques ne contiennent aucune illustration à masquer +@msg the layout moved la disposition a changé +@msg the library has a group `{name}` already la bibliothèque a déjà un groupe `{name}` +@msg the library has no group `{name}` la bibliothèque n’a pas de groupe `{name}` +@msg the library has no item `{item}` la bibliothèque n’a pas d’élément `{item}` +@msg the library has no item `{other}` la bibliothèque n’a pas d’élément `{other}` +@msg the library holds {MAX_GROUPS} groups already la bibliothèque contient déjà {MAX_GROUPS} groupes +@msg the library holds {MAX_ITEMS} items of this kind already la bibliothèque contient déjà {MAX_ITEMS} éléments de ce type +@msg the library's file is outside the read roots le fichier de la bibliothèque est en dehors des racines de lecture +@msg the method needs an XML value la méthode nécessite une valeur XML +@msg the name is empty le nom est vide +@msg the object has no fill, stroke or effect l’objet n’a ni fond, ni contour, ni effet +@msg the object has no graphic style (pass `name`) l’objet n’a pas de style graphique (passez `name`) +@msg the objects don't match the plan les objets ne correspondent pas au plan +@msg the open and permissions passwords must differ les mots de passe d’ouverture et d’autorisations doivent être différents +@msg the operand stack overflowed la pile des opérandes a débordé +@msg the page has no area la page n’a pas de surface +@msg the page's type in an unread object's box isn't in its page art le texte de la page dans le cadre d’un objet non lu n’est pas dans l’illustration de sa page +@msg the paint behind the proxy is not a gradient la peinture derrière l’échantillon n’est pas un dégradé +@msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) la peinture n’est pas un dégradé de forme libre (appliquez-en un avec paint.editGradient {kind}) +@msg the parameters or body do not form one function les paramètres ou le corps ne forment pas une seule fonction +@msg the parent must be a layer or sublayer le parent doit être un calque ou un sous-calque +@msg the pasted SVG filter {name} draws differently from the document's filter of that name, and no free name fits it le filtre SVG collé {name} dessine autrement que le filtre du document qui porte ce nom, et aucun nom libre ne lui convient +@msg the path can't be extended le tracé ne peut pas être prolongé +@msg the path can't be inside one of the objects to attach le tracé ne peut pas être à l’intérieur de l’un des objets à attacher +@msg the path has no segments to measure le tracé n’a aucun segment à mesurer +@msg the path is empty le tracé est vide +@msg the path is too short to shorten that much le tracé est trop court pour être raccourci autant +@msg the pen table holds more than 255 pens la table des plumes contient plus de 255 plumes +@msg the picture has no objects l’image n’a aucun objet +@msg the plates can't be kept les plaques ne peuvent pas être conservées +@msg the position table does not match the instructions la table des positions ne correspond pas aux instructions +@msg the program runs too long le programme s’exécute trop longtemps +@msg the program uses too much memory le programme utilise trop de mémoire +@msg the prompt's text is longer than {MAX_PROMPT_BYTES} bytes le texte de l’invite dépasse {MAX_PROMPT_BYTES} octets +@msg the radix must be between 2 and 36 la base doit être comprise entre 2 et 36 +@msg the rectangle must have a width and a height le rectangle doit avoir une largeur et une hauteur +@msg the rectangle needs a size and must lie on the canvas le rectangle nécessite une taille et doit se trouver dans la zone de travail +@msg the right side of 'in' is not an object le côté droit de 'in' n’est pas un objet +@msg the right side of 'instanceof' is not a function le côté droit de 'instanceof' n’est pas une fonction +@msg the selected art has no width l’illustration sélectionnée n’a pas de largeur +@msg the selected art is nested more than {MAX_DEPTH} levels deep l’illustration sélectionnée est imbriquée sur plus de {MAX_DEPTH} niveaux +@msg the selected art is too large to measure l’illustration sélectionnée est trop grande pour être mesurée +@msg the selection draws nothing la sélection ne dessine rien +@msg the selection has no area la sélection n’a pas de surface +@msg the selection has no art to export la sélection ne contient aucune illustration à exporter +@msg the selection has no bounds la sélection n’a pas de limites +@msg the selection has no graphic style la sélection n’a pas de style graphique +@msg the selection has no outlines to weed around la sélection n’a pas de contours autour desquels écheniller +@msg the slice would leave the canvas la tranche sortirait de la zone de travail +@msg the spot colour couldn't be added le ton direct n’a pas pu être ajouté +@msg the subpath has no ends to extend (it is closed or a single point) le sous-tracé n’a pas d’extrémités à prolonger (il est fermé ou réduit à un point) +@msg the symbols are nested too deeply to expand their instances les symboles sont imbriqués trop profondément pour décomposer leurs occurrences +@msg the text file is too large to place as type (at most {_1} MB) le fichier texte est trop volumineux pour être importé comme texte (au plus {_1} Mo) +@msg the text is empty le texte est vide +@msg the text is over {_1} MB le texte dépasse {_1} Mo +@msg the top object must be a path l’objet du dessus doit être un tracé +@msg the trace was cancelled la vectorisation a été annulée +@msg the trailer has no size le trailer n’a pas de taille +@msg the type object is flattened to nothing l’objet texte est aplati à néant +@msg the value bind was called on is not a function la valeur sur laquelle bind a été appelé n’est pas une fonction +@msg the value is not a constructor la valeur n’est pas un constructeur +@msg the value is not a function la valeur n’est pas une fonction +@msg the value is not a valid XML name la valeur n’est pas un nom XML valide +@msg the value is not an XML attribute name la valeur n’est pas un nom d’attribut XML +@msg the value is not an XML name la valeur n’est pas un nom XML +@msg the value of axis `{tag}` must be a number or null la valeur de l’axe `{tag}` doit être un nombre ou null +@msg the variable library declares more than {MAX_LIBRARY_DATASETS} data sets la bibliothèque de variables déclare plus de {MAX_LIBRARY_DATASETS} jeux de données +@msg the variable library declares more than {MAX_LIBRARY_ENTITIES} entities la bibliothèque de variables déclare plus de {MAX_LIBRARY_ENTITIES} entités +@msg the variable library declares more than {MAX_LIBRARY_VARIABLES} variables la bibliothèque de variables déclare plus de {MAX_LIBRARY_VARIABLES} variables +@msg the variable library declares no variables la bibliothèque de variables ne déclare aucune variable +@msg the variable library is larger than {MAX_LIBRARY_BYTES} bytes la bibliothèque de variables dépasse {MAX_LIBRARY_BYTES} octets +@msg the variable library is not UTF-8 la bibliothèque de variables n’est pas en UTF-8 +@msg the variable library is not well-formed XML: {e} la bibliothèque de variables n’est pas du XML bien formé : {e} +@msg the variable library nests elements more than {MAX_LIBRARY_NESTING} deep la bibliothèque de variables imbrique des éléments sur plus de {MAX_LIBRARY_NESTING} niveaux +@msg the variable library's document type declaration holds something other than entities of plain text la déclaration de type de document de la bibliothèque de variables contient autre chose que des entités de texte brut +@msg the variable library's entities expand to more than {MAX_LIBRARY_BYTES} bytes les entités de la bibliothèque de variables se développent en plus de {MAX_LIBRARY_BYTES} octets +@msg the weeding lines cross the art's outlines too many times to measure; use fewer lines les lignes d’échenillage croisent les contours de l’illustration trop de fois pour être mesurées ; utilisez moins de lignes +@msg the weeding lines pass too close to too many outline segments to measure; use fewer lines or a smaller gap les lignes d’échenillage passent trop près de trop de segments de contour pour être mesurées ; utilisez moins de lignes ou un écart plus petit +@msg the weeding lines would be more than {max_pieces} pieces les lignes d’échenillage feraient plus de {max_pieces} morceaux +@msg the window has no dock la fenêtre n’a pas de zone d’ancrage +@msg the written PDF has no catalog le PDF écrit n’a pas de catalogue +@msg the written PDF has no cross-reference table le PDF écrit n’a pas de table de références croisées +@msg the written PDF's metadata can't be edited les métadonnées du PDF écrit ne peuvent pas être modifiées +@msg the {_1} plate lies outside the file la plaque {_1} se trouve en dehors du fichier +@msg there are no colour swatches to draw il n’y a aucune nuance de couleur à dessiner +@msg there is already a design named `{name}` il existe déjà un motif nommé `{name}` +@msg there is already a design named `{to}` il existe déjà un motif nommé `{to}` +@msg there is already a toolbar named `{name}` il existe déjà une barre d’outils nommée `{name}` +@msg there is already a toolbar named `{to}` il existe déjà une barre d’outils nommée `{to}` +@msg there is no library: create one first il n’y a aucune bibliothèque : créez-en d’abord une +@msg these paths are too degenerate for Shaper ces tracés sont trop dégénérés pour Shaper +@msg this is a binary DXF file, which can't be read: save it from the CAD app as an ASCII DXF and open that ceci est un fichier DXF binaire, qui ne peut pas être lu : enregistrez-le depuis l’application de CAO en DXF ASCII et ouvrez ce dernier +@msg this warp's points can't be edited: use Reset with Mesh first les points de cette déformation ne peuvent pas être modifiés : utilisez d’abord Réinitialiser avec un filet +@msg thumbnail: no page {v} (the {what} has {count}) vignette : aucune page {v} (le {what} en compte {count}) +@msg tileRange of {what}: {e} tileRange de {what} : {e} +@msg title can't be empty title ne peut pas être vide +@msg to (the new name) is required to (le nouveau nom) est obligatoire +@msg to must be fill or stroke to doit valoir fill ou stroke +@msg to must be smooth or corner to doit valoir smooth ou corner +@msg toExponential() digits must be between 0 and 20 les chiffres de toExponential() doivent être compris entre 0 et 20 +@msg toFixed() digits must be between 0 and 20 les chiffres de toFixed() doivent être compris entre 0 et 20 +@msg toISOString is not a function toISOString n’est pas une fonction +@msg toPrecision() argument must be between 1 and 21 l’argument de toPrecision() doit être compris entre 1 et 21 +@msg toSource: a getter cannot be written as source toSource : un getter ne peut pas être écrit sous forme de source +@msg toSource: an array with properties besides its elements, a property that is not enumerable or another prototype cannot be written as source toSource : un tableau doté de propriétés autres que ses éléments, d’une propriété non énumérable ou d’un autre prototype ne peut pas être écrit sous forme de source +@msg toSource: an object with a property that is not enumerable, or whose prototype is not Object.prototype, cannot be written as source toSource : un objet doté d’une propriété non énumérable, ou dont le prototype n’est pas Object.prototype, ne peut pas être écrit sous forme de source +@msg toSource: the source is too long toSource : la source est trop longue +@msg toSource: the value contains itself toSource : la valeur se contient elle-même +@msg toSource: the value has too many entries toSource : la valeur a trop d’entrées +@msg toSource: the value is nested too deep toSource : la valeur est imbriquée trop profondément +@msg toString is not a function toString n’est pas une fonction +@msg too large for a zip archive: package to a folder trop volumineux pour une archive zip : assemblez dans un dossier +@msg too many Shaper edits trop de modifications Shaper +@msg too many `points` (at most 100000) trop de `points` (au plus 100000) +@msg too many arguments trop d’arguments +@msg too many characters: at most {MAX_CHARS} trop de caractères : au plus {MAX_CHARS} +@msg too many dots for this size: lower the frequency trop de points pour cette taille : réduisez la linéature +@msg too many filters over one file trop de filtres sur un même fichier +@msg too many overlapping paths for Shaper trop de tracés qui se chevauchent pour Shaper +@msg too many quantifiers trop de quantificateurs +@msg too many saved clips trop de détourages enregistrés +@msg too many saved graphics states trop d’états graphiques enregistrés +@msg toolbar (a toolbar's name) must be a string toolbar (le nom d’une barre d’outils) doit être une chaîne +@msg toolbar name can't be empty le nom de la barre d’outils ne peut pas être vide +@msg transparentImages {v}: "flatten" (the default) or "omit" transparentImages {v} : "flatten" (par défaut) ou "omit" +@msg two saved selections would be named `{_1}` deux sélections enregistrées seraient nommées `{_1}` +@msg type dimension cannot be represented with this text transform la dimension du texte ne peut pas être représentée avec cette transformation de texte +@msg type dimension must be finite la dimension du texte doit être finie +@msg unexpected resources ressources inattendues +@msg unknown CMYK profile `{name}` profil CMJN inconnu `{name}` +@msg unknown File Info field `{k}` champ Informations sur le fichier inconnu `{k}` +@msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; prefix - to turn off; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take an alternate's number as `tag=N` with N from 0 to {_1}, as `salt=2`) fonctionnalité OpenType inconnue `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt ; préfixe - pour désactiver ; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom et aalt acceptent un numéro de variante sous la forme `tag=N` avec N de 0 à {_1}, comme `salt=2`) +@msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) fonctionnalité OpenType inconnue `{t}` dans featureChanges (les balises qu’accepte `features`) +@msg unknown PDF preset `{name}` (presets: {_1}) paramètre prédéfini PDF inconnu `{name}` (paramètres prédéfinis : {_1}) +@msg unknown Warp style style de déformation inconnu +@msg unknown alignToPath `{a}` alignToPath inconnu `{a}` +@msg unknown arrowhead {v} pointe de flèche inconnue {v} +@msg unknown artboardLayout key `{k}` (layout, columns, spacing, rightToLeft) clé artboardLayout inconnue `{k}` (layout, columns, spacing, rightToLeft) +@msg unknown attribute `{attribute}` attribut inconnu `{attribute}` +@msg unknown attribute `{k}` attribut inconnu `{k}` +@msg unknown axis `{other}` (vertical|horizontal|free) axe inconnu `{other}` (vertical|horizontal|free) +@msg unknown blend mode `{b}` mode de fusion inconnu `{b}` +@msg unknown blend mode {b} mode de fusion inconnu {b} +@msg unknown brush type `{o}` type de forme inconnu `{o}` +@msg unknown category `{c}` catégorie inconnue `{c}` +@msg unknown category `{c}` ({_1}) catégorie inconnue `{c}` ({_1}) +@msg unknown character `{c}` caractère inconnu `{c}` +@msg unknown character style number field champ numérique de style de caractère inconnu +@msg unknown dither `{d}` (diffusion, pattern, noise or none) tramage inconnu `{d}` (diffusion, pattern, noise ou none) +@msg unknown effect `{e}` effet inconnu `{e}` +@msg unknown end {e} extrémité inconnue {e} +@msg unknown flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution or a saved one: see flattener.presets.list) flattenerPreset inconnu `{name}` (High Resolution, Medium Resolution, Low Resolution ou un paramètre enregistré : voir flattener.presets.list) +@msg unknown format `{f}` (vcswatches, gpl, ase or css) format inconnu `{f}` (vcswatches, gpl, ase ou css) +@msg unknown from {f} from inconnu {f} +@msg unknown graph type `{t}` type de graphe inconnu `{t}` +@msg unknown grid colours `{name}` (one of {_1}) couleurs de grille inconnues `{name}` (l’une de ces valeurs : {_1}) +@msg unknown gridType `{t}` gridType inconnu `{t}` +@msg unknown highlight `{v}` mise en surbrillance inconnue `{v}` +@msg unknown intent `{i}` mode de rendu inconnu `{i}` +@msg unknown issue kind {id} type de problème inconnu {id} +@msg unknown issue kind {v} type de problème inconnu {v} +@msg unknown knockout state {k} état de masquage inconnu {k} +@msg unknown language `{language}` (one of {_1}) langue inconnue `{language}` (l’une de ces valeurs : {_1}) +@msg unknown language `{l}` (one of {_1}) langue inconnue `{l}` (l’une de ces valeurs : {_1}) +@msg unknown method `{m}` ({_1}) méthode inconnue `{m}` ({_1}) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) mode inconnu `{other}` (gray, rgb, hsb, lab, cmyk ou web) +@msg unknown mode `{other}` (mono|cmyk) mode inconnu `{other}` (mono|cmyk) +@msg unknown mode `{other}` (rgb|cmyk|gray|global) mode inconnu `{other}` (rgb|cmyk|gray|global) +@msg unknown mode `{other}` (set, add, subtract) mode inconnu `{other}` (set, add, subtract) +@msg unknown mode `{o}` mode inconnu `{o}` +@msg unknown mode {m} mode inconnu {m} +@msg unknown model `{other}` modèle inconnu `{other}` +@msg unknown model `{other}` (keep, new or document) modèle inconnu `{other}` (keep, new ou document) +@msg unknown op {o} op inconnu {o} +@msg unknown order `{o}`: toggle, front, forward, backward or back ordre inconnu `{o}` : toggle, front, forward, backward ou back +@msg unknown overprints `{v}` (preserve, simulate or discard) surimpressions inconnues `{v}` (preserve, simulate ou discard) +@msg unknown panel panneau inconnu +@msg unknown panel `{panel}` panneau inconnu `{panel}` +@msg unknown parameter `{key}` paramètre inconnu `{key}` +@msg unknown parameter `{within}settings.{format}`; {why} paramètre inconnu `{within}settings.{format}` ; {why} +@msg unknown parameter `{within}{key}`; {why} paramètre inconnu `{within}{key}` ; {why} +@msg unknown pieLegend `{v}` (none, standard or wedges) pieLegend inconnu `{v}` (none, standard ou wedges) +@msg unknown piePosition `{v}` (even, ratio or stacked) piePosition inconnu `{v}` (even, ratio ou stacked) +@msg unknown pieSort `{v}` (none, all or first) pieSort inconnu `{v}` (none, all ou first) +@msg unknown plate `{n}` plaque inconnue `{n}` +@msg unknown preference `{k}` préférence inconnue `{k}` +@msg unknown profile {id} (see stroke.widthProfile.list) profil inconnu {id} (voir stroke.widthProfile.list) +@msg unknown proof target `{t}` cible d’épreuve inconnue `{t}` +@msg unknown quotes key `{k}` (double, single) clé de guillemets inconnue `{k}` (double, single) +@msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) réduction inconnue `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform ou document) +@msg unknown resolution `{v}` résolution inconnue `{v}` +@msg unknown rule `{rule}` ({_1}) règle inconnue `{rule}` ({_1}) +@msg unknown rule `{r}` (see color.harmony) règle inconnue `{r}` (voir color.harmony) +@msg unknown setting `{k}` réglage inconnu `{k}` +@msg unknown shape `{v}` (circle|ellipse|square|diamond|line) forme inconnue `{v}` (circle|ellipse|square|diamond|line) +@msg unknown spacing `{o}` (smooth|steps|distance) espacement inconnu `{o}` (smooth|steps|distance) +@msg unknown tileType `{t}` ({_1}) tileType inconnu `{t}` ({_1}) +@msg unknown units unités inconnues +@msg unknown units `{u}` unités inconnues `{u}` +@msg unknown value axis `{v}` (left, right or both) axe des valeurs inconnu `{v}` (left, right ou both) +@msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) variation inconnue `{v}` (tintsShades|warmCool|vividMuted) +@msg unknown warp style `{s}` style de déformation inconnu `{s}` +@msg unknown {key} `{v}` (none, short or full) {key} inconnu `{v}` (none, short ou full) +@msg unknown {key} profile `{n}` profil {key} inconnu `{n}` +@msg unknown {k} key `{key}` (size, position) clé {k} inconnue `{key}` (size, position) +@msg unmatched ')' ')' sans correspondance +@msg unreadable object objet illisible +@msg unsafe destination file name nom de fichier de destination non sûr +@msg unterminated character class classe de caractères non terminée +@msg unterminated group groupe non terminé +@msg use paths or compound paths utilisez des tracés ou des tracés transparents +@msg useArtboards must be true or false, not {v} useArtboards doit valoir true ou false, pas {v} +@msg value for `{var}` must match its variable kind la valeur de `{var}` doit correspondre au type de sa variable +@msg variable `{_1}` is already defined la variable `{_1}` est déjà définie +@msg variable `{name}` has no `trait` la variable `{name}` n’a pas de `trait` +@msg variable `{name}` is already defined la variable `{name}` est déjà définie +@msg variable `{name}` is declared twice la variable `{name}` est déclarée deux fois +@msg variable `{to}` already exists la variable `{to}` existe déjà +@msg view is required view est obligatoire +@msg view must be one of {_1} view doit valoir l’une de ces valeurs : {_1} +@msg warpStyle can only edit an applied Warp effect warpStyle ne peut modifier qu’un effet Déformation appliqué +@msg width and height must be more than 0 and at most {limit} width et height doivent être supérieurs à 0 et d’au plus {limit} +@msg width factors must be finite les facteurs de largeur doivent être finis +@msg width must be positive width doit être positif +@msg width out of range largeur hors limites +@msg width/height must be > 0 width/height doivent être > 0 +@msg wordGap and lineGap need area type in the selection wordGap et lineGap nécessitent du texte captif dans la sélection +@msg x and y must be finite numbers x et y doivent être des nombres finis +@msg x and y must be given together x et y doivent être indiqués ensemble +@msg xpath needs its variables as an object xpath nécessite ses variables sous forme d’objet +@msg xpath needs the expression as a string xpath nécessite l’expression sous forme de chaîne +@msg zone needs an anchor: dock beside a panel with anchor, or in a new dock column with side (Start or End) zone nécessite un ancrage : ancrez à côté d’un panneau avec anchor, ou dans une nouvelle colonne d’ancrage avec side (Start ou End) +@msg zoom must be positive zoom doit être positif +@msg {C}: no effect at index {list} {C} : aucun effet à l’indice {list} +@msg {DEFAULT_PRESET} is protected and stays {DEFAULT_PRESET} est protégé et ne peut pas être retiré +@msg {DEFAULT_PRESET} is protected: save the settings under another name {DEFAULT_PRESET} est protégé : enregistrez les réglages sous un autre nom +@msg {GRANT_NOT_REMOVED}, and its settings and cache can't be moved back from {_1} to {_2}: {e} {GRANT_NOT_REMOVED}, et ses réglages et son cache ne peuvent pas être replacés de {_1} vers {_2} : {e} +@msg {LABEL} produced an empty result {LABEL} a produit un résultat vide +@msg {_1} MB of document, at most {_2} MB {_1} Mo de document, au plus {_2} Mo +@msg {_1} MB of images, at most {_2} MB {_1} Mo d’images, au plus {_2} Mo +@msg {_1} bytes of RGBA data for a {width} × {height} image {_1} octets de données RVBA pour une image de {width} × {height} +@msg {_1} can't be read, or changed since it was read: relink or update it first {_1} ne peut pas être lu, ou a changé depuis sa lecture : liez-le à nouveau ou mettez-le d’abord à jour +@msg {_1} can't go into {into} {_1} ne peut pas aller dans {into} +@msg {_1} can't limit printing to low resolution: choose PDF 1.4 or later, or allow high-resolution printing {_1} ne peut pas limiter l’impression à la basse résolution : choisissez PDF 1.4 ou ultérieur, ou autorisez l’impression haute résolution +@msg {_1} files can't be opened yet les fichiers {_1} ne peuvent pas encore être ouverts +@msg {_1} files can't be password-protected: remove the passwords or choose no standard les fichiers {_1} ne peuvent pas être protégés par mot de passe : supprimez les mots de passe ou ne choisissez aucune norme +@msg {_1} files can't be {_2} les fichiers {_1} ne peuvent pas être {_2} +@msg {_1} files can't carry editing data: turn off preserveEditing les fichiers {_1} ne peuvent pas contenir de données d’édition : désactivez preserveEditing +@msg {_1} files can't have PDF layers: turn off createLayers les fichiers {_1} ne peuvent pas avoir de calques PDF : désactivez createLayers +@msg {_1} files need a creation date, and this platform has no clock to give one les fichiers {_1} nécessitent une date de création, et cette plateforme n’a pas d’horloge pour en fournir une +@msg {_1} is not a folder: {e} {_1} n’est pas un dossier : {e} +@msg {_1} isn't a path {_1} n’est pas un tracé +@msg {_1} options: {e} Options {_1} : {e} +@msg {_1} paints nothing to rasterize {_1} ne peint rien à pixelliser +@msg {_1} passwords can have up to {MAX_LEGACY_PASSWORD} ASCII characters (PDF 1.7 and later take any) les mots de passe {_1} peuvent compter jusqu’à {MAX_LEGACY_PASSWORD} caractères ASCII (PDF 1.7 et ultérieur acceptent tous les caractères) +@msg {_1} with linked images or an image map writes several files: use document.export {_1} avec des images liées ou une image réactive écrit plusieurs fichiers : utilisez document.export +@msg {_1} writes one file per artboard here: use document.export, or name one artboard {_1} écrit ici un fichier par plan de travail : utilisez document.export, ou indiquez un seul plan de travail +@msg {_1} × {_2} pixels is too large for {_3} (at most {max} pixels a side): lower the scale {_1} × {_2} pixels est trop grand pour {_3} (au plus {max} pixels de côté) : réduisez l’échelle +@msg {_1}: belongs to another account {_1} : appartient à un autre compte +@msg {_1}: not a folder of its own {_1} : ce n’est pas un dossier distinct +@msg {_1}: not a plain file {_1} : ce n’est pas un fichier ordinaire +@msg {_1}: {_2} and {_3} are in the way {_1} : {_2} et {_3} gênent +@msg {code}: {0} {code} : {0} +@msg {dest}: {e} {dest} : {e} +@msg {dir}: {e} {dir} : {e} +@msg {doc} has no folder {doc} n’a pas de dossier +@msg {file} isn't linked {file} n’est pas lié +@msg {file} names more than one linked JavaScript file {file} désigne plusieurs fichiers JavaScript liés +@msg {folder} is not a package folder {folder} n’est pas un dossier d’assemblage +@msg {folder}: more than {max} files and folders {folder} : plus de {max} fichiers et dossiers +@msg {folder}: {e} {folder} : {e} +@msg {g} is not a Live Paint group {g} n’est pas un groupe de peinture dynamique +@msg {id} is not a slice {id} n’est pas une tranche +@msg {key} must be 0–{MAX_ADD_AROUND} pt {key} doit être compris entre 0 et {MAX_ADD_AROUND} pt +@msg {key} must be [x,y] {key} doit être [x,y] +@msg {key} must be a percentage {min}..100 {key} doit être un pourcentage de {min} à 100 +@msg {key} must be a positive number, not {n} {key} doit être un nombre positif, pas {n} +@msg {key} must be a positive number, not {v} {key} doit être un nombre positif, pas {v} +@msg {key} must be one of {_1} {key} doit valoir l’une de ces valeurs : {_1} +@msg {key} must be {_1}, got {s} {key} doit valoir {_1}, reçu : {s} +@msg {key} must name a floating panel {key} doit désigner un panneau flottant +@msg {key} must name a panel in another group {key} doit désigner un panneau d’un autre groupe +@msg {key} must name a panel that shows {key} doit désigner un panneau affiché +@msg {key} must name a registered panel {key} doit désigner un panneau enregistré +@msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) les fichiers {kind} n’ont pas de transparence, et le fichier aurait {what} : aplatissez-la d’abord (object.flattenTransparency) +@msg {kind} images can't be opened (see document.formats) les images {kind} ne peuvent pas être ouvertes (voir document.formats) +@msg {k} `{v}` is not one of the choices {k} `{v}` ne fait pas partie des choix +@msg {k} has control characters{_1} {k} contient des caractères de contrôle{_1} +@msg {k} is too long (at most {MAX_TEXT} characters) {k} est trop long (au plus {MAX_TEXT} caractères) +@msg {k} must be > 0 {k} doit être > 0 +@msg {k} must be a number (pt) or a length such as "210 mm" {k} doit être un nombre (pt) ou une longueur comme "210 mm" +@msg {k} must be a number from {min} to {max} {k} doit être un nombre compris entre {min} et {max} +@msg {k} must be a number or "auto" {k} doit être un nombre ou "auto" +@msg {k} must be a string {k} doit être une chaîne +@msg {k} must be text {k} doit être du texte +@msg {k} must be true or false {k} doit valoir true ou false +@msg {k} must be {{size?, position?}} {k} doit être {{size?, position?}} +@msg {k}: a custom arrowhead's path needs an area to fill and at most {most} anchors and {most} subpaths, each anchor within {far} head units of its tip {k} : le tracé d’une pointe de flèche personnalisée nécessite une zone à remplir et au plus {most} points d’ancrage et {most} sous-tracés, chaque point d’ancrage à moins de {far} unités de pointe de son extrémité +@msg {k}: bad custom arrowhead path: {e} {k} : tracé de pointe de flèche personnalisée incorrect : {e} +@msg {k}: bad custom arrowhead: {e} {k} : pointe de flèche personnalisée incorrecte : {e} +@msg {k}: can't read `{s}` as a length {k} : impossible de lire `{s}` comme une longueur +@msg {k}: custom must be a name {k} : custom doit être un nom +@msg {label} must be a number at most {max} {label} doit être un nombre d’au plus {max} +@msg {label} must be a number from -1296 to 1296 {label} doit être un nombre compris entre -1296 et 1296 +@msg {label} must be a number from 1 to 10000 {label} doit être un nombre compris entre 1 et 10000 +@msg {name} `{s}`: {ids} {name} `{s}` : {ids} +@msg {name} is built in and can't be deleted {name} est intégré et ne peut pas être supprimé +@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} doit être compris entre {lo} et {hi}{unit} (reçu : {v}) +@msg {name}: CRC or size mismatch {name} : CRC ou taille incohérents +@msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name} : seul l’aperçu incorporé de ce fichier Affinity a pu être lu ; utilisez Fichier › Ouvrir pour l’afficher avec son avertissement, ou exportez en SVG ou PDF depuis Affinity avant de l’importer +@msg {name}: {e} {name} : {e} +@msg {native}; its embedded preview can't be read either ({e}) {native} ; son aperçu incorporé ne peut pas non plus être lu ({e}) +@msg {path}: copy takes a DCS file only when its plates are inside it; relink to it where its plate files are {path} : copy n’accepte un fichier DCS que si ses plaques sont à l’intérieur ; liez-le à nouveau là où se trouvent ses fichiers de plaques +@msg {path}: larger than {_1} MB {path} : dépasse {_1} Mo +@msg {shown} is not an XPath 1.0 function {shown} n’est pas une fonction XPath 1.0 +@msg {std} files are CMYK, and the file would have colours in {_1} les fichiers {std} sont en CMJN, et le fichier aurait des couleurs en {_1} +@msg {std} files embed their fonts, and the file would have one that isn't les fichiers {std} incorporent leurs polices, et le fichier en aurait une qui ne l’est pas +@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway {target} est le fichier à partir duquel ce document a été lu, et sa lecture a omis des éléments ({what}) : l’écraser les ferait perdre définitivement. Écrivez plutôt un autre fichier, ou passez acknowledgeLoss: true pour le remplacer quand même +@msg {ty} brushes need selected art (or params.{k}) les formes {ty} nécessitent une illustration sélectionnée (ou params.{k}) +@msg {v} is not an asset id {v} n’est pas un identifiant de ressource +@msg {v} names no layer or sublayer {v} ne désigne aucun calque ni sous-calque +@msg {what} can't be intertwined {what} ne peut pas être entrelacé +@msg {what} doesn't fit the paper with its bleed and marks {what} ne tient pas sur le papier avec son fond perdu et ses repères +@msg {what} is not a function {what} n’est pas une fonction +@msg {what} would print more than {MAX_COPIES_PER_SHEET} copies on a sheet: scale it up {what} imprimerait plus de {MAX_COPIES_PER_SHEET} exemplaires sur une feuille : agrandissez-le +@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} s’imprimerait sur plus de {MAX_TILES} mosaïques : réduisez-le +@msg {what} {i} out of range {what} {i} hors limites +@msg Alignment must be one of the choices Alignement doit être l’un des choix proposés +@msg Line Gap must be a number Écart entre les lignes doit être un nombre +@msg `at` must be a point [x, y] `at` doit être un point [x, y] +@msg `points` must hold from 2 to 100000 points `points` doit contenir de 2 à 100000 points +@msg `rect` must be [x, y, width, height] `rect` doit être [x, y, width, height] +@msg `tolerance` must be from 0 to 100 pt `tolerance` doit être compris entre 0 et 100 pt +@msg `warichuAlign` must be one of {_1} `warichuAlign` doit valoir l’une de ces valeurs : {_1} +@msg `warichuLines` must be a whole number from {_1} to {_2} `warichuLines` doit être un nombre entier compris entre {_1} et {_2} +@msg bad point {v}: expected [x, y] point incorrect {v} : [x, y] attendu +@msg give exactly one of `at`, `rect` and `points` indiquez exactement un paramètre parmi `at`, `rect` et `points` +@msg the line is too long, or the paths it passes too many, to check la ligne est trop longue, ou elle traverse trop de tracés, pour être vérifiée +@msg the paths are too many or too tangled to find where they cross les tracés sont trop nombreux ou trop enchevêtrés pour trouver où ils se croisent +@msg the rectangle or line reaches too many paths to check le rectangle ou la ligne atteint trop de tracés pour être vérifié +@msg {name} must be a number {name} doit être un nombre Banner Hems and Grommets… Ourlets et œillets de banderole… Banner Hems and Grommets Ourlets et œillets de banderole Hem Ourlet Grommets Œillets Grommet Inset Distance des œillets au bord Diameter Diamètre + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points Les effets 3D exigent des coordonnées finies comprises dans 100 millions de points +@msg 3D effects require one to ten lights Les effets 3D exigent d’une à dix lumières +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Profondeur BMP {_1} : 1, 4, 8, 16, 24 ou 32 bits par pixel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Échec de l’encodage BMP : {width} × {height} pixels ne conviennent ni au format ni au tampon de pixels +@msg GIF encoding failed: the palette image is malformed Échec de l’encodage GIF : l’image à palette est mal formée +@msg GIF encoding failed: {e} Échec de l’encodage GIF : {e} +@msg JPEG colour profile: {e} Profil colorimétrique JPEG : {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Échec de l’encodage JPEG : le tampon de pixels ne correspond pas à la taille de l’image +@msg JPEG encoding failed: {e} Échec de l’encodage JPEG : {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Échec de l’encodage PNG : le tampon de pixels ne correspond pas à la taille de l’image +@msg PNG encoding failed: the palette image is malformed Échec de l’encodage PNG : l’image à palette est mal formée +@msg PNG encoding failed: {e} Échec de l’encodage PNG : {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Échec de l’encodage PNG : {width} × {height} pixels n’est pas une taille d’image valide +@msg PSD colour profile: {e} Profil colorimétrique PSD : {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Échec de l’encodage PSD : le tampon de pixels ne correspond pas à la taille de l’image +@msg Revolve profile contains invalid coordinates Le profil de révolution contient des coordonnées non valides +@msg Revolve profile is too complex Le profil de révolution est trop complexe +@msg Revolve projection is not finite La projection de la révolution n’est pas finie +@msg Revolve requires finite profile coordinates within 100 million points La révolution exige des coordonnées de profil finies comprises dans 100 millions de points +@msg Revolve surface is too complex; reduce Segments or simplify the profile La surface de révolution est trop complexe ; réduisez Segments ou simplifiez le profil +@msg Revolve surface is too complex; simplify the profile La surface de révolution est trop complexe ; simplifiez le profil +@msg Revolve visibility cannot split the projected boundary La visibilité de la révolution ne peut pas diviser le contour projeté +@msg Revolve visibility creates too many fragments La visibilité de la révolution crée trop de fragments +@msg Revolve visibility creates too many vector anchors La visibilité de la révolution crée trop de points d’ancrage vectoriels +@msg Revolve visibility exceeds its geometry work limit La visibilité de la révolution dépasse sa limite de calcul géométrique +@msg Revolve visibility exceeds its spatial index limit La visibilité de la révolution dépasse sa limite d’index spatial +@msg Revolve visibility has too many boundary crossings La visibilité de la révolution compte trop de croisements de contour +@msg Revolve visibility has too many input anchors La visibilité de la révolution compte trop de points d’ancrage en entrée +@msg Revolve visibility requires convex cap sectors La visibilité de la révolution exige des secteurs de fermeture convexes +@msg Revolve visibility requires finite projected faces La visibilité de la révolution exige des faces projetées finies +@msg SVG options: {e} Options SVG : {e} +@msg Save for Web settings: {e} Réglages d’Enregistrer pour le web : {e} +@msg TIFF colour profile: {e} Profil colorimétrique TIFF : {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Échec de l’encodage TIFF : le tampon de pixels ne correspond pas à la taille de l’image +@msg TIFF encoding failed: {e} Échec de l’encodage TIFF : {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Profondeur Targa {_1} : 16, 24 ou 32 bits par pixel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Échec de l’encodage Targa : le tampon de pixels ne correspond pas à la taille de l’image +@msg The 3D projection is not finite La projection 3D n’est pas finie +@msg The 3D shadow is too complex; turn Shadows off or simplify the art L’ombre 3D est trop complexe ; désactivez Ombres ou simplifiez l’illustration +@msg The shape contains invalid coordinates La forme contient des coordonnées non valides +@msg Too many Revolve faces for visibility evaluation Trop de faces de révolution pour évaluer la visibilité +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft lit au plus {ASE_MAX_ENTRIES} couleurs et groupes d’un fichier d’échange de nuances, et cette bibliothèque en contient {entries} +@msg WebP encoding failed: {e} Échec de l’encodage WebP : {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}` : {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` vaut smallThumb, mediumThumb, largeThumb, smallList ou largeList +@msg a line can't run from a point to itself une ligne ne peut pas relier un point à lui-même +@msg a line needs at least two points une ligne nécessite au moins deux points +@msg a number cannot be read un nombre ne peut pas être lu +@msg a swatch exchange block is too long un bloc du fichier d’échange de nuances est trop long +@msg a swatch exchange name is too long un nom du fichier d’échange de nuances est trop long +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels une image de {sw} × {sh} ne peut pas être redimensionnée à {width} × {height} pixels +@msg a {width} × {height} image is too large une image de {width} × {height} est trop grande +@msg a {width} × {height} image: {e} une image de {width} × {height} : {e} +@msg an image could not be written: {e} une image n’a pas pu être écrite : {e} +@msg an image that couldn't be read was left out une image illisible a été omise +@msg can't open “{name}”: {e} impossible d’ouvrir « {name} » : {e} +@msg cannot align zip entries to {align} bytes impossible d’aligner les entrées zip sur {align} octets +@msg cannot open the automation {kind} root `{_1}`: {e} impossible d’ouvrir le dossier racine d’automatisation ({kind}) `{_1}` : {e} +@msg cannot read profile: {0} impossible de lire le profil : {0} +@msg color book version {version} isn't supported (only 1) la version {version} du carnet de couleurs n’est pas prise en charge (seulement 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) les carnets de couleurs dans l’espace colorimétrique {other} ne sont pas pris en charge (seulement RVB, CMJN et Lab) +@msg file name too long to zip: {_1} nom de fichier trop long pour le zip : {_1} +@msg file name too long to zip: {name} nom de fichier trop long pour le zip : {name} +@msg freeform line {i}: {e} ligne libre {i} : {e} +@msg freeform point {i}: {e} point libre {i} : {e} +@msg give `{key}` or `{other}`, not both indiquez `{key}` ou `{other}`, pas les deux +@msg grayscale profiles can't be working spaces yet les profils en niveaux de gris ne peuvent pas encore servir d’espaces de travail +@msg input contains NaN or infinite coordinates l’entrée contient des coordonnées NaN ou infinies +@msg input path could not be closed le tracé d’entrée n’a pas pu être fermé +@msg invalid ICC profile: {0} profil ICC non valide : {0} +@msg invalid scale {scale} échelle non valide {scale} +@msg its localized names take more than {_1} KB ses noms localisés occupent plus de {_1} Ko +@msg its objects are nested too deep ({e}) ses objets sont trop profondément imbriqués ({e}) +@msg its tag table lists the `{_1}` tag more than once sa table de balises répertorie la balise `{_1}` plus d’une fois +@msg not a graphic style library: {e} ce n’est pas une bibliothèque de styles graphiques : {e} +@msg not a swatch library (.vcswatches or .gpl) ce n’est pas une bibliothèque de nuances (.vcswatches ou .gpl) +@msg not a swatch library (format `{_1}`) ce n’est pas une bibliothèque de nuances (format `{_1}`) +@msg not a swatch library: {e} ce n’est pas une bibliothèque de nuances : {e} +@msg not an action set file ({e}) ce n’est pas un fichier de jeu de scripts ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray l’espace colorimétrique {other} du profil n’est pas RVB, CMJN ou Niveaux de gris +@msg regular expression too large expression régulière trop volumineuse +@msg script file is not UTF-8 text: {value} le fichier de script n’est pas du texte UTF-8 : {value} +@msg stop {i}: {e} étape de dégradé {i} : {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) la version {major}.{minor} du fichier d’échange de nuances n’est pas prise en charge (seulement 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors le carnet de couleurs contient plus de {ASE_MAX_ENTRIES} couleurs +@msg the color book is cut short le carnet de couleurs est tronqué +@msg the color book's names take more than {_1} MB les noms du carnet de couleurs occupent plus de {_1} Mo +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution l’image mesurerait {w} × {h} pixels ; les exports en pixels sont limités à {MAX_RASTER_SIDE} pixels par côté et à {_1} mégapixels : réduisez l’échelle ou la résolution +@msg the optimised image can't be read back: {e} l’image optimisée ne peut pas être relue : {e} +@msg the pixel buffer doesn't match the image size le tampon de pixels ne correspond pas à la taille de l’image +@msg the preview: {e} l’aperçu : {e} +@msg the request may not read the New Document profiles folder la requête n’est pas autorisée à lire le dossier des profils de nouveau document +@msg the shapes are too degenerate to combine les formes sont trop dégénérées pour être combinées +@msg the shapes cross themselves and each other too often to combine les formes se croisent elles-mêmes et entre elles trop souvent pour être combinées +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups le fichier d’échange de nuances contient plus de {ASE_MAX_ENTRIES} couleurs et groupes +@msg the swatch exchange file is cut short le fichier d’échange de nuances est tronqué +@msg the {_1} plate can't be read: {e} la plaque {_1} ne peut pas être lue : {e} +@msg too many classes trop de classes +@msg too many groups trop de groupes +@msg too many layers for PSD (at most 32767) trop de calques pour le PSD (32767 au plus) +@msg too many swatch exchange blocks trop de blocs dans le fichier d’échange de nuances +@msg unknown colour profile: {0} profil colorimétrique inconnu : {0} +@msg {_1} clashes with a built-in profile name {_1} entre en conflit avec le nom d’un profil intégré +@msg {_1}: no usable transform to/from sRGB {_1} : aucune transformation utilisable vers ou depuis sRGB +@msg {name} is not a CMYK profile {name} n’est pas un profil CMJN +@msg {name} is not an RGB profile {name} n’est pas un profil RVB +@msg {path}: could not be read {path} : lecture impossible +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pixels, c’est trop grand pour le JPEG (65535 pixels par côté au plus) : réduisez la résolution +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pixels, c’est trop grand pour le Targa (65535 pixels par côté au plus) : réduisez la résolution +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixels, c’est trop grand pour le PSD ({MAX_SIDE} pixels par côté au plus) : réduisez la résolution +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that c’est un dessin DWG, qui ne peut pas être lu : enregistrez-le depuis l’application de CAO au format DXF et ouvrez ce fichier +@msg this binary DXF file is damaged or cut short ce fichier DXF binaire est endommagé ou tronqué +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels, c’est trop grand pour le GIF (65535 pixels par côté au plus) : réduisez la résolution diff --git a/crates/ui-egui/src/i18n/gu.tsv b/crates/ui-egui/src/i18n/gu.tsv new file mode 100644 index 0000000000..716d851655 --- /dev/null +++ b/crates/ui-egui/src/i18n/gu.tsv @@ -0,0 +1,4682 @@ +# Gujarati (gu) catalog. Columns, separated by a TAB: context source translation +# +# Clean-room: written from the plain meaning of the English labels. Loanwords are transliterated +# in Gujarati script where that is how the words are spoken; established Gujarati words are used otherwise. +# Product names, file extensions, keyboard keys, units and placeholders stay as in the English. +# Original 4,286 rows reviewed by a native Gujarati-speaking contributor. +# All 387 later additions reviewed and approved by the contributor on 2026-11-14; 11 wording corrections applied. + — missing — ગુમ + — substituted by {style} — {style} દ્વારા બદલ્યું + — {n} characters from another font — બીજા ફોન્ટમાંથી {n} અક્ષરો + a pin to warp | વાળવા માટે એક પિન | + a point to edit it | તેને સંપાદિત કરવા એક બિંદુ | + a stroke to add a width point | પહોળાઈ બિંદુ ઉમેરવા એક સ્ટ્રોક | + across a selected object to set the gradient direction ગ્રેડિયન્ટ દિશા સેટ કરવા પસંદ કરેલી ઑબ્જેક્ટ પર ખેંચો + across paths to push them along | તેમને આગળ ધકેલવા પાથ પર ખેંચો | + an anchor or path segment to select it | તેને પસંદ કરવા એન્કર અથવા પાથ સેગમેન્ટ | + an object to copy its attributes | તેના ગુણધર્મોની નકલ કરવા ઑબ્જેક્ટ | + an object, then another to blend them | ઑબ્જેક્ટ, પછી તેમને મિશ્ર કરવા બીજી ઑબ્જેક્ટ | + cancels | Double-click the tool for options રદ કરે છે | વિકલ્પો માટે ટૂલ પર ડબલ-ક્લિક કરો + for exact size ચોક્કસ કદ માટે + for exact values ચોક્કસ મૂલ્યો માટે + from center | કેન્દ્રથી | + keeps its proportions) તેના પ્રમાણ જાળવે છે) + near a selected pin to rotate | ફેરવવા પસંદ કરેલી પિનની નજીક | + on the canvas to create one ( એક બનાવવા કેનવાસ પર ( + out from a highlighted edge to place its dimension | તેનું માપ મૂકવા પ્રકાશિત કિનારીથી બહાર | + over paths to roughen their outlines | તેમની રૂપરેખા ખરબચડી કરવા પાથ ઉપર | + over paths, and hold still to keep going | ચાલુ રાખવા સ્થિર રાખો, પાથ ઉપર | + right or left to zoom in or out | ઝૂમ ઇન કે આઉટ કરવા જમણે કે ડાબે | + selects several, or draws one inside an artboard) ઘણા પસંદ કરે છે, અથવા આર્ટબોર્ડની અંદર એક દોરે છે) + the art to add a pin | પિન ઉમેરવા આર્ટ | + the object to duplicate ડુપ્લિકેટ કરવા ઑબ્જેક્ટ + the object to select | પસંદ કરવા ઑબ્જેક્ટ | + to add ઉમેરવા માટે + to add a corner point | કૉર્નર બિંદુ ઉમેરવા | + to add a smooth point | સ્મૂધ બિંદુ ઉમેરવા | + to add smooth points | સ્મૂધ બિંદુઓ ઉમેરવા | + to apply the selection's to it | પસંદગીનું તેના પર લાગુ કરવા | + to blend from it | તેમાંથી મિશ્ર કરવા | + to change one side | એક બાજુ બદલવા | + to close | બંધ કરવા | + to constrain proportions | પ્રમાણ મર્યાદિત કરવા | + to copy | નકલ કરવા | + to create area type | એરિયા ટાઇપ બનાવવા | + to create point type | પોઇન્ટ ટાઇપ બનાવવા | + to draw | દોરવા | + to exit editing સંપાદન બંધ કરવા + to finish સમાપ્ત કરવા + to keep zooming ઝૂમ ચાલુ રાખવા + to move | ખસેડવા | + to move in perspective | પર્સ્પેક્ટિવમાં ખસેડવા | + to pan the view દૃશ્ય પેન કરવા + to remove pins પિન દૂર કરવા + to remove points બિંદુઓ દૂર કરવા + to sample a color રંગનો નમૂનો લેવા + to scale in perspective પર્સ્પેક્ટિવમાં સ્કેલ કરવા + to search every command દરેક આદેશ શોધવા + to select an artboard | આર્ટબોર્ડ પસંદ કરવા | + to select more pins | વધુ પિન પસંદ કરવા | + to select more points | વધુ બિંદુઓ પસંદ કરવા | + to select multiple objects | ઘણી ઑબ્જેક્ટ પસંદ કરવા | + to set spacing and orientation અંતર અને દિશા સેટ કરવા + to set the reference point | સંદર્ભ બિંદુ સેટ કરવા | + to size the brush ( બ્રશનું કદ સેટ કરવા ( + to toggle corner | કૉર્નર ટૉગલ કરવા | + to transform | રૂપાંતર કરવા | + to zoom in | ઝૂમ ઇન કરવા | + to zoom into an area વિસ્તાર પર ઝૂમ ઇન કરવા + to zoom out | ઝૂમ આઉટ કરવા | + two points, then move and click to place an aligned, horizontal or vertical dimension | બે બિંદુઓ, પછી સંરેખિત, આડું કે ઊભું માપ મૂકવા ખસેડો અને ક્લિક કરો | + while dragging to move perpendicular to the plane | ખેંચતી વખતે સમતલને લંબરૂપે ખસેડવા | + "In" Control Points "In" કંટ્રોલ પોઇન્ટ્સ + "Out" Control Points "Out" કંટ્રોલ પોઇન્ટ્સ + % of all commits બધા કમિટ્સના % + + Add Scale + સ્કેલ ઉમેરો + 0.2 (quality) to 100 (speed) 0.2 (ગુણવત્તા) થી 100 (ઝડપ) + 1 Color Job… 1 રંગ જૉબ… + 1 {unit} on the artboard stands for {real} {unit} in the scene. આર્ટબોર્ડ પરનો 1 {unit} દ્રશ્યમાં {real} {unit} દર્શાવે છે. + 2 Color Job… 2 રંગ જૉબ… + 3 Color Job… 3 રંગ જૉબ… + 30° Angles 30° ખૂણા + 3D (Classic) 3D (ક્લાસિક) + 3D Box 3D બૉક્સ + 3D Box Tool 3D બૉક્સ ટૂલ + 3D Export Format 3D નિકાસ ફોર્મેટ + 3D Lighting Preset 3D લાઇટિંગ પ્રીસેટ + 3D Ribbon 3D રિબન + 3D and Materials 3D અને મટીરિયલ્સ + 45° Angles 45° ખૂણા + 60° Angles 60° ખૂણા + 90° & 45° & 30° Angles 90° અને 45° અને 30° ખૂણા + 90° & 45° Angles 90° અને 45° ખૂણા + 90° Angles 90° ખૂણા + : : + < 1 sec < 1 સેક + <અપારદર્શકતા માસ્ક> + A File… એક ફાઇલ… + A Script Is Running સ્ક્રિપ્ટ ચાલી રહી છે + A file dialog is open: choose there first ફાઇલ સંવાદ ખુલ્લો છે: પહેલાં ત્યાં પસંદ કરો + A later row takes this shortcut પછીની પંક્તિ આ શૉર્ટકટ લે છે + A legacy .ai file holds one artboard: each artboard you check is saved as a separate file. જૂની .ai ફાઇલમાં એક આર્ટબોર્ડ છે: તમે ચકાસો તે દરેક આર્ટબોર્ડ અલગ ફાઇલ તરીકે સાચવાય છે. + A lower value follows the stroke closely; a higher one gives fewer points and smoother curves. ઓછું મૂલ્ય સ્ટ્રોકને નજીકથી અનુસરે છે; વધુ મૂલ્ય ઓછા બિંદુઓ અને સ્મૂધ વક્રો આપે છે. + A new preset starting from the selected one પસંદ કરેલાથી શરૂ થતો નવો પ્રીસેટ + A saved copy of the selected preset પસંદ કરેલા પ્રીસેટની સાચવેલી નકલ + A script can change the open documents and can write files through the commands it runs. Run only scripts you trust. સ્ક્રિપ્ટ ખુલ્લા દસ્તાવેજો બદલી શકે છે અને તે ચલાવે છે તે આદેશો દ્વારા ફાઇલો લખી શકે છે. ફક્ત વિશ્વસનીય સ્ક્રિપ્ટ ચલાવો. + About વિશે + About VectorCraft VectorCraft વિશે + Absolute સંપૂર્ણ + Absolute Position સંપૂર્ણ સ્થાન + Accelerated પ્રવેગિત + Accent Color ઍક્સેન્ટ રંગ + Accented Edges… ઍક્સેન્ટેડ કિનારીઓ… + Accurate ચોક્કસ + Action Options ક્રિયા વિકલ્પો + Actions ક્રિયાઓ + Activate Document દસ્તાવેજ સક્રિય કરો + Activate Panel પેનલ સક્રિય કરો + Active Perspective Plane સક્રિય પર્સ્પેક્ટિવ સમતલ + Actual Size વાસ્તવિક કદ + Add ઉમેરો + Add Anchor (Pen) એન્કર ઉમેરો (પેન) + Add Anchor Point એન્કર બિંદુ ઉમેરો + Add Anchor Point Tool એન્કર બિંદુ ઉમેરો ટૂલ + Add Anchor Points એન્કર બિંદુઓ ઉમેરો + Add Anchors… એન્કર ઉમેરો… + Add Content કન્ટેન્ટ ઉમેરો + Add Effect ઇફેક્ટ ઉમેરો + Add Event ઇવેન્ટ ઉમેરો + Add Font Files ફોન્ટ ફાઇલો ઉમેરો + Add Fonts ફોન્ટ ઉમેરો + Add Freeform Line ફ્રીફોર્મ લાઇન ઉમેરો + Add Freeform Point ફ્રીફોર્મ બિંદુ ઉમેરો + Add Guide ગાઇડ ઉમેરો + Add Guides ગાઇડ ઉમેરો + Add JavaScript File JavaScript ફાઇલ ઉમેરો + Add Light લાઇટ ઉમેરો + Add Mesh Line મેશ લાઇન ઉમેરો + Add New નવું ઉમેરો + Add New Effect નવી ઇફેક્ટ ઉમેરો + Add New Fill નવું ફિલ ઉમેરો + Add New Stroke નવો સ્ટ્રોક ઉમેરો + Add Points બિંદુઓ ઉમેરો + Add Points at Crossings છેદ પર બિંદુઓ ઉમેરો + Add Points to Segments સેગમેન્ટમાં બિંદુઓ ઉમેરો + Add Points to Segments… સેગમેન્ટમાં બિંદુઓ ઉમેરો… + Add Selected Artwork (Alt: as one asset) પસંદ કરેલી આર્ટવર્ક ઉમેરો (Alt: એક સંપત્તિ તરીકે) + Add Selected Artwork as Multiple Assets પસંદ કરેલી આર્ટવર્ક ઘણી સંપત્તિ તરીકે ઉમેરો + Add Selected Artwork as One Asset પસંદ કરેલી આર્ટવર્ક એક સંપત્તિ તરીકે ઉમેરો + Add Spine Point સ્પાઇન બિંદુ ઉમેરો + Add Used Colors વપરાયેલા રંગ ઉમેરો + Add as Effect ઇફેક્ટ તરીકે ઉમેરો + Add space to fit ફિટ કરવા જગ્યા ઉમેરો + Add to Brushes બ્રશમાં ઉમેરો + Add to Custom Dictionary કસ્ટમ ડિક્શનરીમાં ઉમેરો + Add to Dictionary ડિક્શનરીમાં ઉમેરો + Add to Graphic Styles ગ્રાફિક સ્ટાઇલમાં ઉમેરો + Add to Library લાઇબ્રેરીમાં ઉમેરો + Add to Profiles પ્રોફાઇલમાં ઉમેરો + Add to Profiles… પ્રોફાઇલમાં ઉમેરો… + Add to Selection પસંદગીમાં ઉમેરો + Add to Swatches સ્વેચમાં ઉમેરો + Add to Symbols સિમ્બોલમાં ઉમેરો + Add to the Current Shortcuts વર્તમાન શૉર્ટકટમાં ઉમેરો + Additional Fonts Folder વધારાનું ફોન્ટ ફોલ્ડર + Additional Plug-ins Folder વધારાનું પ્લગ-ઇન ફોલ્ડર + Adjust Adjoining Width Points અડીને આવેલા પહોળાઈ બિંદુઓ ગોઠવો + Adjust Color Balance… રંગ બૅલેન્સ ગોઠવો… + Adjust Colors રંગ ગોઠવો + Adjust Options: ગોઠવણ વિકલ્પો: + Adjustment ગોઠવણ + Advanced અદ્યતન + Advanced Character Formats અદ્યતન અક્ષર ફોર્મેટ + Advanced Options અદ્યતન વિકલ્પો + After First: પ્રથમ પછી: + Align સંરેખિત કરો + Align Bottom નીચેથી સંરેખિત કરો + Align Center કેન્દ્રમાં સંરેખિત કરો + Align Objects: ઑબ્જેક્ટ સંરેખિત કરો: + Align Stroke to Center સ્ટ્રોકને કેન્દ્રમાં સંરેખિત કરો + Align Stroke to Inside સ્ટ્રોકને અંદરની બાજુએ સંરેખિત કરો + Align Stroke to Outside સ્ટ્રોકને બહારની બાજુએ સંરેખિત કરો + Align Stroke: સ્ટ્રોક સંરેખિત કરો: + Align To: સંરેખિત કરો: + Align Top ઉપરથી સંરેખિત કરો + Align center કેન્દ્રમાં સંરેખિત કરો + Align left ડાબે સંરેખિત કરો + Align right જમણે સંરેખિત કરો + Align to Artboard આર્ટબોર્ડ પર સંરેખિત કરો + Align to Glyph Bounds ગ્લિફ સીમા પર સંરેખિત કરો + Align to Key Object કી ઑબ્જેક્ટ પર સંરેખિત કરો + Align to Page પેજ પર સંરેખિત કરો + Align to Path પાથ પર સંરેખિત કરો + Align to Pixel Grid પિક્સેલ ગ્રિડ પર સંરેખિત કરો + Align to Selection પસંદગી પર સંરેખિત કરો + Align: સંરેખિત કરો: + Alignment Guides સંરેખણ ગાઇડ + Alignment: સંરેખણ: + All બધા + All Artboards બધા આર્ટબોર્ડ + All Artwork Above ઉપરની બધી આર્ટવર્ક + All Caps બધા કૅપ્સ + All Categories બધી કેટેગરી + All Scripts બધી લિપિ + All Text Objects બધી ટેક્સ્ટ ઑબ્જેક્ટ + All Tools બધા ટૂલ + All on Active Artboard સક્રિય આર્ટબોર્ડ પરના બધા + All on Same Layers સમાન લેયર પરના બધા + All printer's marks બધા પ્રિન્ટરના નિશાન + All the art બધી આર્ટ + Alt key toggles to Smooth Tool Alt કી સ્મૂધ ટૂલ પર ટૉગલ કરે છે + Alt: Alt: + Alter Paths for Appearance દેખાવ માટે પાથ બદલો + Alternates for Current Selection વર્તમાન પસંદગી માટે વૈકલ્પિક + Amber એમ્બર + Ambient Light એમ્બિયન્ટ લાઇટ + Amount માત્રા + Amount: માત્રા: + Anchor Eraser Brush એન્કર ઇરેઝર બ્રશ + Anchor Inspector એન્કર ઇન્સ્પેક્ટર + Anchor Point એન્કર બિંદુ + Anchor Point Tool એન્કર બિંદુ ટૂલ + Anchor Points એન્કર બિંદુઓ + Anchor Points, Handle, and Bounding Box Display એન્કર બિંદુઓ, હેન્ડલ અને બાઉન્ડિંગ બૉક્સ ડિસ્પ્લે + Anchor/Path Labels એન્કર/પાથ લેબલ + Anchors selected: {count} પસંદ કરેલા એન્કર: {count} + Anchors: એન્કર: + Angle ખૂણો + Angle: ખૂણો: + Angled Strokes… ત્રાંસા સ્ટ્રોક… + Angles ખૂણા + Animated Zoom ઍનિમેટેડ ઝૂમ + Anti-Alias એન્ટિ-એલિયાસ + Anti-alias એન્ટિ-એલિયાસ + Anti-alias Rasters રાસ્ટર એન્ટિ-એલિયાસ + Anti-aliased Artwork એન્ટિ-એલિયાસ્ડ આર્ટવર્ક + Anti-aliasing Method એન્ટિ-એલિયાસિંગ પદ્ધતિ + Anti-aliasing: એન્ટિ-એલિયાસિંગ: + Appearance દેખાવ + Appearance Attribute દેખાવ ગુણધર્મ + Appearance Item દેખાવ આઇટમ + Appearance Panel દેખાવ પેનલ + Appearance of Black કાળાનો દેખાવ + Appearance panel દેખાવ પેનલ + Applies the next time VectorCraft starts. VectorCraft આગલી વખતે શરૂ થશે ત્યારે લાગુ થશે. + Applies when the linked file is relinked or updated. લિંક કરેલી ફાઇલ ફરી લિંક અથવા અપડેટ થાય ત્યારે લાગુ થાય છે. + Apply લાગુ કરો + Apply Brush બ્રશ લાગુ કરો + Apply Bullets બુલેટ લાગુ કરો + Apply Character Style અક્ષર સ્ટાઇલ લાગુ કરો + Apply Data Set ડેટા સેટ લાગુ કરો + Apply Effect ઇફેક્ટ લાગુ કરો + Apply Fill to Stroke સ્ટ્રોક પર ફિલ લાગુ કરો + Apply Gradient Preset ગ્રેડિયન્ટ પ્રીસેટ લાગુ કરો + Apply Graphic Style ગ્રાફિક સ્ટાઇલ લાગુ કરો + Apply Last Color છેલ્લો રંગ લાગુ કરો + Apply Last Effect છેલ્લી ઇફેક્ટ લાગુ કરો + Apply Last Gradient છેલ્લો ગ્રેડિયન્ટ લાગુ કરો + Apply Nearest Swatch નજીકનો સ્વેચ લાગુ કરો + Apply Numbers નંબર લાગુ કરો + Apply Paragraph Style ફકરા સ્ટાઇલ લાગુ કરો + Apply SVG Filter SVG ફિલ્ટર લાગુ કરો + Apply SVG Filter… SVG ફિલ્ટર લાગુ કરો… + Apply Stroke to Fill ફિલ પર સ્ટ્રોક લાગુ કરો + Apply To: આના પર લાગુ કરો: + Apply as Filter ફિલ્ટર તરીકે લાગુ કરો + Apply the preferences in a file Export Preferences saved Export Preferences દ્વારા સાચવેલી ફાઇલની પસંદગીઓ લાગુ કરો + Apply to All બધા પર લાગુ કરો + Apply to Selected Anchors પસંદ કરેલા એન્કર પર લાગુ કરો + Apply {name} {name} લાગુ કરો + Approximate path અંદાજિત પાથ + Arc આર્ક + Arc Lower… નીચે આર્ક… + Arc Segment Tool Options આર્ક સેગમેન્ટ ટૂલ વિકલ્પો + Arc Tool આર્ક ટૂલ + Arc Upper… ઉપર આર્ક… + Arch… કમાન… + Arc… આર્ક… + Area / Path Type એરિયા / પાથ ટાઇપ + Area Graph Tool એરિયા ગ્રાફ ટૂલ + Area Text એરિયા ટેક્સ્ટ + Area Text Objects એરિયા ટેક્સ્ટ ઑબ્જેક્ટ + Area Type એરિયા ટાઇપ + Area Type Options એરિયા ટાઇપ વિકલ્પો + Area Type Options… એરિયા ટાઇપ વિકલ્પો… + Area Type Tool એરિયા ટાઇપ ટૂલ + Around Object ઑબ્જેક્ટની આસપાસ + Arrange ગોઠવો + Arrange Intertwine Area ઇન્ટરટ્વાઇન વિસ્તાર ગોઠવો + Arrange Tools ટૂલ ગોઠવો + Arrange by Column કૉલમ પ્રમાણે ગોઠવો + Arrange by Row પંક્તિ પ્રમાણે ગોઠવો + Arrange in Grid ગ્રિડમાં ગોઠવો + Arrange in Grid… ગ્રિડમાં ગોઠવો… + Arrange: Bring to Front ગોઠવો: સૌથી આગળ લાવો + Arrowheads: તીરના માથાં: + Art Brush આર્ટ બ્રશ + Art Brush Options આર્ટ બ્રશ વિકલ્પો + Art Ribbons આર્ટ રિબન + Art using a deleted global swatch keeps its colour. કાઢી નાખેલો ગ્લોબલ સ્વેચ વાપરતી આર્ટ પોતાનો રંગ જાળવે છે. + ArtCraft Website ArtCraft વેબસાઇટ + ArtCraft website ArtCraft વેબસાઇટ + Artboard આર્ટબોર્ડ + Artboard Guides with Cmd/Ctrl + Ruler Drag Cmd/Ctrl + રૂલર ખેંચીને આર્ટબોર્ડ ગાઇડ + Artboard Options આર્ટબોર્ડ વિકલ્પો + Artboard Options… આર્ટબોર્ડ વિકલ્પો… + Artboard Tool આર્ટબોર્ડ ટૂલ + Artboard {number} આર્ટબોર્ડ {number} + Artboard {n} of {total} આર્ટબોર્ડ {total} માંથી {n} + Artboard: આર્ટબોર્ડ: + Artboards આર્ટબોર્ડ + Artboards: {n} આર્ટબોર્ડ: {n} + Artistic કલાત્મક + Artwork આર્ટવર્ક + Artwork Cleanup આર્ટવર્ક ક્લીનઅપ + Artwork Colors આર્ટવર્ક રંગ + As Multiple Assets ઘણી સંપત્તિ તરીકે + As Single Asset એક સંપત્તિ તરીકે + Ask When Modified બદલાય ત્યારે પૂછો + Aspect Ratio પાસા ગુણોત્તર + Assamese આસામી + Asset Export સંપત્તિ નિકાસ + Asset Export Settings સંપત્તિ નિકાસ સેટિંગ્સ + Assets સંપત્તિ + Assign સોંપો + Assign Profile પ્રોફાઇલ સોંપો + Assign Profile… પ્રોફાઇલ સોંપો… + Assign: સોંપો: + Attach જોડો + Attach Objects on Path પાથ પર ઑબ્જેક્ટ જોડો + Attach to Active Plane સક્રિય સમતલ પર જોડો + Attribute: ગુણધર્મ: + Attributes ગુણધર્મો + Author Title: લેખકનું શીર્ષક: + Author: લેખક: + Auto ઑટો + Auto Leading: ઑટો લીડિંગ: + Auto Size New Area Type નવા એરિયા ટાઇપનું ઑટો કદ + Auto Spell Check ઑટો સ્પેલ ચેક + Auto-Between ઑટો-વચ્ચે + Auto-Centered ઑટો-કેન્દ્રિત + Auto-Collapse Iconic Panels આઇકન પેનલ ઑટો-સંકોચો + Auto-Overlap ઑટો-ઓવરલેપ + Auto-Rotate (turn the paper to each artboard) ઑટો-ફેરવો (દરેક આર્ટબોર્ડ માટે કાગળ ફેરવો) + Auto-Simplify ઑટો-સરળ બનાવો + Auto-Sliced ઑટો-સ્લાઇસ્ડ + Auto-Smooth ઑટો-સ્મૂધ + Automatic સ્વચાલિત + Automatic flatness સ્વચાલિત ફ્લેટનેસ + Automatically આપમેળે + Automatically Save Recovery Data રિકવરી ડેટા આપમેળે સાચવો + Automation ઑટોમેશન + Average સરેરાશ + Average & Join સરેરાશ અને જોડો + Average & Join… સરેરાશ અને જોડો… + Average… સરેરાશ… + Axis side અક્ષની બાજુ + BLANK DOCUMENT PRESETS ખાલી દસ્તાવેજ પ્રીસેટ + Back પાછળ + Background Color: બૅકગ્રાઉન્ડ રંગ: + Background Contents બૅકગ્રાઉન્ડ કન્ટેન્ટ + Background: બૅકગ્રાઉન્ડ: + Bar Graph Tool બાર ગ્રાફ ટૂલ + Bas Relief… બાસ રિલીફ… + Base Along: સાથે આધાર: + Baseline બેઝલાઇન + Baseline Shift બેઝલાઇન શિફ્ટ + Basic Character Formats મૂળભૂત અક્ષર ફોર્મેટ + Basic Shapes મૂળભૂત આકાર + Batch બૅચ + Batch Trace Folder બૅચ ટ્રેસ ફોલ્ડર + Batch… બૅચ… + Before Last: છેલ્લા પહેલાં: + Begin Recording રેકોર્ડિંગ શરૂ કરો + Begin Undo Group પૂર્વવત્ ગ્રુપ શરૂ કરો + Bend: વાળો: + Bengali બંગાળી + Bevel બેવલ + Bevel Inside અંદરથી બેવલ + Bevel Join બેવલ જોઇન + Bevel Shape બેવલ આકાર + Bevel both sides બંને બાજુ બેવલ + Binary assets added બાઇનરી સંપત્તિ ઉમેરાઈ + Binary assets removed બાઇનરી સંપત્તિ દૂર કરી + Bind Variable વેરિએબલ બાંધો + Bitmap બિટમેપ + Black કાળો + Black and white stay as they are. Dark colors become shades of the stroke color and light colors become tints of it. કાળો અને સફેદ જેમના તેમ રહે છે. ઘેરા રંગ સ્ટ્રોક રંગની છાંયડા બને છે અને આછા રંગ તેની ટિન્ટ બને છે. + Black becomes the stroke color and white stays white. Other colors become tints of the stroke color by their lightness. કાળો સ્ટ્રોક રંગ બને છે અને સફેદ સફેદ રહે છે. અન્ય રંગ તેમની હળવાશ પ્રમાણે સ્ટ્રોક રંગની ટિન્ટ બને છે. + Bleed બ્લીડ + Bleed: બ્લીડ: + Bleeds બ્લીડ + Blend બ્લેન્ડ + Blend Front to Back આગળથી પાછળ બ્લેન્ડ + Blend Horizontally આડું બ્લેન્ડ + Blend Info બ્લેન્ડ માહિતી + Blend Options બ્લેન્ડ વિકલ્પો + Blend Options… બ્લેન્ડ વિકલ્પો… + Blend Steps બ્લેન્ડ સ્ટેપ + Blend Tool બ્લેન્ડ ટૂલ + Blend Vertically ઊભું બ્લેન્ડ + Blending Mode બ્લેન્ડિંગ મોડ + Blends and Transparency બ્લેન્ડ અને પારદર્શિતા + Bloat ફુલાવો + Bloat Tool ફુલાવો ટૂલ + Blob Brush બ્લૉબ બ્રશ + Blob Brush Tool બ્લૉબ બ્રશ ટૂલ + Blue વાદળી + Blur બ્લર + Bold બોલ્ડ + Both sides બંને બાજુ + Bottom નીચે + Bottom Left નીચે ડાબે + Bottom Left: નીચે ડાબે: + Bottom Right નીચે જમણે + Bottom Right: નીચે જમણે: + Bottom to Top નીચેથી ઉપર + Bottom-Justified Tab નીચે-જસ્ટિફાઇડ ટૅબ + Bottom-to-Bottom Leading નીચેથી નીચે લીડિંગ + Bottom: નીચે: + Bracket never closed કૌંસ ક્યારેય બંધ થયો નથી + Break Link લિંક તોડો + Break Link to Graphic Style ગ્રાફિક સ્ટાઇલની લિંક તોડો + Break Link to Symbol સિમ્બોલની લિંક તોડો + Break Text ટેક્સ્ટ તોડો + Break Text into Glyphs ટેક્સ્ટને ગ્લિફમાં તોડો + Break Text into Lines ટેક્સ્ટને લાઇનમાં તોડો + Break Text into Paragraphs ટેક્સ્ટને ફકરામાં તોડો + Break Text into Words ટેક્સ્ટને શબ્દોમાં તોડો + Break Thread થ્રેડ તોડો + Brick Offset: ઈંટ ઑફસેટ: + Brightness તેજ + Brightness/Contrast… તેજ/કૉન્ટ્રાસ્ટ… + Brightness: તેજ: + Brights તેજસ્વી + Bring All to Front બધાને સૌથી આગળ લાવો + Bring Forward આગળ લાવો + Bring to Front સૌથી આગળ લાવો + Bristle Brush બ્રિસ્ટલ બ્રશ + Bristle Brush Options બ્રિસ્ટલ બ્રશ વિકલ્પો + Bristle Brush Strokes બ્રિસ્ટલ બ્રશ સ્ટ્રોક + Browser બ્રાઉઝર + Brush Affects: બ્રશ અસર કરે છે: + Brush Art બ્રશ આર્ટ + Brush Definition બ્રશ વ્યાખ્યા + Brush Libraries બ્રશ લાઇબ્રેરી + Brush Library બ્રશ લાઇબ્રેરી + Brush Options બ્રશ વિકલ્પો + Brush Options… બ્રશ વિકલ્પો… + Brush Scale Options બ્રશ સ્કેલ વિકલ્પો + Brush Strokes બ્રશ સ્ટ્રોક + Brushes બ્રશ + Built-in presets are read-only: New… starts an editable copy. બિલ્ટ-ઇન પ્રીસેટ ફક્ત વાંચવા પૂરતા છે: નવું… સંપાદિત કરી શકાય તેવી નકલ શરૂ કરે છે. + Built-in presets don't change: New makes a copy you can edit. બિલ્ટ-ઇન પ્રીસેટ બદલાતા નથી: નવું સંપાદિત કરી શકાય તેવી નકલ બનાવે છે. + Built-in presets don't change: New… starts an editable copy. બિલ્ટ-ઇન પ્રીસેટ બદલાતા નથી: નવું… સંપાદિત કરી શકાય તેવી નકલ શરૂ કરે છે. + Bulgarian બલ્ગેરિયન + Bulge… ફુગાવો… + Bullet બુલેટ + Bullet Character: બુલેટ અક્ષર: + Bullets બુલેટ + Bullets and Numbering બુલેટ અને નંબરિંગ + Bullets and Numbering… બુલેટ અને નંબરિંગ… + Burasagari Burasagari + Butt Cap બટ કૅપ + By Columns કૉલમ પ્રમાણે + By Layer લેયર પ્રમાણે + By Object ઑબ્જેક્ટ પ્રમાણે + By Rows પંક્તિ પ્રમાણે + Byte Order: બાઇટ ક્રમ: + CMYK CMYK + CMYK Color CMYK રંગ + CMYK Images CMYK ઇમેજ + CMYK colours print with their own values; off, they go through the colour settings too. CMYK રંગો પોતાની કિંમતો સાથે છાપે છે; બંધ હોય ત્યારે તે રંગ સેટિંગમાંથી પણ પસાર થાય છે. + CMYK: CMYK: + CSS Properties CSS ગુણધર્મો + Calligraphic Brush કેલિગ્રાફિક બ્રશ + Calligraphic Brush Options કેલિગ્રાફિક બ્રશ વિકલ્પો + Calligraphic Nibs કેલિગ્રાફિક નિબ + Can't export “{name}”. “{name}” નિકાસ કરી શકાતી નથી. + Can't open “{name}”. “{name}” ખોલી શકાતી નથી. + Can't print these settings: see the Summary આ સેટિંગ્સ છાપી શકાતી નથી: સારાંશ જુઓ + Can't save “{name}”. “{name}” સાચવી શકાતી નથી. + Cancel રદ કરો + Cancel Export નિકાસ રદ કરો + Cancel Image Trace ઇમેજ ટ્રેસ રદ કરો + Cancel Key Object કી ઑબ્જેક્ટ રદ કરો + Cancel Opening ખોલવાનું રદ કરો + Cancel Pattern Editing પેટર્ન સંપાદન રદ કરો + Cancel Plug-in Run પ્લગ-ઇન ચલાવવાનું રદ કરો + Canvas કેનવાસ + Canvas Color કેનવાસ રંગ + Cap Height કેપ ઊંચાઈ + Cap: કેપ: + Caps Lock Cursor State કેપ્સ લૉક કર્સર સ્થિતિ + Capture Data Set ડેટા સેટ કૅપ્ચર કરો + Cascade ક્રમમાં ગોઠવો + Case કેસ + Catalan કેટાલાન + Center કેન્દ્ર + Center Artwork આર્ટવર્ક કેન્દ્રિત કરો + Center on Artboard આર્ટબોર્ડ પર કેન્દ્રિત કરો + Center-Justified Tab કેન્દ્ર-સંરેખિત ટેબ + Centimeters સેન્ટિમીટર + Chalk & Charcoal… ચૉક અને ચારકોલ… + Chamfer ચેમ્ફર + Change બદલો + Change All બધું બદલો + Change Case કેસ બદલો + Change Panel Layout પેનલ લેઆઉટ બદલો + Change how the objects its effect is applied to are drawn જે ઑબ્જેક્ટ્સ પર તેની અસર લાગુ થાય છે તે કેવી રીતે દોરાય તે બદલો + Change in Custom Dictionary કસ્ટમ ડિક્શનરીમાં બદલો + Change to Artboard Rulers આર્ટબોર્ડ રૂલર પર બદલો + Change to Global Rulers ગ્લોબલ રૂલર પર બદલો + Change to Left-to-Right Layout ડાબેથી જમણે લેઆઉટ પર બદલો + Change to Right-to-Left Layout જમણેથી ડાબે લેઆઉટ પર બદલો + Change, add and delete objects in the document દસ્તાવેજમાં ઑબ્જેક્ટ બદલો, ઉમેરો અને કાઢી નાખો + Changed since the last Refresh. છેલ્લા રિફ્રેશ પછી બદલાયું. + Changed since the last check. છેલ્લી તપાસ પછી બદલાયું. + Changes allowed: મંજૂર બદલાવ: + Changes made since it was last saved will be lost. છેલ્લે સાચવ્યા પછી કરેલા બદલાવ ગુમ થશે. + Changes the reference app's preferences સંદર્ભ એપની પસંદગીઓ બદલે છે + Changing these settings changes how raster effects look when exported, flattened or expanded. આ સેટિંગ્સ બદલવાથી નિકાસ, ફ્લેટન કે વિસ્તૃત કરતી વખતે રાસ્ટર અસરો કેવી દેખાય છે તે બદલાય છે. + Channel ચેનલ + Character અક્ષર + Character / Paragraph અક્ષર / ફકરો + Character Alignment અક્ષર સંરેખણ + Character Color અક્ષર રંગ + Character Direction અક્ષર દિશા + Character Rotation અક્ષર પરિભ્રમણ + Character Set: અક્ષર સેટ: + Character Style Options અક્ષર સ્ટાઇલ વિકલ્પો + Character Styles અક્ષર સ્ટાઇલ + Character options અક્ષર વિકલ્પો + Character: અક્ષર: + Charcoal… ચારકોલ… + Check Document દસ્તાવેજ તપાસો + Check Links લિંક તપાસો + Check Script સ્ક્રિપ્ટ તપાસો + Check Script… સ્ક્રિપ્ટ તપાસો… + Check Selection પસંદગી તપાસો + Check Spelling જોડણી તપાસો + Check Spelling… જોડણી તપાસો… + Check an artboard to save. સાચવવા માટે આર્ટબોર્ડ પસંદ કરો. + Check for Updates… અપડેટ્સ તપાસો… + Checked ચકાસેલું + Chinese ચાઇનીઝ + Choose a folder ફોલ્ડર પસંદ કરો + Choose the file to relink each linked file to. Files with the size and contents saved with the link come first. દરેક લિંક થયેલી ફાઇલને ફરી લિંક કરવા માટે ફાઇલ પસંદ કરો. લિંક સાથે સાચવેલા કદ અને સામગ્રીવાળી ફાઇલો પહેલા આવશે. + Choose… પસંદ કરો… + Chop Design ચૉપ ડિઝાઇન + Chosen: {n} of {total} પસંદ કરેલ: {total} માંથી {n} + Chrome… ક્રોમ… + Circle વર્તુળ + Classic ક્લાસિક + Clean Up સાફ કરો + Clean Up… સાફ કરો… + Clear સાફ કરો + Clear All બધું સાફ કરો + Clear All Tabs બધા ટેબ સાફ કરો + Clear Appearance દેખાવ સાફ કરો + Clear Events ઇવેન્ટ્સ સાફ કરો + Clear Guides ગાઇડ્સ સાફ કરો + Clear History ઇતિહાસ સાફ કરો + Clear Plug-in Cache પ્લગ-ઇન કેશ સાફ કરો + Clear Recent Files તાજેતરની ફાઇલો સાફ કરો + Clear Script Console સ્ક્રિપ્ટ કન્સોલ સાફ કરો + Clear Selection પસંદગી સાફ કરો + Click ક્લિક + Click an anchor point એન્કર પોઇન્ટ પર ક્લિક કરો + Click or drag ક્લિક કરો અથવા ખેંચો + Click the art with the Gradient tool to add or select points. પોઇન્ટ ઉમેરવા કે પસંદ કરવા ગ્રેડિયન્ટ ટૂલ વડે આર્ટવર્ક પર ક્લિક કરો. + Click the first point પહેલા પોઇન્ટ પર ક્લિક કરો + Click the ramp or a type button to apply a gradient. ગ્રેડિયન્ટ લાગુ કરવા માટે રૅમ્પ અથવા ટાઇપ બટન પર ક્લિક કરો. + Click to apply to the selected type પસંદ કરેલા ટેક્સ્ટ પર લાગુ કરવા ક્લિક કરો + Click to choose a swatch, Shift-click to mix a colour સ્વેચ પસંદ કરવા ક્લિક કરો, રંગ મિક્સ કરવા Shift-ક્લિક કરો + Click to edit સંપાદન માટે ક્લિક કરો + Click to edit the mask; Alt-click to view only the mask; Shift-click to disable or enable it માસ્ક સંપાદિત કરવા ક્લિક કરો; માત્ર માસ્ક જોવા Alt-ક્લિક કરો; તેને બંધ કે ચાલુ કરવા Shift-ક્લિક કરો + Click to place each file at 100%, or drag to size it; arrow keys switch files, Esc skips one. દરેક ફાઇલ 100% પર મૂકવા ક્લિક કરો, અથવા કદ આપવા ખેંચો; તીર કી ફાઇલો બદલે છે, Esc એક છોડે છે. + Click to select, double-click to edit પસંદ કરવા ક્લિક કરો, સંપાદન માટે ડબલ-ક્લિક કરો + Click to toggle visibility દૃશ્યતા બદલવા ક્લિક કરો + Click to zoom in, Alt-click to zoom out, drag to pan, double-click to fit મોટું કરવા ક્લિક કરો, નાનું કરવા Alt-ક્લિક કરો, ખસેડવા ખેંચો, ફિટ કરવા ડબલ-ક્લિક કરો + Click, then press the key this code stands for (Esc cancels) ક્લિક કરો, પછી આ કોડ જે કી માટે છે તે દબાવો (Esc રદ કરે છે) + Clip ક્લિપ + Clip Complex Regions જટિલ વિસ્તારો ક્લિપ કરો + Clip to Art આર્ટવર્ક પર ક્લિપ કરો + Clip to Artboard આર્ટબોર્ડ પર ક્લિપ કરો + Clip to Bounding Box બાઉન્ડિંગ બૉક્સ પર ક્લિપ કરો + Clipboard Formats ક્લિપબોર્ડ ફોર્મેટ્સ + Clipboard Handling ક્લિપબોર્ડ હેન્ડલિંગ + Clipboard as PDF PDF તરીકે ક્લિપબોર્ડ + Clipboard as PNG PNG તરીકે ક્લિપબોર્ડ + Clipboard as SVG SVG તરીકે ક્લિપબોર્ડ + Clipboard as Text ટેક્સ્ટ તરીકે ક્લિપબોર્ડ + Clipping Mask ક્લિપિંગ માસ્ક + Clipping Masks ક્લિપિંગ માસ્ક + Clockwise ઘડિયાળની દિશામાં + Close બંધ કરો + Close All બધું બંધ કરો + Close Gaps With Paths પાથ વડે ગેપ બંધ કરો + Close Panel પેનલ બંધ કરો + Close Path પાથ બંધ કરો + Close Path… પાથ બંધ કરો… + Close or Join બંધ કરો અથવા જોડો + Close paths when ends are within: છેડા આ અંતરમાં હોય ત્યારે પાથ બંધ કરો: + Close the circular ends of open profiles. Partial sweeps keep their cut sides open. ખુલ્લી પ્રોફાઇલના ગોળ છેડા બંધ કરો. આંશિક સ્વીપ તેમની કાપેલી બાજુઓ ખુલ્લી રાખે છે. + Closing bracket with no opening one ખુલતા કૌંસ વગરનો બંધ થતો કૌંસ + Coincidence: સંયોગ: + Collapse Panel Group પેનલ ગ્રૂપ સંકોચો + Collapse Panels to Icons પેનલ્સને આઇકનમાં સંકોચો + Collapse to Icons આઇકનમાં સંકોચો + Collate ક્રમમાં ગોઠવો + Collect for Export નિકાસ માટે એકત્ર કરો + Collect in New Layer નવા લેયરમાં એકત્ર કરો + Color રંગ + Color Adjustments રંગ ગોઠવણ + Color Burn કલર બર્ન + Color Dodge કલર ડોજ + Color Effects રંગ અસરો + Color Effects Panel રંગ અસરો પેનલ + Color Group: રંગ ગ્રૂપ: + Color Group: {name} રંગ ગ્રૂપ: {name} + Color Guide રંગ ગાઇડ + Color Guide Options રંગ ગાઇડ વિકલ્પો + Color Guide Options… રંગ ગાઇડ વિકલ્પો… + Color Halftone… કલર હાફટોન… + Color Library… રંગ લાઇબ્રેરી… + Color Mode રંગ મોડ + Color Mode: રંગ મોડ: + Color Model: રંગ મોડેલ: + Color Models રંગ મોડેલ + Color Panel Options રંગ પેનલ વિકલ્પો + Color Picker રંગ પિકર + Color Picker… રંગ પિકર… + Color Reduction: રંગ ઘટાડો: + Color Scheme રંગ યોજના + Color Settings રંગ સેટિંગ્સ + Color Settings… રંગ સેટિંગ્સ… + Color Space રંગ સ્પેસ + Color Swatches રંગ સ્વેચ + Color Table રંગ ટેબલ + Color Themes રંગ થીમ + Color Type: રંગ પ્રકાર: + Color Wheel રંગ વ્હીલ + Color blindness – Deuteranopia-type રંગ અંધત્વ – ડ્યુટેરેનોપિયા પ્રકાર + Color blindness – Protanopia-type રંગ અંધત્વ – પ્રોટેનોપિયા પ્રકાર + Color blindness – Tritanopia-type રંગ અંધત્વ – ટ્રિટેનોપિયા પ્રકાર + Color conversion: રંગ રૂપાંતર: + Color field રંગ ક્ષેત્ર + Color images રંગીન ઇમેજ + Color wheel રંગ વ્હીલ + Color: રંગ: + Colored Pencil… રંગીન પેન્સિલ… + Colorization કલરાઇઝેશન + Colorization Tips કલરાઇઝેશન ટિપ્સ + Colorize કલરાઇઝ કરો + Colors રંગો + Colors: રંગો: + Column Graph Tool કૉલમ ગ્રાફ ટૂલ + Column Type: કૉલમ પ્રકાર: + Column Width: કૉલમ પહોળાઈ: + Columns: કૉલમ: + Column… કૉલમ… + Combine Point Text પોઇન્ટ ટેક્સ્ટ જોડો + Combine Slices સ્લાઇસ જોડો + Coming soon — tracked in the parity plan જલદી આવશે — પેરિટી પ્લાનમાં ટ્રેક થાય છે + Command API Reference કમાન્ડ API સંદર્ભ + Command Click to Select Objects Behind પાછળના ઑબ્જેક્ટ પસંદ કરવા Command-ક્લિક કરો + Command Dialog કમાન્ડ ડાયલોગ + Comment not closed ટિપ્પણી બંધ થઈ નથી + Commits કમિટ્સ + Community સમુદાય + Company કંપની + Compare with Image ઇમેજ સાથે સરખાવો + Compatibility: સુસંગતતા: + Compatible Gradient and Gradient Mesh Printing સુસંગત ગ્રેડિયન્ટ અને ગ્રેડિયન્ટ મેશ પ્રિન્ટિંગ + Compiled or not text કમ્પાઇલ થયેલું છે કે નહીં તે ટેક્સ્ટ + Compiled script: ask its author for the .jsx file કમ્પાઇલ થયેલી સ્ક્રિપ્ટ: .jsx ફાઇલ માટે તેના લેખકને પૂછો + Complement પૂરક + Complexity: જટિલતા: + Composite Fonts કમ્પોઝિટ ફોન્ટ્સ + Composite Fonts… કમ્પોઝિટ ફોન્ટ્સ… + Composite colours are converted to it; separations separate with it when it is a CMYK profile. કમ્પોઝિટ રંગો તેમાં રૂપાંતરિત થાય છે; CMYK પ્રોફાઇલ હોય ત્યારે સેપરેશન તેની સાથે અલગ પડે છે. + Compound Path કમ્પાઉન્ડ પાથ + Compound Shapes કમ્પાઉન્ડ આકારો + Compress (RLE) કમ્પ્રેસ (RLE) + Compress text and line art ટેક્સ્ટ અને લાઇન આર્ટ કમ્પ્રેસ કરો + Compression: કમ્પ્રેશન: + Concave અંતર્ગોળ + Concentric Dividers: કેન્દ્રિત ડિવાઇડર: + Condition identifier: શરત ઓળખકર્તા: + Configure Shape આકાર ગોઠવો + Conflict {n} of {count} વિરોધાભાસ {count} માંથી {n} + Connect જોડો + Connect Selected End Points પસંદ કરેલા અંતિમ પોઇન્ટ જોડો + Consider Open Filled Paths as Closed ભરેલા ખુલ્લા પાથને બંધ ગણો + Consolidate All Windows બધી વિન્ડો એકત્ર કરો + Constrain મર્યાદિત કરો + Constrain Angle ખૂણો મર્યાદિત કરો + Constrain Width and Height Proportions પહોળાઈ અને ઊંચાઈનો પ્રમાણ મર્યાદિત કરો + Construction Guides બાંધકામ ગાઇડ્સ + Contextual Alternates સંદર્ભિત વૈકલ્પિક અક્ષરો + Contextual Task Bar સંદર્ભિત ટાસ્ક બાર + Continue ચાલુ રાખો + Continue Action ક્રિયા ચાલુ રાખો + Continue in Background બેકગ્રાઉન્ડમાં ચાલુ રાખો + Contour કન્ટૂર + Contour Tool કન્ટૂર ટૂલ + Contributors યોગદાનકર્તાઓ + Control કંટ્રોલ + Conté Crayon… કોન્ટે ક્રેયોન… + Convert રૂપાંતર કરો + Convert All Spot Colors to Process બધા સ્પોટ રંગોને પ્રોસેસમાં રૂપાંતર કરો + Convert All Strokes to Outlines બધા સ્ટ્રોકને આઉટલાઇનમાં રૂપાંતર કરો + Convert All Text to Outlines બધા ટેક્સ્ટને આઉટલાઇનમાં રૂપાંતર કરો + Convert Anchor Point એન્કર પોઇન્ટ રૂપાંતર કરો + Convert Anchor Points એન્કર પોઇન્ટ્સ રૂપાંતર કરો + Convert Color રંગ રૂપાંતર કરો + Convert Document Color Mode દસ્તાવેજ રંગ મોડ રૂપાંતર કરો + Convert Layers to Symbols લેયર્સને સિમ્બોલમાં રૂપાંતર કરો + Convert Process to Global પ્રોસેસને ગ્લોબલમાં રૂપાંતર કરો + Convert Selected Anchor Points to Corner પસંદ કરેલા એન્કર પોઇન્ટ્સને ખૂણામાં રૂપાંતર કરો + Convert Selected Anchor Points to Smooth પસંદ કરેલા એન્કર પોઇન્ટ્સને સ્મૂધમાં રૂપાંતર કરો + Convert To Area Type એરિયા ટાઇપમાં રૂપાંતર કરો + Convert To Point Type પોઇન્ટ ટાઇપમાં રૂપાંતર કરો + Convert text to outlines ટેક્સ્ટને આઉટલાઇનમાં રૂપાંતર કરો + Convert to Artboards આર્ટબોર્ડમાં રૂપાંતર કરો + Convert to CMYK CMYK માં રૂપાંતર કરો + Convert to Grayscale ગ્રેસ્કેલમાં રૂપાંતર કરો + Convert to Parametric Shape પેરામેટ્રિક આકારમાં રૂપાંતર કરો + Convert to RGB RGB માં રૂપાંતર કરો + Convert to Shape આકારમાં રૂપાંતર કરો + Convert to Straight Lines સીધી રેખાઓમાં રૂપાંતર કરો + Convert to Text ટેક્સ્ટમાં રૂપાંતર કરો + Convert to sRGB sRGB માં રૂપાંતર કરો + Convert: રૂપાંતર: + Convex બહિર્ગોળ + Copies per Sheet (as many as fit, in a grid) પ્રતિ શીટ નકલો (ગ્રિડમાં જેટલી બેસે તેટલી) + Copies: નકલો: + Copy નકલ + Copy (make a transformed copy) નકલ (રૂપાંતરિત નકલ બનાવો) + Copy All બધું નકલ કરો + Copy All Styles બધી સ્ટાઇલ નકલ કરો + Copy Appearance દેખાવ નકલ કરો + Copy Artboard આર્ટબોર્ડ નકલ કરો + Copy Color Value (Hex) રંગ મૂલ્યની નકલ કરો (Hex) + Copy Guide ગાઇડ નકલ કરો + Copy Report રિપોર્ટ નકલ કરો + Copy Script Console સ્ક્રિપ્ટ કન્સોલ નકલ કરો + Copy Selected પસંદ કરેલું નકલ કરો + Copy Selected Style પસંદ કરેલી સ્ટાઇલ નકલ કરો + Copy Width Point પહોળાઈ પોઇન્ટ નકલ કરો + Copy in Perspective પર્સ્પેક્ટિવમાં નકલ કરો + Copy into the document's folder દસ્તાવેજના ફોલ્ડરમાં નકલ કરો + Copy only fonts you own or are licensed to install. ફક્ત તમારી માલિકીના અથવા ઇન્સ્ટોલ કરવાના લાઇસન્સવાળા ફોન્ટ્સની નકલ કરો. + Copy to User Defined વપરાશકર્તા-વ્યાખ્યાયિતમાં નકલ કરો + Copyright કૉપીરાઇટ + Copyright Info URL: કૉપીરાઇટ માહિતી URL: + Copyright Notice: કૉપીરાઇટ સૂચના: + Copyright Status: કૉપીરાઇટ સ્થિતિ: + Copyright Symbol કૉપીરાઇટ ચિહ્ન + Coral કોરલ + Corner ખૂણો + Corner Point Angle Threshold: ખૂણા પોઇન્ટ ખૂણા મર્યાદા: + Corner Radius ખૂણાની ત્રિજ્યા + Corner Radius: ખૂણાની ત્રિજ્યા: + Corner Tool ખૂણા ટૂલ + Corner: ખૂણો: + Corners ખૂણાઓ + Corners selected: {count} પસંદ કરેલા ખૂણા: {count} + Corners… ખૂણાઓ… + Cove કોવ + Craquelure… ક્રેક્લ્યુર… + Create બનાવો + Create Clipping Mask ક્લિપિંગ માસ્ક બનાવો + Create Compound Path From Ellipses અંડાકારમાંથી કમ્પાઉન્ડ પાથ બનાવો + Create Dimension ડાયમેન્શન બનાવો + Create From: આમાંથી બનાવો: + Create Gradient Mesh ગ્રેડિયન્ટ મેશ બનાવો + Create Gradient Mesh… ગ્રેડિયન્ટ મેશ બનાવો… + Create Graph ગ્રાફ બનાવો + Create New Layer નવો લેયર બનાવો + Create New Library નવી લાઇબ્રેરી બનાવો + Create New Sublayer નવો સબલેયર બનાવો + Create New Swatch… નવો સ્વેચ બનાવો… + Create Object Mosaic ઑબ્જેક્ટ મોઝેઇક બનાવો + Create Object Mosaic… ઑબ્જેક્ટ મોઝેઇક બનાવો… + Create Outlines આઉટલાઇન બનાવો + Create PDF layers from layers and sublayers લેયર અને સબલેયરમાંથી PDF લેયર બનાવો + Create PDF-Compatible File PDF-સુસંગત ફાઇલ બનાવો + Create Path પાથ બનાવો + Create Slice સ્લાઇસ બનાવો + Create Slice from Selection પસંદગીમાંથી સ્લાઇસ બનાવો + Create Slices from Guides ગાઇડ્સમાંથી સ્લાઇસ બનાવો + Create Sub-folders સબ-ફોલ્ડર બનાવો + Create Swatch Legend સ્વેચ લિજેન્ડ બનાવો + Create Swatch Legend… સ્વેચ લિજેન્ડ બનાવો… + Create Text ટેક્સ્ટ બનાવો + Create Trim Marks ટ્રિમ માર્ક્સ બનાવો + Create from Guides ગાઇડ્સમાંથી બનાવો + Create from Selection પસંદગીમાંથી બનાવો + Created બનાવેલ + Created: બનાવેલ: + Crisp ક્રિસ્પ + Croatian ક્રોએશિયન + Crop ક્રોપ + Crop Image ઇમેજ ક્રોપ કરો + Crop Marks ક્રોપ માર્ક્સ + Crop To આના પર ક્રોપ કરો + Crosshatch… ક્રોસહૅચ… + Crystallize ક્રિસ્ટલાઇઝ + Crystallize Tool ક્રિસ્ટલાઇઝ ટૂલ + Crystallize… ક્રિસ્ટલાઇઝ… + Current Brush વર્તમાન બ્રશ + Current Colors ({total}) વર્તમાન રંગો ({total}) + Current Symbol વર્તમાન સિમ્બોલ + Cursor Swatch Preview કર્સર સ્વેચ પૂર્વાવલોકન + Curvature વક્રતા + Curvature Tool વક્રતા ટૂલ + Curve વક્ર + Curved વક્ર + Curves… કર્વ્સ… + Custom કસ્ટમ + Customize… કસ્ટમાઇઝ કરો… + Cut કાપો + Cut Artboard આર્ટબોર્ડ કાપો + Cut Path પાથ કાપો + Cut Path at Selected Anchor Points પસંદ કરેલા એન્કર પોઇન્ટ પર પાથ કાપો + Cutout… કટઆઉટ… + Czech ચેક + DXF Import Options DXF આયાત વિકલ્પો + DXF Info DXF માહિતી + DXF Options DXF વિકલ્પો + DXF Options Dialog DXF વિકલ્પો ડાયલોગ + Danish ડેનિશ + Dark ડાર્ક + Dark Gray ડાર્ક ગ્રે + Dark Rough ડાર્ક રફ + Dark Strokes… ડાર્ક સ્ટ્રોક્સ… + Darken ઘાટું કરો + Darkness ઘાટાપણું + Dash ડૅશ + Dash: ડૅશ: + Dashed ડૅશવાળું + Dashed Line ડૅશવાળી રેખા + Dashes to Geometry… ડૅશને જ્યામિતિમાં ફેરવો… + Data Recovery ડેટા પુનઃપ્રાપ્તિ + Data Set ડેટા સેટ + Data Sets ડેટા સેટ્સ + Data… ડેટા… + Dates તારીખો + De-Interlace… ડી-ઇન્ટરલેસ… + Decimal-Justified Tab દશાંશ-સંરેખિત ટેબ + Decimal: દશાંશ: + Decorative સુશોભિત + Decrease Font Size ફોન્ટ કદ ઘટાડો + Decrease Font Size by Five Steps ફોન્ટ કદ પાંચ પગલાં ઘટાડો + Deep Ungroup ડીપ અનગ્રૂપ + Deep Ungroup… ડીપ અનગ્રૂપ… + Default ડિફૉલ્ટ + Default Fill and Stroke ડિફૉલ્ટ ભરો અને સ્ટ્રોક + Default Fill and Stroke (D) ડિફૉલ્ટ ભરો અને સ્ટ્રોક (D) + Default Language ડિફૉલ્ટ ભાષા + Default Swatches ડિફૉલ્ટ સ્વેચ + Deferred Effects સ્થગિત અસરો + Define Grid… ગ્રિડ વ્યાખ્યાયિત કરો… + Define Perspective Grid પર્સ્પેક્ટિવ ગ્રિડ વ્યાખ્યાયિત કરો + Define Perspective Grid… પર્સ્પેક્ટિવ ગ્રિડ વ્યાખ્યાયિત કરો… + Define a variable first પહેલા ચલ વ્યાખ્યાયિત કરો + Delete કાઢી નાખો + Delete Action Sets ક્રિયા સેટ કાઢી નાખો + Delete Action Step ક્રિયા પગલું કાઢી નાખો + Delete All બધું કાઢી નાખો + Delete All Slices બધી સ્લાઇસ કાઢી નાખો + Delete Anchor Point એન્કર પોઇન્ટ કાઢી નાખો + Delete Anchor Point Tool એન્કર પોઇન્ટ કાઢી નાખો ટૂલ + Delete Anchor Points એન્કર પોઇન્ટ્સ કાઢી નાખો + Delete Artboard આર્ટબોર્ડ કાઢી નાખો + Delete Artboards આર્ટબોર્ડ્સ કાઢી નાખો + Delete Brush બ્રશ કાઢી નાખો + Delete Character Style અક્ષર સ્ટાઇલ કાઢી નાખો + Delete Data Set ડેટા સેટ કાઢી નાખો + Delete Data Sets ડેટા સેટ્સ કાઢી નાખો + Delete Design ડિઝાઇન કાઢી નાખો + Delete Empty Artboards ખાલી આર્ટબોર્ડ કાઢી નાખો + Delete Export Preset નિકાસ પ્રીસેટ કાઢી નાખો + Delete Font ફોન્ટ કાઢી નાખો + Delete Freeform Point ફ્રીફોર્મ પોઇન્ટ કાઢી નાખો + Delete Gradient Preset ગ્રેડિયન્ટ પ્રીસેટ કાઢી નાખો + Delete Graphic Style ગ્રાફિક સ્ટાઇલ કાઢી નાખો + Delete Graphic Style (Alt-click: without asking) ગ્રાફિક સ્ટાઇલ કાઢી નાખો (Alt-ક્લિક: પૂછ્યા વગર) + Delete Graphic Styles ગ્રાફિક સ્ટાઇલ્સ કાઢી નાખો + Delete Guide ગાઇડ કાઢી નાખો + Delete Guides ગાઇડ્સ કાઢી નાખો + Delete Image Trace Preset ઇમેજ ટ્રેસ પ્રીસેટ કાઢી નાખો + Delete Instances ઇન્સ્ટન્સ કાઢી નાખો + Delete Library લાઇબ્રેરી કાઢી નાખો + Delete Library Group લાઇબ્રેરી ગ્રૂપ કાઢી નાખો + Delete Library Item લાઇબ્રેરી આઇટમ કાઢી નાખો + Delete Light લાઇટ કાઢી નાખો + Delete Mesh Point મેશ પોઇન્ટ કાઢી નાખો + Delete PDF Preset PDF પ્રીસેટ કાઢી નાખો + Delete Paragraph Style ફકરા સ્ટાઇલ કાઢી નાખો + Delete Pattern પેટર્ન કાઢી નાખો + Delete Perspective Grid Preset પર્સ્પેક્ટિવ ગ્રિડ પ્રીસેટ કાઢી નાખો + Delete Point પોઇન્ટ કાઢી નાખો + Delete Preset પ્રીસેટ કાઢી નાખો + Delete Print Preset પ્રિન્ટ પ્રીસેટ કાઢી નાખો + Delete Profile પ્રોફાઇલ કાઢી નાખો + Delete SVG Filter SVG ફિલ્ટર કાઢી નાખો + Delete Save for Web Preset વેબ માટે સાચવો પ્રીસેટ કાઢી નાખો + Delete Selected Item પસંદ કરેલી આઇટમ કાઢી નાખો + Delete Selection પસંદગી કાઢી નાખો + Delete Slice સ્લાઇસ કાઢી નાખો + Delete Slices સ્લાઇસ કાઢી નાખો + Delete Spine Point સ્પાઇન પોઇન્ટ કાઢી નાખો + Delete Stop સ્ટોપ કાઢી નાખો + Delete Style સ્ટાઇલ કાઢી નાખો + Delete Styles સ્ટાઇલ્સ કાઢી નાખો + Delete Swatch સ્વેચ કાઢી નાખો + Delete Symbol સિમ્બોલ કાઢી નાખો + Delete Symbols સિમ્બોલ્સ કાઢી નાખો + Delete Theme થીમ કાઢી નાખો + Delete Toolbar ટૂલબાર કાઢી નાખો + Delete Transparency Flattener Preset ટ્રાન્સપરન્સી ફ્લેટનર પ્રીસેટ કાઢી નાખો + Delete Variable ચલ કાઢી નાખો + Delete Variables ચલો કાઢી નાખો + Delete View વ્યૂ કાઢી નાખો + Delete Width Point પહોળાઈ પોઇન્ટ કાઢી નાખો + Delete Workspace વર્કસ્પેસ કાઢી નાખો + Delete from Custom Dictionary કસ્ટમ ડિક્શનરીમાંથી કાઢી નાખો + Delete the graphic style “{name}”? ગ્રાફિક સ્ટાઇલ “{name}” કાઢી નાખીએ? + Delete the library “{name}”? લાઇબ્રેરી “{name}” કાઢી નાખીએ? + Delete the selected brushes? પસંદ કરેલા બ્રશ કાઢી નાખીએ? + Delete the selected symbol? પસંદ કરેલો સિમ્બોલ કાઢી નાખીએ? + Delete the selected symbols? પસંદ કરેલા સિમ્બોલ કાઢી નાખીએ? + Delete theme થીમ કાઢી નાખો + Delete this saved preset આ સાચવેલો પ્રીસેટ કાઢી નાખો + Delete “{name}”? “{name}” કાઢી નાખીએ? + Depth ઊંડાઈ + Depth: ઊંડાઈ: + Desaturate અસંતૃપ્ત કરો + Description વર્ણન + Description: વર્ણન: + Deselect પસંદગી રદ કરો + Design… ડિઝાઇન… + Desired ઇચ્છિત + Destination Folder: ગંતવ્ય ફોલ્ડર: + Destination: ગંતવ્ય: + Detail: વિગત: + Devices ડિવાઇસ + Dialog ડાયલોગ + Diameter: વ્યાસ: + Diamond ડાયમંડ + Difference ડિફરન્સ + Differences from {preset}: {preset} થી તફાવત: + Diffuse ડિફ્યુઝ + Diffuse Glow… ડિફ્યુઝ ગ્લો… + Digits અંકો + Dim Copies to: ઝાંખી નકલો: + Dim Images to: ઝાંખી છબીઓ: + Dimension પરિમાણ + Dimension Tool પરિમાણ ટૂલ + Dimension Tool Options પરિમાણ ટૂલ વિકલ્પો + Dimensions પરિમાણો + Direct Selection Tool ડાયરેક્ટ સિલેક્શન ટૂલ + Direct-select anchor points to edit them. સંપાદિત કરવા એન્કર પોઇન્ટ્સ ડાયરેક્ટ-સિલેક્ટ કરો. + Direction Handles દિશા હેન્ડલ્સ + Direction: દિશા: + Directives નિર્દેશો + Disable Auto Add/Delete ઑટો ઍડ/ડિલીટ બંધ કરો + Disable Opacity Mask ઓપેસિટી માસ્ક બંધ કરો + Disable and Continue બંધ કરો અને ચાલુ રાખો + Disabled plug-ins બંધ કરેલા પ્લગ-ઇન્સ + Discard કાઢી નાખો + Discard Empty Type ખાલી ટાઇપ કાઢી નાખો + Discard Recovered Documents પુનઃપ્રાપ્ત દસ્તાવેજો કાઢી નાખો + Discard White Overprint in Output આઉટપુટમાં સફેદ ઓવરપ્રિન્ટ કાઢી નાખો + Discretionary Hyphen વૈકલ્પિક હાઇફન + Discretionary Ligatures વૈકલ્પિક લિગેચર્સ + Display All Blacks Accurately બધા બ્લેક્સ ચોક્કસ રીતે બતાવો + Display All Blacks as Rich Black બધા બ્લેક્સ રિચ બ્લેક તરીકે બતાવો + Display Bitmaps as Anti-aliased Images in Pixel Preview પિક્સેલ પ્રિવ્યૂમાં બિટમેપ્સ એન્ટી-એલિઆસ્ડ છબીઓ તરીકે બતાવો + Display Options પ્રદર્શન વિકલ્પો + Display Print Size at 100% Zoom 100% ઝૂમ પર પ્રિન્ટ કદ બતાવો + Display name પ્રદર્શન નામ + Distort વિકૃત કરો + Distort & Transform વિકૃત કરો અને રૂપાંતરિત કરો + Distort Appearance દેખાવ વિકૃત કરો + Distort Linear Gradients લીનિયર ગ્રેડિયન્ટ્સ વિકૃત કરો + Distort Pattern Fills પેટર્ન ફિલ્સ વિકૃત કરો + Distortion વિકૃતિ + Distribute વિતરિત કરો + Distribute Evenly સમાન રીતે વિતરિત કરો + Distribute Objects: ઑબ્જેક્ટ્સ વિતરિત કરો: + Distribute Spacing અંતર વિતરિત કરો + Distribute Spacing: અંતર વિતરિત કરો: + Dither ડિથર + Dither: ડિથર: + Divide વિભાજિત કરો + Divide Horizontally Into આડી રીતે આમાં વિભાજિત કરો + Divide Objects Below નીચેના ઑબ્જેક્ટ્સ વિભાજિત કરો + Divide Slices સ્લાઇસ વિભાજિત કરો + Divide Slices… સ્લાઇસ વિભાજિત કરો… + Divide Vertically Into ઊભી રીતે આમાં વિભાજિત કરો + Divide and Outline Will Remove Unpainted Artwork "વિભાજિત કરો અને રૂપરેખા" રંગ વગરની આર્ટવર્ક દૂર કરશે + Divide into Dashes ડેશમાં વિભાજિત કરો + Divide into Dashes… ડેશમાં વિભાજિત કરો… + Do not show this warning again આ ચેતવણી ફરી બતાવશો નહીં + Do you want to save the changes you made to “{name}”? તમે "{name}" માં કરેલા ફેરફારો સાચવવા માંગો છો? + Dock Control Bar ડોક કંટ્રોલ બાર + Dock Panel ડોક પેનલ + Dock to Bottom નીચે ડોક કરો + Dock to Top ઉપર ડોક કરો + Document દસ્તાવેજ + Document Color Mode દસ્તાવેજ કલર મોડ + Document Health Check દસ્તાવેજ હેલ્થ ચેક + Document Info દસ્તાવેજ માહિતી + Document Ink Options દસ્તાવેજ ઇન્ક વિકલ્પો + Document JSON દસ્તાવેજ JSON + Document Library દસ્તાવેજ લાઇબ્રેરી + Document Name દસ્તાવેજ નામ + Document Raster Effects Settings દસ્તાવેજ રાસ્ટર ઇફેક્ટ્સ સેટિંગ્સ + Document Raster Effects Settings Dialog દસ્તાવેજ રાસ્ટર ઇફેક્ટ્સ સેટિંગ્સ ડાયલૉગ + Document Raster Effects Settings… દસ્તાવેજ રાસ્ટર ઇફેક્ટ્સ સેટિંગ્સ… + Document Setup દસ્તાવેજ સેટઅપ + Document Setup… દસ્તાવેજ સેટઅપ… + Document Title: દસ્તાવેજ શીર્ષક: + Document Tools દસ્તાવેજ ટૂલ્સ + Document model દસ્તાવેજ મોડેલ + Document open password દસ્તાવેજ ખોલવાનો પાસવર્ડ + Documents you create appear here. તમે બનાવેલા દસ્તાવેજો અહીં દેખાશે. + Don't Relink ફરીથી લિંક કરશો નહીં + Don't Save સાચવશો નહીં + Don't Show Center સેન્ટર બતાવશો નહીં + Done પૂર્ણ + Done Editing Pattern પેટર્ન સંપાદન પૂર્ણ + Dot Color from Art આર્ટમાંથી ડોટ રંગ + Dots ટપકાં + Double Click To Isolate અલગ કરવા ડબલ ક્લિક કરો + Double Column ડબલ કૉલમ + Double Left Quotation Marks ડબલ ડાબા અવતરણ ચિહ્નો + Double Quotes: ડબલ અવતરણ ચિહ્નો: + Double Right Quotation Marks ડબલ જમણા અવતરણ ચિહ્નો + Double-click ડબલ-ક્લિક + Double-click to edit સંપાદિત કરવા ડબલ-ક્લિક કરો + Double-click to edit the characters' paint અક્ષરોનો પેઇન્ટ સંપાદિત કરવા ડબલ-ક્લિક કરો + Double-click to insert દાખલ કરવા ડબલ-ક્લિક કરો + Double-click to rename નામ બદલવા ડબલ-ક્લિક કરો + Double-click to replace બદલવા ડબલ-ક્લિક કરો + Double-click to target the contents સામગ્રી લક્ષ્ય બનાવવા ડબલ-ક્લિક કરો + Download: ડાઉનલોડ: + Drag ખેંચો + Drag Direction ખેંચવાની દિશા + Drag a handle હેન્ડલ ખેંચો + Drag an item here, or right-click one, to put it in this group. આ જૂથમાં મૂકવા અહીં આઇટમ ખેંચો, અથવા કોઈ એક પર જમણું-ક્લિક કરો. + Drag art here, or select it and click +. Hold Alt for one asset of several objects. અહીં આર્ટ ખેંચો, અથવા તેને પસંદ કરીને + પર ક્લિક કરો. ઘણા ઑબ્જેક્ટ્સમાંથી એક એસેટ માટે Alt દબાવી રાખો. + Drag art or swatches here, or use + to add the selection's colors and text styles. અહીં આર્ટ અથવા સ્વેચ ખેંચો, અથવા પસંદગીના રંગો અને ટેક્સ્ટ સ્ટાઇલ ઉમેરવા + વાપરો. + Drag onto art to apply this appearance આ દેખાવ લાગુ કરવા આર્ટ પર ખેંચો + Drag rings to rotate. Shift snaps to 15°. ફેરવવા રિંગ્સ ખેંચો. Shift 15° પર સ્નેપ કરે છે. + Drag the art to move it on the paper કાગળ પર ખસેડવા આર્ટ ખેંચો + Drag the light, or its rings. Shift snaps to 15°. લાઇટ અથવા તેની રિંગ્સ ખેંચો. Shift 15° પર સ્નેપ કરે છે. + Drag to float as a toolbar ટૂલબાર તરીકે ફ્લોટ કરવા ખેંચો + Drag to float the toolbar ટૂલબાર ફ્લોટ કરવા ખેંચો + Drag to move ખસેડવા ખેંચો + Drag to the window's left or right edge to dock ડોક કરવા વિન્ડોની ડાબી કે જમણી કિનારી પર ખેંચો + Drag values or labels. Double-click a value to type. મૂલ્યો અથવા લેબલ્સ ખેંચો. ટાઇપ કરવા મૂલ્ય પર ડબલ-ક્લિક કરો. + Draw દોરો + Draw Dashed Lines as Solid Lines ડેશ્ડ રેખાઓ સોલિડ રેખાઓ તરીકે દોરો + Draw Hidden Faces છુપાયેલી સપાટીઓ દોરો + Draw in Perspective પર્સ્પેક્ટિવમાં દોરો + Draw: દોરો: + Drawer menu ડ્રોઅર મેનુ + Drawing : real size — 1:10 labels 1 unit on the page as 10. ડ્રોઇંગ: વાસ્તવિક કદ — 1:10 પૃષ્ઠ પર 1 એકમને 10 તરીકે લેબલ કરે છે. + Drawing Mode ડ્રોઇંગ મોડ + Drop Artwork આર્ટવર્ક ડ્રોપ કરો + Drop Shadow… ડ્રોપ શેડો… + Drop here to take it out of its group તેને જૂથમાંથી બહાર કાઢવા અહીં ડ્રોપ કરો + Dry Brush… ડ્રાય બ્રશ… + Duotone Gradients ડ્યુઓટોન ગ્રેડિયન્ટ્સ + Duotone… ડ્યુઓટોન… + Duplicate ડુપ્લિકેટ + Duplicate Action or Action Set ઍક્શન અથવા ઍક્શન સેટની ડુપ્લિકેટ + Duplicate Artboard આર્ટબોર્ડ ડુપ્લિકેટ + Duplicate Artboards આર્ટબોર્ડ્સ ડુપ્લિકેટ + Duplicate Brush બ્રશ ડુપ્લિકેટ + Duplicate Character Style કૅરેક્ટર સ્ટાઇલ ડુપ્લિકેટ + Duplicate Effect ઇફેક્ટ ડુપ્લિકેટ + Duplicate Effects ઇફેક્ટ્સ ડુપ્લિકેટ + Duplicate Graphic Style ગ્રાફિક સ્ટાઇલ ડુપ્લિકેટ + Duplicate Item આઇટમ ડુપ્લિકેટ + Duplicate Paragraph Style પેરેગ્રાફ સ્ટાઇલ ડુપ્લિકેટ + Duplicate Rows પંક્તિઓ ડુપ્લિકેટ + Duplicate Selected Item પસંદ કરેલી આઇટમ ડુપ્લિકેટ + Duplicate Selection પસંદગી ડુપ્લિકેટ + Duplicate Slice સ્લાઇસ ડુપ્લિકેટ + Duplicate Swatch સ્વેચ ડુપ્લિકેટ + Duplicate Symbol સિમ્બોલ ડુપ્લિકેટ + Duplicate Toolbar ટૂલબાર ડુપ્લિકેટ + Dutch ડચ + Dynamic Symbol ડાયનેમિક સિમ્બોલ + EPS Options EPS વિકલ્પો + EPS Options Dialog EPS વિકલ્પો ડાયલૉગ + Each Design Represents: દરેક ડિઝાઇન દર્શાવે છે: + Each data set saves over the same file, which keeps only the last data set. દરેક ડેટા સેટ એક જ ફાઇલ પર સાચવાય છે, જેમાં માત્ર છેલ્લો ડેટા સેટ રહે છે. + Each page prints as one image, at the document's raster effects resolution. દરેક પૃષ્ઠ દસ્તાવેજના રાસ્ટર ઇફેક્ટ્સ રિઝોલ્યુશન પર એક છબી તરીકે પ્રિન્ટ થાય છે. + Earth Tones અર્થ ટોન્સ + Ease In ઇઝ ઇન + Ease In Out ઇઝ ઇન આઉટ + Ease Out ઇઝ આઉટ + Ease Out In ઇઝ આઉટ ઇન + East Asian Type પૂર્વ એશિયાઈ ટાઇપ + Edit સંપાદિત કરો + Edit Artboards આર્ટબોર્ડ્સ સંપાદિત કરો + Edit Character Style કૅરેક્ટર સ્ટાઇલ સંપાદિત કરો + Edit Clipping Path ક્લિપિંગ પાથ સંપાદિત કરો + Edit Color Group કલર ગ્રૂપ સંપાદિત કરો + Edit Colors રંગો સંપાદિત કરો + Edit Contents સામગ્રી સંપાદિત કરો + Edit Custom Dictionary કસ્ટમ શબ્દકોશ સંપાદિત કરો + Edit Custom Dictionary… કસ્ટમ શબ્દકોશ સંપાદિત કરો… + Edit Data Set ડેટા સેટ સંપાદિત કરો + Edit Data Set… ડેટા સેટ સંપાદિત કરો… + Edit Envelope એન્વેલોપ સંપાદિત કરો + Edit Freeform Point ફ્રીફોર્મ પોઇન્ટ સંપાદિત કરો + Edit Gradient ગ્રેડિયન્ટ સંપાદિત કરો + Edit Opacity Mask ઓપેસિટી માસ્ક સંપાદિત કરો + Edit Original મૂળ સંપાદિત કરો + Edit PDF Preset PDF પ્રીસેટ સંપાદિત કરો + Edit Parametric Shape પેરામેટ્રિક આકાર સંપાદિત કરો + Edit Path પાથ સંપાદિત કરો + Edit Pattern પેટર્ન સંપાદિત કરો + Edit Perspective Grid પર્સ્પેક્ટિવ ગ્રિડ સંપાદિત કરો + Edit Print Preset પ્રિન્ટ પ્રીસેટ સંપાદિત કરો + Edit SVG Filter SVG ફિલ્ટર સંપાદિત કરો + Edit Selection પસંદગી સંપાદિત કરો + Edit Selection… પસંદગી સંપાદિત કરો… + Edit Symbol સિમ્બોલ સંપાદિત કરો + Edit Text ટેક્સ્ટ સંપાદિત કરો + Edit Theme થીમ સંપાદિત કરો + Edit Toolbar ટૂલબાર સંપાદિત કરો + Edit Views વ્યૂઝ સંપાદિત કરો + Edit Views… વ્યૂઝ સંપાદિત કરો… + Edit or Apply Color Group કલર ગ્રૂપ સંપાદિત કરો અથવા લાગુ કરો + Edit or Apply Color Group… કલર ગ્રૂપ સંપાદિત કરો અથવા લાગુ કરો… + Edit or Apply Colors રંગો સંપાદિત કરો અથવા લાગુ કરો + Edit selected paths within: પસંદ કરેલા પાથ આમાં સંપાદિત કરો: + Edit the applied effect, or add another one? લાગુ ઇફેક્ટ સંપાદિત કરીએ, અથવા બીજી ઉમેરીએ? + Edit the point પોઇન્ટ સંપાદિત કરો + Edit the stop સ્ટોપ સંપાદિત કરો + Edit theme થીમ સંપાદિત કરો + Editable સંપાદનયોગ્ય + Edit… સંપાદિત કરો… + Effect ઇફેક્ટ + Effect Gallery ઇફેક્ટ ગેલેરી + Effect Gallery Dialog ઇફેક્ટ ગેલેરી ડાયલૉગ + Effect Gallery… ઇફેક્ટ ગેલેરી… + Effect Options ઇફેક્ટ વિકલ્પો + Effective PPI અસરકારક PPI + Effects ઇફેક્ટ્સ + Effect… ઇફેક્ટ… + Ellipse એલિપ્સ + Ellipse Properties: એલિપ્સ ગુણધર્મો: + Ellipse Tool એલિપ્સ ટૂલ + Ellipse… એલિપ્સ… + Ellipsis એલિપ્સિસ + Em Box Em બૉક્સ + Em Box Bottom/Left Em બૉક્સ નીચે/ડાબે + Em Box Center Em બૉક્સ કેન્દ્ર + Em Box Top/Right Em બૉક્સ ઉપર/જમણે + Em Dash Em ડૅશ + Em Space Em સ્પેસ + Embed એમ્બેડ કરો + Embed Fonts (Glyphs Used) ફૉન્ટ્સ એમ્બેડ કરો (વપરાયેલા ગ્લિફ્સ) + Embed Fonts (for other applications) ફૉન્ટ્સ એમ્બેડ કરો (અન્ય ઍપ્લિકેશન્સ માટે) + Embed ICC Profile ICC પ્રોફાઇલ એમ્બેડ કરો + Embed ICC Profiles ICC પ્રોફાઇલ્સ એમ્બેડ કરો + Embed Image છબી એમ્બેડ કરો + Embed Image(s) છબી(ઓ) એમ્બેડ કરો + Embed page thumbnails પૃષ્ઠ થંબનેલ્સ એમ્બેડ કરો + Embedded એમ્બેડ કરેલું + Embedded Image એમ્બેડ કરેલી છબી + Emulsion: ઇમલ્શન: + En Dash En ડૅશ + En Space En સ્પેસ + Enable Background Export બૅકગ્રાઉન્ડ એક્સપોર્ટ ચાલુ કરો + Enable Background Save બૅકગ્રાઉન્ડ સેવ ચાલુ કરો + Enable Contextual Task Bar કૉન્ટેક્સ્ચ્યુઅલ ટાસ્ક બાર ચાલુ કરો + Enable Guides for 9-Slice Scaling 9-સ્લાઇસ સ્કેલિંગ માટે ગાઇડ્સ ચાલુ કરો + Enable Missing Glyph Protection ગુમ ગ્લિફ સુરક્ષા ચાલુ કરો + Enable Opacity Mask ઓપેસિટી માસ્ક ચાલુ કરો + Enable Rubber Band for આ માટે રબર બૅન્ડ ચાલુ કરો + Enable Touch Gestures ટચ ગેસ્ચર ચાલુ કરો + Enable Touch Workspace ટચ વર્કસ્પેસ ચાલુ કરો + Enable copying of text, images and other content ટેક્સ્ટ, છબીઓ અને અન્ય સામગ્રીની નકલ ચાલુ કરો + Enable in-menu font previews મેનૂમાં ફૉન્ટ પ્રિવ્યૂ ચાલુ કરો + Enable on Re-launch ફરી લૉન્ચ થાય ત્યારે ચાલુ કરો + Enable plaintext metadata પ્લેનટેક્સ્ટ મેટાડેટા ચાલુ કરો + Enable text access for screen readers સ્ક્રીન રીડર્સ માટે ટેક્સ્ટ ઍક્સેસ ચાલુ કરો + Enclosing Lasso એન્ક્લોઝિંગ લાસો + Enclosing Lasso Tool એન્ક્લોઝિંગ લાસો ટૂલ + Encoding એન્કોડિંગ + Encoding and writing the file… ફાઇલ એન્કોડ કરી લખાઈ રહી છે… + Encoding: એન્કોડિંગ: + Encryption: {name} (set by Compatibility) એન્ક્રિપ્શન: {name} (કોમ્પેટિબિલિટી દ્વારા સેટ) + End Tile ટાઇલ સમાપ્ત કરો + End Undo Group અનડુ ગ્રૂપ સમાપ્ત કરો + End arrowhead અંતિમ તીર + End: અંત: + Ended at a host limit હોસ્ટ મર્યાદા પર સમાપ્ત + Ended at a limit મર્યાદા પર સમાપ્ત + Ended by an internal fault આંતરિક ખામીથી સમાપ્ત + Ended with an error ભૂલ સાથે સમાપ્ત + English: UK અંગ્રેજી: UK + English: USA અંગ્રેજી: USA + Enter દાખલ કરો + Enter Isolation Mode આઇસોલેશન મોડ દાખલ કરો + Entry: પ્રવેશ: + Envelope Distort એન્વેલોપ ડિસ્ટોર્ટ + Envelope Info એન્વેલોપ માહિતી + Envelope Mesh એન્વેલોપ મેશ + Envelope Options એન્વેલોપ વિકલ્પો + Envelope Options… એન્વેલોપ વિકલ્પો… + Equalize Handles હેન્ડલ્સ સમાન કરો + Eraser ઇરેઝર + Eraser Tool ઇરેઝર ટૂલ + Error ભૂલ + Esc Esc + Essentials એસેન્શિયલ્સ + Essentials Classic એસેન્શિયલ્સ ક્લાસિક + Event: ઇવેન્ટ: + Every (minutes) દર (મિનિટ) + Every option is at its default. દરેક વિકલ્પ ડિફૉલ્ટ પર છે. + Every option matches {base}. દરેક વિકલ્પ {base} સાથે મેળ ખાય છે. + Every-line Composer એવરી-લાઇન કમ્પોઝર + Exact dash lengths ચોક્કસ ડેશ લંબાઈ + Exceptions (comma separated) અપવાદો (અલ્પવિરામથી અલગ) + Exclude બાકાત રાખો + Exclusion બાકાત + Exit બહાર નીકળો + Exit Isolation Mode આઇસોલેશન મોડમાંથી બહાર નીકળો + Exit Symbol Editing Mode સિમ્બોલ સંપાદન મોડમાંથી બહાર નીકળો + Expand વિસ્તૃત કરો + Expand Appearance દેખાવ વિસ્તૃત કરો + Expand Appearance first (Object › Expand Appearance) પહેલા દેખાવ વિસ્તૃત કરો (ઑબ્જેક્ટ › દેખાવ વિસ્તૃત કરો) + Expand Blend બ્લેન્ડ વિસ્તૃત કરો + Expand Brush Strokes બ્રશ સ્ટ્રોક્સ વિસ્તૃત કરો + Expand Compound Shape કમ્પાઉન્ડ આકાર વિસ્તૃત કરો + Expand Dashes into Paths ડેશને પાથમાં વિસ્તૃત કરો + Expand Envelope એન્વેલોપ વિસ્તૃત કરો + Expand Gradient Mesh ગ્રેડિયન્ટ મેશ વિસ્તૃત કરો + Expand Gradient To ગ્રેડિયન્ટ આ સુધી વિસ્તૃત કરો + Expand Image Trace ઇમેજ ટ્રેસ વિસ્તૃત કરો + Expand Instances ઇન્સ્ટન્સ વિસ્તૃત કરો + Expand Layers Panel Rows લેયર્સ પેનલ પંક્તિઓ વિસ્તૃત કરો + Expand Live Paint લાઇવ પેઇન્ટ વિસ્તૃત કરો + Expand Objects on Path પાથ પરના ઑબ્જેક્ટ્સ વિસ્તૃત કરો + Expand Options વિસ્તૃત વિકલ્પો + Expand Repeat રિપીટ વિસ્તૃત કરો + Expand Shape આકાર વિસ્તૃત કરો + Expand Shaper Group શેપર ગ્રૂપ વિસ્તૃત કરો + Expand: વિસ્તૃત કરો: + Expand… વિસ્તૃત કરો… + Export એક્સપોર્ટ + Export 3D Assets 3D એસેટ્સ એક્સપોર્ટ કરો + Export 3D Object 3D ઑબ્જેક્ટ એક્સપોર્ટ કરો + Export All Open Documents બધા ખુલ્લા દસ્તાવેજો એક્સપોર્ટ કરો + Export All Open Documents as PDF બધા ખુલ્લા દસ્તાવેજો PDF તરીકે એક્સપોર્ટ કરો + Export All Open Documents as SVG બધા ખુલ્લા દસ્તાવેજો SVG તરીકે એક્સપોર્ટ કરો + Export All… બધું એક્સપોર્ટ કરો… + Export Artboard આર્ટબોર્ડ એક્સપોર્ટ કરો + Export As આ રીતે એક્સપોર્ટ કરો + Export As PNG… PNG તરીકે એક્સપોર્ટ કરો… + Export As SVG… SVG તરીકે એક્સપોર્ટ કરો… + Export Assets એસેટ્સ એક્સપોર્ટ કરો + Export As… આ રીતે એક્સપોર્ટ કરો… + Export CSS CSS એક્સપોર્ટ કરો + Export CSS… CSS એક્સપોર્ટ કરો… + Export Composite Fonts કમ્પોઝિટ ફૉન્ટ્સ એક્સપોર્ટ કરો + Export DXF DXF એક્સપોર્ટ કરો + Export Data Sets… ડેટા સેટ એક્સપોર્ટ કરો… + Export Document દસ્તાવેજ એક્સપોર્ટ કરો + Export EPS EPS એક્સપોર્ટ કરો + Export Export Presets એક્સપોર્ટ પ્રીસેટ્સ એક્સપોર્ટ કરો + Export Keyboard Shortcuts as Text… કીબોર્ડ શૉર્ટકટ્સ ટેક્સ્ટ તરીકે એક્સપોર્ટ કરો… + Export Keyboard Shortcuts… કીબોર્ડ શૉર્ટકટ્સ એક્સપોર્ટ કરો… + Export Library લાઇબ્રેરી એક્સપોર્ટ કરો + Export Option એક્સપોર્ટ વિકલ્પ + Export PDF PDF એક્સપોર્ટ કરો + Export PDF Presets PDF પ્રીસેટ્સ એક્સપોર્ટ કરો + Export PDFs As: PDF આ રીતે એક્સપોર્ટ કરો: + Export Perspective Grid Presets પર્સ્પેક્ટિવ ગ્રિડ પ્રીસેટ્સ એક્સપોર્ટ કરો + Export Preferences પસંદગીઓ એક્સપોર્ટ કરો + Export Preferences… પસંદગીઓ એક્સપોર્ટ કરો… + Export Presets પ્રીસેટ્સ એક્સપોર્ટ કરો + Export Preset… પ્રીસેટ એક્સપોર્ટ કરો… + Export Print Presets પ્રિન્ટ પ્રીસેટ્સ એક્સપોર્ટ કરો + Export Selected Art Only ફક્ત પસંદ કરેલી આર્ટ એક્સપોર્ટ કરો + Export Selected CSS… પસંદ કરેલ CSS એક્સપોર્ટ કરો… + Export Selection… પસંદગી એક્સપોર્ટ કરો… + Export Settings એક્સપોર્ટ સેટિંગ્સ + Export Transparency Flattener Presets ટ્રાન્સપરન્સી ફ્લેટનર પ્રીસેટ્સ એક્સપોર્ટ કરો + Export Type: એક્સપોર્ટ પ્રકાર: + Export and Clipboard Transparency Flattener Settings એક્સપોર્ટ અને ક્લિપબોર્ડ ટ્રાન્સપરન્સી ફ્લેટનર સેટિંગ્સ + Export for Screens સ્ક્રીન માટે એક્સપોર્ટ કરો + Export for Screens Settings સ્ક્રીન માટે એક્સપોર્ટ સેટિંગ્સ + Export for Screens… સ્ક્રીન માટે એક્સપોર્ટ કરો… + Export the selected assets (else all of them) પસંદ કરેલી એસેટ્સ એક્સપોર્ટ કરો (નહીંતર બધી) + Export to: આમાં એક્સપોર્ટ કરો: + Export {count} Selected {count} પસંદ કરેલા એક્સપોર્ટ કરો + Export: એક્સપોર્ટ: + Export… એક્સપોર્ટ કરો… + Exposure… એક્સપોઝર… + Extend Path પાથ લંબાવો + Extend Path Tool પાથ લંબાવો ટૂલ + Extend Path… પાથ લંબાવો… + Extrude એક્સ્ટ્રુડ + Extrude & Bevel (Classic)… એક્સ્ટ્રુડ અને બેવલ (ક્લાસિક)… + Extrude & Bevel… એક્સ્ટ્રુડ અને બેવલ… + Eyedropper આઇડ્રોપર + Eyedropper Applies: આઇડ્રોપર લાગુ કરે છે: + Eyedropper Options આઇડ્રોપર વિકલ્પો + Eyedropper Picks Up: આઇડ્રોપર ઉપાડે છે: + Eyedropper Tool આઇડ્રોપર ટૂલ + Eyedropper: click the art to sample the key color આઇડ્રોપર: મુખ્ય રંગ લેવા આર્ટ પર ક્લિક કરો + Eyedropper: click the art to sample the stop's colour આઇડ્રોપર: સ્ટોપનો રંગ લેવા આર્ટ પર ક્લિક કરો + Fade Region Outside Artboard આર્ટબોર્ડ બહારનો વિસ્તાર ઝાંખો કરો + Feather… ફેધર… + Feet ફૂટ + Feet & Inches ફૂટ અને ઇંચ + Fewer Elements ઓછા ઘટકો + Fidelity: ફિડેલિટી: + Figure Space ફિગર સ્પેસ + Figure: ફિગર: + File ફાઇલ + File Format: ફાઇલ ફોર્મેટ: + File Formats ફાઇલ ફોર્મેટ્સ + File Handling ફાઇલ હેન્ડલિંગ + File Info ફાઇલ માહિતી + File Info Dialog ફાઇલ માહિતી ડાયલૉગ + File Info… ફાઇલ માહિતી… + File Name: ફાઇલનું નામ: + File SHA-256: {hash} ફાઇલ SHA-256: {hash} + File or URL: ફાઇલ અથવા URL: + File {n} of {total} ફાઇલ {n} / {total} + File › Place… brings in an image, linked or embedded. ફાઇલ › મૂકો… છબી લિંક્ડ અથવા એમ્બેડ કરેલી લાવે છે. + Files ફાઇલો + Files of a PDF standard can't be password-protected. PDF સ્ટાન્ડર્ડની ફાઇલો પાસવર્ડ-સુરક્ષિત કરી શકાતી નથી. + Files of this standard tag their colours with ICC profiles. આ સ્ટાન્ડર્ડની ફાઇલો તેમના રંગોને ICC પ્રોફાઇલ્સ સાથે ટૅગ કરે છે. + Fill ભરો + Fill & Stroke ભરો અને સ્ટ્રોક + Fill (X), double-click for the Color Picker ભરો (X), કલર પીકર માટે ડબલ-ક્લિક કરો + Fill Arc આર્ક ભરો + Fill Color ભરવાનો રંગ + Fill Grid ગ્રિડ ભરો + Fill Line લાઇન ભરો + Fill New Type Objects With Placeholder Text નવા ટાઇપ ઑબ્જેક્ટ્સ પ્લેસહોલ્ડર ટેક્સ્ટથી ભરો + Fill Rule ફિલ નિયમ + Fill Tint ફિલ ટિન્ટ + Fill and Stroke ભરો અને સ્ટ્રોક + Fill new strokes નવા સ્ટ્રોક ભરો + Fill with Placeholder Text પ્લેસહોલ્ડર ટેક્સ્ટથી ભરો + Fill: ભરો: + Fill: click for swatches, Shift-click for the color mixer ભરો: સ્વેચ માટે ક્લિક કરો, કલર મિક્સર માટે Shift-ક્લિક કરો + Filled Dot ભરેલું ટપકું + Filled Square ભરેલો ચોરસ + Film Grain… ફિલ્મ ગ્રેઇન… + Filter ફિલ્ટર + Filter Layers Panel Rows ફિલ્ટર લેયર્સ પેનલ પંક્તિઓ + Find શોધો + Find Font ફૉન્ટ શોધો + Find Font Files ફૉન્ટ ફાઇલ્સ શોધો + Find Fonts ફૉન્ટ્સ શોધો + Find Fonts in Folder… ફોલ્ડરમાં ફૉન્ટ્સ શોધો… + Find Font… ફૉન્ટ શોધો… + Find In આમાં શોધો + Find Linked Files લિંક્ડ ફાઇલો શોધો + Find Linked Files in Folder… ફોલ્ડરમાં લિંક્ડ ફાઇલો શોધો… + Find Nearest Swatch નજીકનો સ્વેચ શોધો + Find Nearest Swatch… નજીકનો સ્વેચ શોધો… + Find Next આગળ શોધો + Find Objects ઑબ્જેક્ટ્સ શોધો + Find and Replace… શોધો અને બદલો… + Find in Folder… ફોલ્ડરમાં શોધો… + Fine noise hides banding in the gradient fill ઝીણો નોઇઝ ગ્રેડિયન્ટ ફિલમાં બેન્ડિંગ છુપાવે છે + Finished પૂર્ણ થયું + Finnish ફિનિશ + First પહેલું + First Artboard પહેલું આર્ટબોર્ડ + First Line Indent: પ્રથમ લાઇન ઇન્ડેન્ટ: + First Page પહેલું પૃષ્ઠ + First commit પ્રથમ કમિટ + First-line Left Indent પ્રથમ લાઇન ડાબો ઇન્ડેન્ટ + Fisheye… ફિશઆઇ… + Fish… ફિશ… + Fit ફિટ + Fit All બધું ફિટ કરો + Fit All in Window વિન્ડોમાં બધું ફિટ કરો + Fit Artboard in Window વિન્ડોમાં આર્ટબોર્ડ ફિટ કરો + Fit Headline હેડલાઇન ફિટ કરો + Fit dashes to corners and ends ડેશને ખૂણાઓ અને છેડા પર ફિટ કરો + Fit in Window વિન્ડોમાં ફિટ કરો + Fit on Screen સ્ક્રીન પર ફિટ કરો + Fit to Artwork Bounds આર્ટવર્ક સીમા પર ફિટ કરો + Fit to Corners and Ends ખૂણા અને છેડા પર ફિટ કરો + Fit to Selected Art પસંદ કરેલી આર્ટ પર ફિટ કરો + Fix All બધું ઠીક કરો + Fix All Issues બધી સમસ્યાઓ ઠીક કરો + Fix Issues સમસ્યાઓ ઠીક કરો + Fix Selected પસંદ કરેલું ઠીક કરો + Flag… ફ્લેગ… + Flare ફ્લેર + Flare Tool ફ્લેર ટૂલ + Flare Tool Options ફ્લેર ટૂલ વિકલ્પો + Flat Image ફ્લેટ છબી + Flatness: ફ્લૅટનેસ: + Flatten ફ્લેટન કરો + Flatten Artwork આર્ટવર્ક ફ્લેટન કરો + Flatten Transparency ટ્રાન્સપરન્સી ફ્લેટન કરો + Flatten Transparency… ટ્રાન્સપરન્સી ફ્લેટન કરો… + Flattener Preview ફ્લેટનર પ્રિવ્યૂ + Flattener preset: ફ્લેટનર પ્રીસેટ: + Flip Across આડું ફ્લિપ કરો + Flip Along સાથે ફ્લિપ કરો + Flip Along Horizontal Axis આડી ધરી સાથે ફ્લિપ કરો + Flip Along Vertical Axis ઊભી અક્ષ સાથે ફ્લિપ કરો + Flip Horizontal આડું ફ્લિપ કરો + Flip Row Order પંક્તિનો ક્રમ ફ્લિપ કરો + Flip Vertical ઊભું ફ્લિપ કરો + Flip: ફ્લિપ: + Float All in Windows બધા વિન્ડોમાં ફ્લોટ કરો + Float Panel પેનલ ફ્લોટ કરો + Float Tool Group ટૂલ ગ્રૂપ ફ્લોટ કરો + Float in Window વિન્ડોમાં ફ્લોટ કરો + Folder ફોલ્ડર + Folder Name: ફોલ્ડરનું નામ: + Font ફોન્ટ + Font Family ફોન્ટ ફેમિલી + Font Family & Style ફોન્ટ ફેમિલી અને સ્ટાઇલ + Font Family, Style & Size ફોન્ટ ફેમિલી, સ્ટાઇલ અને સાઇઝ + Font Family: ફોન્ટ ફેમિલી: + Font List ફોન્ટ યાદી + Font Preview Size ફોન્ટ પૂર્વાવલોકન સાઇઝ + Font Size ફોન્ટ સાઇઝ + Font Style: ફોન્ટ સ્ટાઇલ: + Font: ફોન્ટ: + Fonts ફોન્ટ્સ + Fonts in Document દસ્તાવેજમાં ફોન્ટ્સ + Fonts in Document: {count} દસ્તાવેજમાં ફોન્ટ્સ: {count} + Fonts whose licence doesn't allow embedding are not copied. જે ફોન્ટ્સનું લાઇસન્સ એમ્બેડિંગની મંજૂરી આપતું નથી તે નકલ થશે નહીં. + For Fractions: અપૂર્ણાંક માટે: + Force ફોર્સ + Forced Line Break ફરજિયાત લાઇન બ્રેક + Forget Import Matches આયાત મેળ ભૂલી જાઓ + Format ફોર્મેટ + Format Options ફોર્મેટ વિકલ્પો + Format Presets ફોર્મેટ પ્રીસેટ્સ + Format Settings ફોર્મેટ સેટિંગ્સ + Format: ફોર્મેટ: + Formats: ફોર્મેટ્સ: + Fractional Widths અપૂર્ણાંક પહોળાઈ + Fractions અપૂર્ણાંકો + Free Distort ફ્રી ડિસ્ટોર્ટ + Free Distort… ફ્રી ડિસ્ટોર્ટ… + Free Transform ફ્રી ટ્રાન્સફોર્મ + Free Transform Tool ફ્રી ટ્રાન્સફોર્મ ટૂલ + Freeform ફ્રીફોર્મ + Freeform Gradient ફ્રીફોર્મ ગ્રેડિયન્ટ + French ફ્રેન્ચ + Frequencies and angles are the output device's to apply. ફ્રિક્વન્સી અને એંગલ આઉટપુટ ડિવાઇસ લાગુ કરશે. + Frequency ફ્રિક્વન્સી + Fresco… ફ્રેસ્કો… + From: થી: + Front આગળ + Full Document સંપૂર્ણ દસ્તાવેજ + Full Justify સંપૂર્ણ જસ્ટિફાય + Full Screen Mode ફુલ સ્ક્રીન મોડ + Full Screen Mode with Menu Bar મેનુ બાર સાથે ફુલ સ્ક્રીન મોડ + Full Tone ફુલ ટોન + Fully Enclosed સંપૂર્ણપણે બંધ + Fuzziness: ફઝીનેસ: + GPL palettes keep solid colours only, as RGB. GPL પેલેટમાં ફક્ત સોલિડ રંગો RGB તરીકે રાખવામાં આવે છે. + GPU Performance GPU પર્ફોર્મન્સ + Game HUD ગેમ HUD + Game Trails ગેમ ટ્રેઇલ્સ + Gamma ગામા + Gamut Check ગેમટ ચેક + Gamut Warning ગેમટ ચેતવણી + Gap Detection ગેપ ડિટેક્શન + Gap Length: ગેપની લંબાઈ: + Gap Options ગેપ વિકલ્પો + Gap Options… ગેપ વિકલ્પો… + Gap Preview Color: ગેપ પૂર્વાવલોકન રંગ: + Gap: ગેપ: + Gaussian Blur… ગૉસિયન બ્લર… + General સામાન્ય + Generate CSS CSS જનરેટ કરો + Generate CSS: the whole document's CSS while nothing is selected CSS જનરેટ કરો: કંઈ પસંદ ન હોય ત્યારે સમગ્ર દસ્તાવેજનું CSS + Geometric Guides ભૌમિતિક માર્ગદર્શિકાઓ + Geometric Patterns ભૌમિતિક પેટર્ન + German જર્મન + German: Swiss જર્મન: સ્વિસ + Get Preferences પસંદગીઓ મેળવો + Get Text Range ટેક્સ્ટ રેન્જ મેળવો + Glass… ગ્લાસ… + Global ગ્લોબલ + Global Brush Dimensions ગ્લોબલ બ્રશ પરિમાણો + Global Edit Options ગ્લોબલ એડિટ વિકલ્પો + Global Process Color ગ્લોબલ પ્રોસેસ રંગ + Glowing Edges… ગ્લોઇંગ એજિસ… + Glyph Bounds ગ્લિફ બાઉન્ડ્સ + Glyph Scaling: ગ્લિફ સ્કેલિંગ: + Glyphs ગ્લિફ્સ + Go To Link લિંક પર જાઓ + Go to Artboard આર્ટબોર્ડ પર જાઓ + Grab bag ગ્રેબ બેગ + Gradient ગ્રેડિયન્ટ + Gradient Fill: click to apply, drag onto art ગ્રેડિયન્ટ ભરો: લાગુ કરવા ક્લિક કરો, આર્ટ પર ખેંચો + Gradient Finishes ગ્રેડિયન્ટ ફિનિશ + Gradient Mesh ગ્રેડિયન્ટ મેશ + Gradient Presets ગ્રેડિયન્ટ પ્રીસેટ્સ + Gradient Tool ગ્રેડિયન્ટ ટૂલ + Gradient Vector ગ્રેડિયન્ટ વેક્ટર + Gradient across stroke સ્ટ્રોકની આરપાર ગ્રેડિયન્ટ + Gradient along stroke સ્ટ્રોક સાથે ગ્રેડિયન્ટ + Gradient and Mesh Resolution: ગ્રેડિયન્ટ અને મેશ રિઝોલ્યુશન: + Gradient swatches ગ્રેડિયન્ટ સ્વેચ + Gradient within stroke સ્ટ્રોકની અંદર ગ્રેડિયન્ટ + Gradients ગ્રેડિયન્ટ્સ + Grain ગ્રેઇન + Grain… ગ્રેઇન… + Graph ગ્રાફ + Graph Column ગ્રાફ કૉલમ + Graph Data ગ્રાફ ડેટા + Graph Design ગ્રાફ ડિઝાઇન + Graph Marker ગ્રાફ માર્કર + Graph Type ગ્રાફ પ્રકાર + Graphic Pen… ગ્રાફિક પેન… + Graphic Style ગ્રાફિક સ્ટાઇલ + Graphic Style Libraries ગ્રાફિક સ્ટાઇલ લાઇબ્રેરીઓ + Graphic Style Library ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી + Graphic Style Options ગ્રાફિક સ્ટાઇલ વિકલ્પો + Graphic Style Options… ગ્રાફિક સ્ટાઇલ વિકલ્પો… + Graphic Styles ગ્રાફિક સ્ટાઇલ્સ + Graphic Styles Options ગ્રાફિક સ્ટાઇલ્સ વિકલ્પો + Graphics ગ્રાફિક્સ + Graphics Processor ગ્રાફિક્સ પ્રોસેસર + Graphics: {adapter} ગ્રાફિક્સ: {adapter} + Gravity ગ્રેવિટી + Grays ગ્રે + Grays and Neutrals ગ્રે અને ન્યુટ્રલ + Grayscale ગ્રેસ્કેલ + Grayscale Images ગ્રેસ્કેલ છબીઓ + Grayscale images ગ્રેસ્કેલ છબીઓ + Green લીલો + Grid ગ્રિડ + Grid Color & Opacity ગ્રિડ રંગ અને અપારદર્શિતા + Grid Colors: ગ્રિડ રંગો: + Grid Repeat ગ્રિડ પુનરાવર્તન + Grid Size: ગ્રિડ સાઇઝ: + Grid View ગ્રિડ દૃશ્ય + Grid by Column કૉલમ પ્રમાણે ગ્રિડ + Grid by Row પંક્તિ પ્રમાણે ગ્રિડ + Gridline every દર ગ્રિડલાઇન + Gridline every: દર ગ્રિડલાઇન: + Grids In Back ગ્રિડ પાછળ + Group ગ્રૂપ + Group Overlapping Objects ઓવરલેપ થતી ઑબ્જેક્ટ્સ ગ્રૂપ કરો + Group Selection Tool ગ્રૂપ પસંદગી ટૂલ + Groups ગ્રૂપ્સ + Growth: વૃદ્ધિ: + Guide Label: ગાઇડ લેબલ: + Guides ગાઇડ્સ + Guides & Grid ગાઇડ્સ અને ગ્રિડ + Gujarati ગુજરાતી + Gutter: ગટર: + H Spacing: H સ્પેસિંગ: + H: H: + Ha Ha + Hair Space હેર સ્પેસ + Halftone Pattern… હાફટોન પેટર્ન… + Halo હેલો + Hand Tool હેન્ડ ટૂલ + Hand-Drawn હાથથી દોરેલું + Handles હેન્ડલ્સ + Hard હાર્ડ + Hard Light હાર્ડ લાઇટ + Hard Mix હાર્ડ મિક્સ + Harmony Rules: હાર્મની નિયમો: + Harmony Sets હાર્મની સેટ્સ + Health Check હેલ્થ ચેક + Height ઊંચાઈ + Height: ઊંચાઈ: + Help મદદ + Help Bar મદદ બાર + Help › Search Commands… મદદ › આદેશો શોધો… + Hidden છુપાયેલું + Hidden Layer છુપાયેલ લેયર + Hidden Objects: છુપાયેલી ઑબ્જેક્ટ્સ: + Hide છુપાવો + Hide Artboards આર્ટબોર્ડ છુપાવો + Hide Bar બાર છુપાવો + Hide Bounding Box બાઉન્ડિંગ બૉક્સ છુપાવો + Hide Code કોડ છુપાવો + Hide Corner Widget કૉર્નર વિજેટ છુપાવો + Hide Corner Widget for angles greater than આથી વધુ એંગલ માટે કૉર્નર વિજેટ છુપાવો + Hide Edges કિનારીઓ છુપાવો + Hide Font Height Options ફોન્ટ ઊંચાઈ વિકલ્પો છુપાવો + Hide Gradient Annotator ગ્રેડિયન્ટ એનોટેટર છુપાવો + Hide Grid ગ્રિડ છુપાવો + Hide Guides ગાઇડ્સ છુપાવો + Hide Hidden Characters છુપાયેલા અક્ષરો છુપાવો + Hide Live Paint Gaps લાઇવ પેઇન્ટ ગેપ છુપાવો + Hide Note નોંધ છુપાવો + Hide Options વિકલ્પો છુપાવો + Hide Others બીજા છુપાવો + Hide Presets પ્રીસેટ્સ છુપાવો + Hide Print Tiling પ્રિન્ટ ટાઇલિંગ છુપાવો + Hide Rulers રૂલર છુપાવો + Hide Slices સ્લાઇસ છુપાવો + Hide Snap to Glyph Options ગ્લિફ સ્નેપ વિકલ્પો છુપાવો + Hide Template ટેમ્પલેટ છુપાવો + Hide Text Threads ટેક્સ્ટ થ્રેડ્સ છુપાવો + Hide Thumbnail થંબનેલ છુપાવો + Hide Thumbnails થંબનેલ્સ છુપાવો + Hide Transparency Grid પારદર્શિતા ગ્રિડ છુપાવો + Hide VectorCraft VectorCraft છુપાવો + Hide Video Rulers વિડિઓ રૂલર છુપાવો + High Performance (discrete) ઉચ્ચ પર્ફોર્મન્સ (અલગ) + Highlight હાઇલાઇટ + Highlight Alternate Glyphs વૈકલ્પિક ગ્લિફ હાઇલાઇટ કરો + Highlight Area વિસ્તાર હાઇલાઇટ કરો + Highlight Font Name ફોન્ટનું નામ હાઇલાઇટ કરો + Highlight Intensity હાઇલાઇટ તીવ્રતા + Highlight Kerning કર્નિંગ હાઇલાઇટ કરો + Highlight Rows પંક્તિઓ હાઇલાઇટ કરો + Highlight Size હાઇલાઇટ સાઇઝ + Highlight Substituted Fonts બદલાયેલા ફોન્ટ્સ હાઇલાઇટ કરો + Highlight Substituted Glyphs બદલાયેલા ગ્લિફ હાઇલાઇટ કરો + Highlight Tracking ટ્રેકિંગ હાઇલાઇટ કરો + Highlight Variable વેરિએબલ હાઇલાઇટ કરો + Highlight anchors on mouse over માઉસ ફેરવતાં એન્કર હાઇલાઇટ કરો + Highlight: હાઇલાઇટ: + Hindi હિન્દી + History ઇતિહાસ + History Options… ઇતિહાસ વિકલ્પો… + History States ઇતિહાસ સ્થિતિઓ + Hold હોલ્ડ + Hold a Tool Shortcut to Use the Tool Temporarily ટૂલને અસ્થાયી રૂપે વાપરવા માટે ટૂલ શૉર્ટકટ દબાવી રાખો + Hollow હોલો + Hollow Circle હોલો વર્તુળ + Home હોમ + Horizon Height: ક્ષિતિજ ઊંચાઈ: + Horizontal આડું + Horizontal & Vertical Align Center આડું અને ઊભું કેન્દ્ર સંરેખિત કરો + Horizontal Align Center આડું કેન્દ્ર સંરેખિત કરો + Horizontal Align Left આડું ડાબે સંરેખિત કરો + Horizontal Align Right આડું જમણે સંરેખિત કરો + Horizontal Distribute Center આડું કેન્દ્ર વિતરિત કરો + Horizontal Distribute Left આડું ડાબે વિતરિત કરો + Horizontal Distribute Right આડું જમણે વિતરિત કરો + Horizontal Distribute Space આડી જગ્યા વિતરિત કરો + Horizontal Dividers: આડા ડિવાઇડર: + Horizontal Grid: આડો ગ્રિડ: + Horizontal Guide આડી ગાઇડ + Horizontal Plane આડું પ્લેન + Horizontal Scale આડું સ્કેલ + Horizontal Scale % આડું સ્કેલ % + Horizontal: આડું: + How colours outside the press's gamut are separated. પ્રેસના ગેમટની બહારના રંગો કેવી રીતે અલગ કરવામાં આવે છે. + Hue હ્યૂ + Hue Shift હ્યૂ શિફ્ટ + Hue ring હ્યૂ રિંગ + Hue/Saturation… હ્યૂ/સંતૃપ્તિ… + Hyphen Limit: હાઇફન મર્યાદા: + Hyphenate હાઇફનેટ કરો + Hyphenate Capitalized Words કૅપિટલ શબ્દો હાઇફનેટ કરો + Hyphenation હાઇફનેશન + Hyphenation Zone: હાઇફનેશન ઝોન: + Hyphenation… હાઇફનેશન… + ICC Profile ICC પ્રોફાઇલ + ICF Bottom/Left ICF નીચે/ડાબે + ICF Box ICF બૉક્સ + ICF Top/Right ICF ઉપર/જમણે + ID: {id} ID: {id} + Identify Objects By ઑબ્જેક્ટ્સ આ રીતે ઓળખો + If a drawing tablet's pen doesn't draw, choose an X11 (XWayland) option. જો ડ્રોઇંગ ટેબ્લેટની પેન દોરતી ન હોય, તો X11 (XWayland) વિકલ્પ પસંદ કરો. + Ignore અવગણો + Ignore All બધું અવગણો + Ignore Artboards (all the art as one page) આર્ટબોર્ડ અવગણો (બધી આર્ટ એક પેજ તરીકે) + Image ઇમેજ + Image Info ઇમેજ માહિતી + Image Map: ઇમેજ મેપ: + Image Size ઇમેજ સાઇઝ + Image Trace ઇમેજ ટ્રેસ + Image Trace (Make and Expand) ઇમેજ ટ્રેસ (બનાવો અને વિસ્તૃત કરો) + Image Trace Presets ઇમેજ ટ્રેસ પ્રીસેટ્સ + Image Trace Preview ઇમેજ ટ્રેસ પૂર્વાવલોકન + Image Trace View ઇમેજ ટ્રેસ દૃશ્ય + Image Tracing ઇમેજ ટ્રેસિંગ + Image: ઇમેજ: + Images ઇમેજ + Images: ઇમેજ: + Images: link to the file instead of only embedding it. ઇમેજ: ફક્ત એમ્બેડ કરવાને બદલે ફાઇલની લિંક. + Import Composite Fonts કમ્પોઝિટ ફોન્ટ્સ આયાત કરો + Import Data Sets… ડેટા સેટ આયાત કરો… + Import Data… ડેટા આયાત કરો… + Import Export Presets આયાત-નિકાસ પ્રીસેટ્સ + Import Keyboard Shortcuts… કીબોર્ડ શૉર્ટકટ આયાત કરો… + Import Library લાઇબ્રેરી આયાત કરો + Import Matches આયાત મેળ + Import PDF PDF આયાત કરો + Import PDF Presets PDF આયાત પ્રીસેટ્સ + Import Perspective Grid Presets પર્સ્પેક્ટિવ ગ્રિડ પ્રીસેટ્સ આયાત કરો + Import Preferences પસંદગીઓ આયાત કરો + Import Preferences… પસંદગીઓ આયાત કરો… + Import Preset… પ્રીસેટ આયાત કરો… + Import Print Presets પ્રિન્ટ પ્રીસેટ્સ આયાત કરો + Import SVG Filter SVG ફિલ્ટર આયાત કરો + Import SVG Filter… SVG ફિલ્ટર આયાત કરો… + Import Shortcut Set શૉર્ટકટ સેટ આયાત કરો + Import Shortcut Set… શૉર્ટકટ સેટ આયાત કરો… + Import Transparency Flattener Presets પારદર્શિતા ફ્લેટનર પ્રીસેટ્સ આયાત કરો + Imported. Press OK to keep the imported set. આયાત થયું. આયાત કરેલો સેટ રાખવા ઠીક દબાવો. + Import… આયાત કરો… + In Merge Mode, Clicking Stroke Splits the Path મર્જ મોડમાં, સ્ટ્રોક પર ક્લિક કરવાથી પાથ વિભાજિત થાય છે + In Tangent Handles ટેન્જન્ટ હેન્ડલમાં + In VectorCraft VectorCraft માં + In the File ફાઇલમાં + In the selected objects પસંદ કરેલી ઑબ્જેક્ટ્સમાં + Inches ઇંચ + Include Action Steps ઍક્શન સ્ટેપ્સ શામેલ કરો + Include Artboard Fill આર્ટબોર્ડ ભરણ શામેલ કરો + Include Bleed બ્લીડ શામેલ કરો + Include CMYK PostScript in RGB Files RGB ફાઇલોમાં CMYK PostScript શામેલ કરો + Include Document Thumbnails દસ્તાવેજ થંબનેલ્સ શામેલ કરો + Include Editing Data for Other Apps અન્ય ઍપ્સ માટે એડિટિંગ ડેટા શામેલ કરો + Include Hidden Layers છુપાયેલા લેયર શામેલ કરો + Include Linked Files લિંક કરેલી ફાઇલો શામેલ કરો + Include Metadata મેટાડેટા શામેલ કરો + Include Objects On Canvas કેનવાસ પરની ઑબ્જેક્ટ્સ શામેલ કરો + Include SVG Code SVG કોડ શામેલ કરો + Include Swatches for Tints ટિન્ટ માટે સ્વેચ શામેલ કરો + Include non-printing layers બિન-પ્રિન્ટિંગ લેયર શામેલ કરો + Includes શામેલ છે + Includes itself પોતાને શામેલ કરે છે + Increase Font Size ફોન્ટ સાઇઝ વધારો + Increase Font Size by Five Steps ફોન્ટ સાઇઝ પાંચ સ્ટેપ વધારો + Inflate ફુલાવો + Inflate… ફુલાવો… + Info માહિતી + Ink ઇંક + Ink Outlines… ઇંક આઉટલાઇન… + Inks ઇંક્સ + Inner Corner Tile આંતરિક કૉર્નર ટાઇલ + Inner Glow… ઇનર ગ્લો… + Inner Radius: આંતરિક ત્રિજ્યા: + Insert Break Character બ્રેક અક્ષર દાખલ કરો + Insert Character અક્ષર દાખલ કરો + Insert Inline Symbol ઇનલાઇન સિમ્બોલ દાખલ કરો + Insert Kashidas કાશીદા દાખલ કરો + Insert Special Character ખાસ અક્ષર દાખલ કરો + Insert Stop સ્ટોપ દાખલ કરો + Insert Whitespace Character ખાલી જગ્યાનો અક્ષર દાખલ કરો + Inside અંદર + Inspect Document દસ્તાવેજ તપાસો + Inspect Object ઑબ્જેક્ટ તપાસો + Inspect Plug-in પ્લગઇન તપાસો + Install Plug-in પ્લગઇન ઇન્સ્ટૉલ કરો + Install Plug-in… પ્લગઇન ઇન્સ્ટૉલ કરો… + Install “{name}” in place of the plug-in with the same ID? સમાન ID ધરાવતા પ્લગઇનની જગ્યાએ “{name}” ઇન્સ્ટૉલ કરીએ? + Install “{name}”, which asks for a heavy budget? “{name}” ઇન્સ્ટૉલ કરીએ, જેને ભારે બજેટની જરૂર છે? + Install “{name}”, which asks for these permissions? “{name}” ઇન્સ્ટૉલ કરીએ, જે આ પરવાનગીઓ માંગે છે? + Intensity તીવ્રતા + Intensity: તીવ્રતા: + Intent: ઇન્ટેન્ટ: + Interface Language ઇન્ટરફેસ ભાષા + Interlaced ઇન્ટરલેસ્ડ + Internet Standard RGB (sRGB) ઇન્ટરનેટ સ્ટાન્ડર્ડ RGB (sRGB) + Intersect છેદ + Intertwine ગૂંથો + Invalid panel layout; restored the default dock અમાન્ય પેનલ લેઆઉટ; ડિફોલ્ટ ડૉક પુનઃસ્થાપિત કર્યું + Inventory Icons ઇન્વેન્ટરી આઇકન + Inverse ઇન્વર્સ + Invert ઊલટાવો + Invert Colors રંગો ઊલટાવો + Invert Mask માસ્ક ઊલટાવો + Invert Pie પાઇ ઊલટાવો + Inverted Round ઊલટું ગોળ + Invoke Distance Guides ડિસ્ટન્સ ગાઇડ્સ ચાલુ કરો + Isolate અલગ કરો + Isolate Blending બ્લેન્ડિંગ અલગ કરો + Isolate Group ગ્રૂપ અલગ કરો + Isolate Selected Group પસંદ કરેલું ગ્રૂપ અલગ કરો + Isolate Selected Object પસંદ કરેલી ઑબ્જેક્ટ અલગ કરો + Isometric Bottom આઇસોમેટ્રિક નીચે + Isometric Left આઇસોમેટ્રિક ડાબે + Isometric Right આઇસોમેટ્રિક જમણે + Isometric Top આઇસોમેટ્રિક ઉપર + Issues fixed: {count} સુધારેલી સમસ્યાઓ: {count} + It may take minutes, so it runs in the background, where you can cancel it. તેમાં મિનિટો લાગી શકે છે, તેથી તે બૅકગ્રાઉન્ડમાં ચાલે છે, જ્યાં તમે તેને રદ કરી શકો છો. + Italian ઇટાલિયન + Italic ઇટાલિક + Its graphics, colors and text styles are deleted from this machine. આ મશીન પરથી તેના ગ્રાફિક્સ, રંગો અને ટેક્સ્ટ સ્ટાઇલ કાઢી નાખવામાં આવશે. + Japanese જાપાનીઝ + JavaScript Files JavaScript ફાઇલો + JavaScript: JavaScript: + Join જોડો + Join Our Discord અમારા Discord માં જોડાઓ + Join Point Text જોઇન્ટ પોઇન્ટ ટેક્સ્ટ + Join Tool જોઇન ટૂલ + Join our Discord અમારા Discord માં જોડાઓ + Join the ArtCraft community on Discord (discord.gg/artcraft) Discord (discord.gg/artcraft) પર ArtCraft સમુદાયમાં જોડાઓ + Join the lines of each paragraph દરેક ફકરાની લાઇનો જોડો + Justification જસ્ટિફિકેશન + Justification… જસ્ટિફિકેશન… + Justify Vertically ઊભું જસ્ટિફાય કરો + Justify all lines બધી લાઇન જસ્ટિફાય કરો + Justify with last line aligned left છેલ્લી લાઇન ડાબે સંરેખિત સાથે જસ્ટિફાય કરો + Kana કાના + Kanji કાંજી + Kannada કન્નડ + Kashidas કાશીદા + Keep Formatting ફોર્મેટિંગ રાખો + Keep Original મૂળ રાખો + Keep Plain Text સાદો ટેક્સ્ટ રાખો + Keep Shared Points Together વહેંચાયેલા પોઇન્ટ સાથે રાખો + Keep Tools Beside the Canvas ટૂલ્સ કેનવાસની બાજુમાં રાખો + Keep a cache of its own, which you can clear તેનું પોતાનું કેશ રાખો, જે તમે સાફ કરી શકો છો + Keep a link to an image file instead of only embedding it ઇમેજ ફાઇલને ફક્ત એમ્બેડ કરવાને બદલે તેની લિંક રાખો + Keep both sides the same width બંને બાજુ સમાન પહોળાઈ રાખો + Keep data of its own with the document દસ્તાવેજ સાથે પોતાનો ડેટા રાખો + Keep graphics, colors and text styles here to use them in any document. Libraries are stored on this machine — no account required. કોઈપણ દસ્તાવેજમાં વાપરવા માટે અહીં ગ્રાફિક્સ, રંગો અને ટેક્સ્ટ સ્ટાઇલ રાખો. લાઇબ્રેરીઓ આ મશીન પર સંગ્રહિત થાય છે — ખાતું જરૂરી નથી. + Keep selected પસંદ કરેલું રાખો + Keep settings of its own પોતાની સેટિંગ્સ રાખો + Keep this row's colors (exclude) આ પંક્તિના રંગ રાખો (બાકાત કરો) + Keep visible surfaces only when expanding વિસ્તૃત કરતી વખતે ફક્ત દેખાતી સપાટીઓ રાખો + Kerning કર્નિંગ + Key Color: કી રંગ: + Keyboard Increment કીબોર્ડ ઇન્ક્રીમેન્ટ + Keyboard Shortcut Conflicts કીબોર્ડ શૉર્ટકટ વિવાદો + Keyboard Shortcut Set કીબોર્ડ શૉર્ટકટ સેટ + Keyboard Shortcuts… કીબોર્ડ શૉર્ટકટ… + Keys કી + Keywords: કીવર્ડ્સ: + Kind પ્રકાર + Kinsoku Set Kinsoku Set + Kinsoku Shori Type Kinsoku Shori Type + Knife નાઇફ + Knockout Group નૉકઆઉટ ગ્રૂપ + LZW Compression LZW કમ્પ્રેશન + Lab Spot Colors: Lab સ્પોટ રંગો: + Landscape લેન્ડસ્કેપ + Language ભાષા + Language Options ભાષા વિકલ્પો + Language: ભાષા: + Large મોટું + Large Tabs મોટા ટૅબ + Largest: સૌથી મોટું: + Lasso Tool લાસો ટૂલ + Last છેલ્લું + Last Artboard છેલ્લું આર્ટબોર્ડ + Last Effect: {name} છેલ્લી ઇફેક્ટ: {name} + Last Effect… છેલ્લી ઇફેક્ટ… + Last Page છેલ્લું પેજ + Last commit છેલ્લો કમિટ + Latin લેટિન + Layer Options લેયર વિકલ્પો + Layer Options… લેયર વિકલ્પો… + Layers લેયર્સ + Layers Panel Options લેયર્સ પેનલ વિકલ્પો + Layout લેઆઉટ + Layout Order: લેઆઉટ ક્રમ: + Layout: લેઆઉટ: + Leading લીડિંગ + Leave Out of Global Edit ગ્લોબલ એડિટમાંથી બાકાત રાખો + Left ડાબે + Left Grid: ડાબો ગ્રિડ: + Left Indent ડાબો ઇન્ડેન્ટ + Left Indent: ડાબો ઇન્ડેન્ટ: + Left Plane ડાબું પ્લેન + Left to Right ડાબેથી જમણે + Left-Justified Tab ડાબે-જસ્ટિફાઇડ ટૅબ + Left-to-Right Paragraph Direction ડાબેથી જમણે ફકરાની દિશા + Left/Right: ડાબે/જમણે: + Left: ડાબે: + Legacy (version 7) લેગસી (વર્ઝન 7) + Legacy .ai Options લેગસી .ai વિકલ્પો + Legacy Macintosh RGB (Gamma 1.8) લેગસી Macintosh RGB (Gamma 1.8) + Legacy vector clipboard લેગસી વેક્ટર ક્લિપબોર્ડ + Legacy vector clipboard (no transparency) લેગસી વેક્ટર ક્લિપબોર્ડ (પારદર્શિતા વગર) + Length લંબાઈ + Length X-Axis: X-અક્ષ લંબાઈ: + Length Y-Axis: Y-અક્ષ લંબાઈ: + Less ઓછું + Letter Spacing: અક્ષર અંતર: + Level: સ્તર: + Levels… લેવલ્સ… + Libraries લાઇબ્રેરીઓ + Library લાઇબ્રેરી + Library Panel Options લાઇબ્રેરી પૅનલ વિકલ્પો + Library: લાઇબ્રેરી: + Ligatures are off while the text is tracked. ટ્રૅક થયેલા લખાણ દરમિયાન લિગેચર બંધ છે. + Light લાઇટ + Light Gray લાઇટ ગ્રે + Light Intensity લાઇટ તીવ્રતા + Light Rough લાઇટ રફ + Light behind the object ઑબ્જેક્ટની પાછળ લાઇટ + Lighten હળવું કરો + Lighting લાઇટિંગ + Lights લાઇટ્સ + Limit Color Guide to Library રંગ ગાઇડને લાઇબ્રેરી સુધી મર્યાદિત કરો + Limit colors to swatch library રંગોને સ્વેચ લાઇબ્રેરી સુધી મર્યાદિત કરો + Limit colors to swatch library: {name} રંગોને સ્વેચ લાઇબ્રેરી સુધી મર્યાદિત કરો: {name} + Limit to Library: લાઇબ્રેરી સુધી મર્યાદિત કરો: + Limit: મર્યાદા: + Limited મર્યાદિત + Line લાઇન + Line Art and Text Resolution: લાઇન આર્ટ અને લખાણ રિઝોલ્યુશન: + Line Breaks લાઇન બ્રેક + Line Color લાઇન રંગ + Line Cut લાઇન કટ + Line Cut Tool લાઇન કટ ટૂલ + Line Endings: લાઇનના અંત: + Line Graph Tool લાઇન ગ્રાફ ટૂલ + Line Segment લાઇન સેગમેન્ટ + Line Segment Tool લાઇન સેગમેન્ટ ટૂલ + Line Segment Tool Options લાઇન સેગમેન્ટ ટૂલ વિકલ્પો + Line delta લાઇન ડેલ્ટા + Line {line} લાઇન {line} + Line {line}: {name}: {status} લાઇન {line}: {name}: {status} + Line-end Punctuation Half Width લાઇન-અંતના વિરામચિહ્ન અર્ધ પહોળાઈ + Linear Gradient લીનિયર ગ્રેડિયન્ટ + Lines લાઇન્સ + Lines +/− લાઇન્સ +/− + Lines added ઉમેરાયેલી લાઇનો + Lines deleted કાઢી નાખેલી લાઇનો + Lines: clicks add points joined by a line લાઇન્સ: ક્લિક કરવાથી લાઇન વડે જોડાયેલા બિંદુઓ ઉમેરાય + Link લિંક + Link Block Series બ્લોક શ્રેણી લિંક કરો + Link Info લિંક માહિતી + Link JavaScript Files… JavaScript ફાઇલો લિંક કરો… + Link Opacity Mask ઓપેસિટી માસ્ક લિંક કરો + Link harmony colors હાર્મની રંગો લિંક કરો + Link start and end arrowhead scales શરૂઆત અને અંતના એરોહેડ સ્કેલ લિંક કરો + Link the mask માસ્ક લિંક કરો + Linked લિંક કરેલું + Linked File લિંક કરેલી ફાઇલ + Linked File Not Found લિંક કરેલી ફાઇલ મળી નથી + Linked Files લિંક કરેલી ફાઇલો + Links લિંક્સ + Linux Display Server Linux ડિસ્પ્લે સર્વર + Liquify લિક્વિફાઇ + List Data Sets ડેટા સેટની યાદી + List Folder ફોલ્ડરની યાદી + List Graphic Styles ગ્રાફિક સ્ટાઇલની યાદી + List Installed Scripts ઇન્સ્ટોલ થયેલી સ્ક્રિપ્ટની યાદી + List Keyboard Shortcuts કીબોર્ડ શૉર્ટકટની યાદી + List Patterns પેટર્નની યાદી + List Plug-ins પ્લગ-ઇનની યાદી + List Preferences પસંદગીઓની યાદી + List Slices સ્લાઇસની યાદી + List Toolbars ટૂલબારની યાદી + List Variables વેરિએબલની યાદી + List View યાદી દૃશ્ય + List Workspaces વર્કસ્પેસની યાદી + Live Paint લાઇવ પેઇન્ટ + Live Paint Bucket લાઇવ પેઇન્ટ બકેટ + Live Paint Bucket (Stroke) લાઇવ પેઇન્ટ બકેટ (સ્ટ્રોક) + Live Paint Info લાઇવ પેઇન્ટ માહિતી + Live Paint Selection Tool લાઇવ પેઇન્ટ પસંદગી ટૂલ + Live Shape લાઇવ શેપ + Live Shape Properties લાઇવ શેપ ગુણધર્મો + Live curve fitting લાઇવ કર્વ ફિટિંગ + Live preview લાઇવ પૂર્વાવલોકન + Load Actions… ઍક્શન લોડ કરો… + Load All Styles બધી સ્ટાઇલ લોડ કરો + Load All Styles… બધી સ્ટાઇલ લોડ કરો… + Load Character Styles કેરેક્ટર સ્ટાઇલ લોડ કરો + Load Character Styles… કેરેક્ટર સ્ટાઇલ લોડ કરો… + Load Color Profile… કલર પ્રોફાઇલ લોડ કરો… + Load EPS into Clipboard EPS ને ક્લિપબોર્ડમાં લોડ કરો + Load Image into Clipboard ઇમેજ ક્લિપબોર્ડમાં લોડ કરો + Load Metafile into Clipboard મેટાફાઇલ ક્લિપબોર્ડમાં લોડ કરો + Load PDF into Clipboard PDF ક્લિપબોર્ડમાં લોડ કરો + Load Paragraph Styles ફકરા સ્ટાઇલ લોડ કરો + Load Paragraph Styles… ફકરા સ્ટાઇલ લોડ કરો… + Load Place Cursor પ્લેસ કર્સર લોડ કરો + Load Profile… પ્રોફાઇલ લોડ કરો… + Load SVG into Clipboard SVG ને ક્લિપબોર્ડમાં લોડ કરો + Load Text into Clipboard લખાણ ક્લિપબોર્ડમાં લોડ કરો + Load Texture… ટેક્સ્ચર લોડ કરો… + Load Variable Library… વેરિએબલ લાઇબ્રેરી લોડ કરો… + Loads native code નેટિવ કોડ લોડ કરે છે + Local Libraries સ્થાનિક લાઇબ્રેરીઓ + Locate Library… લાઇબ્રેરી શોધો… + Locate Object ઑબ્જેક્ટ શોધો + Locate Selected Objects પસંદ કરેલા ઑબ્જેક્ટ શોધો + Location સ્થાન + Location: સ્થાન: + Lock લૉક + Lock (⌘2) લૉક (⌘2) + Lock All બધું લૉક કરો + Lock All Except Selected પસંદ કરેલા સિવાય બધું લૉક કરો + Lock Artboards આર્ટબોર્ડ લૉક કરો + Lock Grid ગ્રિડ લૉક કરો + Lock Guides ગાઇડ લૉક કરો + Lock Guides by Default ડિફૉલ્ટ રૂપે ગાઇડ લૉક કરો + Lock Others અન્ય લૉક કરો + Lock Selected પસંદ કરેલું લૉક કરો + Lock Slices સ્લાઇસ લૉક કરો + Lock Station Point સ્ટેશન પૉઇન્ટ લૉક કરો + Lock Variables વેરિએબલ લૉક કરો + Locked લૉક કરેલું + Long લાંબું + Longest: સૌથી લાંબું: + Lossless (lossy WebP isn't available yet) લોસલેસ (લોસી WebP હજી ઉપલબ્ધ નથી) + Lossy: લોસી: + Luminosity લ્યુમિનોસિટી + Magic Wand મૅજિક વૅન્ડ + Magic Wand Options મૅજિક વૅન્ડ વિકલ્પો + Magic Wand Settings મૅજિક વૅન્ડ સેટિંગ્સ + Magic Wand Tool મૅજિક વૅન્ડ ટૂલ + Maintain Envelope Shape એન્વેલપનો આકાર જાળવો + Make બનાવો + Make Blend બ્લેન્ડ બનાવો + Make Clipping Mask ક્લિપિંગ માસ્ક બનાવો + Make Compound Path કમ્પાઉન્ડ પાથ બનાવો + Make Compound Shape કમ્પાઉન્ડ શેપ બનાવો + Make Corner કૉર્નર બનાવો + Make Dynamic ડાયનેમિક બનાવો + Make Envelope એન્વેલપ બનાવો + Make Graph Dynamic ગ્રાફ ડાયનેમિક બનાવો + Make Guides ગાઇડ બનાવો + Make Image Dynamic ઇમેજ ડાયનેમિક બનાવો + Make Intertwine ઇન્ટરટ્વાઇન બનાવો + Make Live Paint લાઇવ પેઇન્ટ બનાવો + Make Mask માસ્ક બનાવો + Make Opacity Mask ઓપેસિટી માસ્ક બનાવો + Make Pattern પેટર્ન બનાવો + Make Pixel Perfect પિક્સેલ પરફેક્ટ બનાવો + Make Sides Equal બાજુઓ સરખી બનાવો + Make Slice સ્લાઇસ બનાવો + Make Smooth સ્મૂથ બનાવો + Make Text Dynamic લખાણ ડાયનેમિક બનાવો + Make Text Wrap લખાણ રૅપ બનાવો + Make Visibility Dynamic દૃશ્યતા ડાયનેમિક બનાવો + Make Visible દૃશ્યમાન બનાવો + Make a theme on Create and save it. થીમ બનાવીને તેને સાચવો. + Make all bleed settings the same બધી બ્લીડ સેટિંગ્સ સરખી બનાવો + Make and Expand બનાવો અને વિસ્તૃત કરો + Make the bleed values differ બ્લીડ મૂલ્યો અલગ બનાવો + Make with Mesh… મેશ વડે બનાવો… + Make with Top Object ટોચના ઑબ્જેક્ટ વડે બનાવો + Make with Warp… વૉર્પ વડે બનાવો… + Make/Release Clipping Mask ક્લિપિંગ માસ્ક બનાવો/છોડો + Malayalam મલયાલમ + Manage Toolbars ટૂલબાર સંચાલિત કરો + Manage Toolbars… ટૂલબાર સંચાલિત કરો… + Manage Workspaces વર્કસ્પેસ સંચાલિત કરો + Manage Workspaces… વર્કસ્પેસ સંચાલિત કરો… + Manually જાતે + Map Markers મૅપ માર્કર + Marathi મરાઠી + Mark Older Files as [Converted] When Opened ખોલતી વખતે જૂની ફાઇલોને [Converted] તરીકે ચિહ્નિત કરો + Mark as trapped ટ્રૅપ થયેલું તરીકે ચિહ્નિત કરો + Marker… માર્કર… + Marks ચિહ્નો + Marquee Selection માર્કી પસંદગી + Mask માસ્ક + Match મેળ + Match User Interface Brightness યુઝર ઇન્ટરફેસની તેજસ્વિતા સરખી કરો + Materials… મટીરિયલ્સ… + Matte: મેટ: + Maximize મોટું કરો + Maximum મહત્તમ + Maximum Editability મહત્તમ સંપાદનક્ષમતા + Maximum angle મહત્તમ ખૂણો + Maximum: મહત્તમ: + Measure & Inspect માપ અને તપાસ + Measure & Inspect Tool માપ અને તપાસ ટૂલ + Measure Tool માપ ટૂલ + Measure Type by Glyph Bounds ગ્લિફ સીમા દ્વારા ટાઇપ માપો + Measurement Labels માપ લેબલ + Media મીડિયા + Medium મધ્યમ + Medium Dark મધ્યમ ઘેરો + Medium Gray મધ્યમ ગ્રે + Medium Light મધ્યમ હળવો + Menu Dialog મેનુ સંવાદ + Menu commands મેનુ આદેશો + Merge મર્જ કરો + Merge Graphic Styles ગ્રાફિક સ્ટાઇલ મર્જ કરો + Merge Graphic Styles… ગ્રાફિક સ્ટાઇલ મર્જ કરો… + Merge Layers લેયર મર્જ કરો + Merge Live Paint લાઇવ પેઇન્ટ મર્જ કરો + Merge Selected પસંદ કરેલું મર્જ કરો + Merge Shared Edge શેર કરેલી કિનાર મર્જ કરો + Merge Swatches સ્વેચ મર્જ કરો + Merge colors into one row રંગોને એક હરોળમાં મર્જ કરો + Merge only with selection માત્ર પસંદગી સાથે મર્જ કરો + Merged PRs મર્જ થયેલા PR + Mesh Point Color મેશ બિંદુનો રંગ + Mesh Tool મેશ ટૂલ + Message: સંદેશ: + Metadata: મેટાડેટા: + Metallic Gradients મેટાલિક ગ્રેડિયન્ટ + Meters મીટર + Method: પદ્ધતિ: + Mezzotint… મેઝોટિન્ટ… + Millimeters મિલીમીટર + Minify નાનું કરો + Minimize નાનું કરો + Minimum ન્યૂનતમ + Minimum angle ન્યૂનતમ ખૂણો + Minimum must not exceed Desired, nor Desired Maximum. ન્યૂનતમ, ઇચ્છિત કે ઇચ્છિત મહત્તમ કરતાં વધારે ન હોઈ શકે. + Minimum: ન્યૂનતમ: + Minus Back માઇનસ બૅક + Minus Front માઇનસ ફ્રન્ટ + Mirror મિરર + Mirror & Cut મિરર અને કટ + Mirror & Cut Tool મિરર અને કટ ટૂલ + Mirror Repeat મિરર રિપીટ + Missing ગુમ + Missing Fonts ગુમ ફૉન્ટ + Missing Fonts Dialog ગુમ ફૉન્ટ સંવાદ + Missing: {path} ગુમ: {path} + Miter માઇટર + Miter Join માઇટર જોઇન + Mixed મિશ્ર + Mixed Appearances મિશ્ર દેખાવ + Mixed line endings મિશ્ર લાઇન અંત + Mode: મોડ: + Model મૉડેલ + Models મૉડેલ્સ + Modern મૉડર્ન + Modified સુધારેલું + Modified since it was read: {path} વાંચ્યા પછી સુધારેલું: {path} + Modified: સુધારેલું: + Modify સુધારો + Mojikumi Set મોજીકુમી સેટ + Monitor RGB મૉનિટર RGB + Mono મોનો + Monochrome images મોનોક્રોમ ઇમેજ + Monospaced મોનોસ્પેસ્ડ + More વધુ + More Align options વધુ સંરેખણ વિકલ્પો + More Options વધુ વિકલ્પો + More Paragraph options વધુ ફકરા વિકલ્પો + More Pathfinder options વધુ પાથફાઇન્ડર વિકલ્પો + More Settings વધુ સેટિંગ્સ + Mosaic Tiles… મોઝેક ટાઇલ્સ… + Move ખસેડો + Move Anchor Point એન્કર બિંદુ ખસેડો + Move Anchors એન્કર ખસેડો + Move Appearance દેખાવ ખસેડો + Move Artboard આર્ટબોર્ડ ખસેડો + Move Artboard Up/Down આર્ટબોર્ડ ઉપર/નીચે ખસેડો + Move Artwork with Artboard આર્ટબોર્ડ સાથે આર્ટવર્ક ખસેડો + Move Brush બ્રશ ખસેડો + Move Direction Handle દિશા હૅન્ડલ ખસેડો + Move Document દસ્તાવેજ ખસેડો + Move Down નીચે ખસેડો + Move Effect ઇફેક્ટ ખસેડો + Move Envelope Mesh Point એન્વેલપ મેશ બિંદુ ખસેડો + Move Envelope Point એન્વેલપ બિંદુ ખસેડો + Move Graphic Style ગ્રાફિક સ્ટાઇલ ખસેડો + Move Guide ગાઇડ ખસેડો + Move Guide to Layer ગાઇડ લેયરમાં ખસેડો + Move Library Group લાઇબ્રેરી ગ્રૂપ ખસેડો + Move Library Item to Group લાઇબ્રેરી આઇટમ ગ્રૂપમાં ખસેડો + Move Locked and Hidden Artwork with Artboard લૉક અને છુપાયેલું આર્ટવર્ક આર્ટબોર્ડ સાથે ખસેડો + Move Mesh Point મેશ બિંદુ ખસેડો + Move Mesh Points મેશ બિંદુઓ ખસેડો + Move Panel પૅનલ ખસેડો + Move Plane પ્લેન ખસેડો + Move Plane and Copy Objects પ્લેન ખસેડો અને ઑબ્જેક્ટની નકલ કરો + Move Plane and Objects પ્લેન અને ઑબ્જેક્ટ ખસેડો + Move Plane to Match Object ઑબ્જેક્ટ સાથે મેળ ખાય તે રીતે પ્લેન ખસેડો + Move Rows હરોળ ખસેડો + Move Slice સ્લાઇસ ખસેડો + Move Slices સ્લાઇસ ખસેડો + Move Spine Point સ્પાઇન બિંદુ ખસેડો + Move Swatch સ્વેચ ખસેડો + Move Type Path Handle ટાઇપ પાથ હૅન્ડલ ખસેડો + Move Type on a Path પાથ પર ટાઇપ ખસેડો + Move Up ઉપર ખસેડો + Move in Perspective પર્સ્પેક્ટિવમાં ખસેડો + Move to Group ગ્રૂપમાં ખસેડો + Move… ખસેડો… + Multiple Files અનેક ફાઇલો + Multiple objects અનેક ઑબ્જેક્ટ + Multiply ગુણાકાર + My Themes મારી થીમ + NTSC Colors NTSC રંગો + Name નામ + Name (A–Z) નામ (A–Z) + Name: નામ: + Names the script builds as it runs: {count} સ્ક્રિપ્ટ ચાલતી વખતે બનાવે છે તે નામ: {count} + Navigate નેવિગેટ કરો + Navigator નેવિગેટર + Navigator Panel Options નેવિગેટર પૅનલ વિકલ્પો + Needs Attention Only માત્ર ધ્યાન માગતા + Needs a choice પસંદગી જરૂરી + Needs a key કીની જરૂર છે + Needs dialogs સંવાદોની જરૂર છે + Needs features only the reference app has માત્ર સંદર્ભ એપમાં હોય તેવી સુવિધાઓ જોઈએ + Needs files ફાઇલો જોઈએ + Needs menu commands મેનુ આદેશો જોઈએ + Needs nothing beyond plain JavaScript સાદા JavaScript સિવાય કશું જોઈતું નથી + Needs the desktop app ડેસ્કટૉપ એપ જોઈએ + Needs the document model દસ્તાવેજ મૉડેલ જોઈએ + Needs the script language's own objects or directives સ્ક્રિપ્ટ ભાષાના પોતાના ઑબ્જેક્ટ કે નિર્દેશો જોઈએ + Neon Glow… નિયોન ગ્લો… + Nesting too deep to follow અનુસરવા માટે નેસ્ટિંગ ખૂબ ઊંડું + Neutral Gradients ન્યુટ્રલ ગ્રેડિયન્ટ + New નવું + New Action નવી ઍક્શન + New Art Appearance નવો આર્ટ દેખાવ + New Art Has Basic Appearance નવા આર્ટમાં મૂળભૂત દેખાવ + New Artboard નવું આર્ટબોર્ડ + New Artboard Options… નવા આર્ટબોર્ડ વિકલ્પો… + New Brush નવો બ્રશ + New Brush… નવો બ્રશ… + New Character Style નવી કેરેક્ટર સ્ટાઇલ + New Character Style… નવી કેરેક્ટર સ્ટાઇલ… + New Color Group નવો રંગ ગ્રૂપ + New Color Group… નવો રંગ ગ્રૂપ… + New Data Set નવો ડેટા સેટ + New Data Set… નવો ડેટા સેટ… + New Design નવી ડિઝાઇન + New Document Presets નવા દસ્તાવેજ પ્રીસેટ + New Document from State સ્ટેટમાંથી નવો દસ્તાવેજ + New Graphic Style નવી ગ્રાફિક સ્ટાઇલ + New Graphic Style (Alt-click to name it) નવી ગ્રાફિક સ્ટાઇલ (નામ આપવા Alt-ક્લિક કરો) + New Graphic Style… નવી ગ્રાફિક સ્ટાઇલ… + New Group નવું ગ્રૂપ + New Guide નવી ગાઇડ + New Layer નવું લેયર + New Layer Options… નવા લેયર વિકલ્પો… + New Layer… નવું લેયર… + New Library Group નવું લાઇબ્રેરી ગ્રૂપ + New Name નવું નામ + New Opacity Masks Are Clipping નવા ઓપેસિટી માસ્ક ક્લિપિંગ છે + New Opacity Masks Are Inverted નવા ઓપેસિટી માસ્ક ઊલટા છે + New PDF Preset નવો PDF પ્રીસેટ + New Paragraph Style નવી ફકરા સ્ટાઇલ + New Paragraph Style… નવી ફકરા સ્ટાઇલ… + New Print Preset નવો પ્રિન્ટ પ્રીસેટ + New SVG Filter નવું SVG ફિલ્ટર + New Set નવો સેટ + New Sublayer નવું સબલેયર + New Sublayer… નવું સબલેયર… + New Swatch નવો સ્વેચ + New Swatch… નવો સ્વેચ… + New Symbol નવું સિમ્બોલ + New Symbols from Layers લેયરમાંથી નવા સિમ્બોલ + New Symbol… નવું સિમ્બોલ… + New Toolbar નવું ટૂલબાર + New Toolbar… નવું ટૂલબાર… + New Variable નવો વેરિએબલ + New Variable… નવો વેરિએબલ… + New View નવું દૃશ્ય + New View… નવું દૃશ્ય… + New Window નવી વિન્ડો + New Without Dialog સંવાદ વિના નવું + New Workspace નવી વર્કસ્પેસ + New Workspace… નવી વર્કસ્પેસ… + New file નવી ફાઇલ + New from Template… ટેમ્પ્લેટમાંથી નવું… + New theme from the current color હાલના રંગમાંથી નવી થીમ + New… નવું… + Next આગળ + Next Artboard આગળનું આર્ટબોર્ડ + Next Data Set આગળનો ડેટા સેટ + Next Document આગળનો દસ્તાવેજ + Next Object Above ઉપરનું આગળનું ઑબ્જેક્ટ + Next Object Below નીચેનું આગળનું ઑબ્જેક્ટ + Next Page આગળનું પેજ + Next Segment આગળનો સેગમેન્ટ + Next page આગળનું પેજ + No ના + No Break બ્રેક નહીં + No CSS CSS નથી + No Document કોઈ દસ્તાવેજ નથી + No Selection કોઈ પસંદગી નથી + No Shading શેડિંગ નથી + No Suggestions કોઈ સૂચનો નથી + No alternates for the selected character. પસંદ કરેલા અક્ષર માટે કોઈ વિકલ્પ નથી. + No artboards match. કોઈ આર્ટબોર્ડ મેળ ખાતું નથી. + No assets કોઈ ઍસેટ નથી + No assets yet. Collect art with Object › Collect for Export, or drag it into the Asset Export panel. હજી કોઈ ઍસેટ નથી. Object › Collect for Export વડે આર્ટ એકત્ર કરો, અથવા તેને Asset Export પૅનલમાં ખેંચો. + No colors to recolor (preserved colors are left out). ફરીથી રંગ આપવા કોઈ રંગ નથી (સાચવેલા રંગ બાકાત છે). + No contributor data was built into this copy. આ નકલમાં કોઈ યોગદાનકર્તા ડેટા સામેલ નથી. + No document કોઈ દસ્તાવેજ નથી + No document open કોઈ દસ્તાવેજ ખુલ્લો નથી + No document open. કોઈ દસ્તાવેજ ખુલ્લો નથી. + No equivalent સમકક્ષ નથી + No filter plug-ins installed કોઈ ફિલ્ટર પ્લગ-ઇન ઇન્સ્ટોલ નથી + No fonts are available. કોઈ ફૉન્ટ ઉપલબ્ધ નથી. + No gradient swatches કોઈ ગ્રેડિયન્ટ સ્વેચ નથી + No graphic styles કોઈ ગ્રાફિક સ્ટાઇલ નથી + No images કોઈ ઇમેજ નથી + No images match. કોઈ ઇમેજ મેળ ખાતી નથી. + No importer plug-ins installed કોઈ ઇમ્પોર્ટર પ્લગ-ઇન ઇન્સ્ટોલ નથી + No issues found. કોઈ સમસ્યા મળી નથી. + No items in this library match “{query}”. આ લાઇબ્રેરીમાં “{query}” સાથે મેળ ખાતી કોઈ આઇટમ નથી. + No model credits were built into this copy. આ નકલમાં કોઈ મૉડેલ ક્રેડિટ સામેલ નથી. + No options કોઈ વિકલ્પ નથી + No plug-ins are disabled. કોઈ પ્લગ-ઇન બંધ નથી. + No printer settings to open here અહીં ખોલવા માટે પ્રિન્ટર સેટિંગ્સ નથી + No results કોઈ પરિણામ નથી + No saved themes કોઈ સાચવેલી થીમ નથી + No selection કોઈ પસંદગી નથી + No settings found કોઈ સેટિંગ્સ મળી નથી + No text selected કોઈ લખાણ પસંદ નથી + Nonbreaking Hyphen નૉન-બ્રેકિંગ હાઇફન + Nonbreaking Space નૉન-બ્રેકિંગ સ્પેસ + None કંઈ નહીં + None. કંઈ નહીં. + Normal સામાન્ય + Normal Screen Mode સામાન્ય સ્ક્રીન મોડ + Norwegian નોર્વેજિયન + Not a script for the reference app સંદર્ભ એપ માટેની સ્ક્રિપ્ટ નથી + Not followed: outside the script's folder અનુસરાયું નથી: સ્ક્રિપ્ટના ફોલ્ડરની બહાર + Not found મળ્યું નથી + Not read વાંચ્યું નથી + Not read: a limit was reached વાંચ્યું નથી: મર્યાદા પહોંચી + Not valid UTF-8: unreadable bytes were replaced માન્ય UTF-8 નથી: ન વંચાતા બાઇટ બદલાયા + Note Paper… નોટ પેપર… + Note: નોંધ: + Nothing matches the Show filter. Show ફિલ્ટર સાથે કંઈ મેળ ખાતું નથી. + Nothing to print છાપવા માટે કંઈ નથી + Nudge નજ + Nudge in Perspective પર્સ્પેક્ટિવમાં નજ + Number Style: અંક શૈલી: + Number of Artboards: આર્ટબોર્ડની સંખ્યા: + Number of Colors: રંગોની સંખ્યા: + Number of Decimals: દશાંશની સંખ્યા: + Number of Recent Files to Display દર્શાવવાની તાજેતરની ફાઇલોની સંખ્યા + Number of Recent Fonts તાજેતરના ફૉન્ટની સંખ્યા + Number: નંબર: + Numbered List ક્રમાંકિત યાદી + Numbers અંકો + Numbers Without Units Are Points એકમ વગરના અંક પૉઇન્ટ ગણાય + Numerals અંકો + OK ઠીક + Object ઑબ્જેક્ટ + Object Highlighting ઑબ્જેક્ટ હાઇલાઇટિંગ + Object IDs: ઑબ્જેક્ટ ID: + Object Name ઑબ્જેક્ટનું નામ + Object Properties ઑબ્જેક્ટ ગુણધર્મો + Object Selection by Path Only માત્ર પાથ દ્વારા ઑબ્જેક્ટ પસંદગી + Object types: {names} ઑબ્જેક્ટ પ્રકાર: {names} + Objects ઑબ્જેક્ટ્સ + Objects on Path પાથ પરના ઑબ્જેક્ટ + Objects on Path Options પાથ પરના ઑબ્જેક્ટ વિકલ્પો + Objects on Path Tool પાથ પરના ઑબ્જેક્ટ ટૂલ + Objects using them keep their look but are no longer linked. તેમનો ઉપયોગ કરતા ઑબ્જેક્ટ તેમનો દેખાવ જાળવે છે પણ હવે લિંક નથી. + Objects with Color Effects રંગ અસર ધરાવતા ઑબ્જેક્ટ + Objects with Spot Colors સ્પૉટ રંગ ધરાવતા ઑબ્જેક્ટ + Ocean Ripple… ઓશન રિપલ… + Odia ઓડિયા + Off બંધ + Off-Axis Back ઑફ-ઍક્સિસ બૅક + Off-Axis Bottom ઑફ-ઍક્સિસ બૉટમ + Off-Axis Front ઑફ-ઍક્સિસ ફ્રન્ટ + Off-Axis Left ઑફ-ઍક્સિસ ડાબે + Off-Axis Right ઑફ-ઍક્સિસ જમણે + Off-Axis Top ઓફ-એક્સિસ ટોપ + Off: an editable copy of its art, embedded in this document. બંધ: આ દસ્તાવેજમાં સમાવિષ્ટ, તેની કલાની સંપાદનયોગ્ય નકલ. + Offset ઓફસેટ + Offset Path ઓફસેટ પાથ + Offset Path… ઓફસેટ પાથ… + Offset: ઓફસેટ: + Ogee ઓજી + Omit બાકાત રાખો + On ચાલુ + On Artboards આર્ટબોર્ડ પર + On Copy નકલ વખતે + On Paste ચોંટાડતી વખતે + On Screen સ્ક્રીન પર + On: one locked object showing the document, updated when it changes. ચાલુ: દસ્તાવેજ બતાવતી એક લૉક કરેલી ઑબ્જેક્ટ, જે બદલાય ત્યારે અપડેટ થાય છે. + One Point વન પોઇન્ટ + One Point Perspective વન પોઇન્ટ પરસ્પેક્ટિવ + One Point Perspective Preset 1 વન પોઇન્ટ પરસ્પેક્ટિવ પ્રીસેટ 1 + One Point Perspective Preset 2 વન પોઇન્ટ પરસ્પેક્ટિવ પ્રીસેટ 2 + One Point Perspective Preset 3 વન પોઇન્ટ પરસ્પેક્ટિવ પ્રીસેટ 3 + One Point Perspective Preset 4 વન પોઇન્ટ પરસ્પેક્ટિવ પ્રીસેટ 4 + One Point Perspective Preset 5 વન પોઇન્ટ પરસ્પેક્ટિવ પ્રીસેટ 5 + One file per artboard: -.{ext} દરેક આર્ટબોર્ડ માટે એક ફાઇલ: -.{ext} + One or more of the symbols are in use and cannot be deleted until their instances are expanded or deleted. એક કે વધુ સિમ્બોલ ઉપયોગમાં છે, અને તેમના ઇન્સ્ટન્સ વિસ્તૃત કરાય અથવા કાઢી નખાય ત્યાં સુધી તે કાઢી શકાશે નહીં. + One page per artboard. દરેક આર્ટબોર્ડ માટે એક પેજ. + Only Web Colors માત્ર વેબ રંગો + Opacity અપારદર્શકતા + Opacity & Mask Define Knockout Shape અપારદર્શકતા અને માસ્ક નૉકઆઉટ આકાર વ્યાખ્યાયિત કરે છે + Opacity Mask Info અપારદર્શકતા માસ્ક માહિતી + Opacity Mask Options અપારદર્શકતા માસ્ક વિકલ્પો + Opacity: અપારદર્શકતા: + Opacity: {value} અપારદર્શકતા: {value} + Opaque અપારદર્શક + Open ખોલો + Open Document દસ્તાવેજ ખોલો + Open Documents As Tabs દસ્તાવેજો ટેબ તરીકે ખોલો + Open Graphic Style Library ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી ખોલો + Open Location after Export નિકાસ પછી સ્થાન ખોલો + Open Paths ખુલ્લા પાથ + Open Recent File 1 તાજેતરની ફાઇલ 1 ખોલો + Open Recent File 10 તાજેતરની ફાઇલ 10 ખોલો + Open Recent File 11 તાજેતરની ફાઇલ 11 ખોલો + Open Recent File 12 તાજેતરની ફાઇલ 12 ખોલો + Open Recent File 13 તાજેતરની ફાઇલ 13 ખોલો + Open Recent File 14 તાજેતરની ફાઇલ 14 ખોલો + Open Recent File 15 તાજેતરની ફાઇલ 15 ખોલો + Open Recent File 16 તાજેતરની ફાઇલ 16 ખોલો + Open Recent File 17 તાજેતરની ફાઇલ 17 ખોલો + Open Recent File 18 તાજેતરની ફાઇલ 18 ખોલો + Open Recent File 19 તાજેતરની ફાઇલ 19 ખોલો + Open Recent File 2 તાજેતરની ફાઇલ 2 ખોલો + Open Recent File 20 તાજેતરની ફાઇલ 20 ખોલો + Open Recent File 21 તાજેતરની ફાઇલ 21 ખોલો + Open Recent File 22 તાજેતરની ફાઇલ 22 ખોલો + Open Recent File 23 તાજેતરની ફાઇલ 23 ખોલો + Open Recent File 24 તાજેતરની ફાઇલ 24 ખોલો + Open Recent File 25 તાજેતરની ફાઇલ 25 ખોલો + Open Recent File 26 તાજેતરની ફાઇલ 26 ખોલો + Open Recent File 27 તાજેતરની ફાઇલ 27 ખોલો + Open Recent File 28 તાજેતરની ફાઇલ 28 ખોલો + Open Recent File 29 તાજેતરની ફાઇલ 29 ખોલો + Open Recent File 3 તાજેતરની ફાઇલ 3 ખોલો + Open Recent File 30 તાજેતરની ફાઇલ 30 ખોલો + Open Recent File 4 તાજેતરની ફાઇલ 4 ખોલો + Open Recent File 5 તાજેતરની ફાઇલ 5 ખોલો + Open Recent File 6 તાજેતરની ફાઇલ 6 ખોલો + Open Recent File 7 તાજેતરની ફાઇલ 7 ખોલો + Open Recent File 8 તાજેતરની ફાઇલ 8 ખોલો + Open Recent File 9 તાજેતરની ફાઇલ 9 ખોલો + Open Recent Files તાજેતરની ફાઇલો ખોલો + Open Swatch Library સ્વેચ લાઇબ્રેરી ખોલો + Open With આ વડે ખોલો + Open a document to check it for issues. સમસ્યાઓ માટે તપાસવા દસ્તાવેજ ખોલો. + Open a document to draw parametric shapes. પેરામેટ્રિક આકારો દોરવા માટે દસ્તાવેજ ખોલો. + Open a document to draw with the Smart Pen. સ્માર્ટ પેન વડે દોરવા માટે દસ્તાવેજ ખોલો. + Open a document to edit its anchor points. તેના એન્કર પોઇન્ટ સંપાદિત કરવા દસ્તાવેજ ખોલો. + Open a document to edit its patterns. તેના પેટર્ન સંપાદિત કરવા દસ્તાવેજ ખોલો. + Open a document to navigate it. તેમાં નેવિગેટ કરવા દસ્તાવેજ ખોલો. + Open a document to preview its flattening. તેના ફ્લેટનિંગનું પૂર્વાવલોકન કરવા દસ્તાવેજ ખોલો. + Open a document to preview its pages તેના પેજનું પૂર્વાવલોકન કરવા દસ્તાવેજ ખોલો + Open a document to see its artboards. તેના આર્ટબોર્ડ જોવા દસ્તાવેજ ખોલો. + Open a document to see its graphic styles. તેની ગ્રાફિક સ્ટાઇલ જોવા દસ્તાવેજ ખોલો. + Open a document to see its history. તેનો ઇતિહાસ જોવા દસ્તાવેજ ખોલો. + Open a document to see its swatches. તેના સ્વેચ જોવા દસ્તાવેજ ખોલો. + Open password: ખોલવાનો પાસવર્ડ: + Open the URL in the web browser વેબ બ્રાઉઝરમાં URL ખોલો + Open this dialog with these settings next time આવતી વખતે આ સેટિંગ્સ સાથે આ ડાયલોગ ખોલો + Open this setting's help page આ સેટિંગનું મદદ પેજ ખોલો + OpenType OpenType + OpenType Features OpenType ફીચર્સ + Opening it left out what VectorCraft can't read yet ({what}), so replacing it loses that for good. Save under another name to keep it. ખોલતી વખતે VectorCraft હજી વાંચી ન શકે તે ({what}) છોડી દેવાયું, તેથી તેને બદલવાથી તે કાયમ માટે ખોવાઈ જશે. તેને રાખવા માટે બીજા નામથી સાચવો. + Opens files in other apps અન્ય ઍપમાં ફાઇલો ખોલે છે + Opens network connections નેટવર્ક કનેક્શન ખોલે છે + Open… ખોલો… + Optical ઓપ્ટિકલ + Optical Margin Alignment ઓપ્ટિકલ માર્જિન એલાઇનમેન્ટ + Optimize for fast web view ઝડપી વેબ વ્યૂ માટે ઑપ્ટિમાઇઝ કરો + Optimized ઑપ્ટિમાઇઝ્ડ + Options વિકલ્પો + Options for Selection… પસંદગી માટેના વિકલ્પો… + Options: વિકલ્પો: + Options… વિકલ્પો… + Order: ક્રમ: + Ordinals ક્રમવાચક સંખ્યાઓ + Orientation અભિમુખતા + Orientation: અભિમુખતા: + Original મૂળ + Original: click to restore મૂળ: પુનઃસ્થાપિત કરવા ક્લિક કરો + Other અન્ય + Other Layers અન્ય લેયર + Other Library… અન્ય લાઇબ્રેરી… + Other Script… અન્ય સ્ક્રિપ્ટ… + Out Tangent Handles આઉટ ટેન્જન્ટ હેન્ડલ્સ + Out of fuel ઇંધણ ખતમ + Outer Corner Tile બહારની કોર્નર ટાઇલ + Outer Glow… બહારની ઝગમગાટ… + Outline આઉટલાઇન + Outline Object ઑબ્જેક્ટની આઉટલાઇન + Outline Others અન્યની આઉટલાઇન + Outline Stroke સ્ટ્રોકની આઉટલાઇન + Outline Text ટેક્સ્ટની આઉટલાઇન + Outlines આઉટલાઇન્સ + Outlines and Rules આઉટલાઇન અને નિયમો + Output All Blacks Accurately બધા બ્લેક ચોક્કસપણે આઉટપુટ કરો + Output All Blacks as Rich Black બધા બ્લેકને રિચ બ્લેક તરીકે આઉટપુટ કરો + Output Intent આઉટપુટ ઇન્ટેન્ટ + Output condition: આઉટપુટ સ્થિતિ: + Output intent profile: આઉટપુટ ઇન્ટેન્ટ પ્રોફાઇલ: + Output: આઉટપુટ: + Outside બહાર + Outside the document દસ્તાવેજની બહાર + Overlap ઓવરલેપ + Overlap: ઓવરલેપ: + Overlay ઓવરલે + Overprint ઓવરપ્રિન્ટ + Overprint Black ઓવરપ્રિન્ટ બ્લેક + Overprint Black… ઓવરપ્રિન્ટ બ્લેક… + Overprint Fill ઓવરપ્રિન્ટ ભરો + Overprint Preview ઓવરપ્રિન્ટ પૂર્વાવલોકન + Overprint Preview (separations) ઓવરપ્રિન્ટ પૂર્વાવલોકન (વિભાજન) + Overprint Stroke ઓવરપ્રિન્ટ સ્ટ્રોક + Overprint and Transparency Flattener ઓવરપ્રિન્ટ અને પારદર્શિતા ફ્લેટનર + Overprint and Transparency Flattener Options ઓવરપ્રિન્ટ અને પારદર્શિતા ફ્લેટનર વિકલ્પો + Overprint: ઓવરપ્રિન્ટ: + Overprints: ઓવરપ્રિન્ટ્સ: + Override Character Color અક્ષરનો રંગ ઓવરરાઇડ કરો + Overrides ઓવરરાઇડ્સ + PDF PDF + PDF 1.3 files have no transparency: the preset flattens it. PDF 1.3 ફાઇલોમાં પારદર્શિતા નથી: પ્રીસેટ તેને ફ્લેટ કરે છે. + PDF Info PDF માહિતી + PDF Preset PDF પ્રીસેટ + PDF Preset: PDF પ્રીસેટ: + PDF Presets PDF પ્રીસેટ્સ + PDF Presets… PDF પ્રીસેટ્સ… + PDF Settings PDF સેટિંગ્સ + PDF-compatible PDF-સુસંગત + PDF/A files carry their own output intent. PDF/A ફાઇલોમાં તેનો પોતાનો આઉટપુટ ઇન્ટેન્ટ હોય છે. + PDF/X-1a files are CMYK: every colour is converted to the destination (blank: the output intent's CMYK profile), untagged. PDF/X-1a ફાઇલો CMYK છે: દરેક રંગ ગંતવ્યમાં રૂપાંતરિત થાય છે (ખાલી: આઉટપુટ ઇન્ટેન્ટની CMYK પ્રોફાઇલ), ટૅગ વગરની. + PPI PPI + PRESET DETAILS પ્રીસેટની વિગતો + Package પેકેજ + Package collects a saved document with its linked files and fonts. પેકેજ સાચવેલા દસ્તાવેજને તેની લિંક કરેલી ફાઇલો અને ફોન્ટ સાથે એકત્ર કરે છે. + Package created પેકેજ બનાવ્યું + Package… પેકેજ… + Page પેજ + Page Isolated Blending પેજ આઇસોલેટેડ બ્લેન્ડિંગ + Page Knockout Group પેજ નૉકઆઉટ ગ્રૂપ + Pages પેજ + Paint Daubs… પેઇન્ટ ડૉબ્સ… + Paint Fills પેઇન્ટ ભરો + Paint Stops At: પેઇન્ટ અહીં અટકે છે: + Paint Strokes પેઇન્ટ સ્ટ્રોક + Paintbrush પેઇન્ટબ્રશ + Paintbrush Tool પેઇન્ટબ્રશ ટૂલ + Painting પેઇન્ટિંગ + Palette Knife… પેલેટ નાઇફ… + Panel Options… પેનલ વિકલ્પો… + Panel menu પેનલ મેનૂ + Panels પેનલ્સ + Panels Except Tools and Control ટૂલ્સ અને કંટ્રોલ સિવાયની પેનલ્સ + Paragraph ફકરો + Paragraph Style Options ફકરા સ્ટાઇલ વિકલ્પો + Paragraph Styles ફકરા સ્ટાઇલ + Paragraph Symbol ફકરા ચિહ્ન + Paragraph options ફકરા વિકલ્પો + Paragraph: ફકરો: + Parametric Shape પેરામેટ્રિક આકાર + Parametric Shape Tool પેરામેટ્રિક આકાર ટૂલ + Password પાસવર્ડ + Paste ચોંટાડો + Paste Design ડિઝાઇન ચોંટાડો + Paste Offset ઓફસેટ ચોંટાડો + Paste Remembers Layers ચોંટાડતી વખતે લેયર યાદ રાખો + Paste in Back પાછળ ચોંટાડો + Paste in Front આગળ ચોંટાડો + Paste in Place એ જ સ્થાને ચોંટાડો + Paste on All Artboards બધા આર્ટબોર્ડ પર ચોંટાડો + Paste without Formatting ફોર્મેટિંગ વગર ચોંટાડો + Pasted ચોંટાડ્યું + Pastels પેસ્ટલ + Patchwork… પેચવર્ક… + Path પાથ + Path Effects પાથ ઇફેક્ટ્સ + Path Eraser પાથ ઇરેઝર + Path Eraser Tool પાથ ઇરેઝર ટૂલ + Path Precision Tools પાથ ચોકસાઈ ટૂલ્સ + Path: પાથ: + Pathfinder પાથફાઇન્ડર + Pathfinder Options પાથફાઇન્ડર વિકલ્પો + Pathfinder Options… પાથફાઇન્ડર વિકલ્પો… + Pathfinders: પાથફાઇન્ડર્સ: + Paths પાથ + Pattern પેટર્ન + Pattern Borders પેટર્ન બોર્ડર + Pattern Brush પેટર્ન બ્રશ + Pattern Brush Options પેટર્ન બ્રશ વિકલ્પો + Pattern Editing પેટર્ન સંપાદન + Pattern Options પેટર્ન વિકલ્પો + Pattern options are available in pattern editing mode. પેટર્ન વિકલ્પો પેટર્ન સંપાદન મોડમાં ઉપલબ્ધ છે. + Patterns પેટર્ન + Pause For આ સમય માટે થોભાવો + Pen પેન + Pen Tool પેન ટૂલ + Pencil પેન્સિલ + Pencil Tool પેન્સિલ ટૂલ + Percent: ટકા: + Perceptual પર્સેપ્ચ્યુઅલ + Perceptual Scales પર્સેપ્ચ્યુઅલ સ્કેલ + Performance પ્રદર્શન + Permissions પરવાનગીઓ + Permissions password: પરવાનગી પાસવર્ડ: + Perspective પરસ્પેક્ટિવ + Perspective Distort પરસ્પેક્ટિવ વિકૃત + Perspective Grid પરસ્પેક્ટિવ ગ્રિડ + Perspective Grid Options પરસ્પેક્ટિવ ગ્રિડ વિકલ્પો + Perspective Grid Preset પરસ્પેક્ટિવ ગ્રિડ પ્રીસેટ + Perspective Grid Presets પરસ્પેક્ટિવ ગ્રિડ પ્રીસેટ્સ + Perspective Grid Presets… પરસ્પેક્ટિવ ગ્રિડ પ્રીસેટ્સ… + Perspective Grid Settings પરસ્પેક્ટિવ ગ્રિડ સેટિંગ્સ + Perspective Grid Tool પરસ્પેક્ટિવ ગ્રિડ ટૂલ + Perspective Plane Options… પરસ્પેક્ટિવ પ્લેન વિકલ્પો… + Perspective Selection Tool પરસ્પેક્ટિવ પસંદગી ટૂલ + Photocopy… ફોટોકોપી… + Picas પાઇકા + Pick Color From: આમાંથી રંગ પસંદ કરો: + Pie End Angle: પાઇ અંતિમ કોણ: + Pie Graph Tool પાઇ ગ્રાફ ટૂલ + Pie Start Angle: પાઇ પ્રારંભ કોણ: + Pin Bar Position પિન બાર સ્થિતિ + Pink ગુલાબી + Pivot: પિવટ: + Pixel Preview પિક્સેલ પૂર્વાવલોકન + Pixelate પિક્સેલેટ + Pixels પિક્સેલ + Place મૂકો + Place DXF DXF મૂકો + Place PDF PDF મૂકો + Place Symbol Instance સિમ્બોલ ઇન્સ્ટન્સ મૂકો + Place from Library લાઇબ્રેરીમાંથી મૂકો + Place the pages with the placement again પ્લેસમેન્ટ સાથે પેજ ફરી મૂકો + Placed File Info મૂકેલી ફાઇલની માહિતી + Placement Options પ્લેસમેન્ટ વિકલ્પો + Placement Options… પ્લેસમેન્ટ વિકલ્પો… + Placement: પ્લેસમેન્ટ: + Place… મૂકો… + Plane પ્લેન + Plaster… પ્લાસ્ટર… + Plastic પ્લાસ્ટિક + Plastic Wrap… પ્લાસ્ટિક રેપ… + Plates પ્લેટ્સ + Platform: પ્લેટફોર્મ: + Play Action ક્રિયા ચલાવો + Playback Options પ્લેબેક વિકલ્પો + Plug-in Info પ્લગ-ઇન માહિતી + Plug-ins પ્લગ-ઇન્સ + Plug-ins & Scratch Disks પ્લગ-ઇન્સ અને સ્ક્રેચ ડિસ્ક + Plug-in… પ્લગ-ઇન… + Point Text પોઇન્ટ ટેક્સ્ટ + Point Text Objects પોઇન્ટ ટેક્સ્ટ ઑબ્જેક્ટ્સ + Pointillize… પોઇન્ટિલાઇઝ… + Points પોઇન્ટ્સ + Points per segment પ્રતિ સેગમેન્ટ પોઇન્ટ + Points: પોઇન્ટ્સ: + Points: clicks add free points પોઇન્ટ્સ: ક્લિક મુક્ત પોઇન્ટ ઉમેરે છે + Polar Grid પોલર ગ્રિડ + Polar Grid Tool પોલર ગ્રિડ ટૂલ + Polar Grid Tool Options પોલર ગ્રિડ ટૂલ વિકલ્પો + Polish પોલિશ + Polygon બહુકોણ + Polygon Properties: બહુકોણના ગુણધર્મો: + Polygon Tool બહુકોણ ટૂલ + Portrait પોટ્રેટ + Portuguese પોર્ટુગીઝ + Position સ્થિતિ + Position: સ્થિતિ: + PostScript: PostScript: + Poster Edges… પોસ્ટર ધાર… + Power Saving (integrated) પાવર સેવિંગ (સંકલિત) + Precision ચોકસાઈ + Precision: ચોકસાઈ: + Preferences પસંદગીઓ + Preferences… પસંદગીઓ… + Prefix: ઉપસર્ગ: + Preparing the image… છબી તૈયાર કરી રહ્યું છે… + Presentation Mode પ્રેઝન્ટેશન મોડ + Preserve Alpha Transparency આલ્ફા પારદર્શિતા જાળવો + Preserve Appearance and Overprints દેખાવ અને ઓવરપ્રિન્ટ જાળવો + Preserve CMYK Numbers CMYK નંબર જાળવો + Preserve Editing Capabilities સંપાદન ક્ષમતાઓ જાળવો + Preserve Lightness તેજ જાળવો + Preserve Overprints and Spot Colors ઓવરપ્રિન્ટ અને સ્પોટ રંગ જાળવો + Preserve Paths પાથ જાળવો + Preserve Shape Using: આ વડે આકાર જાળવો: + Preserve Spot Colors સ્પોટ રંગ જાળવો + Preserve Text Appearance ટેક્સ્ટનો દેખાવ જાળવો + Preserve Text Editability ટેક્સ્ટ સંપાદનક્ષમતા જાળવો + Preserve editing capabilities સંપાદન ક્ષમતાઓ જાળવો + Preserve: જાળવો: + Preset Name પ્રીસેટનું નામ + Preset name: પ્રીસેટનું નામ: + Preset: પ્રીસેટ: + Presets પ્રીસેટ્સ + Presets you save with the Save Preset button appear here. સાચવો પ્રીસેટ બટન વડે તમે સાચવેલા પ્રીસેટ અહીં દેખાય છે. + Presets: પ્રીસેટ્સ: + Press દબાવો + Press Play Current Selection in the Actions panel to go on. આગળ વધવા માટે ક્રિયા પેનલમાં વર્તમાન પસંદગી ચલાવો દબાવો. + Press a key… કોઈ કી દબાવો… + Preview પૂર્વાવલોકન + Preview (1 inch on the page) પૂર્વાવલોકન (પેજ પર 1 ઇંચ) + Preview All Layers બધા લેયરનું પૂર્વાવલોકન + Preview Mode પૂર્વાવલોકન મોડ + Preview in Browser બ્રાઉઝરમાં પૂર્વાવલોકન + Preview the document as it is now અત્યારે જેમ છે તેમ દસ્તાવેજનું પૂર્વાવલોકન કરો + Previous પાછલું + Previous Artboard પાછલું આર્ટબોર્ડ + Previous Data Set પાછલો ડેટા સેટ + Previous Document પાછલો દસ્તાવેજ + Previous Page પાછલું પેજ + Previous page પાછલું પેજ + Primary પ્રાથમિક + Print છાપો + Print Ink Fixes પ્રિન્ટ ઇંક ફિક્સ + Print Ink Fixes… પ્રિન્ટ ઇંક ફિક્સ… + Print Layers: પ્રિન્ટ લેયર: + Print Preset પ્રિન્ટ પ્રીસેટ + Print Preset: પ્રિન્ટ પ્રીસેટ: + Print Presets પ્રિન્ટ પ્રીસેટ્સ + Print Presets… પ્રિન્ટ પ્રીસેટ્સ… + Print Preview પ્રિન્ટ પૂર્વાવલોકન + Print Setup પ્રિન્ટ સેટઅપ + Print Tiling પ્રિન્ટ ટાઇલિંગ + Print Tiling Pages પ્રિન્ટ ટાઇલિંગ પેજ + Print Tiling Tool પ્રિન્ટ ટાઇલિંગ ટૂલ + Print as Bitmap બિટમેપ તરીકે પ્રિન્ટ કરો + Printer પ્રિન્ટર + Printer Setup… પ્રિન્ટર સેટઅપ… + Printer mark type: પ્રિન્ટર માર્ક પ્રકાર: + Printer profile: પ્રિન્ટર પ્રોફાઇલ: + Printer: પ્રિન્ટર: + Printers પ્રિન્ટર્સ + Printing / Exporting છાપવું / નિકાસ + Printing allowed: છાપવાની મંજૂરી: + Printing and Proofing પ્રિન્ટિંગ અને પ્રૂફિંગ + Print… છાપો… + Problems સમસ્યાઓ + Process Color પ્રોસેસ રંગ + Profile inclusion: પ્રોફાઇલ સમાવેશ: + Profile: પ્રોફાઇલ: + Progressive પ્રોગ્રેસિવ + Projecting Cap પ્રોજેક્ટિંગ કેપ + Proof Colors પ્રૂફ રંગો + Proof Setup પ્રૂફ સેટઅપ + Properties ગુણધર્મો + Proportional Metrics પ્રમાણસર મેટ્રિક્સ + Pucker પકર + Pucker & Bloat… પકર અને બ્લોટ… + Pucker Tool પકર ટૂલ + Punctuation વિરામચિહ્નો + Punctuation Space વિરામચિહ્ન જગ્યા + Punjabi પંજાબી + Puppet Warp પપેટ વોર્પ + Puppet Warp Pins પપેટ વોર્પ પિન + Puppet Warp Tool પપેટ વોર્પ ટૂલ + Push In First પહેલા અંદર ધકેલો + Push Out First પહેલા બહાર ધકેલો + Push Out Only માત્ર બહાર ધકેલો + Put back in the toolbar ટૂલબારમાં પાછું મૂકો + Q Q + Quality {quality} ગુણવત્તા {quality} + Quality: ગુણવત્તા: + Quarter Space ચોથા ભાગની જગ્યા + Quick Actions ઝડપી ક્રિયાઓ + Quickly start a new file નવી ફાઇલ ઝડપથી શરૂ કરો + Quit VectorCraft VectorCraft બંધ કરો + RECENT તાજેતરનાં + RGB Color RGB રંગ + RGB Images RGB છબીઓ + RGB: RGB: + Radar Graph Tool રડાર ગ્રાફ ટૂલ + Radial રેડિયલ + Radial Blur… રેડિયલ બ્લર… + Radial Dividers: રેડિયલ વિભાજક: + Radial Glows રેડિયલ ઝગમગાટ + Radial Gradient રેડિયલ ગ્રેડિઅન્ટ + Radial Repeat રેડિયલ રિપીટ + Radius: ત્રિજ્યા: + Rainbow મેઘધનુષ્ય + Ramp: રેમ્પ: + Random રેન્ડમ + Randomize Colors રંગો રેન્ડમ કરો + Randomize Opacity અપારદર્શકતા રેન્ડમ કરો + Randomize Opacity… અપારદર્શકતા રેન્ડમ કરો… + Randomly change color order રંગોનો ક્રમ રેન્ડમ રીતે બદલો + Randomly change saturation and brightness સંતૃપ્તિ અને તેજ રેન્ડમ રીતે બદલો + Range: શ્રેણી: + Raster Effects રાસ્ટર ઇફેક્ટ્સ + Raster File Format: રાસ્ટર ફાઇલ ફોર્મેટ: + Raster Sample Size: રાસ્ટર નમૂના માપ: + Raster/Vector Balance: રાસ્ટર/વેક્ટર સંતુલન: + Rasterize રાસ્ટરાઇઝ કરો + Rasterize Unsupported Art અસમર્થિત કલાને રાસ્ટરાઇઝ કરો + Rasterize… રાસ્ટરાઇઝ કરો… + Rasters રાસ્ટર + Rating: રેટિંગ: + Ratio ગુણોત્તર + Rays કિરણો + Read Action Set File ક્રિયા સેટ ફાઇલ વાંચો + Read Shortcut Set File શોર્ટકટ સેટ ફાઇલ વાંચો + Read files you open in its format and make documents from them તમે ખોલો તે ફાઇલોને તેના ફોર્મેટમાં વાંચો અને તેમાંથી દસ્તાવેજ બનાવો + Read the objects it is given આપેલી ઑબ્જેક્ટ્સ વાંચો + Reading the file… ફાઇલ વાંચી રહ્યું છે… + Reads or sets environment variables એન્વાયર્નમેન્ટ વેરીએબલ વાંચે કે સેટ કરે છે + Ready તૈયાર + Real World: વાસ્તવિક વિશ્વ: + Real name વાસ્તવિક નામ + Real-time Drawing and Editing રિયલ-ટાઇમ ડ્રોઇંગ અને સંપાદન + Rearrange ફરીથી ગોઠવો + Rearrange All બધું ફરીથી ગોઠવો + Rearrange All Artboards બધા આર્ટબોર્ડ ફરીથી ગોઠવો + Rearrange All Artboards… બધા આર્ટબોર્ડ ફરીથી ગોઠવો… + Rearrange Artboards આર્ટબોર્ડ ફરીથી ગોઠવો + Recall Selection પસંદગી યાદ કરો + Recent Colors તાજેતરના રંગો + Recent Files તાજેતરની ફાઇલો + Recent Font 1 તાજેતરનો ફોન્ટ 1 + Recent Font 10 તાજેતરનો ફોન્ટ 10 + Recent Font 11 તાજેતરનો ફોન્ટ 11 + Recent Font 12 તાજેતરનો ફોન્ટ 12 + Recent Font 13 તાજેતરનો ફોન્ટ 13 + Recent Font 14 તાજેતરનો ફોન્ટ 14 + Recent Font 15 તાજેતરનો ફોન્ટ 15 + Recent Font 2 તાજેતરનો ફોન્ટ 2 + Recent Font 3 તાજેતરનો ફોન્ટ 3 + Recent Font 4 તાજેતરનો ફોન્ટ 4 + Recent Font 5 તાજેતરનો ફોન્ટ 5 + Recent Font 6 તાજેતરનો ફોન્ટ 6 + Recent Font 7 તાજેતરનો ફોન્ટ 7 + Recent Font 8 તાજેતરનો ફોન્ટ 8 + Recent Font 9 તાજેતરનો ફોન્ટ 9 + Recent Fonts તાજેતરના ફોન્ટ્સ + Recent URLs તાજેતરના URL + Recolor રંગ બદલો + Recolor Artwork કલાકૃતિનો રંગ બદલો + Recolor Artwork… કલાકૃતિનો રંગ બદલો… + Recolor this row આ પંક્તિનો રંગ બદલો + Recolor with Preset પ્રીસેટ વડે રંગ બદલો + Record રેકોર્ડ + Record Stop રેકોર્ડ બંધ કરો + Recover Documents દસ્તાવેજો પુનઃપ્રાપ્ત કરો + Recovery Data પુનઃપ્રાપ્તિ ડેટા + Rectangle લંબચોરસ + Rectangle Cut લંબચોરસ કટ + Rectangle Cut Tool લંબચોરસ કટ ટૂલ + Rectangle Properties: લંબચોરસ પ્રોપર્ટીઝ: + Rectangle Tool લંબચોરસ ટૂલ + Rectangle… લંબચોરસ… + Rectangular Grid લંબચોરસ ગ્રિડ + Rectangular Grid Tool લંબચોરસ ગ્રિડ ટૂલ + Rectangular Grid Tool Options લંબચોરસ ગ્રિડ ટૂલ વિકલ્પો + Red લાલ + Redefine Character Style અક્ષર સ્ટાઇલ ફરીથી વ્યાખ્યાયિત કરો + Redefine Graphic Style ગ્રાફિક સ્ટાઇલ ફરીથી વ્યાખ્યાયિત કરો + Redefine Graphic Style “{name}” ગ્રાફિક સ્ટાઇલ “{name}” ફરીથી વ્યાખ્યાયિત કરો + Redefine Paragraph Style ફકરા સ્ટાઇલ ફરીથી વ્યાખ્યાયિત કરો + Redefine Symbol સિમ્બોલ ફરીથી વ્યાખ્યાયિત કરો + Redefine {name} {name} ફરીથી વ્યાખ્યાયિત કરો + Redo ફરીથી કરો + Redo {name} {name} ફરીથી કરો + Reduce Colors રંગો ઘટાડો + Reduce to Basic Appearance મૂળભૂત દેખાવમાં ઘટાડો + Reduction: ઘટાડો: + Reference Point સંદર્ભ બિંદુ + Reflect પ્રતિબિંબિત કરો + Reflect Tool પ્રતિબિંબ ટૂલ + Reflect X X પ્રતિબિંબ + Reflect Y Y પ્રતિબિંબ + Reflect… પ્રતિબિંબિત કરો… + Refresh તાજું કરો + Refresh Deferred Effects સ્થગિત ઇફેક્ટ્સ તાજી કરો + Refresh Font List ફોન્ટ યાદી તાજી કરો + Registered Trademark Symbol રજિસ્ટર્ડ ટ્રેડમાર્ક સિમ્બોલ + Registration: નોંધણી: + Registry name: રજિસ્ટ્રી નામ: + Regular સામાન્ય + Regular expression not closed નિયમિત અભિવ્યક્તિ બંધ નથી + Rejoin Path Pieces પાથના ટુકડા ફરી જોડો + Rejoin Path Pieces… પાથના ટુકડા ફરી જોડો… + Relative સાપેક્ષ + Release મુક્ત કરો + Release Blend બ્લેન્ડ મુક્ત કરો + Release Clipping Mask ક્લિપિંગ માસ્ક મુક્ત કરો + Release Compound Path કમ્પાઉન્ડ પાથ મુક્ત કરો + Release Compound Shape કમ્પાઉન્ડ શેપ મુક્ત કરો + Release Envelope એન્વેલપ મુક્ત કરો + Release Guides ગાઇડ મુક્ત કરો + Release Image Trace ઇમેજ ટ્રેસ મુક્ત કરો + Release Intertwine ઇન્ટરટ્વાઇન મુક્ત કરો + Release Live Paint લાઇવ પેઇન્ટ મુક્ત કરો + Release Opacity Mask ઓપેસિટી માસ્ક મુક્ત કરો + Release Repeat રિપીટ મુક્ત કરો + Release Selection પસંદગી મુક્ત કરો + Release Shaper Group શેપર ગ્રૂપ મુક્ત કરો + Release Slice સ્લાઇસ મુક્ત કરો + Release Text Wrap ટેક્સ્ટ રેપ મુક્ત કરો + Release Threaded Text થ્રેડેડ ટેક્સ્ટ મુક્ત કરો + Release Type on a Path પાથ પર ટાઇપ મુક્ત કરો + Release Type on a Path… પાથ પર ટાઇપ મુક્ત કરો… + Release to Layers (Build) લેયર્સમાં મુક્ત કરો (બિલ્ડ) + Release to Layers (Sequence) લેયર્સમાં મુક્ત કરો (સિક્વન્સ) + Release with Perspective પર્સ્પેક્ટિવ સાથે મુક્ત કરો + Relink ફરી લિંક કરો + Relink to Folder… ફોલ્ડરમાં ફરી લિંક કરો… + Relink… ફરી લિંક કરો… + Reload Plug-ins પ્લગ-ઇન્સ ફરી લોડ કરો + Remember Import Matches ઇમ્પોર્ટ મેચ યાદ રાખો + Remember My Choices મારી પસંદગીઓ યાદ રાખો + Remove દૂર કરો + Remove Anchor Points એન્કર પોઇન્ટ દૂર કરો + Remove Asset એસેટ દૂર કરો + Remove Breaks બ્રેક દૂર કરો + Remove Brush Stroke બ્રશ સ્ટ્રોક દૂર કરો + Remove Color Profile… કલર પ્રોફાઇલ દૂર કરો… + Remove Corners ખૂણા દૂર કરો + Remove Effect ઇફેક્ટ દૂર કરો + Remove Effects ઇફેક્ટ્સ દૂર કરો + Remove Gaps ગેપ દૂર કરો + Remove Guide ગાઇડ દૂર કરો + Remove Item આઇટમ દૂર કરો + Remove JavaScript File JavaScript ફાઇલ દૂર કરો + Remove Line Breaks લાઇન બ્રેક દૂર કરો + Remove Paragraph Breaks ફકરા બ્રેક દૂર કરો + Remove Plug-in પ્લગ-ઇન દૂર કરો + Remove Points, Keep Shape પોઇન્ટ દૂર કરો, આકાર જાળવો + Remove Redundant Points વધારાના પોઇન્ટ દૂર કરો + Remove Selected Assets પસંદ કરેલી એસેટ્સ દૂર કરો + Remove Selected Entry પસંદ કરેલી એન્ટ્રી દૂર કરો + Remove Strokes સ્ટ્રોક દૂર કરો + Remove Threading થ્રેડિંગ દૂર કરો + Remove blank lines between paragraphs ફકરાઓ વચ્ચેની ખાલી લાઇનો દૂર કરો + Remove from Shaper Group શેપર ગ્રૂપમાંથી દૂર કરો + Remove “{keyword}” “{keyword}” દૂર કરો + Rename નામ બદલો + Rename Action ક્રિયાનું નામ બદલો + Rename Artboards આર્ટબોર્ડ્સનું નામ બદલો + Rename Asset એસેટનું નામ બદલો + Rename Character Style અક્ષર સ્ટાઇલનું નામ બદલો + Rename Data Set ડેટા સેટનું નામ બદલો + Rename Data Set… ડેટા સેટનું નામ બદલો… + Rename Design ડિઝાઇનનું નામ બદલો + Rename Graphic Style ગ્રાફિક સ્ટાઇલનું નામ બદલો + Rename Library લાઇબ્રેરીનું નામ બદલો + Rename Library Group લાઇબ્રેરી ગ્રૂપનું નામ બદલો + Rename Paragraph Style ફકરા સ્ટાઇલનું નામ બદલો + Rename Preset પ્રીસેટનું નામ બદલો + Rename Style સ્ટાઇલનું નામ બદલો + Rename Toolbar ટૂલબારનું નામ બદલો + Rename Variable વેરિએબલનું નામ બદલો + Rename View વ્યૂનું નામ બદલો + Rename Workspace વર્કસ્પેસનું નામ બદલો + Render Threads (-1 = Automatic) રેન્ડર થ્રેડ્સ (-1 = આપમેળે) + Rendering intent: રેન્ડરિંગ ઇરાદો: + Reorder ક્રમ બદલો + Reorder Appearance દેખાવનો ક્રમ બદલો + Reorder Appearance Item દેખાવ આઇટમનો ક્રમ બદલો + Reorder Artboards આર્ટબોર્ડ્સનો ક્રમ બદલો + Repeat પુનરાવર્તન કરો + Repeat Options પુનરાવર્તન વિકલ્પો + Repeat Pathfinder પાથફાઇન્ડર પુનરાવર્તન કરો + Repeat {name} {name} પુનરાવર્તન કરો + Repeating પુનરાવર્તન + Replace બદલો + Replace Font ફોન્ટ બદલો + Replace Missing Fonts ગુમ ફોન્ટ બદલો + Replace Missing Fonts… ગુમ ફોન્ટ બદલો… + Replace Spine સ્પાઇન બદલો + Replace Symbol સિમ્બોલ બદલો + Replace With Font ફોન્ટ વડે બદલો + Replace With Font From આમાંથી ફોન્ટ વડે બદલો + Replace it with another file, or ignore it: its images keep showing the preview saved with the document. તેને બીજી ફાઇલથી બદલો, અથવા અવગણો: તેની છબીઓ દસ્તાવેજ સાથે સાચવેલું પૂર્વાવલોકન બતાવતી રહેશે. + Replace with Top Object ટોચની ઑબ્જેક્ટ વડે બદલો + Replace with Top Object… ટોચની ઑબ્જેક્ટ વડે બદલો… + Replace “{name}”, the file this document was opened from? “{name}” બદલીએ, જે ફાઇલમાંથી આ દસ્તાવેજ ખોલવામાં આવ્યો હતો તે? + Replace: બદલો: + Replaces the saved preset of that name. એ નામનો સાચવેલો પ્રીસેટ બદલાશે. + Replace… બદલો… + Report copied રિપોર્ટ નકલ થયો + Require a password to open the document દસ્તાવેજ ખોલવા પાસવર્ડ જરૂરી + Reselect ફરી પસંદ કરો + Reset રીસેટ કરો + Reset Bar Position બાર સ્થિતિ રીસેટ કરો + Reset Bounding Box બાઉન્ડિંગ બોક્સ રીસેટ કરો + Reset Envelope Mesh એન્વેલપ મેશ રીસેટ કરો + Reset Envelope Shape એન્વેલપ આકાર રીસેટ કરો + Reset Essentials એસેન્શિયલ્સ રીસેટ કરો + Reset Horizontal Scale આડો સ્કેલ રીસેટ કરો + Reset Keyboard Shortcuts કીબોર્ડ શૉર્ટકટ રીસેટ કરો + Reset OpenType Features OpenType ફીચર્સ રીસેટ કરો + Reset Panel પેનલ રીસેટ કરો + Reset Preferences પસંદગીઓ રીસેટ કરો + Reset Profiles પ્રોફાઇલ્સ રીસેટ કરો + Reset Rotate View વ્યૂ ફેરવવાનું રીસેટ કરો + Reset Ruler Origin રૂલર ઓરિજિન રીસેટ કરો + Reset Symbol Instance સિમ્બોલ ઇન્સ્ટન્સ રીસેટ કરો + Reset Text Transform ટેક્સ્ટ ટ્રાન્સફોર્મ રીસેટ કરો + Reset Text Transform and Scale ટેક્સ્ટ ટ્રાન્સફોર્મ અને સ્કેલ રીસેટ કરો + Reset Tracking and Kerning ટ્રેકિંગ અને કર્નિંગ રીસેટ કરો + Reset Transformation ટ્રાન્સફોર્મેશન રીસેટ કરો + Reset all બધું રીસેટ કરો + Reset all 3D settings to their defaults. બધી 3D સેટિંગ્સ ડિફોલ્ટ પર રીસેટ કરો. + Reset all Revolve settings to their defaults. બધી રિવોલ્વ સેટિંગ્સ ડિફોલ્ટ પર રીસેટ કરો. + Reset all preferences to their defaults? બધી પસંદગીઓ ડિફોલ્ટ પર રીસેટ કરીએ? + Reset the rows to the artwork's colors પંક્તિઓ આર્ટવર્કના રંગો પર રીસેટ કરો + Reset to Inverse ઊલટા પર રીસેટ કરો + Reset to Linear લિનિયર પર રીસેટ કરો + Reset to White, Black સફેદ, કાળા પર રીસેટ કરો + Reset to default ડિફોલ્ટ પર રીસેટ કરો + Reset with Mesh મેશ વડે રીસેટ કરો + Reset with Mesh… મેશ વડે રીસેટ કરો… + Reset with Warp વોર્પ વડે રીસેટ કરો + Reset with Warp… વોર્પ વડે રીસેટ કરો… + Reset {name} {name} રીસેટ કરો + Reshape રીશેપ + Reshape Segment સેગમેન્ટ રીશેપ કરો + Reshape Spine સ્પાઇન રીશેપ કરો + Reshape Spine Segment સ્પાઇન સેગમેન્ટ રીશેપ કરો + Reshape Tool રીશેપ ટૂલ + Reshape Type Area ટાઇપ એરિયા રીશેપ કરો + Reshape Type Path ટાઇપ પાથ રીશેપ કરો + Resize માપ બદલો + Resize Artboard આર્ટબોર્ડનું માપ બદલો + Resize Slice સ્લાઇસનું માપ બદલો + Resize Type Area ટાઇપ એરિયાનું માપ બદલો + Resolution: રિઝોલ્યુશન: + Responsive રિસ્પોન્સિવ + Restore પુનઃસ્થાપિત કરો + Restore Recovered Documents પુનઃપ્રાપ્ત દસ્તાવેજો પુનઃસ્થાપિત કરો + Restore every preference to its default (applied on OK) દરેક પસંદગી તેના ડિફોલ્ટ પર પુનઃસ્થાપિત કરો (ઠીક પર લાગુ થશે) + Restored documents open unsaved: save them to keep them. પુનઃસ્થાપિત દસ્તાવેજો અસાચવેલા ખુલશે: તેમને રાખવા માટે સાચવો. + Restrict printing, editing and other tasks છાપકામ, સંપાદન અને અન્ય કાર્યો પર પ્રતિબંધ મૂકો + Reticulation… રેટિક્યુલેશન… + Retract Handles હેન્ડલ પાછા ખેંચો + Retract Handles… હેન્ડલ પાછા ખેંચો… + Reverse Direction દિશા ઊલટાવો + Reverse Front to Back આગળથી પાછળ ઊલટાવો + Reverse Gradient ગ્રેડિયન્ટ ઊલટાવો + Reverse Order ક્રમ ઊલટાવો + Reverse Path Direction પાથની દિશા ઊલટાવો + Reverse Path Direction Off પાથની દિશા ઊલટાવવાનું બંધ + Reverse Path Direction On પાથની દિશા ઊલટાવવાનું ચાલુ + Reverse Spine સ્પાઇન ઊલટાવો + Reverse the order ક્રમ ઊલટાવો + Revert મૂળ સ્થિતિમાં લાવો + Revert to the saved version of “{name}”? “{name}”નું સાચવેલું સંસ્કરણ પાછું લાવીએ? + Revolve રિવોલ્વ + Revolve angle રિવોલ્વ ખૂણો + Revolve… રિવોલ્વ… + Right જમણે + Right Grid: જમણી ગ્રિડ: + Right Indent જમણો ઇન્ડેન્ટ + Right Plane જમણું પ્લેન + Right to Left જમણેથી ડાબે + Right-Justified Tab જમણે-સંરેખિત ટૅબ + Right-to-Left Paragraph Direction જમણેથી ડાબે ફકરાની દિશા + Right: જમણે: + Rings રિંગ્સ + Rise… રાઇઝ… + Roman રોમન + Roman Baseline રોમન બેઝલાઇન + Roman Hanging Punctuation રોમન હેંગિંગ વિરામચિહ્નો + Rotate ફેરવો + Rotate Tool ફેરવો ટૂલ + Rotate View વ્યૂ ફેરવો + Rotate View Tool વ્યૂ ફેરવો ટૂલ + Rotate View to Selection વ્યૂ પસંદગી પ્રમાણે ફેરવો + Rotate: ફેરવો: + Rotate… ફેરવો… + Rotation પરિભ્રમણ + Rotation X પરિભ્રમણ X + Rotation Y પરિભ્રમણ Y + Rotation Z પરિભ્રમણ Z + Rotation relative to: આના સાપેક્ષે પરિભ્રમણ: + Rotation: પરિભ્રમણ: + Rough Pastels… રફ પેસ્ટલ્સ… + Roughen… રફ બનાવો… + Round ગોળ + Round Cap ગોળ કેપ + Round Corners… ગોળ ખૂણા… + Round Join ગોળ જોઇન + Rounded ગોળાકાર + Rounded Rectangle ગોળાકાર લંબચોરસ + Rounded Rectangle Tool ગોળાકાર લંબચોરસ ટૂલ + Rounded Rectangle… ગોળાકાર લંબચોરસ… + Roundness: ગોળાઈ: + Row Size: પંક્તિનું માપ: + Rows: પંક્તિઓ: + Ruby રૂબી + Ruby… રૂબી… + Rule: નિયમ: + Ruler Origin રૂલર ઓરિજિન + Rulers રૂલર્સ + Rulers & Grids રૂલર્સ અને ગ્રિડ + Run ચલાવો + Run Plug-in પ્લગ-ઇન ચલાવો + Run Script સ્ક્રિપ્ટ ચલાવો + Run these commands on the document: {ids} દસ્તાવેજ પર આ આદેશો ચલાવો: {ids} + Runs code the checker can't read ચકાસણીકર્તા વાંચી ન શકે તેવો કોડ ચલાવે છે + Russian રશિયન + SAVED સાચવેલું + SVG Filter SVG ફિલ્ટર + SVG Filters SVG ફિલ્ટર્સ + SVG Interactivity SVG ઇન્ટરેક્ટિવિટી + SVG Options SVG વિકલ્પો + SVG Profile: SVG પ્રોફાઇલ: + Safe Mode સેફ મોડ + Safe Mode… સેફ મોડ… + Same સમાન + Same file સમાન ફાઇલ + Same item as a later row પછીની પંક્તિ જેવી જ આઇટમ + Same size સમાન માપ + Sample Color નમૂના રંગ + Sample Color from Screen સ્ક્રીનમાંથી નમૂના રંગ + Sans Serif / Gothic સાન્સ સેરિફ / ગોથિક + Sanskrit સંસ્કૃત + Saturate સંતૃપ્ત કરો + Saturate… સંતૃપ્ત કરો… + Saturation સંતૃપ્તિ + Saturation and brightness સંતૃપ્તિ અને તેજ + Save સાચવો + Save Actions… ક્રિયાઓ સાચવો… + Save As આ રીતે સાચવો + Save As Preset… પ્રીસેટ તરીકે સાચવો… + Save As… આ રીતે સાચવો… + Save Brush Library બ્રશ લાઇબ્રેરી સાચવો + Save Brush Library… બ્રશ લાઇબ્રેરી સાચવો… + Save Brushes… બ્રશ સાચવો… + Save Changes ફેરફારો સાચવો + Save Colors as Swatches રંગો સ્વેચ તરીકે સાચવો + Save Document દસ્તાવેજ સાચવો + Save Document Info… દસ્તાવેજની માહિતી સાચવો… + Save Document Preset દસ્તાવેજ પ્રીસેટ સાચવો + Save Export Preset એક્સપોર્ટ પ્રીસેટ સાચવો + Save Gradient Preset ગ્રેડિયન્ટ પ્રીસેટ સાચવો + Save Gradient Preset… ગ્રેડિયન્ટ પ્રીસેટ સાચવો… + Save Graphic Style Library ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી સાચવો + Save Graphic Style Library… ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી સાચવો… + Save Grid as Preset ગ્રિડ પ્રીસેટ તરીકે સાચવો + Save Grid as Preset… ગ્રિડ પ્રીસેટ તરીકે સાચવો… + Save Image Trace Preset ઇમેજ ટ્રેસ પ્રીસેટ સાચવો + Save PDF PDF સાચવો + Save PDF Dialog PDF સંવાદ સાચવો + Save PDF Preset PDF પ્રીસેટ સાચવો + Save Perspective Grid Preset પર્સ્પેક્ટિવ ગ્રિડ પ્રીસેટ સાચવો + Save Preset પ્રીસેટ સાચવો + Save Preset… પ્રીસેટ સાચવો… + Save Print Preset પ્રિન્ટ પ્રીસેટ સાચવો + Save Recovery Data પુનઃપ્રાપ્તિ ડેટા સાચવો + Save Save for Web Preset વેબ માટેનો પ્રીસેટ સાચવો + Save Selection પસંદગી સાચવો + Save Selection… પસંદગી સાચવો… + Save Swatch Library સ્વેચ લાઇબ્રેરી સાચવો + Save Swatch Library… સ્વેચ લાઇબ્રેરી સાચવો… + Save Symbol Library સિમ્બોલ લાઇબ્રેરી સાચવો + Save Symbol Library… સિમ્બોલ લાઇબ્રેરી સાચવો… + Save Symbols… સિમ્બોલ સાચવો… + Save Theme થીમ સાચવો + Save To: આ સ્થળે સાચવો: + Save Transparency Flattener Preset પારદર્શિતા ફ્લેટનર પ્રીસેટ સાચવો + Save Transparency Flattener Preset… પારદર્શિતા ફ્લેટનર પ્રીસેટ સાચવો… + Save Variable Library… વેરિએબલ લાઇબ્રેરી સાચવો… + Save a Copy નકલ સાચવો + Save a Copy… નકલ સાચવો… + Save a Timestamped Copy ટાઇમસ્ટેમ્પવાળી નકલ સાચવો + Save as New Preset… નવો પ્રીસેટ તરીકે સાચવો… + Save as PDF… PDF તરીકે સાચવો… + Save as Template ટેમ્પલેટ તરીકે સાચવો + Save as Template… ટેમ્પલેટ તરીકે સાચવો… + Save as preset: પ્રીસેટ તરીકે સાચવો: + Save changes to {name} {name}માં ફેરફારો સાચવો + Save color group to Swatch panel રંગ ગ્રૂપ સ્વેચ પેનલમાં સાચવો + Save each artboard to a separate file દરેક આર્ટબોર્ડ અલગ ફાઇલમાં સાચવો + Save for Office Documents Office દસ્તાવેજો માટે સાચવો + Save for Office Documents… Office દસ્તાવેજો માટે સાચવો… + Save for Web વેબ માટે સાચવો + Save for Web (Legacy)… વેબ માટે સાચવો (લેગસી)… + Save for Web Presets વેબ માટે સાચવો પ્રીસેટ્સ + Save for Web Preview વેબ માટે સાચવો પૂર્વાવલોકન + Save for Web Settings વેબ માટે સાચવો સેટિંગ્સ + Save selected colors as swatches પસંદ કરેલા રંગો સ્વેચ તરીકે સાચવો + Save the applied preferences to a JSON file લાગુ પસંદગીઓ JSON ફાઇલમાં સાચવો + Save the current layout under this name વર્તમાન લેઆઉટ આ નામે સાચવો + Save the document first? પહેલા દસ્તાવેજ સાચવીએ? + Save the selected preset to a file પસંદ કરેલો પ્રીસેટ ફાઇલમાં સાચવો + Save the settings as a preset સેટિંગ્સ પ્રીસેટ તરીકે સાચવો + Save theme to My Themes થીમ "મારી થીમ્સ"માં સાચવો + Save these settings as a preset આ સેટિંગ્સ પ્રીસેટ તરીકે સાચવો + Save these settings as a print preset આ સેટિંગ્સ પ્રિન્ટ પ્રીસેટ તરીકે સાચવો + Save to Swatches સ્વેચમાં સાચવો + Saved સાચવ્યું + Saved Selection 1 સાચવેલી પસંદગી 1 + Saved Selection 10 સાચવેલી પસંદગી 10 + Saved Selection 11 સાચવેલી પસંદગી 11 + Saved Selection 12 સાચવેલી પસંદગી 12 + Saved Selection 13 સાચવેલી પસંદગી 13 + Saved Selection 14 સાચવેલી પસંદગી 14 + Saved Selection 15 સાચવેલી પસંદગી 15 + Saved Selection 16 સાચવેલી પસંદગી 16 + Saved Selection 17 સાચવેલી પસંદગી 17 + Saved Selection 18 સાચવેલી પસંદગી 18 + Saved Selection 19 સાચવેલી પસંદગી 19 + Saved Selection 2 સાચવેલી પસંદગી 2 + Saved Selection 20 સાચવેલી પસંદગી 20 + Saved Selection 21 સાચવેલી પસંદગી 21 + Saved Selection 22 સાચવેલી પસંદગી 22 + Saved Selection 23 સાચવેલી પસંદગી 23 + Saved Selection 24 સાચવેલી પસંદગી 24 + Saved Selection 25 સાચવેલી પસંદગી 25 + Saved Selection 3 સાચવેલી પસંદગી 3 + Saved Selection 4 સાચવેલી પસંદગી 4 + Saved Selection 5 સાચવેલી પસંદગી 5 + Saved Selection 6 સાચવેલી પસંદગી 6 + Saved Selection 7 સાચવેલી પસંદગી 7 + Saved Selection 8 સાચવેલી પસંદગી 8 + Saved Selection 9 સાચવેલી પસંદગી 9 + Saved Selections સાચવેલી પસંદગીઓ + Saved View 1 સાચવેલો વ્યૂ 1 + Saved View 10 સાચવેલો વ્યૂ 10 + Saved View 11 સાચવેલો વ્યૂ 11 + Saved View 12 સાચવેલો વ્યૂ 12 + Saved View 13 સાચવેલો વ્યૂ 13 + Saved View 14 સાચવેલો વ્યૂ 14 + Saved View 15 સાચવેલો વ્યૂ 15 + Saved View 16 સાચવેલો વ્યૂ 16 + Saved View 17 સાચવેલો વ્યૂ 17 + Saved View 18 સાચવેલો વ્યૂ 18 + Saved View 19 સાચવેલો વ્યૂ 19 + Saved View 2 સાચવેલો વ્યૂ 2 + Saved View 20 સાચવેલો વ્યૂ 20 + Saved View 21 સાચવેલો વ્યૂ 21 + Saved View 22 સાચવેલો વ્યૂ 22 + Saved View 23 સાચવેલો વ્યૂ 23 + Saved View 24 સાચવેલો વ્યૂ 24 + Saved View 25 સાચવેલો વ્યૂ 25 + Saved View 3 સાચવેલો વ્યૂ 3 + Saved View 4 સાચવેલો વ્યૂ 4 + Saved View 5 સાચવેલો વ્યૂ 5 + Saved View 6 સાચવેલો વ્યૂ 6 + Saved View 7 સાચવેલો વ્યૂ 7 + Saved View 8 સાચવેલો વ્યૂ 8 + Saved View 9 સાચવેલો વ્યૂ 9 + Saved Views સાચવેલા વ્યૂઝ + Saves the current bars, toolbar and panel layout. વર્તમાન બાર, ટૂલબાર અને પેનલ લેઆઉટ સાચવે છે. + Save… સાચવો… + Scale સ્કેલ + Scale Artwork with Artboard આર્ટબોર્ડ સાથે આર્ટવર્ક સ્કેલ કરો + Scale Corners ખૂણા સ્કેલ કરો + Scale Cursor Proportional to UI UI પ્રમાણે કર્સર સ્કેલ કરો + Scale Design ડિઝાઇન સ્કેલ કરો + Scale Lineweights લાઇનવેઇટ સ્કેલ કરો + Scale Presets સ્કેલ પ્રીસેટ્સ + Scale Proportionately પ્રમાણસર સ્કેલ કરો + Scale Strokes & Effects સ્ટ્રોક અને ઇફેક્ટ્સ સ્કેલ કરો + Scale Text Attributes ટેક્સ્ટ ગુણધર્મો સ્કેલ કરો + Scale Tool સ્કેલ ટૂલ + Scale at Center કેન્દ્રથી સ્કેલ કરો + Scale in Perspective પર્સ્પેક્ટિવમાં સ્કેલ કરો + Scale to Fit Artboard આર્ટબોર્ડમાં બંધબેસતું સ્કેલ કરો + Scale: સ્કેલ: + Scale… સ્કેલ… + Scaling સ્કેલિંગ + Scaling: સ્કેલિંગ: + Scallop સ્કેલપ + Scallop Tool સ્કેલપ ટૂલ + Scans: સ્કેન: + Scatter Brush સ્કેટર બ્રશ + Scatter Brush Options સ્કેટર બ્રશ વિકલ્પો + Scatter Graph Tool સ્કેટર ગ્રાફ ટૂલ + Scatter Shapes સ્કેટર આકારો + Scatter: સ્કેટર: + Scissors Tool કાતર ટૂલ + Scratch Disks સ્ક્રેચ ડિસ્ક + Screen સ્ક્રીન + Screen Mode સ્ક્રીન મોડ + Screens સ્ક્રીન્સ + Scribble… સ્ક્રિબલ… + Script / Brush સ્ક્રિપ્ટ / બ્રશ + Script Alert સ્ક્રિપ્ટ ચેતવણી + Script Console સ્ક્રિપ્ટ કન્સોલ + Scripts સ્ક્રિપ્ટ્સ + Scroll Sideways with Cmd/Ctrl + Wheel Cmd/Ctrl + વ્હીલ વડે બાજુમાં સ્ક્રોલ કરો + Scrub Numeric Fields by Dragging ખેંચીને આંકડાકીય ફીલ્ડ્સ સ્ક્રબ કરો + Search શોધો + Search All બધું શોધો + Search Commands… આદેશો શોધો… + Search Fonts Folder ફોન્ટ ફોલ્ડર શોધો + Search Preferences પસંદગીઓ શોધો + Search commands and tools આદેશો અને ટૂલ્સ શોધો + Search commands and tools… આદેશો અને ટૂલ્સ શોધો… + Search images છબીઓ શોધો + Searching… શોધી રહ્યા છીએ… + Secondary ગૌણ + Section Symbol વિભાગ ચિહ્ન + Seed: સીડ: + Segmented color wheel વિભાજિત રંગ ચક્ર + Segments સેગમેન્ટ્સ + Select પસંદ કરો + Select All બધું પસંદ કરો + Select All Artboards બધા આર્ટબોર્ડ પસંદ કરો + Select All Assets બધી એસેટ્સ પસંદ કરો + Select All Bound Objects બધી બાઉન્ડ ઑબ્જેક્ટ્સ પસંદ કરો + Select All Instances બધા ઇન્સ્ટન્સ પસંદ કરો + Select All Unused બધું ન વપરાયેલું પસંદ કરો + Select Anchors એન્કર પસંદ કરો + Select Appearance Item દેખાવ આઇટમ પસંદ કરો + Select Art આર્ટ પસંદ કરો + Select Bound Object બાઉન્ડ ઑબ્જેક્ટ પસંદ કરો + Select Data Set ડેટા સેટ પસંદ કરો + Select Embedded એમ્બેડ કરેલું પસંદ કરો + Select Fills ભરણ પસંદ કરો + Select Freeform Point ફ્રીફોર્મ પોઇન્ટ પસંદ કરો + Select Gradient Stop ગ્રેડિયન્ટ સ્ટોપ પસંદ કરો + Select Guides ગાઇડ પસંદ કરો + Select Linked લિંક કરેલું પસંદ કરો + Select Missing ગુમ થયેલું પસંદ કરો + Select Modified સુધારેલું પસંદ કરો + Select Objects ઑબ્જેક્ટ્સ પસંદ કરો + Select Same Tint % સમાન ટિન્ટ % પસંદ કરો + Select Segments સેગમેન્ટ પસંદ કરો + Select Shaper Face શેપર ફેસ પસંદ કરો + Select Slices સ્લાઇસ પસંદ કરો + Select Strokes સ્ટ્રોક પસંદ કરો + Select Symbol Instance Part સિમ્બોલ ઇન્સ્ટન્સનો ભાગ પસંદ કરો + Select Text by Font ફોન્ટ મુજબ ટેક્સ્ટ પસંદ કરો + Select Tool ટૂલ પસંદ કરો + Select Unused વપરાયેલ નથી તે પસંદ કરો + Select a character with the Type tool to see its alternates. તેના વિકલ્પી અક્ષરો જોવા માટે ટાઇપ ટૂલ વડે એક અક્ષર પસંદ કરો. + Select a parametric shape to edit it. With none selected, these set the next shape. સંપાદિત કરવા માટે પેરામેટ્રિક શેપ પસંદ કરો. કંઈ પસંદ ન હોય ત્યારે, આ આગલો શેપ સેટ કરે છે. + Select a text object ટેક્સ્ટ ઑબ્જેક્ટ પસંદ કરો + Select a text object to edit its character attributes. અક્ષર ગુણધર્મો સંપાદિત કરવા માટે ટેક્સ્ટ ઑબ્જેક્ટ પસંદ કરો. + Select a text object to edit its paragraph attributes. ફકરા ગુણધર્મો સંપાદિત કરવા માટે ટેક્સ્ટ ઑબ્જેક્ટ પસંદ કરો. + Select an image to see its Link Info. તેની લિંક માહિતી જોવા માટે ઇમેજ પસંદ કરો. + Select art and choose Object › Pattern › Make. આર્ટ પસંદ કરો અને ઑબ્જેક્ટ › પૅટર્ન › બનાવો પસંદ કરો. + Select art to make a scatter, art or pattern brush. સ્કેટર, આર્ટ અથવા પૅટર્ન બ્રશ બનાવવા માટે આર્ટ પસંદ કરો. + Select artwork to apply effects અસરો લાગુ કરવા માટે આર્ટવર્ક પસંદ કરો + Select by Artboards આર્ટબોર્ડ મુજબ પસંદ કરો + Select by Artboards… આર્ટબોર્ડ મુજબ પસંદ કરો… + Select by Color રંગ મુજબ પસંદ કરો + Select by Color Kind રંગ પ્રકાર મુજબ પસંદ કરો + Select by Link Status લિંક સ્થિતિ મુજબ પસંદ કરો + Select by Link Status… લિંક સ્થિતિ મુજબ પસંદ કરો… + Select objects to adjust their colors. તેમના રંગ ગોઠવવા માટે ઑબ્જેક્ટ પસંદ કરો. + Select objects to find the swatches nearest their colors. તેમના રંગની સૌથી નજીકના સ્વેચ શોધવા માટે ઑબ્જેક્ટ પસંદ કરો. + Select objects to see their CSS, or Generate CSS for the whole document. તેમની CSS જોવા માટે ઑબ્જેક્ટ પસંદ કરો, અથવા આખા દસ્તાવેજ માટે CSS બનાવો. + Select objects, then pick an object type to give them a 3D effect. ઑબ્જેક્ટ પસંદ કરો, પછી તેમને 3D અસર આપવા માટે ઑબ્જેક્ટ પ્રકાર પસંદ કરો. + Select styled art and click New Graphic Style. સ્ટાઇલવાળી આર્ટ પસંદ કરો અને નવી ગ્રાફિક સ્ટાઇલ ક્લિક કરો. + Select text to set its OpenType features. તેની OpenType સુવિધાઓ સેટ કરવા માટે ટેક્સ્ટ પસંદ કરો. + Select the art (and, on top of it, the mask object) આર્ટ (અને તેની ઉપર માસ્ક ઑબ્જેક્ટ) પસંદ કરો + Select two or more objects, or a group બે કે વધુ ઑબ્જેક્ટ, અથવા ગ્રૂપ પસંદ કરો + Select: પસંદ કરો: + Selected Artwork પસંદ કરેલ આર્ટવર્ક + Selected Brushes Only માત્ર પસંદ કરેલા બ્રશ + Selected Styles Only માત્ર પસંદ કરેલી સ્ટાઇલ + Selected Swatches પસંદ કરેલા સ્વેચ + Selected Swatches Only માત્ર પસંદ કરેલા સ્વેચ + Selected Symbols Only માત્ર પસંદ કરેલા સિમ્બોલ + Selected: {n}, Total number of files to export: {m} પસંદ કરેલ: {n}, નિકાસ કરવાની કુલ ફાઇલો: {m} + Selection પસંદગી + Selection & Anchor Display પસંદગી અને એન્કર ડિસ્પ્લે + Selection Only માત્ર પસંદગી + Selection Tool પસંદગી ટૂલ + Selection Tools પસંદગી ટૂલ્સ + Selection: પસંદગી: + Send Backward પાછળ મોકલો + Send to Back સૌથી પાછળ મોકલો + Send to Current Layer વર્તમાન લેયરમાં મોકલો + Sends messages to other apps અન્ય એપ્સને સંદેશા મોકલે છે + Sentence case વાક્ય કેસ + Separate colors into rows રંગોને પંક્તિઓમાં અલગ કરો + Separate several keywords with commas. અનેક કીવર્ડ અલ્પવિરામથી અલગ કરો. + Separations Preview સેપરેશન પ્રીવ્યૂ + Separations list the document's inks here: one page per ink that prints. અહીં સેપરેશન દસ્તાવેજની શાહી યાદી આપે છે: છાપવામાં આવતી દરેક શાહી માટે એક પાનું. + Serbian: Cyrillic સર્બિયન: સિરિલિક + Serbian: Latin સર્બિયન: લેટિન + Serialize Document દસ્તાવેજ ક્રમબદ્ધ કરો + Serif / Mincho સેરીફ / મિન્ચો + Services સેવાઓ + Set Alignment, Keep Position ગોઠવણી સેટ કરો, સ્થિતિ જાળવો + Set Anchor એન્કર સેટ કરો + Set Anchors એન્કર સેટ કરો + Set Bounds બાઉન્ડ્સ સેટ કરો + Set Corners કોર્નર સેટ કરો + Set Corners… કોર્નર સેટ કરો… + Set Current Layer વર્તમાન લેયર સેટ કરો + Set Font Height Reference ફોન્ટ ઊંચાઈ સંદર્ભ સેટ કરો + Set History Limit… ઇતિહાસ મર્યાદા સેટ કરો… + Set Keyboard Shortcut કીબોર્ડ શોર્ટકટ સેટ કરો + Set Mesh Point Color મેશ પોઇન્ટ રંગ સેટ કરો + Set Options વિકલ્પો સેટ કરો + Set Preference પસંદગી સેટ કરો + Set Size of Each દરેકનું કદ સેટ કરો + Set Size of Each… દરેકનું કદ સેટ કરો… + Set Slice Rectangle સ્લાઇસ લંબચોરસ સેટ કરો + Set Tab Stops ટૅબ સ્ટૉપ સેટ કરો + Set Text ટેક્સ્ટ સેટ કરો + Set Zoom ઝૂમ સેટ કરો + Set as Default ડિફૉલ્ટ તરીકે સેટ કરો + Set base color to the current color બેઝ રંગ વર્તમાન રંગ પર સેટ કરો + Set the selected color to the current color પસંદ કરેલ રંગ વર્તમાન રંગ પર સેટ કરો + Set {n} {n} સેટ કરો + Settings સેટિંગ્સ + Setup… સેટઅપ… + Shading શેડિંગ + Shading Color શેડિંગ રંગ + Shadows and Glows પડછાયા અને ગ્લો + Shape શેપ + Shape Builder શેપ બિલ્ડર + Shape Builder Delete શેપ બિલ્ડર કાઢી નાખો + Shape Builder Regions શેપ બિલ્ડર વિસ્તારો + Shape Builder Tool શેપ બિલ્ડર ટૂલ + Shape Effects શેપ અસરો + Shape Mode શેપ મોડ + Shape Mode Buttons Make Compound Shapes શેપ મોડ બટન્સ કમ્પાઉન્ડ શેપ બનાવે છે + Shape Modes: શેપ મોડ્સ: + Shape Properties શેપ ગુણધર્મો + Shape Properties: શેપ ગુણધર્મો: + Shape: શેપ: + Shaper શેપર + Shaper Tool શેપર ટૂલ + Shapes શેપ + Shared Edge Merge Tool શેર્ડ એજ મર્જ ટૂલ + Sharpen શાર્પન + Shear શિયર + Shear Tool શિયર ટૂલ + Shear… શિયર… + Shell Lower… શેલ નીચે… + Shell Upper… શેલ ઉપર… + Shift Shift + Shift to Color… રંગ તરફ શિફ્ટ કરો… + Shift: શિફ્ટ: + Shifts the tints of global and spot colors; other colors stay. ગ્લોબલ અને સ્પૉટ રંગના ટિન્ટ શિફ્ટ કરે છે; અન્ય રંગો યથાવત રહે છે. + Short ટૂંકું + Shortcut શોર્ટકટ + Shortcuts શોર્ટકટ + Show બતાવો + Show Active Plane Widget સક્રિય પ્લેન વિજેટ બતાવો + Show All બધું બતાવો + Show All Hidden Attributes બધા છુપાયેલા ગુણધર્મો બતાવો + Show All Layers બધા લેયર બતાવો + Show All Plates બધી પ્લેટ બતાવો + Show Artboards આર્ટબોર્ડ બતાવો + Show Bounding Box બાઉન્ડિંગ બૉક્સ બતાવો + Show Brush Size બ્રશ કદ બતાવો + Show Center કેન્દ્ર બતાવો + Show Center Mark કેન્દ્ર ચિહ્ન બતાવો + Show Code કોડ બતાવો + Show Corner Widget કોર્નર વિજેટ બતાવો + Show Cross Hairs ક્રોસ હેર બતાવો + Show East Asian Options પૂર્વ એશિયન વિકલ્પો બતાવો + Show Edges કિનારીઓ બતાવો + Show External Script Warning બાહ્ય સ્ક્રિપ્ટ ચેતવણી બતાવો + Show Find Field શોધ ફીલ્ડ બતાવો + Show Font Height Options ફોન્ટ ઊંચાઈ વિકલ્પો બતાવો + Show Font Names in English ફોન્ટ નામો અંગ્રેજીમાં બતાવો + Show Gradient Annotator ગ્રેડિઅન્ટ એનોટેટર બતાવો + Show Grid ગ્રિડ બતાવો + Show Grid (⌘') ગ્રિડ બતાવો (⌘') + Show Guides ગાઇડ બતાવો + Show Hidden Characters છુપાયેલા અક્ષરો બતાવો + Show Images in Outline Mode આઉટલાઇન મોડમાં ઇમેજ બતાવો + Show Indic Options ઇન્ડિક વિકલ્પો બતાવો + Show Issue સમસ્યા બતાવો + Show Layers Only માત્ર લેયર બતાવો + Show Library લાઇબ્રેરી બતાવો + Show Link Info લિંક માહિતી બતાવો + Show List View સૂચિ દૃશ્ય બતાવો + Show Live Paint Gaps લાઇવ પેઇન્ટ ગેપ બતાવો + Show Note નોંધ બતાવો + Show Options વિકલ્પો બતાવો + Show Original Path મૂળ પાથ બતાવો + Show Package પૅકેજ બતાવો + Show Panel પેનલ બતાવો + Show Perspective Grid પર્સ્પેક્ટિવ ગ્રિડ બતાવો + Show Pixel Grid (Above 600% Zoom) પિક્સેલ ગ્રિડ બતાવો (600% ઝૂમથી ઉપર) + Show Presets પ્રીસેટ બતાવો + Show Print Tiling પ્રિન્ટ ટાઇલિંગ બતાવો + Show Properties Panel ગુણધર્મો પેનલ બતાવો + Show Rulers રૂલર બતાવો + Show Rulers (⌘R) રૂલર બતાવો (⌘R) + Show Slice Numbers સ્લાઇસ નંબર બતાવો + Show Slices સ્લાઇસ બતાવો + Show Snap to Glyph Options ગ્લિફ પર સ્નેપ વિકલ્પો બતાવો + Show Swatch Bounds સ્વેચ બાઉન્ડ્સ બતાવો + Show Swatch Kinds સ્વેચ પ્રકાર બતાવો + Show Template ટેમ્પ્લેટ બતાવો + Show Text Threads ટેક્સ્ટ થ્રેડ બતાવો + Show The Home Screen When No Documents Are Open કોઈ દસ્તાવેજ ખુલ્લો ન હોય ત્યારે હોમ સ્ક્રીન બતાવો + Show Thumbnail થંબનેઇલ બતાવો + Show Thumbnail View થંબનેઇલ દૃશ્ય બતાવો + Show Thumbnails થંબનેઇલ બતાવો + Show Tile Edge ટાઇલ કિનારી બતાવો + Show Tints/Shades ટિન્ટ/શેડ બતાવો + Show Tool Group Labels ટૂલ ગ્રૂપ લેબલ બતાવો + Show Tool Tips ટૂલ ટિપ્સ બતાવો + Show Toolbar ટૂલબાર બતાવો + Show Transparency Grid પારદર્શિતા ગ્રિડ બતાવો + Show Video Rulers વિડિયો રૂલર બતાવો + Show Video Safe Areas વિડિયો સેફ એરિયા બતાવો + Show Vivid/Muted વાઇબ્રન્ટ/મ્યૂટ બતાવો + Show Warm/Cool ગરમ/ઠંડા બતાવો + Show all plates બધી પ્લેટ બતાવો + Show axis અક્ષ બતાવો + Show color bars રંગ બાર બતાવો + Show handles when multiple anchors are selected બહુવિધ એન્કર પસંદ હોય ત્યારે હૅન્ડલ બતાવો + Show in Folder ફોલ્ડરમાં બતાવો + Show its progress, see Cancel and write log lines તેની પ્રગતિ બતાવવી, રદ કરવાની વિનંતી જોવી અને લૉગ લાઇનો લખવી + Show segmented color wheel સેગમેન્ટેડ રંગ ચક્ર બતાવો + Show smooth color wheel સ્મૂધ રંગ ચક્ર બતાવો + Show/hide plate (Alt-click: only this plate) પ્લેટ બતાવો/છુપાવો (Alt-ક્લિક: માત્ર આ પ્લેટ) + Show: બતાવો: + Shown with the optimised preview. ઑપ્ટિમાઇઝ્ડ પ્રીવ્યૂ સાથે બતાવેલ. + Side 1: બાજુ 1: + Side 2: બાજુ 2: + Side Length: બાજુની લંબાઈ: + Side Tile સાઇડ ટાઇલ + Sides: બાજુઓ: + Simple સરળ + Simplify સરળ બનાવો + Simplify Anchors (Keep Shape) એન્કર સરળ બનાવો (શેપ જાળવો) + Simplify Anchors (Keep Shape)… એન્કર સરળ બનાવો (શેપ જાળવો)… + Simplify Anchors… એન્કર સરળ બનાવો… + Simplify: સરળ બનાવો: + Simplify… સરળ બનાવો… + Simulate Colored Paper રંગીન કાગળનું અનુકરણ કરો + Simulate Paper કાગળનું અનુકરણ કરો + Single Corner Radius એક કોર્નર ત્રિજ્યા + Single File એક ફાઇલ + Single Left Quotation Mark ડાબું એકલ અવતરણ ચિહ્ન + Single Quotes: એકલ અવતરણ ચિહ્નો: + Single Right Quotation Mark જમણું એકલ અવતરણ ચિહ્ન + Single Word Justification: એક શબ્દ જસ્ટિફિકેશન: + Single-line Composer સિંગલ-લાઇન કમ્પોઝર + Sixth Space છઠ્ઠી જગ્યા + Size કદ + Size Tile to Art ટાઇલનું કદ આર્ટ પ્રમાણે કરો + Size/Leading કદ/લીડિંગ + Size: કદ: + Size: {size} Tracking: {tracking} કદ: {size} ટ્રેકિંગ: {tracking} + Sketch સ્કેચ + Skew સ્કીવ + Skew: સ્કીવ: + Skin Tone Ramps સ્કિન ટોન રૅમ્પ + Skip Blank Artboards ખાલી આર્ટબોર્ડ છોડો + Skip Objects with Spot Colors સ્પૉટ રંગવાળા ઑબ્જેક્ટ છોડો + Skip Spaces જગ્યાઓ છોડો + Sky Gradients સ્કાય ગ્રેડિઅન્ટ + Slice સ્લાઇસ + Slice Options સ્લાઇસ વિકલ્પો + Slice Options… સ્લાઇસ વિકલ્પો… + Slice Selection Tool સ્લાઇસ પસંદગી ટૂલ + Slice Tool સ્લાઇસ ટૂલ + Slice Type: સ્લાઇસ પ્રકાર: + Slices સ્લાઇસ + Slices: સ્લાઇસ: + Slide Anchor Along Path પાથ સાથે એન્કર સ્લાઇડ કરો + Sliding સ્લાઇડિંગ + Slope: ઢાળ: + Small નાનું + Small Caps સ્મોલ કૅપ્સ + Small Caps: સ્મોલ કૅપ્સ: + Smaller ↔ Larger નાનું ↔ મોટું + Smart Blur… સ્માર્ટ બ્લર… + Smart Guides સ્માર્ટ ગાઇડ + Smart Guides (View → Smart Guides) સ્માર્ટ ગાઇડ (વ્યૂ → સ્માર્ટ ગાઇડ) + Smart Guides (⌘U) સ્માર્ટ ગાઇડ (⌘U) + Smart Pen સ્માર્ટ પેન + Smart Pen Panel સ્માર્ટ પેન પેનલ + Smart Pen Tool સ્માર્ટ પેન ટૂલ + Smart Punctuation… સ્માર્ટ વિરામચિહ્નો… + Smooth સ્મૂધ + Smooth Anchors… એન્કર સ્મૂધ કરો… + Smooth Tool સ્મૂધ ટૂલ + Smooth… સ્મૂધ કરો… + Smudge Stick… સ્મજ સ્ટિક… + Snap Options સ્નેપ વિકલ્પો + Snap to Glyph ગ્લિફ પર સ્નેપ + Snap to Glyph Options ગ્લિફ પર સ્નેપ વિકલ્પો + Snap to Grid ગ્રિડ પર સ્નેપ + Snap to Last Location છેલ્લા સ્થાન પર સ્નેપ + Snap to Perpendicular લંબ પર સ્નેપ + Snap to Pixel પિક્સેલ પર સ્નેપ + Snap to Point પોઇન્ટ પર સ્નેપ + Snap to Tangent સ્પર્શક પર સ્નેપ + Snapping સ્નેપિંગ + Snapping Tolerance સ્નેપિંગ સહનશીલતા + Soft સૉફ્ટ + Soft Light સૉફ્ટ લાઇટ + Soft Mix સૉફ્ટ મિક્સ + Softness નરમાઈ + Solid સૉલિડ + Some lists were cut short at their limit. કેટલીક યાદીઓ તેમની મર્યાદા પર ટૂંકાવવામાં આવી હતી. + Some scripts were not listed કેટલીક સ્ક્રિપ્ટ યાદીમાં નહોતી + Sort ક્રમ લગાવો + Sort By: આ મુજબ ક્રમ લગાવો: + Sort Objects ઑબ્જેક્ટ ક્રમ લગાવો + Sort Objects… ઑબ્જેક્ટ ક્રમ લગાવો… + Sort Swatches સ્વેચ ક્રમ લગાવો + Sort by Kind પ્રકાર મુજબ ક્રમ લગાવો + Sort by Name નામ મુજબ ક્રમ લગાવો + Source Folder: સ્રોત ફોલ્ડર: + Source code on GitHub GitHub પર સ્રોત કોડ + Space After Paragraph ફકરા પછી જગ્યા + Space Before Paragraph ફકરા પહેલાં જગ્યા + Spaces જગ્યાઓ + Spacing Guides અંતર ગાઇડ + Spacing: અંતર: + Spanish સ્પેનિશ + Sparkle સ્પાર્કલ + Spatter… સ્પૅટર… + Specify: ઉલ્લેખ કરો: + Spectrum Gradients સ્પેક્ટ્રમ ગ્રેડિઅન્ટ + Spelling જોડણી + Spelling Suggestions જોડણી સૂચનો + Spiral સ્પાઇરલ + Spiral Tool સ્પાઇરલ ટૂલ + Split Freeform Line ફ્રીફોર્મ રેખા વિભાજિત કરો + Split Into Grid ગ્રિડમાં વિભાજિત કરો + Split Into Grid… ગ્રિડમાં વિભાજિત કરો… + Split Path પાથ વિભાજિત કરો + Split Text at Cursor કર્સર પર ટેક્સ્ટ વિભાજિત કરો + Split at Anchors… એન્કર પર વિભાજિત કરો… + Split at Crossings ક્રોસિંગ પર વિભાજિત કરો + Sponge… સ્પૉન્જ… + Spot Color સ્પૉટ રંગ + Spot Colors સ્પૉટ રંગો + Spot Colors… સ્પૉટ રંગો… + Sprayed Strokes… સ્પ્રે સ્ટ્રોક… + Spread: સ્પ્રેડ: + Square ચોરસ + Squeeze… સ્ક્વિઝ… + Stacked Bar Graph Tool સ્ટૅક્ડ બાર ગ્રાફ ટૂલ + Stacked Column Graph Tool સ્ટૅક્ડ કૉલમ ગ્રાફ ટૂલ + Stained Glass… સ્ટેઇન્ડ ગ્લાસ… + Stair Step સીડી પગથિયું + Stamp… સ્ટૅમ્પ… + Standard માનક + Standard Ligatures માનક લિગેચર + Standard Vertical Roman Alignment માનક વર્ટિકલ રોમન ગોઠવણી + Standard: માનક: + Star સ્ટાર + Star Tool સ્ટાર ટૂલ + Start Global Edit ગ્લોબલ સંપાદન શરૂ કરો + Start Lists From Typed Markers ટાઇપ કરેલા માર્કરથી યાદીઓ શરૂ કરો + Start Normally સામાન્ય રીતે શરૂ કરો + Start Tile શરૂઆતની ટાઇલ + Start arrowhead શરૂઆતનું એરોહેડ + Start from VectorCraft Defaults VectorCraft ડિફૉલ્ટથી શરૂ કરો + Start in Safe Mode સેફ મોડમાં શરૂ કરો + Start: શરૂ: + Static Symbol સ્ટેટિક સિમ્બોલ + Status સ્થિતિ + Status Effects સ્ટેટસ અસરો + Step પગલું + Step Backward એક પગલું પાછળ + Step Forward એક પગલું આગળ + Step Type પગલાનો પ્રકાર + Step by Step પગલાં પ્રમાણે + Steps: પગલાં: + Stop બંધ કરો + Stop Editing Opacity Mask ઓપેસિટી માસ્ક સંપાદન બંધ કરો + Stop Global Edit ગ્લોબલ સંપાદન બંધ કરો + Stop Playing/Recording પ્લેબેક/રેકોર્ડિંગ બંધ કરો + Stop Script સ્ક્રિપ્ટ બંધ કરો + Stop editing the opacity mask ઓપેસિટી માસ્કનું સંપાદન બંધ કરો + Stop the script and undo what it did? Then quit again. સ્ક્રિપ્ટ બંધ કરીને તેણે કરેલું પૂર્વવત્ કરીએ? પછી ફરી બહાર નીકળો. + Stopped બંધ થયું + Straight સીધું + Straight Line સીધી રેખા + Straight or Curved Segment સીધો અથવા વક્ર સેગમેન્ટ + Stray Points છૂટા પોઇન્ટ + Stretch Between Guides ગાઇડ વચ્ચે ખેંચો + Stretch to Fit Stroke Length સ્ટ્રોક લંબાઈ પ્રમાણે ખેંચો + Stretch to fit બંધબેસાડવા ખેંચો + Strikethrough સ્ટ્રાઇકથ્રૂ + String not closed સ્ટ્રિંગ બંધ નથી + Stroke સ્ટ્રોક + Stroke (X), double-click for the Color Picker સ્ટ્રોક (X), કલર પિકર માટે ડબલ-ક્લિક કરો + Stroke Color સ્ટ્રોક રંગ + Stroke Options સ્ટ્રોક વિકલ્પો + Stroke Tint સ્ટ્રોક ટિન્ટ + Stroke Weight સ્ટ્રોક જાડાઈ + Stroke Weight Down સ્ટ્રોક જાડાઈ ઘટાડો + Stroke Weight Up સ્ટ્રોક જાડાઈ વધારો + Stroke When Editable સંપાદનયોગ્ય હોય ત્યારે સ્ટ્રોક + Stroke options સ્ટ્રોક વિકલ્પો + Stroke: સ્ટ્રોક: + Stroke: click for swatches, Shift-click for the color mixer સ્ટ્રોક: સ્વેચ માટે ક્લિક કરો, કલર મિક્સર માટે Shift-ક્લિક કરો + Strokes use one or more of these brushes. Take the brushes off those strokes and delete the brushes? આ સ્ટ્રોક એક કે વધુ બ્રશ વાપરે છે. તે સ્ટ્રોક પરથી બ્રશ દૂર કરીને બ્રશ કાઢી નાખીએ? + Strong મજબૂત + Style સ્ટાઇલ + Style Name: સ્ટાઇલ નામ: + Style: સ્ટાઇલ: + Styling: સ્ટાઇલિંગ: + Stylistic સ્ટાઇલિસ્ટિક + Stylistic Alternates સ્ટાઇલિસ્ટિક વિકલ્પી + Stylistic Sets સ્ટાઇલિસ્ટિક સેટ + Stylize સ્ટાઇલાઇઝ + Subdivisions ઉપવિભાગો + Subscript સબસ્ક્રિપ્ટ + Subscript: સબસ્ક્રિપ્ટ: + Subset fonts below: નીચેના ફોન્ટ સબસેટ કરો: + Subtract બાદ કરો + Suffix સફિક્સ + Sumi-e… સુમી-ઈ… + Superscript સુપરસ્ક્રિપ્ટ + Superscript: સુપરસ્ક્રિપ્ટ: + Surface સપાટી + Swap Fill and Stroke ફિલ અને સ્ટ્રોક બદલો + Swap Fill and Stroke (Shift+X) ફિલ અને સ્ટ્રોક બદલો (Shift+X) + Swap Objects ઑબ્જેક્ટ બદલો + Swap Objects and Sizes ઑબ્જેક્ટ અને કદ બદલો + Swap start and end arrowheads શરૂઆત અને અંતના એરોહેડ બદલો + Swash સ્વૅશ + Swatch Conflict સ્વેચ વિરોધાભાસ + Swatch Conflicts સ્વેચ વિરોધાભાસ + Swatch Libraries સ્વેચ લાઇબ્રેરી + Swatch Library સ્વેચ લાઇબ્રેરી + Swatch Name: સ્વેચ નામ: + Swatch Options સ્વેચ વિકલ્પો + Swatch Options… સ્વેચ વિકલ્પો… + Swatch Tiles સ્વેચ ટાઇલ + Swatch exchange files keep solid colors only. સ્વેચ એક્સચેન્જ ફાઇલોમાં માત્ર સૉલિડ રંગ રહે છે. + Swatches સ્વેચ + Swedish સ્વીડિશ + Switch Orientation દિશા બદલો + Switch Units એકમો બદલો + Switch workspace વર્કસ્પેસ બદલો + Switch x/y x/y બદલો + Symbol Instance સિમ્બોલ ઇન્સ્ટન્સ + Symbol Instance Appearance સિમ્બોલ ઇન્સ્ટન્સ દેખાવ + Symbol Libraries સિમ્બોલ લાઇબ્રેરી + Symbol Library સિમ્બોલ લાઇબ્રેરી + Symbol Options સિમ્બોલ વિકલ્પો + Symbol Options… સિમ્બોલ વિકલ્પો… + Symbol Screener સિમ્બોલ સ્ક્રીનર + Symbol Screener Tool સિમ્બોલ સ્ક્રીનર ટૂલ + Symbol Scruncher સિમ્બોલ સ્ક્રન્ચર + Symbol Scruncher Tool સિમ્બોલ સ્ક્રન્ચર ટૂલ + Symbol Set Density: સિમ્બોલ સેટ ઘનતા: + Symbol Shifter સિમ્બોલ શિફ્ટર + Symbol Shifter Tool સિમ્બોલ શિફ્ટર ટૂલ + Symbol Sizer સિમ્બોલ સાઇઝર + Symbol Sizer Tool સિમ્બોલ સાઇઝર ટૂલ + Symbol Spinner સિમ્બોલ સ્પિનર + Symbol Spinner Tool સિમ્બોલ સ્પિનર ટૂલ + Symbol Sprayer સિમ્બોલ સ્પ્રેયર + Symbol Sprayer Tool સિમ્બોલ સ્પ્રેયર ટૂલ + Symbol Stainer સિમ્બોલ સ્ટેઇનર + Symbol Stainer Tool સિમ્બોલ સ્ટેઇનર ટૂલ + Symbol Styler સિમ્બોલ સ્ટાઇલર + Symbol Styler Tool સિમ્બોલ સ્ટાઇલર ટૂલ + Symbol Type: સિમ્બોલ પ્રકાર: + Symbolism Tool સિમ્બોલિઝમ ટૂલ + Symbolism Tools Options સિમ્બોલિઝમ ટૂલ્સ વિકલ્પો + Symbols સિમ્બોલ + Syntax newer than ES3 ES3 કરતાં નવું સિન્ટેક્સ + System Layout સિસ્ટમ લેઆઉટ + System Title Bar સિસ્ટમ ટાઇટલ બાર + System Title Bar takes precedence over this option while it is on. ચાલુ હોય ત્યારે સિસ્ટમ ટાઇટલ બાર આ વિકલ્પ પર પ્રાધાન્ય ધરાવે છે. + Tab ટૅબ + Tab Stops ટૅબ સ્ટૉપ + Table ટેબલ + Tabs ટૅબ + Tamil તમિલ + Taper ટેપર + Target લક્ષ્ય + Target Contents લક્ષ્ય સામગ્રી + Target: લક્ષ્ય: + Tate-chu-yoko તેટે-ચુ-યોકો + Tate-chu-yoko Settings તેટે-ચુ-યોકો સેટિંગ્સ + Tate-chu-yoko Settings… તેટે-ચુ-યોકો સેટિંગ્સ… + Telugu તેલુગુ + Temperature તાપમાન + Temperature/Tint… તાપમાન/ટિન્ટ… + Template ટેમ્પ્લેટ + Template literal not closed ટેમ્પ્લેટ લિટરલ બંધ નથી + Templates Folder ટેમ્પ્લેટ ફોલ્ડર + Text ટેક્સ્ટ + Text Displayed in Cell: સેલમાં દેખાતો ટેક્સ્ટ: + Text Export Options ટેક્સ્ટ નિકાસ વિકલ્પો + Text Fill & Stroke Color ટેક્સ્ટ ફિલ અને સ્ટ્રોક રંગ + Text Fill Color ટેક્સ્ટ ફિલ રંગ + Text Flow ટેક્સ્ટ ફ્લો + Text Import Options ટેક્સ્ટ આયાત વિકલ્પો + Text Orientation ટેક્સ્ટ દિશા + Text Stroke Color ટેક્સ્ટ સ્ટ્રોક રંગ + Text Tweaker ટેક્સ્ટ ટ્વીકર + Text Tweaker… ટેક્સ્ટ ટ્વીકર… + Text Wrap ટેક્સ્ટ રૅપ + Text Wrap Options ટેક્સ્ટ રૅપ વિકલ્પો + Text Wrap Options… ટેક્સ્ટ રૅપ વિકલ્પો… + Text: ટેક્સ્ટ: + Texture ટેક્સ્ચર + Texturizer… ટેક્સ્ચરાઇઝર… + Thai થાઈ + The Print Tiling tool placed the pages. પ્રિન્ટ ટાઇલિંગ ટૂલે પૃષ્ઠો ગોઠવ્યાં. + The Scripts folder cannot be read સ્ક્રિપ્ટ્સ ફોલ્ડર વાંચી શકાતું નથી + The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. જ્યારે VECTORCRAFT_TITLEBAR એન્વાયર્નમેન્ટ વેરિએબલ સેટ હોય ત્યારે તે ટાઇટલ બાર પસંદ કરે છે. + The active document changed while the screen color sampler was open સ્ક્રીન રંગ સેમ્પલર ખુલ્લું હતું ત્યારે સક્રિય દસ્તાવેજ બદલાયો + The art keeps its own colors. આર્ટમાં પોતાના રંગો રહે છે. + The bounds of the visible art. દેખાતી આર્ટની સીમાઓ. + The cell shows the type object's text as HTML. સેલ ટાઇપ ઑબ્જેક્ટનો ટેક્સ્ટ HTML તરીકે બતાવે છે. + The defaults are applied when you click OK in Preferences. Cancel there keeps your current preferences. તમે સેટિંગ્સમાં ઠીક ક્લિક કરો ત્યારે ડિફોલ્ટ લાગુ થાય છે. ત્યાં રદ કરો તમારી હાલની પસંદગીઓ જાળવી રાખે છે. + The dialog was closed before its file dialog answered ફાઇલ ડાયલૉગનો જવાબ મળે તે પહેલાં ડાયલૉગ બંધ થયો + The document has no colour swatches. દસ્તાવેજમાં કોઈ રંગ સ્વેચ નથી. + The document was closed while its file dialog was open ફાઇલ ડાયલૉગ ખુલ્લું હતું ત્યારે દસ્તાવેજ બંધ થયો + The edge of the paper the printer can't reach: the art goes inside it, and the preview shows it dashed. પ્રિન્ટર પહોંચી ન શકે તે કાગળની કિનારી: આર્ટ તેની અંદર જાય છે, અને પૂર્વાવલોકનમાં તે ડૅશ સાથે દેખાય છે. + The file is too large to read in full, so only its first part is listed. ફાઇલ પૂરી વાંચવા માટે ખૂબ મોટી છે, તેથી તેનો માત્ર પહેલો ભાગ દર્શાવ્યો છે. + The key color becomes the stroke color. The other colors shift their hue by the same amount and keep their saturation and brightness. મુખ્ય રંગ સ્ટ્રોક રંગ બને છે. બીજા રંગોનો હ્યુ એટલો જ બદલાય છે અને તેમની સંતૃપ્તિ તથા તેજ જળવાય છે. + The last launch of VectorCraft stopped while the plug-in {name} was loading. It may not be what stopped it. છેલ્લી વખત VectorCraft શરૂ થતાં પ્લગ-ઇન {name} લોડ થતું હતું ત્યારે બંધ પડ્યું. તે કારણ ન પણ હોય. + The name in the save panel was “{typed}”; VectorCraft added the file type's extension. Replacing the file overwrites its contents. સાચવો પેનલમાં નામ “{typed}” હતું; VectorCraft એ ફાઇલ પ્રકારનું એક્સ્ટેન્શન ઉમેર્યું. ફાઇલ બદલવાથી તેની સામગ્રી ઓવરરાઇટ થશે. + The page as it prints છાપતી વખતે પૃષ્ઠ જેવું દેખાય છે + The plug-in is computing… પ્લગ-ઇન ગણતરી કરી રહ્યું છે… + The plug-in writes the whole document. પ્લગ-ઇન આખો દસ્તાવેજ લખે છે. + The samples show this brush on a blue stroke. નમૂનાઓ આ બ્રશને વાદળી સ્ટ્રોક પર બતાવે છે. + The search stopped at its limit: search a smaller folder. શોધ તેની મર્યાદાએ અટકી: નાનું ફોલ્ડર શોધો. + The selected character's font is not available. પસંદ કરેલા અક્ષરનો ફૉન્ટ ઉપલબ્ધ નથી. + The selected objects have no CSS of their own (see below). પસંદ કરેલી ઑબ્જેક્ટ્સની પોતાની CSS નથી (નીચે જુઓ). + The system's settings of this printer આ પ્રિન્ટરની સિસ્ટમ સેટિંગ્સ + These fonts aren't available. Their text shows in another font. આ ફૉન્ટ ઉપલબ્ધ નથી. તેમનો ટેક્સ્ટ બીજા ફૉન્ટમાં દેખાય છે. + Thin Space પાતળી જગ્યા + Third Space ત્રીજી જગ્યા + Third Vanishing Point: ત્રીજો વેનિશિંગ પૉઇન્ટ: + This document already has a swatch named “{name}” with another color. આ દસ્તાવેજમાં “{name}” નામનો સ્વેચ બીજા રંગ સાથે પહેલેથી છે. + This file is not the plug-in installed before with this ID. It gets the settings and cache kept for that ID. આ ફાઇલ આ ID સાથે અગાઉ ઇન્સ્ટોલ થયેલું પ્લગ-ઇન નથી. તેને તે ID માટે રાખેલી સેટિંગ્સ અને કૅશ મળે છે. + This library is empty આ લાઇબ્રેરી ખાલી છે + This panel is on the roadmap (see the parity plan). આ પૅનલ રોડમૅપ પર છે (પૅરિટી યોજના જુઓ). + This script has added a great many objects. Continue, or stop it and undo what it did? આ સ્ક્રિપ્ટે ઘણી બધી ઑબ્જેક્ટ્સ ઉમેરી છે. ચાલુ રાખીએ, કે તેને બંધ કરીને તેણે જે કર્યું તે પૂર્વવત્ કરીએ? + This system has no screen color sampler આ સિસ્ટમમાં સ્ક્રીન રંગ સેમ્પલર નથી + Thread Text થ્રેડ ટેક્સ્ટ + Threaded Text થ્રેડેડ ટેક્સ્ટ + Threads થ્રેડ્સ + Three Point ત્રણ બિંદુ + Three Point Perspective ત્રણ બિંદુ પર્સ્પેક્ટિવ + Three Point Perspective Preset 1 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 1 + Three Point Perspective Preset 2 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 2 + Three Point Perspective Preset 3 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 3 + Three Point Perspective Preset 4 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 4 + Three Point Perspective Preset 5 ત્રણ બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 5 + Thumbnails: થંબનેલ: + Tile ટાઇલ + Tile Edge Color ટાઇલ કિનારીનો રંગ + Tile Edge Color… ટાઇલ કિનારીનો રંગ… + Tile Range: ટાઇલ શ્રેણી: + Tile Type: ટાઇલ પ્રકાર: + Tiles are numbered across, then down; leave the range empty for every tile. ટાઇલ આડી રીતે, પછી ઊભી રીતે ક્રમાંકિત છે; દરેક ટાઇલ માટે શ્રેણી ખાલી છોડો. + Tint ટિન્ટ + Tints ટિન્ટ્સ + Tints and Shades ટિન્ટ્સ અને શેડ્સ + Tips ટિપ્સ + Title Case ટાઇટલ કેસ + Titling Alternates ટાઇટલિંગ વૈકલ્પિક અક્ષરો + To: સુધી: + Toggle Fill/Stroke Focus ભરો/સ્ટ્રોક ફોકસ ટૉગલ કરો + Toggle Line Composer લાઇન કમ્પોઝર ટૉગલ કરો + Toggle Selection પસંદગી ટૉગલ કરો + Toggle single/double column એક/બે કૉલમ ટૉગલ કરો + Tolerance સહનશીલતા + Tolerance: સહનશીલતા: + Tone 1 ટોન 1 + Tone 2 ટોન 2 + Tone 3 ટોન 3 + Tone 4 ટોન 4 + Too large to check તપાસવા માટે ખૂબ મોટું + Tool Option ટૂલ વિકલ્પ + Tool Options… ટૂલ વિકલ્પો… + Toolbar: Add Tool ટૂલબાર: ટૂલ ઉમેરો + Toolbar: Advanced / Basic ટૂલબાર: એડવાન્સ્ડ / બેઝિક + Toolbar: Remove Tool ટૂલબાર: ટૂલ કાઢી નાખો + Toolbar: Reset ટૂલબાર: રીસેટ કરો + Toolbar: Show Controls ટૂલબાર: નિયંત્રણો બતાવો + Toolbar: Single/Double Column ટૂલબાર: એક/બે કૉલમ + Toolbars ટૂલબાર + Tools ટૂલ્સ + Tools take a single key (optionally with Shift) ટૂલ્સ એક જ કી લે છે (વૈકલ્પિક રીતે Shift સાથે) + Top ઉપર + Top Left ઉપર ડાબે + Top Left: ઉપર ડાબે: + Top Right ઉપર જમણે + Top Right: ઉપર જમણે: + Top to Bottom ઉપરથી નીચે + Top-Justified Tab ઉપર-સંરેખિત ટૅબ + Top-to-Top Leading ઉપરથી ઉપર લીડિંગ + Top: ઉપર: + Torn Edges… ફાટેલી કિનારીઓ… + Total Width: કુલ પહોળાઈ: + Total: કુલ: + Touch ટચ + Touch Type ટચ ટાઇપ + Touch Type Tool ટચ ટાઇપ ટૂલ + Touching સ્પર્શતું + Tracing ટ્રેસિંગ + Tracing the colors… રંગોનું ટ્રેસિંગ… + Tracking ટ્રેકિંગ + Trackpad Gesture to Rotate View વ્યૂ ફેરવવા માટે ટ્રૅકપૅડ જેસ્ચર + Trademark Symbol ટ્રેડમાર્ક ચિહ્ન + Transform ટ્રાન્સફોર્મ + Transform Again ફરી ટ્રાન્સફોર્મ કરો + Transform Both બંનેને ટ્રાન્સફોર્મ કરો + Transform Each દરેકને ટ્રાન્સફોર્મ કરો + Transform Each… દરેકને ટ્રાન્સફોર્મ કરો… + Transform Object Only માત્ર ઑબ્જેક્ટ ટ્રાન્સફોર્મ કરો + Transform Objects ઑબ્જેક્ટ્સ ટ્રાન્સફોર્મ કરો + Transform Panel ટ્રાન્સફોર્મ પૅનલ + Transform Pattern Only માત્ર પૅટર્ન ટ્રાન્સફોર્મ કરો + Transform Pattern Tiles પૅટર્ન ટાઇલ્સ ટ્રાન્સફોર્મ કરો + Transform Patterns પૅટર્ન ટ્રાન્સફોર્મ કરો + Transform Tools ટ્રાન્સફોર્મ ટૂલ્સ + Transform in Perspective પર્સ્પેક્ટિવમાં ટ્રાન્સફોર્મ કરો + Transform options ટ્રાન્સફોર્મ વિકલ્પો + Transform… ટ્રાન્સફોર્મ… + Transparency પારદર્શિતા + Transparency Flattener Presets પારદર્શિતા ફ્લેટનર પ્રીસેટ્સ + Transparency Flattener Presets… પારદર્શિતા ફ્લેટનર પ્રીસેટ્સ… + Transparency Grid પારદર્શિતા ગ્રિડ + Transparency Info પારદર્શિતા માહિતી + Transparency Options પારદર્શિતા વિકલ્પો + Transparency is flattened with the preset. Type is written as outlines; gradients as bands of colour. પ્રીસેટ સાથે પારદર્શિતા ફ્લેટન થાય છે. ટાઇપ આઉટલાઇન તરીકે લખાય છે; ગ્રેડિયન્ટ રંગની પટ્ટીઓ તરીકે. + Transparency is flattened with the preset. Type is written as outlines; gradients stay smooth. પ્રીસેટ સાથે પારદર્શિતા ફ્લેટન થાય છે. ટાઇપ આઉટલાઇન તરીકે લખાય છે; ગ્રેડિયન્ટ સરળ રહે છે. + Transparent પારદર્શક + Transparent Background પારદર્શક પૃષ્ઠભૂમિ + Transparent Images: પારદર્શક છબીઓ: + Transpose ટ્રાન્સપોઝ + Transverse (the page a quarter turn on the paper) ટ્રાન્સવર્સ (પૃષ્ઠ કાગળ પર ચોથા ભાગનો વળાંક) + Trap… ટ્રૅપ… + Trim ટ્રિમ + Trim View ટ્રિમ વ્યૂ + Trim covered geometry on Expand Appearance. Live preview keeps the full surface. Transparent paints and surfaces exceeding visibility limits retain all faces. Expand Appearance પર ઢંકાયેલી ભૂમિતિ ટ્રિમ કરો. લાઇવ પૂર્વાવલોકન આખી સપાટી જાળવે છે. પારદર્શક પેઇન્ટ્સ અને દૃશ્યતા મર્યાદા વટાવતી સપાટીઓ બધી ફેસ જાળવે છે. + Trim mark weight: ટ્રિમ માર્કની જાડાઈ: + True colour needs version 2004 or later: the nearest of 256 colours is written. ટ્રૂ કલર માટે સંસ્કરણ 2004 કે તેથી નવું જોઈએ: 256 રંગોમાંથી નજીકનો લખાય છે. + Turkish તુર્કી + Turn off Data Recovery for complex documents જટિલ દસ્તાવેજો માટે ડેટા રિકવરી બંધ કરો + Tweak… ટ્વીક… + Twirl ટ્વિર્લ + Twirl Rate: ટ્વિર્લ દર: + Twirl Tool ટ્વિર્લ ટૂલ + Twist ટ્વિસ્ટ + Twist… ટ્વિસ્ટ… + Two Point બે બિંદુ + Two Point Perspective બે બિંદુ પર્સ્પેક્ટિવ + Two Point Perspective Preset 1 બે બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 1 + Two Point Perspective Preset 2 બે બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 2 + Two Point Perspective Preset 3 બે બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 3 + Two Point Perspective Preset 4 બે બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 4 + Two Point Perspective Preset 5 બે બિંદુ પર્સ્પેક્ટિવ પ્રીસેટ 5 + Type ટાઇપ + Type Object Selection by Path Only માત્ર પાથ દ્વારા ટાઇપ ઑબ્જેક્ટ પસંદગી + Type Orientation ટાઇપ દિશા + Type Tool ટાઇપ ટૂલ + Type Tools ટાઇપ ટૂલ્સ + Type becomes outlines, and strokes a CAD line can't draw become filled shapes. ટાઇપ આઉટલાઇન બને છે, અને CAD લાઇન દોરી ન શકે તેવા સ્ટ્રોક ભરેલા આકાર બને છે. + Type on a Path પાથ પર ટાઇપ + Type on a Path Options પાથ પર ટાઇપ વિકલ્પો + Type on a Path Options… પાથ પર ટાઇપ વિકલ્પો… + Type on a Path Tool પાથ પર ટાઇપ ટૂલ + Type stays text, and every stroke is a line with its lineweight and dashes. ટાઇપ ટેક્સ્ટ જ રહે છે, અને દરેક સ્ટ્રોક તેની લાઇનની જાડાઈ અને ડૅશ સાથેની લાઇન છે. + Type: ટાઇપ: + Type… ટાઇપ… + Typing ટાઇપિંગ + Typography ટાઇપોગ્રાફી + UI Brightness UI તેજ + UI Frames UI ફ્રેમ્સ + UI Scaling UI સ્કેલિંગ + UPPERCASE અપરકેસ + URL: URL: + Unbind Variable વેરિએબલ અનબાઇન્ડ કરો + Underline અધોરેખા + Underpainting… અંડરપેઇન્ટિંગ… + Undo પૂર્વવત્ કરો + Undo {name} {name} પૂર્વવત્ કરો + Unembed એમ્બેડ દૂર કરો + Unembed… એમ્બેડ દૂર કરો… + Ungroup અનગ્રુપ કરો + Ungroup Color Group રંગ ગ્રુપ અનગ્રુપ કરો + Uniform યુનિફોર્મ + Uniformly Scaled સમાન રીતે સ્કેલ કરેલ + Unite યુનાઇટ + Units એકમો + Units: એકમો: + Units: {units} એકમો: {units} + Unknown directive અજાણ્યો નિર્દેશ + Unlink Opacity Mask ઓપેસિટી માસ્કનું લિંક દૂર કરો + Unlink harmony colors હાર્મની રંગોનું લિંક દૂર કરો + Unlink the mask માસ્કનું લિંક દૂર કરો + Unlock અનલૉક કરો + Unlock All બધું અનલૉક કરો + Unlock All Layers બધા લેયર અનલૉક કરો + Unlock Artboards આર્ટબોર્ડ અનલૉક કરો + Unlock Grid ગ્રિડ અનલૉક કરો + Unlock Guides ગાઇડ અનલૉક કરો + Unlock Selected પસંદ કરેલું અનલૉક કરો + Unlock Variables વેરિએબલ અનલૉક કરો + Unnamed Objects નામ વગરની ઑબ્જેક્ટ્સ + Unprintable margin: અછાપી હાંસિયો: + Unselected Artwork પસંદ ન કરેલી આર્ટવર્ક + Unsharp Mask… અનશાર્પ માસ્ક… + Unshift Unshift + Up/Down: ઉપર/નીચે: + Update Changed Links બદલાયેલી લિંક્સ અપડેટ કરો + Update Data Set ડેટા સેટ અપડેટ કરો + Update Dimensions પરિમાણ અપડેટ કરો + Update Link લિંક અપડેટ કરો + Update Links લિંક્સ અપડેટ કરો + Update Modified Links સુધારેલી લિંક્સ અપડેટ કરો + Update Selection પસંદગી અપડેટ કરો + Update While Dragging ખસેડતી વખતે અપડેટ કરો + Urdu ઉર્દૂ + Use વાપરો + Use Artboards આર્ટબોર્ડ વાપરો + Use Black Point Compensation બ્લેક પૉઇન્ટ કમ્પેન્સેશન વાપરો + Use Compression કમ્પ્રેશન વાપરો + Use Document Raster Effects Resolution દસ્તાવેજ રાસ્ટર અસર રિઝોલ્યુશન વાપરો + Use Even-Odd Fill Rule ઇવન-ઓડ ભરો નિયમ વાપરો + Use Japanese Crop Marks જાપાનીઝ ક્રોપ માર્ક્સ વાપરો + Use Library Item લાઇબ્રેરી આઇટમ વાપરો + Use Low Resolution Proxy for Linked EPS લિંક થયેલ EPS માટે ઓછા રિઝોલ્યુશનનો પ્રોક્સી વાપરો + Use Non-Zero Winding Fill Rule નૉન-ઝીરો વાઇન્ડિંગ ભરો નિયમ વાપરો + Use Outside Rectangle As Frame બહારના લંબચોરસને ફ્રેમ તરીકે વાપરો + Use Precise Cursors ચોક્કસ કર્સર વાપરો + Use Pressure Pen પ્રેશર પેન વાપરો + Use Preview Bounds પૂર્વાવલોકન સીમા વાપરો + Use Registration Point for Symbol સિમ્બોલ માટે રજિસ્ટ્રેશન બિંદુ વાપરો + Use Square for Previews પૂર્વાવલોકન માટે ચોરસ વાપરો + Use System Defaults for Edit Original ઓરિજિનલ એડિટ કરવા માટે સિસ્ટમ ડિફોલ્ટ વાપરો + Use Text for Previews પૂર્વાવલોકન માટે ટેક્સ્ટ વાપરો + Use Typographer's Quotes ટાઇપોગ્રાફર ક્વોટ્સ વાપરો + Use document bleed settings દસ્તાવેજની બ્લીડ સેટિંગ્સ વાપરો + Use the Selected Text's Font પસંદ કરેલા ટેક્સ્ટનો ફૉન્ટ વાપરો + User Brush Library 1 વપરાશકર્તા બ્રશ લાઇબ્રેરી 1 + User Brush Library 10 વપરાશકર્તા બ્રશ લાઇબ્રેરી 10 + User Brush Library 2 વપરાશકર્તા બ્રશ લાઇબ્રેરી 2 + User Brush Library 3 વપરાશકર્તા બ્રશ લાઇબ્રેરી 3 + User Brush Library 4 વપરાશકર્તા બ્રશ લાઇબ્રેરી 4 + User Brush Library 5 વપરાશકર્તા બ્રશ લાઇબ્રેરી 5 + User Brush Library 6 વપરાશકર્તા બ્રશ લાઇબ્રેરી 6 + User Brush Library 7 વપરાશકર્તા બ્રશ લાઇબ્રેરી 7 + User Brush Library 8 વપરાશકર્તા બ્રશ લાઇબ્રેરી 8 + User Brush Library 9 વપરાશકર્તા બ્રશ લાઇબ્રેરી 9 + User Defined વપરાશકર્તા વ્યાખ્યાયિત + User Defined Libraries વપરાશકર્તા વ્યાખ્યાયિત લાઇબ્રેરીઓ + User Graphic Style Library 1 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 1 + User Graphic Style Library 10 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 10 + User Graphic Style Library 2 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 2 + User Graphic Style Library 3 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 3 + User Graphic Style Library 4 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 4 + User Graphic Style Library 5 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 5 + User Graphic Style Library 6 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 6 + User Graphic Style Library 7 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 7 + User Graphic Style Library 8 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 8 + User Graphic Style Library 9 વપરાશકર્તા ગ્રાફિક સ્ટાઇલ લાઇબ્રેરી 9 + User Interface યુઝર ઇન્ટરફેસ + User Swatch Library 1 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 1 + User Swatch Library 10 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 10 + User Swatch Library 2 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 2 + User Swatch Library 3 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 3 + User Swatch Library 4 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 4 + User Swatch Library 5 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 5 + User Swatch Library 6 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 6 + User Swatch Library 7 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 7 + User Swatch Library 8 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 8 + User Swatch Library 9 વપરાશકર્તા સ્વેચ લાઇબ્રેરી 9 + User Symbol Library 1 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 1 + User Symbol Library 10 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 10 + User Symbol Library 2 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 2 + User Symbol Library 3 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 3 + User Symbol Library 4 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 4 + User Symbol Library 5 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 5 + User Symbol Library 6 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 6 + User Symbol Library 7 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 7 + User Symbol Library 8 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 8 + User Symbol Library 9 વપરાશકર્તા સિમ્બોલ લાઇબ્રેરી 9 + Username વપરાશકર્તાનામ + Uses every data set of the open document. ખુલ્લા દસ્તાવેજના દરેક ડેટા સેટનો ઉપયોગ કરે છે. + V Spacing: V અંતર: + V: V: + Variable વેરિએબલ + Variable Font વેરિએબલ ફૉન્ટ + Variable Options… વેરિએબલ વિકલ્પો… + Variable Width Profile વેરિએબલ પહોળાઈ પ્રોફાઇલ + Variables વેરિએબલ્સ + Variation: વેરિએશન: + Vector Effects વેક્ટર અસરો + Vector Halftone વેક્ટર હાફટોન + Vector Halftone… વેક્ટર હાફટોન… + Vector illustration — fast, open, scriptable. વેક્ટર ઇલસ્ટ્રેશન — ઝડપી, ખુલ્લું, સ્ક્રિપ્ટેબલ. + VectorCraft VectorCraft + VectorCraft Help… VectorCraft મદદ… + VectorCraft Title Bar on Every Desktop દરેક ડેસ્કટૉપ પર VectorCraft ટાઇટલ બાર + VectorCraft Updates VectorCraft અપડેટ્સ + VectorCraft copies the fonts to {folder}. VectorCraft ફૉન્ટ્સ {folder} માં કૉપિ કરે છે. + VectorCraft didn't quit normally last time. These documents had unsaved changes: છેલ્લી વખત VectorCraft સામાન્ય રીતે બંધ થયું નહોતું. આ દસ્તાવેજોમાં સાચવ્યા વગરના ફેરફારો હતા: + VectorCraft documents: one locked object, updated when the file changes. VectorCraft દસ્તાવેજો: એક લૉક ઑબ્જેક્ટ, ફાઇલ બદલાય ત્યારે અપડેટ થાય છે. + VectorCraft is in Safe Mode: no plug-ins load or run until it starts normally. VectorCraft સેફ મોડમાં છે: સામાન્ય રીતે શરૂ ન થાય ત્યાં સુધી કોઈ પ્લગ-ઇન લોડ કે ચાલતા નથી. + VectorCraft on GitHub GitHub પર VectorCraft + VectorCraft on getartcraft.com getartcraft.com પર VectorCraft + VectorCraft read this script without running it. VectorCraft એ સ્ક્રિપ્ટ ચલાવ્યા વગર વાંચી. + VectorCraft {release} and later (version {n}) VectorCraft {release} અને પછીનાં (સંસ્કરણ {n}) + Vectors વેક્ટર્સ + Version સંસ્કરણ + Version {version} — open-source vector illustration in pure Rust. સંસ્કરણ {version} — શુદ્ધ Rust માં ઓપન-સોર્સ વેક્ટર ઇલસ્ટ્રેશન. + Version: સંસ્કરણ: + Version: {version} સંસ્કરણ: {version} + Vertical ઊભું + Vertical Align Bottom ઊભું સંરેખણ: નીચે + Vertical Align Center ઊભું સંરેખણ: મધ્ય + Vertical Align Top ઊભું સંરેખણ: ઉપર + Vertical Area Type Tool ઊભું એરિયા ટાઇપ ટૂલ + Vertical Distribute Bottom ઊભું વિતરણ: નીચે + Vertical Distribute Center ઊભું વિતરણ: મધ્ય + Vertical Distribute Space ઊભું વિતરણ: જગ્યા + Vertical Distribute Top ઊભું વિતરણ: ઉપર + Vertical Dividers: ઊભા વિભાજકો: + Vertical Guide ઊભી ગાઇડ + Vertical Scale ઊભું સ્કેલ + Vertical Scale % ઊભું સ્કેલ % + Vertical Type Tool ઊભું ટાઇપ ટૂલ + Vertical Type on a Path Tool પાથ પર ઊભું ટાઇપ ટૂલ + Vertical: ઊભું: + Vertically Scaled ઊભી રીતે સ્કેલ કરેલ + Video વિડિયો + Video Ruler Pixel Aspect Ratio: વિડિયો રૂલર પિક્સેલ ગુણોત્તર: + View વ્યૂ + View Artboard Only માત્ર આર્ટબોર્ડ જુઓ + View Opacity Mask ઓપેસિટી માસ્ક જુઓ + View PDF after saving સાચવ્યા પછી PDF જુઓ + Viewing Angle: જોવાનો ખૂણો: + Viewing Distance: જોવાનું અંતર: + Violet વાયોલેટ + Visibility દૃશ્યતા + Volume વૉલ્યૂમ + W: W: + Warnings ચેતવણીઓ + Warp વૉર્પ + Warp Options વૉર્પ વિકલ્પો + Warp Tool વૉર્પ ટૂલ + Water Paper… વૉટર પેપર… + Watercolor… વૉટરકલર… + Wave… વેવ… + Web વેબ + Web Safe 216 વેબ સેફ 216 + Web Shift વેબ શિફ્ટ + Web Snap: વેબ સ્નૅપ: + Weight જાડાઈ + Weight: જાડાઈ: + Welcome to VectorCraft VectorCraft માં સ્વાગત છે + When pasting text ટેક્સ્ટ ચોંટાડતી વખતે + White સફેદ + Wide Blurry પહોળું ઝાંખું + Wide Sharp પહોળું તીક્ષ્ણ + Widget Position: વિજેટ સ્થાન: + Width પહોળાઈ + Width Point પહોળાઈ બિંદુ + Width Point Edit પહોળાઈ બિંદુ સંપાદન + Width Point Edit… પહોળાઈ બિંદુ સંપાદન… + Width Profile પહોળાઈ પ્રોફાઇલ + Width Profiles પહોળાઈ પ્રોફાઇલ્સ + Width Tool પહોળાઈ ટૂલ + Width and Height પહોળાઈ અને ઊંચાઈ + Width: પહોળાઈ: + Window વિન્ડો + Wireframe વાયરફ્રેમ + Word Spacing: શબ્દ અંતર: + Words Longer Than: આનાથી લાંબા શબ્દો: + Working CMYK કાર્યકારી CMYK + Workspace વર્કસ્પેસ + Wrinkle કરચલી + Wrinkle Tool કરચલી ટૂલ + Write Layers લેયર લખો + Write the document as a file in its own format દસ્તાવેજને તેના પોતાના ફૉર્મેટમાં ફાઇલ તરીકે લખો + Writes, moves or deletes files ફાઇલો લખે, ખસેડે કે કાઢી નાખે છે + X11 (XWayland) X11 (XWayland) + X11 (XWayland) When a Pen Is Attached પેન જોડાયેલ હોય ત્યારે X11 (XWayland) + XML ID XML ID + XML literal not closed XML લિટરલ બંધ નથી + Yards યાર્ડ + Yes હા + Your browser downloads the files (several as one .zip). તમારું બ્રાઉઝર ફાઇલો ડાઉનલોડ કરે છે (ઘણી એક .zip તરીકે). + Your changes will be lost if you don't save them. તમે સાચવશો નહીં તો તમારા ફેરફારો ખોવાઈ જશે. + Zig Zag… ઝિગ ઝૅગ… + Zoom ઝૂમ + Zoom In ઝૂમ ઇન + Zoom Out ઝૂમ આઉટ + Zoom Tool ઝૂમ ટૂલ + Zoom to Selection પસંદગી પર ઝૂમ કરો + Zoom with Mouse Wheel માઉસ વ્હીલથી ઝૂમ કરો + [1P-High View] [1P-ઉચ્ચ વ્યૂ] + [1P-Low View] [1P-નીચો વ્યૂ] + [1P-Normal View] [1P-સામાન્ય વ્યૂ] + [2P-High View] [2P-ઉચ્ચ વ્યૂ] + [2P-Low View] [2P-નીચો વ્યૂ] + [2P-Normal View] [2P-સામાન્ય વ્યૂ] + [3P-Low View] [3P-નીચો વ્યૂ] + [3P-Normal View] [3P-સામાન્ય વ્યૂ] + [Default] is protected: New… starts an editable copy. [Default] સુરક્ષિત છે: નવું… સંપાદનયોગ્ય નકલ શરૂ કરે છે. + [Unnamed] [નામ વગરનું] + above ઉપર + dash ડૅશ + e.g. 1-3, 5 દા.ત. 1-3, 5 + fonts not copied: {fonts} ફૉન્ટ્સ કૉપિ થયા નથી: {fonts} + from the format's public description ફૉર્મેટના જાહેર વર્ણન પરથી + from your earlier imports તમારા અગાઉના આયાતોમાંથી + gap અંતર + glyph {id} ગ્લિફ {id} + hyphens હાઇફન + letters અક્ષરો + line {line} લાઇન {line} + lines {lines} લાઇન {lines} + lowercase નાના અક્ષરો + no data set to edit સંપાદન કરવા માટે કોઈ ડેટા સેટ નથી + no data set to rename નામ બદલવા માટે કોઈ ડેટા સેટ નથી + no document કોઈ દસ્તાવેજ નથી + no variable to rename નામ બદલવા માટે કોઈ વેરિએબલ નથી + not known yet હજી જાણીતું નથી + of characters used વપરાયેલા અક્ષરોમાંથી + of {count} {count} માંથી + or more spaces with a tab અથવા વધુ જગ્યાઓ ટૅબ સાથે + per slice પ્રતિ સ્લાઇસ + slices across, evenly spaced આડી સ્લાઇસ, સરખા અંતરે + slices down, evenly spaced ઊભી સ્લાઇસ, સરખા અંતરે + spot સ્પૉટ + the preset પ્રીસેટ + tile {number} ટાઇલ {number} + to થી + x-Height x-ઊંચાઈ + {count} of {total} artboards {total} માંથી {count} આર્ટબોર્ડ + {effect} is already applied {effect} પહેલેથી લાગુ છે + {file}, line {line} {file}, લાઇન {line} + {folders} and {files} searched {folders} ફોલ્ડર અને {files} ફાઇલ શોધાયા + {format} Options {format} વિકલ્પો + {kind} Gradient {kind} ગ્રેડિયન્ટ + {kind}, {model} {kind}, {model} + {name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2} + {name} (spot) {name} (સ્પૉટ) + {pages} in all, {count} per copy કુલ {pages}, પ્રતિ નકલ {count} + {page} of {count} {count} માંથી {page} + {people} contributors · {commits} commits {people} યોગદાનકર્તાઓ · {commits} કમિટ્સ + {percent}% opacity {percent}% ઓપેસિટી + {ready} of {total} ready {total} માંથી {ready} તૈયાર + {secs} sec {secs} સેક + {shortcut} with the tool sizes the brush {shortcut} સાથે ટૂલ બ્રશનું કદ નક્કી કરે છે + {title} (selection) {title} (પસંદગી) + {tool} Options {tool} વિકલ્પો + {tool} Tool Options {tool} ટૂલ વિકલ્પો + {warning}: click to correct to the closest color ({hex}) {warning}: નજીકના રંગ પર સુધારવા ક્લિક કરો ({hex}) + “{file}” is protected by a password. “{file}” પાસવર્ડથી સુરક્ષિત છે. + “{name}” already exists. Replace it? “{name}” પહેલેથી છે. તેને બદલીએ? +antiAlias Sharp શાર્પ + Arabic અરબી + Farsi ફારસી + Devanagari દેવનાગરી + Gurmukhi ગુરમુખી +@plural Result: {n}|Results: {n} પરિણામ: {n}|પરિણામો: {n} +@msg the document sets a bleed that this PDF/X file leaves out: turn on Use document bleed settings દસ્તાવેજ એવી બ્લીડ સેટ કરે છે જે આ PDF/X ફાઇલ છોડી દે છે: "દસ્તાવેજની બ્લીડ સેટિંગ્સ વાપરો" ચાલુ કરો +@msgplural Saved {path} with {n} note: {first}|Saved {path} with {n} notes: {first} {path} સાચવ્યું, {n} નોંધ સાથે: {first}|{path} સાચવ્યું, {n} નોંધો સાથે: {first} +@msgplural Packaged {n} file ({note}) in {folder}|Packaged {n} files ({note}) in {folder} {folder} માં {n} ફાઇલ ({note}) પેકેજ થઈ|{folder} માં {n} ફાઇલો ({note}) પેકેજ થઈ +@msgplural Packaged {n} file {note}|Packaged {n} files {note} {n} ફાઇલ પેકેજ થઈ {note}|{n} ફાઇલો પેકેજ થઈ {note} +@msgplural Packaged {n} file in {folder}|Packaged {n} files in {folder} {folder} માં {n} ફાઇલ પેકેજ થઈ|{folder} માં {n} ફાઇલો પેકેજ થઈ +@msgplural Packaged {n} file|Packaged {n} files {n} ફાઇલ પેકેજ થઈ|{n} ફાઇલો પેકેજ થઈ +@plural Packaged {n} file {note} in {folder}|Packaged {n} files {note} in {folder} {folder} માં {n} ફાઇલ {note} પેકેજ થઈ|{folder} માં {n} ફાઇલો {note} પેકેજ થઈ +@plural Packaged {n} file {note}|Packaged {n} files {note} {n} ફાઇલ પેકેજ થઈ {note}|{n} ફાઇલો પેકેજ થઈ {note} +@plural Packaged {n} file in {folder}|Packaged {n} files in {folder} {folder} માં {n} ફાઇલ પેકેજ થઈ|{folder} માં {n} ફાઇલો પેકેજ થઈ +@plural Packaged {n} file|Packaged {n} files {n} ફાઇલ પેકેજ થઈ|{n} ફાઇલો પેકેજ થઈ +@msg (fonts not copied: {fonts}) (ફૉન્ટ્સ કૉપિ થયા નથી: {fonts}) +@msgplural ({n} linked file not found)|({n} linked files not found) ({n} લિંક કરેલી ફાઇલ મળી નથી)|({n} લિંક કરેલી ફાઇલો મળી નથી) +@msgplural {n} linked file not found|{n} linked files not found {n} લિંક કરેલી ફાઇલ મળી નથી|{n} લિંક કરેલી ફાઇલો મળી નથી +@plural {n} linked file not found|{n} linked files not found {n} લિંક કરેલી ફાઇલ મળી નથી|{n} લિંક કરેલી ફાઇલો મળી નથી +@msg variables that aren't text were left out: {kinds} ટેક્સ્ટ ન હોય તેવા વેરિએબલ છોડી દેવાયા: {kinds} +@msg a new document won't read these variables back with their kind: {names} નવો દસ્તાવેજ આ વેરિએબલ્સને તેમના પ્રકાર સાથે પાછા વાંચશે નહીં: {names} +@msg a new document refuses this file because of these variables: {names} આ વેરિએબલ્સને કારણે નવો દસ્તાવેજ આ ફાઇલ સ્વીકારશે નહીં: {names} +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them `{name}` માટેનું હેડર `{cell}` વેરિએબલ `{other}` તરીકે વંચાશે: બેમાંથી એકનું નામ બદલો +@msg the header `{header}` for `{name}` would read back as the variable `{other}`: rename one of them `{name}` માટેનું હેડર `{header}` વેરિએબલ `{other}` તરીકે વંચાશે: બેમાંથી એકનું નામ બદલો +@msg ({note}) ({more}) ({note}) ({more}) +@msg {note}) ({more} {note} ({more}) +@msg invalid parameters for `{cmd}`: {msg} `{cmd}` માટે અમાન્ય પેરામીટર: {msg} +@msg fonts not copied: {fonts} ફૉન્ટ્સ કૉપિ થયા નથી: {fonts} + Energy Beams ઊર્જા કિરણો + Laser Bolt લેસર બોલ્ટ + Plasma Arc પ્લાઝ્મા આર્ક + Charge Wave ચાર્જ તરંગ + Spark Trail તણખાનો પથ + Skill Icons કૌશલ્ય આઇકન + Attack હુમલો + Defend બચાવ + Heal ઉપચાર + Buff બફ + Ult અલ્ટ + Write pages longer than 200 in at full size in points 200 in થી લાંબા પેજ પૂરા કદમાં, પોઇન્ટ્સમાં લખો + Dynamic Text ડાયનેમિક ટેક્સ્ટ +@msg type on a path in a thread cannot use Dynamic Text: {frames} થ્રેડમાં પાથ પરનું ટાઇપ ડાયનેમિક ટેક્સ્ટ વાપરી શકતું નથી: {frames} +@msg id {value} is a ruler guide, not an object id {value} રૂલર ગાઇડ છે, ઑબ્જેક્ટ નથી +@msg a ruler guide goes only directly in a layer or sublayer રૂલર ગાઇડ ફક્ત સીધા લેયર અથવા સબલેયરમાં જ જાય છે + time unavailable સમય ઉપલબ્ધ નથી + {ms} ms {ms} ms + {time}, {calls} {time}, {calls} + slowest: {commands} સૌથી ધીમા: {commands} + {dropped}, {cut} {dropped}, {cut} +@plural {n} host call|{n} host calls {n} હોસ્ટ કૉલ|{n} હોસ્ટ કૉલ +@plural {n} earlier line dropped|{n} earlier lines dropped {n} અગાઉની લાઇન છોડી|{n} અગાઉની લાઇનો છોડી +@plural {n} line cut|{n} lines cut {n} લાઇન કાપી|{n} લાઇનો કાપી +# Interface labels added since the original native review; contributor proofreading completed 2026-11-14. + Convert to Indexed Color ઇન્ડેક્સ્ડ કલરમાં ફેરવો + Convert to Indexed Color… ઇન્ડેક્સ્ડ કલરમાં ફેરવો… + Image Tools ઇમેજ ટૂલ્સ + Remove Background… પૃષ્ઠભૂમિ દૂર કરો… + Remove Background પૃષ્ઠભૂમિ દૂર કરો + Background પૃષ્ઠભૂમિ + Edge Color કિનારીનો રંગ + Picked Colors પસંદ કરેલા રંગો + Corner Color ખૂણાનો રંગ + Contiguous સળંગ + Each Channel દરેક ચેનલ + Color Mask… કલર માસ્ક… + Color Mask કલર માસ્ક + Remove Color Mask કલર માસ્ક દૂર કરો + Apply Color Mask કલર માસ્ક લાગુ કરો + Delete the selected items and their artwork? પસંદ કરેલી આઇટમ્સ અને તેમની આર્ટવર્ક કાઢી નાખવી છે? + Delete this layer and its artwork? આ લેયર અને તેની આર્ટવર્ક કાઢી નાખવી છે? + Preserve જાળવો + TIFF (Black & White) TIFF (કાળું અને સફેદ) + TIFF (8-bit Color) TIFF (8-bit રંગ) + High Resolution ઉચ્ચ રિઝોલ્યુશન + Medium Resolution મધ્યમ રિઝોલ્યુશન + Low Resolution નીચું રિઝોલ્યુશન + Language Level 2 લેંગ્વેજ લેવલ 2 + Language Level 3 લેંગ્વેજ લેવલ 3 + Select one character with the Type tool first. પહેલા ટાઇપ ટૂલ વડે એક અક્ષર પસંદ કરો. + {glyph} is a glyph of {font}, not of the font the selected text is set in ({text_font}). {glyph} એ {font}નો ગ્લિફ છે, પસંદ કરેલા લખાણના ફોન્ટ ({text_font})નો નથી. + {glyph} belongs to {base} (U+{base_code}) {place}; your selection is {sel} (U+{code}). {glyph} એ {base} (U+{base_code})નો {place} ગ્લિફ છે; તમારી પસંદગી {sel} (U+{code}) છે. + at the start of a word શબ્દની શરૂઆતમાં + in the middle of a word શબ્દની વચ્ચે + at the end of a word શબ્દના અંતે + standing alone સ્વતંત્ર + {glyph} is not an alternate of {sel} (U+{code}) as it stands in its word. શબ્દમાં તેના સ્થાન મુજબ {glyph} એ {sel} (U+{code})નો વૈકલ્પિક ગ્લિફ નથી. + Double-click to insert {base} (U+{code}) instead: a presentation form does not join, the letter does. તેના બદલે {base} (U+{code}) દાખલ કરવા ડબલ-ક્લિક કરો: પ્રેઝન્ટેશન ફોર્મ જોડાતું નથી, અક્ષર જોડાય છે. + Inserted {base} (U+{code}) instead of a presentation form: the font joins it to its neighbors by position. પ્રેઝન્ટેશન ફોર્મના બદલે {base} (U+{code}) દાખલ કર્યો: ફોન્ટ તેને સ્થાન પ્રમાણે આસપાસના અક્ષરો સાથે જોડે છે. + No OpenType feature draws this glyph here, so it replaces the character's glyph and may not join its neighbors. અહીં કોઈ OpenType ફીચર આ ગ્લિફ દોરતું નથી, તેથી તે અક્ષરના ગ્લિફને બદલે છે અને કદાચ આસપાસના અક્ષરો સાથે જોડાશે નહીં. + Show samples on white સફેદ પૃષ્ઠભૂમિ પર નમૂનાઓ બતાવો + Switch Selection and Drawing Modes પસંદગી અને ડ્રોઇંગ મોડ્સ બદલો + Revolve (Classic)… રિવોલ્વ (ક્લાસિક)… + Rotate (Classic)… રોટેટ (ક્લાસિક)… + Painted and Sketched રંગેલું અને સ્કેચ કરેલું + Washed Blue ધોવાયેલો વાદળી + Bristle Ochre બ્રિસલ ગેરુ + Pastel Heather પેસ્ટલ હેધર + Charcoal Shade ચારકોલ છાંયો + Ink Contour શાહીનો કોન્ટૂર + Wet Ink ભીની શાહી + Fine Pen બારીક પેન + Detach અલગ કરો + Detach Object from Path ઑબ્જેક્ટને પાથથી અલગ કરો + Include Variable Data વેરિએબલ ડેટા સામેલ કરો + Pad પેડ + Repeats રિપીટ્સ + YakumonoHankaku YakumonoHankaku + GyomatsuYakumonoHankaku GyomatsuYakumonoHankaku + GyomatsuYakumonoZenkaku GyomatsuYakumonoZenkaku + YakumonoZenkaku YakumonoZenkaku + Blend Easing બ્લેન્ડ ઇઝિંગ + missing from the Brushes panel બ્રશ પેનલમાં નથી + Show DCS Transparency Interactions DCS ટ્રાન્સપરન્સીની પરસ્પર અસરો બતાવો + Transparent, or overlaps transparent objects: check its separations પારદર્શક છે અથવા પારદર્શક ઑબ્જેક્ટ્સ પર આવે છે: તેના કલર સેપરેશન્સ તપાસો + Dynamic Text Presets ડાયનેમિક ટેક્સ્ટ પ્રીસેટ્સ + Arch કમાન + Organic Fades ઑર્ગેનિક ફેડ્સ + Holographic હોલોગ્રાફિક + Preview: પ્રીવ્યૂ: + Insert Aki Left ડાબે અકી ઉમેરો + Insert Aki Right જમણે અકી ઉમેરો + Conic Gradient કોનિક ગ્રેડિયન્ટ + Diamond Gradient ડાયમંડ ગ્રેડિયન્ટ + Include Placed Images પ્લેસ કરેલી ઇમેજો સામેલ કરો + Include Fill Hatches ફિલ હેચિસ સામેલ કરો + Use Monitor Profile for Canvas કેનવાસ માટે મોનિટર પ્રોફાઇલ વાપરો + The canvas is drawn in sRGB. કેનવાસ sRGBમાં દોરાય છે. + Canvas display profile: કેનવાસ ડિસ્પ્લે પ્રોફાઇલ: + The system matches the window to the display's colors. સિસ્ટમ વિન્ડોના રંગો ડિસ્પ્લેના રંગો સાથે મેળવે છે. + No usable display profile was found: the canvas is drawn in sRGB. ઉપયોગી ડિસ્પ્લે પ્રોફાઇલ મળી નથી: કેનવાસ sRGBમાં દોરાય છે. + Create Spine સ્પાઇન બનાવો + Create Spine: સ્પાઇન બનાવો: + Always હંમેશાં + Never ક્યારેય નહીં + Arrowheads એરોહેડ્સ + Edit Arrowheads એરોહેડ્સ સંપાદિત કરો + Edit Arrowheads… એરોહેડ્સ સંપાદિત કરો… + Reload Arrowheads એરોહેડ્સ ફરી લોડ કરો + Color Theme Picker કલર થીમ પિકર + Click or drag across the art to pick its colors; Shift adds more આર્ટના રંગો પસંદ કરવા તેના પર ક્લિક કરો અથવા ડ્રેગ કરો; Shiftથી વધુ ઉમેરાય છે + Prominent Colors મુખ્ય રંગો + Save All Colors બધા રંગો સાચવો + Save Prominent Colors મુખ્ય રંગો સાચવો + Korean Line Break Anywhere કોરિયન લાઇન ગમે ત્યાં તોડો + Bunri-Kinshi બુનરી-કિન્શી + East Asian Composition Settings પૂર્વ એશિયાઈ કમ્પોઝિશન સેટિંગ્સ + Korean Composition Settings કોરિયન કમ્પોઝિશન સેટિંગ્સ + Show Bounding Box While Moving and Drawing ખસેડતી અને દોરતી વખતે બાઉન્ડિંગ બોક્સ બતાવો + Textures ટેક્સ્ચર્સ + Fine Grain બારીક દાણા + Canvas Weave કેનવાસ વણાટ + Burlap Sack શણનો કોથળો + Cracked Glaze તિરાડવાળું ગ્લેઝ + Mosaic Floor મોઝેક ફ્લોર + Quilted Squares ગાદીદાર ચોરસ + Leaded Glass લેડેડ ગ્લાસ + Damp Paper ભીનો કાગળ + Show Recent Colors તાજેતરના રંગો બતાવો + Toggle RGB Percent RGB ટકાવારી ચાલુ/બંધ કરો + Spot Color Objects સ્પોટ કલર ઑબ્જેક્ટ્સ + Pattern Objects પેટર્ન ઑબ્જેક્ટ્સ + Gradient Objects ગ્રેડિયન્ટ ઑબ્જેક્ટ્સ + Font Details ફોન્ટની વિગતો + Linked Images લિંક કરેલી ઇમેજો + Embedded Images એમ્બેડ કરેલી ઇમેજો + Compound Paths કમ્પાઉન્ડ પાથ્સ + Text Objects ટેક્સ્ટ ઑબ્જેક્ટ્સ + Placed Documents પ્લેસ કરેલા દસ્તાવેજો + Symbol Instances સિમ્બોલ ઇન્સ્ટન્સિસ + Gradient Meshes ગ્રેડિયન્ટ મેશિસ + Blends બ્લેન્ડ્સ + Envelopes એન્વલોપ્સ + Intertwine Groups ઇન્ટરટ્વાઇન ગ્રુપ્સ + Opacity Masks ઓપેસિટી માસ્ક્સ + Objects with Effects ઇફેક્ટ્સવાળા ઑબ્જેક્ટ્સ + Pattern Swatches પેટર્ન સ્વેચિસ + Tate-chu-yoko Up/Down ટાટે-ચુ-યોકો ઉપર/નીચે + Tate-chu-yoko Left/Right ટાટે-ચુ-યોકો ડાબે/જમણે + Add Tool… ટૂલ ઉમેરો… + Remove Tool ટૂલ દૂર કરો + Center on Top ઉપર કેન્દ્રિત કરો + Center on Bottom નીચે કેન્દ્રિત કરો + Working RGB (don't tag) વર્કિંગ RGB (ટૅગ ન કરો) + Dock to Left ડાબે ડૉક કરો + Dock to Right જમણે ડૉક કરો + Dock Toolbar ટૂલબાર ડૉક કરો + Float Toolbar ટૂલબાર ફ્લોટ કરો + Control Bar Options કન્ટ્રોલ બાર વિકલ્પો + Tool Options ટૂલ વિકલ્પો + Object Options ઑબ્જેક્ટ વિકલ્પો + Image Options ઇમેજ વિકલ્પો + Vertical Alignment ઊભું એલાઇનમેન્ટ + Align and Distribute સંરેખિત કરો અને વહેંચો + Document Options દસ્તાવેજ વિકલ્પો + Rename Library Item લાઇબ્રેરી આઇટમનું નામ બદલો + Add to Character Styles કેરેક્ટર સ્ટાઇલ્સમાં ઉમેરો + Shadows પડછાયા + Distance from Object ઑબ્જેક્ટથી અંતર + Shadow Bounds પડછાયાની સીમા + Behind Object ઑબ્જેક્ટની પાછળ + Below Object ઑબ્જેક્ટની નીચે + Optical Effects ઑપ્ટિકલ ઇફેક્ટ્સ + Grit Textures ખરબચડા ટેક્સ્ચર્સ + Hue Clockwise હ્યૂ ઘડિયાળની દિશામાં + Hue Counterclockwise હ્યૂ ઘડિયાળની વિરુદ્ધ દિશામાં + Automation asked to install this plug-in. To install it, choose Object › Plug-ins › Install Plug-in… yourself. ઑટોમેશને આ પ્લગ-ઇન ઇન્સ્ટૉલ કરવા કહ્યું છે. ઇન્સ્ટૉલ કરવા માટે જાતે Object › Plug-ins › Install Plug-in… પસંદ કરો. + Move Action Step ઍક્શનનું પગલું ખસેડો + Insert Menu Item… મેનુ આઇટમ ઉમેરો… + Insert Menu Item મેનુ આઇટમ ઉમેરો + Insert Select Path પાથ પસંદ કરવાનું પગલું ઉમેરો + Select Path પાથ પસંદ કરો + Select Object… ઑબ્જેક્ટ પસંદ કરો… + Select Object ઑબ્જેક્ટ પસંદ કરો + Set Selection પસંદગી સેટ કરો + Case Sensitive મોટા-નાના અક્ષરનો ભેદ રાખો + Whole Word આખો શબ્દ + Select Object: {note} ઑબ્જેક્ટ પસંદ કરો: {note} + Select by Note નોંધ દ્વારા પસંદ કરો + Menu Item: મેનુ આઇટમ: + No menu item matches. કોઈ મેનુ આઇટમ મેળ ખાતી નથી. + Several menu items match. Choose one from the list. ઘણી મેનુ આઇટમ્સ મેળ ખાય છે. યાદીમાંથી એક પસંદ કરો. + Items that open a dialog, and File, Window and Help menu items, are not listed. ડાયલોગ ખોલતી આઇટમ્સ અને File, Window તથા Help મેનુની આઇટમ્સ યાદીમાં નથી. + Ink and Wash શાહી અને વૉશ + Tapered Ink ટેપર થયેલી શાહી + Brush Pen બ્રશ પેન + Soft Wash સોફ્ટ વૉશ + Pooling Wash એકઠો થતો વૉશ + Bristle Brushes બ્રિસલ બ્રશ + Fine Liner ફાઇન લાઇનર + Pointed Flat અણીદાર ફ્લેટ + Stubby Round ટૂંકો ગોળ + Dry Scrub સૂકું સ્ક્રબ + Soft Dome સોફ્ટ ડોમ + Filbert ફિલ્બર્ટ + Angled Round ખૂણાવાળો ગોળ + Angled Flat ખૂણાવાળો સપાટ + Fan Blender ફેન બ્લેન્ડર + Grass Fan ગ્રાસ ફેન + Dry Media સૂકાં માધ્યમો + Chalk Grain ચૉકના દાણા + Graphite Pencil ગ્રેફાઇટ પેન્સિલ + Wax Crayon વેક્સ ક્રેયોન + Charcoal Dust ચારકોલનો ભૂકો + Notched Ribbon ખાંચાવાળી રિબન + Double Line બેવડી રેખા + Wave તરંગ + Teardrop આંસુનો આકાર + Striped Ribbon પટ્ટાવાળી રિબન + Fine Nib બારીક નિબ + Broad Nib પહોળી નિબ + Chisel છીણી + Round Pen ગોળ પેન + Pressure Pen પ્રેશર પેન + Beads મણકા + Dash Dot ડૅશ ડૉટ + Scallops કાંગરાવાળી કિનારી + Stars તારા + Triangles ત્રિકોણ + Sparkles ચમકારા + Pixel Snapping Options પિક્સેલ સ્નેપિંગ વિકલ્પો + Pixel Snapping Options… પિક્સેલ સ્નેપિંગ વિકલ્પો… + Snap to Pixel While Drawing દોરતી વખતે પિક્સેલ પર સ્નેપ કરો + Snap to Pixel While Moving ખસેડતી વખતે પિક્સેલ પર સ્નેપ કરો + Snap to Pixel While Scaling સ્કેલ કરતી વખતે પિક્સેલ પર સ્નેપ કરો + These options take effect when View › Snap to Pixel is on. View › Snap to Pixel ચાલુ હોય ત્યારે આ વિકલ્પો લાગુ થાય છે. + Basic Paragraph Formats પેરાગ્રાફના મૂળભૂત ફૉર્મેટ્સ + Composition કમ્પોઝિશન + Place Brush Art બ્રશ આર્ટ પ્લેસ કરો + Replace Brush Art બ્રશ આર્ટ બદલો + Strokes use this brush. Apply the new art to those strokes, or leave them as they are and add a copy of the brush with the new art? સ્ટ્રોક્સ આ બ્રશ વાપરે છે. તે સ્ટ્રોક્સ પર નવી આર્ટ લાગુ કરવી છે કે તેમને જેમ છે તેમ રાખીને નવી આર્ટવાળી બ્રશની નકલ ઉમેરવી છે? + Apply to Strokes સ્ટ્રોક્સ પર લાગુ કરો + Leave Strokes સ્ટ્રોક્સ જેમ છે તેમ રાખો + Copy Troubleshooting Info સમસ્યા નિવારણની માહિતી કૉપી કરો + Align New Objects to Pixel Grid નવા ઑબ્જેક્ટ્સને પિક્સેલ ગ્રિડ સાથે સંરેખિત કરો + Not Aligned to Pixel Grid પિક્સેલ ગ્રિડ સાથે સંરેખિત નથી + Learn શીખો + Explore tutorials ટ્યુટોરિયલ્સ શોધો + For you તમારા માટે + Skills કૌશલ્યો + Get started શરૂ કરો + Quick skill guide કૌશલ્યની ઝડપી માર્ગદર્શિકા + Short hands-on tutorials for the essential tools, grouped by skill. Choose a skill to see its tutorials. મુખ્ય ટૂલ્સ માટે કૌશલ્ય પ્રમાણે ગોઠવેલા ટૂંકા પ્રાયોગિક ટ્યુટોરિયલ્સ. તેના ટ્યુટોરિયલ્સ જોવા કૌશલ્ય પસંદ કરો. + List Tutorials ટ્યુટોરિયલ્સની યાદી બતાવો + Show Tutorial ટ્યુટોરિયલ બતાવો + Show Tool Location ટૂલનું સ્થાન બતાવો + Show where this tool is આ ટૂલ ક્યાં છે તે બતાવો + View more વધુ જુઓ + Finish tutorial ટ્યુટોરિયલ પૂર્ણ કરો + Next Up હવે પછી + You finished the last tutorial in this skill. તમે આ કૌશલ્યનો છેલ્લો ટ્યુટોરિયલ પૂર્ણ કર્યો છે. + Back to skills કૌશલ્યો પર પાછા જાઓ + Open Tutorial Sample ટ્યુટોરિયલનો નમૂનો ખોલો + Finish Tutorial ટ્યુટોરિયલ પૂર્ણ કરો + Next Tutorial આગળનો ટ્યુટોરિયલ + Back to Skills કૌશલ્યો પર પાછા જાઓ + Cutting Tools કટિંગ ટૂલ્સ + Stencil Bridges… સ્ટેન્સિલ બ્રિજિસ… + Stencil Bridges સ્ટેન્સિલ બ્રિજિસ + Shortest Crossing સૌથી ટૂંકો ક્રોસિંગ + Direction દિશા + Weed Box and Lines… વીડ બોક્સ અને રેખાઓ… + Weed Box and Lines વીડ બોક્સ અને રેખાઓ + Margin માર્જિન + Box બોક્સ + Swatch સ્વેચ +# Current-main coverage additions; contributor proofreading completed 2026-11-14. + built in બિલ્ટ-ઇન + embedding not allowed એમ્બેડ કરવાની મંજૂરી નથી + embedding for editing સંપાદન માટે એમ્બેડ કરવાની મંજૂરી + embedding for preview and print પ્રીવ્યૂ અને પ્રિન્ટ માટે એમ્બેડ કરવાની મંજૂરી + embedding allowed એમ્બેડ કરવાની મંજૂરી છે + {file}; {embedding} {file}; {embedding} + substituted: shown in {family} {style} ({detail}) બદલાયેલ: {family} {style}માં બતાવ્યું ({detail}) + missing: shown in {family} {style} ગુમ: {family} {style}માં બતાવ્યું + missing ગુમ + {width} × {height} px {width} × {height} px + {size} — {file} {size} — {file} + {n} ppi {n} ppi + {kind}, {instances} {kind}, {instances} + {kind}, {rows} × {cols} {kind}, {rows} × {cols} + {grid}, {instances} {grid}, {instances} + Linear gradient લીનિયર ગ્રેડિયન્ટ + Radial gradient રેડિયલ ગ્રેડિયન્ટ + Conic gradient કોનિક ગ્રેડિયન્ટ + Diamond gradient ડાયમંડ ગ્રેડિયન્ટ + Freeform gradient ફ્રીફોર્મ ગ્રેડિયન્ટ +@plural {n} instance|{n} instances {n} ઇન્સ્ટન્સ|{n} ઇન્સ્ટન્સિસ +@plural {n} row|{n} rows {n} પંક્તિ|{n} પંક્તિઓ +@plural {n} column|{n} columns {n} કૉલમ|{n} કૉલમ + Warichu વારિચુ + Warichu Settings… વારિચુ સેટિંગ્સ… + Warichu Settings વારિચુ સેટિંગ્સ + Lines: રેખાઓ: + Line Gap: રેખાઓ વચ્ચેનું અંતર: + Trim at Crossings Tool છેદબિંદુઓ પર કાપવાનું ટૂલ + Trim at Crossings છેદબિંદુઓ પર કાપો + Banner Hems and Grommets… બેનરની વાળેલી કિનારીઓ અને ગ્રોમેટ્સ… + Banner Hems and Grommets બેનરની વાળેલી કિનારીઓ અને ગ્રોમેટ્સ + Hem વાળેલી કિનારી + Grommets ગ્રોમેટ્સ + Grommet Inset ગ્રોમેટનું અંદરની બાજુનું અંતર + Diameter વ્યાસ + Add as Single Graphic એક ગ્રાફિક તરીકે ઉમેરો + Bow ધનુષાકાર + Expand as Wireframes વાયરફ્રેમ્સ તરીકે વિસ્તારો + Add art with Add as Single Graphic, or drop art here. એક ગ્રાફિક તરીકે ઉમેરો વડે આર્ટ ઉમેરો, અથવા આર્ટ અહીં મૂકો. + Align On: આના પર સંરેખિત કરો: + Delete Tab ટૅબ કાઢી નાખો + Face સપાટી + Graphics map onto the Plane, Extrude and Revolve object types. ગ્રાફિક્સને Plane, Extrude અને Revolve પ્રકારના ઑબ્જેક્ટ્સ પર મેપ કરી શકાય છે. + Justify with last line aligned center છેલ્લી લાઇન મધ્યમાં રાખીને જસ્ટિફાઇ કરો + Justify with last line aligned right છેલ્લી લાઇન જમણે રાખીને જસ્ટિફાઇ કરો + Leader: લીડર: + Line Gap રેખાઓ વચ્ચેનું અંતર + Manage Profiles પ્રોફાઇલ્સનું સંચાલન કરો + Mapped graphics મેપ કરેલા ગ્રાફિક્સ + Materials મટિરિયલ્સ + NEW DOCUMENT PROFILES નવા દસ્તાવેજની પ્રોફાઇલ્સ + Opacity Mask ઓપેસિટી માસ્ક + Pick a graphic above to map it onto the object. ઑબ્જેક્ટ પર મેપ કરવા ઉપરથી ગ્રાફિક પસંદ કરો. + Remove Graphic ગ્રાફિક દૂર કરો + Replace the selected 3D objects with the edges of their faces, as stroked paths. પસંદ કરેલા 3D ઑબ્જેક્ટ્સને તેમની સપાટીઓની કિનારીઓના સ્ટ્રોકવાળા પાથ્સથી બદલો. + Select a 3D object to map the graphic onto it. ગ્રાફિક મેપ કરવા માટે 3D ઑબ્જેક્ટ પસંદ કરો. + The selected objects have different graphics. પસંદ કરેલા ઑબ્જેક્ટ્સમાં જુદાં ગ્રાફિક્સ છે. + Word Gap શબ્દો વચ્ચેનું અંતર + X: X: + Y: Y: + @{login}: {prs}, {commits}, +{added} / −{deleted} lines (Δ {delta}), +{binary_added} / −{binary_deleted} binary assets, {first} – {last} @{login}: {prs}, {commits}, +{added} / −{deleted} લાઇન્સ (Δ {delta}), +{binary_added} / −{binary_deleted} બાઇનરી ઍસેટ્સ, {first} – {last} + PRs PRs + Preset {number} પ્રીસેટ {number} +@plural {n} PR|{n} PRs {n} PR|{n} PRs +@plural {n} commit|{n} commits {n} કમિટ|{n} કમિટ્સ +anchor Points: પોઇન્ટ્સ: +diagnostics render રેન્ડર +diagnostics ui ઇન્ટરફેસ +file-filter All placeable files પ્લેસ કરી શકાય તેવી બધી ફાઇલો +file-filter All readable files વાંચી શકાય તેવી બધી ફાઇલો +file-filter Export presets એક્સપોર્ટ પ્રીસેટ્સ +file-filter Flattener presets ફ્લેટનર પ્રીસેટ્સ +file-filter PDF presets PDF પ્રીસેટ્સ +file-filter PDF-compatible .ai PDF-સુસંગત .ai +file-filter Print presets પ્રિન્ટ પ્રીસેટ્સ +file-filter SVG Compressed સંકુચિત SVG +file-filter Swatch libraries સ્વેચ લાઇબ્રેરીઓ +file-filter Templates ટેમ્પ્લેટ્સ +file-filter VectorCraft Template VectorCraft ટેમ્પ્લેટ +gradient-kind Radial રેડિયલ +lighting Light લાઇટ +mark-style Japanese જાપાનીઝ +swatch Amber એમ્બર +swatch Aqua એક્વા +swatch Azure આસમાની +swatch Black કાળો +swatch Blue વાદળી +swatch Bright Blue તેજસ્વી વાદળી +swatch Bright Green તેજસ્વી લીલો +swatch Bright Red તેજસ્વી લાલ +swatch Bright Violet તેજસ્વી વાયોલેટ +swatch Bright Yellow તેજસ્વી પીળો +swatch Brights તેજસ્વી +swatch Brown ભૂરો +swatch Chocolate ચૉકલેટ +swatch Coffee કોફી +swatch Copper કોપર +swatch Cyan સાયન +swatch Cyan Green સાયન લીલો +swatch Emerald એમરાલ્ડ +swatch Espresso એસ્પ્રેસો +swatch Grays ગ્રે +swatch Green લીલો +swatch Indigo ઈન્ડિગો +swatch Lime લાઇમ +swatch Magenta મેજેન્ટા +swatch Ocean સમુદ્રી +swatch Orange નારંગી +swatch Orange Red નારંગી લાલ +swatch Pink ગુલાબી +swatch Purple જાંબલી +swatch Radial White, Black રેડિયલ સફેદ, કાળો +swatch Red લાલ +swatch Rose રોઝ +swatch Rust રસ્ટ +swatch Sand રેતિયો +swatch Sunset સૂર્યાસ્ત +swatch Tan આછો ભૂરો +swatch Teal ટીલ +swatch Violet વાયોલેટ +swatch Walnut અખરોટી +swatch White સફેદ +swatch White, Black સફેદ, કાળો +swatch Yellow પીળો +swatch Yellow Green પીળો લીલો +swatch [None] [કંઈ નહીં] +swatch [Registration] [રજિસ્ટ્રેશન] + Burst Ray વિસ્ફોટક કિરણ + Dash Trail ડૅશની લડી + Speed Line ગતિ રેખા + Zigzag ઝિગઝૅગ + Repeat Objects પુનરાવર્તિત ઑબ્જેક્ટ્સ +@msg `{path}` must be one of {_1}, not {got} `{path}` એ {_1}માંથી એક હોવું જોઈએ, {got} નહીં + Path Length પાથની લંબાઈ diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 9d056e085a..78c0a9a7eb 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -1140,6 +1140,8 @@ antiAlias Sharp शार्प Crop Image इमेज क्रॉप करें Image Tools इमेज टूल Remove Background… पृष्ठभूमि हटाएँ… + Draw (Pencil) ड्रा (पेंसिल) + Place Image इमेज प्लेस करें Remove Background पृष्ठभूमि हटाएँ Background पृष्ठभूमि Edge Color किनारे का रंग @@ -3560,6 +3562,8 @@ antiAlias Sharp शार्प @msg the action set would be larger than 8 MiB एक्शन सेट 8 MiB से बड़ा हो जाएगा Playback Options प्लेबैक ऑप्शन्स Playback Options… प्लेबैक ऑप्शन्स… + Button Mode बटन मोड + No actions. कोई कार्रवाई नहीं। Plug-in Info प्लगइन जानकारी Plug-in… प्लग-इन… Plug-ins प्लग-इन्स @@ -3694,6 +3698,7 @@ antiAlias Sharp शार्प Proportional Metrics आनुपातिक मीट्रिक Insert Aki Left बाईं ओर आकी जोड़ें Insert Aki Right दाईं ओर आकी जोड़ें + Tsume त्सुमे Proportional Oldstyle आनुपातिक ओल्डस्टाइल Protect Corners कॉर्नर को सुरक्षित रखें Proximity Guides निकटता गाइड @@ -4997,6 +5002,7 @@ antiAlias Sharp शार्प VectorCraft Title Bar on Every Desktop हर डेस्कटॉप पर VectorCraft टाइटल बार The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. जब तक एनवायरनमेंट वेरिएबल VECTORCRAFT_TITLEBAR सेट है, टाइटल बार वही चुनता है। System Title Bar takes precedence over this option while it is on. जब तक सिस्टम टाइटल बार चालू है, उसे इस विकल्प पर प्राथमिकता मिलती है। + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. जब तक हर डेस्कटॉप पर VectorCraft टाइटल बार बंद है, यह डेस्कटॉप विंडो का टाइटल बार बनाता है, चाहे यह विकल्प चालू हो या बंद। Tab Tab Tab Stops टैब स्टॉप्स Table तालिका @@ -5611,11 +5617,11 @@ antiAlias Sharp शार्प @msg a painted live effect returns only `objects` पेंट करने वाला लाइव इफ़ेक्ट केवल `objects` लौटाता है @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` पेंट करने वाले लाइव इफ़ेक्ट के हिस्से में केवल `path`, `fillRule`, `fills` और `strokes` होते हैं @msg a read-only object was left out एक केवल-पढ़ने योग्य ऑब्जेक्ट छोड़ दिया गया -@msg a read-only object was left out: return it, as {"id"} alone or as it was given एक केवल-पढ़ने योग्य ऑब्जेक्ट छोड़ दिया गया: इसे केवल {"id"} के रूप में या जैसा दिया गया था वैसा लौटाएँ +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given एक केवल-पढ़ने योग्य ऑब्जेक्ट छोड़ दिया गया: इसे केवल {{"id": …}} के रूप में या जैसा दिया गया था वैसा लौटाएँ @msg a string एक स्ट्रिंग @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` स्ट्रोक में केवल `paint`, `width`, `join`, `cap` और `miterLimit` होते हैं -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} स्ट्रोक {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} होना चाहिए -@msg an effect must be {"id", "params"?, "visible"?} इफ़ेक्ट {"id", "params"?, "visible"?} होना चाहिए +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} स्ट्रोक {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} होना चाहिए +@msg an effect must be {{"id", "params"?, "visible"?}} इफ़ेक्ट {{"id", "params"?, "visible"?}} होना चाहिए @msg an effect on a fill returns only `fills` फ़िल पर इफ़ेक्ट केवल `fills` लौटाता है @msg an effect on a stroke returns only `strokes` स्ट्रोक पर इफ़ेक्ट केवल `strokes` लौटाता है @msg an object must be a JSON object ऑब्जेक्ट एक JSON ऑब्जेक्ट होना चाहिए @@ -5926,7 +5932,7 @@ antiAlias Sharp शार्प @msg `{key}` is longer than {MAX_NAME} characters `{key}` {MAX_NAME} अक्षरों से अधिक लंबा है @msg `{key}` is out of range `{key}` रेंज से बाहर है @msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}` को प्रतिशत में [min, desired, max] या {{min?, desired?, max?}} होना चाहिए -@msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` होना चाहिए [x, y, चौड़ाई, ऊंचाई]: चार परिमित संख्या, चौड़ाई और ऊंचाई नकारात्मक नहीं है +@msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` होना चाहिए [x, y, width, height]: चार परिमित संख्या, चौड़ाई और ऊंचाई नकारात्मक नहीं है @msg `{key}` must be [x, y] `{key}` होना चाहिए [x, y] @msg `{key}` must be `auto` or a language code such as `en` or `zh-hant` `{key}` को `auto` या `en` या `zh-hant` जैसे भाषा कोड होना चाहिए। @msg `{key}` must be 0..{max} `{key}` होना चाहिए 0.{max} @@ -5939,6 +5945,7 @@ antiAlias Sharp शार्प @msg `{key}` must be a number `{key}` एक संख्या होना चाहिए @msg `{key}` must be a number {_1}..{_2} `{key}` {_1}..{_2} की एक संख्या होना चाहिए @msg `{key}` must be a number not below 0 `{key}` 0 से कम नहीं होने वाली संख्या होना चाहिए +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` 0 से कम नहीं होने वाली चार संख्याएँ होनी चाहिए: [tl, tr, br, bl] @msg `{key}` must be a number, not {v} `{key}` एक संख्या होना चाहिए, {v} नहीं @msg `{key}` must be a profile name or null `{key}` को प्रोफ़ाइल नाम या null होना चाहिए @msg `{key}` must be a string `{key}` एक स्ट्रिंग होना चाहिए @@ -6011,7 +6018,7 @@ antiAlias Sharp शार्प @msg `a` and `b` must be two different paths `a` और `b` को दो अलग-अलग पाथ होना चाहिए @msg `align` is start, center or end `align` शुरू, केंद्र या अंत है @msg `align` must be "left", "center" or "right", not {other} `align` होना चाहिए "left", "center" या "right", नहीं {other} -@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` को [subpath, एंकर] जोड़े की एक सारणी होना चाहिए +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` को [subpath, anchor] जोड़े की एक सारणी होना चाहिए @msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` में एंकर इंडेक्स (0, 1, 2…) की सूची होनी चाहिए, {k} नहीं @msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` में एंकर इंडेक्स (0, 1, 2…) की सूची होनी चाहिए, {v} नहीं @msg `antiAlias` must be "none", "sharp", "crisp" or "strong" `antiAlias` "none", "sharp", "crisp" या "strong" होना चाहिए @@ -6078,7 +6085,7 @@ antiAlias Sharp शार्प @msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` में पिछली text.findFontFiles सर्च में मिली फ़ॉन्ट फ़ाइलों के 1 से 1000 पाथ होने चाहिए @msg `folder` must be an absolute folder path `folder` एक पूर्ण फ़ोल्डर पाथ होना चाहिए @msg `follow` must be "average", "a" or "b" `follow` को "average", "a" या "b" होना चाहिए। -@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` को अक्ष टैग और मानों का एक ऑब्जेक्ट होना चाहिए, जैसे कि {"wght"} +@msg `fontAxes` must be an object of axis tags and values, such as {{"wght": 650}} `fontAxes` को अक्ष टैग और मानों का एक ऑब्जेक्ट होना चाहिए, जैसे कि {{"wght": 650}} @msg `fontHeightReference` must be "emBox", "capHeight", "xHeight" or "icfBox" `fontHeightReference` को "emBox", "capHeight", "xHeight" या "icfBox" होना चाहिए @msg `format` must be a string `format` एक स्ट्रिंग होना चाहिए @msg `format` must be one of {_1} `format` को {_1} में से एक होना चाहिए @@ -6112,12 +6119,12 @@ antiAlias Sharp शार्प @msg `index` must be a point index `index` एक बिंदु सूचकांक होना चाहिए @msg `index` must be a whole number or null `index` होना चाहिए पूरी संख्या या null होना चाहिए @msg `indices` must be a non-empty array of item indices `indices` आइटम सूचकांकों की एक गैर-खाली सरणी होना चाहिए -@msg `items` is a list of {kind, item} `items` {kind, item} की सूची है +@msg `items` is a list of {{kind, item}} `items` {{kind, item}} की सूची है @msg `items` is empty `items` खाली है @msg `items` must be a list of {{id, anchors?}}, not {v} `items` को {{id, anchors?}} की सूची होना चाहिए, {v} नहीं -@msg `items` must be a list of {id, points} `items` को {id, points} की सूची होना चाहिए +@msg `items` must be a list of {{id, points}} `items` को {{id, points}} की सूची होना चाहिए @msg `items` must be an array of {{id, corners?}}, not {v} `items` को {{id, corners?}} की ऐरे होना चाहिए, {v} नहीं -@msg `items` must be an array of {id, anchors} `items` को {id, anchors} की ऐरे होना चाहिए +@msg `items` must be an array of {{id, anchors}} `items` को {{id, anchors}} की ऐरे होना चाहिए @msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` होना चाहिए "none", "short", "medium", "long" या "stylistic"। @msg `kind` is one of {_1} `kind` {_1} में से एक है @msg `kind` must be "line" or "paragraph", not {other} `kind` होना चाहिए "line" या "paragraph", नहीं {other} @@ -6397,12 +6404,12 @@ antiAlias Sharp शार्प @msg area type in frames too short for a line of the font it shows in got taller frames ({_1}): their type wouldn't show otherwise अपने फ़ॉन्ट की एक लाइन के लिए बहुत छोटे फ़्रेम वाले एरिया टाइप को लंबे फ़्रेम दिए गए ({_1}): वरना उनका टाइप नहीं दिखता @msg area type needs a path that encloses an area एरिया टाइप को ऐसा पाथ चाहिए जो किसी क्षेत्र को घेरता हो @msg arrowAlign must be extend|tip, got {o} arrowAlign को extend|tip होना चाहिए, {o} मिला -@msg arrowScale must be [start, end] arrowScale होना चाहिए [शुरू, अंत] +@msg arrowScale must be [start, end] arrowScale होना चाहिए [start, end] @msg artboard {0} does not exist आर्टबोर्ड {0} मौजूद नहीं है @msg artboard {i} doesn't print आर्टबोर्ड {i} प्रिंट नहीं करता है @msg artboard is a 0-based index artboard 0 से शुरू होने वाला इंडेक्स है @msg artboard must be a 0-based index artboard 0 से शुरू होने वाला इंडेक्स होना चाहिए -@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout को {layout?, columns?, spacing?, rightToLeft?} होना चाहिए +@msg artboardLayout must be {{layout?, columns?, spacing?, rightToLeft?}} artboardLayout को {{layout?, columns?, spacing?, rightToLeft?}} होना चाहिए @msg artboardLayout.columns must be 1 or more artboardLayout.columns को 1 या अधिक होना चाहिए @msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout को gridByRow, gridByColumn, row या column होना चाहिए @msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft को true या false होना चाहिए @@ -6458,14 +6465,14 @@ antiAlias Sharp शार्प @msg bad edit बुरा संपादन @msg bad fill {v} बुरा भर {v} @msg bad fit: {e} बुरा फिट: {e} -@msg bad model {other} (keep, new or document) बुरा मॉडल {other} (keep, नया या डॉक्यूमेंट) +@msg bad model {other} (keep, new or document) बुरा मॉडल {other} (keep, new या document) @msg bad new colour {v} बुरा नया रंग {v} @msg bad object बुरा ऑब्जेक्ट @msg bad object number खराब ऑब्जेक्ट संख्या @msg bad offset बुरा ऑफसेट @msg bad page tree बुरा पेज पेड़ @msg bad path data: {e} बुरा पाथ डेटा: {e} -@msg bad point {v}: expected [x, y] or [x, y, pressure] बुरा बिंदु {v}: उम्मीद [x, y] या [x, y, दबाव] +@msg bad point {v}: expected [x, y] or [x, y, pressure] बुरा बिंदु {v}: उम्मीद [x, y] या [x, y, pressure] @msg bad reference बुरा संदर्भ @msg bad shortcut बुरा शॉर्टकट @msg bad stream length खराब धारा की लंबाई @@ -6771,13 +6778,13 @@ antiAlias Sharp शार्प @msg DXF scale must be a positive number up to {_1}, not {scale} DXF स्केल {_1} तक की धनात्मक संख्या होनी चाहिए, न कि {scale} @msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf इकाई `{u}`: एक इकाई जैसे mm, cm, in या pt @msg dxf: {e} dxf: {e} -@msg each format is an object {format, scale?, suffix?} हर फ़ॉर्मैट एक ऑब्जेक्ट {format, scale?, suffix?} है +@msg each format is an object {{format, scale?, suffix?}} हर फ़ॉर्मैट एक ऑब्जेक्ट {{format, scale?, suffix?}} है @msg each item needs an id प्रत्येक आइटम को एक आईडी की आवश्यकता होती है @msg each match needs `kind` प्रत्येक मैच की जरूरत है `kind` @msg each match needs a `name` प्रत्येक मैच को `name` की आवश्यकता होती है -@msg each of `fonts` is {family, style?}; 1 to 1000 of them `fonts` का हर आइटम {family, style?} है; 1 से 1000 आइटम +@msg each of `fonts` is {{family, style?}}; 1 to 1000 of them `fonts` का हर आइटम {{family, style?}} है; 1 से 1000 आइटम @msg each of `items` is {{id, corners?}} with an object id, not {it} `items` का हर आइटम ऑब्जेक्ट आईडी वाला {{id, corners?}} है, {it} नहीं -@msg each of `items` is {kind, item} `items` का हर आइटम {kind, item} है +@msg each of `items` is {{kind, item}} `items` का हर आइटम {{kind, item}} है @msg each row needs `from` हर पंक्ति के लिए `from` चाहिए @msg each stop needs a position प्रत्येक स्टॉप को स्थिति की आवश्यकता होती है @msg each subpath needs an anchors array प्रत्येक उपपाथ को एक एंकर सरणी की आवश्यकता होती है @@ -6809,8 +6816,8 @@ antiAlias Sharp शार्प @msg Expand: no gradient fills विस्तार: कोई ग्रेडिएंट भरता नहीं @msg Expand: nothing to expand विस्तार: विस्तार करने के लिए कुछ नहीं @msg expanded SVG styles exceed the import size limit विस्तारित SVG स्टाइल्स आयात आकार सीमा से अधिक है -@msg expected {"dataBase64"} अपेक्षित: {"dataBase64"} -@msg expected {"objects"} अपेक्षित: {"objects"} +@msg expected {{"dataBase64": "…"}} अपेक्षित: {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} अपेक्षित: {{"objects": [...]}} @msg export `{name}`: {e} निर्यात `{name}`: {e} @msg Export cancelled निर्यात रद्द @msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft स्क्रीन के लिए एक्सपोर्ट png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai या vectorcraft लिखता है @@ -6830,7 +6837,7 @@ antiAlias Sharp शार्प @msg features must be a list of tags features टैग की एक सूची होनी चाहिए @msg fidelity must be 0..100 fidelity 0..100 होना चाहिए @msg file version {0} is newer than this VectorCraft supports ({VERSION}) फ़ाइल संस्करण {0} इस वेक्टर क्रेफ्ट समर्थन ({VERSION}) की तुलना में नया है। -@msg files must be {name, dataBase64} files {name, dataBase64} होना चाहिए +@msg files must be {{name, dataBase64}} files {{name, dataBase64}} होना चाहिए @msg finish editing the pattern first पहले पैटर्न को संपादित करना @msg First measured segment no longer exists पहले मापा खंड अब मौजूद नहीं है @msg fit must be none|autoHeight|shrinkText|block, got {id} fit को none|autoHeight|shrinkText|block होना चाहिए, {id} मिला @@ -6856,7 +6863,7 @@ antiAlias Sharp शार्प @msg frequency must be between 1 and 300 lines per inch frequency प्रति इंच 1 से 300 लाइनों के बीच होनी चाहिए @msg from and to must be finite से और होना चाहिए करने के लिए @msg from must be [x0, y0, x1, y1] from [x0, y0, x1, y1] होना चाहिए -@msg give {key, value} or {values} {key, value} या {values} दें +@msg give {{key, value}} or {{values}} {{key, value}} या {{values}} दें @msg give `{a}` and `{b}` `{a}` और `{b}` दें @msg give `anchor`, the index of the anchor to slide खिसकाने वाले एंकर का इंडेक्स `anchor` दें @msg give `before` or `after`, not both `before` या `after` दें, दोनों नहीं @@ -6874,7 +6881,7 @@ antiAlias Sharp शार्प @msg give `id` or `guide`, not both `id` या `guide` दें, दोनों नहीं @msg give `inkLimit`, `removeWhiteOverprint` or `overprintBlack` `inkLimit`, `removeWhiteOverprint` या `overprintBlack` दें @msg give `length` or `to` `length` या `to` देना -@msg give `matches`: [{kind, name, target}] `matches`: [{kind, name, target}] +@msg give `matches`: [{{kind, name, target}}] `matches`: [{{kind, name, target}}] @msg give `name` (or edit a pattern) `name` (या एक पैटर्न संपादित करें) @msg give `name` or `names` `name` या `names` दें @msg give `path` (a .wasm file) or `dataBase64` (the module) `path` (.wasm फ़ाइल) या `dataBase64` (मॉड्यूल) दें @@ -6931,7 +6938,7 @@ antiAlias Sharp शार्प @msg give the preset a `name` प्रीसेट देना `name` @msg give the preset a name प्रीसेट को एक नाम देना @msg give the preset a name (1–64 characters) प्रीसेट का नाम दें (1–64 अक्षर) -@msg give the settings to change, e.g. {"formats"}]} सेटिंग्स को बदलने के लिए, उदाहरण के लिए {"formats"}]} +@msg give the settings to change, e.g. {{"formats": [{{"format": "png", "scale": "2x"}}]}} सेटिंग्स को बदलने के लिए, उदाहरण के लिए {{"formats": [{{"format": "png", "scale": "2x"}}]}} @msg give the style a name स्टाइल को एक नाम दें @msg give two or more style `names` दो या अधिक स्टाइल `names` @msg give two or more swatches दो या अधिक स्वॉच दें @@ -6995,7 +7002,7 @@ antiAlias Sharp शार्प @msg Internal error: {msg} (please report this bug) आंतरिक त्रुटि: {msg} (कृपया इस बग की रिपोर्ट करें) @msg invalid `color` अमान्य `color` @msg invalid anchor index {v}: expected a non-negative integer अमान्य एंकर इंडेक्स {v}: एक गैर-नकारात्मक पूर्णांक की उम्मीद -@msg invalid anchor reference {v}: expected [subpath, anchor] अमान्य एंकर संदर्भ {v}: उम्मीद [subpath, एंकर] +@msg invalid anchor reference {v}: expected [subpath, anchor] अमान्य एंकर संदर्भ {v}: उम्मीद [subpath, anchor] @msg invalid angle अमान्य कोण @msg invalid brush: {e} अमान्य ब्रश: {e} @msg invalid color अमान्य रंग @@ -7151,7 +7158,7 @@ antiAlias Sharp शार्प @msg missing `library` (see graphicStyle.libraries) लापता `library` (graphicStyle.libraries देखें) @msg missing `library` (see swatch.library.list) लापता `library` (swatch.library.list देखें) @msg missing `library` (see symbol.libraries) `library` अनुपस्थित है (symbol.libraries देखें) -@msg missing `map` (rows [{from, to}] or {current}) लापता `map` (rows [{from, to}] या {current}) +@msg missing `map` (rows [{{from, to}}] or {{current: new}}) लापता `map` (rows [{{from, to}}] या {{current: new}}) @msg missing `matrix` [a,b,c,d,e,f] लापता `matrix` [a,b,c,d,e,f] @msg missing `name` लापता `name` @msg missing `name` (see gradient.presets.list) लापता `name` (gradient.presets.list देखें) @@ -7172,7 +7179,7 @@ antiAlias Sharp शार्प @msg missing `value` लापता `value` @msg missing anchor लापता एंकर @msg missing anchors लापता एंकर -@msg missing anchors [[subpath, anchor]…] लापता एंकर [[subpath, एंकर]...] +@msg missing anchors [[subpath, anchor]…] लापता एंकर [[subpath, anchor]...] @msg missing array `{key}` लापता सरणी `{key}` @msg missing case लापता मामला @msg missing color लापता रंग @@ -7513,6 +7520,7 @@ antiAlias Sharp शार्प @msg not a Word document: its WordDocument stream doesn't start with a file information block वर्ड डॉक्यूमेंट नहीं: इसकी WordDocument धारा फ़ाइल सूचना ब्लॉक के साथ शुरू नहीं होती है @msg the action set file can't be read in full एक्शन सेट फ़ाइल पूरी तरह नहीं पढ़ी जा सकती @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out “{name}” लोड किया गया: {n} चरण छोड़ा गया|“{name}” लोड किया गया: {n} चरण छोड़े गए +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` “{name}” लोड किया गया: {n} चरण में अज्ञात आदेश है और उसे रखा गया: “{action}”, चरण {step}, `{command}`|“{name}” लोड किया गया: {n} चरणों में अज्ञात आदेश हैं और उन्हें रखा गया; पहला: “{action}”, चरण {step}, `{command}` @msg not an action set file एक एक्शन सेट फ़ाइल नहीं @msg not an EMF or WMF file नहीं एक EMF या WMF फ़ाइल @msg not an HP-GL file HP-GL फ़ाइल नहीं है @@ -7521,7 +7529,7 @@ antiAlias Sharp शार्प @msg not an export presets file (format `{_1}`) यह एक्सपोर्ट प्रीसेट फ़ाइल नहीं है (फ़ॉर्मैट `{_1}`) @msg not an export presets file: {e} एक निर्यात प्रीसेट फ़ाइल नहीं: {e} @msg not an image VectorCraft reads (see document.formats) यह ऐसी इमेज नहीं है जिसे VectorCraft पढ़ सके (document.formats देखें) -@msg not an RTF file: it doesn't start with {\\rtf RTF फ़ाइल नहीं: यह {\rtf के साथ शुरू नहीं होता है +@msg not an RTF file: it doesn't start with {{\\rtf RTF फ़ाइल नहीं: यह {{\rtf के साथ शुरू नहीं होता है @msg not area type (text in a frame) outside perspective पर्सपेक्टिव के बाहर का एरिया टाइप (फ़्रेम में टेक्स्ट) नहीं है @msg not editing an opacity mask ओपेसिटी मास्क संपादित नहीं किया जा रहा है @msg not found नहीं मिला @@ -7718,7 +7726,7 @@ antiAlias Sharp शार्प @msg printing isn't available here मुद्रण यहाँ उपलब्ध नहीं है @msg procedures nest too deeply प्रक्रियाओं घोंसला बहुत गहराई से @msg procedures nested too deeply प्रक्रियाओं ने बहुत गहराई से घोंसले -@msg quotes must be {double?, single?} quotes को {double?, single?} होना चाहिए +@msg quotes must be {{double?, single?}} quotes को {{double?, single?}} होना चाहिए @msg quotes.{k} must be an opening and a closing quote, e.g. "“”" उद्धरण.{k} एक उद्घाटन और एक समापन उद्धरण होना चाहिए, उदाहरण के लिए "“”" @msg range `{s}` is empty श्रेणी `{s}` खाली है @msg range `{s}`: `{part}` names no number सीमा `{s}`: `{part}` कोई संख्या नहीं बताता @@ -7959,14 +7967,14 @@ antiAlias Sharp शार्प @msg Switch x/y is for scatter graphs स्विच x/y स्कैटर ग्राफ़ के लिए है @msg t, dx and dy must be finite टी, डीएक्स और डीआई को परिमित होना चाहिए @msg Targa files are RGB: colorModel rgb Targa फ़ाइलें RGB हैं: colorModel rgb -@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text को {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} होना चाहिए +@msg text must be {{characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?}} text को {{characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?}} होना चाहिए @msg Text options: {e} टेक्स्ट ऑप्शन्स: {e} @msg text transform is collapsed or unrepresentable टेक्स्ट ट्रांसफ़ॉर्म सिमटा हुआ है या उसे दर्शाया नहीं जा सकता @msg Text Wrap: select a wrap object टेक्स्ट लपेटें: एक रैप ऑब्जेक्ट चुनें @msg text.{key} `{v}`: use "{_1}" or "{_2}" Text.{key} `{v}`: "{_1}" या "{_2}" का उपयोग करें। @msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces को 2 से 100 के बीच पूर्णांक होना चाहिए @msg textureImage: {e} textureImage: {e} -@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage: किसी इमेज फ़ाइल का {path} या {name, dataBase64} दें, या effect.list द्वारा दिया गया टेक्सचर दें +@msg textureImage: give {{path}} or {{name, dataBase64}} of an image file, or a texture as effect.list gives it textureImage: किसी इमेज फ़ाइल का {{path}} या {{name, dataBase64}} दें, या effect.list द्वारा दिया गया टेक्सचर दें @msg that anchor can't slide: an end of an open path has nowhere to go कि एंकर स्लाइड नहीं कर सकते: एक खुले रास्ते का अंत कहीं नहीं जाना है @msg the active document changed while the question was open; nothing was deleted प्रश्न खुला रहते हुए सक्रिय डॉक्यूमेंट बदल गया; कुछ भी नहीं हटाया गया @msg that document is no longer open यह डॉक्यूमेंट अब खुला नहीं है @@ -8384,7 +8392,7 @@ antiAlias Sharp शार्प @msg Unembedded to {_1} एम्बेड हटाकर {_1} में रखा गया @msg unexpected host trap होस्ट में अप्रत्याशित ट्रैप @msg unexpected resources अप्रत्याशित संसाधन -@msg unknown {k} key `{key}` (size, position) अज्ञात {k} कुंजी `{key}` (आकार, स्थिति) +@msg unknown {k} key `{key}` (size, position) अज्ञात {k} कुंजी `{key}` (size, position) @msg unknown {key} `{v}` (none, short or full) अज्ञात {key} `{v}` (none, short या full) @msg unknown {key} profile `{n}` अज्ञात {key} प्रोफ़ाइल `{n}` @msg unknown align `{other}` अज्ञात संरेखण `{other}` @@ -8403,6 +8411,7 @@ antiAlias Sharp शार्प @msg unknown character style number field अज्ञात चरित्र स्टाइल संख्या क्षेत्र @msg unknown CMYK profile `{name}` अज्ञात CMYK प्रोफ़ाइल `{name}` @msg unknown command `{0}` अज्ञात आदेश `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` “{action}” का चरण {step} अज्ञात आदेश `{command}` चलाता है @msg unknown command `{0}`; did you mean `{1}`? अज्ञात आदेश `{0}`; क्या आपको `{1}` का मतलब है? @msg unknown control `{name}`: fillStroke, coloring, drawMode or screenMode अज्ञात नियंत्रण `{name}`: fillStroke, रंग, drawMode या screenMode @msg Unknown dimension mode अज्ञात आयाम मोड @@ -8417,9 +8426,9 @@ antiAlias Sharp शार्प @msg unknown format अज्ञात स्वरूप @msg unknown format `{f}` (Save writes {_1}) अज्ञात फ़ॉर्मैट `{f}` (सेव {_1} लिखता है) @msg unknown format `{f}` (vcswatches, gpl, ase or css) अज्ञात फ़ॉर्मैट `{f}` (vcswatches, gpl, ase या css) -@msg unknown freeform mode `{m}` (points, lines) अज्ञात फ्रीफॉर्म मोड `{m}` (बिंदुओं, लाइनों) +@msg unknown freeform mode `{m}` (points, lines) अज्ञात फ्रीफॉर्म मोड `{m}` (points, lines) @msg unknown from {f} {f} से अज्ञात -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) अज्ञात ग्रेडिएंट `{k}` (रैखिक, रेडियल, शंक्वाकार, डायमंड, फ्रीफॉर्म) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) अज्ञात ग्रेडिएंट `{k}` (linear, radial, conic, diamond, freeform) @msg unknown graph type `{t}` अज्ञात ग्राफ प्रकार `{t}` @msg unknown grid colours `{name}` (one of {_1}) अज्ञात ग्रिड रंग `{name}` ({_1} में से एक) @msg unknown gridType `{t}` अज्ञात gridType `{t}` @@ -8434,20 +8443,20 @@ antiAlias Sharp शार्प @msg unknown method `{m}` ({_1}) अज्ञात विधि `{m}` ({_1}) @msg unknown mode {m} अज्ञात मोड {m} @msg unknown mode `{o}` अज्ञात मोड `{o}` -@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) अज्ञात मोड `{other}` (ग्रे, RGB, hsb, लैब, cmyk या वेब) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) अज्ञात मोड `{other}` (gray, rgb, hsb, lab, cmyk या web) @msg unknown mode `{other}` (mono|cmyk) अज्ञात मोड `{other}` (mono|cmyk) @msg unknown mode `{other}` (rgb|cmyk|gray|global) अज्ञात मोड `{other}` (rgb|cmyk|gray|global) -@msg unknown mode `{other}` (set, add, subtract) अज्ञात मोड `{other}` (सेट, ऐड, घटाना) +@msg unknown mode `{other}` (set, add, subtract) अज्ञात मोड `{other}` (set, add, subtract) @msg unknown model `{other}` अज्ञात मॉडल `{other}` -@msg unknown model `{other}` (keep, new or document) अज्ञात मॉडल `{other}` (keep, नया या डॉक्यूमेंट) +@msg unknown model `{other}` (keep, new or document) अज्ञात मॉडल `{other}` (keep, new या document) @msg unknown op {o} अज्ञात op {o} @msg unknown OpenType feature `{t}` अज्ञात ओपन टाइप सुविधा `{t}` @msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom; prefix - to turn off) अज्ञात OpenType फ़ीचर `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom; बंद करने के लिए आगे - लगाएँ) @msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) featureChanges में अज्ञात OpenType फ़ीचर `{t}` (वे टैग जो `features` लेता है) @msg unknown option `{path}.{k}` अज्ञात ऑप्शन `{path}.{k}` @msg unknown order `{o}`: toggle, front, forward, backward or back अज्ञात आदेश `{o}`: टॉगल, फ्रंट, फॉरवर्ड, बैकवर्ड या बैक -@msg unknown overprints `{o}` (preserve, simulate or discard) अज्ञात ओवरप्रिंट `{o}` (preserve, अनुकरण या discard) -@msg unknown overprints `{v}` (preserve, simulate or discard) अज्ञात ओवरप्रिंट `{v}` (प्ररक्षित, अनुकरण या त्यागपत्र) +@msg unknown overprints `{o}` (preserve, simulate or discard) अज्ञात ओवरप्रिंट `{o}` (preserve, simulate या discard) +@msg unknown overprints `{v}` (preserve, simulate or discard) अज्ञात ओवरप्रिंट `{v}` (preserve, simulate या discard) @msg unknown panel अज्ञात पैनल @msg unknown panel `{raw}` अज्ञात पैनल `{raw}` @msg panels can't be shown in Presentation Mode प्रस्तुति मोड में पैनल्स नहीं दिखाए जा सकते @@ -8462,7 +8471,7 @@ antiAlias Sharp शार्प @msg `{path}` is nested too deeply `{path}` बहुत गहराई तक नेस्ट किया गया है @msg unknown PDF preset `{name}` (presets: {_1}) अज्ञात PDF प्रीसेट `{name}` (presets: {_1}) @msg unknown pieLegend `{v}` (none, standard or wedges) अज्ञात pieLegend `{v}` (none, standard या wedges) -@msg unknown piePosition `{v}` (even, ratio or stacked) अज्ञात piePosition `{v}` (यहां तक कि अनुपात या स्टैक्ड) +@msg unknown piePosition `{v}` (even, ratio or stacked) अज्ञात piePosition `{v}` (even, ratio या stacked) @msg unknown pieSort `{v}` (none, all or first) अज्ञात pieSort `{v}` (none, all या first) @msg unknown plate `{n}` अज्ञात प्लेट `{n}` @msg unknown preference `{k}` अज्ञात वरीयता `{k}` @@ -8488,7 +8497,7 @@ antiAlias Sharp शार्प @msg unknown preset `{name}`: not a built-in or saved preset (see imageTrace.presets) अज्ञात प्रीसेट `{name}`: एक अंतर्निहित या सेव किए गए प्रीसेट नहीं (imageTrace.presets देखें) @msg unknown profile {id} (see stroke.widthProfile.list) अज्ञात प्रोफ़ाइल {id} (stroke.widthProfile.list देखें) @msg unknown proof target `{t}` अज्ञात प्रमाण लक्ष्य `{t}` -@msg unknown quotes key `{k}` (double, single) अज्ञात उद्धरण कुंजी `{k}` (डबल, सिंगल) +@msg unknown quotes key `{k}` (double, single) अज्ञात उद्धरण कुंजी `{k}` (double, single) @msg unknown resolution `{v}` अज्ञात रिज़ॉल्यूशन `{v}` @msg unknown rule `{r}` (see color.harmony) अज्ञात नियम `{r}` (देखें color.harmony) @msg unknown rule `{rule}` ({_1}) अज्ञात नियम `{rule}` ({_1}) @@ -8504,7 +8513,7 @@ antiAlias Sharp शार्प @msg Unknown unit अज्ञात इकाई @msg unknown units अज्ञात इकाइयों @msg unknown units `{u}` अज्ञात इकाइयों `{u}` -@msg unknown value axis `{v}` (left, right or both) अज्ञात मान अक्ष `{v}` (बाएं, दाएं या दोनों) +@msg unknown value axis `{v}` (left, right or both) अज्ञात मान अक्ष `{v}` (left, right या both) @msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) अज्ञात variation `{v}` (tintsShades|warmCool|vividMuted) @msg unknown Warp style अज्ञात ताना स्टाइल @msg unknown warp style `{s}` अज्ञात ताना स्टाइल `{s}` @@ -8854,6 +8863,12 @@ theme Appearance अपीयरेंस @msg open the practice sample of `{id}` first (see learn.openSample) पहले `{id}` का अभ्यास नमूना खोलें (learn.openSample देखें) @msg finish `{id}` first (see learn.finish) पहले `{id}` पूरा करें (learn.finish देखें) @msg `{id}` is the last tutorial in its skill `{id}` अपने कौशल का अंतिम ट्यूटोरियल है + Reset progress प्रगति रीसेट करें + Mark Tutorial Step ट्यूटोरियल चरण चिह्नित करें + Reset Learn Progress सीखने की प्रगति रीसेट करें +@msg missing `step` (see learn.show) लापता `step` (learn.show देखें) +@msg `step` must be a step number from 0 to {last} `step` 0 से {last} तक की चरण संख्या होनी चाहिए +@msg `{id}` is finished (see learn.resetProgress) `{id}` पूरा हो चुका है (learn.resetProgress देखें) # Deferred plug-in effects Refresh Deferred Effects स्थगित इफ़ेक्ट्स रिफ्रेश करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index c2f1a52cd9..7f2f03afb2 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -906,6 +906,8 @@ font-technology Variable Változó Crop Image Kép körülvágása Image Tools Képeszközök Remove Background… Háttér eltávolítása… + Draw (Pencil) Rajzolás (Ceruza) + Place Image Kép elhelyezése Remove Background Háttér eltávolítása Background Háttér Edge Color Szélszín @@ -3222,6 +3224,7 @@ mark-style Japanese Japán Proportional Metrics Arányos metrika Insert Aki Left Aki beszúrása balra Insert Aki Right Aki beszúrása jobbra + Tsume Tsume Proportional Lining Arányos modern Position: Pozíció: Default Position Alapértelmezett pozíció @@ -4311,6 +4314,7 @@ mark-style Japanese Japán VectorCraft Title Bar on Every Desktop A VectorCraft címsora minden asztali környezetben The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Amíg a VECTORCRAFT_TITLEBAR környezeti változó be van állítva, az választja ki a címsort. System Title Bar takes precedence over this option while it is on. Amíg a Rendszer címsora be van kapcsolva, elsőbbséget élvez ezzel a beállítással szemben. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Amíg a VectorCraft címsora minden asztali környezetben beállítás ki van kapcsolva, ez az asztali környezet rajzolja az ablak címsorát, akár be van kapcsolva ez a beállítás, akár nem. Tab Tabulátor Tab Stops Tabulátorpontok Table Táblázat @@ -4913,6 +4917,7 @@ imageTrace Outline Körvonal @msg `select` must be true or false `select`: true vagy false kell @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` és `maxAnchors`: egész szám kell @msg `{key}` must be a number not below 0 `{key}`: legalább 0 értékű szám kell +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}`: négy legalább 0 értékű szám kell: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}`: [x, y, width, height] kell, négy véges szám, a szélesség és a magasság nem negatív @msg `{min_key}` is greater than `{max_key}` `{min_key}` nagyobb, mint `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` adj meg legalább egyet ezek közül: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -5429,6 +5434,7 @@ imageTrace Outline Körvonal @msg no action set to save nincs menthető műveletkészlet @msg the action set file can't be read in full a műveletkészlet-fájl nem olvasható be teljesen @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out „{name}” betöltve; kihagyott lépések: {n} +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` „{name}” betöltve; megtartott lépések ismeretlen paranccsal: {n}; az első: „{action}”, lépés: {step}, `{command}` @msg not an action set file nem műveletkészlet-fájl @msg the action set file is larger than 8 MiB a műveletkészlet-fájl nagyobb 8 MiB-nál @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: a referencia nagyobb lenne {MAX_BYTES} bájtnál @@ -5802,6 +5808,7 @@ imageTrace Outline Körvonal @msg truncated csonka @msg Unembedded to {_1} Beágyazás megszüntetve, ide: {_1} @msg unknown command `{0}` ismeretlen parancs: `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` „{action}”, lépés: {step}: ismeretlen parancsot futtat: `{command}` @msg unknown command `{0}`; did you mean `{1}`? ismeretlen parancs: `{0}`; erre gondolt: `{1}`? @msg unknown effect `{id}` ismeretlen effektus: `{id}` @msg unknown format ismeretlen formátum @@ -6372,8 +6379,8 @@ axis Y Axis Y tengely @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` az exportáló bővítmény 1–{MAX_EXTENSIONS} `extensions` értéket ad meg @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` csoporton kívül legfeljebb {MAX_UNGROUPED} paraméter lehet: a többinek adj meg `group` értéket @msg can't encode the input a bemenet nem kódolható -@msg expected {"dataBase64"} várt formátum: {"dataBase64"} -@msg expected {"objects"} várt formátum: {"objects"} +@msg expected {{"dataBase64": "…"}} várt formátum: {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} várt formátum: {{"objects": [...]}} @msg export `{name}`: {e} `{name}` modulexport: {e} @msg extension {e} is listed twice a(z) {e} kiterjesztés kétszer szerepel @msg extension {e}: use 1-16 lower-case letters and digits, without the dot {e} kiterjesztés: 1-16 kisbetűt és számjegyet használj, pont nélkül @@ -6437,11 +6444,11 @@ axis Y Axis Y tengely @msg a painted live effect returns only `objects` a festő élő effektus csak `objects` értéket ad vissza @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` a festő élő effektus darabjának csak `path`, `fillRule`, `fills` és `strokes` kulcsa van @msg a read-only object was left out kimaradt egy írásvédett objektum -@msg a read-only object was left out: return it, as {"id"} alone or as it was given kimaradt egy írásvédett objektum: adja vissza önmagában {"id"} formában vagy úgy, ahogy megkapta +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given kimaradt egy írásvédett objektum: adja vissza önmagában {{"id": …}} formában vagy úgy, ahogy megkapta @msg a string karakterlánc @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` a körvonalnak csak `paint`, `width`, `join`, `cap` és `miterLimit` kulcsa van -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} a körvonal formája {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} legyen -@msg an effect must be {"id", "params"?, "visible"?} az effektus formája {"id", "params"?, "visible"?} legyen +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} a körvonal formája {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} legyen +@msg an effect must be {{"id", "params"?, "visible"?}} az effektus formája {{"id", "params"?, "visible"?}} legyen @msg an effect on a fill returns only `fills` a kitöltésen lévő effektus csak `fills` értéket ad vissza @msg an effect on a stroke returns only `strokes` a körvonalon lévő effektus csak `strokes` értéket ad vissza @msg an object must be a JSON object az objektum JSON-objektum legyen @@ -6583,6 +6590,8 @@ axis Y Axis Y tengely Action Options… Művelet beállításai… Action Options Művelet beállításai Playback Options… Lejátszási beállítások… + Button Mode Gomb mód + No actions. Nincs művelet. Insert Stop… Megállás beszúrása… Insert Stop Megállás beszúrása Record Stop Megállás rögzítése @@ -7447,6 +7456,12 @@ breakText Glyphs Glifák @msg open the practice sample of `{id}` first (see learn.openSample) előbb nyissa meg a gyakorló mintafájlt ehhez: `{id}` (lásd: learn.openSample) @msg finish `{id}` first (see learn.finish) előbb fejezze be ezt: `{id}` (lásd: learn.finish) @msg `{id}` is the last tutorial in its skill a készsége utolsó oktatóanyaga: `{id}` + Reset progress Előrehaladás visszaállítása + Mark Tutorial Step Oktatóanyag lépésének megjelölése + Reset Learn Progress Tanulási előrehaladás visszaállítása +@msg missing `step` (see learn.show) hiányzik: `step` (lásd: learn.show) +@msg `step` must be a step number from 0 to {last} a `step` értéke 0 és {last} közötti lépésszám legyen +@msg `{id}` is finished (see learn.resetProgress) befejezve: `{id}` (lásd: learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Elhalasztott effektusok frissítése @@ -7476,3 +7491,120 @@ breakText Glyphs Glifák Grommets Ringlik Grommet Inset Ringlik távolsága a széltől Diameter Átmérő + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points A 3D effektusokhoz 100 millió ponton belüli véges koordináták kellenek +@msg 3D effects require one to ten lights A 3D effektusokhoz egy és tíz közötti számú fény kell +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP-színmélység {_1}: 1, 4, 8, 16, 24 vagy 32 bit/pixel lehet +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer A BMP-kódolás sikertelen: {width} × {height} pixel nem fér bele a formátumba vagy a pixelpufferbe +@msg GIF encoding failed: the palette image is malformed A GIF-kódolás sikertelen: a palettás kép hibás szerkezetű +@msg GIF encoding failed: {e} A GIF-kódolás sikertelen: {e} +@msg JPEG colour profile: {e} JPEG-színprofil: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size A JPEG-kódolás sikertelen: a pixelpuffer nem egyezik a kép méretével +@msg JPEG encoding failed: {e} A JPEG-kódolás sikertelen: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size A PNG-kódolás sikertelen: a pixelpuffer nem egyezik a kép méretével +@msg PNG encoding failed: the palette image is malformed A PNG-kódolás sikertelen: a palettás kép hibás szerkezetű +@msg PNG encoding failed: {e} A PNG-kódolás sikertelen: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size A PNG-kódolás sikertelen: {width} × {height} pixel nem érvényes képméret +@msg PSD colour profile: {e} PSD-színprofil: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size A PSD-kódolás sikertelen: a pixelpuffer nem egyezik a kép méretével +@msg Revolve profile contains invalid coordinates Forgatás tengely körül: a profil érvénytelen koordinátákat tartalmaz +@msg Revolve profile is too complex Forgatás tengely körül: a profil túl összetett +@msg Revolve projection is not finite Forgatás tengely körül: a vetület nem véges +@msg Revolve requires finite profile coordinates within 100 million points Forgatás tengely körül: 100 millió ponton belüli véges profilkoordináták kellenek +@msg Revolve surface is too complex; reduce Segments or simplify the profile Forgatás tengely körül: a felület túl összetett; csökkentsd a Szakaszok értékét, vagy egyszerűsítsd a profilt +@msg Revolve surface is too complex; simplify the profile Forgatás tengely körül: a felület túl összetett; egyszerűsítsd a profilt +@msg Revolve visibility cannot split the projected boundary Forgatás tengely körül: a láthatóság számítása nem tudja felosztani a vetített határvonalat +@msg Revolve visibility creates too many fragments Forgatás tengely körül: a láthatóság számítása túl sok darabot hoz létre +@msg Revolve visibility creates too many vector anchors Forgatás tengely körül: a láthatóság számítása túl sok vektoros horgonypontot hoz létre +@msg Revolve visibility exceeds its geometry work limit Forgatás tengely körül: a láthatóság számítása túllépi a geometriai számítások korlátját +@msg Revolve visibility exceeds its spatial index limit Forgatás tengely körül: a láthatóság számítása túllépi a térbeli index korlátját +@msg Revolve visibility has too many boundary crossings Forgatás tengely körül: a láthatóság számításában túl sok a határvonal-keresztezés +@msg Revolve visibility has too many input anchors Forgatás tengely körül: a láthatóság számításában túl sok a bemeneti horgonypont +@msg Revolve visibility requires convex cap sectors Forgatás tengely körül: a láthatóság számításához konvex zárólap-szektorok kellenek +@msg Revolve visibility requires finite projected faces Forgatás tengely körül: a láthatóság számításához véges vetített lapok kellenek +@msg SVG options: {e} SVG-beállítások: {e} +@msg Save for Web settings: {e} Webes mentés beállításai: {e} +@msg TIFF colour profile: {e} TIFF-színprofil: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size A TIFF-kódolás sikertelen: a pixelpuffer nem egyezik a kép méretével +@msg TIFF encoding failed: {e} A TIFF-kódolás sikertelen: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa-színmélység {_1}: 16, 24 vagy 32 bit/pixel lehet +@msg Targa encoding failed: the pixel buffer doesn't match the image size A Targa-kódolás sikertelen: a pixelpuffer nem egyezik a kép méretével +@msg The 3D projection is not finite A 3D vetület nem véges +@msg The 3D shadow is too complex; turn Shadows off or simplify the art A 3D árnyék túl összetett; kapcsold ki az Árnyékok beállítást, vagy egyszerűsítsd a rajzot +@msg The shape contains invalid coordinates Az alakzat érvénytelen koordinátákat tartalmaz +@msg Too many Revolve faces for visibility evaluation Túl sok lap a láthatóság kiértékeléséhez (Forgatás tengely körül) +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} A VectorCraft legfeljebb {ASE_MAX_ENTRIES} színt és csoportot olvas be egy színmintacsere-fájlból, ebben a könyvtárban pedig ennyi van: {entries} +@msg WebP encoding failed: {e} A WebP-kódolás sikertelen: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `index` must be a whole number `index`: egész szám kell +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view`: smallThumb, mediumThumb, largeThumb, smallList vagy largeList lehet +@msg a line can't run from a point to itself egy vonal nem futhat egy pontból önmagába +@msg a line needs at least two points egy vonalhoz legalább két pont kell +@msg a number cannot be read egy szám nem olvasható be +@msg a swatch exchange block is too long egy színmintacsere-blokk túl hosszú +@msg a swatch exchange name is too long egy színmintacsere-név túl hosszú +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels egy {sw} × {sh} méretű kép nem méretezhető át erre: {width} × {height} pixel +@msg a {width} × {height} image is too large egy {width} × {height} méretű kép túl nagy +@msg a {width} × {height} image: {e} egy {width} × {height} méretű kép: {e} +@msg an image could not be written: {e} egy képet nem sikerült kiírni: {e} +@msg an image that couldn't be read was left out kimaradt egy kép, amely nem volt beolvasható +@msg can't open “{name}”: {e} nem nyitható meg: „{name}”: {e} +@msg cannot align zip entries to {align} bytes a zip-bejegyzések nem igazíthatók {align} bájtos határra +@msg cannot open the automation {kind} root `{_1}`: {e} az automatizálás gyökérmappája nem nyitható meg ({kind}): `{_1}`: {e} +@msg cannot read profile: {0} a profil nem olvasható: {0} +@msg color book version {version} isn't supported (only 1) a színkönyv verziója nem támogatott: {version} (csak 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) a színkönyvek nem támogatottak ebben a színtérben: {other} (csak RGB, CMYK és Lab) +@msg file name too long to zip: {_1} a fájlnév túl hosszú a zip-tömörítéshez: {_1} +@msg file name too long to zip: {name} a fájlnév túl hosszú a zip-tömörítéshez: {name} +@msg freeform line {i}: {e} szabad formájú vonal {i}: {e} +@msg freeform point {i}: {e} szabad formájú pont {i}: {e} +@msg give `{key}` or `{other}`, not both `{key}` vagy `{other}`: csak az egyiket add meg, ne mindkettőt +@msg grayscale profiles can't be working spaces yet a szürkeárnyalatos profilok egyelőre nem lehetnek munkaszínterek +@msg input contains NaN or infinite coordinates a bemenet NaN vagy végtelen koordinátákat tartalmaz +@msg input path could not be closed a bemeneti útvonalat nem sikerült lezárni +@msg invalid ICC profile: {0} érvénytelen ICC-profil: {0} +@msg invalid scale {scale} érvénytelen méretarány: {scale} +@msg its localized names take more than {_1} KB a honosított nevei több mint {_1} KB helyet foglalnak +@msg its objects are nested too deep ({e}) az objektumai túl mélyen egymásba ágyazottak ({e}) +@msg its tag table lists the `{_1}` tag more than once a címketáblája többször is felsorolja ezt a címkét: `{_1}` +@msg knockout groups with too many overlapping translucent elements are written as PDF knockout groups: their translucent elements knock out what they cover fully a túl sok egymást átfedő áttetsző elemet tartalmazó kiütő csoportok PDF-kiütőcsoportként íródnak: az áttetsző elemeik teljesen kiütik azt, amit takarnak +@msg not a graphic style library: {e} nem grafikaistílus-könyvtár: {e} +@msg not a swatch library (.vcswatches or .gpl) nem színminta-könyvtár (.vcswatches vagy .gpl) +@msg not a swatch library (format `{_1}`) nem színminta-könyvtár (formátum: `{_1}`) +@msg not a swatch library: {e} nem színminta-könyvtár: {e} +@msg not an action set file ({e}) nem műveletkészlet-fájl ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray a profil színtere nem RGB, CMYK vagy szürkeárnyalatos: {other} +@msg regular expression too large a reguláris kifejezés túl nagy +@msg script file is not UTF-8 text: {value} a parancsfájl nem UTF-8 szöveg: {value} +@msg stop {i}: {e} színátmenet-pont {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) a színmintacsere-fájl verziója nem támogatott: {major}.{minor} (csak 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors a színkönyv több mint {ASE_MAX_ENTRIES} színt tartalmaz +@msg the color book is cut short a színkönyv csonka +@msg the color book's names take more than {_1} MB a színkönyv nevei több mint {_1} MB helyet foglalnak +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution a kép mérete {w} × {h} pixel lenne; a raszteres exportálás oldalanként legfeljebb {MAX_RASTER_SIDE} pixelt és összesen legfeljebb {_1} megapixelt enged: csökkentsd a méretarányt vagy a felbontást +@msg the optimised image can't be read back: {e} az optimalizált kép nem olvasható vissza: {e} +@msg the pixel buffer doesn't match the image size a pixelpuffer nem egyezik a kép méretével +@msg the preview: {e} az előnézeti kép: {e} +@msg the request may not read the New Document profiles folder a kérés nem olvashatja az Új dokumentum profiljainak mappáját +@msg the shapes are too degenerate to combine az alakzatok túlságosan elfajultak az egyesítéshez +@msg the shapes cross themselves and each other too often to combine az alakzatok túl sokszor keresztezik önmagukat és egymást az egyesítéshez +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups a színmintacsere-fájl több mint {ASE_MAX_ENTRIES} színt és csoportot tartalmaz +@msg the swatch exchange file is cut short a színmintacsere-fájl csonka +@msg the {_1} plate can't be read: {e} a nyomólemez nem olvasható be ({_1}): {e} +@msg this binary DXF file is damaged or cut short ez a bináris DXF-fájl sérült vagy csonka +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that ez DWG-rajz, amely nem olvasható: mentsd DXF-ként a CAD-alkalmazásból, és azt nyisd meg +@msg too many classes túl sok karakterosztály +@msg too many groups túl sok csoport +@msg too many layers for PSD (at most 32767) túl sok réteg a PSD formátumhoz (legfeljebb 32767) +@msg too many swatch exchange blocks túl sok színmintacsere-blokk +@msg unknown colour profile: {0} ismeretlen színprofil: {0} +@msg {_1} clashes with a built-in profile name {_1}: ütközik egy beépített profil nevével +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixel túl nagy a GIF formátumhoz (oldalanként legfeljebb 65535 pixel): csökkentsd a felbontást +@msg {_1}: no usable transform to/from sRGB {_1}: nincs használható átalakítás az sRGB színtérbe vagy onnan +@msg {name} is not a CMYK profile {name}: nem CMYK-profil +@msg {name} is not an RGB profile {name}: nem RGB-profil +@msg {path}: could not be read {path}: nem sikerült beolvasni +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pixel túl nagy a JPEG formátumhoz (oldalanként legfeljebb 65535 pixel): csökkentsd a felbontást +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pixel túl nagy a Targa formátumhoz (oldalanként legfeljebb 65535 pixel): csökkentsd a felbontást +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixel túl nagy a PSD formátumhoz (oldalanként legfeljebb {MAX_SIDE} pixel): csökkentsd a felbontást diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index a36c629332..c7c6b956db 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -194,6 +194,8 @@ Crop Image Pangkas gambar Image Tools Alat Gambar Remove Background… Hapus latar belakang… + Draw (Pencil) Menggambar (pensil) + Place Image Tempatkan gambar Remove Background Hapus latar belakang Background Latar belakang Edge Color Warna tepi @@ -924,6 +926,7 @@ VectorCraft Title Bar on Every Desktop Bilah judul VectorCraft di setiap desktop The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Selama ditetapkan, variabel lingkungan VECTORCRAFT_TITLEBAR memilih bilah judul. System Title Bar takes precedence over this option while it is on. Selama aktif, Bilah judul sistem lebih diutamakan daripada opsi ini. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Selama Bilah judul VectorCraft di setiap desktop nonaktif, desktop ini menggambar bilah judul jendela, baik opsi ini aktif maupun tidak. Exit Keluar Distort Distorsi Diffuse Glow… Pendar difusi… @@ -1506,6 +1509,7 @@ lighting Light Cahaya Proportional Metrics Metrik proporsional Insert Aki Left Sisipkan aki kiri Insert Aki Right Sisipkan aki kanan + Tsume Tsume Character Direction Arah karakter Digits Digit Arabic Arab @@ -4795,11 +4799,11 @@ imageTrace Outline Kontur @msg unknown effect `{id}` efek `{id}` tidak dikenal @msg unknown format format tidak dikenal @msg unknown format `{f}` (Save writes {_1}) format `{f}` tidak dikenal (Simpan menulis {_1}) -@msg unknown freeform mode `{m}` (points, lines) mode bentuk bebas `{m}` tidak dikenal (titik, garis) -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) jenis gradien `{k}` tidak dikenal (linear, radial, kerucut, wajik, bentuk bebas) +@msg unknown freeform mode `{m}` (points, lines) mode bentuk bebas `{m}` tidak dikenal (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) jenis gradien `{k}` tidak dikenal (linear, radial, conic, diamond, freeform) @msg unknown highlight `{h}` sorotan `{h}` tidak dikenal @msg unknown option `{path}.{k}` opsi `{path}.{k}` tidak dikenal -@msg unknown overprints `{o}` (preserve, simulate or discard) overprint `{o}` tidak dikenal (pertahankan, simulasikan, atau buang) +@msg unknown overprints `{o}` (preserve, simulate or discard) overprint `{o}` tidak dikenal (preserve, simulate, atau discard) @msg unknown panel `{raw}` panel `{raw}` tidak dikenal @msg unknown preference `{key}` preferensi `{key}` tidak dikenal @msg Preferences imported. Preferensi diimpor. @@ -4817,10 +4821,10 @@ imageTrace Outline Kontur @msg `{key}` must be an object `{key}` harus berupa objek @msg `prefs.import` runs on its own, not as a batch step `prefs.import` dijalankan sendiri, bukan sebagai langkah batch @msg unknown preset (one of {_1}) preset tidak dikenal (salah satu dari {_1}) -@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) preset `{name}` tidak dikenal (tinggi, sedang, rendah, atau yang tersimpan: lihat flattener.presets.list) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) preset `{name}` tidak dikenal (high, medium, low, atau yang tersimpan: lihat flattener.presets.list) @msg unknown preset `{name}` (see flattener.presets.list) preset `{name}` tidak dikenal (lihat flattener.presets.list) @msg unknown preset `{name}` (see webExport.presets.list) preset `{name}` tidak dikenal (lihat webExport.presets.list) -@msg unknown side `{other}` (left|right|top|bottom) sisi `{other}` tidak dikenal (kiri|kanan|atas|bawah) +@msg unknown side `{other}` (left|right|top|bottom) sisi `{other}` tidak dikenal (left|right|top|bottom) @msg unknown tool `{tool}` alat `{tool}` tidak dikenal @msg unknown tool `{t}` alat `{t}` tidak dikenal @msg unknown tool or command `{key}` alat atau perintah `{key}` tidak dikenal @@ -6073,6 +6077,8 @@ axis Y Axis Sumbu Y Action Options… Opsi tindakan… Action Options Opsi tindakan Playback Options… Opsi pemutaran… + Button Mode Mode tombol + No actions. Tidak ada aksi. Insert Stop… Sisipkan henti… Insert Stop Sisipkan henti Record Stop Rekam henti @@ -6874,6 +6880,12 @@ breakText Glyphs Glif @msg open the practice sample of `{id}` first (see learn.openSample) buka contoh latihan `{id}` terlebih dahulu (lihat learn.openSample) @msg finish `{id}` first (see learn.finish) selesaikan `{id}` terlebih dahulu (lihat learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` adalah tutorial terakhir dalam keterampilannya + Reset progress Atur ulang kemajuan + Mark Tutorial Step Tandai langkah tutorial + Reset Learn Progress Atur ulang kemajuan belajar +@msg missing `step` (see learn.show) `step` tidak ada (lihat learn.show) +@msg `step` must be a step number from 0 to {last} `step` harus berupa nomor langkah dari 0 sampai {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` sudah selesai (lihat learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Segarkan efek yang ditunda diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 0ac2816b07..f832a5baf3 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -705,6 +705,8 @@ font-technology Variable Variabili Crop Image Ritaglia immagine Image Tools Strumenti immagine Remove Background… Rimuovi sfondo… + Draw (Pencil) Disegna (Matita) + Place Image Inserisci immagine Remove Background Rimuovi sfondo Background Sfondo Edge Color Colore del bordo @@ -2706,6 +2708,7 @@ mark-style Japanese Giapponese Proportional Metrics Metrica proporzionale Insert Aki Left Inserisci aki a sinistra Insert Aki Right Inserisci aki a destra + Tsume Tsume Character Direction Direzione caratteri Digits Cifre Arabic Arabe @@ -4541,6 +4544,7 @@ axis Both Entrambi @msg `select` must be true or false `select` deve essere true o false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` e `maxAnchors` devono essere numeri interi @msg `{key}` must be a number not below 0 `{key}` deve essere un numero non inferiore a 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` deve essere quattro numeri non inferiori a 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` deve essere [x, y, width, height]: quattro numeri finiti, con larghezza e altezza non negative @msg `{min_key}` is greater than `{max_key}` `{min_key}` è maggiore di `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` indica almeno uno tra `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4793,6 +4797,7 @@ axis Both Entrambi @msg no action set to save nessun set di azioni da salvare @msg the action set file can't be read in full il file di set di azioni non può essere letto per intero @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Caricato “{name}”: {n} passaggio è stato omesso|Caricato “{name}”: {n} passaggi sono stati omessi +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Caricato “{name}”: {n} passaggio ha un comando sconosciuto ed è stato mantenuto: “{action}”, passaggio {step}, `{command}`|Caricato “{name}”: {n} passaggi hanno comandi sconosciuti e sono stati mantenuti; il primo: “{action}”, passaggio {step}, `{command}` @msg not an action set file non è un file di set di azioni @msg the action set file is larger than 8 MiB il file del set di azioni supera 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: il riferimento supererebbe {MAX_BYTES} byte @@ -5034,6 +5039,7 @@ axis Both Entrambi @msg tool shortcuts must be a single key (optionally with Shift) le scelte rapide degli strumenti devono essere un singolo tasto (eventualmente con Shift) @msg truncated troncato @msg unknown command `{0}` comando sconosciuto `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` il passaggio {step} di “{action}” esegue il comando sconosciuto `{command}` @msg unknown command `{0}`; did you mean `{1}`? comando sconosciuto `{0}`; forse intendevate `{1}`? @msg unknown effect `{id}` effetto sconosciuto `{id}` @msg unknown format formato sconosciuto @@ -5377,6 +5383,7 @@ effect Regular Normale VectorCraft Title Bar on Every Desktop Barra del titolo di VectorCraft su ogni desktop The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Finché è impostata, la variabile d'ambiente VECTORCRAFT_TITLEBAR sceglie la barra del titolo. System Title Bar takes precedence over this option while it is on. Finché è attiva, Barra del titolo di sistema ha la precedenza su questa opzione. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Finché Barra del titolo di VectorCraft su ogni desktop è disattivata, questo desktop disegna la barra del titolo della finestra, sia con questa opzione attiva sia disattivata. Value Axis Asse dei valori On Left Side Sul lato sinistro On Right Side Sul lato destro @@ -6015,8 +6022,8 @@ axis Y Axis Asse Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` un plug-in di esportazione dichiara da 1 a {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` al massimo {MAX_UNGROUPED} parametri fuori dai gruppi: assegna agli altri un `group` @msg can't encode the input impossibile codificare l’input -@msg expected {"dataBase64"} previsto {"dataBase64"} -@msg expected {"objects"} previsto {"objects"} +@msg expected {{"dataBase64": "…"}} previsto {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} previsto {{"objects": [...]}} @msg export `{name}`: {e} esportazione del modulo `{name}`: {e} @msg extension {e} is listed twice l’estensione {e} è elencata due volte @msg extension {e}: use 1-16 lower-case letters and digits, without the dot estensione {e}: usa 1-16 lettere minuscole e cifre, senza il punto @@ -6080,11 +6087,11 @@ axis Y Axis Asse Y @msg a painted live effect returns only `objects` un effetto dinamico di pittura restituisce solo `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` un pezzo di un effetto dinamico di pittura ha solo `path`, `fillRule`, `fills` e `strokes` @msg a read-only object was left out è stato omesso un oggetto di sola lettura -@msg a read-only object was left out: return it, as {"id"} alone or as it was given è stato omesso un oggetto di sola lettura: restituiscilo come {"id"} da solo o così come è stato fornito +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given è stato omesso un oggetto di sola lettura: restituiscilo come {{"id": …}} da solo o così come è stato fornito @msg a string una stringa @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` una traccia ha solo `paint`, `width`, `join`, `cap` e `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} una traccia deve essere {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} un effetto deve essere {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} una traccia deve essere {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} un effetto deve essere {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` un effetto su un riempimento restituisce solo `fills` @msg an effect on a stroke returns only `strokes` un effetto su una traccia restituisce solo `strokes` @msg an object must be a JSON object un oggetto deve essere un oggetto JSON @@ -6226,6 +6233,8 @@ axis Y Axis Asse Y Action Options… Opzioni azione… Action Options Opzioni azione Playback Options… Opzioni di riproduzione… + Button Mode Modalità pulsante + No actions. Nessuna azione. Insert Stop… Inserisci interruzione… Insert Stop Inserisci interruzione Record Stop Registra interruzione @@ -7093,6 +7102,12 @@ breakText Glyphs Glifi @msg open the practice sample of `{id}` first (see learn.openSample) apri prima l’esempio di esercitazione di `{id}` (vedi learn.openSample) @msg finish `{id}` first (see learn.finish) termina prima `{id}` (vedi learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` è l’ultimo tutorial della sua competenza + Reset progress Reimposta i progressi + Mark Tutorial Step Segna il passaggio del tutorial + Reset Learn Progress Reimposta i progressi di apprendimento +@msg missing `step` (see learn.show) manca `step` (vedi learn.show) +@msg `step` must be a step number from 0 to {last} `step` deve essere un numero di passaggio da 0 a {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` è terminato (vedi learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Aggiorna effetti rimandati diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 71de1ce91c..3abb388f49 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -52,6 +52,7 @@ font-technology Variable バリアブル Proportional Metrics プロポーショナルメトリクス Insert Aki Left 前にアキを挿入 Insert Aki Right 後ろにアキを挿入 + Tsume 文字ツメ Character Direction 文字の方向 Digits 数字 Arabic アラビア数字 @@ -242,6 +243,8 @@ digits Malayalam マラヤーラム数字 Crop Image 画像の切り抜き Image Tools 画像ツール Remove Background… 背景を削除… + Draw (Pencil) 描画 (鉛筆) + Place Image 画像を配置 Remove Background 背景を削除 Background 背景 Edge Color 端の色 @@ -4712,6 +4715,7 @@ swatch Bright Violet ビビッドバイオレット @msg objects can't be nested more than 32 deep オブジェクトは 32 階層より深く入れ子にできません @msg the SVG's elements are nested more than {0} deep SVG の要素が {0} 階層より深く入れ子になっています @msg unknown command `{0}` `{0}` は不明なコマンドです +@msg step {step} of “{action}” runs the unknown command `{command}` 「{action}」のステップ {step} は不明なコマンド `{command}` を実行します @msg unknown command `{0}`; did you mean `{1}`? `{0}` は不明なコマンドです。`{1}` のことですか? @msg `{what}` closes nothing `{what}` に対応する開始部分がありません @msg `{what}` closes something it didn't open `{what}` が対応しない開始部分を閉じています @@ -5011,6 +5015,7 @@ swatch Bright Violet ビビッドバイオレット @msg `select` must be true or false `select` には true または false を指定してください @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` と `maxAnchors` は整数にしてください @msg `{key}` must be a number not below 0 `{key}` には 0 以上の数値を指定してください +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` には 0 以上の数値を 4 つ指定してください: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` は [x, y, width, height] の形式で指定してください: 有限の数値 4 つで、幅と高さは負の値にできません @msg `{min_key}` is greater than `{max_key}` `{min_key}` が `{max_key}` より大きくなっています @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` 次のうち少なくとも 1 つを指定してください: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -5060,6 +5065,7 @@ swatch Bright Violet ビビッドバイオレット @msg no action set to save 保存するアクションセットがありません @msg the action set file can't be read in full アクションセットファイルをすべて読み込めません @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out 「{name}」を読み込みました。{n} 個のステップは省きました +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` 「{name}」を読み込みました。不明なコマンドのステップ {n} 個はそのまま残しました。最初は「{action}」のステップ {step}、`{command}` です @msg not an action set file アクションセットファイルではありません @msg the action set file is larger than 8 MiB アクションセットファイルが 8 MiB を超えています @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: リファレンスが {MAX_BYTES} バイトを超えます @@ -5419,6 +5425,7 @@ effect Vertical 垂直 VectorCraft Title Bar on Every Desktop すべてのデスクトップで VectorCraft のタイトルバー The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. 環境変数 VECTORCRAFT_TITLEBAR が設定されている間は、この変数でタイトルバーが決まります。 System Title Bar takes precedence over this option while it is on. システムのタイトルバーがオンの間は、そちらがこのオプションより優先されます。 + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. すべてのデスクトップで VectorCraft のタイトルバーがオフの間は、このオプションのオンとオフにかかわらず、このデスクトップがウィンドウのタイトルバーを描画します。 Value Axis 数値軸 On Left Side 左側 On Right Side 右側 @@ -6081,8 +6088,8 @@ axis Y Axis Y 軸 @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` 書き出しプラグインは `extensions` を 1~{MAX_EXTENSIONS} 個宣言します @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` グループ外のパラメーターは {MAX_UNGROUPED} 個までです。ほかのパラメーターには `group` を指定してください @msg can't encode the input 入力をエンコードできません -@msg expected {"dataBase64"} {"dataBase64"} が必要です -@msg expected {"objects"} {"objects"} が必要です +@msg expected {{"dataBase64": "…"}} {{"dataBase64": "…"}} が必要です +@msg expected {{"objects": [...]}} {{"objects": [...]}} が必要です @msg export `{name}`: {e} モジュールのエクスポート `{name}`: {e} @msg extension {e} is listed twice 拡張子 {e} が 2 回指定されています @msg extension {e}: use 1-16 lower-case letters and digits, without the dot 拡張子 {e}: ドットを付けずに小文字と数字で 1-16 文字にしてください @@ -6146,11 +6153,11 @@ axis Y Axis Y 軸 @msg a painted live effect returns only `objects` ペイント型のライブ効果が返すのは `objects` だけです @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` ペイント型のライブ効果のピースに使えるのは `path`、`fillRule`、`fills`、`strokes` だけです @msg a read-only object was left out 読み取り専用のオブジェクトが省かれています -@msg a read-only object was left out: return it, as {"id"} alone or as it was given 読み取り専用のオブジェクトが省かれています: {"id"} だけの形か、渡されたとおりの形で返してください +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given 読み取り専用のオブジェクトが省かれています: {{"id": …}} だけの形か、渡されたとおりの形で返してください @msg a string 文字列 @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` 線に使えるのは `paint`、`width`、`join`、`cap`、`miterLimit` だけです -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 線は {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} の形にしてください -@msg an effect must be {"id", "params"?, "visible"?} 効果は {"id", "params"?, "visible"?} の形にしてください +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 線は {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} の形にしてください +@msg an effect must be {{"id", "params"?, "visible"?}} 効果は {{"id", "params"?, "visible"?}} の形にしてください @msg an effect on a fill returns only `fills` 塗りの効果が返すのは `fills` だけです @msg an effect on a stroke returns only `strokes` 線の効果が返すのは `strokes` だけです @msg an object must be a JSON object オブジェクトは JSON オブジェクトにしてください @@ -6292,6 +6299,8 @@ axis Y Axis Y 軸 Action Options… アクションオプション… Action Options アクションオプション Playback Options… 再生オプション… + Button Mode ボタンモード + No actions. アクションがありません。 Insert Stop… 停止を挿入… Insert Stop 停止を挿入 Record Stop 停止を記録 @@ -7159,6 +7168,12 @@ breakText Glyphs 字形 @msg open the practice sample of `{id}` first (see learn.openSample) 先に `{id}` の練習用サンプルを開いてください (learn.openSample を参照) @msg finish `{id}` first (see learn.finish) 先に `{id}` を完了してください (learn.finish を参照) @msg `{id}` is the last tutorial in its skill `{id}` はこのスキルの最後のチュートリアルです + Reset progress 進行状況をリセット + Mark Tutorial Step チュートリアルの手順をマーク + Reset Learn Progress 学習の進行状況をリセット +@msg missing `step` (see learn.show) `step` が指定されていません (learn.show を参照) +@msg `step` must be a step number from 0 to {last} `step` は 0 から {last} までの手順番号にしてください +@msg `{id}` is finished (see learn.resetProgress) `{id}` は完了しています (learn.resetProgress を参照) # Deferred plug-in effects Refresh Deferred Effects 保留中の効果を更新 @@ -7188,3 +7203,131 @@ breakText Glyphs 字形 Grommets ハトメ Grommet Inset 端からハトメまでの距離 Diameter 直径 + +# Messages no catalog translated yet: image export and color profiles, color books and swatch exchange files, 3D and Revolve, and script, zip, line and file errors. +@msg 3D effects require finite coordinates within 100 million points 3D 効果には 1 億ポイント以内の有限の座標が必要です +@msg 3D effects require one to ten lights 3D 効果にはライトが 1~10 個必要です +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP の色深度 {_1}: 1、4、8、16、24、32 ビット/ピクセルのいずれかにしてください +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP のエンコードに失敗しました: {width} × {height} ピクセルは形式またはピクセルバッファーに収まりません +@msg GIF encoding failed: the palette image is malformed GIF のエンコードに失敗しました: パレット画像の形式が正しくありません +@msg GIF encoding failed: {e} GIF のエンコードに失敗しました: {e} +@msg JPEG colour profile: {e} JPEG のカラープロファイル: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG のエンコードに失敗しました: ピクセルバッファーが画像サイズと一致しません +@msg JPEG encoding failed: {e} JPEG のエンコードに失敗しました: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG のエンコードに失敗しました: ピクセルバッファーが画像サイズと一致しません +@msg PNG encoding failed: the palette image is malformed PNG のエンコードに失敗しました: パレット画像の形式が正しくありません +@msg PNG encoding failed: {e} PNG のエンコードに失敗しました: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG のエンコードに失敗しました: {width} × {height} ピクセルは有効な画像サイズではありません +@msg PSD colour profile: {e} PSD のカラープロファイル: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD のエンコードに失敗しました: ピクセルバッファーが画像サイズと一致しません +@msg Revolve profile contains invalid coordinates 回転体のプロファイルに無効な座標が含まれています +@msg Revolve profile is too complex 回転体のプロファイルが複雑すぎます +@msg Revolve projection is not finite 回転体の投影が有限ではありません +@msg Revolve requires finite profile coordinates within 100 million points 回転体には 1 億ポイント以内の有限のプロファイル座標が必要です +@msg Revolve surface is too complex; reduce Segments or simplify the profile 回転体のサーフェスが複雑すぎます。分割数を減らすか、プロファイルを単純化してください +@msg Revolve surface is too complex; simplify the profile 回転体のサーフェスが複雑すぎます。プロファイルを単純化してください +@msg Revolve visibility cannot split the projected boundary 回転体の可視判定で投影された境界線を分割できません +@msg Revolve visibility creates too many fragments 回転体の可視判定で生成される断片が多すぎます +@msg Revolve visibility creates too many vector anchors 回転体の可視判定で生成されるベクトルのアンカーポイントが多すぎます +@msg Revolve visibility exceeds its geometry work limit 回転体の可視判定がジオメトリ計算の上限を超えています +@msg Revolve visibility exceeds its spatial index limit 回転体の可視判定が空間インデックスの上限を超えています +@msg Revolve visibility has too many boundary crossings 回転体の可視判定で境界線の交差が多すぎます +@msg Revolve visibility has too many input anchors 回転体の可視判定に入力されるアンカーポイントが多すぎます +@msg Revolve visibility requires convex cap sectors 回転体の可視判定には凸状のキャップのセクターが必要です +@msg Revolve visibility requires finite projected faces 回転体の可視判定には有限の投影面が必要です +@msg SVG options: {e} SVG オプション: {e} +@msg Save for Web settings: {e} Web 用に保存の設定: {e} +@msg TIFF colour profile: {e} TIFF のカラープロファイル: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF のエンコードに失敗しました: ピクセルバッファーが画像サイズと一致しません +@msg TIFF encoding failed: {e} TIFF のエンコードに失敗しました: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa の色深度 {_1}: 16、24、32 ビット/ピクセルのいずれかにしてください +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa のエンコードに失敗しました: ピクセルバッファーが画像サイズと一致しません +@msg The 3D projection is not finite 3D の投影が有限ではありません +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D のシャドウが複雑すぎます。シャドウをオフにするか、アートを単純化してください +@msg The shape contains invalid coordinates シェイプに無効な座標が含まれています +@msg Too many Revolve faces for visibility evaluation 可視判定を行うには回転体の面が多すぎます +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft がスウォッチ交換ファイルから読み込めるカラーとグループは {ASE_MAX_ENTRIES} 個までですが、このライブラリには {entries} 個あります +@msg WebP encoding failed: {e} WebP のエンコードに失敗しました: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` には smallThumb、mediumThumb、largeThumb、smallList、largeList のいずれかを指定してください +@msg a line can't run from a point to itself ラインの始点と終点に同じポイントは指定できません +@msg a line needs at least two points ラインには少なくとも 2 つのポイントが必要です +@msg a number cannot be read 数値を読み取れません +@msg a swatch exchange block is too long スウォッチ交換ファイルのブロックが長すぎます +@msg a swatch exchange name is too long スウォッチ交換ファイルの名前が長すぎます +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels {sw} × {sh} の画像を {width} × {height} ピクセルにサイズ変更できません +@msg a {width} × {height} image is too large {width} × {height} の画像は大きすぎます +@msg a {width} × {height} image: {e} {width} × {height} の画像: {e} +@msg an image could not be written: {e} 画像を書き出せませんでした: {e} +@msg an image that couldn't be read was left out 読み込めなかった画像は除外されました +@msg can't open “{name}”: {e} 「{name}」を開けません: {e} +@msg cannot align zip entries to {align} bytes ZIP のエントリを {align} バイト境界に揃えられません +@msg cannot open the automation {kind} root `{_1}`: {e} 自動化の {kind} ルート `{_1}` を開けません: {e} +@msg cannot read profile: {0} プロファイルを読み込めません: {0} +@msg color book version {version} isn't supported (only 1) カラーブックのバージョン {version} には対応していません (対応しているのは 1 のみ) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) 色空間 {other} のカラーブックには対応していません (対応しているのは RGB、CMYK、Lab のみ) +@msg file name too long to zip: {_1} ファイル名が長すぎて ZIP に格納できません: {_1} +@msg file name too long to zip: {name} ファイル名が長すぎて ZIP に格納できません: {name} +@msg freeform line {i}: {e} フリーフォームのライン {i}: {e} +@msg freeform point {i}: {e} フリーフォームのポイント {i}: {e} +@msg give `{key}` or `{other}`, not both `{key}` と `{other}` のどちらか一方を指定してください (両方は指定できません) +@msg grayscale profiles can't be working spaces yet グレースケールのプロファイルはまだ作業用スペースにできません +@msg input contains NaN or infinite coordinates 入力に NaN または無限大の座標が含まれています +@msg input path could not be closed 入力パスを閉じられませんでした +@msg invalid ICC profile: {0} 無効な ICC プロファイル: {0} +@msg invalid scale {scale} 倍率 {scale} は無効です +@msg its localized names take more than {_1} KB ローカライズされた名前が {_1} KB を超えています +@msg its objects are nested too deep ({e}) オブジェクトの入れ子が深すぎます ({e}) +@msg its tag table lists the `{_1}` tag more than once タグテーブルに `{_1}` タグが複数回記載されています +@msg not a graphic style library: {e} グラフィックスタイルライブラリではありません: {e} +@msg not a swatch library (.vcswatches or .gpl) スウォッチライブラリではありません (.vcswatches または .gpl) +@msg not a swatch library (format `{_1}`) スウォッチライブラリではありません (形式: `{_1}`) +@msg not a swatch library: {e} スウォッチライブラリではありません: {e} +@msg not an action set file ({e}) アクションセットファイルではありません ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray プロファイルの色空間 {other} は RGB、CMYK、グレースケールのいずれでもありません +@msg regular expression too large 正規表現が大きすぎます +@msg script file is not UTF-8 text: {value} スクリプトファイルは UTF-8 テキストではありません: {value} +@msg stop {i}: {e} 分岐点 {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) スウォッチ交換ファイルのバージョン {major}.{minor} には対応していません (対応しているのは 1.x のみ) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors カラーブックのカラーが {ASE_MAX_ENTRIES} 色を超えています +@msg the color book is cut short カラーブックが途中で切れています +@msg the color book's names take more than {_1} MB カラーブックの名前が {_1} MB を超えています +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution 画像が {w} × {h} ピクセルになります。ラスター書き出しの上限は 1 辺 {MAX_RASTER_SIDE} ピクセル、{_1} メガピクセルです: 倍率または解像度を下げてください +@msg the optimised image can't be read back: {e} 最適化した画像を読み戻せません: {e} +@msg the pixel buffer doesn't match the image size ピクセルバッファーが画像サイズと一致しません +@msg the preview: {e} プレビュー: {e} +@msg the request may not read the New Document profiles folder このリクエストには新規ドキュメントプロファイルのフォルダーを読み込む権限がありません +@msg the shapes are too degenerate to combine シェイプの形状がつぶれすぎていて結合できません +@msg the shapes cross themselves and each other too often to combine シェイプ自身やシェイプ同士の交差が多すぎて結合できません +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups スウォッチ交換ファイルのカラーとグループが {ASE_MAX_ENTRIES} 個を超えています +@msg the swatch exchange file is cut short スウォッチ交換ファイルが途中で切れています +@msg the {_1} plate can't be read: {e} {_1} 版を読み込めません: {e} +@msg this binary DXF file is damaged or cut short このバイナリ DXF ファイルは壊れているか途中で切れています +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that DWG 図面は読み込めません: CAD アプリで DXF として保存し、そのファイルを開いてください +@msg too many classes 文字クラスが多すぎます +@msg too many groups グループが多すぎます +@msg too many layers for PSD (at most 32767) PSD にはレイヤーが多すぎます (最大 32767) +@msg too many swatch exchange blocks スウォッチ交換ファイルのブロックが多すぎます +@msg unknown colour profile: {0} 不明なカラープロファイル: {0} +@msg {_1} clashes with a built-in profile name {_1} は組み込みのプロファイル名と重複しています +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} ピクセルは GIF には大きすぎます (1 辺最大 65535 ピクセル): 解像度を下げてください +@msg {_1}: no usable transform to/from sRGB {_1}: sRGB との間で使用できる変換がありません +@msg {name} is not a CMYK profile {name} は CMYK プロファイルではありません +@msg {name} is not an RGB profile {name} は RGB プロファイルではありません +@msg {path}: could not be read {path}: 読み込めませんでした +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} ピクセルは JPEG には大きすぎます (1 辺最大 65535 ピクセル): 解像度を下げてください +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} ピクセルは Targa には大きすぎます (1 辺最大 65535 ピクセル): 解像度を下げてください +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} ピクセルは PSD には大きすぎます (1 辺最大 {MAX_SIDE} ピクセル): 解像度を下げてください + +# Messages other catalogs translate and Japanese did not: Banner Hems and Grommets, a parameter range and the recovery save. +@msg `{key}` must be from 0.01 to 1000 pt `{key}` は 0.01~1000 pt にしてください +@msg select the banner, or mark every artboard バナーを選択するか、すべてのアートボードにマークを付けてください +@msg the banner has no width or height バナーに幅または高さがありません +@msg the grommet inset is too large for the banner 端からハトメまでの距離がバナーに対して大きすぎます +@msg the hem is too deep for the banner 折り返しがバナーに対して深すぎます +@msg the spacing makes more than {MAX_GROMMETS} grommets この間隔ではハトメが {MAX_GROMMETS} 個を超えます +@msg there is no banner to mark マークを付けるバナーがありません +@msg turn on at least one side 少なくとも 1 つの辺をオンにしてください +@msg with no hem and no grommets there is nothing to mark 折り返しもハトメもないため、マークを付けるものがありません +@msg {saving} failed: {e} {saving} に失敗しました: {e} diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index 2cff51d94b..55f726dc38 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -166,6 +166,8 @@ Crop Image გამოსახულების ჩამოჭრა Image Tools გამოსახულების ხელსაწყოები Remove Background… ფონის მოშორება… + Draw (Pencil) ხატვა (ფანქარი) + Place Image გამოსახულების განთავსება Remove Background ფონის მოშორება Background ფონი Edge Color კიდის ფერი @@ -890,6 +892,7 @@ VectorCraft Title Bar on Every Desktop VectorCraft-ის სათაურის ზოლი ყველა სამუშაო მაგიდაზე The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. სანამ გარემოს ცვლადი VECTORCRAFT_TITLEBAR დაყენებულია, სათაურის ზოლს ის ირჩევს. System Title Bar takes precedence over this option while it is on. სანამ სისტემის სათაურის ზოლი ჩართულია, მას ამ პარამეტრზე უპირატესობა აქვს. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. სანამ VectorCraft-ის სათაურის ზოლი ყველა სამუშაო მაგიდაზე გამორთულია, ეს სამუშაო მაგიდა ფანჯრის სათაურის ზოლს ხატავს, ეს პარამეტრი ჩართულია თუ გამორთული. Exit გასვლა Distort დეფორმაცია Diffuse Glow… გაბნეული ნათება… @@ -1443,6 +1446,7 @@ lighting Light სინათლე Proportional Metrics პროპორციული მეტრიკა Insert Aki Left აკის ჩასმა მარცხნივ Insert Aki Right აკის ჩასმა მარჯვნივ + Tsume ცუმე Character Direction სიმბოლოების მიმართულება Digits ციფრები Arabic არაბული @@ -4185,6 +4189,7 @@ font-technology Variable ცვლადი @msg `select` must be true or false `select` უნდა იყოს true ან false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` და `maxAnchors` უნდა იყოს მთელი რიცხვები @msg `{key}` must be a number not below 0 `{key}` უნდა იყოს რიცხვი, არანაკლებ 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` უნდა იყოს ოთხი რიცხვი, თითოეული არანაკლებ 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` უნდა იყოს [x, y, width, height]: ოთხი სასრული რიცხვი, სიგანე და სიმაღლე არ უნდა იყოს უარყოფითი @msg `{min_key}` is greater than `{max_key}` `{min_key}` მეტია, ვიდრე `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` მიუთითეთ ერთი მაინც: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4420,6 +4425,7 @@ font-technology Variable ცვლადი @msg no action set to save შესანახი მოქმედებების ნაკრები არ არის @msg the action set file can't be read in full მოქმედებების ნაკრების ფაილის სრულად წაკითხვა შეუძლებელია @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out ჩაიტვირთა „{name}“; გამოტოვებული ნაბიჯები: {n} +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` ჩაიტვირთა „{name}“; შენახული ნაბიჯები უცნობი ბრძანებით: {n}; პირველი: „{action}“, ნაბიჯი {step}, `{command}` @msg not an action set file ეს არ არის მოქმედებების ნაკრების ფაილი @msg the action set file is larger than 8 MiB მოქმედებების ნაკრების ფაილი 8 MiB-ზე დიდია @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: ცნობარი {MAX_BYTES} ბაიტზე დიდი იქნებოდა @@ -4639,6 +4645,7 @@ font-technology Variable ცვლადი @msg tool shortcuts must be a single key (optionally with Shift) ხელსაწყოს მალსახმობი ერთი კლავიში უნდა იყოს (სურვილისამებრ Shift-ით) @msg truncated შეკვეცილია @msg unknown command `{0}` უცნობი ბრძანება `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` „{action}“, ნაბიჯი {step}: უცნობი ბრძანება `{command}` @msg unknown command `{0}`; did you mean `{1}`? უცნობი ბრძანება `{0}`; იქნებ `{1}` იგულისხმეთ? @msg unknown effect `{id}` უცნობი ეფექტი `{id}` @msg unknown format უცნობი ფორმატი @@ -6340,8 +6347,8 @@ axis Y Axis Y ღერძი @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` ექსპორტის პლაგინი აცხადებს 1-დან {MAX_EXTENSIONS}-მდე `extensions`-ს @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` ჯგუფების გარეთ მაქსიმუმ {MAX_UNGROUPED} პარამეტრია დასაშვები: დანარჩენებს მიეცით `group` @msg can't encode the input შეყვანის კოდირება ვერ ხერხდება -@msg expected {"dataBase64"} მოსალოდნელი იყო {"dataBase64"} -@msg expected {"objects"} მოსალოდნელი იყო {"objects"} +@msg expected {{"dataBase64": "…"}} მოსალოდნელი იყო {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} მოსალოდნელი იყო {{"objects": [...]}} @msg export `{name}`: {e} მოდულის ექსპორტი `{name}`: {e} @msg extension {e} is listed twice გაფართოება {e} ორჯერაა მითითებული @msg extension {e}: use 1-16 lower-case letters and digits, without the dot გაფართოება {e}: გამოიყენეთ 1-16 პატარა ასო და ციფრი, წერტილის გარეშე @@ -6405,11 +6412,11 @@ axis Y Axis Y ღერძი @msg a painted live effect returns only `objects` მხატვრული ცოცხალი ეფექტი აბრუნებს მხოლოდ `objects`-ს @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` მხატვრული ცოცხალი ეფექტის ნაწილს აქვს მხოლოდ `path`, `fillRule`, `fills` და `strokes` @msg a read-only object was left out გამოტოვებულია მხოლოდ წასაკითხი ობიექტი -@msg a read-only object was left out: return it, as {"id"} alone or as it was given გამოტოვებულია მხოლოდ წასაკითხი ობიექტი: დააბრუნეთ ის მხოლოდ {"id"}-ის სახით ან ისე, როგორც მიიღეთ +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given გამოტოვებულია მხოლოდ წასაკითხი ობიექტი: დააბრუნეთ ის მხოლოდ {{"id": …}}-ის სახით ან ისე, როგორც მიიღეთ @msg a string სტრიქონი @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` კონტურს აქვს მხოლოდ `paint`, `width`, `join`, `cap` და `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} კონტური უნდა იყოს {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} ეფექტი უნდა იყოს {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} კონტური უნდა იყოს {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} ეფექტი უნდა იყოს {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` შევსების ეფექტი აბრუნებს მხოლოდ `fills`-ს @msg an effect on a stroke returns only `strokes` კონტურის ეფექტი აბრუნებს მხოლოდ `strokes`-ს @msg an object must be a JSON object ობიექტი უნდა იყოს JSON ობიექტი @@ -6551,6 +6558,8 @@ axis Y Axis Y ღერძი Action Options… მოქმედების პარამეტრები… Action Options მოქმედების პარამეტრები Playback Options… შესრულების პარამეტრები… + Button Mode ღილაკების რეჟიმი + No actions. მოქმედებები არ არის. Insert Stop… გაჩერების ჩასმა… Insert Stop გაჩერების ჩასმა Record Stop გაჩერების ჩაწერა @@ -7353,7 +7362,7 @@ font-script Japanese იაპონური Japanese Envelope #3 იაპონური კონვერტი #3 Japanese Envelope #4 იაპონური კონვერტი #4 @msg image '{key}' has no pixels and was left out გამოსახულებას '{key}' პიქსელები არ აქვს და გამოტოვდა -@msg not an RTF file: it doesn't start with {\\rtf RTF ფაილი არ არის: არ იწყება {\\rtf-ით +@msg not an RTF file: it doesn't start with {{\\rtf RTF ფაილი არ არის: არ იწყება {{\\rtf-ით # Type Tools add-on (Object › Plug-ins › Type Tools). Type Tools ტექსტის ხელსაწყოები Text Tweaker… ტექსტის მორგება… @@ -7577,6 +7586,12 @@ font-script Japanese იაპონური @msg open the practice sample of `{id}` first (see learn.openSample) ჯერ გახსენით `{id}` გაკვეთილის სავარჯიშო ნიმუში (იხ. learn.openSample) @msg finish `{id}` first (see learn.finish) ჯერ დაასრულეთ `{id}` (იხ. learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` თავისი უნარის ბოლო გაკვეთილია + Reset progress პროგრესის ჩამოყრა + Mark Tutorial Step გაკვეთილის ნაბიჯის მონიშვნა + Reset Learn Progress სწავლის პროგრესის ჩამოყრა +@msg missing `step` (see learn.show) აკლია `step` (იხ. learn.show) +@msg `step` must be a step number from 0 to {last} `step` უნდა იყოს ნაბიჯის ნომერი 0-დან {last}-მდე +@msg `{id}` is finished (see learn.resetProgress) `{id}` დასრულებულია (იხ. learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects გადადებული ეფექტების განახლება diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 4715a413f4..abe2b4bc28 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -46,6 +46,7 @@ font-technology Variable 가변 Proportional Metrics 비례 메트릭 Insert Aki Left 앞 아키 삽입 Insert Aki Right 뒤 아키 삽입 + Tsume 츠메 Character Direction 문자 방향 Digits 숫자 Arabic 아라비아어 @@ -235,6 +236,8 @@ digits Malayalam 말라얄람어 Crop Image 이미지 자르기 Image Tools 이미지 도구 Remove Background… 배경 제거… + Draw (Pencil) 그리기(연필) + Place Image 이미지 가져오기 Remove Background 배경 제거 Background 배경 Edge Color 가장자리 색상 @@ -4639,6 +4642,7 @@ theme Appearance 외관 @msg objects can't be nested more than 32 deep 개체는 32단계보다 깊게 중첩할 수 없습니다 @msg the SVG's elements are nested more than {0} deep SVG 요소가 {0}단계보다 깊게 중첩되어 있습니다 @msg unknown command `{0}` 알 수 없는 명령 `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` “{action}”의 단계 {step}에서 알 수 없는 명령 `{command}`을(를) 실행합니다 @msg unknown command `{0}`; did you mean `{1}`? 알 수 없는 명령 `{0}`: `{1}`을(를) 의미하셨습니까? @msg `{what}` closes nothing `{what}`이(가) 닫는 항목이 없습니다 @msg `{what}` closes something it didn't open `{what}`이(가) 열지 않은 항목을 닫습니다 @@ -4938,6 +4942,7 @@ theme Appearance 외관 @msg `select` must be true or false `select`은(는) true 또는 false여야 합니다 @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors`와 `maxAnchors`는 정수여야 합니다 @msg `{key}` must be a number not below 0 `{key}`은(는) 0 이상의 숫자여야 합니다 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}`은(는) 0 이상의 숫자 네 개여야 합니다: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}`은(는) [x, y, width, height]여야 합니다: 유한한 숫자 네 개이며 너비와 높이는 음수가 아니어야 합니다 @msg `{min_key}` is greater than `{max_key}` `{min_key}`이(가) `{max_key}`보다 큽니다 @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` 다음 중 하나 이상을 지정하세요: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4987,6 +4992,7 @@ theme Appearance 외관 @msg no action set to save 저장할 액션 세트가 없습니다 @msg the action set file can't be read in full 액션 세트 파일을 전부 읽을 수 없습니다 @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out “{name}”을(를) 불러왔습니다. 단계 {n}개를 제외했습니다 +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` “{name}”을(를) 불러왔습니다. 알 수 없는 명령이 있는 단계 {n}개를 그대로 두었습니다. 첫 번째: “{action}”, 단계 {step}, `{command}` @msg not an action set file 액션 세트 파일이 아닙니다 @msg the action set file is larger than 8 MiB 액션 세트 파일이 8 MiB보다 큽니다 @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: 참조가 {MAX_BYTES}바이트보다 커집니다 @@ -5346,6 +5352,7 @@ effect Vertical 세로 VectorCraft Title Bar on Every Desktop 모든 데스크톱에서 VectorCraft 제목 표시줄 The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. 환경 변수 VECTORCRAFT_TITLEBAR가 설정되어 있는 동안에는 이 변수가 제목 표시줄을 정합니다. System Title Bar takes precedence over this option while it is on. 시스템 제목 표시줄이 켜져 있는 동안에는 그 설정이 이 옵션보다 우선합니다. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. 모든 데스크톱에서 VectorCraft 제목 표시줄이 꺼져 있는 동안에는 이 옵션을 켜든 끄든 이 데스크톱이 창의 제목 표시줄을 그립니다. Value Axis 값 축 On Left Side 왼쪽 On Right Side 오른쪽 @@ -5976,8 +5983,8 @@ axis Y Axis Y축 @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` 내보내기 플러그인은 `extensions`를 1~{MAX_EXTENSIONS}개 선언합니다 @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` 그룹 밖의 매개변수는 최대 {MAX_UNGROUPED}개입니다. 나머지에는 `group`을 지정하세요 @msg can't encode the input 입력을 인코딩할 수 없습니다 -@msg expected {"dataBase64"} {"dataBase64"} 형식이어야 합니다 -@msg expected {"objects"} {"objects"} 형식이어야 합니다 +@msg expected {{"dataBase64": "…"}} {{"dataBase64": "…"}} 형식이어야 합니다 +@msg expected {{"objects": [...]}} {{"objects": [...]}} 형식이어야 합니다 @msg export `{name}`: {e} 모듈 내보내기 `{name}`: {e} @msg extension {e} is listed twice 확장자 {e}이(가) 두 번 나열되었습니다 @msg extension {e}: use 1-16 lower-case letters and digits, without the dot 확장자 {e}: 점 없이 소문자와 숫자 1-16자를 사용하세요 @@ -6041,11 +6048,11 @@ axis Y Axis Y축 @msg a painted live effect returns only `objects` 페인트형 라이브 효과는 `objects`만 반환합니다 @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` 페인트형 라이브 효과의 조각에는 `path`, `fillRule`, `fills`, `strokes`만 있습니다 @msg a read-only object was left out 읽기 전용 개체가 빠졌습니다 -@msg a read-only object was left out: return it, as {"id"} alone or as it was given 읽기 전용 개체가 빠졌습니다: {"id"}만 있는 형태나 받은 그대로 반환하십시오 +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given 읽기 전용 개체가 빠졌습니다: {{"id": …}}만 있는 형태나 받은 그대로 반환하십시오 @msg a string 문자열 @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` 선에는 `paint`, `width`, `join`, `cap`, `miterLimit`만 있습니다 -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 선은 {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 형태여야 합니다 -@msg an effect must be {"id", "params"?, "visible"?} 효과는 {"id", "params"?, "visible"?} 형태여야 합니다 +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 선은 {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 형태여야 합니다 +@msg an effect must be {{"id", "params"?, "visible"?}} 효과는 {{"id", "params"?, "visible"?}} 형태여야 합니다 @msg an effect on a fill returns only `fills` 칠에 적용된 효과는 `fills`만 반환합니다 @msg an effect on a stroke returns only `strokes` 선에 적용된 효과는 `strokes`만 반환합니다 @msg an object must be a JSON object 개체는 JSON 개체여야 합니다 @@ -6187,6 +6194,8 @@ axis Y Axis Y축 Action Options… 액션 옵션… Action Options 액션 옵션 Playback Options… 재생 옵션… + Button Mode 버튼 모드 + No actions. 동작이 없습니다. Insert Stop… 중지 삽입… Insert Stop 중지 삽입 Record Stop 중지 기록 @@ -7054,6 +7063,12 @@ breakText Glyphs 글리프 @msg open the practice sample of `{id}` first (see learn.openSample) 먼저 `{id}`의 연습용 샘플을 여세요(learn.openSample 참조) @msg finish `{id}` first (see learn.finish) 먼저 `{id}`을(를) 완료하세요(learn.finish 참조) @msg `{id}` is the last tutorial in its skill `{id}`은(는) 해당 기술의 마지막 튜토리얼입니다 + Reset progress 진행률 재설정 + Mark Tutorial Step 튜토리얼 단계 표시 + Reset Learn Progress 학습 진행률 재설정 +@msg missing `step` (see learn.show) `step`이 없습니다(learn.show 참조) +@msg `step` must be a step number from 0 to {last} `step`은 0에서 {last} 사이의 단계 번호여야 합니다 +@msg `{id}` is finished (see learn.resetProgress) `{id}`은(는) 완료되었습니다(learn.resetProgress 참조) # Deferred plug-in effects Refresh Deferred Effects 보류된 효과 새로 고침 @@ -7083,3 +7098,1936 @@ breakText Glyphs 글리프 Grommets 아일렛 Grommet Inset 가장자리에서 아일렛까지 거리 Diameter 지름 + +# Messages of the 3D effects, image export, color profiles, swatch exchange files, color books, DXF import, +# path operations, libraries, scripts and zip files. +@msg 3D effects require finite coordinates within 100 million points 3D 효과에는 1억 포인트 이내의 유한한 좌표가 필요합니다 +@msg 3D effects require one to ten lights 3D 효과에는 광원이 1개에서 10개까지 필요합니다 +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP 비트 심도 {_1}: 픽셀당 1, 4, 8, 16, 24 또는 32비트여야 합니다 +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP 인코딩 실패: {width} × {height}픽셀이 형식이나 픽셀 버퍼에 맞지 않습니다 +@msg GIF encoding failed: the palette image is malformed GIF 인코딩 실패: 팔레트 이미지의 형식이 잘못되었습니다 +@msg GIF encoding failed: {e} GIF 인코딩 실패: {e} +@msg JPEG colour profile: {e} JPEG 색상 프로파일: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG 인코딩 실패: 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg JPEG encoding failed: {e} JPEG 인코딩 실패: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG 인코딩 실패: 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg PNG encoding failed: the palette image is malformed PNG 인코딩 실패: 팔레트 이미지의 형식이 잘못되었습니다 +@msg PNG encoding failed: {e} PNG 인코딩 실패: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG 인코딩 실패: {width} × {height}픽셀은 올바른 이미지 크기가 아닙니다 +@msg PSD colour profile: {e} PSD 색상 프로파일: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD 인코딩 실패: 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg Revolve profile contains invalid coordinates 회전체 프로파일에 잘못된 좌표가 있습니다 +@msg Revolve profile is too complex 회전체 프로파일이 너무 복잡합니다 +@msg Revolve projection is not finite 회전체 투영이 유한하지 않습니다 +@msg Revolve requires finite profile coordinates within 100 million points 회전체에는 1억 포인트 이내의 유한한 프로파일 좌표가 필요합니다 +@msg Revolve surface is too complex; reduce Segments or simplify the profile 회전체 표면이 너무 복잡합니다. 세그먼트를 줄이거나 프로파일을 단순화하십시오 +@msg Revolve surface is too complex; simplify the profile 회전체 표면이 너무 복잡합니다. 프로파일을 단순화하십시오 +@msg Revolve visibility cannot split the projected boundary 회전체 가시성 계산에서 투영된 경계를 분할할 수 없습니다 +@msg Revolve visibility creates too many fragments 회전체 가시성 계산에서 조각이 너무 많이 생깁니다 +@msg Revolve visibility creates too many vector anchors 회전체 가시성 계산에서 벡터 고정점이 너무 많이 생깁니다 +@msg Revolve visibility exceeds its geometry work limit 회전체 가시성 계산이 기하 연산 한도를 넘습니다 +@msg Revolve visibility exceeds its spatial index limit 회전체 가시성 계산이 공간 인덱스 한도를 넘습니다 +@msg Revolve visibility has too many boundary crossings 회전체 가시성 계산에 경계 교차가 너무 많습니다 +@msg Revolve visibility has too many input anchors 회전체 가시성 계산의 입력 고정점이 너무 많습니다 +@msg Revolve visibility requires convex cap sectors 회전체 가시성 계산에는 볼록한 캡 부채꼴이 필요합니다 +@msg Revolve visibility requires finite projected faces 회전체 가시성 계산에는 유한한 투영 면이 필요합니다 +@msg SVG options: {e} SVG 옵션: {e} +@msg Save for Web settings: {e} 웹용 저장 설정: {e} +@msg TIFF colour profile: {e} TIFF 색상 프로파일: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF 인코딩 실패: 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg TIFF encoding failed: {e} TIFF 인코딩 실패: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa 비트 심도 {_1}: 픽셀당 16, 24 또는 32비트여야 합니다 +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa 인코딩 실패: 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg The 3D projection is not finite 3D 투영이 유한하지 않습니다 +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D 그림자가 너무 복잡합니다. 그림자를 끄거나 아트를 단순화하십시오 +@msg The shape contains invalid coordinates 모양에 잘못된 좌표가 있습니다 +@msg Too many Revolve faces for visibility evaluation 회전체의 면이 너무 많아 가시성을 계산할 수 없습니다 +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft는 견본 교환 파일에서 색상과 그룹을 최대 {ASE_MAX_ENTRIES}개까지 읽는데, 이 라이브러리에는 {entries}개가 있습니다 +@msg WebP encoding failed: {e} WebP 인코딩 실패: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `index` must be a whole number `index`은(는) 정수여야 합니다 +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view`는 smallThumb, mediumThumb, largeThumb, smallList 또는 largeList여야 합니다 +@msg a line can't run from a point to itself 선은 한 점에서 같은 점으로 이어질 수 없습니다 +@msg a line needs at least two points 선에는 점이 두 개 이상 필요합니다 +@msg a number cannot be read 숫자를 읽을 수 없습니다 +@msg a swatch exchange block is too long 견본 교환 블록이 너무 깁니다 +@msg a swatch exchange name is too long 견본 교환 이름이 너무 깁니다 +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels {sw} × {sh} 이미지를 {width} × {height}픽셀로 크기 조정할 수 없습니다 +@msg a {width} × {height} image is too large {width} × {height} 이미지가 너무 큽니다 +@msg a {width} × {height} image: {e} {width} × {height} 이미지: {e} +@msg an image could not be written: {e} 이미지를 기록할 수 없습니다: {e} +@msg an image that couldn't be read was left out 읽을 수 없는 이미지를 제외했습니다 +@msg can't open “{name}”: {e} “{name}”을(를) 열 수 없습니다: {e} +@msg cannot align zip entries to {align} bytes zip 항목을 {align}바이트 단위로 정렬할 수 없습니다 +@msg cannot open the automation {kind} root `{_1}`: {e} 자동화 {kind} 루트 `{_1}`을(를) 열 수 없습니다: {e} +@msg cannot read profile: {0} 프로파일을 읽을 수 없습니다: {0} +@msg color book version {version} isn't supported (only 1) 색상 견본집 버전 {version}은(는) 지원되지 않습니다(1만 지원) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) 색상 공간이 {other}인 색상 견본집은 지원되지 않습니다(RGB, CMYK, Lab만 지원) +@msg file name too long to zip: {_1} 파일 이름이 너무 길어 zip에 넣을 수 없습니다: {_1} +@msg file name too long to zip: {name} 파일 이름이 너무 길어 zip에 넣을 수 없습니다: {name} +@msg freeform line {i}: {e} 자유형 선 {i}: {e} +@msg freeform point {i}: {e} 자유형 점 {i}: {e} +@msg give `{key}` or `{other}`, not both `{key}`와 `{other}` 중 하나만 지정하세요 +@msg grayscale profiles can't be working spaces yet 그레이스케일 프로파일은 아직 작업 공간으로 사용할 수 없습니다 +@msg input contains NaN or infinite coordinates 입력에 NaN 또는 무한대 좌표가 있습니다 +@msg input path could not be closed 입력 패스를 닫을 수 없습니다 +@msg invalid ICC profile: {0} 잘못된 ICC 프로파일: {0} +@msg invalid scale {scale} 잘못된 비율 {scale} +@msg its localized names take more than {_1} KB 지역화된 이름이 {_1} KB를 넘습니다 +@msg its objects are nested too deep ({e}) 개체가 너무 깊이 중첩되어 있습니다({e}) +@msg its tag table lists the `{_1}` tag more than once 태그 표에 `{_1}` 태그가 두 번 이상 나열되어 있습니다 +@msg not a graphic style library: {e} 그래픽 스타일 라이브러리가 아닙니다: {e} +@msg not a swatch library (.vcswatches or .gpl) 견본 라이브러리가 아닙니다(.vcswatches 또는 .gpl) +@msg not a swatch library (format `{_1}`) 견본 라이브러리가 아닙니다(형식 `{_1}`) +@msg not a swatch library: {e} 견본 라이브러리가 아닙니다: {e} +@msg not an action set file ({e}) 액션 세트 파일이 아닙니다({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray 프로파일의 색상 공간 {other}은(는) RGB, CMYK 또는 Gray가 아닙니다 +@msg regular expression too large 정규식이 너무 큽니다 +@msg script file is not UTF-8 text: {value} 스크립트 파일이 UTF-8 텍스트가 아닙니다: {value} +@msg stop {i}: {e} 정지점 {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) 견본 교환 버전 {major}.{minor}은(는) 지원되지 않습니다(1.x만 지원) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors 색상 견본집의 색상이 {ASE_MAX_ENTRIES}개를 넘습니다 +@msg the color book is cut short 색상 견본집이 중간에 잘려 있습니다 +@msg the color book's names take more than {_1} MB 색상 견본집의 이름이 {_1} MB를 넘습니다 +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution 이미지가 {w} × {h}픽셀이 됩니다. 래스터 내보내기는 한 변에 {MAX_RASTER_SIDE}픽셀, {_1}메가픽셀로 제한됩니다. 비율이나 해상도를 낮추세요 +@msg the optimised image can't be read back: {e} 최적화된 이미지를 다시 읽을 수 없습니다: {e} +@msg the pixel buffer doesn't match the image size 픽셀 버퍼가 이미지 크기와 맞지 않습니다 +@msg the preview: {e} 미리 보기: {e} +@msg the request may not read the New Document profiles folder 이 요청은 새 문서 프로파일 폴더를 읽을 수 없습니다 +@msg the shapes are too degenerate to combine 모양이 너무 퇴화되어 결합할 수 없습니다 +@msg the shapes cross themselves and each other too often to combine 모양이 자기 자신 및 서로와 너무 자주 교차하여 결합할 수 없습니다 +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups 견본 교환 파일의 색상과 그룹이 {ASE_MAX_ENTRIES}개를 넘습니다 +@msg the swatch exchange file is cut short 견본 교환 파일이 중간에 잘려 있습니다 +@msg the {_1} plate can't be read: {e} {_1} 분판을 읽을 수 없습니다: {e} +@msg this binary DXF file is damaged or cut short 이 바이너리 DXF 파일이 손상되었거나 중간에 잘려 있습니다 +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that DWG 도면은 읽을 수 없습니다. CAD 앱에서 DXF로 저장한 후 여세요 +@msg too many classes 문자 클래스가 너무 많습니다 +@msg too many groups 그룹이 너무 많습니다 +@msg too many layers for PSD (at most 32767) PSD에 비해 레이어가 너무 많습니다(최대 32767개) +@msg too many swatch exchange blocks 견본 교환 블록이 너무 많습니다 +@msg unknown colour profile: {0} 알 수 없는 색상 프로파일: {0} +@msg {_1} clashes with a built-in profile name {_1}이(가) 기본 제공 프로파일 이름과 겹칩니다 +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2}픽셀은 GIF에 비해 너무 큽니다(한 변 최대 65535픽셀). 해상도를 낮추세요 +@msg {_1}: no usable transform to/from sRGB {_1}: sRGB와 주고받을 수 있는 변환이 없습니다 +@msg {name} is not a CMYK profile {name}은(는) CMYK 프로파일이 아닙니다 +@msg {name} is not an RGB profile {name}은(는) RGB 프로파일이 아닙니다 +@msg {path}: could not be read {path}: 읽을 수 없습니다 +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height}픽셀은 JPEG에 비해 너무 큽니다(한 변 최대 65535픽셀). 해상도를 낮추세요 +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height}픽셀은 Targa에 비해 너무 큽니다(한 변 최대 65535픽셀). 해상도를 낮추세요 +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h}픽셀은 PSD에 비해 너무 큽니다(한 변 최대 {MAX_SIDE}픽셀). 해상도를 낮추세요 + +# Status and error messages of commands, scripts, file import and export, and plug-ins. +@msg 'caller', 'callee' and 'arguments' cannot be used on strict mode functions 엄격 모드 함수에서는 'caller', 'callee', 'arguments'를 사용할 수 없습니다 +@msg A profile supports one Revolve effect. Edit the existing effect's options instead. 프로파일 하나에는 회전체 효과를 하나만 쓸 수 있습니다. 기존 효과의 옵션을 편집하세요. +@msg Add Points at Crossings: a path went missing 교차점에 점 추가: 패스가 사라졌습니다 +@msg Alignment must be one of the choices 정렬은 선택 항목 중 하나여야 합니다 +@msg Boolean.prototype.{name} was called on a value that is not a Boolean Boolean이 아닌 값에서 Boolean.prototype.{name}을(를) 호출했습니다 +@msg CMYK images whose samples couldn't be read in CMYK were imported in RGB 샘플을 CMYK로 읽을 수 없는 CMYK 이미지는 RGB로 가져왔습니다 +@msg CSS options: {e} CSS 옵션: {e} +@msg CSV has a header but no data rows CSV에 머리글은 있지만 데이터 행이 없습니다 +@msg CSV holds NUL bytes: save it as UTF-8, or as UTF-16 with a byte-order mark CSV에 NUL 바이트가 있습니다: UTF-8로 저장하거나 바이트 순서 표시가 있는 UTF-16으로 저장하세요 +@msg CSV is empty CSV가 비어 있습니다 +@msg CSV is larger than {MAX_CSV_BYTES} bytes CSV가 {MAX_CSV_BYTES}바이트보다 큽니다 +@msg CSV is not UTF-16 CSV가 UTF-16이 아닙니다 +@msg CSV is not UTF-8 CSV가 UTF-8이 아닙니다 +@msg CSV would be larger than {MAX_CSV_BYTES} bytes CSV가 {MAX_CSV_BYTES}바이트보다 커집니다 +@msg Cannot write to the location of “{name}”; choose where to save it “{name}”의 위치에 쓸 수 없습니다. 저장할 위치를 선택하세요 +@msg Choose original artwork, not a dimension's generated paths 치수가 만든 패스가 아닌 원본 아트웍을 선택하세요 +@msg Contour: select paths or shapes 윤곽: 패스나 모양을 선택하세요 +@msg Contour: the Offset Path effect is not available 윤곽: 패스 간격 띄우기 효과를 사용할 수 없습니다 +@msg Create needs fills, strokes or both 만들려면 칠이나 선, 또는 둘 다 필요합니다 +@msg DCS files can only be placed linked: use File › Place with Link on DCS 파일은 연결된 상태로만 가져올 수 있습니다: 링크를 켜고 파일 › 가져오기를 사용하세요 +@msg DXF options: {e} DXF 옵션: {e} +@msg DXF scale must be a positive number up to {_1}, not {scale} DXF 비율은 {_1} 이하의 양수여야 합니다: {scale} +@msg DXF {field} `{s}`: {allowed} DXF {field} `{s}`: {allowed}이어야 합니다 +@msg Date.prototype method called on a value that is not a Date object Date 개체가 아닌 값에서 Date.prototype 메서드를 호출했습니다 +@msg Dimension is locked or hidden 치수가 잠겨 있거나 숨겨져 있습니다 +@msg Dimension mode does not match its source 치수 모드가 원본과 맞지 않습니다 +@msg Draw Inside needs exactly one selected path, compound path or text 안쪽에 그리기에는 선택한 패스, 컴파운드 패스 또는 텍스트가 정확히 하나 필요합니다 +@msg EPS Save writes all artwork: use document.export for selected-only EPS EPS 저장은 모든 아트웍을 기록합니다: 선택 항목만 EPS로 기록하려면 document.export를 사용하세요 +@msg EPS flattener: {e} EPS 병합: {e} +@msg EPS options: {e} EPS 옵션: {e} +@msg EPS {field} `{s}`: {allowed} EPS {field} `{s}`: {allowed}이어야 합니다 +@msg Error.prototype.toString was called on a value that is not an object 개체가 아닌 값에서 Error.prototype.toString을 호출했습니다 +@msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft 화면용 내보내기는 png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai 또는 vectorcraft로 기록합니다 +@msg Flare click coordinates must be finite numbers 플레어 클릭 좌표는 유한한 숫자여야 합니다 +@msg Function.prototype.toString was called on a value that is not a function 함수가 아닌 값에서 Function.prototype.toString을 호출했습니다 +@msg HTML Text applies to object slices of type only HTML 텍스트는 문자의 개체 슬라이스에만 적용됩니다 +@msg Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces) 개체 식별 기준이 XML ID입니다: 이름은 올바른 XML ID여야 합니다(글자, 밑줄 또는 콜론으로 시작하고 공백이 없어야 함) +@msg Image Trace failed: internal error: its thread stopped (please report this bug) 이미지 추적 실패: 내부 오류: 스레드가 멈췄습니다(이 버그를 보고해 주세요) +@msg Image Trace failed: {e} 이미지 추적 실패: {e} +@msg Image Trace finished, but its document was closed 이미지 추적이 끝났지만 문서가 닫혔습니다 +@msg Image Trace finished, but the image or its settings changed meanwhile: trace it again 이미지 추적이 끝났지만 그 사이에 이미지나 설정이 바뀌었습니다: 다시 추적하세요 +@msg Import SVG Filter reads SVG files, not SVGZ SVG 필터 가져오기는 SVGZ가 아닌 SVG 파일을 읽습니다 +@msg Invalid dimension offset 잘못된 치수 오프셋 +@msg Invalid point 잘못된 점 +@msg JSON.parse: {why} (at offset {at}) JSON.parse: {why}(오프셋 {at}) +@msg JSON.stringify cannot write a structure that contains itself JSON.stringify는 자신을 포함하는 구조를 기록할 수 없습니다 +@msg Join: a subpath went missing 연결: 하위 패스가 사라졌습니다 +@msg Line Gap must be a number 행 간격은 숫자여야 합니다 +@msg Lock Workspace is not available in VectorCraft VectorCraft에서는 작업 영역 잠그기를 사용할 수 없습니다 +@msg Move Panel to New Window is not available: floating panels stay in the main window 패널을 새 창으로 이동은 사용할 수 없습니다: 떠 있는 패널은 기본 창 안에 있습니다 +@msg Namespace.prototype.toString needs a Namespace Namespace.prototype.toString에는 Namespace가 필요합니다 +@msg New Document profiles need the preferences folder, which this run doesn't have 새 문서 프로파일에는 환경 설정 폴더가 필요한데, 이번 실행에는 그 폴더가 없습니다 +@msg Number.prototype.{name} was called on a value that is not a number 숫자가 아닌 값에서 Number.prototype.{name}을(를) 호출했습니다 +@msg Object.create's prototype must be an object or null Object.create의 프로토타입은 개체 또는 null이어야 합니다 +@msg Object.{function} was given a value that is not an object Object.{function}에 개체가 아닌 값을 전달했습니다 +@msg Offset Path: the path is too complex to offset 패스 간격 띄우기: 패스가 너무 복잡해서 간격을 띄울 수 없습니다 +@msg Offset Path: {e} 패스 간격 띄우기: {e} +@msg PDF content is incomplete or exceeds the reader's limits; no document was imported PDF 내용이 불완전하거나 읽기 한도를 넘습니다. 문서를 가져오지 않았습니다 +@msg PDF flattener: {e} PDF 병합: {e} +@msg PDF options: {e} PDF 옵션: {e} +@msg QName.prototype.toString needs a QName QName.prototype.toString에는 QName이 필요합니다 +@msg Recolor Artwork is no longer open 아트웍 색상 재지정이 더 이상 열려 있지 않습니다 +@msg RegExp.prototype.{name} was called on a value that is not a RegExp object RegExp 개체가 아닌 값에서 RegExp.prototype.{name}을(를) 호출했습니다 +@msg SVG is not UTF-8, UTF-16 or ISO 8859-1 SVG가 UTF-8, UTF-16 또는 ISO 8859-1이 아닙니다 +@msg Save writes one artboard: name one, or export several with document.export 저장은 아트보드 하나를 기록합니다: 하나를 지정하거나 document.export로 여러 개를 내보내세요 +@msg Select a dimension first 먼저 치수를 선택하세요 +@msg Select dimensions to update 업데이트할 치수를 선택하세요 +@msg Select only dimensions 치수만 선택하세요 +@msg Select two or more objects, or a group 개체를 두 개 이상 선택하거나 그룹을 선택하세요 +@msg Shaper needs 1–64 source paths 셰이퍼에는 원본 패스가 1–64개 필요합니다 +@msg Stencil Bridges: the selected art is too large or too detailed to bridge 스텐실 브리지: 선택한 아트웍이 너무 크거나 세밀해서 브리지를 만들 수 없습니다 +@msg String.prototype.toString was called on a value that is not a string 문자열이 아닌 값에서 String.prototype.toString을 호출했습니다 +@msg Switch x/y is for scatter graphs x/y 전환은 분산형 그래프에 사용합니다 +@msg Text options: {e} 텍스트 옵션: {e} +@msg The {name} profile could not be read, so the new document has the default settings: {reason} {name} 프로파일을 읽을 수 없어 새 문서에 기본 설정을 사용했습니다: {reason} +@msg Trap: more than {_1} pairs of objects lie close enough to trap, or too many objects share a horizontal range; trap fewer objects at a time 트랩: 트랩할 만큼 가까운 개체 쌍이 {_1}개보다 많거나, 같은 가로 범위에 있는 개체가 너무 많습니다. 한 번에 더 적은 개체를 트랩하세요 +@msg Weed Box and Lines: no weeding line fits outside the art, and the weed box is off 위딩 상자 및 선: 아트웍 바깥에 들어갈 위딩 선이 없고 위딩 상자가 꺼져 있습니다 +@msg \ at end of pattern 패턴 끝에 \이(가) 있습니다 +@msg `alignOn` cannot be empty `alignOn`은(는) 비워 둘 수 없습니다 +@msg `alignOn` must be a string `alignOn`은(는) 문자열이어야 합니다 +@msg `align` is start, center or end `align`은(는) start, center 또는 end입니다 +@msg `align` must be a string `align`은(는) 문자열이어야 합니다 +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors`은(는) [subpath, anchor] 쌍의 배열이어야 합니다 +@msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors`에는 앵커 인덱스(0, 1, 2…)를 나열해야 합니다: {k} +@msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors`에는 앵커 인덱스(0, 1, 2…)를 나열해야 합니다: {v} +@msg `answer` for this {kind} dialog must be one of: {_1} 이 {kind} 대화 상자의 `answer`은(는) 다음 중 하나여야 합니다: {_1} +@msg `answers` has more than {MAX_ANSWERS} answers `answers`에 응답이 {MAX_ANSWERS}개보다 많습니다 +@msg `answers` is larger than 1 MiB `answers`이(가) 1 MiB보다 큽니다 +@msg `answers` must be a list of answers `answers`은(는) 응답 목록이어야 합니다 +@msg `artboard` must be the index of an artboard of the document `artboard`은(는) 문서에 있는 아트보드의 인덱스여야 합니다 +@msg `artboardsAt` must be [x, y] `artboardsAt`은(는) [x, y]여야 합니다 +@msg `artboards` must be a list of artboard indices `artboards`은(는) 아트보드 인덱스 목록이어야 합니다 +@msg `artboards` names an artboard the document does not have `artboards`에 문서에 없는 아트보드가 있습니다 +@msg `artboards` names an artboard twice `artboards`에 같은 아트보드가 두 번 있습니다 +@msg `asset` is the asset id (see assets.list) `asset`은(는) 에셋 id입니다(assets.list 참조) +@msg `at` must be [x, y] (got {at}) `at`은(는) [x, y]여야 합니다({at} 입력됨) +@msg `at` must be a byte offset `at`은(는) 바이트 오프셋이어야 합니다 +@msg `at` must be a point [x, y] `at`은(는) 점 [x, y]여야 합니다 +@msg `autoLeading` must be a number `autoLeading`은(는) 숫자여야 합니다 +@msg `background` must be "", "matte" or #rrggbb `background`은(는) "", "matte" 또는 #rrggbb여야 합니다 +@msg `beside` needs `side` `beside`에는 `side`가 필요합니다 +@msg `burasagari` must be "none", "standard" or "forced" `burasagari`은(는) "none", "standard" 또는 "forced"여야 합니다 +@msg `center` must be [x, y] `center`은(는) [x, y]여야 합니다 +@msg `charAlign` must be "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" or "icfBottom" `charAlign`은(는) "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" 또는 "icfBottom"이어야 합니다 +@msg `charDirection` must be "default", "leftToRight" or "rightToLeft" `charDirection`은(는) "default", "leftToRight" 또는 "rightToLeft"여야 합니다 +@msg `clearStroke` requires `stroke: false`, `ids: []` and no `stop` `clearStroke`에는 `stroke: false`와 `ids: []`가 필요하며 `stop`은 쓸 수 없습니다 +@msg `clear` must be a list of type object ids, not {v} `clear`은(는) 문자 개체 id 목록이어야 합니다: {v} +@msg `clear` must list type objects; {_1} is not one `clear`에는 문자 개체를 나열해야 합니다. {_1}은(는) 문자 개체가 아닙니다 +@msg `clear` must not list `id` `clear`에 `id`를 넣을 수 없습니다 +@msg `code` must be a whole number `code`은(는) 정수여야 합니다 +@msg `colorMode` must be one of rgb, cmyk `colorMode`은(는) rgb, cmyk 중 하나여야 합니다 +@msg `color` needs a `rule` to make the theme from `color`에는 테마를 만들 `rule`이 필요합니다 +@msg `colors` does not apply to the {name} reduction `colors`은(는) {name} 감소에는 적용되지 않습니다 +@msg `colors` is empty `colors`이(가) 비어 있습니다 +@msg `colors` must be a whole number from 2 to 256 `colors`은(는) 2에서 256 사이의 정수여야 합니다 +@msg `colors` must be at least 9 for the uniform reduction uniform 감소에서는 `colors`이(가) 9 이상이어야 합니다 +@msg `colors` must be between 1 and {MAX_THEME_COLORS} (got {n}) `colors`은(는) 1에서 {MAX_THEME_COLORS} 사이여야 합니다({n} 입력됨) +@msg `columnType` is vertical, uniform, repeating or sliding `columnType`은(는) vertical, uniform, repeating 또는 sliding입니다 +@msg `columns` must be a whole number 1..50 `columns`은(는) 1..50의 정수여야 합니다 +@msg `commands` must not be empty `commands`은(는) 비어 있으면 안 됩니다 +@msg `contents` goes with `to` `contents`은(는) `to`와 함께 씁니다 +@msg `corners` must be sharp, round or square, not `{other}` `corners`은(는) sharp, round 또는 square여야 합니다: `{other}` +@msg `corners` must list anchor indices (0, 1, 2…), not {v} `corners`에는 앵커 인덱스(0, 1, 2…)를 나열해야 합니다: {v} +@msg `count` must be a whole number from 0 to {MAX_COUNT} `count`은(는) 0에서 {MAX_COUNT} 사이의 정수여야 합니다 +@msg `count` must be a whole number from 1 to 100 `count`은(는) 1에서 100 사이의 정수여야 합니다 +@msg `dataBase64` is larger than the module limit `dataBase64`이(가) 모듈 한도보다 큽니다 +@msg `dataBase64` is not valid base64 `dataBase64`이(가) 올바른 base64가 아닙니다 +@msg `defaultsOnly` cannot be combined with `ids`, `reverse` or `append` `defaultsOnly`은(는) `ids`, `reverse` 또는 `append`와 함께 쓸 수 없습니다 +@msg `depth` and `childLimit` slice the summary: pass `summary: true` `depth`와 `childLimit`은 요약을 잘라 냅니다: `summary: true`를 전달하세요 +@msg `design` is a design name, or null for plain columns `design`은(는) 디자인 이름이며, 일반 막대에는 null입니다 +@msg `design` is a design name, or null for the default marker `design`은(는) 디자인 이름이며, 기본 마커에는 null입니다 +@msg `destinationFolder` is required when destination is `folder` destination이 `folder`이면 `destinationFolder`가 필요합니다 +@msg `destination` must be `none`, `saveAndClose` or `folder` `destination`은(는) `none`, `saveAndClose` 또는 `folder`여야 합니다 +@msg `diameter` must be from 0.1 to 2500 pt `diameter`은(는) 0.1에서 2500 pt 사이여야 합니다 +@msg `digits` must be one of {_1} `digits`은(는) {_1} 중 하나여야 합니다 +@msg `dimImages` is a percentage or false `dimImages`은(는) 백분율 또는 false입니다 +@msg `direction` must be "auto", "leftToRight" or "rightToLeft" `direction`은(는) "auto", "leftToRight" 또는 "rightToLeft"여야 합니다 +@msg `ditherAmount` must be a number from 0 to 100 `ditherAmount`은(는) 0에서 100 사이의 숫자여야 합니다 +@msg `each` is the value one design stands for, more than 0 `each`은(는) 디자인 하나가 나타내는 값이며 0보다 커야 합니다 +@msg `end` must be "start" or "end" `end`은(는) "start" 또는 "end"여야 합니다 +@msg `ends` applies to joining exactly two paths `ends`은(는) 정확히 두 패스를 연결할 때 적용됩니다 +@msg `event` must be one of {_1} `event`은(는) {_1} 중 하나여야 합니다 +@msg `every` must be "all", "odd" or "even", not {v} `every`은(는) "all", "odd" 또는 "even"이어야 합니다: {v} +@msg `expand` must be true or false `expand`은(는) true 또는 false여야 합니다 +@msg `fidelity` must be from {lo} to {hi} pt `fidelity`은(는) {lo}에서 {hi} pt 사이여야 합니다 +@msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files`은(는) 마지막 text.findFontFiles 검색에서 찾은 글꼴 파일의 경로 1개에서 1000개여야 합니다 +@msg `focal` and `radius` cannot be used together `focal`과 `radius`는 함께 쓸 수 없습니다 +@msg `focal` must be an array of [subpath, anchor] pairs `focal`은(는) [subpath, anchor] 쌍의 배열이어야 합니다 +@msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal`의 [{si}, {ai}]은(는) 패스의 앵커가 아닙니다 +@msg `folder` must be an absolute folder path `folder`은(는) 폴더의 절대 경로여야 합니다 +@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes`은(는) {"wght"}처럼 축 태그와 값으로 이루어진 개체여야 합니다 +@msg `format` must be a string `format`은(는) 문자열이어야 합니다 +@msg `format` must be one of {_1} `format`은(는) {_1} 중 하나여야 합니다 +@msg `fractions` is chop or scale `fractions`은(는) chop 또는 scale입니다 +@msg `from` and `to` must differ `from`과 `to`는 서로 달라야 합니다 +@msg `from` has an empty frame `from`에 빈 프레임이 있습니다 +@msg `from` must be a non-negative integer `from`은(는) 음이 아닌 정수여야 합니다 +@msg `from` must be area type or type on a path `from`은(는) 영역 문자 또는 패스 위 문자여야 합니다 +@msg `gid` must be a glyph id, not {v} `gid`은(는) 글리프 id여야 합니다: {v} +@msg `glyphAlternate` belongs to one character, not to a character style (text.setGlyphAlternate sets it) `glyphAlternate`은(는) 문자 스타일이 아니라 글자 하나에 속합니다(text.setGlyphAlternate로 설정) +@msg `glyphAlternate` takes only null, which takes a glyph choice away (text.setGlyphAlternate makes one) `glyphAlternate`에는 글리프 선택을 없애는 null만 쓸 수 있습니다(선택은 text.setGlyphAlternate로 지정) +@msg `group` must be one of {_1} `group`은(는) {_1} 중 하나여야 합니다 +@msg `group` must be the Objects on Path group of `member` and `target` `group`은(는) `member`와 `target`이 속한 패스 위 개체 그룹이어야 합니다 +@msg `guide` must be a guide index (guide.list) `guide`은(는) 안내선 인덱스여야 합니다(guide.list) +@msg `hAlign` must be default, left, center or right `hAlign`은(는) default, left, center 또는 right여야 합니다 +@msg `id` is an object id, not {v} `id`은(는) 개체 id입니다: {v} +@msg `id` must be a node id `id`은(는) 노드 id여야 합니다 +@msg `id` must be an object id, not {v} `id`은(는) 개체 id여야 합니다: {v} +@msg `ids` must name Objects on Path groups or objects in them `ids`에는 패스 위 개체 그룹이나 그 안의 개체를 지정해야 합니다 +@msg `ids` takes at most {MAX_INSPECT_IDS} ids `ids`에는 id를 최대 {MAX_INSPECT_IDS}개까지 넣을 수 있습니다 +@msg `imageMap` must be none, rectangle or polygon `imageMap`은(는) none, rectangle 또는 polygon이어야 합니다 +@msg `includeArtboardFill` must be true or false `includeArtboardFill`은(는) true 또는 false여야 합니다 +@msg `includeSubdirs` must be true or false `includeSubdirs`은(는) true 또는 false여야 합니다 +@msg `index` must be a point index `index`은(는) 점 인덱스여야 합니다 +@msg `index` must be a whole number or null `index`은(는) 정수 또는 null이어야 합니다 +@msg `indices` must be a non-empty array of item indices `indices`은(는) 항목 인덱스가 하나 이상 있는 배열이어야 합니다 +@msg `item` needs `index` `item`에는 `index`가 필요합니다 +@msg `items` is a list of {kind, item} `items`은(는) {kind, item}의 목록입니다 +@msg `items` is empty `items`이(가) 비어 있습니다 +@msg `items` must be a list of {id, points} `items`은(는) {id, points}의 목록이어야 합니다 +@msg `items` must be a list of {{id, anchors?}}, not {v} `items`은(는) {{id, anchors?}}의 목록이어야 합니다: {v} +@msg `items` must be an array of {id, anchors} `items`은(는) {id, anchors}의 배열이어야 합니다 +@msg `items` must be an array of {{id, corners?}}, not {v} `items`은(는) {{id, corners?}}의 배열이어야 합니다: {v} +@msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida`은(는) "none", "short", "medium", "long" 또는 "stylistic"이어야 합니다 +@msg `kerningBefore` belongs to a line's first character, not to a character style (text.setRangeStyle sets it) `kerningBefore`은(는) 문자 스타일이 아니라 줄의 첫 글자에 속합니다(text.setRangeStyle로 설정) +@msg `kind` is one of {_1} `kind`은(는) {_1} 중 하나입니다 +@msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind`은(는) "round", "invertedRound" 또는 "chamfer"여야 합니다: {v} +@msg `kind` must be `text`, `visibility`, `image` or `graph` `kind`은(는) `text`, `visibility`, `image` 또는 `graph`여야 합니다 +@msg `kind` must be a string `kind`은(는) 문자열이어야 합니다 +@msg `kind` must be image, noImage or htmlText `kind`은(는) image, noImage 또는 htmlText여야 합니다 +@msg `kinsokuType` must be "pushInFirst", "pushOutFirst" or "pushOutOnly" `kinsokuType`은(는) "pushInFirst", "pushOutFirst" 또는 "pushOutOnly"여야 합니다 +@msg `kinsoku` must be "none", "hard" or "soft" `kinsoku`은(는) "none", "hard" 또는 "soft"여야 합니다 +@msg `label` must be a non-empty name of at most 200 characters `label`은(는) 비어 있지 않은 최대 200자의 이름이어야 합니다 +@msg `language` must be a language name or tag, such as "Turkish" or "tr" `language`은(는) "Turkish"나 "tr" 같은 언어 이름 또는 태그여야 합니다 +@msg `leader` must be a string `leader`은(는) 문자열이어야 합니다 +@msg `leadingModel` must be "romanBaseline" or "emBoxTop" `leadingModel`은(는) "romanBaseline" 또는 "emBoxTop"이어야 합니다 +@msg `leading` must be from 0.1 to 5000, or null for Auto `leading`은(는) 0.1에서 5000 사이이거나, 자동이면 null이어야 합니다 +@msg `length` must be a number of at most 1000000 pt either way `length`은(는) 양쪽 방향으로 최대 1000000 pt의 숫자여야 합니다 +@msg `line` must be true or false `line`은(는) true 또는 false여야 합니다 +@msg `max` must be 1 to {MAX_SUGGESTIONS} `max`은(는) 1에서 {MAX_SUGGESTIONS} 사이여야 합니다 +@msg `minAngle` ({min_angle}°) can't be more than `maxAngle` ({max_angle}°) `minAngle`({min_angle}°)은 `maxAngle`({max_angle}°)보다 클 수 없습니다 +@msg `mode` must be "handles", "straight" or "smooth" `mode`은(는) "handles", "straight" 또는 "smooth"여야 합니다 +@msg `mode` must be "straight", "bezier" or "arc" `mode`은(는) "straight", "bezier" 또는 "arc"여야 합니다 +@msg `mode` must be one of {_1} `mode`은(는) {_1} 중 하나여야 합니다 +@msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi`은(는) "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" 또는 "lineEndHalf"여야 합니다 +@msg `name` must be a name that is not empty `name`은(는) 비어 있지 않은 이름이어야 합니다 +@msg `name` must not be empty `name`은(는) 비어 있으면 안 됩니다 +@msg `names` is a list of preset names `names`은(는) 사전 설정 이름 목록입니다 +@msg `names` lists preset names `names`에는 사전 설정 이름을 나열합니다 +@msg `names` must be a list of names `names`은(는) 이름 목록이어야 합니다 +@msg `names` must be a list of swatch names `names`은(는) 견본 이름 목록이어야 합니다 +@msg `names` must be an array of style names `names`은(는) 스타일 이름의 배열이어야 합니다 +@msg `new` is a design name, or true `new`은(는) 디자인 이름 또는 true입니다 +@msg `origin` must be [x, y] in points `origin`은(는) 포인트 단위의 [x, y]여야 합니다 +@msg `path` must be a folder `path`은(는) 폴더여야 합니다 +@msg `path` must be a path object `path`은(는) 패스 개체여야 합니다 +@msg `picks` must be an array (got {v}) `picks`은(는) 배열이어야 합니다({v} 입력됨) +@msg `picks` must hold 1 to {MAX_PICKS} picks (got {_1}) `picks`에는 선택을 1개에서 {MAX_PICKS}개까지 넣어야 합니다({_1} 입력됨) +@msg `pivot` must be a whole number from 0 to 8 `pivot`은(는) 0에서 8 사이의 정수여야 합니다 +@msg `points` must be a list of [x, y] points `points`은(는) [x, y] 점의 목록이어야 합니다 +@msg `points` must be a list of point indexes `points`은(는) 점 인덱스 목록이어야 합니다 +@msg `points` must be an array of point indices `points`은(는) 점 인덱스의 배열이어야 합니다 +@msg `points` must be point indexes `points`은(는) 점 인덱스여야 합니다 +@msg `points` must hold from 2 to 100000 points `points`에는 점이 2개에서 100000개 있어야 합니다 +@msg `port` must be "in" or "out" `port`은(는) "in" 또는 "out"이어야 합니다 +@msg `position` is above or below `position`은(는) above 또는 below입니다 +@msg `preset` must be a string `preset`은(는) 문자열이어야 합니다 +@msg `radius` must be 0 or more `radius`은(는) 0 이상이어야 합니다 +@msg `ratio` must be from 0.1 to 0.5 `ratio`은(는) 0.1에서 0.5 사이여야 합니다 +@msg `rect` must be [x, y, width, height] `rect`은(는) [x, y, width, height]여야 합니다 +@msg `rect` must be [x, y, width, height] with a positive size `rect`은(는) 크기가 양수인 [x, y, width, height]여야 합니다 +@msg `rect` must be [x0, y0, x1, y1] (got {r}) `rect`은(는) [x0, y0, x1, y1]이어야 합니다({r} 입력됨) +@msg `relation` must be overlap, inside or outside `relation`은(는) overlap, inside 또는 outside여야 합니다 +@msg `replace` must be a string `replace`은(는) 문자열이어야 합니다 +@msg `reversed` must be true or false `reversed`은(는) true 또는 false여야 합니다 +@msg `rotate` must be a finite number `rotate`은(는) 유한한 숫자여야 합니다 +@msg `rows` must be lists of numbers or nulls, not {r} `rows`은(는) 숫자 또는 null의 목록이어야 합니다: {r} +@msg `rule` must be nonZero or evenOdd `rule`은(는) nonZero 또는 evenOdd여야 합니다 +@msg `scale` must be a number from 0.001 to 1000 `scale`은(는) 0.001에서 1000 사이의 숫자여야 합니다 +@msg `scale` must be a number in (0, 100] `scale`은(는) (0, 100] 범위의 숫자여야 합니다 +@msg `scope.{key}` must be a non-empty array `scope.{key}`은(는) 비어 있지 않은 배열이어야 합니다 +@msg `scope` must be "document", {artboards} or {layers} `scope`은(는) "document", {artboards} 또는 {layers}여야 합니다 +@msg `scope` must be "selection" or "document", not {other} `scope`은(는) "selection" 또는 "document"여야 합니다: {other} +@msg `script` must be a string `script`은(는) 문자열이어야 합니다 +@msg `seriesIndexes` is a non-empty list of series indexes `seriesIndexes`은(는) 계열 인덱스가 하나 이상 있는 목록입니다 +@msg `seriesIndexes` needs a `type` or a `valueAxis` `seriesIndexes`에는 `type` 또는 `valueAxis`가 필요합니다 +@msg `shift` must be a number of points `shift`은(는) 포인트 단위의 숫자여야 합니다 +@msg `showCenter` must be true or false `showCenter`은(는) true 또는 false여야 합니다 +@msg `side` must be "left", "right", "top" or "bottom" `side`은(는) "left", "right", "top" 또는 "bottom"이어야 합니다 +@msg `side` places the artboard: leave out x, y, width and height `side`가 아트보드의 위치를 정합니다: x, y, width, height는 생략하세요 +@msg `singleWordJustification` must be "fullJustify", "alignLeft", "alignCenter" or "alignRight" `singleWordJustification`은(는) "fullJustify", "alignLeft", "alignCenter" 또는 "alignRight"여야 합니다 +@msg `size` is a percentage of the base text's size, 1 to 100 `size`은(는) 기준 텍스트 크기에 대한 백분율이며 1에서 100 사이입니다 +@msg `source` and `target` are the same object `source`와 `target`이 같은 개체입니다 +@msg `source` is the only path in series group `target` `source`은(는) 계열 그룹 `target`에 있는 유일한 패스입니다 +@msg `source` must be `folder` or `datasets` `source`은(는) `folder` 또는 `datasets`여야 합니다 +@msg `spacing` makes more than {MAX_COUNT} lines across the box `spacing` 값으로는 상자에 선이 {MAX_COUNT}개보다 많이 생깁니다 +@msg `spacing` must be a number `spacing`은(는) 숫자여야 합니다 +@msg `spacing` must be a number of points, 0 or more, or "auto" `spacing`은(는) 0 이상의 포인트 값이거나 "auto"여야 합니다 +@msg `spacing` must be more than 0 and at most {MAX_DISTANCE} pt `spacing`은(는) 0보다 크고 {MAX_DISTANCE} pt 이하여야 합니다 +@msg `start` must be a finite number `start`은(는) 유한한 숫자여야 합니다 +@msg `starts` must be an array of anchor indices (or nulls) `starts`은(는) 앵커 인덱스(또는 null)의 배열이어야 합니다 +@msg `status` must be linked, embedded, missing or modified, or a list of them `status`은(는) linked, embedded, missing 또는 modified이거나 이들의 목록이어야 합니다 +@msg `stop` must be a stop index `stop`은(는) 정지점 인덱스여야 합니다 +@msg `story` styles the whole story: give no `start` or `end` `story`은(는) 스토리 전체에 스타일을 적용합니다: `start`와 `end`는 지정하지 마세요 +@msg `story` takes the whole story: give no `start` or `end` `story`은(는) 스토리 전체를 대상으로 합니다: `start`와 `end`는 지정하지 마세요 +@msg `strokeMode` applies to strokes (stroke: true) `strokeMode`은(는) 선에 적용됩니다(stroke: true) +@msg `style` must be roman or japanese `style`은(는) roman 또는 japanese여야 합니다 +@msg `subpaths` must be two integer indices `subpaths`은(는) 정수 인덱스 두 개여야 합니다 +@msg `symbol` must be a symbol name `symbol`은(는) 심볼 이름이어야 합니다 +@msg `target` must be "object" or "contents", not {v} `target`은(는) "object" 또는 "contents"여야 합니다: {v} +@msg `target` must be an object of the same Objects on Path group as `member` `target`은(는) `member`와 같은 패스 위 개체 그룹에 있는 개체여야 합니다 +@msg `tint` applies to global and spot colours `tint`은(는) 글로벌 색상과 별색에 적용됩니다 +@msg `tint` goes with a global or spot `swatch` `tint`은(는) 글로벌 색상 또는 별색 `swatch`와 함께 씁니다 +@msg `tint` must be a number (%) `tint`은(는) 숫자(%)여야 합니다 +@msg `tint` needs a global or spot colour `tint`에는 글로벌 색상이나 별색이 필요합니다 +@msg `to` is already threaded `to`은(는) 이미 스레드로 연결되어 있습니다 +@msg `to` is the design's new name `to`은(는) 디자인의 새 이름입니다 +@msg `to` must be [x, y] `to`은(는) [x, y]여야 합니다 +@msg `to` must be a closed path, area type or type on a path other than `from` `to`은(는) `from`이 아닌 닫힌 패스, 영역 문자 또는 패스 위 문자여야 합니다 +@msg `to` must be a whole number `to`은(는) 정수여야 합니다 +@msg `to` takes the rows of one object's stack, not aligned rows `to`에는 정렬된 행이 아니라 한 개체 스택의 행을 지정합니다 +@msg `tolerance` must be from 0 to 100 pt `tolerance`은(는) 0에서 100 pt 사이여야 합니다 +@msg `useLab` must be true or false `useLab`은(는) true 또는 false여야 합니다 +@msg `vAlign` must be default, top, middle, baseline or bottom `vAlign`은(는) default, top, middle, baseline 또는 bottom이어야 합니다 +@msg `values` must be a list `values`은(는) 목록이어야 합니다 +@msg `values` must be an object `values`은(는) 개체여야 합니다 +@msg `values` must name hex, rgb, cmyk, lab or gray `values`에는 hex, rgb, cmyk, lab 또는 gray를 지정해야 합니다 +@msg `values` names a kind twice `values`에 같은 종류가 두 번 있습니다 +@msg `version` must be 0 or {_1} `version`은(는) 0 또는 {_1}이어야 합니다 +@msg `version` must be 0 or {newest} `version`은(는) 0 또는 {newest}이어야 합니다 +@msg `warichuAlign` must be one of {_1} `warichuAlign`은(는) {_1} 중 하나여야 합니다 +@msg `warichuLines` must be a whole number from {_1} to {_2} `warichuLines`은(는) {_1}에서 {_2} 사이의 정수여야 합니다 +@msg `weight` must be from 0.01 to 1000 pt `weight`은(는) 0.01에서 1000 pt 사이여야 합니다 +@msg `weights` must be a list of {_1} numbers, one per row (got {v}) `weights`은(는) 행마다 하나씩 숫자 {_1}개의 목록이어야 합니다({v} 입력됨) +@msg `xml` must be a string `xml`은(는) 문자열이어야 합니다 +@msg `{KEY}` entry {n} gives the paragraph at byte {start} of {_1} other indents than an entry before it `{KEY}` 항목 {n}은(는) {_1}의 바이트 {start}에 있는 단락에 앞선 항목과 다른 들여쓰기를 지정합니다 +@msg `{KEY}` entry {n} must be an object `{KEY}` 항목 {n}은(는) 개체여야 합니다 +@msg `{KEY}` entry {n} sets neither `leftIndent` nor `firstLineIndent` `{KEY}` 항목 {n}이(가) `leftIndent`와 `firstLineIndent` 중 어느 것도 설정하지 않습니다 +@msg `{KEY}` entry {n}: `id` must be an object id `{KEY}` 항목 {n}: `id`은(는) 개체 id여야 합니다 +@msg `{KEY}` entry {n}: `start` must be a byte offset `{KEY}` 항목 {n}: `start`은(는) 바이트 오프셋이어야 합니다 +@msg `{KEY}` entry {n}: `{k}` must be a number from -{MAX_PARA} to {MAX_PARA} pt `{KEY}` 항목 {n}: `{k}`은(는) -{MAX_PARA}에서 {MAX_PARA} pt 사이의 숫자여야 합니다 +@msg `{KEY}` entry {n}: no paragraph of {_1} starts at byte {start} `{KEY}` 항목 {n}: {_1}에는 바이트 {start}에서 시작하는 단락이 없습니다 +@msg `{KEY}` entry {n}: unknown key `{k}` `{KEY}` 항목 {n}: 알 수 없는 키 `{k}` +@msg `{KEY}` entry {n}: {_1} is not a type object `{KEY}` 항목 {n}: {_1}은(는) 문자 개체가 아닙니다 +@msg `{KEY}` is empty `{KEY}`이(가) 비어 있습니다 +@msg `{KEY}` must be a list `{KEY}`은(는) 목록이어야 합니다 +@msg `{KEY}` takes at most {MAX_PARAGRAPH_INDENTS} entries (got {_1}) `{KEY}`에는 항목을 최대 {MAX_PARAGRAPH_INDENTS}개까지 넣을 수 있습니다({_1} 입력됨) +@msg `{KEY}` takes no `{other}` beside it `{KEY}`은(는) `{other}`와(과) 함께 쓸 수 없습니다 +@msg `{_1}` can't be edited or removed `{_1}`은(는) 편집하거나 제거할 수 없습니다 +@msg `{_1}` is built in and always listed `{_1}`은(는) 기본 제공 항목이며 항상 목록에 있습니다 +@msg `{_1}` is not a font file the last text.findFontFiles search found `{_1}`은(는) 마지막 text.findFontFiles 검색에서 찾은 글꼴 파일이 아닙니다 +@msg `{_1}` would be overwritten by the package: choose a different folder or name 패키지가 `{_1}`을(를) 덮어쓰게 됩니다: 다른 폴더나 이름을 선택하세요 +@msg `{base}` is larger than {_1} MB `{base}`이(가) {_1} MB보다 큽니다 +@msg `{base}` is not in the DCS file's folder `{base}`이(가) DCS 파일의 폴더에 없습니다 +@msg `{file}` has no art to place `{file}`에 가져올 아트웍이 없습니다 +@msg `{file}` is over {_1} MB `{file}`이(가) {_1} MB를 넘습니다 +@msg `{f}` belongs to a VectorCraft that is running `{f}`은(는) 실행 중인 VectorCraft가 사용하고 있습니다 +@msg `{f}` is the copy of a document open now `{f}`은(는) 지금 열려 있는 문서의 복사본입니다 +@msg `{id}` is no writable format (see document.formats) `{id}`은(는) 기록할 수 있는 형식이 아닙니다(document.formats 참조) +@msg `{id}` isn't a loaded library `{id}`은(는) 불러온 라이브러리가 아닙니다 +@msg `{key}` has no colours `{key}`에 색상이 없습니다 +@msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}`에 단어가 {MAX_EDIT_WORDS}개보다 많습니다 +@msg `{key}` is a design name `{key}`은(는) 디자인 이름입니다 +@msg `{key}` is a design name or a list of them `{key}`은(는) 디자인 이름 또는 디자인 이름 목록입니다 +@msg `{key}` is longer than {MAX_NAME} characters `{key}`이(가) {MAX_NAME}자보다 깁니다 +@msg `{key}` is out of range `{key}`이(가) 범위를 벗어났습니다 +@msg `{key}` must be 0 or more `{key}`은(는) 0 이상이어야 합니다 +@msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}`은(는) 백분율 단위의 [min, desired, max] 또는 {{min?, desired?, max?}}여야 합니다 +@msg `{key}` must be [x, y] numbers `{key}`은(는) 숫자 [x, y]여야 합니다 +@msg `{key}` must be a list of words `{key}`은(는) 단어 목록이어야 합니다 +@msg `{key}` must be a list, not {v} `{key}`은(는) 목록이어야 합니다: {v} +@msg `{key}` must be a non-negative integer `{key}`은(는) 음이 아닌 정수여야 합니다 +@msg `{key}` must be a number or null, not {v} `{key}`은(는) 숫자 또는 null이어야 합니다: {v} +@msg `{key}` must be a number {_1}..{_2} `{key}`은(는) {_1}..{_2}의 숫자여야 합니다 +@msg `{key}` must be a whole number of 0 or more `{key}`은(는) 0 이상의 정수여야 합니다 +@msg `{key}` must be a whole number of at least 0, not {n} `{key}`은(는) 0 이상의 정수여야 합니다: {n} +@msg `{key}` must be an appearance item index (paint order) or null `{key}`은(는) 모양새 항목 인덱스(칠하는 순서) 또는 null이어야 합니다 +@msg `{key}` must be an array of asset ids (see assets.list) `{key}`은(는) 에셋 id의 배열이어야 합니다(assets.list 참조) +@msg `{key}` must be from 0 to 180 degrees, not {a} `{key}`은(는) 0도에서 180도 사이여야 합니다: {a} +@msg `{key}` must be from 0 to {MAX_DISTANCE} pt `{key}`은(는) 0에서 {MAX_DISTANCE} pt 사이여야 합니다 +@msg `{key}` must be from 0.01 to 1000 pt `{key}`은(는) 0.01에서 1000 pt 사이여야 합니다 +@msg `{key}` must be from {_1} to {shift_max} `{key}`은(는) {_1}에서 {shift_max} 사이여야 합니다 +@msg `{key}` must be from {lo} to {hi}, not {v} `{key}`은(는) {lo}에서 {hi} 사이여야 합니다: {v} +@msg `{key}` must be one of auto, always, never `{key}`은(는) auto, always, never 중 하나여야 합니다 +@msg `{key}` must be one of miter, round, bevel `{key}`은(는) miter, round, bevel 중 하나여야 합니다 +@msg `{key}` must be one word of at most {_1} characters `{key}`은(는) 최대 {_1}자의 단어 하나여야 합니다 +@msg `{key}` must hold single words of at most {_1} characters `{key}`에는 최대 {_1}자의 단어를 하나씩 넣어야 합니다 +@msg `{key}` must name an object attached to the path of an Objects on Path group `{key}`에는 패스 위 개체 그룹의 패스에 부착된 개체를 지정해야 합니다 +@msg `{key}` names an object that is hidden or locked `{key}`에 지정한 개체가 숨겨졌거나 잠겨 있습니다 +@msg `{key}`: not a colour: {v} `{key}`: 색상이 아닙니다: {v} +@msg `{k}.family` is required `{k}.family`가 필요합니다 +@msg `{k}` is a number 0..1 `{k}`은(는) 0..1의 숫자입니다 +@msg `{k}` is true or false `{k}`은(는) true 또는 false입니다 +@msg `{k}` isn't an export setting: {_1} `{k}`은(는) 내보내기 설정이 아닙니다: {_1} +@msg `{k}` must be a byte offset `{k}`은(는) 바이트 오프셋이어야 합니다 +@msg `{k}` must be a number `{k}`은(는) 숫자여야 합니다 +@msg `{k}` must be a number of points `{k}`은(는) 포인트 단위의 숫자여야 합니다 +@msg `{k}` must be a string `{k}`은(는) 문자열이어야 합니다 +@msg `{k}` must be a whole number `{k}`은(는) 정수여야 합니다 +@msg `{k}` must be from {lo} to {hi} for {key} {key}에서는 `{k}`이(가) {lo}에서 {hi} 사이여야 합니다 +@msg `{k}` must be {what}, not {v} `{k}`은(는) {what}이어야 합니다: {v} +@msg `{l}` isn't a global or spot colour `{l}`은(는) 글로벌 색상이나 별색이 아닙니다 +@msg `{m}` isn't a bitmap: use clipboard.importSvg, importPdf or importText `{m}`은(는) 비트맵이 아닙니다: clipboard.importSvg, importPdf 또는 importText를 사용하세요 +@msg `{name}` can't be deleted `{name}`은(는) 삭제할 수 없습니다 +@msg `{name}` can't be duplicated `{name}`은(는) 복제할 수 없습니다 +@msg `{name}` can't be edited `{name}`은(는) 편집할 수 없습니다 +@msg `{name}` can't be edited this way `{name}`은(는) 이 방법으로 편집할 수 없습니다 +@msg `{name}` can't be renamed `{name}`은(는) 이름을 바꿀 수 없습니다 +@msg `{name}` can't name a folder `{name}`은(는) 폴더 이름으로 쓸 수 없습니다 +@msg `{name}` has no art to place `{name}`에 가져올 아트웍이 없습니다 +@msg `{name}` has no text to place `{name}`에 가져올 텍스트가 없습니다 +@msg `{name}` in the Word document is not UTF-8 or UTF-16 text Word 문서의 `{name}`이(가) UTF-8 또는 UTF-16 텍스트가 아닙니다 +@msg `{name}` in the Word document is not well-formed XML: {e} Word 문서의 `{name}`이(가) 올바른 형식의 XML이 아닙니다: {e} +@msg `{name}` in the Word document nests elements more than {MAX_NESTING} deep Word 문서의 `{name}`에 요소가 {MAX_NESTING}단계보다 깊게 중첩되어 있습니다 +@msg `{name}` is a built-in preset and is read-only: save it under another name `{name}`은(는) 기본 제공 사전 설정이며 읽기 전용입니다: 다른 이름으로 저장하세요 +@msg `{name}` is a built-in preset: save under another name `{name}`은(는) 기본 제공 사전 설정입니다: 다른 이름으로 저장하세요 +@msg `{name}` is a built-in profile and stays `{name}`은(는) 기본 제공 프로파일이므로 그대로 남습니다 +@msg `{name}` is a file of its own, which can only be found next to the DCS file's path `{name}`은(는) 별도의 파일이며 DCS 파일의 경로 옆에서만 찾을 수 있습니다 +@msg `{name}` is a tint of `{base}`: edit `{base}` (a tint swatch only takes a new name) `{name}`은(는) `{base}`의 색조입니다: `{base}`을(를) 편집하세요(색조 견본은 이름만 바꿀 수 있습니다) +@msg `{name}` is a working space: choose another with edit.colorSettings first `{name}`은(는) 작업 공간입니다: 먼저 edit.colorSettings로 다른 작업 공간을 선택하세요 +@msg `{name}` is built in and stays `{name}`은(는) 기본 제공 항목이므로 그대로 남습니다 +@msg `{name}` takes a paint of its own kind (colour, gradient or pattern) `{name}`에는 같은 종류의 페인트(색상, 그레이디언트 또는 패턴)만 지정할 수 있습니다 +@msg `{name}`: {_1}: {e} `{name}`: {_1}: {e} +@msg `{n}` can't be deleted `{n}`은(는) 삭제할 수 없습니다 +@msg `{n}` can't be merged `{n}`은(는) 병합할 수 없습니다 +@msg `{n}` can't be moved `{n}`은(는) 이동할 수 없습니다 +@msg `{n}` is not a colour swatch `{n}`은(는) 색상 견본이 아닙니다 +@msg `{n}` isn't a solid colour `{n}`은(는) 단색이 아닙니다 +@msg `{n}`: colour groups hold solid colours only `{n}`: 색상 그룹에는 단색만 넣을 수 있습니다 +@msg `{other}` doesn't trace an image `{other}`은(는) 이미지를 추적하지 않습니다 +@msg `{s}`: the step's references copy in more than {_1} MB of values `{s}`: 이 단계의 참조가 {_1} MB보다 많은 값을 복사해 넣습니다 +@msg `{tag}` is not an axis tag: a tag is four characters, such as "wght" `{tag}`은(는) 축 태그가 아닙니다: 태그는 "wght"처럼 네 글자입니다 +@msg `{to}` is empty or already used `{to}`이(가) 비어 있거나 이미 사용 중입니다 +@msg `{u}` is no Unicode character `{u}`은(는) 유니코드 문자가 아닙니다 +@msg `{what}` is longer than {MAX_TEXT} bytes `{what}`이(가) {MAX_TEXT}바이트보다 깁니다 +@msg `{what}` must be text `{what}`은(는) 텍스트여야 합니다 +@msg `{word}` isn't in the custom dictionary `{word}`은(는) 사용자 사전에 없습니다 +@msg a CMap has too many mappings CMap에 매핑이 너무 많습니다 +@msg a DXF drawing has one origin: pass useArtboards: true for one drawing per artboard DXF 도면에는 원점이 하나입니다: 아트보드마다 도면을 하나씩 만들려면 useArtboards: true를 전달하세요 +@msg a PDF presets file with over {_1} presets 사전 설정이 {_1}개를 넘는 PDF 사전 설정 파일입니다 +@msg a \u escape needs four hexadecimal digits \u 이스케이프에는 16진수 네 자리가 필요합니다 +@msg a batch preview cannot switch documents 일괄 처리 미리 보기에서는 문서를 전환할 수 없습니다 +@msg a brush named `{nn}` exists `{nn}` 브러시가 이미 있습니다 +@msg a comma in an XPath expression must separate function arguments XPath 식의 쉼표는 함수 인수를 구분해야 합니다 +@msg a container of the listed objects is gone 나열한 개체의 컨테이너 하나가 없어졌습니다 +@msg a content stream can't be read 콘텐츠 스트림을 읽을 수 없습니다 +@msg a content stream isn't a stream 콘텐츠 스트림이 스트림이 아닙니다 +@msg a design holds at most {_1} objects 디자인에는 개체를 최대 {_1}개까지 넣을 수 있습니다 +@msg a design needs a name 디자인에는 이름이 필요합니다 +@msg a dictionary grew too large 사전이 너무 커졌습니다 +@msg a document holds at most {_1} SVG filters 문서에는 SVG 필터를 최대 {_1}개까지 둘 수 있습니다 +@msg a document keeps at most {_1} graph designs 문서에는 그래프 디자인을 최대 {_1}개까지 둘 수 있습니다 +@msg a document keeps at most {_1} saved selections 문서에는 저장된 선택 영역을 최대 {_1}개까지 둘 수 있습니다 +@msg a document keeps at most {_1} views 문서에는 보기를 최대 {_1}개까지 둘 수 있습니다 +@msg a document links at most {MAX_SVG_SCRIPTS} JavaScript files 문서에는 JavaScript 파일을 최대 {MAX_SVG_SCRIPTS}개까지 연결할 수 있습니다 +@msg a document with unsaved changes has no recovery copy 저장하지 않은 변경 내용이 있는 문서에는 복구 복사본이 없습니다 +@msg a feConvolveMatrix filter's order is {x}×{y}, which overflows the kernel-size multiply usvg makes feConvolveMatrix 필터의 order가 {x}×{y}여서 usvg의 커널 크기 곱셈이 오버플로됩니다 +@msg a font's data is too large 글꼴 데이터가 너무 큽니다 +@msg a font's subroutines are too large 글꼴의 서브루틴이 너무 큽니다 +@msg a function declaration without a name 이름이 없는 함수 선언입니다 +@msg a gradient preset is already called {n} {n}(이)라는 그레이디언트 사전 설정이 이미 있습니다 +@msg a graph has at most {_1} series, so it transposes with at most that many categories 그래프에는 계열이 최대 {_1}개이므로 범주가 그 개수 이하일 때만 행과 열을 바꿀 수 있습니다 +@msg a host value has too many entries 호스트 값에 항목이 너무 많습니다 +@msg a host value is nested too deep 호스트 값이 너무 깊게 중첩되어 있습니다 +@msg a layer can't be merged into its own sublayer 레이어는 자신의 하위 레이어에 병합할 수 없습니다 +@msg a layer's form box isn't an array 레이어 폼의 상자가 배열이 아닙니다 +@msg a layer's form can't be read 레이어의 폼을 읽을 수 없습니다 +@msg a layer's form has no box 레이어의 폼에 상자가 없습니다 +@msg a layer's form has no dictionary 레이어의 폼에 사전이 없습니다 +@msg a legend draws at most {MAX_CHIPS} swatches 범례에는 견본을 최대 {MAX_CHIPS}개까지 그립니다 +@msg a name names one asset: give multiple: false, or one object 이름은 에셋 하나를 가리킵니다: multiple: false를 지정하거나 개체 하나를 지정하세요 +@msg a namespace declaration uses a reserved prefix or URI 네임스페이스 선언에 예약된 접두사나 URI를 사용했습니다 +@msg a namespace qualifier is undefined 네임스페이스 한정자가 정의되지 않았습니다 +@msg a namespace with an empty URI cannot have a prefix URI가 빈 네임스페이스에는 접두사를 붙일 수 없습니다 +@msg a number has no digits 숫자에 자릿수가 없습니다 +@msg a number's exponent has no digits 숫자의 지수에 자릿수가 없습니다 +@msg a number's fraction has no digits 숫자의 소수부에 자릿수가 없습니다 +@msg a page can't be read 페이지를 읽을 수 없습니다 +@msg a page object is used by something else 페이지 개체를 다른 항목이 사용하고 있습니다 +@msg a page thumbnail must be RGB pixels, 1 to {THUMBNAIL_SIZE} a side (got {w} × {h}) 페이지 미리 보기 이미지는 한 변이 1에서 {THUMBNAIL_SIZE}인 RGB 픽셀이어야 합니다({w} × {h} 입력됨) +@msg a pattern layer doesn't end what it starts 패턴 레이어가 시작한 것을 끝내지 않습니다 +@msg a pattern layer's colors hold something else 패턴 레이어의 색상에 다른 것이 들어 있습니다 +@msg a pattern named `{n}` exists `{n}` 패턴이 이미 있습니다 +@msg a plug-in with id {_1} is already installed id가 {_1}인 플러그인이 이미 설치되어 있습니다 +@msg a preset named `{n}` exists `{n}` 사전 설정이 이미 있습니다 +@msg a print presets file with over {_1} presets 사전 설정이 {_1}개를 넘는 인쇄 사전 설정 파일입니다 +@msg a profile is already called {n} {n}(이)라는 프로파일이 이미 있습니다 +@msg a property descriptor cannot have both a value or writable and a get or set 속성 설명자에는 value 또는 writable과 get 또는 set을 함께 둘 수 없습니다 +@msg a property descriptor must be an object 속성 설명자는 개체여야 합니다 +@msg a property's {name} must be a function or undefined 속성의 {name}은(는) 함수 또는 undefined여야 합니다 +@msg a row can't go into itself 행을 자기 자신 안으로 옮길 수 없습니다 +@msg a series goes on the left or the right value axis 계열은 왼쪽 또는 오른쪽 값 축에 놓입니다 +@msg a start must be an anchor index ≥ 0 or null 시작은 0 이상의 앵커 인덱스 또는 null이어야 합니다 +@msg a stream in it would decode to more than 256 MB, or its decode parameters can't be applied 그 안의 스트림을 디코딩하면 256 MB를 넘거나 디코딩 매개변수를 적용할 수 없습니다 +@msg a string holds a control character 문자열에 제어 문자가 있습니다 +@msg a string holds an escape sequence JSON does not have 문자열에 JSON에 없는 이스케이프 시퀀스가 있습니다 +@msg a string is not closed 문자열이 닫히지 않았습니다 +@msg a style named `{name}` already exists `{name}` 스타일이 이미 있습니다 +@msg a style named `{to}` already exists `{to}` 스타일이 이미 있습니다 +@msg a swatch needs a colour, gradient or pattern 견본에는 색상, 그레이디언트 또는 패턴이 필요합니다 +@msg a symbol named `{n}` already exists `{n}` 심볼이 이미 있습니다 +@msg a theme has 1 to {THEME_SIZE} colours 테마에는 색상이 1개에서 {THEME_SIZE}개 있습니다 +@msg a theme is already called {name} (replace: "{name}" overwrites it) {name}(이)라는 테마가 이미 있습니다(replace: "{name}"을(를) 지정하면 덮어씁니다) +@msg a toolbar name has at most {MAX_NAME} characters 도구 막대 이름은 최대 {MAX_NAME}자입니다 +@msg a view named `{_1}` exists `{_1}` 보기가 이미 있습니다 +@msg a view named `{name}` exists `{name}` 보기가 이미 있습니다 +@msg a workspace keeps at most {MAX} toolbars 작업 영역에는 도구 막대를 최대 {MAX}개까지 둘 수 있습니다 +@msg a {_1} series can't go in a {_2} graph {_1} 계열은 {_2} 그래프에 넣을 수 없습니다 +@msg aiVersion {v}: "pdf" (PDF-compatible, the default) or "7" (legacy .ai, version 7) aiVersion {v}: "pdf"(PDF 호환, 기본값) 또는 "7"(이전 .ai, 버전 7)이어야 합니다 +@msg already editing an opacity mask 이미 불투명 마스크를 편집하고 있습니다 +@msg already editing another object's opacity mask 이미 다른 개체의 불투명 마스크를 편집하고 있습니다 +@msg already in pattern editing mode 이미 패턴 편집 모드입니다 +@msg an SVG filter is named by its id: give `xml` with `name` SVG 필터의 이름은 id입니다: `name`과 함께 `xml`을 지정하세요 +@msg an XML element has two attributes with the same name XML 요소에 이름이 같은 속성이 두 개 있습니다 +@msg an XML value cannot be inserted into itself or its descendants XML 값을 자기 자신이나 그 하위 항목에 삽입할 수 없습니다 +@msg an XML value's children cannot be assigned by position XML 값의 자식은 위치로 대입할 수 없습니다 +@msg an XML value's children cannot be deleted by position XML 값의 자식은 위치로 삭제할 수 없습니다 +@msg an XMLList converts to XML only when it has one item XMLList는 항목이 하나일 때만 XML로 변환됩니다 +@msg an XPath node test is missing XPath 노드 테스트가 없습니다 +@msg an XPath operand is missing XPath 피연산자가 없습니다 +@msg an XPath operator is missing XPath 연산자가 없습니다 +@msg an XPath predicate or step cannot follow here 여기에는 XPath 조건자나 단계가 올 수 없습니다 +@msg an XPath predicate or step follows a value that is not a node-set 노드 집합이 아닌 값 뒤에 XPath 조건자나 단계가 있습니다 +@msg an XPath step is missing XPath 단계가 없습니다 +@msg an artboard is listed twice 아트보드가 두 번 나열되었습니다 +@msg an empty artboard has no width or height to scale to 빈 아트보드에는 맞춰 비율을 조정할 너비나 높이가 없습니다 +@msg an image couldn't be decoded and is missing from the picture 이미지를 디코딩할 수 없어 그림에서 빠졌습니다 +@msg an image is too large for DXF and was left out 이미지가 DXF에 쓰기에는 너무 커서 제외되었습니다 +@msg an image of {_1} MB, at most {_2} MB 이미지가 {_1} MB입니다(최대 {_2} MB) +@msg an image of {declared_w} × {declared_h} pixels is too large to draw {declared_w} × {declared_h} 픽셀 이미지는 너무 커서 그릴 수 없습니다 +@msg an image of {width} × {height} pixels is too large to draw {width} × {height} 픽셀 이미지는 너무 커서 그릴 수 없습니다 +@msg an image of {w} × {h} pixels is too large to convert (at most {_1} pixels) {w} × {h} 픽셀 이미지는 너무 커서 변환할 수 없습니다(최대 {_1} 픽셀) +@msg an index must be a whole number 인덱스는 정수여야 합니다 +@msg an inline graphic has no glyphs 인라인 그래픽에 글리프가 없습니다 +@msg an invisible text form can't be read 보이지 않는 텍스트 폼을 읽을 수 없습니다 +@msg an object is missing 개체가 없습니다 +@msg an object's header is missing 개체의 헤더가 없습니다 +@msg an overprinting form can't be read 오버프린트 폼을 읽을 수 없습니다 +@msg an unread object has no readable bounds 읽지 않은 개체에 읽을 수 있는 경계가 없습니다 +@msg an unread object holds a frame of threaded type 읽지 않은 개체에 스레드 문자의 프레임이 있습니다 +@msg an unread object is missing from its layer 읽지 않은 개체가 레이어에 없습니다 +@msg anchor `smooth` must be true or false 앵커의 `smooth`은(는) true 또는 false여야 합니다 +@msg anchor `{key}` must be [x, y] 앵커의 `{key}`은(는) [x, y]여야 합니다 +@msg anchor `{key}` must be a number 앵커의 `{key}`은(는) 숫자여야 합니다 +@msg angle and roundness must be finite 각도와 원형률은 유한해야 합니다 +@msg angles must be a list as long as pins (degrees or null) angles는 pins와 길이가 같은 목록이어야 합니다(도 또는 null) +@msg appearance must be flat|center|edge appearance는 flat|center|edge여야 합니다 +@msg apply is "fill" or "stroke", not `{other}` apply는 "fill" 또는 "stroke"입니다: `{other}` +@msg apply was called on a value that is not a function 함수가 아닌 값에서 apply를 호출했습니다 +@msg area must be a closed polygon of 3 to 100000 [x, y] points area는 [x, y] 점 3개에서 100000개로 이루어진 닫힌 다각형이어야 합니다 +@msg area type in a thread cannot use Dynamic Text: {frames} 스레드로 연결된 영역 문자에는 동적 텍스트를 사용할 수 없습니다: {frames} +@msg area type needs a path that encloses an area 영역 문자에는 영역을 둘러싸는 패스가 필요합니다 +@msg area type {_1} is named twice 영역 문자 {_1}이(가) 두 번 지정되었습니다 +@msg array literal too long 배열 리터럴이 너무 깁니다 +@msg arrowAlign must be extend|tip, got {o} arrowAlign은 extend|tip이어야 합니다({o} 입력됨) +@msg arrowScale must be [start, end] arrowScale은 [start, end]여야 합니다 +@msg artboard is a 0-based index artboard는 0부터 시작하는 인덱스입니다 +@msg artboard must be a 0-based index artboard는 0부터 시작하는 인덱스여야 합니다 +@msg artboard {i} doesn't print 아트보드 {i}은(는) 인쇄되지 않습니다 +@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout은 {layout?, columns?, spacing?, rightToLeft?}여야 합니다 +@msg artboardLayout.columns must be 1 or more artboardLayout.columns는 1 이상이어야 합니다 +@msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout은 gridByRow, gridByColumn, row 또는 column이어야 합니다 +@msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft는 true 또는 false여야 합니다 +@msg artboardLayout.spacing must be 0–{MAX_SPACING} pt artboardLayout.spacing은 0–{MAX_SPACING} pt여야 합니다 +@msg artboards must be a non-empty list artboards는 비어 있지 않은 목록이어야 합니다 +@msg artboards must be a number artboards는 숫자여야 합니다 +@msg asset `{_1}` has no art to export 에셋 `{_1}`에 내보낼 아트웍이 없습니다 +@msg assignment to a constant binding 상수 바인딩에 대입했습니다 +@msg at least one row that isn't excluded needs a weight above 0 제외되지 않은 행 중 하나 이상은 가중치가 0보다 커야 합니다 +@msg at most {MAX_KEYWORDS} keywords 키워드는 최대 {MAX_KEYWORDS}개입니다 +@msg at most {MAX_MATCHES} matches are kept 일치 항목은 최대 {MAX_MATCHES}개까지 보관합니다 +@msg at most {MAX_POINTS} points 점은 최대 {MAX_POINTS}개입니다 +@msg at most {MAX_QUEUE} files 파일은 최대 {MAX_QUEUE}개입니다 +@msg at must be [x, y] at은 [x, y]여야 합니다 +@msg at/rect lie outside the canvas at/rect가 캔버스 밖에 있습니다 +@msg attribute must be size|leading|tracking|kerning|baselineShift attribute는 size|leading|tracking|kerning|baselineShift여야 합니다 +@msg attrs must be an object attrs는 개체여야 합니다 +@msg automation path rejected: the folder's name isn't valid text 자동화 경로가 거부되었습니다: 폴더 이름이 올바른 텍스트가 아닙니다 +@msg automation path rejected: {_1} isn't valid text 자동화 경로가 거부되었습니다: {_1}이(가) 올바른 텍스트가 아닙니다 +@msg automation path rejected: {why}: {path} 자동화 경로가 거부되었습니다: {why}: {path} +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{given}` axis는 "vertical", "horizontal" 또는 도 단위 각도여야 합니다: `{given}` +@msg backgroundContents must be transparent or white backgroundContents는 transparent 또는 white여야 합니다 +@msg bad AES key 잘못된 AES 키 +@msg bad `runs`: {e} 잘못된 `runs`: {e} +@msg bad arrowScale 잘못된 arrowScale +@msg bad base64 잘못된 base64 +@msg bad color {c} 잘못된 색상 {c} +@msg bad colour 잘못된 색상 +@msg bad colour in `colors` `colors`에 잘못된 색상이 있습니다 +@msg bad colour {v} 잘못된 색상 {v} +@msg bad colour {v} in groupColors groupColors에 잘못된 색상 {v}이(가) 있습니다 +@msg bad cross-reference entry 잘못된 상호 참조 항목 +@msg bad cross-reference table 잘못된 상호 참조 테이블 +@msg bad current colour {v} 잘못된 현재 색상 {v} +@msg bad dataBase64 잘못된 dataBase64 +@msg bad edit 잘못된 편집 +@msg bad fill {v} 잘못된 칠 {v} +@msg bad fit: {e} 잘못된 fit: {e} +@msg bad model {other} (keep, new or document) 잘못된 model {other}(keep, new 또는 document) +@msg bad new colour {v} 잘못된 새 색상 {v} +@msg bad object 잘못된 개체 +@msg bad object number 잘못된 개체 번호 +@msg bad offset 잘못된 오프셋 +@msg bad path data: {e} 잘못된 패스 데이터: {e} +@msg bad point {v}: expected [x, y] 잘못된 점 {v}: [x, y]여야 합니다 +@msg bad point {v}: expected [x, y] or [x, y, pressure] 잘못된 점 {v}: [x, y] 또는 [x, y, pressure]여야 합니다 +@msg bad reference 잘못된 참조 +@msg bad trailer size 잘못된 트레일러 크기 +@msg bad {k} colour 잘못된 {k} 색상 +@msg batches cannot nest 일괄 처리는 중첩할 수 없습니다 +@msg bind something to a variable first 먼저 변수에 항목을 바인딩하세요 +@msg bleed must be 0–{MAX_BLEED} pt: a number, [top, bottom, left, right] or {{top, bottom, left, right}} bleed는 0–{MAX_BLEED} pt여야 합니다: 숫자, [top, bottom, left, right] 또는 {{top, bottom, left, right}} +@msg blend must be a mode name blend는 모드 이름이어야 합니다 +@msg both sides of an XPath | must select nodes XPath |의 양쪽은 모두 노드를 선택해야 합니다 +@msg brush must be a name or null brush는 이름 또는 null이어야 합니다 +@msg by must be a number by는 숫자여야 합니다 +@msg can't add page thumbnails: {why} 페이지 미리 보기 이미지를 추가할 수 없습니다: {why} +@msg can't add the editing data for other apps: {why} 다른 앱용 편집 데이터를 추가할 수 없습니다: {why} +@msg can't edit the written PDF: {why} 기록한 PDF를 편집할 수 없습니다: {why} +@msg can't encrypt the PDF: {why} PDF를 암호화할 수 없습니다: {why} +@msg can't linearise the PDF: {why} PDF를 선형화할 수 없습니다: {why} +@msg can't open `{_1}`: {_2} `{_1}`을(를) 열 수 없습니다: {_2} +@msg can't open `{_1}`: {e} `{_1}`을(를) 열 수 없습니다: {e} +@msg can't open `{name}`: not a format VectorCraft reads (see document.formats) `{name}`을(를) 열 수 없습니다: VectorCraft가 읽는 형식이 아닙니다(document.formats 참조) +@msg can't place `{name}`: not a format VectorCraft reads (see document.formats) `{name}`을(를) 가져올 수 없습니다: VectorCraft가 읽는 형식이 아닙니다(document.formats 참조) +@msg can't read back the written PDF: {e} 기록한 PDF를 다시 읽을 수 없습니다: {e} +@msg can't read this Word document: {why} 이 Word 문서를 읽을 수 없습니다: {why} +@msg can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp .{e} 이미지는 기록할 수 없습니다: .png, .jpg, .gif, .webp, .tif 또는 .bmp를 사용하세요 +@msg can't write PDF layers, overprint or invisible text: {why} PDF 레이어, 오버프린트 또는 보이지 않는 텍스트를 기록할 수 없습니다: {why} +@msg can't write the file's copyright: {why} 파일의 저작권을 기록할 수 없습니다: {why} +@msg can't write the file's modification date: {why} 파일의 수정 날짜를 기록할 수 없습니다: {why} +@msg can't write the pages' user units: {why} 페이지의 사용자 단위를 기록할 수 없습니다: {why} +@msg canceled 취소됨 +@msg cannot convert the object to a primitive value 개체를 기본 값으로 변환할 수 없습니다 +@msg cannot convert undefined or null to an object undefined 또는 null은 개체로 변환할 수 없습니다 +@msg cannot distort a zero-size or non-finite bounding box 크기가 0이거나 유한하지 않은 테두리 상자는 왜곡할 수 없습니다 +@msg cannot move an object into itself 개체를 자기 자신 안으로 이동할 수 없습니다 +@msg case must be upper|lower|title|sentence case는 upper|lower|title|sentence여야 합니다 +@msg category `{c}`: one of {_1} category `{c}`: {_1} 중 하나여야 합니다 +@msg center must be [x, y] center는 [x, y]여야 합니다 +@msg character dimensions cannot be represented with the source text transform 원본 텍스트 변형으로는 문자 치수를 나타낼 수 없습니다 +@msg character dimensions cannot be represented with the target text transform 대상 텍스트 변형으로는 문자 치수를 나타낼 수 없습니다 +@msg choose at least one artboard 아트보드를 하나 이상 선택하세요 +@msg choose at least one status 상태를 하나 이상 선택하세요 +@msg clip must be true or false clip은 true 또는 false여야 합니다 +@msg clippingMask must be true or false clippingMask는 true 또는 false여야 합니다 +@msg closed must be a boolean closed는 부울이어야 합니다 +@msg collapsed must be true or false collapsed는 true 또는 false여야 합니다 +@msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile: “{profile}”(이)라는 RGB 또는 CMYK 프로파일이 없습니다 +@msg colorMode must be rgb or cmyk, not `{m}` colorMode는 rgb 또는 cmyk여야 합니다: `{m}` +@msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel은 {own}(문서의 모드), grayscale 또는 bitmap이어야 합니다 +@msg colour groups can't go into colour groups 색상 그룹은 색상 그룹 안에 넣을 수 없습니다 +@msg colour, mode and spot apply to solid-colour swatches only colour, mode, spot은 단색 견본에만 적용됩니다 +@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read {column}열: `{cell}`은(는) 그래프 데이터 파일의 `%` 열이며, 이 열은 읽지 않습니다 +@msg column {column}: `{cell}` names `{name}`, which is a {_1} variable {column}열: `{cell}`이(가) 가리키는 `{name}`은(는) {_1} 변수입니다 +@msg column {column}: `{cell}` names no variable {column}열: `{cell}`이(가) 가리키는 변수가 없습니다 +@msg column {column}: the variable name is longer than {MAX_NAME} characters {column}열: 변수 이름이 {MAX_NAME}자보다 깁니다 +@msg column: true floats the whole column and takes no onto, above or below column: true는 열 전체를 띄우며 onto, above, below와 함께 쓸 수 없습니다 +@msg command must be a shape.* command command는 shape.* 명령이어야 합니다 +@msg commands[{i}]: missing `command` commands[{i}]: `command`가 없습니다 +@msg composer must be "singleLine" or "everyLine" composer는 "singleLine" 또는 "everyLine"이어야 합니다 +@msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes 컴파운드 모양에는 패스, 컴파운드 패스, 그룹, 컴파운드 모양, 문자, 블렌드, 엔벨로프를 넣을 수 있습니다 +@msg compound {_1} must contain exactly one open path to join 컴파운드 {_1}에는 연결할 열린 패스가 정확히 하나 있어야 합니다 +@msg connect needs a path other than the one extended connect에는 연장한 패스가 아닌 다른 패스가 필요합니다 +@msg connect needs id connect에는 id가 필요합니다 +@msg connect path has no open end connect 패스에 열린 끝이 없습니다 +@msg continuation must be an array of path chunks continuation은 패스 조각의 배열이어야 합니다 +@msg continuation requires points continuation에는 points가 필요합니다 +@msg copy needs path: the file to copy into the document's folder copy에는 path가 필요합니다: 문서의 폴더에 복사할 파일입니다 +@msg copy takes images only: relink placed documents where their files are copy는 이미지에만 쓸 수 있습니다: 가져온 문서는 파일이 있는 위치로 다시 연결하세요 +@msg copying a file isn't available on the web 웹에서는 파일을 복사할 수 없습니다 +@msg copyrightStatus must be unknown, copyrighted or publicDomain copyrightStatus는 unknown, copyrighted 또는 publicDomain이어야 합니다 +@msg copyrightUrl must be a URL (no spaces, at most 2048 characters) copyrightUrl은 URL이어야 합니다(공백 없이 최대 2048자) +@msg corners must be 4 [x, y] points (TL, TR, BR, BL) corners는 [x, y] 점 4개여야 합니다(TL, TR, BR, BL) +@msg counterPer `{c}`: item or file counterPer `{c}`: item 또는 file이어야 합니다 +@msg crop `{_1}`: only PDF pages have art, trim, bleed and media boxes; use "crop" or "bounding" crop `{_1}`: art, trim, bleed, media 상자는 PDF 페이지에만 있습니다. "crop" 또는 "bounding"을 사용하세요 +@msg crop rectangle doesn't overlap the image 자르기 사각형이 이미지와 겹치지 않습니다 +@msg cross-reference and object streams aren't supported 상호 참조 스트림과 개체 스트림은 지원하지 않습니다 +@msg damaged compressed data: {e} 압축 데이터가 손상되었습니다: {e} +@msg dash lengths must be numbers, got {v} 대시 길이는 숫자여야 합니다({v} 입력됨) +@msg dash must be a list of lengths or null, got {v} dash는 길이 목록 또는 null이어야 합니다({v} 입력됨) +@msg data key `{k}`: letters, digits, -, _ and . (not name or vc-…) data 키 `{k}`: 글자, 숫자, -, _, .만 쓸 수 있습니다(name 또는 vc-…는 안 됨) +@msg data must be an object of key: value, not {v} data는 key: value로 이루어진 개체여야 합니다: {v} +@msg data set `{name}` holds a value for `{var}`, which the library doesn't declare 데이터 세트 `{name}`에 라이브러리가 선언하지 않은 `{var}`의 값이 있습니다 +@msg data set `{name}` holds two values for `{var}` 데이터 세트 `{name}`에 `{var}`의 값이 두 개 있습니다 +@msg data set `{name}` is declared twice 데이터 세트 `{name}`이(가) 두 번 선언되었습니다 +@msg data takes at most {MAX_DATA} keys at once data에는 한 번에 키를 최대 {MAX_DATA}개까지 넣을 수 있습니다 +@msg dataset `{name}` already exists 데이터 세트 `{name}`이(가) 이미 있습니다 +@msg dataset `{to}` already exists 데이터 세트 `{to}`이(가) 이미 있습니다 +@msg date `{d}`: YYYY-MM-DD date `{d}`: YYYY-MM-DD 형식이어야 합니다 +@msg decoded data is too large 디코딩한 데이터가 너무 큽니다 +@msg define a variable first 먼저 변수를 정의하세요 +@msg detect must be true or false detect는 true 또는 false여야 합니다 +@msg direct-select anchor points of a path 패스의 앵커 포인트를 직접 선택하세요 +@msg distance must be > 0 distance는 0보다 커야 합니다 +@msg dx and dy give the arrow's direction dx와 dy는 화살표의 방향을 지정합니다 +@msg dx and dy must be numbers dx와 dy는 숫자여야 합니다 +@msg dxf fitTo must be [width, height], positive dxf fitTo는 양수인 [width, height]여야 합니다 +@msg dxf must be an object of DXF import options dxf는 DXF 가져오기 옵션 개체여야 합니다 +@msg dxf scale must be a positive number up to {_1}, not {s} dxf scale은 {_1} 이하의 양수여야 합니다: {s} +@msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf unit `{u}`: mm, cm, in, pt 같은 단위여야 합니다 +@msg dxf: {e} dxf: {e} +@msg each format is an object {format, scale?, suffix?} 각 형식은 {format, scale?, suffix?} 개체입니다 +@msg each item needs an id 각 항목에는 id가 필요합니다 +@msg each match needs `kind` 각 일치 항목에는 `kind`가 필요합니다 +@msg each match needs a `name` 각 일치 항목에는 `name`이 필요합니다 +@msg each of `fonts` is {family, style?}; 1 to 1000 of them `fonts`의 각 항목은 {family, style?}이며 1개에서 1000개까지 지정합니다 +@msg each of `items` is {kind, item} `items`의 각 항목은 {kind, item}입니다 +@msg each of `items` is {{id, corners?}} with an object id, not {it} `items`의 각 항목은 개체 id가 있는 {{id, corners?}}입니다: {it} +@msg each path chunk must contain 1 to 4096 points 각 패스 조각에는 점이 1개에서 4096개 있어야 합니다 +@msg each pick is {{at: [x, y]}} or {{rect: [x0, y0, x1, y1]}} (got {v}) 각 선택은 {{at: [x, y]}} 또는 {{rect: [x0, y0, x1, y1]}}입니다({v} 입력됨) +@msg each row needs `from` 각 행에는 `from`이 필요합니다 +@msg each stop needs a position 각 정지점에는 위치가 필요합니다 +@msg each subpath needs an anchors array 각 하위 패스에는 anchors 배열이 필요합니다 +@msg each weight must be a number of 0 or more (got {v}) 각 가중치는 0 이상의 숫자여야 합니다({v} 입력됨) +@msg easingType must be easeIn, easeOut, easeInOut or easeOutIn easingType은 easeIn, easeOut, easeInOut 또는 easeOutIn이어야 합니다 +@msg editingData must be true or false editingData는 true 또는 false여야 합니다 +@msg editingData must be true, false or "always" editingData는 true, false 또는 "always"여야 합니다 +@msg edits overlap 편집 범위가 겹칩니다 +@msg effects of objects whose appearances differ can't be moved together 모양새가 서로 다른 개체의 효과는 함께 이동할 수 없습니다 +@msg empty header in column {_1} {_1}열의 머리글이 비어 있습니다 +@msg encoding `{_1}`: utf8 or utf16 encoding `{_1}`: utf8 또는 utf16이어야 합니다 +@msg ends must be two of "first" and "last" ends는 "first"와 "last" 중에서 고른 두 개여야 합니다 +@msg every numbered name for the result is taken 결과에 붙일 번호 이름이 모두 사용 중입니다 +@msg expanded SVG styles exceed the import size limit 확장한 SVG 스타일이 가져오기 크기 한도를 넘습니다 +@msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes 내보내기 사전 설정 파일이 {MAX_PRESET_FILE_BYTES}바이트보다 큽니다 +@msg exportText must be editable or appearance exportText는 editable 또는 appearance여야 합니다 +@msg exportType must be movieClip or graphic, not `{s}` exportType은 movieClip 또는 graphic이어야 합니다: `{s}` +@msg extend needs id extend에는 id가 필요합니다 +@msg featureChanges lists at most {MAX_FEATURE_CHANGES} tags featureChanges에는 태그를 최대 {MAX_FEATURE_CHANGES}개까지 나열할 수 있습니다 +@msg featureChanges must be a list of tags featureChanges는 태그 목록이어야 합니다 +@msg features must be a list of tags features는 태그 목록이어야 합니다 +@msg fidelity must be 0..100 fidelity는 0..100이어야 합니다 +@msg files must be {name, dataBase64} files는 {name, dataBase64}여야 합니다 +@msg finally table {t} out of range finally 테이블 {t}이(가) 범위를 벗어났습니다 +@msg fit must be none|autoHeight|shrinkText|block, got {id} fit은 none|autoHeight|shrinkText|block이어야 합니다({id} 입력됨) +@msg flags cannot be given with a RegExp object RegExp 개체와 함께 플래그를 지정할 수 없습니다 +@msg flattener: {e} 병합: {e} +@msg flattenerPreset `{name}`: high, medium, low or a saved one (see flattener.presets.list) flattenerPreset `{name}`: high, medium, low 또는 저장된 사전 설정이어야 합니다(flattener.presets.list 참조) +@msg flipProfile must be along|across, got {o} flipProfile은 along|across여야 합니다({o} 입력됨) +@msg folders `{f}`: none, rows, format, item or itemFormat folders `{f}`: none, rows, format, item 또는 itemFormat이어야 합니다 +@msg folders deeper than {MAX_BATCH_DEPTH} levels 폴더가 {MAX_BATCH_DEPTH}단계보다 깊습니다 +@msg folders deeper than {MAX_DEPTH} levels 폴더가 {MAX_DEPTH}단계보다 깊습니다 +@msg font family `{family}` is not available 글꼴 모음 `{family}`을(를) 사용할 수 없습니다 +@msg font family `{tf}` is not available 글꼴 모음 `{tf}`을(를) 사용할 수 없습니다 +@msg format `{f}`: pdf or postscript format `{f}`: pdf 또는 postscript여야 합니다 +@msg format `{f}`: text or json format `{f}`: text 또는 json이어야 합니다 +@msg format is `{format}` format은 `{format}`입니다 +@msg formats must be an array of rows, not {v} formats는 행의 배열이어야 합니다: {v} +@msg frequency must be between 1 and 300 lines per inch frequency는 인치당 1줄에서 300줄 사이여야 합니다 +@msg from and to must be finite from과 to는 유한해야 합니다 +@msg from must be [x0, y0, x1, y1] from은 [x0, y0, x1, y1]이어야 합니다 +@msg function declaration index out of range 함수 선언 인덱스가 범위를 벗어났습니다 +@msg give `before` or `after`, not both `before`와 `after` 중 하나만 지정하세요 +@msg give `char`, `text`, `code` or `unicode` `char`, `text`, `code` 또는 `unicode`를 지정하세요 +@msg give `colors`, or `color` and `rule` `colors`를 지정하거나 `color`와 `rule`을 지정하세요 +@msg give `count` or `spacing`, not both `count`와 `spacing` 중 하나만 지정하세요 +@msg give `event`, such as onclick onclick 같은 `event`를 지정하세요 +@msg give `file`, the JavaScript file's path or URL JavaScript 파일의 경로나 URL인 `file`을 지정하세요 +@msg give `fill` and/or `stroke` `fill`이나 `stroke`, 또는 둘 다 지정하세요 +@msg give `fill`, `stroke` or both `fill`이나 `stroke`, 또는 둘 다 지정하세요 +@msg give `folder` `folder`를 지정하세요 +@msg give `fonts`, or open a document `fonts`를 지정하거나 문서를 여세요 +@msg give `from` or `indices`, not both `from`과 `indices` 중 하나만 지정하세요 +@msg give `id` (no text is being edited) `id`를 지정하세요(편집 중인 텍스트가 없습니다) +@msg give `id` and `anchors`, or `items`, not both `id`와 `anchors`를 지정하거나 `items`를 지정하세요. 둘 다 지정할 수는 없습니다 +@msg give `id` or `guide`, not both `id`와 `guide` 중 하나만 지정하세요 +@msg give `length` or `to` `length` 또는 `to`를 지정하세요 +@msg give `matches`: [{kind, name, target}] `matches`를 지정하세요: [{kind, name, target}] +@msg give `name` (or edit a pattern) `name`을 지정하세요(또는 패턴을 편집하세요) +@msg give `name` or `names` `name` 또는 `names`를 지정하세요 +@msg give `name`, an SVG filter's name SVG 필터의 이름인 `name`을 지정하세요 +@msg give `path` (a .wasm file) or `dataBase64` (the module) `path`(.wasm 파일) 또는 `dataBase64`(모듈)를 지정하세요 +@msg give `path`, `data` or `dataBase64` `path`, `data` 또는 `dataBase64`를 지정하세요 +@msg give `path`, `data`, `dataBase64` or `csv` `path`, `data`, `dataBase64` 또는 `csv`를 지정하세요 +@msg give `path`, `xml` or `dataBase64` `path`, `xml` 또는 `dataBase64`를 지정하세요 +@msg give `path`, an SVG file, or `svg`, SVG text SVG 파일인 `path` 또는 SVG 텍스트인 `svg`를 지정하세요 +@msg give `script`, the JavaScript the event runs ("" removes the event) 이벤트가 실행할 JavaScript인 `script`를 지정하세요(""는 이벤트를 제거합니다) +@msg give `text` (the reading) or `remove` `text`(읽는 법) 또는 `remove`를 지정하세요 +@msg give `x` and `y` (and a `tolerance` of 0 or more) `x`와 `y`를 지정하세요(`tolerance`는 0 이상) +@msg give `xml`, one SVG element SVG 요소 하나인 `xml`을 지정하세요 +@msg give a mode or r/g/b, c/m/y/k, gray or tint adjustments mode를 지정하거나 r/g/b, c/m/y/k, gray 또는 tint 조정값을 지정하세요 +@msg give a name, or paint the active proxy with a saved preset 이름을 지정하거나 활성 프록시를 저장된 사전 설정으로 칠하세요 +@msg give a name, or select a stroke with a saved profile 이름을 지정하거나 저장된 프로파일이 있는 선을 선택하세요 +@msg give a pattern name or select an object painted with a pattern 패턴 이름을 지정하거나 패턴으로 칠한 개체를 선택하세요 +@msg give at least one of clip, invert, disabled, linked clip, invert, disabled, linked 중 하나 이상을 지정하세요 +@msg give color, none, swatch or gradient color, none, swatch 또는 gradient를 지정하세요 +@msg give dataBase64 dataBase64를 지정하세요 +@msg give either at (a click) or area (a path drawn around the overlaps) at(클릭) 또는 area(겹친 부분 둘레에 그린 패스) 중 하나를 지정하세요 +@msg give exactly one of `at`, `rect` and `points` `at`, `rect`, `points` 중 정확히 하나를 지정하세요 +@msg give exactly one of `path`, `data` and `dataBase64` `path`, `data`, `dataBase64` 중 정확히 하나를 지정하세요 +@msg give formats or a preset, not both formats와 사전 설정 중 하나만 지정하세요 +@msg give index or indexes, not both index와 indexes 중 하나만 지정하세요 +@msg give newName or delete newName 또는 delete를 지정하세요 +@msg give offset or by offset 또는 by를 지정하세요 +@msg give one element 요소 하나를 지정하세요 +@msg give one of `to`, `rect` or `at` `to`, `rect`, `at` 중 하나를 지정하세요 +@msg give one of assets, layers, selection or fullDocument assets, layers, selection, fullDocument 중 하나를 지정하세요 +@msg give only one of onto, above, below, icon and a column place onto, above, below, icon, 열 위치 중 하나만 지정하세요 +@msg give opacity or blend opacity 또는 blend를 지정하세요 +@msg give origin: [x, y], or reset: true origin: [x, y] 또는 reset: true를 지정하세요 +@msg give overprintFill, overprintStroke, showCenter, imageMap, url or note overprintFill, overprintStroke, showCenter, imageMap, url 또는 note를 지정하세요 +@msg give path (a file) or folder path(파일) 또는 folder를 지정하세요 +@msg give path, or name and dataBase64 path를 지정하거나 name과 dataBase64를 지정하세요 +@msg give paths or files paths 또는 files를 지정하세요 +@msg give rows, rowHeight, columns or columnWidth rows, rowHeight, columns 또는 columnWidth를 지정하세요 +@msg give svg, or dataBase64 of an SVG or SVGZ file svg를 지정하거나 SVG 또는 SVGZ 파일의 dataBase64를 지정하세요 +@msg give text text를 지정하세요 +@msg give the asset a name 에셋에 이름을 지정하세요 +@msg give the preset a `name` 사전 설정에 `name`을 지정하세요 +@msg give the preset a name 사전 설정에 이름을 지정하세요 +@msg give the preset a name (1–64 characters) 사전 설정에 이름을 지정하세요(1–64자) +@msg give the settings to change, e.g. {"formats"}]} 변경할 설정을 지정하세요(예: {"formats"}]}) +@msg give the style a name 스타일에 이름을 지정하세요 +@msg give two or more style `names` 스타일 `names`를 두 개 이상 지정하세요 +@msg give two or more swatches 견본을 두 개 이상 지정하세요 +@msg give x, y, or a handle's length or angle x, y 또는 핸들의 길이나 각도를 지정하세요 +@msg give {key, value} or {values} {key, value} 또는 {values}를 지정하세요 +@msg global must be true or false global은 true 또는 false여야 합니다 +@msg glyph {_1} is not drawn for {ch} with the character's style (such as All Caps, Small Caps or a numeral system) 글자의 스타일(예: 모두 대문자, 작은 대문자 또는 숫자 체계)에서는 {ch}에 글리프 {_1}을(를) 그리지 않습니다 +@msg glyph {g} is not an alternate of {ch} in {_1} {_2} 글리프 {g}은(는) {_1} {_2}에서 {ch}의 대체 글리프가 아닙니다 +@msg gradient must be "objects" or "mesh" gradient는 "objects" 또는 "mesh"여야 합니다 +@msg grays must be "profile" or "black", not `{g}` grays는 "profile" 또는 "black"이어야 합니다: `{g}` +@msg gridColors must be a preset name or two colours gridColors는 사전 설정 이름 또는 색상 두 개여야 합니다 +@msg gridSize must be small, medium or large gridSize는 small, medium 또는 large여야 합니다 +@msg guide {g} is not selected 안내선 {g}이(가) 선택되어 있지 않습니다 +@msg handle must be 0..3 handle은 0..3이어야 합니다 +@msg handler at {_1} expects {_2} values but its range starts with {d} {_1}의 처리기는 값 {_2}개가 필요하지만 그 범위는 {d}개로 시작합니다 +@msg handler depth too large 처리기 깊이가 너무 큽니다 +@msg handler range {_1}..{_2} out of range 처리기 범위 {_1}..{_2}이(가) 범위를 벗어났습니다 +@msg hiddenLayers must be true or false hiddenLayers는 true 또는 false여야 합니다 +@msg hiddenObjects {v}: "layer" (the default), "omit" or "visible" hiddenObjects {v}: "layer"(기본값), "omit" 또는 "visible"이어야 합니다 +@msg highlight a layer to merge into 병합해 넣을 레이어를 강조 표시하세요 +@msg highlight two or more rows in one layer or group 한 레이어나 그룹에서 행을 두 개 이상 강조 표시하세요 +@msg highlight two or more rows to merge 병합할 행을 두 개 이상 강조 표시하세요 +@msg hvcC hvcC +@msg icon docks a panel in the icon column: use window.panel.dock icon은 패널을 아이콘 열에 도킹합니다: window.panel.dock을 사용하세요 +@msg id must be a dimension id id는 치수 id여야 합니다 +@msg image has no bounds 이미지에 경계가 없습니다 +@msg image {_1} is linked already 이미지 {_1}은(는) 이미 연결되어 있습니다 +@msg imageMap `{m}`: none, client or server imageMap `{m}`: none, client 또는 server여야 합니다 +@msg images in a spot ink whose samples couldn't be read were imported in RGB 샘플을 읽을 수 없는 별색 잉크 이미지는 RGB로 가져왔습니다 +@msg images past the most pixels one file may hold were left out 파일 하나에 담을 수 있는 최대 픽셀 수를 넘는 이미지는 제외되었습니다 +@msg images too large to read were left out 너무 커서 읽을 수 없는 이미지는 제외되었습니다 +@msg index out of range 인덱스가 범위를 벗어났습니다 +@msg indexes may hold at most {MAX_GUIDE_INDEXES} entries indexes에는 항목을 최대 {MAX_GUIDE_INDEXES}개까지 넣을 수 있습니다 +@msg indexes must be an array of guide indexes indexes는 안내선 인덱스의 배열이어야 합니다 +@msg instances must be 1..1000 instances는 1..1000이어야 합니다 +@msg instruction out of range 명령이 범위를 벗어났습니다 +@msg instruction {pc} ({op}) pops below the stack 명령 {pc}({op})이(가) 스택 바닥 아래에서 값을 꺼냅니다 +@msg instruction {pc} reached with stack depths {seen} and {d} 명령 {pc}에 스택 깊이 {seen}와(과) {d}(으)로 도달했습니다 +@msg invalid `color` 잘못된 `color` +@msg invalid anchor index {v}: expected a non-negative integer 잘못된 앵커 인덱스 {v}: 음이 아닌 정수여야 합니다 +@msg invalid anchor reference {v}: expected [subpath, anchor] 잘못된 앵커 참조 {v}: [subpath, anchor]여야 합니다 +@msg invalid angle 잘못된 각도 +@msg invalid array length 잘못된 배열 길이 +@msg invalid brush: {e} 잘못된 브러시: {e} +@msg invalid color 잘못된 색상 +@msg invalid colour {c} 잘못된 색상 {c} +@msg invalid delta 잘못된 델타 +@msg invalid group 잘못된 그룹 +@msg invalid object id {v}: expected a non-negative integer 잘못된 개체 id {v}: 음이 아닌 정수여야 합니다 +@msg invalid point 잘못된 점 +@msg invalid regular expression flag '{_1}' 잘못된 정규식 플래그 '{_1}' +@msg invalid regular expression: {m} 잘못된 정규식: {m} +@msg invalid size 잘못된 크기 +@msg invalid t 잘못된 t +@msg invalid time value 잘못된 시간 값 +@msg invalid tolerance 잘못된 허용치 +@msg is a confirm's answer, whose `value` must be true or false confirm의 응답이며 `value`은(는) true 또는 false여야 합니다 +@msg is a prompt's answer, whose `value` must be a string or null prompt의 응답이며 `value`은(는) 문자열 또는 null이어야 합니다 +@msg is an alert's answer, whose `value` must be "ok" alert의 응답이며 `value`은(는) "ok"여야 합니다 +@msg is longer than 16 KiB 16 KiB보다 깁니다 +@msg it draws its image through a clipping path 이미지를 클리핑 패스를 통해 그립니다 +@msg it draws no image 이미지를 그리지 않습니다 +@msg it is larger than {MAX_DICTIONARY_FILE_BYTES} bytes {MAX_DICTIONARY_FILE_BYTES}바이트보다 큽니다 +@msg it isn't a file 파일이 아닙니다 +@msg it names {_1} plates, and at most {MAX_PLATES} are read 색판 {_1}개를 지정하지만 최대 {MAX_PLATES}개까지만 읽습니다 +@msg its art is too long or too detailed for a head 아트웍이 화살촉으로 쓰기에는 너무 길거나 세밀합니다 +@msg its art paints nothing 아트웍이 아무것도 칠하지 않습니다 +@msg its artboards all lie beyond the canvas (more than {_1} pt from the origin) 아트보드가 모두 캔버스 밖에 있습니다(원점에서 {_1} pt 넘게 떨어져 있음) +@msg its clipping masks are nested too deeply 클리핑 마스크가 너무 깊게 중첩되어 있습니다 +@msg its image is too large to read 이미지가 너무 커서 읽을 수 없습니다 +@msg its metadata has no description 메타데이터에 설명이 없습니다 +@msg its metadata has no direct length 메타데이터에 직접 길이가 없습니다 +@msg its plates are too large: more than {MAX_SAMPLES} pixels together 색판이 너무 큽니다: 모두 합쳐 {MAX_SAMPLES} 픽셀을 넘습니다 +@msg its plates are too large: {_1} plates of {w} × {h} pixels 색판이 너무 큽니다: {w} × {h} 픽셀 색판 {_1}개 +@msg its plates can't be kept together 색판을 함께 보관할 수 없습니다 +@msg its shapes could not be combined into one 모양을 하나로 결합할 수 없습니다 +@msg join two different paths 서로 다른 두 패스를 연결하세요 +@msg jump to {pc}, past the end 끝을 지나 {pc}(으)로 점프합니다 +@msg justify must be auto|left|center|right|justifyAll justify는 auto|left|center|right|justifyAll이어야 합니다 +@msg kbps must be a positive number, not {kbps} kbps는 양수여야 합니다: {kbps} +@msg keywords must be a list of words or a comma-separated string keywords는 단어 목록이거나 쉼표로 구분한 문자열이어야 합니다 +@msg keywords must be at most {MAX_KEYWORD} characters, without control characters keywords는 제어 문자 없이 최대 {MAX_KEYWORD}자여야 합니다 +@msg kind must be 1, 2 or 3, or give a preset `name` (see perspective.presets.list) kind는 1, 2 또는 3이어야 합니다. 아니면 사전 설정 `name`을 지정하세요(perspective.presets.list 참조) +@msg kind must be graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle or paraStyle kind는 graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle 또는 paraStyle이어야 합니다 +@msg knockout must be "on", "off", "neutral" or a bool, not {v} knockout은 "on", "off", "neutral" 또는 부울이어야 합니다: {v} +@msg layer `{name}` has no art to export 레이어 `{name}`에 내보낼 아트웍이 없습니다 +@msg layer must name a layer or sublayer layer에는 레이어나 하위 레이어를 지정해야 합니다 +@msg layers can't be intertwined: select the objects in them 레이어는 교차할 수 없습니다: 레이어 안의 개체를 선택하세요 +@msg layers go only at the top level or in layers, objects in layers and groups 레이어는 최상위나 레이어 안에만, 개체는 레이어와 그룹 안에만 둘 수 있습니다 +@msg layers must be true or false layers는 true 또는 false여야 합니다 +@msg layout must be gridByRow, gridByColumn, row or column layout은 gridByRow, gridByColumn, row 또는 column이어야 합니다 +@msg leading must be a number or "auto" leading은 숫자 또는 "auto"여야 합니다 +@msg left/right must be non-negative widths left/right는 음이 아닌 너비여야 합니다 +@msg legacyNameEncoding must be one of {_1} legacyNameEncoding은 {_1} 중 하나여야 합니다 +@msg level `{t}`: 2 or 3 level `{t}`: 2 또는 3이어야 합니다 +@msg line {line}: more than {MAX_CSV_COLS} columns {line}행: 열이 {MAX_CSV_COLS}개보다 많습니다 +@msg line {line}: unclosed quote {line}행: 따옴표가 닫히지 않았습니다 +@msg line {line}: value for `{var}` must match its variable kind {line}행: `{var}`의 값은 변수 종류와 맞아야 합니다 +@msg lineEndings `{other}`: lf or crlf lineEndings `{other}`: lf 또는 crlf여야 합니다 +@msg loading profiles from disk isn't available in the browser 브라우저에서는 디스크에서 프로파일을 불러올 수 없습니다 +@msg localize: the first argument must be a localization object or a string localize: 첫 번째 인수는 지역화 개체 또는 문자열이어야 합니다 +@msg margin: a {m} pt margin leaves no imageable area on the paper margin: 여백이 {m} pt이면 용지에 인쇄 가능 영역이 남지 않습니다 +@msg matrix must be finite and invertible, depth finite matrix는 유한하고 역행렬이 있어야 하며 depth는 유한해야 합니다 +@msg matte: {e} matte: {e} +@msg member is for order front, forward, backward or back member는 order가 front, forward, backward 또는 back일 때 씁니다 +@msg missing `artboards` `artboards`가 없습니다 +@msg missing `at` [x, y] `at` [x, y]가 없습니다 +@msg missing `attrs` `attrs`가 없습니다 +@msg missing `color` or `opacity` `color` 또는 `opacity`가 없습니다 +@msg missing `colors` `colors`가 없습니다 +@msg missing `commands` `commands`가 없습니다 +@msg missing `destinationFolder` `destinationFolder`가 없습니다 +@msg missing `effect` id `effect` id가 없습니다 +@msg missing `family` `family`가 없습니다 +@msg missing `find` `find`가 없습니다 +@msg missing `gid` (a glyph id, or null for the default glyph) `gid`가 없습니다(글리프 id, 기본 글리프는 null) +@msg missing `group` `group`이 없습니다 +@msg missing `id` `id`가 없습니다 +@msg missing `id`: give one, or select one type object `id`가 없습니다: id를 지정하거나 문자 개체 하나를 선택하세요 +@msg missing `index` (a point index, or null to clear) `index`가 없습니다(점 인덱스, 지우려면 null) +@msg missing `index` (a stop index, or null to clear) `index`가 없습니다(정지점 인덱스, 지우려면 null) +@msg missing `index` (an item index or null) `index`가 없습니다(항목 인덱스 또는 null) +@msg missing `item` `item`이 없습니다 +@msg missing `library` `library`가 없습니다 +@msg missing `library` (see graphicStyle.libraries) `library`가 없습니다(graphicStyle.libraries 참조) +@msg missing `library` (see swatch.library.list) `library`가 없습니다(swatch.library.list 참조) +@msg missing `map` (rows [{from, to}] or {current}) `map`이 없습니다(행 [{from, to}] 또는 {current}) +@msg missing `matrix` [a,b,c,d,e,f] `matrix` [a,b,c,d,e,f]가 없습니다 +@msg missing `name` (see gradient.presets.list) `name`이 없습니다(gradient.presets.list 참조) +@msg missing `offset` (a distance in points) `offset`이 없습니다(포인트 단위 거리) +@msg missing `path` `path`가 없습니다 +@msg missing `path` (a path object id) `path`가 없습니다(패스 개체 id) +@msg missing `picks` `picks`가 없습니다 +@msg missing `rule` `rule`이 없습니다 +@msg missing `source` id `source` id가 없습니다 +@msg missing `start` (the byte offset of a character) `start`가 없습니다(글자의 바이트 오프셋) +@msg missing `status`: linked, embedded, missing or modified `status`가 없습니다: linked, embedded, missing 또는 modified +@msg missing `target` id `target` id가 없습니다 +@msg missing `text` `text`가 없습니다 +@msg missing `to` `to`가 없습니다 +@msg missing `to` (an index) `to`가 없습니다(인덱스) +@msg missing `to`: a non-negative integer `to`가 없습니다: 음이 아닌 정수 +@msg missing `type` `type`이 없습니다 +@msg missing `value` `value`가 없습니다 +@msg missing `word` `word`가 없습니다 +@msg missing `{key}` `{key}`이(가) 없습니다 +@msg missing `{k}` `{k}`이(가) 없습니다 +@msg missing anchor 앵커가 없습니다 +@msg missing anchors anchors가 없습니다 +@msg missing anchors [[subpath, anchor]…] anchors [[subpath, anchor]…]가 없습니다 +@msg missing array `{key}` 배열 `{key}`이(가) 없습니다 +@msg missing case case가 없습니다 +@msg missing color color가 없습니다 +@msg missing commands commands가 없습니다 +@msg missing destination folder 대상 폴더가 없습니다 +@msg missing from from이 없습니다 +@msg missing group group이 없습니다 +@msg missing id or ids id 또는 ids가 없습니다 +@msg missing ids ids가 없습니다 +@msg missing indexes indexes가 없습니다 +@msg missing matrix [a,b,c,d,e,f] matrix [a,b,c,d,e,f]가 없습니다 +@msg missing name name이 없습니다 +@msg missing op op가 없습니다 +@msg missing or invalid `color` `color`가 없거나 잘못되었습니다 +@msg missing or unknown `tool` `tool`이 없거나 알 수 없는 값입니다 +@msg missing point 점이 없습니다 +@msg missing point [x,y] 점 [x,y]가 없습니다 +@msg missing point `{key}` ([x, y]) 점 `{key}`([x, y])이(가) 없습니다 +@msg missing points points가 없습니다 +@msg missing points [[x,y]…] points [[x,y]…]가 없습니다 +@msg missing segment 세그먼트가 없습니다 +@msg missing stops stops가 없습니다 +@msg missing subpaths subpaths가 없습니다 +@msg missing target target이 없습니다 +@msg missing to to가 없습니다 +@msg missing x, y x, y가 없습니다 +@msg mode is set, add or toggle, not `{other}` mode는 set, add 또는 toggle입니다: `{other}` +@msg mode must be "cmyk" or "rgb" mode는 "cmyk" 또는 "rgb"여야 합니다 +@msg mode must be area|onPath, got {o} mode는 area|onPath여야 합니다({o} 입력됨) +@msg more than 10000 linked files: package dependencies in smaller parts 연결된 파일이 10000개보다 많습니다: 종속 파일을 더 작게 나누어 패키지하세요 +@msg more than 256 commands 명령이 256개보다 많습니다 +@msg more than {MAX_BATCH_FILES} data sets 데이터 세트가 {MAX_BATCH_FILES}개보다 많습니다 +@msg more than {MAX_BATCH_FILES} files 파일이 {MAX_BATCH_FILES}개보다 많습니다 +@msg more than {MAX_CSV_ROWS} data rows 데이터 행이 {MAX_CSV_ROWS}개보다 많습니다 +@msg more than {MAX_FILES} images 이미지가 {MAX_FILES}개보다 많습니다 +@msg more than {MAX_IMPORT} presets 사전 설정이 {MAX_IMPORT}개보다 많습니다 +@msg moved must be [[x,y]…] moved는 [[x,y]…]여야 합니다 +@msg must be an object with `kind` and `value` `kind`와 `value`가 있는 개체여야 합니다 +@msg must have `kind` alert, confirm or prompt `kind`가 alert, confirm 또는 prompt여야 합니다 +@msg must have exactly `kind` and `value` `kind`와 `value`만 있어야 합니다 +@msg name (a toolbar's name) is required name(도구 막대 이름)이 필요합니다 +@msg name (a toolbar's name) must be a string name(도구 막대 이름)은 문자열이어야 합니다 +@msg name must be a toolbar's name name은 도구 막대 이름이어야 합니다 +@msg names is empty names가 비어 있습니다 +@msg names must be an array of symbol names names는 심볼 이름의 배열이어야 합니다 +@msg need `anchor` or `segment` + `t` `anchor` 또는 `segment` + `t`가 필요합니다 +@msg need at least one anchor 앵커가 하나 이상 필요합니다 +@msg need at least one point 점이 하나 이상 필요합니다 +@msg need at least two points 점이 두 개 이상 필요합니다 +@msg needs a closing quote after the name 이름 뒤에 닫는 따옴표가 필요합니다 +@msg needs a name 이름이 필요합니다 +@msg needs a name of at most 64 bytes 최대 64바이트의 이름이 필요합니다 +@msg needs a name of letters, digits and _, or a quoted name 글자, 숫자, _로 이루어진 이름이나 따옴표로 묶은 이름이 필요합니다 +@msg needs a name without control characters 제어 문자가 없는 이름이 필요합니다 +@msg needs points points가 필요합니다 +@msg nesting too deep 중첩이 너무 깊습니다 +@msg nineSlice must be true or false nineSlice는 true 또는 false여야 합니다 +@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides는 [left, top, right, bottom]이어야 하고, 각 값은 -16..16이며 left + right < 1, top + bottom < 1이어야 합니다 +@msg no HP-GL format HP-GL 형식이 없습니다 +@msg no New Document profile called `{shown}` ({_1}) `{shown}`(이)라는 새 문서 프로파일이 없습니다({_1}) +@msg no PDF preset named `{n}` `{n}` PDF 사전 설정이 없습니다 +@msg no SVG filter at index {k} 인덱스 {k}에 SVG 필터가 없습니다 +@msg no action set is current 현재 액션 세트가 없습니다 +@msg no active data set 활성 데이터 세트가 없습니다 +@msg no appearance item {index} 모양새 항목 {index}이(가) 없습니다 +@msg no arrowheads file here 여기에는 화살촉 파일이 없습니다 +@msg no artboard {_1} 아트보드 {_1}이(가) 없습니다 +@msg no artboard {artboard} (0-based; the document has {_1}) 아트보드 {artboard}이(가) 없습니다(0부터 시작, 문서의 아트보드 수: {_1}) +@msg no asset {id} 에셋 {id}이(가) 없습니다 +@msg no asset {id} (see assets.list) 에셋 {id}이(가) 없습니다(assets.list 참조) +@msg no assets to export 내보낼 에셋이 없습니다 +@msg no assets yet: collect art for export first (assets.add) 아직 에셋이 없습니다: 먼저 내보낼 아트웍을 수집하세요(assets.add) +@msg no brush named `{n}` `{n}` 브러시가 없습니다 +@msg no character at byte {start} 바이트 {start}에 글자가 없습니다 +@msg no character has code {code} 코드가 {code}인 글자가 없습니다 +@msg no colour 색상이 없습니다 +@msg no colour group `{group}` 색상 그룹 `{group}`이(가) 없습니다 +@msg no colour group `{name}` 색상 그룹 `{name}`이(가) 없습니다 +@msg no custom arrowhead {name} (see stroke.arrowheads.list) 사용자 정의 화살촉 {name}이(가) 없습니다(stroke.arrowheads.list 참조) +@msg no data sets 데이터 세트가 없습니다 +@msg no dataset named `{from}` `{from}` 데이터 세트가 없습니다 +@msg no dataset named `{name}` `{name}` 데이터 세트가 없습니다 +@msg no datasets 데이터 세트가 없습니다 +@msg no design named `{name}` `{name}` 디자인이 없습니다 +@msg no design named `{n}` `{n}` 디자인이 없습니다 +@msg no design named `{old}` `{old}` 디자인이 없습니다 +@msg no encoder for {_1} yet 아직 {_1} 인코더가 없습니다 +@msg no export preset `{name}` (see document.exportPresets.list) 내보내기 사전 설정 `{name}`이(가) 없습니다(document.exportPresets.list 참조) +@msg no file to open 열 파일이 없습니다 +@msg no folder: pass `path` or set Preferences › Plug-ins & Scratch Disks › Additional Plug-ins Folder 폴더가 없습니다: `path`를 전달하거나 환경 설정 › 플러그인 & 스크래치 디스크 › 추가 플러그인 폴더를 설정하세요 +@msg no fonts to look for: they are all available 찾을 글꼴이 없습니다: 모든 글꼴을 사용할 수 있습니다 +@msg no formats to export 내보낼 형식이 없습니다 +@msg no gradient preset `{name}` (see gradient.presets.list) 그레이디언트 사전 설정 `{name}`이(가) 없습니다(gradient.presets.list 참조) +@msg no graphic style `{n}` in `{_1}` `{_1}`에 그래픽 스타일 `{n}`이(가) 없습니다 +@msg no graphic style library `{key}` (see graphicStyle.libraries) 그래픽 스타일 라이브러리 `{key}`이(가) 없습니다(graphicStyle.libraries 참조) +@msg no guide selected 선택한 안내선이 없습니다 +@msg no guide selected (or give an index) 선택한 안내선이 없습니다(또는 인덱스를 지정하세요) +@msg no guide {i} 안내선 {i}이(가) 없습니다 +@msg no images in the folder 폴더에 이미지가 없습니다 +@msg no instructions 명령이 없습니다 +@msg no item at index {_1} 인덱스 {_1}에 항목이 없습니다 +@msg no item at index {from} 인덱스 {from}에 항목이 없습니다 +@msg no item at one of the indices {idx} 인덱스 {idx} 중 하나에 항목이 없습니다 +@msg no layer 레이어가 없습니다 +@msg no layer to rename 이름을 바꿀 레이어가 없습니다 +@msg no layer {id} (see layer.list) 레이어 {id}이(가) 없습니다(layer.list 참조) +@msg no layers to export 내보낼 레이어가 없습니다 +@msg no library `{key}` 라이브러리 `{key}`이(가) 없습니다 +@msg no metafile format 메타파일 형식이 없습니다 +@msg no object {_1} 개체 {_1}이(가) 없습니다 +@msg no objects 개체가 없습니다 +@msg no parent layer 상위 레이어가 없습니다 +@msg no perspective grid preset named `{b}` (see perspective.presets.list) `{b}` 원근 격자 사전 설정이 없습니다(perspective.presets.list 참조) +@msg no perspective grid preset named `{n}` `{n}` 원근 격자 사전 설정이 없습니다 +@msg no point selected (give `index`) 선택한 점이 없습니다(`index`를 지정하세요) +@msg no preset called `{from}` (see file.newPresets) `{from}` 사전 설정이 없습니다(file.newPresets 참조) +@msg no preset called `{name}` (see file.newPresets) `{name}` 사전 설정이 없습니다(file.newPresets 참조) +@msg no preset named `{n}` `{n}` 사전 설정이 없습니다 +@msg no print preset named `{b}` (see print.presets.list) `{b}` 인쇄 사전 설정이 없습니다(print.presets.list 참조) +@msg no print preset named `{name}` (presets: {_1}) `{name}` 인쇄 사전 설정이 없습니다(사전 설정: {_1}) +@msg no print preset named `{n}` `{n}` 인쇄 사전 설정이 없습니다 +@msg no profile named `{name}` `{name}` 프로파일이 없습니다 +@msg no random numbers ({e}) 난수를 얻을 수 없습니다({e}) +@msg no readable files in the folder 폴더에 읽을 수 있는 파일이 없습니다 +@msg no recovery copy `{f}` (see file.recovery.list) 복구 복사본 `{f}`이(가) 없습니다(file.recovery.list 참조) +@msg no rows 행이 없습니다 +@msg no saved PDF preset named `{name}` `{name}`(이)라는 저장된 PDF 사전 설정이 없습니다 +@msg no saved export preset `{name}` 저장된 내보내기 사전 설정 `{name}`이(가) 없습니다 +@msg no saved gradient preset called {name} {name}(이)라는 저장된 그레이디언트 사전 설정이 없습니다 +@msg no saved gradient presets 저장된 그레이디언트 사전 설정이 없습니다 +@msg no saved preset called `{name}` `{name}`(이)라는 저장된 사전 설정이 없습니다 +@msg no saved presets to export (name [Default] in `names` to export it) 내보낼 저장된 사전 설정이 없습니다([Default]를 내보내려면 `names`에 지정하세요) +@msg no saved presets to export (name built-in ones in `names`) 내보낼 저장된 사전 설정이 없습니다(기본 제공 사전 설정은 `names`에 지정하세요) +@msg no saved print preset named `{name}` `{name}`(이)라는 저장된 인쇄 사전 설정이 없습니다 +@msg no saved profile called {name} {name}(이)라는 저장된 프로파일이 없습니다 +@msg no saved selection `{name}` 저장된 선택 영역 `{name}`이(가) 없습니다 +@msg no saved theme called {name} (see colorTheme.list) {name}(이)라는 저장된 테마가 없습니다(colorTheme.list 참조) +@msg no saved views 저장된 보기가 없습니다 +@msg no selected or given object has a visible 3D effect 선택하거나 지정한 개체 중에 보이는 3D 효과가 있는 개체가 없습니다 +@msg no series {i} 계열 {i}이(가) 없습니다 +@msg no slice {n} in the image (see slice.list) 이미지에 슬라이스 {n}이(가) 없습니다(slice.list 참조) +@msg no source art 원본 아트웍이 없습니다 +@msg no stop {i} (the gradient has {n}) 정지점 {i}이(가) 없습니다(그레이디언트의 정지점 수: {n}) +@msg no style `{name}` 스타일 `{name}`이(가) 없습니다 +@msg no such artboard {v} 해당 아트보드가 없습니다: {v} +@msg no such assets (see assets.list) 해당 에셋이 없습니다(assets.list 참조) +@msg no such frame anchor, or the frame would reach past the canvas 해당 프레임 앵커가 없거나 프레임이 캔버스를 벗어납니다 +@msg no such objects 해당 개체가 없습니다 +@msg no such path anchor, or the path would reach past the canvas 해당 패스 앵커가 없거나 패스가 캔버스를 벗어납니다 +@msg no such rows 해당 행이 없습니다 +@msg no swatch `{keep}` 견본 `{keep}`이(가) 없습니다 +@msg no swatch `{n}` 견본 `{n}`이(가) 없습니다 +@msg no swatch `{n}` (swatches and colour groups move separately) 견본 `{n}`이(가) 없습니다(견본과 색상 그룹은 따로 이동합니다) +@msg no swatch library `{key}` (see swatch.library.list) 견본 라이브러리 `{key}`이(가) 없습니다(swatch.library.list 참조) +@msg no swatch library `{key}` (see swatch.library.list; "document": the document's swatches) 견본 라이브러리 `{key}`이(가) 없습니다(swatch.library.list 참조, "document": 문서의 견본) +@msg no swatch library `{key}` (see swatch.library.list; "{DOCUMENT_SWATCHES}": the document's swatches) 견본 라이브러리 `{key}`이(가) 없습니다(swatch.library.list 참조, "{DOCUMENT_SWATCHES}": 문서의 견본) +@msg no swatch named `{n}` `{n}` 견본이 없습니다 +@msg no swatch or colour group `{n}` 견본 또는 색상 그룹 `{n}`이(가) 없습니다 +@msg no swatch or colour group `{n}` in `{_1}` `{_1}`에 견본 또는 색상 그룹 `{n}`이(가) 없습니다 +@msg no symbol named `{_1}` `{_1}` 심볼이 없습니다 +@msg no symbol named `{name}` `{name}` 심볼이 없습니다 +@msg no text objects selected 선택한 텍스트 개체가 없습니다 +@msg no toolbar named `{_1}` `{_1}` 도구 막대가 없습니다 +@msg no toolbar named `{name}` `{name}` 도구 막대가 없습니다 +@msg no tracing preset `{preset}` (see imageTrace.presets) 추적 사전 설정 `{preset}`이(가) 없습니다(imageTrace.presets 참조) +@msg no user library folder here (save with a path, or without one to get the data) 여기에는 사용자 라이브러리 폴더가 없습니다(경로를 지정해 저장하거나, 경로 없이 저장해 데이터를 받으세요) +@msg no variable named `{from}` `{from}` 변수가 없습니다 +@msg no variable named `{name}` `{name}` 변수가 없습니다 +@msg no variable named `{var}` `{var}` 변수가 없습니다 +@msg no variable named `{v}` `{v}` 변수가 없습니다 +@msg no view named `{name}` `{name}` 보기가 없습니다 +@msg node {_1} already has the text variable `{_2}` 노드 {_1}에 이미 텍스트 변수 `{_2}`이(가) 있습니다 +@msg node {_1} is not a graph 노드 {_1}은(는) 그래프가 아닙니다 +@msg node {_1} is not an image 노드 {_1}은(는) 이미지가 아닙니다 +@msg node {_1} is not type 노드 {_1}은(는) 문자가 아닙니다 +@msg not a DCS file DCS 파일이 아닙니다 +@msg not a PDF presets file (format `{_1}`) PDF 사전 설정 파일이 아닙니다(형식 `{_1}`) +@msg not a PDF presets file: {e} PDF 사전 설정 파일이 아닙니다: {e} +@msg not a RegExp object RegExp 개체가 아닙니다 +@msg not a Word document: its WordDocument stream doesn't start with a file information block Word 문서가 아닙니다: WordDocument 스트림이 파일 정보 블록으로 시작하지 않습니다 +@msg not a Word document: its compound file has no WordDocument stream Word 문서가 아닙니다: 복합 파일에 WordDocument 스트림이 없습니다 +@msg not a Word document: its main part is not a WordprocessingML document Word 문서가 아닙니다: 주 부분이 WordprocessingML 문서가 아닙니다 +@msg not a Word document: its package has no main document part Word 문서가 아닙니다: 패키지에 주 문서 부분이 없습니다 +@msg not a closed path 닫힌 패스가 아닙니다 +@msg not a flattener presets file (format `{_1}`) 병합 사전 설정 파일이 아닙니다(형식 `{_1}`) +@msg not a flattener presets file: {e} 병합 사전 설정 파일이 아닙니다: {e} +@msg not a layer or group 레이어나 그룹이 아닙니다 +@msg not a library file: {e} 라이브러리 파일이 아닙니다: {e} +@msg not a mesh envelope point 메시 엔벨로프 점이 아닙니다 +@msg not a perspective grid presets file (format `{_1}`) 원근 격자 사전 설정 파일이 아닙니다(형식 `{_1}`) +@msg not a perspective grid presets file: {e} 원근 격자 사전 설정 파일이 아닙니다: {e} +@msg not a print presets file (format `{_1}`) 인쇄 사전 설정 파일이 아닙니다(형식 `{_1}`) +@msg not a print presets file: {e} 인쇄 사전 설정 파일이 아닙니다: {e} +@msg not a regular expression 정규식이 아닙니다 +@msg not a stored or deflated central record 저장 방식이나 deflate 방식의 중앙 레코드가 아닙니다 +@msg not a valid SVGZ file: {e} 올바른 SVGZ 파일이 아닙니다: {e} +@msg not an RTF file: it doesn't start with {\rtf RTF 파일이 아닙니다: {\rtf(으)로 시작하지 않습니다 +@msg not an action set: the text doesn't start with /version and a number 액션 세트가 아닙니다: 텍스트가 /version과 숫자로 시작하지 않습니다 +@msg not an image VectorCraft reads (see document.formats) VectorCraft가 읽는 이미지가 아닙니다(document.formats 참조) +@msg not area type (text in a frame) outside perspective 원근 밖의 영역 문자(프레임 안의 텍스트)가 아닙니다 +@msg not editing an opacity mask 불투명 마스크를 편집하고 있지 않습니다 +@msg not type on a path outside perspective 원근 밖의 패스 위 문자가 아닙니다 +@msg nothing prints 인쇄할 것이 없습니다 +@msg nothing to bind 바인딩할 항목이 없습니다 +@msg nothing to change 변경할 항목이 없습니다 +@msg nothing to change: give dx, dy, hScale, vScale or rotation 변경할 항목이 없습니다: dx, dy, hScale, vScale 또는 rotation을 지정하세요 +@msg nothing to crop 자를 항목이 없습니다 +@msg nothing to export 내보낼 항목이 없습니다 +@msg nothing to export: the document has no visible art 내보낼 항목이 없습니다: 문서에 보이는 아트웍이 없습니다 +@msg nothing to mark 표시할 항목이 없습니다 +@msg nothing to print: every artboard picked is blank 인쇄할 것이 없습니다: 선택한 아트보드가 모두 비어 있습니다 +@msg nothing to print: the document has no art that prints 인쇄할 것이 없습니다: 문서에 인쇄되는 아트웍이 없습니다 +@msg nothing to repeat 반복할 항목이 없습니다 +@msg numbers out of order in {_1} quantifier {_1} 수량자의 숫자 순서가 잘못되었습니다 +@msg object is not a path 개체가 패스가 아닙니다 +@msg object transparency cannot be sampled onto highlighted characters; disable Transparency in Eyedropper Options or select the whole object 개체 투명도는 강조 표시한 글자에 샘플링할 수 없습니다. 스포이드 옵션에서 투명도를 끄거나 개체 전체를 선택하세요 +@msg object {_1} can't be set as point type 개체 {_1}은(는) 포인트 문자로 설정할 수 없습니다 +@msg object {_1} has lost its file's contents: relink it 개체 {_1}이(가) 파일 내용을 잃었습니다: 다시 연결하세요 +@msg object {_1} has no path 개체 {_1}에 패스가 없습니다 +@msg object {_1} has no size 개체 {_1}에 크기가 없습니다 +@msg object {_1} is hidden or locked, or on a locked artboard 개체 {_1}이(가) 숨겨졌거나 잠겨 있거나 잠긴 아트보드에 있습니다 +@msg object {_1} is not a placed document 개체 {_1}은(는) 가져온 문서가 아닙니다 +@msg object {_1} is not an Intertwine group 개체 {_1}은(는) 교차 그룹이 아닙니다 +@msg object {_1} is not an image 개체 {_1}은(는) 이미지가 아닙니다 +@msg object {_1} is not an image or a linked file 개체 {_1}은(는) 이미지나 연결된 파일이 아닙니다 +@msg object {_1} is not an image or a placed document 개체 {_1}은(는) 이미지나 가져온 문서가 아닙니다 +@msg object {_1} is not in this Intertwine group 개체 {_1}은(는) 이 교차 그룹에 없습니다 +@msg object {_1} needs a 3D effect 개체 {_1}에는 3D 효과가 필요합니다 +@msg object {_1} needs a 3D effect at index {index} 개체 {_1}에는 인덱스 {index}에 3D 효과가 필요합니다 +@msg object {_1}: a hollow Extrude & Bevel has no caps: turn on Cap to map a graphic 개체 {_1}: 속이 빈 돌출 및 경사에는 캡이 없습니다: 그래픽을 매핑하려면 캡을 켜세요 +@msg object {_1}: with a depth of 0 the object has one face: map its graphics onto the front 개체 {_1}: 깊이가 0이면 개체에 면이 하나뿐입니다: 그래픽을 앞면에 매핑하세요 +@msg object {_1}: {_2} 개체 {_1}: {_2} +@msg object {_1}: {e} 개체 {_1}: {e} +@msg object {_1}: {name} at index {index} has no lighting presets; set its lights with effect.setParams 개체 {_1}: 인덱스 {index}의 {name}에는 조명 사전 설정이 없습니다. effect.setParams로 조명을 설정하세요 +@msg object {id} has anchors 0–{_1} for `corners`, not {past} 개체 {id}에서 `corners`에 쓸 수 있는 앵커는 0–{_1}입니다: {past} +@msg object {id} has {n} anchors, so no anchor {past} 개체 {id}에는 앵커가 {n}개이므로 앵커 {past}은(는) 없습니다 +@msg objects must be none, move or copy objects는 none, move 또는 copy여야 합니다 +@msg objects were left out 개체가 제외되었습니다 +@msg offset out of range 오프셋이 범위를 벗어났습니다 +@msg on must be true or false on은 true 또는 false여야 합니다 +@msg only groups, layers, type and images have a Contents (Characters) row 콘텐츠(글자) 행은 그룹, 레이어, 문자, 이미지에만 있습니다 +@msg only interior mesh lines can be deleted 안쪽 메시 선만 삭제할 수 있습니다 +@msg only solid colours can be added (not gradients or patterns) 단색만 추가할 수 있습니다(그레이디언트나 패턴은 안 됨) +@msg only solid-colour swatches can be spot colours 단색 견본만 별색이 될 수 있습니다 +@msg only this Affinity file's embedded preview could be read: use File › Open to see it with its warning, or export SVG or PDF from Affinity first 이 Affinity 파일은 포함된 미리 보기만 읽을 수 있었습니다: 파일 › 열기로 경고와 함께 확인하거나 먼저 Affinity에서 SVG나 PDF로 내보내세요 +@msg only this Affinity file's embedded preview could be read; use File › Open to see it with its warning 이 Affinity 파일은 포함된 미리 보기만 읽을 수 있었습니다. 파일 › 열기로 경고와 함께 확인하세요 +@msg onto, above, below, icon and a column place belong to window.panel.float and window.panel.dock onto, above, below, icon, 열 위치는 window.panel.float와 window.panel.dock에 씁니다 +@msg onto, above, below, icon and a column place take no anchor, side, zone or before onto, above, below, icon, 열 위치는 anchor, side, zone, before와 함께 쓸 수 없습니다 +@msg onto, above, below, icon and a column place take no x, y, width or height onto, above, below, icon, 열 위치는 x, y, width, height와 함께 쓸 수 없습니다 +@msg opacity must be a number opacity는 숫자여야 합니다 +@msg open a document to look for its linked files 연결된 파일을 찾으려면 문서를 여세요 +@msg operand too large 피연산자가 너무 큽니다 +@msg options must be an object (see file.formatOptions) options는 개체여야 합니다(file.formatOptions 참조) +@msg order is a whole number from 0 to {others}, not `{v}` order는 0에서 {others} 사이의 정수입니다: `{v}` +@msg order must be leftToRight or rightToLeft order는 leftToRight 또는 rightToLeft여야 합니다 +@msg orientation must be portrait or landscape, not `{o}` orientation은 portrait 또는 landscape여야 합니다: `{o}` +@msg outlineText {v}: true or false outlineText {v}: true 또는 false여야 합니다 +@msg output intent profile: {e} 출력 의도 프로파일: {e} +@msg output.destination: no RGB or CMYK profile is called “{name}” output.destination: “{name}”(이)라는 RGB 또는 CMYK 프로파일이 없습니다 +@msg output.destination: {_1} files are CMYK, and “{name}” is an RGB profile output.destination: {_1} 파일은 CMYK인데 “{name}”은(는) RGB 프로파일입니다 +@msg output.destination: {e} output.destination: {e} +@msg output.inks: no ink is set to print output.inks: 인쇄하도록 설정된 잉크가 없습니다 +@msg output.outputIntent: no profile is called “{name}”, and a {std} output intent embeds its profile output.outputIntent: “{name}”(이)라는 프로파일이 없으며, {std} 출력 의도는 프로파일을 포함해야 합니다 +@msg output.outputIntent: no profile is called “{name}”: a {std} output intent embeds a profile, or names a registered printing condition (outputConditionId and registry) output.outputIntent: “{name}”(이)라는 프로파일이 없습니다: {std} 출력 의도는 프로파일을 포함하거나 등록된 인쇄 조건(outputConditionId와 registry)을 지정합니다 +@msg output.outputIntent: {std} files print in CMYK, and “{name}” is an RGB profile output.outputIntent: {std} 파일은 CMYK로 인쇄하는데 “{name}”은(는) RGB 프로파일입니다 +@msg output.outputIntent: “{name}” is a grey profile, which can't be a {std} output intent output.outputIntent: “{name}”은(는) 회색 프로파일이어서 {std} 출력 의도로 쓸 수 없습니다 +@msg overlap: {o} pt is half a tile or more overlap: {o} pt는 타일의 절반 이상입니다 +@msg overlapping Shaper paths must be in the same layer or group 겹치는 셰이퍼 패스는 같은 레이어나 그룹에 있어야 합니다 +@msg overlapping edits 편집 범위가 겹칩니다 +@msg page art conflicts with image data for {key} 페이지 아트웍이 {key}의 이미지 데이터와 충돌합니다 +@msg page art conflicts with pattern {name} 페이지 아트웍이 패턴 {name}와(과) 충돌합니다 +@msg page art conflicts with swatch {name} 페이지 아트웍이 견본 {name}와(과) 충돌합니다 +@msg page art is missing image data for {key} 페이지 아트웍에 {key}의 이미지 데이터가 없습니다 +@msg page art is missing pattern {name} 페이지 아트웍에 패턴 {name}이(가) 없습니다 +@msg page art is missing swatch {name} 페이지 아트웍에 견본 {name}이(가) 없습니다 +@msg page must be a whole number from 1 page는 1 이상의 정수여야 합니다 +@msg page thumbnail: {e} 페이지 미리 보기 이미지: {e} +@msg page {page} of the PDF has no objects PDF의 {page}페이지에 개체가 없습니다 +@msg page {page}: `{file}` has {n} {artboards} {page}페이지: `{file}`에는 {artboards}이(가) {n}개 있습니다 +@msg page {page}: `{name}` has {n} {pages} {page}페이지: `{name}`에는 {pages}이(가) {n}개 있습니다 +@msg pages must be a range such as "2-3" or a page number, not {v} pages는 "2-3" 같은 범위 또는 페이지 번호여야 합니다: {v} +@msg pages: {e} pages: {e} +@msg panel position must be finite 패널 위치는 유한해야 합니다 +@msg parameters must be an object 매개변수는 개체여야 합니다 +@msg params must be an object params는 개체여야 합니다 +@msg passwords can have up to {MAX_PASSWORD} bytes 암호는 최대 {MAX_PASSWORD}바이트까지 쓸 수 있습니다 +@msg path chunks must share their boundary point 패스 조각은 경계 점을 공유해야 합니다 +@msg path has no open end 패스에 열린 끝이 없습니다 +@msg paths must be strings paths는 문자열이어야 합니다 +@msg pdfCompatible: false needs every artboard to keep the editable artwork pdfCompatible: false를 쓰려면 편집 가능한 아트웍을 보존하도록 모든 아트보드를 포함해야 합니다 +@msg pdfCompatible: false needs the artboards to keep the editable artwork when useArtboards is false useArtboards가 false일 때 pdfCompatible: false를 쓰려면 편집 가능한 아트웍을 보존하도록 아트보드를 포함해야 합니다 +@msg pdfs `{m}`: single or multiple pdfs `{m}`: single 또는 multiple이어야 합니다 +@msg pickColorFrom is "artwork" or "swatches", not {v} pickColorFrom은 "artwork" 또는 "swatches"입니다: {v} +@msg pins and moved must be non-empty lists of the same length pins와 moved는 길이가 같고 비어 있지 않은 목록이어야 합니다 +@msg pins must be [[x,y]…] pins는 [[x,y]…]여야 합니다 +@msg pins must be finite pins는 유한해야 합니다 +@msg place is above, below or inside, not `{other}` place는 above, below 또는 inside입니다: `{other}` +@msg plane must be left|right|ground plane은 left|right|ground여야 합니다 +@msg plane must be left|right|ground|none plane은 left|right|ground|none이어야 합니다 +@msg point is outside the mesh 점이 메시 밖에 있습니다 +@msg point x must be a number 점의 x는 숫자여야 합니다 +@msg point y must be a number 점의 y는 숫자여야 합니다 +@msg points must be [t, left, right] with non-negative widths points는 너비가 음이 아닌 [t, left, right]여야 합니다 +@msg points must be [x,y] pairs points는 [x,y] 쌍이어야 합니다 +@msg points must be a non-empty [[x,y,pressure?]…] list points는 비어 있지 않은 [[x,y,pressure?]…] 목록이어야 합니다 +@msg points must be a non-empty list of finite [x,y] points는 유한한 [x,y]의 비어 있지 않은 목록이어야 합니다 +@msg points must be an array or null points는 배열 또는 null이어야 합니다 +@msg points must be finite points는 유한해야 합니다 +@msg points must be finite [x,y] pairs points는 유한한 [x,y] 쌍이어야 합니다 +@msg points must be finite canvas points points는 유한한 캔버스 점이어야 합니다 +@msg points must contain 1–4096 coordinates points에는 좌표가 1–4096개 있어야 합니다 +@msg position must be normal, superscript or subscript position은 normal, superscript 또는 subscript여야 합니다 +@msg position must be topLeft, topRight, bottomLeft or bottomRight position은 topLeft, topRight, bottomLeft 또는 bottomRight여야 합니다 +@msg positions must be between 0 and 100000 pt positions는 0에서 100000 pt 사이여야 합니다 +@msg ppi must be a positive number, not {ppi} ppi는 양수여야 합니다: {ppi} +@msg ppi must be between 1 and 2400 ppi는 1에서 2400 사이여야 합니다 +@msg preserve `{v}` is not transforms|bounds|fileDimensions|fit|fill preserve `{v}`은(는) transforms|bounds|fileDimensions|fit|fill이 아닙니다 +@msg preserveShape must be clippingMask|transparency preserveShape는 clippingMask|transparency여야 합니다 +@msg preset `{id}`: mobile or density preset `{id}`: mobile 또는 density여야 합니다 +@msg preset must be standard, diffuse, topLeft or right preset은 standard, diffuse, topLeft 또는 right여야 합니다 +@msg preset must be the name of a print preset preset은 인쇄 사전 설정의 이름이어야 합니다 +@msg previewMode must be default, pixel or overprint previewMode는 default, pixel 또는 overprint여야 합니다 +@msg print settings: {e} 인쇄 설정: {e} +@msg procedures nest too deeply 프로시저가 너무 깊게 중첩되어 있습니다 +@msg procedures nested too deeply 프로시저가 너무 깊게 중첩되었습니다 +@msg quotes must be {double?, single?} quotes는 {double?, single?}여야 합니다 +@msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k}은(는) 여는 따옴표와 닫는 따옴표여야 합니다(예: "“”") +@msg range out of order in character class 문자 클래스의 범위 순서가 잘못되었습니다 +@msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi는 1–2400이어야 합니다(72 screen, 150 medium, 300 high) +@msg rating must be a whole number from 0 to {MAX_RATING} rating은 0에서 {MAX_RATING} 사이의 정수여야 합니다 +@msg rect and {k} contradict each other: give the area or the artboards rect와 {k}이(가) 서로 맞지 않습니다: 영역이나 아트보드 중 하나를 지정하세요 +@msg rect applies to raster formats, not {_1} rect는 래스터 형식에 적용되며 {_1}에는 적용되지 않습니다 +@msg rect is [x, y, width, height] in points rect는 포인트 단위의 [x, y, width, height]입니다 +@msg rect must be [x, y, width, height] rect는 [x, y, width, height]여야 합니다 +@msg rect must be [x, y, width, height] with a positive width and height rect는 너비와 높이가 양수인 [x, y, width, height]여야 합니다 +@msg rect needs finite numbers and a positive width and height rect에는 유한한 숫자와 양수인 너비와 높이가 필요합니다 +@msg redraw needs id redraw에는 id가 필요합니다 +@msg redraw within must be a finite distance of 0 or more redraw의 within은 0 이상의 유한한 거리여야 합니다 +@msg reduce of an empty array with no initial value 초기값 없이 빈 배열에 reduce를 호출했습니다 +@msg registration must be 0..8 registration은 0..8이어야 합니다 +@msg regular expression flag '{_1}' given twice 정규식 플래그 '{_1}'을(를) 두 번 지정했습니다 +@msg release a layer or a group 레이어나 그룹을 해제하세요 +@msg replace keeps the replaced object's place and transform: drop template, at and rect replace는 바꾼 개체의 위치와 변형을 유지합니다: template, at, rect를 빼세요 +@msg replace: select the one object to replace replace: 바꿀 개체 하나를 선택하세요 +@msg resolution must be a number or screen|medium|high resolution은 숫자 또는 screen|medium|high여야 합니다 +@msg resolution must be between 1 and 2400 ppi resolution은 1에서 2400 ppi 사이여야 합니다 +@msg rotation must be a number of degrees rotation은 도 단위의 숫자여야 합니다 +@msg rotation must be finite rotation은 유한해야 합니다 +@msg rows and cols must be 1..50 rows와 cols는 1..50이어야 합니다 +@msg rows and columns must be 1..500 rows와 columns는 1..500이어야 합니다 +@msg rows of objects whose appearances differ can't be reordered together 모양새가 서로 다른 개체의 행은 함께 순서를 바꿀 수 없습니다 +@msg sampled text would exceed the canvas (coordinates out of range) 샘플링한 텍스트가 캔버스를 벗어납니다(좌표 범위 초과) +@msg save the document first: Package collects a saved document 먼저 문서를 저장하세요: 패키지는 저장된 문서를 수집합니다 +@msg save the document first: copy puts the file in its folder 먼저 문서를 저장하세요: copy는 파일을 문서의 폴더에 넣습니다 +@msg savedPreset: {e} savedPreset: {e} +@msg scale `{s}`: a factor such as 2x, a width (100w), a height (100h) or a resolution (72ppi) scale `{s}`: 2x 같은 배율, 너비(100w), 높이(100h) 또는 해상도(72ppi)여야 합니다 +@msg scale must be a number above 0, at most 64 scale은 0보다 크고 64 이하인 숫자여야 합니다 +@msg scale must be non-zero scale은 0이 아니어야 합니다 +@msg scope must be selection or all (got {other}) scope는 selection 또는 all이어야 합니다({other} 입력됨) +@msg scribble is too long 스크리블이 너무 깁니다 +@msg segment does not exist 세그먼트가 없습니다 +@msg select a Shaper group 셰이퍼 그룹을 선택하세요 +@msg select a blend to set easing or color shift 이징이나 색상 이동을 설정할 블렌드를 선택하세요 +@msg select a compound shape 컴파운드 모양을 선택하세요 +@msg select a graph 그래프를 선택하세요 +@msg select a group or layer with visible, unlocked members 보이고 잠기지 않은 구성원이 있는 그룹이나 레이어를 선택하세요 +@msg select a layer 레이어를 선택하세요 +@msg select a text object 텍스트 개체를 선택하세요 +@msg select an SVG filter SVG 필터를 선택하세요 +@msg select an image (or an Image Trace group) 이미지(또는 이미지 추적 그룹)를 선택하세요 +@msg select an image, or pass id 이미지를 선택하거나 id를 전달하세요 +@msg select an object (or pass `id`) 개체를 선택하세요(또는 `id`를 전달하세요) +@msg select an object with a 3D effect 3D 효과가 있는 개체를 선택하세요 +@msg select an object with a 3D effect, or give its id in ids 3D 효과가 있는 개체를 선택하거나 ids에 그 id를 지정하세요 +@msg select an object with a freeform gradient 자유 형태 그레이디언트가 있는 개체를 선택하세요 +@msg select an object with an opacity mask 불투명 마스크가 있는 개체를 선택하세요 +@msg select area type 영역 문자를 선택하세요 +@msg select area type (text in a frame) 영역 문자(프레임 안의 텍스트)를 선택하세요 +@msg select area type and closed paths (at least one area type object) 영역 문자와 닫힌 패스를 선택하세요(영역 문자 개체가 하나 이상 있어야 함) +@msg select area type whose first line can fit its frame 첫 줄이 프레임에 들어가는 영역 문자를 선택하세요 +@msg select artwork to add its colours 색상을 추가할 아트웍을 선택하세요 +@msg select artwork to make a group of its colours 색상으로 그룹을 만들 아트웍을 선택하세요 +@msg select artwork to recolour, or give a colour `group` 색상을 재지정할 아트웍을 선택하거나 색상 `group`을 지정하세요 +@msg select exactly two path ends to join 연결할 패스 끝을 정확히 두 개 선택하세요 +@msg select members of a compound shape 컴파운드 모양의 구성원을 선택하세요 +@msg select objects or give ids 개체를 선택하거나 ids를 지정하세요 +@msg select objects to align to the guide 안내선에 정렬할 개체를 선택하세요 +@msg select one Intertwine group 교차 그룹 하나를 선택하세요 +@msg select one image or pass id 이미지 하나를 선택하거나 id를 전달하세요 +@msg select one layer, group or object to rename 이름을 바꿀 레이어, 그룹 또는 개체를 하나 선택하세요 +@msg select paths 패스를 선택하세요 +@msg select paths or compound paths 패스나 컴파운드 패스를 선택하세요 +@msg select rows or objects to collect 수집할 행이나 개체를 선택하세요 +@msg select something to export 내보낼 항목을 선택하세요 +@msg select something to export (or turn off selectedOnly) 내보낼 항목을 선택하세요(또는 selectedOnly를 끄세요) +@msg select text to redefine the style from 스타일을 재정의할 기준 텍스트를 선택하세요 +@msg select the art and, on top of it, the mask object 아트웍과 그 위에 있는 마스크 개체를 선택하세요 +@msg select the art for the design 디자인에 쓸 아트웍을 선택하세요 +@msg select the art for the pattern tile 패턴 타일에 쓸 아트웍을 선택하세요 +@msg select the art to add first 먼저 추가할 아트웍을 선택하세요 +@msg select the art to collect (or give its ids) 수집할 아트웍을 선택하세요(또는 ids를 지정하세요) +@msg select the art to weed 위딩할 아트웍을 선택하세요 +@msg select the banner, or mark every artboard 배너를 선택하거나 모든 아트보드에 표시하세요 +@msg select the content and a path on top 콘텐츠와 그 위의 패스를 선택하세요 +@msg select the images to relink, or pass ids 다시 연결할 이미지를 선택하거나 ids를 전달하세요 +@msg select the images, or pass ids 이미지를 선택하거나 ids를 전달하세요 +@msg select the linked images or placed documents, or pass ids 연결된 이미지나 가져온 문서를 선택하거나 ids를 전달하세요 +@msg select the object to copy from 복사해 올 개체를 선택하세요 +@msg select the objects (or give their ids) 개체를 선택하세요(또는 ids를 지정하세요) +@msg select the objects to attach to the path 패스에 부착할 개체를 선택하세요 +@msg select the objects to bind 바인딩할 개체를 선택하세요 +@msg select two or more objects to intertwine 교차할 개체를 두 개 이상 선택하세요 +@msg select two or more slices to combine 결합할 슬라이스를 두 개 이상 선택하세요 +@msg select type on a path 패스 위 문자를 선택하세요 +@msg select type on a path or area type 패스 위 문자 또는 영역 문자를 선택하세요 +@msg selection `{m}`: one or each selection `{m}`: one 또는 each여야 합니다 +@msg settings is an object of document.exportForScreens params settings는 document.exportForScreens 매개변수의 개체입니다 +@msg settings must be an object settings는 개체여야 합니다 +@msg show `{show}`: all, missing, modified or embedded show `{show}`: all, missing, modified 또는 embedded여야 합니다 +@msg show must be true or false show는 true 또는 false여야 합니다 +@msg side is left or right, not `{v}` side는 left 또는 right입니다: `{v}` +@msg size must be "small", "medium", "large" or a number of points over 0 up to {_1} size는 "small", "medium", "large"이거나 0보다 크고 {_1} 이하인 포인트 값이어야 합니다 +@msg size must be positive size는 양수여야 합니다 +@msg sizeMode is "fixed" or "pressure", not `{other}` sizeMode는 "fixed" 또는 "pressure"입니다: `{other}` +@msg sizeMode is "fixed" or "pressure", not {other} sizeMode는 "fixed" 또는 "pressure"입니다: {other} +@msg sizeVariation must be 0 or more sizeVariation은 0 이상이어야 합니다 +@msg smallCaps must be true or false smallCaps는 true 또는 false여야 합니다 +@msg sort `{x}`: name, kind or status sort `{x}`: name, kind 또는 status여야 합니다 +@msg source paths are too large for Shaper 원본 패스가 셰이퍼에 쓰기에는 너무 큽니다 +@msg source text transform is collapsed or unrepresentable 원본 텍스트 변형이 축소되었거나 나타낼 수 없습니다 +@msg spot, mode and group apply to solid colours only spot, mode, group은 단색에만 적용됩니다 +@msg status `{s}`: linked, embedded, missing or modified status `{s}`: linked, embedded, missing 또는 modified여야 합니다 +@msg steps must be 1..1000 steps는 1..1000이어야 합니다 +@msg steps must be 1..{MAX_STEPS} steps는 1..{MAX_STEPS}이어야 합니다 +@msg stop {i}: `plates` must be four numbers from 0 to 1 (C, M, Y, K) 정지점 {i}: `plates`은(는) 0에서 1 사이의 숫자 네 개(C, M, Y, K)여야 합니다 +@msg stopped before the archive was finished 아카이브를 끝내기 전에 중지되었습니다 +@msg strokeMode must be within|along|across, got {m} strokeMode는 within|along|across여야 합니다({m} 입력됨) +@msg strokeOptions must be an object of stroke.set options strokeOptions는 stroke.set 옵션의 개체여야 합니다 +@msg strokeWidth must be a positive number of pixels strokeWidth는 픽셀 단위의 양수여야 합니다 +@msg subpath {si} is not an open subpath 하위 패스 {si}은(는) 열린 하위 패스가 아닙니다 +@msg subpaths required when joining the same path 같은 패스를 연결할 때는 subpaths가 필요합니다 +@msg swatchConflict must be "merge" or "add", not {v} swatchConflict는 "merge" 또는 "add"여야 합니다: {v} +@msg table must be true or false table은 true 또는 false여야 합니다 +@msg takes one name 이름 하나만 지정할 수 있습니다 +@msg target text transform is collapsed or unrepresentable 대상 텍스트 변형이 축소되었거나 나타낼 수 없습니다 +@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text는 {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?}여야 합니다 +@msg text transform is collapsed or unrepresentable 텍스트 변형이 축소되었거나 나타낼 수 없습니다 +@msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces는 2에서 100 사이의 정수여야 합니다 +@msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}`: "{_1}" 또는 "{_2}"을(를) 사용하세요 +@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage: 이미지 파일의 {path} 또는 {name, dataBase64}를 지정하거나 effect.list가 제공하는 텍스처를 지정하세요 +@msg textureImage: {e} textureImage: {e} +@msg that makes more than {MAX_PIECES} slices 그러면 슬라이스가 {MAX_PIECES}개보다 많아집니다 +@msg that makes too many pieces (at most 100000) or dash steps: simplify the dash pattern or make the dashes longer 그러면 조각(최대 100000개)이나 대시 단계가 너무 많아집니다: 대시 패턴을 단순하게 하거나 대시를 더 길게 하세요 +@msg that object is not in the overlap 그 개체는 겹친 부분에 없습니다 +@msg the Affinity document has no page with a size Affinity 문서에 크기가 있는 페이지가 없습니다 +@msg the CMYK image couldn't be written CMYK 이미지를 기록할 수 없습니다 +@msg the Layers panel is not shown 레이어 패널이 표시되어 있지 않습니다 +@msg the Layers panel's search, filter or Show Layers Only hides its row 레이어 패널의 검색, 필터 또는 레이어만 표시 때문에 해당 행이 숨겨져 있습니다 +@msg the Objects on Path group is hidden or locked 패스 위 개체 그룹이 숨겨졌거나 잠겨 있습니다 +@msg the PDF security settings were saved without their passwords: give openPassword or permissionsPassword again, or security without passwordRequired to export unprotected PDF 보안 설정이 암호 없이 저장되었습니다: openPassword 또는 permissionsPassword를 다시 지정하거나, 보호 없이 내보내려면 passwordRequired가 없는 security를 지정하세요 +@msg the RTF file has too many paragraphs or formatting changes to place as type (at most {MAX_PARAGRAPHS} paragraphs and {MAX_RUNS} runs) RTF 파일에 단락이나 서식 변경이 너무 많아 문자로 가져올 수 없습니다(최대 단락 {MAX_PARAGRAPHS}개, 런 {MAX_RUNS}개) +@msg the RTF file is too large to place as type (at most {_1} MB) RTF 파일이 너무 커서 문자로 가져올 수 없습니다(최대 {_1} MB) +@msg the SVG expands to more than {0} nested SVG images SVG를 확장하면 중첩된 SVG 이미지가 {0}개보다 많아집니다 +@msg the SVG expands to more than {0} objects SVG를 확장하면 개체가 {0}개보다 많아집니다 +@msg the SVG file is larger than {MAX_IMPORT_BYTES} bytes SVG 파일이 {MAX_IMPORT_BYTES}바이트보다 큽니다 +@msg the SVG has no drawable objects SVG에 그릴 수 있는 개체가 없습니다 +@msg the SVGZ file unpacks to more than {_1} MB SVGZ 파일의 압축을 풀면 {_1} MB를 넘습니다 +@msg the Word document has more than {MAX_PAGES} pages of properties, too many to place Word 문서의 속성이 {MAX_PAGES}페이지보다 많아 가져올 수 없습니다 +@msg the Word document has more than {MAX_RUNS} runs of character or paragraph properties, too many to place Word 문서에 문자 또는 단락 속성의 런이 {MAX_RUNS}개보다 많아 가져올 수 없습니다 +@msg the Word document has more than {_1} MB of formatting properties, too many to place Word 문서의 서식 속성이 {_1} MB보다 많아 가져올 수 없습니다 +@msg the Word document has too much text or formatting to place as type (at most {MAX_PARAGRAPHS} paragraphs, {MAX_RUNS} runs and {_1} MB of text) Word 문서에 텍스트나 서식이 너무 많아 문자로 가져올 수 없습니다(최대 단락 {MAX_PARAGRAPHS}개, 런 {MAX_RUNS}개, 텍스트 {_1} MB) +@msg the Word document has too much text to place as type (at most {_1} MB) Word 문서에 텍스트가 너무 많아 문자로 가져올 수 없습니다(최대 {_1} MB) +@msg the Word document is encrypted or protected with a password; save it without one to place it Word 문서가 암호화되었거나 암호로 보호되어 있습니다. 가져오려면 암호 없이 저장하세요 +@msg the Word document is too large to place (its {name} stream holds more than {_1} MB) Word 문서가 너무 커서 가져올 수 없습니다({name} 스트림이 {_1} MB를 넘습니다) +@msg the Word document was last saved with fast save, which VectorCraft doesn't read; save it again with fast save turned off Word 문서가 마지막에 빠른 저장으로 저장되었는데, VectorCraft는 이 방식을 읽지 않습니다. 빠른 저장을 끄고 다시 저장하세요 +@msg the Word document was saved by Word 6.0 or Word 95, which VectorCraft doesn't read; save it as a Word 97-2003 document Word 문서가 Word 6.0 또는 Word 95에서 저장되었는데, VectorCraft는 이 형식을 읽지 않습니다. Word 97-2003 문서로 저장하세요 +@msg the Word document's text is made of more than {MAX_PIECES} pieces, too many to place Word 문서의 텍스트가 {MAX_PIECES}개보다 많은 조각으로 이루어져 있어 가져올 수 없습니다 +@msg the XML operation needs an XML or XMLList value XML 연산에는 XML 또는 XMLList 값이 필요합니다 +@msg the XPath expression does not evaluate to a node-set XPath 식의 결과가 노드 집합이 아닙니다 +@msg the XPath expression ends early XPath 식이 중간에 끝났습니다 +@msg the XPath expression has an unmatched ) XPath 식에 짝이 없는 )가 있습니다 +@msg the XPath expression has an unmatched ] XPath 식에 짝이 없는 ]가 있습니다 +@msg the XPath expression has an unmatched closing bracket XPath 식에 짝이 없는 닫는 괄호가 있습니다 +@msg the XPath expression selects a namespace node, which is not an XML value XPath 식이 XML 값이 아닌 네임스페이스 노드를 선택합니다 +@msg the XPath expression selects the root node, which is not an XML value XPath 식이 XML 값이 아닌 루트 노드를 선택합니다 +@msg the XPath function {name} needs a node-set XPath 함수 {name}에는 노드 집합이 필요합니다 +@msg the XPath function {name} takes the wrong number of arguments XPath 함수 {name}의 인수 개수가 맞지 않습니다 +@msg the XPath name functions need a node-set XPath 이름 함수에는 노드 집합이 필요합니다 +@msg the XPath prefix {shown} is not bound to a namespace XPath 접두사 {shown}이(가) 네임스페이스에 바인딩되어 있지 않습니다 +@msg the XPath variable ${shown} is not bound XPath 변수 ${shown}이(가) 바인딩되어 있지 않습니다 +@msg the action set ids are not a list 액션 세트 id가 목록이 아닙니다 +@msg the active paint is not a gradient 활성 페인트가 그레이디언트가 아닙니다 +@msg the argument list is not an object 인수 목록이 개체가 아닙니다 +@msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size 아트보드가 캔버스에 들어가지 않습니다: 아트보드 수나 간격, 크기를 줄이세요 +@msg the artwork is too large for EPS: what follows 256 MB of PostScript was left out 아트웍이 EPS에 쓰기에는 너무 큽니다: PostScript 256 MB 이후의 내용은 제외되었습니다 +@msg the banner has no width or height 배너에 너비나 높이가 없습니다 +@msg the bitmaps hold more pixels than one file may 비트맵의 픽셀 수가 파일 하나에 담을 수 있는 양보다 많습니다 +@msg the character's size can't be measured 글자의 크기를 잴 수 없습니다 +@msg the code runs past its last instruction 코드가 마지막 명령을 지나 실행됩니다 +@msg the compound shape is too complex to expand 컴파운드 모양이 너무 복잡해서 확장할 수 없습니다 +@msg the container of the listed objects is gone 나열한 개체의 컨테이너가 없어졌습니다 +@msg the copy `{user_id}` can't be read as a library 복사본 `{user_id}`을(를) 라이브러리로 읽을 수 없습니다 +@msg the copy would leave the canvas 복사본이 캔버스를 벗어납니다 +@msg the curve tolerance must be from 0.01 to 10 points 곡선 허용치는 0.01에서 10포인트 사이여야 합니다 +@msg the custom dictionary couldn't be saved to {_1}: {e} 사용자 사전을 {_1}에 저장할 수 없습니다: {e} +@msg the custom dictionary {_1} can't be read ({why}), so it is left as it is 사용자 사전 {_1}을(를) 읽을 수 없어({why}) 그대로 둡니다 +@msg the cut cannot be made on this art: {e} 이 아트웍은 자를 수 없습니다: {e} +@msg the data isn't an EMF or WMF picture 데이터가 EMF 또는 WMF 그림이 아닙니다 +@msg the data isn't an EPS or PostScript picture 데이터가 EPS 또는 PostScript 그림이 아닙니다 +@msg the deferred paste is no longer available 지연된 붙여넣기를 더 이상 사용할 수 없습니다 +@msg the design is too big to draw at every data point of this graph 디자인이 너무 커서 이 그래프의 모든 데이터 점에 그릴 수 없습니다 +@msg the design is too big to draw in every column of this graph 디자인이 너무 커서 이 그래프의 모든 막대에 그릴 수 없습니다 +@msg the dialog it was opened over is no longer open 이 대화 상자가 열렸던 바탕 대화 상자가 더 이상 열려 있지 않습니다 +@msg the dictionary stack overflowed 사전 스택이 오버플로되었습니다 +@msg the document already has an SVG filter named {name} 문서에 {name}(이)라는 SVG 필터가 이미 있습니다 +@msg the document has another SVG filter named {name}: use svgFilter.apply, or svgFilter.define with `replace` to edit it 문서에 {name}(이)라는 다른 SVG 필터가 있습니다: svgFilter.apply를 사용하거나, 편집하려면 `replace`와 함께 svgFilter.define을 사용하세요 +@msg the document has no SVG filter named {name} 문서에 {name}(이)라는 SVG 필터가 없습니다 +@msg the document has no SVG filter named {r} 문서에 {r}(이)라는 SVG 필터가 없습니다 +@msg the document has no color swatches 문서에 색상 견본이 없습니다 +@msg the document's swatches hold {_1} colors; the document reduction takes at most 255 문서의 견본에 색상이 {_1}개 있습니다. document 감소는 최대 255개까지 쓸 수 있습니다 +@msg the editing data's hash has no place 편집 데이터의 해시를 넣을 자리가 없습니다 +@msg the entities the document declares expand to too much text 문서가 선언한 엔티티를 확장하면 텍스트가 너무 많아집니다 +@msg the envelope's content has no bounds 엔벨로프의 콘텐츠에 경계가 없습니다 +@msg the envelope's mesh is malformed 엔벨로프의 메시가 올바르지 않습니다 +@msg the file holds no `variableSets` element 파일에 `variableSets` 요소가 없습니다 +@msg the file is larger than {_1} MB 파일이 {_1} MB보다 큽니다 +@msg the file is too large 파일이 너무 큽니다 +@msg the file isn't valid SVG: {e} 파일이 올바른 SVG가 아닙니다: {e} +@msg the file names no plate 파일에 지정된 색판이 없습니다 +@msg the file was updated or encrypted already 파일이 이미 업데이트되었거나 암호화되었습니다 +@msg the first character of a line has no character before it to kern: it moves only up and down (dy) 줄의 첫 글자는 앞에 커닝할 글자가 없습니다: 위아래로만 이동합니다(dy) +@msg the font {_1} is not available 글꼴 {_1}을(를) 사용할 수 없습니다 +@msg the format has no file extension 이 형식에는 파일 확장자가 없습니다 +@msg the function's prototype is not an object 함수의 프로토타입이 개체가 아닙니다 +@msg the graphic can't be read: {e} 그래픽을 읽을 수 없습니다: {e} +@msg the graphic is empty 그래픽이 비어 있습니다 +@msg the graphic's data is damaged 그래픽의 데이터가 손상되었습니다 +@msg the graphic's document has no artboard 그래픽의 문서에 아트보드가 없습니다 +@msg the grommet inset is too large for the banner 가장자리에서 아일렛까지 거리가 배너에 비해 너무 큽니다 +@msg the guide is hidden or locked 안내선이 숨겨졌거나 잠겨 있습니다 +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them `{name}`의 머리글 `{cell}`은(는) 변수 `{other}`(으)로 다시 읽힙니다: 둘 중 하나의 이름을 바꾸세요 +@msg the hem is too deep for the banner 단 접기가 배너에 비해 너무 깊습니다 +@msg the image `{path}` isn't followed: {r} 이미지 `{path}`을(를) 따라가지 않습니다: {r} +@msg the image has no embedded pixels 이미지에 포함된 픽셀이 없습니다 +@msg the image is empty 이미지가 비어 있습니다 +@msg the image is fully transparent 이미지가 완전히 투명합니다 +@msg the image is not on an artboard; pass rect 이미지가 아트보드 위에 없습니다. rect를 전달하세요 +@msg the image's pixels are missing 이미지의 픽셀이 없습니다 +@msg the image's pixels aren't in the document 이미지의 픽셀이 문서에 없습니다 +@msg the image's pixels can't be read: {e} 이미지의 픽셀을 읽을 수 없습니다: {e} +@msg the image's transparency doesn't fit it 이미지의 투명도가 이미지와 맞지 않습니다 +@msg the job would print more than {MAX_PAGES} pages 이 작업은 {MAX_PAGES}페이지보다 많이 인쇄하게 됩니다 +@msg the job would print more than {_1} pages 이 작업은 {_1}페이지보다 많이 인쇄하게 됩니다 +@msg the layers hold no art to mask 레이어에 마스크할 아트웍이 없습니다 +@msg the layout moved 레이아웃이 이동했습니다 +@msg the library has a group `{name}` already 라이브러리에 `{name}` 그룹이 이미 있습니다 +@msg the library has no group `{name}` 라이브러리에 `{name}` 그룹이 없습니다 +@msg the library has no item `{item}` 라이브러리에 `{item}` 항목이 없습니다 +@msg the library has no item `{other}` 라이브러리에 `{other}` 항목이 없습니다 +@msg the library holds {MAX_GROUPS} groups already 라이브러리에 이미 그룹이 {MAX_GROUPS}개 있습니다 +@msg the library holds {MAX_ITEMS} items of this kind already 라이브러리에 이 종류의 항목이 이미 {MAX_ITEMS}개 있습니다 +@msg the library's file is outside the read roots 라이브러리 파일이 읽기 루트 밖에 있습니다 +@msg the line is too long, or the paths it passes too many, to check 선이 너무 길거나 선이 지나는 패스가 너무 많아 확인할 수 없습니다 +@msg the method needs an XML value 이 메서드에는 XML 값이 필요합니다 +@msg the name is empty 이름이 비어 있습니다 +@msg the object has no fill, stroke or effect 개체에 칠, 선 또는 효과가 없습니다 +@msg the object has no graphic style (pass `name`) 개체에 그래픽 스타일이 없습니다(`name`을 전달하세요) +@msg the objects don't match the plan 개체가 계획과 맞지 않습니다 +@msg the open and permissions passwords must differ 열기 암호와 권한 암호는 서로 달라야 합니다 +@msg the operand stack overflowed 피연산자 스택이 오버플로되었습니다 +@msg the page has no area 페이지에 면적이 없습니다 +@msg the page's type in an unread object's box isn't in its page art 읽지 않은 개체의 상자에 있는 페이지 문자가 페이지 아트웍에 없습니다 +@msg the paint behind the proxy is not a gradient 프록시 뒤의 페인트가 그레이디언트가 아닙니다 +@msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) 페인트가 자유 형태 그레이디언트가 아닙니다(paint.editGradient {kind}(으)로 적용하세요) +@msg the parameters or body do not form one function 매개변수나 본문이 하나의 함수를 이루지 않습니다 +@msg the parent must be a layer or sublayer 상위 항목은 레이어나 하위 레이어여야 합니다 +@msg the pasted SVG filter {name} draws differently from the document's filter of that name, and no free name fits it 붙여넣은 SVG 필터 {name}은(는) 문서에 있는 같은 이름의 필터와 다르게 그려지며, 쓸 수 있는 빈 이름이 없습니다 +@msg the path can't be extended 패스를 연장할 수 없습니다 +@msg the path can't be inside one of the objects to attach 패스가 부착할 개체 안에 있으면 안 됩니다 +@msg the path has no segments to measure 패스에 잴 세그먼트가 없습니다 +@msg the path is empty 패스가 비어 있습니다 +@msg the path is too short to shorten that much 패스가 너무 짧아 그만큼 줄일 수 없습니다 +@msg the paths are too many or too tangled to find where they cross 패스가 너무 많거나 너무 얽혀 있어 교차하는 곳을 찾을 수 없습니다 +@msg the pen table holds more than 255 pens 펜 테이블에 펜이 255개보다 많습니다 +@msg the picture has no objects 그림에 개체가 없습니다 +@msg the plates can't be kept 색판을 보관할 수 없습니다 +@msg the position table does not match the instructions 위치 테이블이 명령과 맞지 않습니다 +@msg the program runs too long 프로그램 실행 시간이 너무 깁니다 +@msg the program uses too much memory 프로그램이 메모리를 너무 많이 사용합니다 +@msg the prompt's text is longer than {MAX_PROMPT_BYTES} bytes 프롬프트의 텍스트가 {MAX_PROMPT_BYTES}바이트보다 깁니다 +@msg the radix must be between 2 and 36 기수는 2에서 36 사이여야 합니다 +@msg the rectangle must have a width and a height 사각형에는 너비와 높이가 있어야 합니다 +@msg the rectangle needs a size and must lie on the canvas 사각형에는 크기가 있어야 하고 캔버스 위에 있어야 합니다 +@msg the rectangle or line reaches too many paths to check 사각형이나 선이 닿는 패스가 너무 많아 확인할 수 없습니다 +@msg the right side of 'in' is not an object 'in'의 오른쪽이 개체가 아닙니다 +@msg the right side of 'instanceof' is not a function 'instanceof'의 오른쪽이 함수가 아닙니다 +@msg the selected art has no width 선택한 아트웍에 너비가 없습니다 +@msg the selected art is nested more than {MAX_DEPTH} levels deep 선택한 아트웍이 {MAX_DEPTH}단계보다 깊게 중첩되어 있습니다 +@msg the selected art is too large to measure 선택한 아트웍이 너무 커서 잴 수 없습니다 +@msg the selection draws nothing 선택 영역이 아무것도 그리지 않습니다 +@msg the selection has no area 선택 영역에 면적이 없습니다 +@msg the selection has no art to export 선택 영역에 내보낼 아트웍이 없습니다 +@msg the selection has no bounds 선택 영역에 경계가 없습니다 +@msg the selection has no graphic style 선택 영역에 그래픽 스타일이 없습니다 +@msg the selection has no outlines to weed around 선택 영역에 둘레를 위딩할 윤곽선이 없습니다 +@msg the slice would leave the canvas 슬라이스가 캔버스를 벗어납니다 +@msg the spacing makes more than {MAX_GROMMETS} grommets 이 간격으로는 아일렛이 {MAX_GROMMETS}개보다 많아집니다 +@msg the spot colour couldn't be added 별색을 추가할 수 없습니다 +@msg the subpath has no ends to extend (it is closed or a single point) 하위 패스에 연장할 끝이 없습니다(닫혀 있거나 점 하나입니다) +@msg the symbols are nested too deeply to expand their instances 심볼이 너무 깊게 중첩되어 있어 인스턴스를 확장할 수 없습니다 +@msg the text file is too large to place as type (at most {_1} MB) 텍스트 파일이 너무 커서 문자로 가져올 수 없습니다(최대 {_1} MB) +@msg the text is empty 텍스트가 비어 있습니다 +@msg the text is over {_1} MB 텍스트가 {_1} MB를 넘습니다 +@msg the top object must be a path 맨 위 개체는 패스여야 합니다 +@msg the trace was cancelled 추적이 취소되었습니다 +@msg the trailer has no size 트레일러에 크기가 없습니다 +@msg the type object is flattened to nothing 문자 개체를 병합하면 아무것도 남지 않습니다 +@msg the value bind was called on is not a function bind를 호출한 값이 함수가 아닙니다 +@msg the value is not a constructor 값이 생성자가 아닙니다 +@msg the value is not a function 값이 함수가 아닙니다 +@msg the value is not a valid XML name 값이 올바른 XML 이름이 아닙니다 +@msg the value is not an XML attribute name 값이 XML 속성 이름이 아닙니다 +@msg the value is not an XML name 값이 XML 이름이 아닙니다 +@msg the value of axis `{tag}` must be a number or null 축 `{tag}`의 값은 숫자 또는 null이어야 합니다 +@msg the variable library declares more than {MAX_LIBRARY_DATASETS} data sets 변수 라이브러리가 데이터 세트를 {MAX_LIBRARY_DATASETS}개보다 많이 선언합니다 +@msg the variable library declares more than {MAX_LIBRARY_ENTITIES} entities 변수 라이브러리가 엔티티를 {MAX_LIBRARY_ENTITIES}개보다 많이 선언합니다 +@msg the variable library declares more than {MAX_LIBRARY_VARIABLES} variables 변수 라이브러리가 변수를 {MAX_LIBRARY_VARIABLES}개보다 많이 선언합니다 +@msg the variable library declares no variables 변수 라이브러리가 변수를 선언하지 않습니다 +@msg the variable library is larger than {MAX_LIBRARY_BYTES} bytes 변수 라이브러리가 {MAX_LIBRARY_BYTES}바이트보다 큽니다 +@msg the variable library is not UTF-8 변수 라이브러리가 UTF-8이 아닙니다 +@msg the variable library is not well-formed XML: {e} 변수 라이브러리가 올바른 형식의 XML이 아닙니다: {e} +@msg the variable library nests elements more than {MAX_LIBRARY_NESTING} deep 변수 라이브러리에 요소가 {MAX_LIBRARY_NESTING}단계보다 깊게 중첩되어 있습니다 +@msg the variable library's document type declaration holds something other than entities of plain text 변수 라이브러리의 문서 형식 선언에 일반 텍스트 엔티티가 아닌 것이 있습니다 +@msg the variable library's entities expand to more than {MAX_LIBRARY_BYTES} bytes 변수 라이브러리의 엔티티를 확장하면 {MAX_LIBRARY_BYTES}바이트를 넘습니다 +@msg the weeding lines cross the art's outlines too many times to measure; use fewer lines 위딩 선이 아트웍의 윤곽선과 너무 많이 교차해 잴 수 없습니다. 선을 줄이세요 +@msg the weeding lines pass too close to too many outline segments to measure; use fewer lines or a smaller gap 위딩 선이 너무 많은 윤곽선 세그먼트에 너무 가깝게 지나가 잴 수 없습니다. 선을 줄이거나 간격을 줄이세요 +@msg the weeding lines would be more than {max_pieces} pieces 위딩 선이 {max_pieces}개보다 많은 조각이 됩니다 +@msg the window has no dock 창에 도킹 영역이 없습니다 +@msg the written PDF has no catalog 기록한 PDF에 카탈로그가 없습니다 +@msg the written PDF has no cross-reference table 기록한 PDF에 상호 참조 테이블이 없습니다 +@msg the written PDF's metadata can't be edited 기록한 PDF의 메타데이터를 편집할 수 없습니다 +@msg the {_1} plate lies outside the file {_1} 색판이 파일 밖에 있습니다 +@msg there are no colour swatches to draw 그릴 색상 견본이 없습니다 +@msg there is already a design named `{name}` `{name}` 디자인이 이미 있습니다 +@msg there is already a design named `{to}` `{to}` 디자인이 이미 있습니다 +@msg there is already a toolbar named `{name}` `{name}` 도구 막대가 이미 있습니다 +@msg there is already a toolbar named `{to}` `{to}` 도구 막대가 이미 있습니다 +@msg there is no banner to mark 표시할 배너가 없습니다 +@msg there is no library: create one first 라이브러리가 없습니다: 먼저 하나 만드세요 +@msg these paths are too degenerate for Shaper 이 패스는 셰이퍼에 쓰기에는 지나치게 퇴화되어 있습니다 +@msg this is a binary DXF file, which can't be read: save it from the CAD app as an ASCII DXF and open that 바이너리 DXF 파일은 읽을 수 없습니다. CAD 앱에서 ASCII DXF로 저장한 후 여세요 +@msg this warp's points can't be edited: use Reset with Mesh first 이 왜곡의 점은 편집할 수 없습니다: 먼저 메시로 재설정을 사용하세요 +@msg thumbnail: no page {v} (the {what} has {count}) thumbnail: 페이지 {v}이(가) 없습니다({what}의 페이지 수: {count}) +@msg tileRange of {what}: {e} {what}의 tileRange: {e} +@msg title can't be empty title은 비워 둘 수 없습니다 +@msg to (the new name) is required to(새 이름)가 필요합니다 +@msg to must be fill or stroke to는 fill 또는 stroke여야 합니다 +@msg to must be smooth or corner to는 smooth 또는 corner여야 합니다 +@msg toExponential() digits must be between 0 and 20 toExponential()의 자릿수는 0에서 20 사이여야 합니다 +@msg toFixed() digits must be between 0 and 20 toFixed()의 자릿수는 0에서 20 사이여야 합니다 +@msg toISOString is not a function toISOString이 함수가 아닙니다 +@msg toPrecision() argument must be between 1 and 21 toPrecision()의 인수는 1에서 21 사이여야 합니다 +@msg toSource: a getter cannot be written as source toSource: getter는 소스로 기록할 수 없습니다 +@msg toSource: an array with properties besides its elements, a property that is not enumerable or another prototype cannot be written as source toSource: 요소 외에 속성이 있거나, 열거할 수 없는 속성이 있거나, 프로토타입이 다른 배열은 소스로 기록할 수 없습니다 +@msg toSource: an object with a property that is not enumerable, or whose prototype is not Object.prototype, cannot be written as source toSource: 열거할 수 없는 속성이 있거나 프로토타입이 Object.prototype이 아닌 개체는 소스로 기록할 수 없습니다 +@msg toSource: the source is too long toSource: 소스가 너무 깁니다 +@msg toSource: the value contains itself toSource: 값이 자신을 포함합니다 +@msg toSource: the value has too many entries toSource: 값에 항목이 너무 많습니다 +@msg toSource: the value is nested too deep toSource: 값이 너무 깊게 중첩되어 있습니다 +@msg toString is not a function toString이 함수가 아닙니다 +@msg too large for a zip archive: package to a folder zip 아카이브에 넣기에는 너무 큽니다: 폴더로 패키지하세요 +@msg too many Shaper edits 셰이퍼 편집이 너무 많습니다 +@msg too many `points` (at most 100000) `points`가 너무 많습니다(최대 100000개) +@msg too many arguments 인수가 너무 많습니다 +@msg too many characters: at most {MAX_CHARS} 글자가 너무 많습니다: 최대 {MAX_CHARS}자 +@msg too many dots for this size: lower the frequency 이 크기에는 점이 너무 많습니다: 주파수를 낮추세요 +@msg too many filters over one file 한 파일에 필터가 너무 많습니다 +@msg too many overlapping paths for Shaper 셰이퍼에 쓰기에는 겹치는 패스가 너무 많습니다 +@msg too many quantifiers 수량자가 너무 많습니다 +@msg too many saved clips 저장된 클립이 너무 많습니다 +@msg too many saved graphics states 저장된 그래픽 상태가 너무 많습니다 +@msg toolbar (a toolbar's name) must be a string toolbar(도구 막대 이름)는 문자열이어야 합니다 +@msg toolbar name can't be empty 도구 막대 이름은 비워 둘 수 없습니다 +@msg transparentImages {v}: "flatten" (the default) or "omit" transparentImages {v}: "flatten"(기본값) 또는 "omit"이어야 합니다 +@msg turn on at least one side 한쪽 이상을 켜세요 +@msg two saved selections would be named `{_1}` 저장된 선택 영역 두 개의 이름이 `{_1}`이(가) 됩니다 +@msg type dimension cannot be represented with this text transform 이 텍스트 변형으로는 문자 치수를 나타낼 수 없습니다 +@msg type dimension must be finite 문자 치수는 유한해야 합니다 +@msg unexpected resources 예상하지 못한 리소스 +@msg unknown CMYK profile `{name}` 알 수 없는 CMYK 프로파일 `{name}` +@msg unknown File Info field `{k}` 알 수 없는 파일 정보 필드 `{k}` +@msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; prefix - to turn off; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take an alternate's number as `tag=N` with N from 0 to {_1}, as `salt=2`) 알 수 없는 OpenType 기능 `{t}`(liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt. 끄려면 앞에 -를 붙이세요. swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt는 대체 글리프 번호를 `tag=N` 형식으로 받으며 N은 0에서 {_1} 사이입니다. 예: `salt=2`) +@msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) featureChanges의 알 수 없는 OpenType 기능 `{t}`(`features`가 받는 태그를 사용하세요) +@msg unknown PDF preset `{name}` (presets: {_1}) 알 수 없는 PDF 프리셋 `{name}`(프리셋: {_1}) +@msg unknown Warp style 알 수 없는 왜곡 스타일 +@msg unknown alignToPath `{a}` 알 수 없는 alignToPath `{a}` +@msg unknown arrowhead {v} 알 수 없는 화살촉 {v} +@msg unknown artboardLayout key `{k}` (layout, columns, spacing, rightToLeft) 알 수 없는 artboardLayout 키 `{k}`(layout, columns, spacing, rightToLeft) +@msg unknown attribute `{attribute}` 알 수 없는 속성 `{attribute}` +@msg unknown attribute `{k}` 알 수 없는 속성 `{k}` +@msg unknown axis `{other}` (vertical|horizontal|free) 알 수 없는 축 `{other}`(vertical|horizontal|free) +@msg unknown blend mode `{b}` 알 수 없는 혼합 모드 `{b}` +@msg unknown blend mode {b} 알 수 없는 혼합 모드 {b} +@msg unknown brush type `{o}` 알 수 없는 브러시 유형 `{o}` +@msg unknown category `{c}` 알 수 없는 범주 `{c}` +@msg unknown category `{c}` ({_1}) 알 수 없는 범주 `{c}`({_1}) +@msg unknown character `{c}` 알 수 없는 문자 `{c}` +@msg unknown character style number field 알 수 없는 문자 스타일 숫자 필드 +@msg unknown dither `{d}` (diffusion, pattern, noise or none) 알 수 없는 디더 `{d}`(diffusion, pattern, noise 또는 none) +@msg unknown effect `{e}` 알 수 없는 효과 `{e}` +@msg unknown end {e} 알 수 없는 끝 {e} +@msg unknown flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution or a saved one: see flattener.presets.list) 알 수 없는 flattenerPreset `{name}`(High Resolution, Medium Resolution, Low Resolution 또는 저장된 프리셋: flattener.presets.list 참조) +@msg unknown format `{f}` (vcswatches, gpl, ase or css) 알 수 없는 형식 `{f}`(vcswatches, gpl, ase 또는 css) +@msg unknown from {f} 알 수 없는 from {f} +@msg unknown graph type `{t}` 알 수 없는 그래프 유형 `{t}` +@msg unknown grid colours `{name}` (one of {_1}) 알 수 없는 격자 색상 `{name}`({_1} 중 하나) +@msg unknown gridType `{t}` 알 수 없는 gridType `{t}` +@msg unknown highlight `{v}` 알 수 없는 강조 `{v}` +@msg unknown intent `{i}` 알 수 없는 의도 `{i}` +@msg unknown issue kind {id} 알 수 없는 문제 종류 {id} +@msg unknown issue kind {v} 알 수 없는 문제 종류 {v} +@msg unknown knockout state {k} 알 수 없는 녹아웃 상태 {k} +@msg unknown language `{language}` (one of {_1}) 알 수 없는 언어 `{language}`({_1} 중 하나) +@msg unknown language `{l}` (one of {_1}) 알 수 없는 언어 `{l}`({_1} 중 하나) +@msg unknown method `{m}` ({_1}) 알 수 없는 방법 `{m}`({_1}) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) 알 수 없는 모드 `{other}`(gray, rgb, hsb, lab, cmyk 또는 web) +@msg unknown mode `{other}` (mono|cmyk) 알 수 없는 모드 `{other}`(mono|cmyk) +@msg unknown mode `{other}` (rgb|cmyk|gray|global) 알 수 없는 모드 `{other}`(rgb|cmyk|gray|global) +@msg unknown mode `{other}` (set, add, subtract) 알 수 없는 모드 `{other}`(set, add, subtract) +@msg unknown mode `{o}` 알 수 없는 모드 `{o}` +@msg unknown mode {m} 알 수 없는 모드 {m} +@msg unknown model `{other}` 알 수 없는 모델 `{other}` +@msg unknown model `{other}` (keep, new or document) 알 수 없는 모델 `{other}`(keep, new 또는 document) +@msg unknown op {o} 알 수 없는 연산 {o} +@msg unknown order `{o}`: toggle, front, forward, backward or back 알 수 없는 순서 `{o}`: toggle, front, forward, backward 또는 back +@msg unknown overprints `{v}` (preserve, simulate or discard) 알 수 없는 오버프린트 `{v}`(preserve, simulate 또는 discard) +@msg unknown panel 알 수 없는 패널 +@msg unknown panel `{panel}` 알 수 없는 패널 `{panel}` +@msg unknown parameter `{key}` 알 수 없는 매개변수 `{key}` +@msg unknown parameter `{within}settings.{format}`; {why} 알 수 없는 매개변수 `{within}settings.{format}`: {why} +@msg unknown parameter `{within}{key}`; {why} 알 수 없는 매개변수 `{within}{key}`: {why} +@msg unknown pieLegend `{v}` (none, standard or wedges) 알 수 없는 pieLegend `{v}`(none, standard 또는 wedges) +@msg unknown piePosition `{v}` (even, ratio or stacked) 알 수 없는 piePosition `{v}`(even, ratio 또는 stacked) +@msg unknown pieSort `{v}` (none, all or first) 알 수 없는 pieSort `{v}`(none, all 또는 first) +@msg unknown plate `{n}` 알 수 없는 색판 `{n}` +@msg unknown preference `{k}` 알 수 없는 환경 설정 `{k}` +@msg unknown profile {id} (see stroke.widthProfile.list) 알 수 없는 프로파일 {id}(stroke.widthProfile.list 참조) +@msg unknown proof target `{t}` 알 수 없는 교정 대상 `{t}` +@msg unknown quotes key `{k}` (double, single) 알 수 없는 따옴표 키 `{k}`(double, single) +@msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) 알 수 없는 색상 축소 방식 `{reduction}`(selective, perceptual, adaptive, web, gray, blackWhite, uniform 또는 document) +@msg unknown resolution `{v}` 알 수 없는 해상도 `{v}` +@msg unknown rule `{rule}` ({_1}) 알 수 없는 규칙 `{rule}`({_1}) +@msg unknown rule `{r}` (see color.harmony) 알 수 없는 규칙 `{r}`(color.harmony 참조) +@msg unknown setting `{k}` 알 수 없는 설정 `{k}` +@msg unknown shape `{v}` (circle|ellipse|square|diamond|line) 알 수 없는 모양 `{v}`(circle|ellipse|square|diamond|line) +@msg unknown spacing `{o}` (smooth|steps|distance) 알 수 없는 간격 `{o}`(smooth|steps|distance) +@msg unknown tileType `{t}` ({_1}) 알 수 없는 tileType `{t}`({_1}) +@msg unknown units 알 수 없는 단위 +@msg unknown units `{u}` 알 수 없는 단위 `{u}` +@msg unknown value axis `{v}` (left, right or both) 알 수 없는 값 축 `{v}`(left, right 또는 both) +@msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) 알 수 없는 변형 `{v}`(tintsShades|warmCool|vividMuted) +@msg unknown warp style `{s}` 알 수 없는 왜곡 스타일 `{s}` +@msg unknown {key} `{v}` (none, short or full) 알 수 없는 {key} `{v}`(none, short 또는 full) +@msg unknown {key} profile `{n}` 알 수 없는 {key} 프로파일 `{n}` +@msg unknown {k} key `{key}` (size, position) 알 수 없는 {k} 키 `{key}`(size, position) +@msg unmatched ')' 짝이 맞지 않는 ')' +@msg unreadable object 읽을 수 없는 개체 +@msg unsafe destination file name 안전하지 않은 대상 파일 이름 +@msg unterminated character class 닫히지 않은 문자 클래스 +@msg unterminated group 닫히지 않은 그룹 +@msg use paths or compound paths 패스나 컴파운드 패스를 사용하세요 +@msg useArtboards must be true or false, not {v} useArtboards는 {v}이(가) 아니라 true 또는 false여야 합니다 +@msg value for `{var}` must match its variable kind `{var}`의 값은 변수 종류와 맞아야 합니다 +@msg variable `{_1}` is already defined 변수 `{_1}`이(가) 이미 정의되어 있습니다 +@msg variable `{name}` has no `trait` 변수 `{name}`에 `trait`이(가) 없습니다 +@msg variable `{name}` is already defined 변수 `{name}`이(가) 이미 정의되어 있습니다 +@msg variable `{name}` is declared twice 변수 `{name}`이(가) 두 번 선언되었습니다 +@msg variable `{to}` already exists 변수 `{to}`이(가) 이미 있습니다 +@msg view is required view가 필요합니다 +@msg view must be one of {_1} view는 {_1} 중 하나여야 합니다 +@msg warpStyle can only edit an applied Warp effect warpStyle은 적용된 왜곡 효과만 편집할 수 있습니다 +@msg width and height must be more than 0 and at most {limit} 너비와 높이는 0보다 크고 {limit} 이하여야 합니다 +@msg width factors must be finite 너비 계수는 유한해야 합니다 +@msg width must be positive width는 양수여야 합니다 +@msg width out of range 너비가 범위를 벗어났습니다 +@msg width/height must be > 0 너비/높이는 0보다 커야 합니다 +@msg with no hem and no grommets there is nothing to mark 단 접기와 아일렛이 모두 없으면 표시할 것이 없습니다 +@msg wordGap and lineGap need area type in the selection wordGap과 lineGap을 쓰려면 선택 항목에 영역 문자가 있어야 합니다 +@msg x and y must be finite numbers x와 y는 유한한 숫자여야 합니다 +@msg x and y must be given together x와 y는 함께 지정해야 합니다 +@msg xpath needs its variables as an object xpath는 변수를 개체로 받아야 합니다 +@msg xpath needs the expression as a string xpath는 식을 문자열로 받아야 합니다 +@msg zone needs an anchor: dock beside a panel with anchor, or in a new dock column with side (Start or End) zone에는 기준이 필요합니다: anchor로 패널 옆에 도킹하거나 side(Start 또는 End)로 새 도크 열에 도킹하세요 +@msg zoom must be positive zoom은 양수여야 합니다 +@msg {C}: no effect at index {list} {C}: 인덱스 {list}에 효과가 없습니다 +@msg {DEFAULT_PRESET} is protected and stays {DEFAULT_PRESET}은(는) 보호되어 있어 그대로 유지됩니다 +@msg {DEFAULT_PRESET} is protected: save the settings under another name {DEFAULT_PRESET}은(는) 보호되어 있습니다: 설정을 다른 이름으로 저장하세요 +@msg {GRANT_NOT_REMOVED}, and its settings and cache can't be moved back from {_1} to {_2}: {e} {GRANT_NOT_REMOVED}. 또한 설정과 캐시를 {_1}에서 {_2}(으)로 되돌려 옮길 수 없습니다: {e} +@msg {LABEL} produced an empty result {LABEL}의 결과가 비어 있습니다 +@msg {_1} MB of document, at most {_2} MB 문서 {_1} MB, 최대 {_2} MB +@msg {_1} MB of images, at most {_2} MB 이미지 {_1} MB, 최대 {_2} MB +@msg {_1} bytes of RGBA data for a {width} × {height} image {width} × {height} 이미지에 대한 RGBA 데이터 {_1}바이트 +@msg {_1} can't be read, or changed since it was read: relink or update it first {_1}을(를) 읽을 수 없거나 읽은 뒤에 바뀌었습니다: 먼저 다시 연결하거나 업데이트하세요 +@msg {_1} can't go into {into} {_1}은(는) {into}에 넣을 수 없습니다 +@msg {_1} can't limit printing to low resolution: choose PDF 1.4 or later, or allow high-resolution printing {_1}은(는) 인쇄를 저해상도로 제한할 수 없습니다: PDF 1.4 이상을 선택하거나 고해상도 인쇄를 허용하세요 +@msg {_1} files can't be opened yet {_1} 파일은 아직 열 수 없습니다 +@msg {_1} files can't be password-protected: remove the passwords or choose no standard {_1} 파일은 암호로 보호할 수 없습니다: 암호를 제거하거나 표준을 선택하지 마세요 +@msg {_1} files can't be {_2} {_1} 파일은 {_2}일 수 없습니다 +@msg {_1} files can't carry editing data: turn off preserveEditing {_1} 파일에는 편집 데이터를 담을 수 없습니다: preserveEditing을 끄세요 +@msg {_1} files can't have PDF layers: turn off createLayers {_1} 파일에는 PDF 레이어를 둘 수 없습니다: createLayers를 끄세요 +@msg {_1} files need a creation date, and this platform has no clock to give one {_1} 파일에는 작성 날짜가 필요하지만 이 플랫폼에는 날짜를 알려 줄 시계가 없습니다 +@msg {_1} is not a folder: {e} {_1}은(는) 폴더가 아닙니다: {e} +@msg {_1} isn't a path {_1}은(는) 패스가 아닙니다 +@msg {_1} options: {e} {_1} 옵션: {e} +@msg {_1} paints nothing to rasterize {_1}에는 래스터화할 칠이 없습니다 +@msg {_1} passwords can have up to {MAX_LEGACY_PASSWORD} ASCII characters (PDF 1.7 and later take any) {_1} 암호에는 ASCII 문자를 {MAX_LEGACY_PASSWORD}자까지 쓸 수 있습니다(PDF 1.7 이상은 모든 문자를 받습니다) +@msg {_1} with linked images or an image map writes several files: use document.export 연결된 이미지나 이미지 맵이 있는 {_1}은(는) 여러 파일을 기록합니다: document.export를 사용하세요 +@msg {_1} writes one file per artboard here: use document.export, or name one artboard 여기서 {_1}은(는) 아트보드마다 파일을 하나씩 기록합니다: document.export를 사용하거나 아트보드 하나를 지정하세요 +@msg {_1} × {_2} pixels is too large for {_3} (at most {max} pixels a side): lower the scale {_1} × {_2}픽셀은 {_3}에 너무 큽니다(한 변 최대 {max}픽셀): 비율을 낮추세요 +@msg {_1}: belongs to another account {_1}: 다른 계정의 소유입니다 +@msg {_1}: not a folder of its own {_1}: 자체 폴더가 아닙니다 +@msg {_1}: not a plain file {_1}: 일반 파일이 아닙니다 +@msg {_1}: {_2} and {_3} are in the way {_1}: {_2}와(과) {_3}이(가) 가로막고 있습니다 +@msg {code}: {0} {code}: {0} +@msg {dest}: {e} {dest}: {e} +@msg {dir}: {e} {dir}: {e} +@msg {doc} has no folder {doc}에는 폴더가 없습니다 +@msg {file} isn't linked {file}은(는) 연결되어 있지 않습니다 +@msg {file} names more than one linked JavaScript file {file}이(가) 연결된 JavaScript 파일을 둘 이상 지정합니다 +@msg {folder} is not a package folder {folder}은(는) 패키지 폴더가 아닙니다 +@msg {folder}: more than {max} files and folders {folder}: 파일과 폴더가 {max}개를 넘습니다 +@msg {folder}: {e} {folder}: {e} +@msg {g} is not a Live Paint group {g}은(는) 라이브 페인트 그룹이 아닙니다 +@msg {id} is not a slice {id}은(는) 슬라이스가 아닙니다 +@msg {key} must be 0–{MAX_ADD_AROUND} pt {key}은(는) 0–{MAX_ADD_AROUND} pt여야 합니다 +@msg {key} must be [x,y] {key}은(는) [x,y]여야 합니다 +@msg {key} must be a percentage {min}..100 {key}은(는) {min}..100 사이의 백분율이어야 합니다 +@msg {key} must be a positive number, not {n} {key}은(는) {n}이(가) 아니라 양수여야 합니다 +@msg {key} must be a positive number, not {v} {key}은(는) {v}이(가) 아니라 양수여야 합니다 +@msg {key} must be one of {_1} {key}은(는) {_1} 중 하나여야 합니다 +@msg {key} must be {_1}, got {s} {key}은(는) {_1}이어야 합니다({s} 입력됨) +@msg {key} must name a floating panel {key}은(는) 떠 있는 패널을 지정해야 합니다 +@msg {key} must name a panel in another group {key}은(는) 다른 그룹의 패널을 지정해야 합니다 +@msg {key} must name a panel that shows {key}은(는) 표시된 패널을 지정해야 합니다 +@msg {key} must name a registered panel {key}은(는) 등록된 패널을 지정해야 합니다 +@msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} 파일에는 투명도가 없는데 이 파일에는 {what}이(가) 있게 됩니다: 먼저 병합하세요(object.flattenTransparency) +@msg {kind} images can't be opened (see document.formats) {kind} 이미지는 열 수 없습니다(document.formats 참조) +@msg {k} `{v}` is not one of the choices {k} `{v}`은(는) 선택 항목 중 하나가 아닙니다 +@msg {k} has control characters{_1} {k}에 제어 문자가 있습니다{_1} +@msg {k} is too long (at most {MAX_TEXT} characters) {k}이(가) 너무 깁니다(최대 {MAX_TEXT}자) +@msg {k} must be > 0 {k}은(는) 0보다 커야 합니다 +@msg {k} must be a number (pt) or a length such as "210 mm" {k}은(는) 숫자(pt) 또는 "210 mm" 같은 길이여야 합니다 +@msg {k} must be a number from {min} to {max} {k}은(는) {min}에서 {max} 사이의 숫자여야 합니다 +@msg {k} must be a number or "auto" {k}은(는) 숫자 또는 "auto"여야 합니다 +@msg {k} must be a string {k}은(는) 문자열이어야 합니다 +@msg {k} must be text {k}은(는) 텍스트여야 합니다 +@msg {k} must be true or false {k}은(는) true 또는 false여야 합니다 +@msg {k} must be {{size?, position?}} {k}은(는) {{size?, position?}}여야 합니다 +@msg {k}: a custom arrowhead's path needs an area to fill and at most {most} anchors and {most} subpaths, each anchor within {far} head units of its tip {k}: 사용자 정의 화살촉의 패스에는 칠할 영역이 있어야 하고 기준점은 {most}개 이하, 하위 패스는 {most}개 이하여야 하며, 각 기준점은 끝에서 화살촉 단위로 {far} 이내에 있어야 합니다 +@msg {k}: bad custom arrowhead path: {e} {k}: 잘못된 사용자 정의 화살촉 패스: {e} +@msg {k}: bad custom arrowhead: {e} {k}: 잘못된 사용자 정의 화살촉: {e} +@msg {k}: can't read `{s}` as a length {k}: `{s}`을(를) 길이로 읽을 수 없습니다 +@msg {k}: custom must be a name {k}: custom은 이름이어야 합니다 +@msg {label} must be a number at most {max} {label}은(는) {max} 이하의 숫자여야 합니다 +@msg {label} must be a number from -1296 to 1296 {label}은(는) -1296에서 1296 사이의 숫자여야 합니다 +@msg {label} must be a number from 1 to 10000 {label}은(는) 1에서 10000 사이의 숫자여야 합니다 +@msg {name} `{s}`: {ids} {name} `{s}`: {ids} +@msg {name} is built in and can't be deleted {name}은(는) 기본 제공 항목이라 삭제할 수 없습니다 +@msg {name} must be a number {name}은(는) 숫자여야 합니다 +@msg {name} must be {lo}–{hi}{unit} (got {v}) {name}은(는) {lo}–{hi}{unit}여야 합니다({v} 입력됨) +@msg {name}: CRC or size mismatch {name}: CRC 또는 크기가 일치하지 않습니다 +@msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: 이 Affinity 파일은 포함된 미리 보기만 읽을 수 있었습니다. 경고와 함께 보려면 파일 › 열기를 사용하거나, 가져오기 전에 Affinity에서 SVG 또는 PDF로 내보내세요 +@msg {name}: {e} {name}: {e} +@msg {native}; its embedded preview can't be read either ({e}) {native}. 포함된 미리 보기도 읽을 수 없습니다({e}) +@msg {path}: copy takes a DCS file only when its plates are inside it; relink to it where its plate files are {path}: 복사는 색판이 파일 안에 있는 DCS 파일만 받습니다. 색판 파일이 있는 위치의 파일로 다시 연결하세요 +@msg {path}: larger than {_1} MB {path}: {_1} MB보다 큽니다 +@msg {saving} failed: {e} {saving} 실패: {e} +@msg {shown} is not an XPath 1.0 function {shown}은(는) XPath 1.0 함수가 아닙니다 +@msg {std} files are CMYK, and the file would have colours in {_1} {std} 파일은 CMYK인데 이 파일에는 {_1} 색상이 있게 됩니다 +@msg {std} files embed their fonts, and the file would have one that isn't {std} 파일은 글꼴을 포함하는데 이 파일에는 포함되지 않은 글꼴이 있게 됩니다 +@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway {target}은(는) 이 문서를 읽어 온 파일이며 읽을 때 빠진 내용이 있습니다({what}): 덮어쓰면 그 내용을 영구히 잃습니다. 다른 파일에 기록하거나, 그래도 바꾸려면 acknowledgeLoss: true를 전달하세요 +@msg {ty} brushes need selected art (or params.{k}) {ty} 브러시에는 선택한 아트웍(또는 params.{k})이 필요합니다 +@msg {v} is not an asset id {v}은(는) 에셋 id가 아닙니다 +@msg {v} names no layer or sublayer {v}에 해당하는 레이어나 하위 레이어가 없습니다 +@msg {what} can't be intertwined {what}은(는) 교차할 수 없습니다 +@msg {what} doesn't fit the paper with its bleed and marks {what}은(는) 도련과 표시를 포함하면 용지에 맞지 않습니다 +@msg {what} is not a function {what}은(는) 함수가 아닙니다 +@msg {what} would print more than {MAX_COPIES_PER_SHEET} copies on a sheet: scale it up {what}은(는) 한 장에 {MAX_COPIES_PER_SHEET}개보다 많이 인쇄됩니다: 크기를 키우세요 +@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what}은(는) 타일 {MAX_TILES}개보다 많이 나뉘어 인쇄됩니다: 크기를 줄이세요 +@msg {what} {i} out of range {what} {i}이(가) 범위를 벗어났습니다 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 94957fb782..ed281382a4 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -157,6 +157,7 @@ @msg `select` must be true or false `select` moet true of false zijn @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` en `maxAnchors` moeten gehele getallen zijn @msg `{key}` must be a number not below 0 `{key}` moet een getal van minstens 0 zijn +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` moet uit vier getallen van minstens 0 bestaan: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` moet [x, y, width, height] zijn: vier eindige getallen, width en height niet negatief @msg `{min_key}` is greater than `{max_key}` `{min_key}` is groter dan `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` geef minstens een van `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -289,8 +290,8 @@ @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` een exportplug-in declareert 1 tot {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` maximaal {MAX_UNGROUPED} parameters buiten groepen: geef de andere een `group` @msg can't encode the input de invoer kan niet worden gecodeerd -@msg expected {"dataBase64"} verwacht: {"dataBase64"} -@msg expected {"objects"} verwacht: {"objects"} +@msg expected {{"dataBase64": "…"}} verwacht: {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} verwacht: {{"objects": [...]}} @msg export `{name}`: {e} export `{name}`: {e} @msg extension {e} is listed twice extensie {e} staat twee keer in de lijst @msg extension {e}: use 1-16 lower-case letters and digits, without the dot extensie {e}: gebruik 1-16 kleine letters en cijfers, zonder de punt @@ -354,11 +355,11 @@ @msg a painted live effect returns only `objects` een geschilderd live-effect geeft alleen `objects` terug @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` een stuk van een geschilderd live-effect heeft alleen `path`, `fillRule`, `fills` en `strokes` @msg a read-only object was left out een alleen-lezen object is weggelaten -@msg a read-only object was left out: return it, as {"id"} alone or as it was given een alleen-lezen object is weggelaten: geef het terug, als alleen {"id"} of zoals het is gegeven +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given een alleen-lezen object is weggelaten: geef het terug, als alleen {{"id": …}} of zoals het is gegeven @msg a string een string @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` een contour heeft alleen `paint`, `width`, `join`, `cap` en `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} een contour moet {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} zijn -@msg an effect must be {"id", "params"?, "visible"?} een effect moet {"id", "params"?, "visible"?} zijn +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} een contour moet {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} zijn +@msg an effect must be {{"id", "params"?, "visible"?}} een effect moet {{"id", "params"?, "visible"?}} zijn @msg an effect on a fill returns only `fills` een effect op een vulling geeft alleen `fills` terug @msg an effect on a stroke returns only `strokes` een effect op een contour geeft alleen `strokes` terug @msg an object must be a JSON object een object moet een JSON-object zijn @@ -711,6 +712,8 @@ Crop Image Afbeelding bijsnijden Image Tools Afbeeldingshulpmiddelen Remove Background… Achtergrond verwijderen… + Draw (Pencil) Tekenen (Potlood) + Place Image Afbeelding plaatsen Remove Background Achtergrond verwijderen Background Achtergrond Edge Color Randkleur @@ -1441,6 +1444,7 @@ VectorCraft Title Bar on Every Desktop VectorCraft-titelbalk op elk bureaublad The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Zolang de omgevingsvariabele VECTORCRAFT_TITLEBAR is ingesteld, kiest die de titelbalk. System Title Bar takes precedence over this option while it is on. Zolang Systeemtitelbalk is ingeschakeld, heeft die voorrang op deze optie. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Zolang VectorCraft-titelbalk op elk bureaublad is uitgeschakeld, tekent dit bureaublad de titelbalk van het venster, of deze optie nu aan of uit staat. Exit Afsluiten Distort Vervormen Diffuse Glow… Diffuse gloed… @@ -2023,6 +2027,7 @@ lighting Light Licht Proportional Metrics Proportionele metingen Insert Aki Left Aki links invoegen Insert Aki Right Aki rechts invoegen + Tsume Tsume Character Direction Tekenrichting Digits Cijfers Arabic Arabisch @@ -5107,6 +5112,7 @@ imageTrace Outline Contour @msg no action set to save geen actieset om op te slaan @msg the action set file can't be read in full het actiesetbestand kan niet volledig worden gelezen @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out „{name}” geladen: {n} stap is weggelaten|„{name}” geladen: {n} stappen zijn weggelaten +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` „{name}” geladen: {n} stap heeft een onbekende opdracht en is behouden: „{action}”, stap {step}, `{command}`|„{name}” geladen: {n} stappen hebben onbekende opdrachten en zijn behouden; de eerste: „{action}”, stap {step}, `{command}` @msg not an action set file geen actiesetbestand @msg the action set file is larger than 8 MiB het actiesetbestand is groter dan 8 MiB @msg the action set file holds more than 1,000 actions het actiesetbestand bevat meer dan 1.000 acties @@ -5308,15 +5314,16 @@ imageTrace Outline Contour @msg tool shortcuts must be a single key (optionally with Shift) gereedschapsneltoetsen moeten uit één toets bestaan (eventueel met Shift) @msg truncated afgekapt @msg unknown command `{0}` onbekende opdracht `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` stap {step} van „{action}” voert de onbekende opdracht `{command}` uit @msg unknown command `{0}`; did you mean `{1}`? onbekende opdracht `{0}`; bedoelde je `{1}`? @msg unknown effect `{id}` onbekend effect `{id}` @msg unknown format onbekende indeling @msg unknown format `{f}` (Save writes {_1}) onbekende indeling `{f}` (Opslaan schrijft {_1}) -@msg unknown freeform mode `{m}` (points, lines) onbekende vrijvormmodus `{m}` (punten, lijnen) -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) onbekend verlooptype `{k}` (lineair, radiaal, conisch, ruit, vrijvorm) +@msg unknown freeform mode `{m}` (points, lines) onbekende vrijvormmodus `{m}` (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) onbekend verlooptype `{k}` (linear, radial, conic, diamond, freeform) @msg unknown highlight `{h}` onbekende markering `{h}` @msg unknown option `{path}.{k}` onbekende optie `{path}.{k}` -@msg unknown overprints `{o}` (preserve, simulate or discard) onbekende overdruk `{o}` (behouden, simuleren of verwerpen) +@msg unknown overprints `{o}` (preserve, simulate or discard) onbekende overdruk `{o}` (preserve, simulate of discard) @msg unknown panel `{raw}` onbekend paneel `{raw}` @msg unknown preference `{key}` onbekende voorkeur `{key}` @msg Preferences imported. Voorkeuren geïmporteerd. @@ -5334,10 +5341,10 @@ imageTrace Outline Contour @msg `{key}` must be an object `{key}` moet een object zijn @msg `prefs.import` runs on its own, not as a batch step `prefs.import` wordt los uitgevoerd, niet als stap van een batch @msg unknown preset (one of {_1}) onbekende voorinstelling (één van {_1}) -@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) onbekende voorinstelling `{name}` (hoog, middel, laag of een opgeslagen voorinstelling: zie flattener.presets.list) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) onbekende voorinstelling `{name}` (high, medium, low of een opgeslagen voorinstelling: zie flattener.presets.list) @msg unknown preset `{name}` (see flattener.presets.list) onbekende voorinstelling `{name}` (zie flattener.presets.list) @msg unknown preset `{name}` (see webExport.presets.list) onbekende voorinstelling `{name}` (zie webExport.presets.list) -@msg unknown side `{other}` (left|right|top|bottom) onbekende zijde `{other}` (links|rechts|boven|onder) +@msg unknown side `{other}` (left|right|top|bottom) onbekende zijde `{other}` (left|right|top|bottom) @msg unknown tool `{tool}` onbekend gereedschap `{tool}` @msg unknown tool `{t}` onbekend gereedschap `{t}` @msg unknown tool or command `{key}` onbekend gereedschap of opdracht `{key}` @@ -5557,6 +5564,1824 @@ imageTrace Outline Contour @msg missing panel layout ontbrekende paneelindeling @msg unsupported native docking operation niet-ondersteunde systeemeigen dokbewerking @msg this kind of brush has no options dialog yet dit soort penseel heeft nog geen dialoogvenster met opties + +# Status and error messages: the script engine's own errors, command parameters, file readers and +# writers, dialogs, panels and add-ons. Names in backticks, command ids, double-quoted values and +# bare true, false and null stay as the English writes them. +@msg 'caller', 'callee' and 'arguments' cannot be used on strict mode functions 'caller', 'callee' en 'arguments' kunnen niet worden gebruikt bij functies in strikte modus +@msg A profile supports one Revolve effect. Edit the existing effect's options instead. Een profiel ondersteunt één effect Draaien. Bewerk in plaats daarvan de opties van het bestaande effect. +@msg Add Points at Crossings: a path went missing Punten toevoegen bij kruisingen: er is een pad verdwenen +@msg Alignment must be one of the choices De uitlijning moet een van de keuzes zijn +@msg Boolean.prototype.{name} was called on a value that is not a Boolean Boolean.prototype.{name} is aangeroepen op een waarde die geen Boolean is +@msg CMYK images whose samples couldn't be read in CMYK were imported in RGB CMYK-afbeeldingen waarvan de samples niet in CMYK konden worden gelezen, zijn in RGB geïmporteerd +@msg CSS options: {e} CSS-opties: {e} +@msg CSV has a header but no data rows De CSV heeft een koptekst maar geen gegevensrijen +@msg CSV holds NUL bytes: save it as UTF-8, or as UTF-16 with a byte-order mark De CSV bevat NUL-bytes: sla het bestand op als UTF-8, of als UTF-16 met een byte-order mark +@msg CSV is empty De CSV is leeg +@msg CSV is larger than {MAX_CSV_BYTES} bytes De CSV is groter dan {MAX_CSV_BYTES} bytes +@msg CSV is not UTF-16 De CSV is geen UTF-16 +@msg CSV is not UTF-8 De CSV is geen UTF-8 +@msg CSV would be larger than {MAX_CSV_BYTES} bytes De CSV zou groter worden dan {MAX_CSV_BYTES} bytes +@msg Cannot write to the location of “{name}”; choose where to save it Kan niet schrijven naar de locatie van „{name}”; kies waar je het wilt opslaan +@msg Choose original artwork, not a dimension's generated paths Kies de oorspronkelijke illustratie, niet de gegenereerde paden van een maatlijn +@msg Contour: select paths or shapes Omtrek: selecteer paden of vormen +@msg Contour: the Offset Path effect is not available Omtrek: het effect Pad verschuiven is niet beschikbaar +@msg Create needs fills, strokes or both Maken heeft vullingen, contouren of beide nodig +@msg DCS files can only be placed linked: use File › Place with Link on DCS-bestanden kunnen alleen gekoppeld worden geplaatst: gebruik Bestand › Plaatsen met Koppeling ingeschakeld +@msg DXF options: {e} DXF-opties: {e} +@msg DXF scale must be a positive number up to {_1}, not {scale} De DXF-schaal moet een positief getal tot en met {_1} zijn, niet {scale} +@msg DXF {field} `{s}`: {allowed} DXF {field} `{s}`: {allowed} +@msg Date.prototype method called on a value that is not a Date object Een methode van Date.prototype is aangeroepen op een waarde die geen Date-object is +@msg Dimension is locked or hidden De maatlijn is vergrendeld of verborgen +@msg Dimension mode does not match its source De modus van de maatlijn komt niet overeen met de bron ervan +@msg Draw Inside needs exactly one selected path, compound path or text Binnen tekenen heeft precies één geselecteerd pad, samengesteld pad of tekstobject nodig +@msg EPS Save writes all artwork: use document.export for selected-only EPS Opslaan als EPS schrijft alle illustraties: gebruik document.export voor een EPS met alleen de selectie +@msg EPS flattener: {e} EPS-afvlakker: {e} +@msg EPS options: {e} EPS-opties: {e} +@msg EPS {field} `{s}`: {allowed} EPS {field} `{s}`: {allowed} +@msg Error.prototype.toString was called on a value that is not an object Error.prototype.toString is aangeroepen op een waarde die geen object is +@msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft Exporteren voor schermen schrijft png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai of vectorcraft +@msg Flare click coordinates must be finite numbers De klikcoördinaten van de flare moeten eindige getallen zijn +@msg Function.prototype.toString was called on a value that is not a function Function.prototype.toString is aangeroepen op een waarde die geen functie is +@msg HTML Text applies to object slices of type only HTML-tekst geldt alleen voor objectslices van tekst +@msg Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces) Objecten identificeren op staat op XML-id: de naam moet een geldige XML-id zijn (begin met een letter, onderstrepingsteken of dubbele punt; geen spaties) +@msg Image Trace failed: internal error: its thread stopped (please report this bug) Afbeelding traceren is mislukt: interne fout: de thread ervan is gestopt (meld deze bug alsjeblieft) +@msg Image Trace failed: {e} Afbeelding traceren is mislukt: {e} +@msg Image Trace finished, but its document was closed Afbeelding traceren is voltooid, maar het document ervan is gesloten +@msg Image Trace finished, but the image or its settings changed meanwhile: trace it again Afbeelding traceren is voltooid, maar de afbeelding of de instellingen ervan zijn intussen gewijzigd: traceer de afbeelding opnieuw +@msg Import SVG Filter reads SVG files, not SVGZ SVG-filter importeren leest SVG-bestanden, geen SVGZ +@msg Invalid dimension offset Ongeldige verschuiving van de maatlijn +@msg Invalid point Ongeldig punt +@msg JSON.parse: {why} (at offset {at}) JSON.parse: {why} (op positie {at}) +@msg JSON.stringify cannot write a structure that contains itself JSON.stringify kan geen structuur schrijven die zichzelf bevat +@msg Join: a subpath went missing Verbinden: er is een subpad verdwenen +@msg Line Gap must be a number De lijnafstand moet een getal zijn +@msg Lock Workspace is not available in VectorCraft Werkruimte vergrendelen is niet beschikbaar in VectorCraft +@msg Move Panel to New Window is not available: floating panels stay in the main window Paneel naar nieuw venster verplaatsen is niet beschikbaar: zwevende panelen blijven in het hoofdvenster +@msg Namespace.prototype.toString needs a Namespace Namespace.prototype.toString heeft een Namespace nodig +@msg New Document profiles need the preferences folder, which this run doesn't have Profielen voor nieuwe documenten hebben de voorkeurenmap nodig, die deze sessie niet heeft +@msg Number.prototype.{name} was called on a value that is not a number Number.prototype.{name} is aangeroepen op een waarde die geen getal is +@msg Object.create's prototype must be an object or null Het prototype van Object.create moet een object of null zijn +@msg Object.{function} was given a value that is not an object Object.{function} kreeg een waarde die geen object is +@msg Offset Path: the path is too complex to offset Pad verschuiven: het pad is te complex om te verschuiven +@msg Offset Path: {e} Pad verschuiven: {e} +@msg PDF content is incomplete or exceeds the reader's limits; no document was imported De PDF-inhoud is onvolledig of overschrijdt de limieten van de lezer; er is geen document geïmporteerd +@msg PDF flattener: {e} PDF-afvlakker: {e} +@msg PDF options: {e} PDF-opties: {e} +@msg QName.prototype.toString needs a QName QName.prototype.toString heeft een QName nodig +@msg Recolor Artwork is no longer open Artwork herkleuren is niet meer geopend +@msg RegExp.prototype.{name} was called on a value that is not a RegExp object RegExp.prototype.{name} is aangeroepen op een waarde die geen RegExp-object is +@msg SVG is not UTF-8, UTF-16 or ISO 8859-1 De SVG is geen UTF-8, UTF-16 of ISO 8859-1 +@msg Save writes one artboard: name one, or export several with document.export Opslaan schrijft één tekengebied: noem er een, of exporteer er meerdere met document.export +@msg Select a dimension first Selecteer eerst een maatlijn +@msg Select dimensions to update Selecteer maatlijnen om bij te werken +@msg Select only dimensions Selecteer alleen maatlijnen +@msg Select two or more objects, or a group Selecteer twee of meer objecten, of een groep +@msg Shaper needs 1–64 source paths Shaper heeft 1–64 bronpaden nodig +@msg Stencil Bridges: the selected art is too large or too detailed to bridge Sjabloonbruggen: de geselecteerde illustratie is te groot of te gedetailleerd om te overbruggen +@msg String.prototype.toString was called on a value that is not a string String.prototype.toString is aangeroepen op een waarde die geen string is +@msg Switch x/y is for scatter graphs x/y omwisselen is bedoeld voor spreidingsgrafieken +@msg Text options: {e} Tekstopties: {e} +@msg The link is inside a symbol, graph design, pattern or opacity mask and has no place on the canvas De koppeling zit in een symbool, grafiekontwerp, patroon of dekkingmasker en heeft geen plaats op het canvas +@msg The {name} profile could not be read, so the new document has the default settings: {reason} Het profiel {name} kon niet worden gelezen, dus heeft het nieuwe document de standaardinstellingen: {reason} +@msg Trap: more than {_1} pairs of objects lie close enough to trap, or too many objects share a horizontal range; trap fewer objects at a time Overbrugging: meer dan {_1} paren objecten liggen dicht genoeg bij elkaar om te overbruggen, of te veel objecten delen een horizontaal bereik; overbrug minder objecten tegelijk +@msg Weed Box and Lines: no weeding line fits outside the art, and the weed box is off Wiedkader en wiedlijnen: er past geen wiedlijn buiten de illustratie en het wiedkader is uitgeschakeld +@msg \\ at end of pattern \\ aan het einde van het patroon +@msg `alignOn` cannot be empty `alignOn` mag niet leeg zijn +@msg `alignOn` must be a string `alignOn` moet een string zijn +@msg `align` is start, center or end `align` is start, center of end +@msg `align` must be a string `align` moet een string zijn +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` moet een array van paren [subpath, anchor] zijn +@msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` moet ankerindexen bevatten (0, 1, 2…), niet {k} +@msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` moet ankerindexen bevatten (0, 1, 2…), niet {v} +@msg `answer` for this {kind} dialog must be one of: {_1} `answer` voor dit dialoogvenster {kind} moet een van de volgende zijn: {_1} +@msg `answers` has more than {MAX_ANSWERS} answers `answers` heeft meer dan {MAX_ANSWERS} antwoorden +@msg `answers` is larger than 1 MiB `answers` is groter dan 1 MiB +@msg `answers` must be a list of answers `answers` moet een lijst met antwoorden zijn +@msg `artboard` must be the index of an artboard of the document `artboard` moet de index van een tekengebied van het document zijn +@msg `artboardsAt` must be [x, y] `artboardsAt` moet [x, y] zijn +@msg `artboards` must be a list of artboard indices `artboards` moet een lijst met tekengebiedindexen zijn +@msg `artboards` names an artboard the document does not have `artboards` noemt een tekengebied dat het document niet heeft +@msg `artboards` names an artboard twice `artboards` noemt een tekengebied twee keer +@msg `asset` is the asset id (see assets.list) `asset` is de asset-id (zie assets.list) +@msg `at` must be [x, y] (got {at}) `at` moet [x, y] zijn (kreeg {at}) +@msg `at` must be a byte offset `at` moet een bytepositie zijn +@msg `at` must be a point [x, y] `at` moet een punt [x, y] zijn +@msg `autoLeading` must be a number `autoLeading` moet een getal zijn +@msg `background` must be "", "matte" or #rrggbb `background` moet "", "matte" of #rrggbb zijn +@msg `beside` needs `side` `beside` heeft `side` nodig +@msg `burasagari` must be "none", "standard" or "forced" `burasagari` moet "none", "standard" of "forced" zijn +@msg `center` must be [x, y] `center` moet [x, y] zijn +@msg `charAlign` must be "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" or "icfBottom" `charAlign` moet "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" of "icfBottom" zijn +@msg `charDirection` must be "default", "leftToRight" or "rightToLeft" `charDirection` moet "default", "leftToRight" of "rightToLeft" zijn +@msg `clearStroke` requires `stroke: false`, `ids: []` and no `stop` `clearStroke` vereist `stroke: false`, `ids: []` en geen `stop` +@msg `clear` must be a list of type object ids, not {v} `clear` moet een lijst met id’s van tekstobjecten zijn, niet {v} +@msg `clear` must list type objects; {_1} is not one `clear` moet tekstobjecten bevatten; {_1} is er geen +@msg `clear` must not list `id` `clear` mag `id` niet bevatten +@msg `code` must be a whole number `code` moet een geheel getal zijn +@msg `colorMode` must be one of rgb, cmyk `colorMode` moet een van rgb, cmyk zijn +@msg `color` needs a `rule` to make the theme from `color` heeft een `rule` nodig om het thema mee te maken +@msg `colors` does not apply to the {name} reduction `colors` geldt niet voor de reductie {name} +@msg `colors` is empty `colors` is leeg +@msg `colors` must be a whole number from 2 to 256 `colors` moet een geheel getal van 2 tot 256 zijn +@msg `colors` must be at least 9 for the uniform reduction `colors` moet minstens 9 zijn voor de uniforme reductie +@msg `colors` must be between 1 and {MAX_THEME_COLORS} (got {n}) `colors` moet tussen 1 en {MAX_THEME_COLORS} liggen (kreeg {n}) +@msg `columnType` is vertical, uniform, repeating or sliding `columnType` is vertical, uniform, repeating of sliding +@msg `columns` must be a whole number 1..50 `columns` moet een geheel getal 1..50 zijn +@msg `commands` must not be empty `commands` mag niet leeg zijn +@msg `contents` goes with `to` `contents` hoort bij `to` +@msg `corners` must be sharp, round or square, not `{other}` `corners` moet sharp, round of square zijn, niet `{other}` +@msg `corners` must list anchor indices (0, 1, 2…), not {v} `corners` moet ankerindexen bevatten (0, 1, 2…), niet {v} +@msg `count` must be a whole number from 0 to {MAX_COUNT} `count` moet een geheel getal van 0 tot {MAX_COUNT} zijn +@msg `count` must be a whole number from 1 to 100 `count` moet een geheel getal van 1 tot 100 zijn +@msg `dataBase64` is larger than the module limit `dataBase64` is groter dan de modulelimiet +@msg `dataBase64` is not valid base64 `dataBase64` is geen geldige base64 +@msg `defaultsOnly` cannot be combined with `ids`, `reverse` or `append` `defaultsOnly` kan niet worden gecombineerd met `ids`, `reverse` of `append` +@msg `depth` and `childLimit` slice the summary: pass `summary: true` `depth` en `childLimit` beperken de samenvatting: geef `summary: true` op +@msg `design` is a design name, or null for plain columns `design` is de naam van een ontwerp, of null voor gewone kolommen +@msg `design` is a design name, or null for the default marker `design` is de naam van een ontwerp, of null voor de standaardmarkering +@msg `destinationFolder` is required when destination is `folder` `destinationFolder` is vereist wanneer de bestemming `folder` is +@msg `destination` must be `none`, `saveAndClose` or `folder` `destination` moet `none`, `saveAndClose` of `folder` zijn +@msg `diameter` must be from 0.1 to 2500 pt `diameter` moet van 0,1 tot 2500 pt zijn +@msg `digits` must be one of {_1} `digits` moet een van {_1} zijn +@msg `dimImages` is a percentage or false `dimImages` is een percentage of false +@msg `direction` must be "auto", "leftToRight" or "rightToLeft" `direction` moet "auto", "leftToRight" of "rightToLeft" zijn +@msg `ditherAmount` must be a number from 0 to 100 `ditherAmount` moet een getal van 0 tot 100 zijn +@msg `each` is the value one design stands for, more than 0 `each` is de waarde waar één ontwerp voor staat, meer dan 0 +@msg `end` must be "start" or "end" `end` moet "start" of "end" zijn +@msg `ends` applies to joining exactly two paths `ends` geldt voor het verbinden van precies twee paden +@msg `event` must be one of {_1} `event` moet een van {_1} zijn +@msg `every` must be "all", "odd" or "even", not {v} `every` moet "all", "odd" of "even" zijn, niet {v} +@msg `expand` must be true or false `expand` moet true of false zijn +@msg `fidelity` must be from {lo} to {hi} pt `fidelity` moet van {lo} tot {hi} pt zijn +@msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` moet 1 tot 1000 paden van lettertypebestanden bevatten die de laatste zoekopdracht van text.findFontFiles heeft gevonden +@msg `focal` and `radius` cannot be used together `focal` en `radius` kunnen niet samen worden gebruikt +@msg `focal` must be an array of [subpath, anchor] pairs `focal` moet een array van paren [subpath, anchor] zijn +@msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal` noemt [{si}, {ai}], en dat is geen anker van het pad +@msg `folder` must be an absolute folder path `folder` moet een absoluut mappad zijn +@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` moet een object met astags en waarden zijn, zoals {"wght"} +@msg `format` must be a string `format` moet een string zijn +@msg `format` must be one of {_1} `format` moet een van {_1} zijn +@msg `fractions` is chop or scale `fractions` is chop of scale +@msg `from` and `to` must differ `from` en `to` moeten verschillen +@msg `from` has an empty frame `from` heeft een leeg kader +@msg `from` must be a non-negative integer `from` moet een niet-negatief geheel getal zijn +@msg `from` must be area type or type on a path `from` moet vlaktekst of tekst op een pad zijn +@msg `gid` must be a glyph id, not {v} `gid` moet een glyph-id zijn, niet {v} +@msg `glyphAlternate` belongs to one character, not to a character style (text.setGlyphAlternate sets it) `glyphAlternate` hoort bij één teken, niet bij een tekenstijl (text.setGlyphAlternate stelt het in) +@msg `glyphAlternate` takes only null, which takes a glyph choice away (text.setGlyphAlternate makes one) `glyphAlternate` accepteert alleen null, dat een glyphkeuze wegneemt (text.setGlyphAlternate maakt er een) +@msg `group` must be one of {_1} `group` moet een van {_1} zijn +@msg `group` must be the Objects on Path group of `member` and `target` `group` moet de groep Objecten op pad van `member` en `target` zijn +@msg `guide` must be a guide index (guide.list) `guide` moet een hulplijnindex zijn (guide.list) +@msg `hAlign` must be default, left, center or right `hAlign` moet default, left, center of right zijn +@msg `id` is an object id, not {v} `id` is een object-id, niet {v} +@msg `id` must be a node id `id` moet een knooppunt-id zijn +@msg `id` must be an object id, not {v} `id` moet een object-id zijn, niet {v} +@msg `ids` must name Objects on Path groups or objects in them `ids` moet groepen Objecten op pad of objecten daarin noemen +@msg `ids` takes at most {MAX_INSPECT_IDS} ids `ids` accepteert maximaal {MAX_INSPECT_IDS} id’s +@msg `imageMap` must be none, rectangle or polygon `imageMap` moet none, rectangle of polygon zijn +@msg `includeArtboardFill` must be true or false `includeArtboardFill` moet true of false zijn +@msg `includeSubdirs` must be true or false `includeSubdirs` moet true of false zijn +@msg `index` must be a point index `index` moet een puntindex zijn +@msg `index` must be a whole number or null `index` moet een geheel getal of null zijn +@msg `indices` must be a non-empty array of item indices `indices` moet een niet-lege array van itemindexen zijn +@msg `item` needs `index` `item` heeft `index` nodig +@msg `items` is a list of {kind, item} `items` is een lijst van {kind, item} +@msg `items` is empty `items` is leeg +@msg `items` must be a list of {id, points} `items` moet een lijst van {id, points} zijn +@msg `items` must be a list of {{id, anchors?}}, not {v} `items` moet een lijst van {{id, anchors?}} zijn, niet {v} +@msg `items` must be an array of {id, anchors} `items` moet een array van {id, anchors} zijn +@msg `items` must be an array of {{id, corners?}}, not {v} `items` moet een array van {{id, corners?}} zijn, niet {v} +@msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` moet "none", "short", "medium", "long" of "stylistic" zijn +@msg `kerningBefore` belongs to a line's first character, not to a character style (text.setRangeStyle sets it) `kerningBefore` hoort bij het eerste teken van een regel, niet bij een tekenstijl (text.setRangeStyle stelt het in) +@msg `kind` is one of {_1} `kind` is een van {_1} +@msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind` moet "round", "invertedRound" of "chamfer" zijn, niet {v} +@msg `kind` must be `text`, `visibility`, `image` or `graph` `kind` moet `text`, `visibility`, `image` of `graph` zijn +@msg `kind` must be a string `kind` moet een string zijn +@msg `kind` must be image, noImage or htmlText `kind` moet image, noImage of htmlText zijn +@msg `kinsokuType` must be "pushInFirst", "pushOutFirst" or "pushOutOnly" `kinsokuType` moet "pushInFirst", "pushOutFirst" of "pushOutOnly" zijn +@msg `kinsoku` must be "none", "hard" or "soft" `kinsoku` moet "none", "hard" of "soft" zijn +@msg `label` must be a non-empty name of at most 200 characters `label` moet een niet-lege naam van maximaal 200 tekens zijn +@msg `language` must be a language name or tag, such as "Turkish" or "tr" `language` moet een taalnaam of -tag zijn, zoals "Turkish" of "tr" +@msg `leader` must be a string `leader` moet een string zijn +@msg `leadingModel` must be "romanBaseline" or "emBoxTop" `leadingModel` moet "romanBaseline" of "emBoxTop" zijn +@msg `leading` must be from 0.1 to 5000, or null for Auto `leading` moet van 0,1 tot 5000 zijn, of null voor Automatisch +@msg `length` must be a number of at most 1000000 pt either way `length` moet een getal van maximaal 1000000 pt in beide richtingen zijn +@msg `line` must be true or false `line` moet true of false zijn +@msg `max` must be 1 to {MAX_SUGGESTIONS} `max` moet 1 tot {MAX_SUGGESTIONS} zijn +@msg `minAngle` ({min_angle}°) can't be more than `maxAngle` ({max_angle}°) `minAngle` ({min_angle}°) mag niet groter zijn dan `maxAngle` ({max_angle}°) +@msg `mode` must be "handles", "straight" or "smooth" `mode` moet "handles", "straight" of "smooth" zijn +@msg `mode` must be "straight", "bezier" or "arc" `mode` moet "straight", "bezier" of "arc" zijn +@msg `mode` must be one of {_1} `mode` moet een van {_1} zijn +@msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi` moet "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" of "lineEndHalf" zijn +@msg `name` must be a name that is not empty `name` moet een naam zijn die niet leeg is +@msg `name` must not be empty `name` mag niet leeg zijn +@msg `names` is a list of preset names `names` is een lijst met namen van voorinstellingen +@msg `names` lists preset names `names` bevat namen van voorinstellingen +@msg `names` must be a list of names `names` moet een lijst met namen zijn +@msg `names` must be a list of swatch names `names` moet een lijst met staalnamen zijn +@msg `names` must be an array of style names `names` moet een array van stijlnamen zijn +@msg `new` is a design name, or true `new` is de naam van een ontwerp, of true +@msg `origin` must be [x, y] in points `origin` moet [x, y] in punten zijn +@msg `path` must be a folder `path` moet een map zijn +@msg `path` must be a path object `path` moet een padobject zijn +@msg `picks` must be an array (got {v}) `picks` moet een array zijn (kreeg {v}) +@msg `picks` must hold 1 to {MAX_PICKS} picks (got {_1}) `picks` moet 1 tot {MAX_PICKS} keuzes bevatten (kreeg {_1}) +@msg `pivot` must be a whole number from 0 to 8 `pivot` moet een geheel getal van 0 tot 8 zijn +@msg `points` must be a list of [x, y] points `points` moet een lijst met punten [x, y] zijn +@msg `points` must be a list of point indexes `points` moet een lijst met puntindexen zijn +@msg `points` must be an array of point indices `points` moet een array van puntindexen zijn +@msg `points` must be point indexes `points` moet uit puntindexen bestaan +@msg `points` must hold from 2 to 100000 points `points` moet 2 tot 100000 punten bevatten +@msg `port` must be "in" or "out" `port` moet "in" of "out" zijn +@msg `position` is above or below `position` is above of below +@msg `preset` must be a string `preset` moet een string zijn +@msg `radius` must be 0 or more `radius` moet 0 of meer zijn +@msg `ratio` must be from 0.1 to 0.5 `ratio` moet van 0,1 tot 0,5 zijn +@msg `rect` must be [x, y, width, height] `rect` moet [x, y, width, height] zijn +@msg `rect` must be [x, y, width, height] with a positive size `rect` moet [x, y, width, height] met een positieve grootte zijn +@msg `rect` must be [x0, y0, x1, y1] (got {r}) `rect` moet [x0, y0, x1, y1] zijn (kreeg {r}) +@msg `relation` must be overlap, inside or outside `relation` moet overlap, inside of outside zijn +@msg `replace` must be a string `replace` moet een string zijn +@msg `reversed` must be true or false `reversed` moet true of false zijn +@msg `rotate` must be a finite number `rotate` moet een eindig getal zijn +@msg `rows` must be lists of numbers or nulls, not {r} `rows` moet uit lijsten met getallen of null-waarden bestaan, niet {r} +@msg `rule` must be nonZero or evenOdd `rule` moet nonZero of evenOdd zijn +@msg `scale` must be a number from 0.001 to 1000 `scale` moet een getal van 0,001 tot 1000 zijn +@msg `scale` must be a number in (0, 100] `scale` moet een getal in (0, 100] zijn +@msg `scope.{key}` must be a non-empty array `scope.{key}` moet een niet-lege array zijn +@msg `scope` must be "document", {artboards} or {layers} `scope` moet "document", {artboards} of {layers} zijn +@msg `scope` must be "selection" or "document", not {other} `scope` moet "selection" of "document" zijn, niet {other} +@msg `script` must be a string `script` moet een string zijn +@msg `seriesIndexes` is a non-empty list of series indexes `seriesIndexes` is een niet-lege lijst met reeksindexen +@msg `seriesIndexes` needs a `type` or a `valueAxis` `seriesIndexes` heeft een `type` of een `valueAxis` nodig +@msg `shift` must be a number of points `shift` moet een aantal punten zijn +@msg `showCenter` must be true or false `showCenter` moet true of false zijn +@msg `side` must be "left", "right", "top" or "bottom" `side` moet "left", "right", "top" of "bottom" zijn +@msg `side` places the artboard: leave out x, y, width and height `side` plaatst het tekengebied: laat x, y, width en height weg +@msg `singleWordJustification` must be "fullJustify", "alignLeft", "alignCenter" or "alignRight" `singleWordJustification` moet "fullJustify", "alignLeft", "alignCenter" of "alignRight" zijn +@msg `size` is a percentage of the base text's size, 1 to 100 `size` is een percentage van de grootte van de basistekst, 1 tot 100 +@msg `source` and `target` are the same object `source` en `target` zijn hetzelfde object +@msg `source` is the only path in series group `target` `source` is het enige pad in reeksgroep `target` +@msg `source` must be `folder` or `datasets` `source` moet `folder` of `datasets` zijn +@msg `spacing` makes more than {MAX_COUNT} lines across the box `spacing` levert meer dan {MAX_COUNT} lijnen over het kader op +@msg `spacing` must be a number `spacing` moet een getal zijn +@msg `spacing` must be a number of points, 0 or more, or "auto" `spacing` moet een aantal punten zijn, 0 of meer, of "auto" +@msg `spacing` must be more than 0 and at most {MAX_DISTANCE} pt `spacing` moet meer dan 0 en maximaal {MAX_DISTANCE} pt zijn +@msg `start` must be a finite number `start` moet een eindig getal zijn +@msg `starts` must be an array of anchor indices (or nulls) `starts` moet een array van ankerindexen (of null-waarden) zijn +@msg `status` must be linked, embedded, missing or modified, or a list of them `status` moet linked, embedded, missing of modified zijn, of een lijst daarvan +@msg `stop` must be a stop index `stop` moet een stopindex zijn +@msg `story` styles the whole story: give no `start` or `end` `story` maakt het hele artikel op: geef geen `start` of `end` +@msg `story` takes the whole story: give no `start` or `end` `story` neemt het hele artikel: geef geen `start` of `end` +@msg `strokeMode` applies to strokes (stroke: true) `strokeMode` geldt voor contouren (stroke: true) +@msg `style` must be roman or japanese `style` moet roman of japanese zijn +@msg `subpaths` must be two integer indices `subpaths` moet uit twee gehele indexen bestaan +@msg `symbol` must be a symbol name `symbol` moet een symboolnaam zijn +@msg `target` must be "object" or "contents", not {v} `target` moet "object" of "contents" zijn, niet {v} +@msg `target` must be an object of the same Objects on Path group as `member` `target` moet een object zijn uit dezelfde groep Objecten op pad als `member` +@msg `tint` applies to global and spot colours `tint` geldt voor globale kleuren en steunkleuren +@msg `tint` goes with a global or spot `swatch` `tint` hoort bij een `swatch` met een globale kleur of steunkleur +@msg `tint` must be a number (%) `tint` moet een getal zijn (%) +@msg `tint` needs a global or spot colour `tint` heeft een globale kleur of steunkleur nodig +@msg `to` is already threaded `to` is al gekoppeld +@msg `to` is the design's new name `to` is de nieuwe naam van het ontwerp +@msg `to` must be [x, y] `to` moet [x, y] zijn +@msg `to` must be a closed path, area type or type on a path other than `from` `to` moet een gesloten pad, vlaktekst of tekst op een pad zijn, anders dan `from` +@msg `to` must be a whole number `to` moet een geheel getal zijn +@msg `to` takes the rows of one object's stack, not aligned rows `to` accepteert de rijen van de stapel van één object, geen uitgelijnde rijen +@msg `tolerance` must be from 0 to 100 pt `tolerance` moet van 0 tot 100 pt zijn +@msg `useLab` must be true or false `useLab` moet true of false zijn +@msg `vAlign` must be default, top, middle, baseline or bottom `vAlign` moet default, top, middle, baseline of bottom zijn +@msg `values` must be a list `values` moet een lijst zijn +@msg `values` must be an object `values` moet een object zijn +@msg `values` must name hex, rgb, cmyk, lab or gray `values` moet hex, rgb, cmyk, lab of gray noemen +@msg `values` names a kind twice `values` noemt een soort twee keer +@msg `version` must be 0 or {_1} `version` moet 0 of {_1} zijn +@msg `version` must be 0 or {newest} `version` moet 0 of {newest} zijn +@msg `warichuAlign` must be one of {_1} `warichuAlign` moet een van {_1} zijn +@msg `warichuLines` must be a whole number from {_1} to {_2} `warichuLines` moet een geheel getal van {_1} tot {_2} zijn +@msg `weight` must be from 0.01 to 1000 pt `weight` moet van 0,01 tot 1000 pt zijn +@msg `weights` must be a list of {_1} numbers, one per row (got {v}) `weights` moet een lijst met {_1} getallen zijn, één per rij (kreeg {v}) +@msg `xml` must be a string `xml` moet een string zijn +@msg `{KEY}` entry {n} gives the paragraph at byte {start} of {_1} other indents than an entry before it `{KEY}`, item {n}, geeft de alinea op byte {start} van {_1} andere inspringingen dan een eerder item +@msg `{KEY}` entry {n} must be an object `{KEY}`, item {n}, moet een object zijn +@msg `{KEY}` entry {n} sets neither `leftIndent` nor `firstLineIndent` `{KEY}`, item {n}, stelt noch `leftIndent` noch `firstLineIndent` in +@msg `{KEY}` entry {n}: `id` must be an object id `{KEY}`, item {n}: `id` moet een object-id zijn +@msg `{KEY}` entry {n}: `start` must be a byte offset `{KEY}`, item {n}: `start` moet een bytepositie zijn +@msg `{KEY}` entry {n}: `{k}` must be a number from -{MAX_PARA} to {MAX_PARA} pt `{KEY}`, item {n}: `{k}` moet een getal van -{MAX_PARA} tot {MAX_PARA} pt zijn +@msg `{KEY}` entry {n}: no paragraph of {_1} starts at byte {start} `{KEY}`, item {n}: er begint geen alinea van {_1} op byte {start} +@msg `{KEY}` entry {n}: unknown key `{k}` `{KEY}`, item {n}: onbekende sleutel `{k}` +@msg `{KEY}` entry {n}: {_1} is not a type object `{KEY}`, item {n}: {_1} is geen tekstobject +@msg `{KEY}` is empty `{KEY}` is leeg +@msg `{KEY}` must be a list `{KEY}` moet een lijst zijn +@msg `{KEY}` takes at most {MAX_PARAGRAPH_INDENTS} entries (got {_1}) `{KEY}` accepteert maximaal {MAX_PARAGRAPH_INDENTS} items (kreeg {_1}) +@msg `{KEY}` takes no `{other}` beside it `{KEY}` accepteert geen `{other}` ernaast +@msg `{_1}` can't be edited or removed `{_1}` kan niet worden bewerkt of verwijderd +@msg `{_1}` is built in and always listed `{_1}` is ingebouwd en staat altijd in de lijst +@msg `{_1}` is not a font file the last text.findFontFiles search found `{_1}` is geen lettertypebestand dat de laatste zoekopdracht van text.findFontFiles heeft gevonden +@msg `{_1}` would be overwritten by the package: choose a different folder or name `{_1}` zou door het pakket worden overschreven: kies een andere map of naam +@msg `{base}` is larger than {_1} MB `{base}` is groter dan {_1} MB +@msg `{base}` is not in the DCS file's folder `{base}` staat niet in de map van het DCS-bestand +@msg `{file}` has no art to place `{file}` heeft geen illustratie om te plaatsen +@msg `{file}` is over {_1} MB `{file}` is groter dan {_1} MB +@msg `{f}` belongs to a VectorCraft that is running `{f}` hoort bij een VectorCraft die actief is +@msg `{f}` is the copy of a document open now `{f}` is de kopie van een document dat nu geopend is +@msg `{id}` is no writable format (see document.formats) `{id}` is geen schrijfbare indeling (zie document.formats) +@msg `{id}` isn't a loaded library `{id}` is geen geladen bibliotheek +@msg `{key}` has no colours `{key}` heeft geen kleuren +@msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` bevat meer dan {MAX_EDIT_WORDS} woorden +@msg `{key}` is a design name `{key}` is de naam van een ontwerp +@msg `{key}` is a design name or a list of them `{key}` is de naam van een ontwerp of een lijst daarvan +@msg `{key}` is longer than {MAX_NAME} characters `{key}` is langer dan {MAX_NAME} tekens +@msg `{key}` is out of range `{key}` valt buiten het bereik +@msg `{key}` must be 0 or more `{key}` moet 0 of meer zijn +@msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}` moet [min, desired, max] of {{min?, desired?, max?}} zijn, in procenten +@msg `{key}` must be [x, y] numbers `{key}` moet uit getallen [x, y] bestaan +@msg `{key}` must be a list of words `{key}` moet een lijst met woorden zijn +@msg `{key}` must be a list, not {v} `{key}` moet een lijst zijn, niet {v} +@msg `{key}` must be a non-negative integer `{key}` moet een niet-negatief geheel getal zijn +@msg `{key}` must be a number or null, not {v} `{key}` moet een getal of null zijn, niet {v} +@msg `{key}` must be a number {_1}..{_2} `{key}` moet een getal {_1}..{_2} zijn +@msg `{key}` must be a whole number of 0 or more `{key}` moet een geheel getal van 0 of meer zijn +@msg `{key}` must be a whole number of at least 0, not {n} `{key}` moet een geheel getal van minstens 0 zijn, niet {n} +@msg `{key}` must be an appearance item index (paint order) or null `{key}` moet de index van een vormgevingsitem (verfvolgorde) of null zijn +@msg `{key}` must be an array of asset ids (see assets.list) `{key}` moet een array van asset-id’s zijn (zie assets.list) +@msg `{key}` must be from 0 to 180 degrees, not {a} `{key}` moet van 0 tot 180 graden zijn, niet {a} +@msg `{key}` must be from 0 to {MAX_DISTANCE} pt `{key}` moet van 0 tot {MAX_DISTANCE} pt zijn +@msg `{key}` must be from 0.01 to 1000 pt `{key}` moet van 0,01 tot 1000 pt zijn +@msg `{key}` must be from {_1} to {shift_max} `{key}` moet van {_1} tot {shift_max} zijn +@msg `{key}` must be from {lo} to {hi}, not {v} `{key}` moet van {lo} tot {hi} zijn, niet {v} +@msg `{key}` must be one of auto, always, never `{key}` moet een van auto, always, never zijn +@msg `{key}` must be one of miter, round, bevel `{key}` moet een van miter, round, bevel zijn +@msg `{key}` must be one word of at most {_1} characters `{key}` moet één woord van maximaal {_1} tekens zijn +@msg `{key}` must hold single words of at most {_1} characters `{key}` moet losse woorden van maximaal {_1} tekens bevatten +@msg `{key}` must name an object attached to the path of an Objects on Path group `{key}` moet een object noemen dat aan het pad van een groep Objecten op pad is gekoppeld +@msg `{key}` names an object that is hidden or locked `{key}` noemt een object dat verborgen of vergrendeld is +@msg `{key}`: not a colour: {v} `{key}`: geen kleur: {v} +@msg `{k}.family` is required `{k}.family` is vereist +@msg `{k}` is a number 0..1 `{k}` is een getal 0..1 +@msg `{k}` is true or false `{k}` is true of false +@msg `{k}` isn't an export setting: {_1} `{k}` is geen exportinstelling: {_1} +@msg `{k}` must be a byte offset `{k}` moet een bytepositie zijn +@msg `{k}` must be a number `{k}` moet een getal zijn +@msg `{k}` must be a number of points `{k}` moet een aantal punten zijn +@msg `{k}` must be a string `{k}` moet een string zijn +@msg `{k}` must be a whole number `{k}` moet een geheel getal zijn +@msg `{k}` must be from {lo} to {hi} for {key} `{k}` moet van {lo} tot {hi} zijn voor {key} +@msg `{k}` must be {what}, not {v} `{k}` moet {what} zijn, niet {v} +@msg `{l}` isn't a global or spot colour `{l}` is geen globale kleur of steunkleur +@msg `{m}` isn't a bitmap: use clipboard.importSvg, importPdf or importText `{m}` is geen bitmap: gebruik clipboard.importSvg, importPdf of importText +@msg `{name}` can't be deleted `{name}` kan niet worden verwijderd +@msg `{name}` can't be duplicated `{name}` kan niet worden gedupliceerd +@msg `{name}` can't be edited `{name}` kan niet worden bewerkt +@msg `{name}` can't be edited this way `{name}` kan niet op deze manier worden bewerkt +@msg `{name}` can't be renamed `{name}` kan geen andere naam krijgen +@msg `{name}` can't name a folder `{name}` kan geen naam van een map zijn +@msg `{name}` has no art to place `{name}` heeft geen illustratie om te plaatsen +@msg `{name}` has no text to place `{name}` heeft geen tekst om te plaatsen +@msg `{name}` in the Word document is not UTF-8 or UTF-16 text `{name}` in het Word-document is geen UTF-8- of UTF-16-tekst +@msg `{name}` in the Word document is not well-formed XML: {e} `{name}` in het Word-document is geen welgevormde XML: {e} +@msg `{name}` in the Word document nests elements more than {MAX_NESTING} deep `{name}` in het Word-document nest elementen meer dan {MAX_NESTING} niveaus diep +@msg `{name}` is a built-in preset and is read-only: save it under another name `{name}` is een ingebouwde voorinstelling en is alleen-lezen: sla deze onder een andere naam op +@msg `{name}` is a built-in preset: save under another name `{name}` is een ingebouwde voorinstelling: sla op onder een andere naam +@msg `{name}` is a built-in profile and stays `{name}` is een ingebouwd profiel en blijft bestaan +@msg `{name}` is a file of its own, which can only be found next to the DCS file's path `{name}` is een afzonderlijk bestand, dat alleen naast het pad van het DCS-bestand kan worden gevonden +@msg `{name}` is a tint of `{base}`: edit `{base}` (a tint swatch only takes a new name) `{name}` is een tint van `{base}`: bewerk `{base}` (een tintstaal accepteert alleen een nieuwe naam) +@msg `{name}` is a working space: choose another with edit.colorSettings first `{name}` is een werkruimte: kies eerst een andere met edit.colorSettings +@msg `{name}` is built in and stays `{name}` is ingebouwd en blijft bestaan +@msg `{name}` takes a paint of its own kind (colour, gradient or pattern) `{name}` accepteert een verf van zijn eigen soort (kleur, verloop of patroon) +@msg `{name}`: {_1}: {e} `{name}`: {_1}: {e} +@msg `{n}` can't be deleted `{n}` kan niet worden verwijderd +@msg `{n}` can't be merged `{n}` kan niet worden samengevoegd +@msg `{n}` can't be moved `{n}` kan niet worden verplaatst +@msg `{n}` is not a colour swatch `{n}` is geen kleurstaal +@msg `{n}` isn't a solid colour `{n}` is geen effen kleur +@msg `{n}`: colour groups hold solid colours only `{n}`: kleurgroepen bevatten alleen effen kleuren +@msg `{other}` doesn't trace an image `{other}` traceert geen afbeelding +@msg `{s}`: the step's references copy in more than {_1} MB of values `{s}`: de verwijzingen van de stap kopiëren meer dan {_1} MB aan waarden +@msg `{tag}` is not an axis tag: a tag is four characters, such as "wght" `{tag}` is geen astag: een tag bestaat uit vier tekens, zoals "wght" +@msg `{to}` is empty or already used `{to}` is leeg of al in gebruik +@msg `{u}` is no Unicode character `{u}` is geen Unicode-teken +@msg `{what}` is longer than {MAX_TEXT} bytes `{what}` is langer dan {MAX_TEXT} bytes +@msg `{what}` must be text `{what}` moet tekst zijn +@msg `{word}` isn't in the custom dictionary `{word}` staat niet in het aangepaste woordenboek +@msg a CMap has too many mappings een CMap heeft te veel toewijzingen +@msg a DXF drawing has one origin: pass useArtboards: true for one drawing per artboard een DXF-tekening heeft één oorsprong: geef useArtboards: true op voor één tekening per tekengebied +@msg a PDF presets file with over {_1} presets een bestand met PDF-voorinstellingen met meer dan {_1} voorinstellingen +@msg a \\u escape needs four hexadecimal digits een \\u-escape heeft vier hexadecimale cijfers nodig +@msg a batch preview cannot switch documents een batchvoorvertoning kan niet van document wisselen +@msg a brush named `{nn}` exists er bestaat al een penseel met de naam `{nn}` +@msg a comma in an XPath expression must separate function arguments een komma in een XPath-expressie moet functieargumenten scheiden +@msg a container of the listed objects is gone een container van de vermelde objecten is verdwenen +@msg a content stream can't be read een inhoudsstroom kan niet worden gelezen +@msg a content stream isn't a stream een inhoudsstroom is geen stroom +@msg a design holds at most {_1} objects een ontwerp bevat maximaal {_1} objecten +@msg a design needs a name een ontwerp heeft een naam nodig +@msg a dictionary grew too large een woordenboek is te groot geworden +@msg a document holds at most {_1} SVG filters een document bevat maximaal {_1} SVG-filters +@msg a document keeps at most {_1} graph designs een document bewaart maximaal {_1} grafiekontwerpen +@msg a document keeps at most {_1} saved selections een document bewaart maximaal {_1} opgeslagen selecties +@msg a document keeps at most {_1} views een document bewaart maximaal {_1} weergaven +@msg a document links at most {MAX_SVG_SCRIPTS} JavaScript files een document koppelt maximaal {MAX_SVG_SCRIPTS} JavaScript-bestanden +@msg a document with unsaved changes has no recovery copy een document met niet-opgeslagen wijzigingen heeft geen herstelkopie +@msg a feConvolveMatrix filter's order is {x}×{y}, which overflows the kernel-size multiply usvg makes de orde van een feConvolveMatrix-filter is {x}×{y}, waardoor de vermenigvuldiging van de kernelgrootte in usvg overloopt +@msg a font's data is too large de gegevens van een lettertype zijn te groot +@msg a font's subroutines are too large de subroutines van een lettertype zijn te groot +@msg a function declaration without a name een functiedeclaratie zonder naam +@msg a gradient preset is already called {n} er heet al een verloopvoorinstelling {n} +@msg a graph has at most {_1} series, so it transposes with at most that many categories een grafiek heeft maximaal {_1} reeksen, dus kan hij met hoogstens zoveel categorieën worden getransponeerd +@msg a host value has too many entries een hostwaarde heeft te veel items +@msg a host value is nested too deep een hostwaarde is te diep genest +@msg a layer can't be merged into its own sublayer een laag kan niet in zijn eigen sublaag worden samengevoegd +@msg a layer's form box isn't an array het kader van het formulier van een laag is geen array +@msg a layer's form can't be read het formulier van een laag kan niet worden gelezen +@msg a layer's form has no box het formulier van een laag heeft geen kader +@msg a layer's form has no dictionary het formulier van een laag heeft geen woordenboek +@msg a legend draws at most {MAX_CHIPS} swatches een legenda tekent maximaal {MAX_CHIPS} stalen +@msg a linked JavaScript file is outside the read roots een gekoppeld JavaScript-bestand staat buiten de leesroots +@msg a name names one asset: give multiple: false, or one object een naam noemt één asset: geef multiple: false, of één object +@msg a namespace declaration uses a reserved prefix or URI een naamruimtedeclaratie gebruikt een gereserveerd voorvoegsel of een gereserveerde URI +@msg a namespace qualifier is undefined een naamruimtekwalificatie is niet gedefinieerd +@msg a namespace with an empty URI cannot have a prefix een naamruimte met een lege URI kan geen voorvoegsel hebben +@msg a number has no digits een getal heeft geen cijfers +@msg a number's exponent has no digits de exponent van een getal heeft geen cijfers +@msg a number's fraction has no digits het breukdeel van een getal heeft geen cijfers +@msg a page can't be read een pagina kan niet worden gelezen +@msg a page object is used by something else een paginaobject wordt door iets anders gebruikt +@msg a page thumbnail must be RGB pixels, 1 to {THUMBNAIL_SIZE} a side (got {w} × {h}) een paginaminiatuur moet uit RGB-pixels bestaan, 1 tot {THUMBNAIL_SIZE} per zijde (kreeg {w} × {h}) +@msg a pattern layer doesn't end what it starts een patroonlaag sluit niet af wat hij begint +@msg a pattern layer's colors hold something else de kleuren van een patroonlaag bevatten iets anders +@msg a pattern named `{n}` exists er bestaat al een patroon met de naam `{n}` +@msg a plug-in with id {_1} is already installed er is al een plug-in met id {_1} geïnstalleerd +@msg a preset named `{n}` exists er bestaat al een voorinstelling met de naam `{n}` +@msg a print presets file with over {_1} presets een bestand met afdrukvoorinstellingen met meer dan {_1} voorinstellingen +@msg a profile is already called {n} er heet al een profiel {n} +@msg a property descriptor cannot have both a value or writable and a get or set een eigenschapsdescriptor kan niet zowel value of writable als get of set hebben +@msg a property descriptor must be an object een eigenschapsdescriptor moet een object zijn +@msg a property's {name} must be a function or undefined de {name} van een eigenschap moet een functie of undefined zijn +@msg a row can't go into itself een rij kan niet in zichzelf worden geplaatst +@msg a series goes on the left or the right value axis een reeks hoort op de linker- of de rechterwaardeas +@msg a start must be an anchor index ≥ 0 or null een start moet een ankerindex ≥ 0 of null zijn +@msg a stream in it would decode to more than 256 MB, or its decode parameters can't be applied een stroom erin zou tot meer dan 256 MB worden gedecodeerd, of de decodeerparameters ervan kunnen niet worden toegepast +@msg a string holds a control character een string bevat een besturingsteken +@msg a string holds an escape sequence JSON does not have een string bevat een escapereeks die JSON niet kent +@msg a string is not closed een string is niet afgesloten +@msg a style named `{name}` already exists er bestaat al een stijl met de naam `{name}` +@msg a style named `{to}` already exists er bestaat al een stijl met de naam `{to}` +@msg a swatch needs a colour, gradient or pattern een staal heeft een kleur, verloop of patroon nodig +@msg a symbol named `{n}` already exists er bestaat al een symbool met de naam `{n}` +@msg a theme has 1 to {THEME_SIZE} colours een thema heeft 1 tot {THEME_SIZE} kleuren +@msg a theme is already called {name} (replace: "{name}" overwrites it) er heet al een thema {name} (replace: "{name}" overschrijft het) +@msg a toolbar name has at most {MAX_NAME} characters de naam van een werkbalk heeft maximaal {MAX_NAME} tekens +@msg a view named `{_1}` exists er bestaat al een weergave met de naam `{_1}` +@msg a view named `{name}` exists er bestaat al een weergave met de naam `{name}` +@msg a workspace keeps at most {MAX} toolbars een werkruimte bewaart maximaal {MAX} werkbalken +@msg a {_1} series can't go in a {_2} graph een reeks van het type {_1} kan niet in een grafiek van het type {_2} staan +@msg aiVersion {v}: "pdf" (PDF-compatible, the default) or "7" (legacy .ai, version 7) aiVersion {v}: "pdf" (PDF-compatibel, de standaard) of "7" (oude .ai, versie 7) +@msg already editing an opacity mask er wordt al een dekkingmasker bewerkt +@msg already editing another object's opacity mask het dekkingmasker van een ander object wordt al bewerkt +@msg already in pattern editing mode de patroonbewerkingsmodus is al actief +@msg an SVG filter is named by its id: give `xml` with `name` een SVG-filter wordt bij zijn id genoemd: geef `xml` met `name` +@msg an XML element has two attributes with the same name een XML-element heeft twee attributen met dezelfde naam +@msg an XML value cannot be inserted into itself or its descendants een XML-waarde kan niet in zichzelf of in zijn afstammelingen worden ingevoegd +@msg an XML value's children cannot be assigned by position de onderliggende elementen van een XML-waarde kunnen niet op positie worden toegewezen +@msg an XML value's children cannot be deleted by position de onderliggende elementen van een XML-waarde kunnen niet op positie worden verwijderd +@msg an XMLList converts to XML only when it has one item een XMLList wordt alleen naar XML geconverteerd wanneer deze één item heeft +@msg an XPath node test is missing er ontbreekt een XPath-knooppunttest +@msg an XPath operand is missing er ontbreekt een XPath-operand +@msg an XPath operator is missing er ontbreekt een XPath-operator +@msg an XPath predicate or step cannot follow here hier kan geen XPath-predicaat of -stap volgen +@msg an XPath predicate or step follows a value that is not a node-set een XPath-predicaat of -stap volgt op een waarde die geen knooppuntenset is +@msg an XPath step is missing er ontbreekt een XPath-stap +@msg an artboard is listed twice een tekengebied staat twee keer in de lijst +@msg an empty artboard has no width or height to scale to een leeg tekengebied heeft geen breedte of hoogte om naar te schalen +@msg an image couldn't be decoded and is missing from the picture een afbeelding kon niet worden gedecodeerd en ontbreekt in het beeld +@msg an image is too large for DXF and was left out een afbeelding is te groot voor DXF en is weggelaten +@msg an image of {_1} MB, at most {_2} MB een afbeelding van {_1} MB, maximaal {_2} MB +@msg an image of {declared_w} × {declared_h} pixels is too large to draw een afbeelding van {declared_w} × {declared_h} pixels is te groot om te tekenen +@msg an image of {width} × {height} pixels is too large to draw een afbeelding van {width} × {height} pixels is te groot om te tekenen +@msg an image of {w} × {h} pixels is too large to convert (at most {_1} pixels) een afbeelding van {w} × {h} pixels is te groot om te converteren (maximaal {_1} pixels) +@msg an index must be a whole number een index moet een geheel getal zijn +@msg an inline graphic has no glyphs een inline afbeelding heeft geen glyphs +@msg an invisible text form can't be read een formulier met onzichtbare tekst kan niet worden gelezen +@msg an object is missing er ontbreekt een object +@msg an object's header is missing de kop van een object ontbreekt +@msg an overprinting form can't be read een overdrukkend formulier kan niet worden gelezen +@msg an unread object has no readable bounds een ongelezen object heeft geen leesbare grenzen +@msg an unread object holds a frame of threaded type een ongelezen object bevat een kader van gekoppelde tekst +@msg an unread object is missing from its layer een ongelezen object ontbreekt in zijn laag +@msg anchor `smooth` must be true or false `smooth` van het anker moet true of false zijn +@msg anchor `{key}` must be [x, y] `{key}` van het anker moet [x, y] zijn +@msg anchor `{key}` must be a number `{key}` van het anker moet een getal zijn +@msg angle and roundness must be finite hoek en ronding moeten eindig zijn +@msg angles must be a list as long as pins (degrees or null) angles moet een lijst zijn die even lang is als pins (graden of null) +@msg appearance must be flat|center|edge appearance moet flat|center|edge zijn +@msg apply is "fill" or "stroke", not `{other}` apply is "fill" of "stroke", niet `{other}` +@msg apply was called on a value that is not a function apply is aangeroepen op een waarde die geen functie is +@msg area must be a closed polygon of 3 to 100000 [x, y] points area moet een gesloten polygoon van 3 tot 100000 punten [x, y] zijn +@msg area type in a thread cannot use Dynamic Text: {frames} vlaktekst in gekoppelde tekst kan geen dynamische tekst gebruiken: {frames} +@msg area type needs a path that encloses an area vlaktekst heeft een pad nodig dat een oppervlak omsluit +@msg area type {_1} is named twice vlaktekst {_1} wordt twee keer genoemd +@msg array literal too long arrayliteral te lang +@msg arrowAlign must be extend|tip, got {o} arrowAlign moet extend|tip zijn, kreeg {o} +@msg arrowScale must be [start, end] arrowScale moet [start, end] zijn +@msg artboard is a 0-based index artboard is een index die bij 0 begint +@msg artboard must be a 0-based index artboard moet een index zijn die bij 0 begint +@msg artboard {i} doesn't print tekengebied {i} wordt niet afgedrukt +@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout moet {layout?, columns?, spacing?, rightToLeft?} zijn +@msg artboardLayout.columns must be 1 or more artboardLayout.columns moet 1 of meer zijn +@msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout moet gridByRow, gridByColumn, row of column zijn +@msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft moet true of false zijn +@msg artboardLayout.spacing must be 0–{MAX_SPACING} pt artboardLayout.spacing moet 0–{MAX_SPACING} pt zijn +@msg artboards must be a non-empty list artboards moet een niet-lege lijst zijn +@msg artboards must be a number artboards moet een getal zijn +@msg asset `{_1}` has no art to export asset `{_1}` heeft geen illustratie om te exporteren +@msg assignment to a constant binding toewijzing aan een constante binding +@msg at least one row that isn't excluded needs a weight above 0 minstens één rij die niet is uitgesloten heeft een gewicht boven 0 nodig +@msg at most {MAX_KEYWORDS} keywords maximaal {MAX_KEYWORDS} trefwoorden +@msg at most {MAX_MATCHES} matches are kept er worden maximaal {MAX_MATCHES} overeenkomsten bewaard +@msg at most {MAX_POINTS} points maximaal {MAX_POINTS} punten +@msg at most {MAX_QUEUE} files maximaal {MAX_QUEUE} bestanden +@msg at must be [x, y] at moet [x, y] zijn +@msg at/rect lie outside the canvas at/rect liggen buiten het canvas +@msg attribute must be size|leading|tracking|kerning|baselineShift attribute moet size|leading|tracking|kerning|baselineShift zijn +@msg attrs must be an object attrs moet een object zijn +@msg automation path rejected: the folder's name isn't valid text automatiseringspad geweigerd: de naam van de map is geen geldige tekst +@msg automation path rejected: {_1} isn't valid text automatiseringspad geweigerd: {_1} is geen geldige tekst +@msg automation path rejected: {why}: {path} automatiseringspad geweigerd: {why}: {path} +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{given}` axis moet "vertical", "horizontal" of een hoek in graden zijn, niet `{given}` +@msg backgroundContents must be transparent or white backgroundContents moet transparent of white zijn +@msg bad AES key ongeldige AES-sleutel +@msg bad `runs`: {e} ongeldige `runs`: {e} +@msg bad arrowScale ongeldige arrowScale +@msg bad base64 ongeldige base64 +@msg bad color {c} ongeldige kleur {c} +@msg bad colour ongeldige kleur +@msg bad colour in `colors` ongeldige kleur in `colors` +@msg bad colour {v} ongeldige kleur {v} +@msg bad colour {v} in groupColors ongeldige kleur {v} in groupColors +@msg bad cross-reference entry ongeldig item in de kruisverwijzingstabel +@msg bad cross-reference table ongeldige kruisverwijzingstabel +@msg bad current colour {v} ongeldige huidige kleur {v} +@msg bad dataBase64 ongeldige dataBase64 +@msg bad edit ongeldige bewerking +@msg bad fill {v} ongeldige vulling {v} +@msg bad fit: {e} ongeldige passing: {e} +@msg bad model {other} (keep, new or document) ongeldig model {other} (keep, new of document) +@msg bad new colour {v} ongeldige nieuwe kleur {v} +@msg bad object ongeldig object +@msg bad object number ongeldig objectnummer +@msg bad offset ongeldige positie +@msg bad path data: {e} ongeldige padgegevens: {e} +@msg bad point {v}: expected [x, y] ongeldig punt {v}: verwacht [x, y] +@msg bad point {v}: expected [x, y] or [x, y, pressure] ongeldig punt {v}: verwacht [x, y] of [x, y, pressure] +@msg bad reference ongeldige verwijzing +@msg bad trailer size ongeldige grootte in de trailer +@msg bad {k} colour ongeldige kleur voor {k} +@msg batches cannot nest batches kunnen niet worden genest +@msg bind something to a variable first koppel eerst iets aan een variabele +@msg bleed must be 0–{MAX_BLEED} pt: a number, [top, bottom, left, right] or {{top, bottom, left, right}} bleed moet 0–{MAX_BLEED} pt zijn: een getal, [top, bottom, left, right] of {{top, bottom, left, right}} +@msg blend must be a mode name blend moet de naam van een modus zijn +@msg both sides of an XPath | must select nodes beide zijden van een XPath-| moeten knooppunten selecteren +@msg brush must be a name or null brush moet een naam of null zijn +@msg by must be a number by moet een getal zijn +@msg can't add page thumbnails: {why} kan geen paginaminiaturen toevoegen: {why} +@msg can't add the editing data for other apps: {why} kan de bewerkingsgegevens voor andere apps niet toevoegen: {why} +@msg can't edit the written PDF: {why} kan de geschreven PDF niet bewerken: {why} +@msg can't encrypt the PDF: {why} kan de PDF niet versleutelen: {why} +@msg can't linearise the PDF: {why} kan de PDF niet lineariseren: {why} +@msg can't open `{_1}`: {_2} kan `{_1}` niet openen: {_2} +@msg can't open `{_1}`: {e} kan `{_1}` niet openen: {e} +@msg can't open `{name}`: not a format VectorCraft reads (see document.formats) kan `{name}` niet openen: geen indeling die VectorCraft leest (zie document.formats) +@msg can't place `{name}`: not a format VectorCraft reads (see document.formats) kan `{name}` niet plaatsen: geen indeling die VectorCraft leest (zie document.formats) +@msg can't read back the written PDF: {e} kan de geschreven PDF niet teruglezen: {e} +@msg can't read this Word document: {why} kan dit Word-document niet lezen: {why} +@msg can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp kan geen .{e}-afbeeldingen schrijven: gebruik .png, .jpg, .gif, .webp, .tif of .bmp +@msg can't write PDF layers, overprint or invisible text: {why} kan geen PDF-lagen, overdruk of onzichtbare tekst schrijven: {why} +@msg can't write the file's copyright: {why} kan het copyright van het bestand niet schrijven: {why} +@msg can't write the file's modification date: {why} kan de wijzigingsdatum van het bestand niet schrijven: {why} +@msg can't write the pages' user units: {why} kan de gebruikerseenheden van de pagina’s niet schrijven: {why} +@msg canceled geannuleerd +@msg cannot convert the object to a primitive value kan het object niet naar een primitieve waarde converteren +@msg cannot convert undefined or null to an object kan undefined of null niet naar een object converteren +@msg cannot distort a zero-size or non-finite bounding box kan een selectiekader zonder grootte of met niet-eindige afmetingen niet vervormen +@msg cannot move an object into itself kan een object niet in zichzelf verplaatsen +@msg case must be upper|lower|title|sentence case moet upper|lower|title|sentence zijn +@msg category `{c}`: one of {_1} categorie `{c}`: een van {_1} +@msg center must be [x, y] center moet [x, y] zijn +@msg character dimensions cannot be represented with the source text transform tekenafmetingen kunnen niet worden weergegeven met de teksttransformatie van de bron +@msg character dimensions cannot be represented with the target text transform tekenafmetingen kunnen niet worden weergegeven met de teksttransformatie van het doel +@msg choose at least one artboard kies minstens één tekengebied +@msg choose at least one status kies minstens één status +@msg clip must be true or false clip moet true of false zijn +@msg clippingMask must be true or false clippingMask moet true of false zijn +@msg closed must be a boolean closed moet een boolean zijn +@msg collapsed must be true or false collapsed moet true of false zijn +@msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile: er is geen RGB- of CMYK-profiel met de naam „{profile}” +@msg colorMode must be rgb or cmyk, not `{m}` colorMode moet rgb of cmyk zijn, niet `{m}` +@msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel moet {own} (de modus van het document), grayscale of bitmap zijn +@msg colour groups can't go into colour groups kleurgroepen kunnen niet in kleurgroepen worden geplaatst +@msg colour, mode and spot apply to solid-colour swatches only colour, mode en spot gelden alleen voor stalen met een effen kleur +@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read kolom {column}: `{cell}` is een `%`-kolom van grafiekgegevensbestanden, die niet worden gelezen +@msg column {column}: `{cell}` names `{name}`, which is a {_1} variable kolom {column}: `{cell}` noemt `{name}`, en dat is een variabele van het type {_1} +@msg column {column}: `{cell}` names no variable kolom {column}: `{cell}` noemt geen variabele +@msg column {column}: the variable name is longer than {MAX_NAME} characters kolom {column}: de naam van de variabele is langer dan {MAX_NAME} tekens +@msg column: true floats the whole column and takes no onto, above or below column: true laat de hele kolom zweven en accepteert geen onto, above of below +@msg command must be a shape.* command command moet een shape.*-opdracht zijn +@msg commands[{i}]: missing `command` commands[{i}]: `command` ontbreekt +@msg composer must be "singleLine" or "everyLine" composer moet "singleLine" of "everyLine" zijn +@msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes samengestelde vormen accepteren paden, samengestelde paden, groepen, samengestelde vormen, tekst, mengsels en omvormingen +@msg compound {_1} must contain exactly one open path to join samengesteld object {_1} moet precies één open pad bevatten om te verbinden +@msg connect needs a path other than the one extended connect heeft een ander pad nodig dan het pad dat wordt verlengd +@msg connect needs id connect heeft id nodig +@msg connect path has no open end het pad van connect heeft geen open uiteinde +@msg continuation must be an array of path chunks continuation moet een array van padstukken zijn +@msg continuation requires points continuation vereist points +@msg copy needs path: the file to copy into the document's folder copy heeft path nodig: het bestand dat naar de map van het document wordt gekopieerd +@msg copy takes images only: relink placed documents where their files are copy accepteert alleen afbeeldingen: koppel geplaatste documenten opnieuw op de plek waar hun bestanden staan +@msg copying a file isn't available on the web een bestand kopiëren is niet beschikbaar op het web +@msg copyrightStatus must be unknown, copyrighted or publicDomain copyrightStatus moet unknown, copyrighted of publicDomain zijn +@msg copyrightUrl must be a URL (no spaces, at most 2048 characters) copyrightUrl moet een URL zijn (geen spaties, maximaal 2048 tekens) +@msg corners must be 4 [x, y] points (TL, TR, BR, BL) corners moet uit 4 punten [x, y] bestaan (LB, RB, RO, LO) +@msg counterPer `{c}`: item or file counterPer `{c}`: item of file +@msg crop `{_1}`: only PDF pages have art, trim, bleed and media boxes; use "crop" or "bounding" crop `{_1}`: alleen PDF-pagina’s hebben art-, trim-, bleed- en mediakaders; gebruik "crop" of "bounding" +@msg crop rectangle doesn't overlap the image de bijsnijdrechthoek overlapt de afbeelding niet +@msg cross-reference and object streams aren't supported kruisverwijzings- en objectstromen worden niet ondersteund +@msg damaged compressed data: {e} beschadigde gecomprimeerde gegevens: {e} +@msg dash lengths must be numbers, got {v} streeplengten moeten getallen zijn, kreeg {v} +@msg dash must be a list of lengths or null, got {v} dash moet een lijst met lengten of null zijn, kreeg {v} +@msg data key `{k}`: letters, digits, -, _ and . (not name or vc-…) gegevenssleutel `{k}`: letters, cijfers, -, _ en . (niet name of vc-…) +@msg data must be an object of key: value, not {v} data moet een object van sleutel: waarde zijn, niet {v} +@msg data set `{name}` holds a value for `{var}`, which the library doesn't declare gegevensset `{name}` bevat een waarde voor `{var}`, die de bibliotheek niet declareert +@msg data set `{name}` holds two values for `{var}` gegevensset `{name}` bevat twee waarden voor `{var}` +@msg data set `{name}` is declared twice gegevensset `{name}` is twee keer gedeclareerd +@msg data takes at most {MAX_DATA} keys at once data accepteert maximaal {MAX_DATA} sleutels tegelijk +@msg dataset `{name}` already exists gegevensset `{name}` bestaat al +@msg dataset `{to}` already exists gegevensset `{to}` bestaat al +@msg date `{d}`: YYYY-MM-DD datum `{d}`: YYYY-MM-DD +@msg decoded data is too large de gedecodeerde gegevens zijn te groot +@msg define a variable first definieer eerst een variabele +@msg detect must be true or false detect moet true of false zijn +@msg direct-select anchor points of a path selecteer met directe selectie ankerpunten van een pad +@msg distance must be > 0 distance moet > 0 zijn +@msg dx and dy give the arrow's direction dx en dy geven de richting van de pijl +@msg dx and dy must be numbers dx en dy moeten getallen zijn +@msg dxf fitTo must be [width, height], positive dxf fitTo moet [width, height] zijn, positief +@msg dxf must be an object of DXF import options dxf moet een object met DXF-importopties zijn +@msg dxf scale must be a positive number up to {_1}, not {s} dxf scale moet een positief getal tot en met {_1} zijn, niet {s} +@msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf unit `{u}`: een eenheid zoals mm, cm, in of pt +@msg dxf: {e} dxf: {e} +@msg each format is an object {format, scale?, suffix?} elke indeling is een object {format, scale?, suffix?} +@msg each item needs an id elk item heeft een id nodig +@msg each match needs `kind` elke overeenkomst heeft `kind` nodig +@msg each match needs a `name` elke overeenkomst heeft een `name` nodig +@msg each of `fonts` is {family, style?}; 1 to 1000 of them elk item van `fonts` is {family, style?}; 1 tot 1000 stuks +@msg each of `items` is {kind, item} elk item van `items` is {kind, item} +@msg each of `items` is {{id, corners?}} with an object id, not {it} elk item van `items` is {{id, corners?}} met een object-id, niet {it} +@msg each path chunk must contain 1 to 4096 points elk padstuk moet 1 tot 4096 punten bevatten +@msg each pick is {{at: [x, y]}} or {{rect: [x0, y0, x1, y1]}} (got {v}) elke keuze is {{at: [x, y]}} of {{rect: [x0, y0, x1, y1]}} (kreeg {v}) +@msg each row needs `from` elke rij heeft `from` nodig +@msg each stop needs a position elke stop heeft een positie nodig +@msg each subpath needs an anchors array elk subpad heeft een array anchors nodig +@msg each weight must be a number of 0 or more (got {v}) elk gewicht moet een getal van 0 of meer zijn (kreeg {v}) +@msg easingType must be easeIn, easeOut, easeInOut or easeOutIn easingType moet easeIn, easeOut, easeInOut of easeOutIn zijn +@msg editingData must be true or false editingData moet true of false zijn +@msg editingData must be true, false or "always" editingData moet true, false of "always" zijn +@msg edits overlap bewerkingen overlappen elkaar +@msg effects of objects whose appearances differ can't be moved together effecten van objecten met een verschillende vormgeving kunnen niet samen worden verplaatst +@msg empty header in column {_1} lege koptekst in kolom {_1} +@msg encoding `{_1}`: utf8 or utf16 codering `{_1}`: utf8 of utf16 +@msg ends must be two of "first" and "last" ends moet uit twee waarden "first" en "last" bestaan +@msg every numbered name for the result is taken elke genummerde naam voor het resultaat is al in gebruik +@msg expanded SVG styles exceed the import size limit uitgevouwen SVG-stijlen overschrijden de groottelimiet voor importeren +@msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes het bestand met exportvoorinstellingen is groter dan {MAX_PRESET_FILE_BYTES} bytes +@msg exportText must be editable or appearance exportText moet editable of appearance zijn +@msg exportType must be movieClip or graphic, not `{s}` exportType moet movieClip of graphic zijn, niet `{s}` +@msg extend needs id extend heeft id nodig +@msg featureChanges lists at most {MAX_FEATURE_CHANGES} tags featureChanges bevat maximaal {MAX_FEATURE_CHANGES} tags +@msg featureChanges must be a list of tags featureChanges moet een lijst met tags zijn +@msg features must be a list of tags features moet een lijst met tags zijn +@msg fidelity must be 0..100 fidelity moet 0..100 zijn +@msg files must be {name, dataBase64} files moet {name, dataBase64} zijn +@msg finally table {t} out of range finally-tabel {t} buiten het bereik +@msg fit must be none|autoHeight|shrinkText|block, got {id} fit moet none|autoHeight|shrinkText|block zijn, kreeg {id} +@msg flags cannot be given with a RegExp object flags kunnen niet samen met een RegExp-object worden opgegeven +@msg flattener: {e} afvlakker: {e} +@msg flattenerPreset `{name}`: high, medium, low or a saved one (see flattener.presets.list) flattenerPreset `{name}`: high, medium, low of een opgeslagen voorinstelling (zie flattener.presets.list) +@msg flipProfile must be along|across, got {o} flipProfile moet along|across zijn, kreeg {o} +@msg folders `{f}`: none, rows, format, item or itemFormat folders `{f}`: none, rows, format, item of itemFormat +@msg folders deeper than {MAX_BATCH_DEPTH} levels mappen dieper dan {MAX_BATCH_DEPTH} niveaus +@msg folders deeper than {MAX_DEPTH} levels mappen dieper dan {MAX_DEPTH} niveaus +@msg font family `{family}` is not available lettertypefamilie `{family}` is niet beschikbaar +@msg font family `{tf}` is not available lettertypefamilie `{tf}` is niet beschikbaar +@msg format `{f}`: pdf or postscript format `{f}`: pdf of postscript +@msg format `{f}`: text or json format `{f}`: text of json +@msg format is `{format}` de indeling is `{format}` +@msg formats must be an array of rows, not {v} formats moet een array van rijen zijn, niet {v} +@msg frequency must be between 1 and 300 lines per inch frequency moet tussen 1 en 300 lijnen per inch liggen +@msg from and to must be finite from en to moeten eindig zijn +@msg from must be [x0, y0, x1, y1] from moet [x0, y0, x1, y1] zijn +@msg function declaration index out of range index van functiedeclaratie buiten het bereik +@msg give `before` or `after`, not both geef `before` of `after`, niet beide +@msg give `char`, `text`, `code` or `unicode` geef `char`, `text`, `code` of `unicode` +@msg give `colors`, or `color` and `rule` geef `colors`, of `color` en `rule` +@msg give `count` or `spacing`, not both geef `count` of `spacing`, niet beide +@msg give `event`, such as onclick geef `event`, zoals onclick +@msg give `file`, the JavaScript file's path or URL geef `file`, het pad of de URL van het JavaScript-bestand +@msg give `fill` and/or `stroke` geef `fill` en/of `stroke` +@msg give `fill`, `stroke` or both geef `fill`, `stroke` of beide +@msg give `folder` geef `folder` +@msg give `fonts`, or open a document geef `fonts`, of open een document +@msg give `from` or `indices`, not both geef `from` of `indices`, niet beide +@msg give `id` (no text is being edited) geef `id` (er wordt geen tekst bewerkt) +@msg give `id` and `anchors`, or `items`, not both geef `id` en `anchors`, of `items`, niet beide +@msg give `id` or `guide`, not both geef `id` of `guide`, niet beide +@msg give `length` or `to` geef `length` of `to` +@msg give `matches`: [{kind, name, target}] geef `matches`: [{kind, name, target}] +@msg give `name` (or edit a pattern) geef `name` (of bewerk een patroon) +@msg give `name` or `names` geef `name` of `names` +@msg give `name`, an SVG filter's name geef `name`, de naam van een SVG-filter +@msg give `path` (a .wasm file) or `dataBase64` (the module) geef `path` (een .wasm-bestand) of `dataBase64` (de module) +@msg give `path`, `data` or `dataBase64` geef `path`, `data` of `dataBase64` +@msg give `path`, `data`, `dataBase64` or `csv` geef `path`, `data`, `dataBase64` of `csv` +@msg give `path`, `xml` or `dataBase64` geef `path`, `xml` of `dataBase64` +@msg give `path`, an SVG file, or `svg`, SVG text geef `path`, een SVG-bestand, of `svg`, SVG-tekst +@msg give `script`, the JavaScript the event runs ("" removes the event) geef `script`, de JavaScript die de gebeurtenis uitvoert ("" verwijdert de gebeurtenis) +@msg give `text` (the reading) or `remove` geef `text` (de lezing) of `remove` +@msg give `x` and `y` (and a `tolerance` of 0 or more) geef `x` en `y` (en een `tolerance` van 0 of meer) +@msg give `xml`, one SVG element geef `xml`, één SVG-element +@msg give a mode or r/g/b, c/m/y/k, gray or tint adjustments geef een modus of aanpassingen voor r/g/b, c/m/y/k, gray of tint +@msg give a name, or paint the active proxy with a saved preset geef een naam, of verf de actieve proxy met een opgeslagen voorinstelling +@msg give a name, or select a stroke with a saved profile geef een naam, of selecteer een contour met een opgeslagen profiel +@msg give a pattern name or select an object painted with a pattern geef de naam van een patroon of selecteer een object dat met een patroon is geverfd +@msg give at least one of clip, invert, disabled, linked geef minstens een van clip, invert, disabled, linked +@msg give color, none, swatch or gradient geef color, none, swatch of gradient +@msg give dataBase64 geef dataBase64 +@msg give either at (a click) or area (a path drawn around the overlaps) geef at (een klik) of area (een pad dat rond de overlappingen is getekend) +@msg give exactly one of `at`, `rect` and `points` geef precies een van `at`, `rect` en `points` +@msg give exactly one of `path`, `data` and `dataBase64` geef precies een van `path`, `data` en `dataBase64` +@msg give formats or a preset, not both geef formats of een voorinstelling, niet beide +@msg give index or indexes, not both geef index of indexes, niet beide +@msg give newName or delete geef newName of delete +@msg give offset or by geef offset of by +@msg give one element geef één element +@msg give one of `to`, `rect` or `at` geef een van `to`, `rect` of `at` +@msg give one of assets, layers, selection or fullDocument geef een van assets, layers, selection of fullDocument +@msg give only one of onto, above, below, icon and a column place geef slechts een van onto, above, below, icon en een kolomplaats +@msg give opacity or blend geef opacity of blend +@msg give origin: [x, y], or reset: true geef origin: [x, y], of reset: true +@msg give overprintFill, overprintStroke, showCenter, imageMap, url or note geef overprintFill, overprintStroke, showCenter, imageMap, url of note +@msg give path (a file) or folder geef path (een bestand) of folder +@msg give path, or name and dataBase64 geef path, of name en dataBase64 +@msg give paths or files geef paths of files +@msg give rows, rowHeight, columns or columnWidth geef rows, rowHeight, columns of columnWidth +@msg give svg, or dataBase64 of an SVG or SVGZ file geef svg, of dataBase64 van een SVG- of SVGZ-bestand +@msg give text geef text +@msg give the asset a name geef de asset een naam +@msg give the preset a `name` geef de voorinstelling een `name` +@msg give the preset a name geef de voorinstelling een naam +@msg give the preset a name (1–64 characters) geef de voorinstelling een naam (1–64 tekens) +@msg give the settings to change, e.g. {"formats"}]} geef de instellingen die moeten worden gewijzigd, bijv. {"formats"}]} +@msg give the style a name geef de stijl een naam +@msg give two or more style `names` geef twee of meer `names` van stijlen +@msg give two or more swatches geef twee of meer stalen +@msg give x, y, or a handle's length or angle geef x, y, of de lengte of hoek van een handgreep +@msg give {key, value} or {values} geef {key, value} of {values} +@msg global must be true or false global moet true of false zijn +@msg glyph {_1} is not drawn for {ch} with the character's style (such as All Caps, Small Caps or a numeral system) glyph {_1} wordt niet getekend voor {ch} met de stijl van het teken (zoals hoofdletters, kleinkapitalen of een cijfersysteem) +@msg glyph {g} is not an alternate of {ch} in {_1} {_2} glyph {g} is geen alternatief voor {ch} in {_1} {_2} +@msg gradient must be "objects" or "mesh" gradient moet "objects" of "mesh" zijn +@msg grays must be "profile" or "black", not `{g}` grays moet "profile" of "black" zijn, niet `{g}` +@msg gridColors must be a preset name or two colours gridColors moet de naam van een voorinstelling of twee kleuren zijn +@msg gridSize must be small, medium or large gridSize moet small, medium of large zijn +@msg guide {g} is not selected hulplijn {g} is niet geselecteerd +@msg handle must be 0..3 handle moet 0..3 zijn +@msg handler at {_1} expects {_2} values but its range starts with {d} de handler op {_1} verwacht {_2} waarden, maar het bereik ervan begint met {d} +@msg handler depth too large handlerdiepte te groot +@msg handler range {_1}..{_2} out of range handlerbereik {_1}..{_2} buiten het bereik +@msg hiddenLayers must be true or false hiddenLayers moet true of false zijn +@msg hiddenObjects {v}: "layer" (the default), "omit" or "visible" hiddenObjects {v}: "layer" (de standaard), "omit" of "visible" +@msg highlight a layer to merge into markeer een laag om in samen te voegen +@msg highlight two or more rows in one layer or group markeer twee of meer rijen in één laag of groep +@msg highlight two or more rows to merge markeer twee of meer rijen om samen te voegen +@msg hvcC hvcC +@msg icon docks a panel in the icon column: use window.panel.dock icon dockt een paneel in de pictogramkolom: gebruik window.panel.dock +@msg id must be a dimension id id moet de id van een maatlijn zijn +@msg image has no bounds de afbeelding heeft geen grenzen +@msg image {_1} is linked already afbeelding {_1} is al gekoppeld +@msg imageMap `{m}`: none, client or server imageMap `{m}`: none, client of server +@msg images in a spot ink whose samples couldn't be read were imported in RGB afbeeldingen in een steunkleurinkt waarvan de samples niet konden worden gelezen, zijn in RGB geïmporteerd +@msg images past the most pixels one file may hold were left out afbeeldingen boven het maximale aantal pixels dat één bestand mag bevatten, zijn weggelaten +@msg images too large to read were left out afbeeldingen die te groot zijn om te lezen, zijn weggelaten +@msg index out of range index buiten het bereik +@msg indexes may hold at most {MAX_GUIDE_INDEXES} entries indexes mag maximaal {MAX_GUIDE_INDEXES} items bevatten +@msg indexes must be an array of guide indexes indexes moet een array van hulplijnindexen zijn +@msg instances must be 1..1000 instances moet 1..1000 zijn +@msg instruction out of range instructie buiten het bereik +@msg instruction {pc} ({op}) pops below the stack instructie {pc} ({op}) haalt meer van de stack dan erop staat +@msg instruction {pc} reached with stack depths {seen} and {d} instructie {pc} bereikt met stackdiepten {seen} en {d} +@msg invalid `color` ongeldige `color` +@msg invalid anchor index {v}: expected a non-negative integer ongeldige ankerindex {v}: verwacht een niet-negatief geheel getal +@msg invalid anchor reference {v}: expected [subpath, anchor] ongeldige ankerverwijzing {v}: verwacht [subpath, anchor] +@msg invalid angle ongeldige hoek +@msg invalid array length ongeldige arraylengte +@msg invalid brush: {e} ongeldig penseel: {e} +@msg invalid color ongeldige kleur +@msg invalid colour {c} ongeldige kleur {c} +@msg invalid delta ongeldige delta +@msg invalid group ongeldige groep +@msg invalid object id {v}: expected a non-negative integer ongeldige object-id {v}: verwacht een niet-negatief geheel getal +@msg invalid point ongeldig punt +@msg invalid regular expression flag '{_1}' ongeldige vlag '{_1}' voor reguliere expressie +@msg invalid regular expression: {m} ongeldige reguliere expressie: {m} +@msg invalid size ongeldige grootte +@msg invalid t ongeldige t +@msg invalid time value ongeldige tijdwaarde +@msg invalid tolerance ongeldige tolerantie +@msg is a confirm's answer, whose `value` must be true or false is het antwoord op een confirm, waarvan `value` true of false moet zijn +@msg is a prompt's answer, whose `value` must be a string or null is het antwoord op een prompt, waarvan `value` een string of null moet zijn +@msg is an alert's answer, whose `value` must be "ok" is het antwoord op een alert, waarvan `value` "ok" moet zijn +@msg is longer than 16 KiB is langer dan 16 KiB +@msg it draws its image through a clipping path het tekent zijn afbeelding door een knippad +@msg it draws no image het tekent geen afbeelding +@msg it is larger than {MAX_DICTIONARY_FILE_BYTES} bytes het is groter dan {MAX_DICTIONARY_FILE_BYTES} bytes +@msg it isn't a file het is geen bestand +@msg it names {_1} plates, and at most {MAX_PLATES} are read het noemt {_1} platen, en er worden er maximaal {MAX_PLATES} gelezen +@msg its art is too long or too detailed for a head de illustratie ervan is te lang of te gedetailleerd voor een kop +@msg its art paints nothing de illustratie ervan verft niets +@msg its artboards all lie beyond the canvas (more than {_1} pt from the origin) alle tekengebieden ervan liggen buiten het canvas (meer dan {_1} pt van de oorsprong) +@msg its clipping masks are nested too deeply de knipmaskers ervan zijn te diep genest +@msg its image is too large to read de afbeelding ervan is te groot om te lezen +@msg its metadata has no description de metagegevens ervan hebben geen beschrijving +@msg its metadata has no direct length de metagegevens ervan hebben geen directe lengte +@msg its plates are too large: more than {MAX_SAMPLES} pixels together de platen ervan zijn te groot: samen meer dan {MAX_SAMPLES} pixels +@msg its plates are too large: {_1} plates of {w} × {h} pixels de platen ervan zijn te groot: {_1} platen van {w} × {h} pixels +@msg its plates can't be kept together de platen ervan kunnen niet bij elkaar worden gehouden +@msg its shapes could not be combined into one de vormen ervan konden niet tot één vorm worden gecombineerd +@msg join two different paths verbind twee verschillende paden +@msg jump to {pc}, past the end sprong naar {pc}, voorbij het einde +@msg justify must be auto|left|center|right|justifyAll justify moet auto|left|center|right|justifyAll zijn +@msg kbps must be a positive number, not {kbps} kbps moet een positief getal zijn, niet {kbps} +@msg keywords must be a list of words or a comma-separated string keywords moet een lijst met woorden of een door komma’s gescheiden string zijn +@msg keywords must be at most {MAX_KEYWORD} characters, without control characters keywords mogen maximaal {MAX_KEYWORD} tekens lang zijn, zonder besturingstekens +@msg kind must be 1, 2 or 3, or give a preset `name` (see perspective.presets.list) kind moet 1, 2 of 3 zijn, of geef de `name` van een voorinstelling (zie perspective.presets.list) +@msg kind must be graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle or paraStyle kind moet graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle of paraStyle zijn +@msg knockout must be "on", "off", "neutral" or a bool, not {v} knockout moet "on", "off", "neutral" of een boolean zijn, niet {v} +@msg layer `{name}` has no art to export laag `{name}` heeft geen illustratie om te exporteren +@msg layer must name a layer or sublayer layer moet een laag of sublaag noemen +@msg layers can't be intertwined: select the objects in them lagen kunnen niet worden verstrengeld: selecteer de objecten erin +@msg layers go only at the top level or in layers, objects in layers and groups lagen staan alleen op het hoogste niveau of in lagen, objecten in lagen en groepen +@msg layers must be true or false layers moet true of false zijn +@msg layout must be gridByRow, gridByColumn, row or column layout moet gridByRow, gridByColumn, row of column zijn +@msg leading must be a number or "auto" leading moet een getal of "auto" zijn +@msg left/right must be non-negative widths left/right moeten niet-negatieve breedten zijn +@msg legacyNameEncoding must be one of {_1} legacyNameEncoding moet een van {_1} zijn +@msg level `{t}`: 2 or 3 niveau `{t}`: 2 of 3 +@msg line {line}: more than {MAX_CSV_COLS} columns regel {line}: meer dan {MAX_CSV_COLS} kolommen +@msg line {line}: unclosed quote regel {line}: niet-afgesloten aanhalingsteken +@msg line {line}: value for `{var}` must match its variable kind regel {line}: de waarde voor `{var}` moet bij het soort variabele passen +@msg lineEndings `{other}`: lf or crlf lineEndings `{other}`: lf of crlf +@msg loading profiles from disk isn't available in the browser profielen van schijf laden is niet beschikbaar in de browser +@msg localize: the first argument must be a localization object or a string localize: het eerste argument moet een lokalisatieobject of een string zijn +@msg margin: a {m} pt margin leaves no imageable area on the paper marge: een marge van {m} pt laat geen afdrukbaar gebied op het papier over +@msg matrix must be finite and invertible, depth finite matrix moet eindig en inverteerbaar zijn, depth eindig +@msg matte: {e} mat: {e} +@msg member is for order front, forward, backward or back member is bedoeld voor order front, forward, backward of back +@msg missing `artboards` `artboards` ontbreekt +@msg missing `at` [x, y] `at` [x, y] ontbreekt +@msg missing `attrs` `attrs` ontbreekt +@msg missing `color` or `opacity` `color` of `opacity` ontbreekt +@msg missing `colors` `colors` ontbreekt +@msg missing `commands` `commands` ontbreekt +@msg missing `destinationFolder` `destinationFolder` ontbreekt +@msg missing `effect` id de id `effect` ontbreekt +@msg missing `family` `family` ontbreekt +@msg missing `find` `find` ontbreekt +@msg missing `gid` (a glyph id, or null for the default glyph) `gid` ontbreekt (een glyph-id, of null voor de standaardglyph) +@msg missing `group` `group` ontbreekt +@msg missing `id` `id` ontbreekt +@msg missing `id`: give one, or select one type object `id` ontbreekt: geef er een, of selecteer één tekstobject +@msg missing `index` (a point index, or null to clear) `index` ontbreekt (een puntindex, of null om te wissen) +@msg missing `index` (a stop index, or null to clear) `index` ontbreekt (een stopindex, of null om te wissen) +@msg missing `index` (an item index or null) `index` ontbreekt (een itemindex of null) +@msg missing `item` `item` ontbreekt +@msg missing `library` `library` ontbreekt +@msg missing `library` (see graphicStyle.libraries) `library` ontbreekt (zie graphicStyle.libraries) +@msg missing `library` (see swatch.library.list) `library` ontbreekt (zie swatch.library.list) +@msg missing `map` (rows [{from, to}] or {current}) `map` ontbreekt (rijen [{from, to}] of {current}) +@msg missing `matrix` [a,b,c,d,e,f] `matrix` [a,b,c,d,e,f] ontbreekt +@msg missing `name` (see gradient.presets.list) `name` ontbreekt (zie gradient.presets.list) +@msg missing `offset` (a distance in points) `offset` ontbreekt (een afstand in punten) +@msg missing `path` `path` ontbreekt +@msg missing `path` (a path object id) `path` ontbreekt (de id van een padobject) +@msg missing `picks` `picks` ontbreekt +@msg missing `rule` `rule` ontbreekt +@msg missing `source` id de id `source` ontbreekt +@msg missing `start` (the byte offset of a character) `start` ontbreekt (de bytepositie van een teken) +@msg missing `status`: linked, embedded, missing or modified `status` ontbreekt: linked, embedded, missing of modified +@msg missing `target` id de id `target` ontbreekt +@msg missing `text` `text` ontbreekt +@msg missing `to` `to` ontbreekt +@msg missing `to` (an index) `to` ontbreekt (een index) +@msg missing `to`: a non-negative integer `to` ontbreekt: een niet-negatief geheel getal +@msg missing `type` `type` ontbreekt +@msg missing `value` `value` ontbreekt +@msg missing `word` `word` ontbreekt +@msg missing `{key}` `{key}` ontbreekt +@msg missing `{k}` `{k}` ontbreekt +@msg missing anchor anker ontbreekt +@msg missing anchors ankers ontbreken +@msg missing anchors [[subpath, anchor]…] anchors [[subpath, anchor]…] ontbreekt +@msg missing array `{key}` array `{key}` ontbreekt +@msg missing case case ontbreekt +@msg missing color color ontbreekt +@msg missing commands commands ontbreekt +@msg missing destination folder doelmap ontbreekt +@msg missing from from ontbreekt +@msg missing group group ontbreekt +@msg missing id or ids id of ids ontbreekt +@msg missing ids ids ontbreekt +@msg missing indexes indexes ontbreekt +@msg missing matrix [a,b,c,d,e,f] matrix [a,b,c,d,e,f] ontbreekt +@msg missing name name ontbreekt +@msg missing op op ontbreekt +@msg missing or invalid `color` `color` ontbreekt of is ongeldig +@msg missing or unknown `tool` `tool` ontbreekt of is onbekend +@msg missing point punt ontbreekt +@msg missing point [x,y] punt [x,y] ontbreekt +@msg missing point `{key}` ([x, y]) punt `{key}` ([x, y]) ontbreekt +@msg missing points points ontbreekt +@msg missing points [[x,y]…] points [[x,y]…] ontbreekt +@msg missing segment segment ontbreekt +@msg missing stops stops ontbreekt +@msg missing subpaths subpaths ontbreekt +@msg missing target target ontbreekt +@msg missing to to ontbreekt +@msg missing x, y x, y ontbreekt +@msg mode is set, add or toggle, not `{other}` mode is set, add of toggle, niet `{other}` +@msg mode must be "cmyk" or "rgb" mode moet "cmyk" of "rgb" zijn +@msg mode must be area|onPath, got {o} mode moet area|onPath zijn, kreeg {o} +@msg more than 10000 linked files: package dependencies in smaller parts meer dan 10000 gekoppelde bestanden: verpak de afhankelijkheden in kleinere delen +@msg more than 256 commands meer dan 256 opdrachten +@msg more than {MAX_BATCH_FILES} data sets meer dan {MAX_BATCH_FILES} gegevenssets +@msg more than {MAX_BATCH_FILES} files meer dan {MAX_BATCH_FILES} bestanden +@msg more than {MAX_CSV_ROWS} data rows meer dan {MAX_CSV_ROWS} gegevensrijen +@msg more than {MAX_FILES} images meer dan {MAX_FILES} afbeeldingen +@msg more than {MAX_IMPORT} presets meer dan {MAX_IMPORT} voorinstellingen +@msg moved must be [[x,y]…] moved moet [[x,y]…] zijn +@msg must be an object with `kind` and `value` moet een object met `kind` en `value` zijn +@msg must have `kind` alert, confirm or prompt moet `kind` alert, confirm of prompt hebben +@msg must have exactly `kind` and `value` moet precies `kind` en `value` hebben +@msg name (a toolbar's name) is required name (de naam van een werkbalk) is vereist +@msg name (a toolbar's name) must be a string name (de naam van een werkbalk) moet een string zijn +@msg name must be a toolbar's name name moet de naam van een werkbalk zijn +@msg names is empty names is leeg +@msg names must be an array of symbol names names moet een array van symboolnamen zijn +@msg need `anchor` or `segment` + `t` `anchor` of `segment` + `t` is nodig +@msg need at least one anchor er is minstens één anker nodig +@msg need at least one point er is minstens één punt nodig +@msg need at least two points er zijn minstens twee punten nodig +@msg needs a closing quote after the name heeft een afsluitend aanhalingsteken na de naam nodig +@msg needs a name heeft een naam nodig +@msg needs a name of at most 64 bytes heeft een naam van maximaal 64 bytes nodig +@msg needs a name of letters, digits and _, or a quoted name heeft een naam van letters, cijfers en _ nodig, of een naam tussen aanhalingstekens +@msg needs a name without control characters heeft een naam zonder besturingstekens nodig +@msg needs points heeft punten nodig +@msg nesting too deep te diep genest +@msg nineSlice must be true or false nineSlice moet true of false zijn +@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides moet [left, top, right, bottom] zijn, elk -16..16, met left + right < 1 en top + bottom < 1 +@msg no HP-GL format geen HP-GL-indeling +@msg no New Document profile called `{shown}` ({_1}) geen profiel voor nieuwe documenten met de naam `{shown}` ({_1}) +@msg no PDF preset named `{n}` geen PDF-voorinstelling met de naam `{n}` +@msg no SVG filter at index {k} geen SVG-filter op index {k} +@msg no action set is current er is geen actieset actief +@msg no active data set geen actieve gegevensset +@msg no appearance item {index} geen vormgevingsitem {index} +@msg no arrowheads file here hier is geen bestand met pijlpunten +@msg no artboard {_1} geen tekengebied {_1} +@msg no artboard {artboard} (0-based; the document has {_1}) geen tekengebied {artboard} (begint bij 0; het document heeft er {_1}) +@msg no asset {id} geen asset {id} +@msg no asset {id} (see assets.list) geen asset {id} (zie assets.list) +@msg no assets to export geen assets om te exporteren +@msg no assets yet: collect art for export first (assets.add) nog geen assets: verzamel eerst illustraties voor export (assets.add) +@msg no brush named `{n}` geen penseel met de naam `{n}` +@msg no character at byte {start} geen teken op byte {start} +@msg no character has code {code} geen teken heeft code {code} +@msg no colour geen kleur +@msg no colour group `{group}` geen kleurgroep `{group}` +@msg no colour group `{name}` geen kleurgroep `{name}` +@msg no custom arrowhead {name} (see stroke.arrowheads.list) geen aangepaste pijlpunt {name} (zie stroke.arrowheads.list) +@msg no data sets geen gegevenssets +@msg no dataset named `{from}` geen gegevensset met de naam `{from}` +@msg no dataset named `{name}` geen gegevensset met de naam `{name}` +@msg no datasets geen gegevenssets +@msg no design named `{name}` geen ontwerp met de naam `{name}` +@msg no design named `{n}` geen ontwerp met de naam `{n}` +@msg no design named `{old}` geen ontwerp met de naam `{old}` +@msg no encoder for {_1} yet nog geen encoder voor {_1} +@msg no export preset `{name}` (see document.exportPresets.list) geen exportvoorinstelling `{name}` (zie document.exportPresets.list) +@msg no file to open geen bestand om te openen +@msg no folder: pass `path` or set Preferences › Plug-ins & Scratch Disks › Additional Plug-ins Folder geen map: geef `path` op of stel Voorkeuren › Plug-ins & Scratchschijven › Extra map met plug-ins in +@msg no fonts to look for: they are all available geen lettertypen om te zoeken: ze zijn allemaal beschikbaar +@msg no formats to export geen indelingen om te exporteren +@msg no gradient preset `{name}` (see gradient.presets.list) geen verloopvoorinstelling `{name}` (zie gradient.presets.list) +@msg no graphic style `{n}` in `{_1}` geen grafische stijl `{n}` in `{_1}` +@msg no graphic style library `{key}` (see graphicStyle.libraries) geen bibliotheek met grafische stijlen `{key}` (zie graphicStyle.libraries) +@msg no guide selected geen hulplijn geselecteerd +@msg no guide selected (or give an index) geen hulplijn geselecteerd (of geef een index) +@msg no guide {i} geen hulplijn {i} +@msg no images in the folder geen afbeeldingen in de map +@msg no instructions geen instructies +@msg no item at index {_1} geen item op index {_1} +@msg no item at index {from} geen item op index {from} +@msg no item at one of the indices {idx} geen item op een van de indexen {idx} +@msg no layer geen laag +@msg no layer to rename geen laag om te hernoemen +@msg no layer {id} (see layer.list) geen laag {id} (zie layer.list) +@msg no layers to export geen lagen om te exporteren +@msg no library `{key}` geen bibliotheek `{key}` +@msg no metafile format geen metafile-indeling +@msg no object {_1} geen object {_1} +@msg no objects geen objecten +@msg no parent layer geen bovenliggende laag +@msg no perspective grid preset named `{b}` (see perspective.presets.list) geen voorinstelling voor het perspectiefraster met de naam `{b}` (zie perspective.presets.list) +@msg no perspective grid preset named `{n}` geen voorinstelling voor het perspectiefraster met de naam `{n}` +@msg no point selected (give `index`) geen punt geselecteerd (geef `index`) +@msg no preset called `{from}` (see file.newPresets) geen voorinstelling met de naam `{from}` (zie file.newPresets) +@msg no preset called `{name}` (see file.newPresets) geen voorinstelling met de naam `{name}` (zie file.newPresets) +@msg no preset named `{n}` geen voorinstelling met de naam `{n}` +@msg no print preset named `{b}` (see print.presets.list) geen afdrukvoorinstelling met de naam `{b}` (zie print.presets.list) +@msg no print preset named `{name}` (presets: {_1}) geen afdrukvoorinstelling met de naam `{name}` (voorinstellingen: {_1}) +@msg no print preset named `{n}` geen afdrukvoorinstelling met de naam `{n}` +@msg no profile named `{name}` geen profiel met de naam `{name}` +@msg no random numbers ({e}) geen willekeurige getallen ({e}) +@msg no readable files in the folder geen leesbare bestanden in de map +@msg no recovery copy `{f}` (see file.recovery.list) geen herstelkopie `{f}` (zie file.recovery.list) +@msg no rows geen rijen +@msg no saved PDF preset named `{name}` geen opgeslagen PDF-voorinstelling met de naam `{name}` +@msg no saved export preset `{name}` geen opgeslagen exportvoorinstelling `{name}` +@msg no saved gradient preset called {name} geen opgeslagen verloopvoorinstelling met de naam {name} +@msg no saved gradient presets geen opgeslagen verloopvoorinstellingen +@msg no saved preset called `{name}` geen opgeslagen voorinstelling met de naam `{name}` +@msg no saved presets to export (name [Default] in `names` to export it) geen opgeslagen voorinstellingen om te exporteren (noem [Default] in `names` om die te exporteren) +@msg no saved presets to export (name built-in ones in `names`) geen opgeslagen voorinstellingen om te exporteren (noem ingebouwde in `names`) +@msg no saved print preset named `{name}` geen opgeslagen afdrukvoorinstelling met de naam `{name}` +@msg no saved profile called {name} geen opgeslagen profiel met de naam {name} +@msg no saved selection `{name}` geen opgeslagen selectie `{name}` +@msg no saved theme called {name} (see colorTheme.list) geen opgeslagen thema met de naam {name} (zie colorTheme.list) +@msg no saved views geen opgeslagen weergaven +@msg no selected or given object has a visible 3D effect geen enkel geselecteerd of opgegeven object heeft een zichtbaar 3D-effect +@msg no series {i} geen reeks {i} +@msg no slice {n} in the image (see slice.list) geen slice {n} in de afbeelding (zie slice.list) +@msg no source art geen bronillustratie +@msg no stop {i} (the gradient has {n}) geen stop {i} (het verloop heeft er {n}) +@msg no style `{name}` geen stijl `{name}` +@msg no such artboard {v} tekengebied {v} bestaat niet +@msg no such assets (see assets.list) deze assets bestaan niet (zie assets.list) +@msg no such frame anchor, or the frame would reach past the canvas dit kaderanker bestaat niet, of het kader zou voorbij het canvas reiken +@msg no such objects deze objecten bestaan niet +@msg no such path anchor, or the path would reach past the canvas dit padanker bestaat niet, of het pad zou voorbij het canvas reiken +@msg no such rows deze rijen bestaan niet +@msg no swatch `{keep}` geen staal `{keep}` +@msg no swatch `{n}` geen staal `{n}` +@msg no swatch `{n}` (swatches and colour groups move separately) geen staal `{n}` (stalen en kleurgroepen worden apart verplaatst) +@msg no swatch library `{key}` (see swatch.library.list) geen stalenbibliotheek `{key}` (zie swatch.library.list) +@msg no swatch library `{key}` (see swatch.library.list; "document": the document's swatches) geen stalenbibliotheek `{key}` (zie swatch.library.list; "document": de stalen van het document) +@msg no swatch library `{key}` (see swatch.library.list; "{DOCUMENT_SWATCHES}": the document's swatches) geen stalenbibliotheek `{key}` (zie swatch.library.list; "{DOCUMENT_SWATCHES}": de stalen van het document) +@msg no swatch named `{n}` geen staal met de naam `{n}` +@msg no swatch or colour group `{n}` geen staal of kleurgroep `{n}` +@msg no swatch or colour group `{n}` in `{_1}` geen staal of kleurgroep `{n}` in `{_1}` +@msg no symbol named `{_1}` geen symbool met de naam `{_1}` +@msg no symbol named `{name}` geen symbool met de naam `{name}` +@msg no text objects selected geen tekstobjecten geselecteerd +@msg no toolbar named `{_1}` geen werkbalk met de naam `{_1}` +@msg no toolbar named `{name}` geen werkbalk met de naam `{name}` +@msg no tracing preset `{preset}` (see imageTrace.presets) geen traceervoorinstelling `{preset}` (zie imageTrace.presets) +@msg no user library folder here (save with a path, or without one to get the data) hier is geen map voor gebruikersbibliotheken (sla op met een pad, of zonder pad om de gegevens te krijgen) +@msg no variable named `{from}` geen variabele met de naam `{from}` +@msg no variable named `{name}` geen variabele met de naam `{name}` +@msg no variable named `{var}` geen variabele met de naam `{var}` +@msg no variable named `{v}` geen variabele met de naam `{v}` +@msg no view named `{name}` geen weergave met de naam `{name}` +@msg node {_1} already has the text variable `{_2}` knooppunt {_1} heeft de tekstvariabele `{_2}` al +@msg node {_1} is not a graph knooppunt {_1} is geen grafiek +@msg node {_1} is not an image knooppunt {_1} is geen afbeelding +@msg node {_1} is not type knooppunt {_1} is geen tekst +@msg not a DCS file geen DCS-bestand +@msg not a PDF presets file (format `{_1}`) geen bestand met PDF-voorinstellingen (indeling `{_1}`) +@msg not a PDF presets file: {e} geen bestand met PDF-voorinstellingen: {e} +@msg not a RegExp object geen RegExp-object +@msg not a Word document: its WordDocument stream doesn't start with a file information block geen Word-document: de WordDocument-stroom ervan begint niet met een blok met bestandsinformatie +@msg not a Word document: its compound file has no WordDocument stream geen Word-document: het samengestelde bestand ervan heeft geen WordDocument-stroom +@msg not a Word document: its main part is not a WordprocessingML document geen Word-document: het hoofdonderdeel ervan is geen WordprocessingML-document +@msg not a Word document: its package has no main document part geen Word-document: het pakket ervan heeft geen hoofddocumentonderdeel +@msg not a closed path geen gesloten pad +@msg not a flattener presets file (format `{_1}`) geen bestand met afvlakkervoorinstellingen (indeling `{_1}`) +@msg not a flattener presets file: {e} geen bestand met afvlakkervoorinstellingen: {e} +@msg not a layer or group geen laag of groep +@msg not a library file: {e} geen bibliotheekbestand: {e} +@msg not a mesh envelope point geen punt van een netomvorming +@msg not a perspective grid presets file (format `{_1}`) geen bestand met voorinstellingen voor het perspectiefraster (indeling `{_1}`) +@msg not a perspective grid presets file: {e} geen bestand met voorinstellingen voor het perspectiefraster: {e} +@msg not a print presets file (format `{_1}`) geen bestand met afdrukvoorinstellingen (indeling `{_1}`) +@msg not a print presets file: {e} geen bestand met afdrukvoorinstellingen: {e} +@msg not a regular expression geen reguliere expressie +@msg not a stored or deflated central record geen opgeslagen of met deflate gecomprimeerd centraal record +@msg not a valid SVGZ file: {e} geen geldig SVGZ-bestand: {e} +@msg not an RTF file: it doesn't start with {\\rtf geen RTF-bestand: het begint niet met {\\rtf +@msg not an action set: the text doesn't start with /version and a number geen actieset: de tekst begint niet met /version en een getal +@msg not an image VectorCraft reads (see document.formats) geen afbeelding die VectorCraft leest (zie document.formats) +@msg not area type (text in a frame) outside perspective geen vlaktekst (tekst in een kader) buiten perspectief +@msg not editing an opacity mask er wordt geen dekkingmasker bewerkt +@msg not type on a path outside perspective geen tekst op een pad buiten perspectief +@msg nothing prints er wordt niets afgedrukt +@msg nothing to bind niets om te koppelen +@msg nothing to change niets om te wijzigen +@msg nothing to change: give dx, dy, hScale, vScale or rotation niets om te wijzigen: geef dx, dy, hScale, vScale of rotation +@msg nothing to crop niets om bij te snijden +@msg nothing to export niets om te exporteren +@msg nothing to export: the document has no visible art niets om te exporteren: het document heeft geen zichtbare illustraties +@msg nothing to mark niets om te markeren +@msg nothing to print: every artboard picked is blank niets om af te drukken: elk gekozen tekengebied is leeg +@msg nothing to print: the document has no art that prints niets om af te drukken: het document heeft geen illustraties die worden afgedrukt +@msg nothing to repeat niets om te herhalen +@msg numbers out of order in {_1} quantifier getallen in de verkeerde volgorde in kwantor {_1} +@msg object is not a path het object is geen pad +@msg object transparency cannot be sampled onto highlighted characters; disable Transparency in Eyedropper Options or select the whole object objecttransparantie kan niet op gemarkeerde tekens worden overgenomen; schakel Transparantie uit in Opties voor pipet of selecteer het hele object +@msg object {_1} can't be set as point type object {_1} kan niet als punttekst worden gezet +@msg object {_1} has lost its file's contents: relink it object {_1} is de inhoud van zijn bestand kwijt: koppel het opnieuw +@msg object {_1} has no path object {_1} heeft geen pad +@msg object {_1} has no size object {_1} heeft geen grootte +@msg object {_1} is hidden or locked, or on a locked artboard object {_1} is verborgen of vergrendeld, of staat op een vergrendeld tekengebied +@msg object {_1} is not a placed document object {_1} is geen geplaatst document +@msg object {_1} is not an Intertwine group object {_1} is geen groep Verstrengelen +@msg object {_1} is not an image object {_1} is geen afbeelding +@msg object {_1} is not an image or a linked file object {_1} is geen afbeelding of gekoppeld bestand +@msg object {_1} is not an image or a placed document object {_1} is geen afbeelding of geplaatst document +@msg object {_1} is not in this Intertwine group object {_1} zit niet in deze groep Verstrengelen +@msg object {_1} needs a 3D effect object {_1} heeft een 3D-effect nodig +@msg object {_1} needs a 3D effect at index {index} object {_1} heeft een 3D-effect op index {index} nodig +@msg object {_1}: a hollow Extrude & Bevel has no caps: turn on Cap to map a graphic object {_1}: een holle Extruderen en afschuinen heeft geen kappen: schakel Kap in om een afbeelding toe te wijzen +@msg object {_1}: with a depth of 0 the object has one face: map its graphics onto the front object {_1}: met een diepte van 0 heeft het object één vlak: wijs de afbeeldingen ervan toe aan de voorkant +@msg object {_1}: {_2} object {_1}: {_2} +@msg object {_1}: {e} object {_1}: {e} +@msg object {_1}: {name} at index {index} has no lighting presets; set its lights with effect.setParams object {_1}: {name} op index {index} heeft geen belichtingsvoorinstellingen; stel de lichten ervan in met effect.setParams +@msg object {id} has anchors 0–{_1} for `corners`, not {past} object {id} heeft de ankers 0–{_1} voor `corners`, niet {past} +@msg object {id} has {n} anchors, so no anchor {past} object {id} heeft {n} ankers, dus geen anker {past} +@msg objects must be none, move or copy objects moet none, move of copy zijn +@msg objects were left out er zijn objecten weggelaten +@msg offset out of range positie buiten het bereik +@msg on must be true or false on moet true of false zijn +@msg only groups, layers, type and images have a Contents (Characters) row alleen groepen, lagen, tekst en afbeeldingen hebben een rij Inhoud (Tekens) +@msg only interior mesh lines can be deleted alleen binnenste netlijnen kunnen worden verwijderd +@msg only solid colours can be added (not gradients or patterns) alleen effen kleuren kunnen worden toegevoegd (geen verlopen of patronen) +@msg only solid-colour swatches can be spot colours alleen stalen met een effen kleur kunnen steunkleuren zijn +@msg only this Affinity file's embedded preview could be read: use File › Open to see it with its warning, or export SVG or PDF from Affinity first alleen de ingesloten voorvertoning van dit Affinity-bestand kon worden gelezen: gebruik Bestand › Openen om die met de bijbehorende waarschuwing te bekijken, of exporteer eerst SVG of PDF vanuit Affinity +@msg only this Affinity file's embedded preview could be read; use File › Open to see it with its warning alleen de ingesloten voorvertoning van dit Affinity-bestand kon worden gelezen; gebruik Bestand › Openen om die met de bijbehorende waarschuwing te bekijken +@msg onto, above, below, icon and a column place belong to window.panel.float and window.panel.dock onto, above, below, icon en een kolomplaats horen bij window.panel.float en window.panel.dock +@msg onto, above, below, icon and a column place take no anchor, side, zone or before onto, above, below, icon en een kolomplaats accepteren geen anchor, side, zone of before +@msg onto, above, below, icon and a column place take no x, y, width or height onto, above, below, icon en een kolomplaats accepteren geen x, y, width of height +@msg opacity must be a number opacity moet een getal zijn +@msg open a document to look for its linked files open een document om de gekoppelde bestanden ervan te zoeken +@msg operand too large operand te groot +@msg options must be an object (see file.formatOptions) options moet een object zijn (zie file.formatOptions) +@msg order is a whole number from 0 to {others}, not `{v}` order is een geheel getal van 0 tot {others}, niet `{v}` +@msg order must be leftToRight or rightToLeft order moet leftToRight of rightToLeft zijn +@msg orientation must be portrait or landscape, not `{o}` orientation moet portrait of landscape zijn, niet `{o}` +@msg outlineText {v}: true or false outlineText {v}: true of false +@msg output intent profile: {e} profiel van de uitvoerintentie: {e} +@msg output.destination: no RGB or CMYK profile is called “{name}” output.destination: er is geen RGB- of CMYK-profiel met de naam „{name}” +@msg output.destination: {_1} files are CMYK, and “{name}” is an RGB profile output.destination: {_1}-bestanden zijn CMYK, en „{name}” is een RGB-profiel +@msg output.destination: {e} output.destination: {e} +@msg output.inks: no ink is set to print output.inks: er is geen inkt ingesteld om af te drukken +@msg output.outputIntent: no profile is called “{name}”, and a {std} output intent embeds its profile output.outputIntent: er is geen profiel met de naam „{name}”, en een uitvoerintentie voor {std} sluit haar profiel in +@msg output.outputIntent: no profile is called “{name}”: a {std} output intent embeds a profile, or names a registered printing condition (outputConditionId and registry) output.outputIntent: er is geen profiel met de naam „{name}”: een uitvoerintentie voor {std} sluit een profiel in, of noemt een geregistreerde drukconditie (outputConditionId en registry) +@msg output.outputIntent: {std} files print in CMYK, and “{name}” is an RGB profile output.outputIntent: {std}-bestanden worden in CMYK afgedrukt, en „{name}” is een RGB-profiel +@msg output.outputIntent: “{name}” is a grey profile, which can't be a {std} output intent output.outputIntent: „{name}” is een grijsprofiel, dat geen uitvoerintentie voor {std} kan zijn +@msg overlap: {o} pt is half a tile or more overlap: {o} pt is een halve tegel of meer +@msg overlapping Shaper paths must be in the same layer or group overlappende Shaper-paden moeten in dezelfde laag of groep staan +@msg overlapping edits overlappende bewerkingen +@msg page art conflicts with image data for {key} de pagina-illustratie is in strijd met de afbeeldingsgegevens voor {key} +@msg page art conflicts with pattern {name} de pagina-illustratie is in strijd met patroon {name} +@msg page art conflicts with swatch {name} de pagina-illustratie is in strijd met staal {name} +@msg page art is missing image data for {key} in de pagina-illustratie ontbreken afbeeldingsgegevens voor {key} +@msg page art is missing pattern {name} in de pagina-illustratie ontbreekt patroon {name} +@msg page art is missing swatch {name} in de pagina-illustratie ontbreekt staal {name} +@msg page must be a whole number from 1 page moet een geheel getal vanaf 1 zijn +@msg page thumbnail: {e} paginaminiatuur: {e} +@msg page {page} of the PDF has no objects pagina {page} van de PDF heeft geen objecten +@msg page {page}: `{file}` has {n} {artboards} pagina {page}: `{file}` heeft {n} {artboards} +@msg page {page}: `{name}` has {n} {pages} pagina {page}: `{name}` heeft {n} {pages} +@msg pages must be a range such as "2-3" or a page number, not {v} pages moet een bereik zoals "2-3" of een paginanummer zijn, niet {v} +@msg pages: {e} pagina’s: {e} +@msg panel position must be finite de paneelpositie moet eindig zijn +@msg parameters must be an object de parameters moeten een object zijn +@msg params must be an object params moet een object zijn +@msg passwords can have up to {MAX_PASSWORD} bytes wachtwoorden mogen maximaal {MAX_PASSWORD} bytes hebben +@msg path chunks must share their boundary point padstukken moeten hun grenspunt delen +@msg path has no open end het pad heeft geen open uiteinde +@msg paths must be strings paths moet uit strings bestaan +@msg pdfCompatible: false needs every artboard to keep the editable artwork pdfCompatible: false vereist dat elk tekengebied de bewerkbare illustratie behoudt +@msg pdfCompatible: false needs the artboards to keep the editable artwork when useArtboards is false pdfCompatible: false vereist dat de tekengebieden de bewerkbare illustratie behouden wanneer useArtboards false is +@msg pdfs `{m}`: single or multiple pdfs `{m}`: single of multiple +@msg pickColorFrom is "artwork" or "swatches", not {v} pickColorFrom is "artwork" of "swatches", niet {v} +@msg pins and moved must be non-empty lists of the same length pins en moved moeten niet-lege lijsten van dezelfde lengte zijn +@msg pins must be [[x,y]…] pins moet [[x,y]…] zijn +@msg pins must be finite pins moet eindig zijn +@msg place is above, below or inside, not `{other}` place is above, below of inside, niet `{other}` +@msg plane must be left|right|ground plane moet left|right|ground zijn +@msg plane must be left|right|ground|none plane moet left|right|ground|none zijn +@msg point is outside the mesh het punt ligt buiten het net +@msg point x must be a number x van het punt moet een getal zijn +@msg point y must be a number y van het punt moet een getal zijn +@msg points must be [t, left, right] with non-negative widths points moet uit [t, left, right] met niet-negatieve breedten bestaan +@msg points must be [x,y] pairs points moet uit paren [x,y] bestaan +@msg points must be a non-empty [[x,y,pressure?]…] list points moet een niet-lege lijst [[x,y,pressure?]…] zijn +@msg points must be a non-empty list of finite [x,y] points moet een niet-lege lijst van eindige [x,y] zijn +@msg points must be an array or null points moet een array of null zijn +@msg points must be finite points moet eindig zijn +@msg points must be finite [x,y] pairs points moet uit eindige paren [x,y] bestaan +@msg points must be finite canvas points points moet uit eindige canvaspunten bestaan +@msg points must contain 1–4096 coordinates points moet 1–4096 coördinaten bevatten +@msg position must be normal, superscript or subscript position moet normal, superscript of subscript zijn +@msg position must be topLeft, topRight, bottomLeft or bottomRight position moet topLeft, topRight, bottomLeft of bottomRight zijn +@msg positions must be between 0 and 100000 pt positions moeten tussen 0 en 100000 pt liggen +@msg ppi must be a positive number, not {ppi} ppi moet een positief getal zijn, niet {ppi} +@msg ppi must be between 1 and 2400 ppi moet tussen 1 en 2400 liggen +@msg preserve `{v}` is not transforms|bounds|fileDimensions|fit|fill preserve `{v}` is niet transforms|bounds|fileDimensions|fit|fill +@msg preserveShape must be clippingMask|transparency preserveShape moet clippingMask|transparency zijn +@msg preset `{id}`: mobile or density preset `{id}`: mobile of density +@msg preset must be standard, diffuse, topLeft or right preset moet standard, diffuse, topLeft of right zijn +@msg preset must be the name of a print preset preset moet de naam van een afdrukvoorinstelling zijn +@msg previewMode must be default, pixel or overprint previewMode moet default, pixel of overprint zijn +@msg print settings: {e} afdrukinstellingen: {e} +@msg procedures nest too deeply procedures zijn te diep genest +@msg procedures nested too deeply procedures te diep genest +@msg quotes must be {double?, single?} quotes moet {double?, single?} zijn +@msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k} moet een openend en een sluitend aanhalingsteken zijn, bijv. "“”" +@msg range out of order in character class bereik in de verkeerde volgorde in tekenklasse +@msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi moet 1–2400 zijn (72 scherm, 150 gemiddeld, 300 hoog) +@msg rating must be a whole number from 0 to {MAX_RATING} rating moet een geheel getal van 0 tot {MAX_RATING} zijn +@msg rect and {k} contradict each other: give the area or the artboards rect en {k} spreken elkaar tegen: geef het gebied of de tekengebieden +@msg rect applies to raster formats, not {_1} rect geldt voor rasterindelingen, niet voor {_1} +@msg rect is [x, y, width, height] in points rect is [x, y, width, height] in punten +@msg rect must be [x, y, width, height] rect moet [x, y, width, height] zijn +@msg rect must be [x, y, width, height] with a positive width and height rect moet [x, y, width, height] met een positieve breedte en hoogte zijn +@msg rect needs finite numbers and a positive width and height rect heeft eindige getallen en een positieve breedte en hoogte nodig +@msg redraw needs id redraw heeft id nodig +@msg redraw within must be a finite distance of 0 or more within van redraw moet een eindige afstand van 0 of meer zijn +@msg reduce of an empty array with no initial value reduce van een lege array zonder beginwaarde +@msg registration must be 0..8 registration moet 0..8 zijn +@msg regular expression flag '{_1}' given twice vlag '{_1}' voor reguliere expressie twee keer opgegeven +@msg release a layer or a group geef een laag of een groep vrij +@msg replace keeps the replaced object's place and transform: drop template, at and rect replace behoudt de plaats en de transformatie van het vervangen object: laat template, at en rect weg +@msg replace: select the one object to replace replace: selecteer het ene object dat moet worden vervangen +@msg resolution must be a number or screen|medium|high resolution moet een getal of screen|medium|high zijn +@msg resolution must be between 1 and 2400 ppi resolution moet tussen 1 en 2400 ppi liggen +@msg rotation must be a number of degrees rotation moet een aantal graden zijn +@msg rotation must be finite rotation moet eindig zijn +@msg rows and cols must be 1..50 rows en cols moeten 1..50 zijn +@msg rows and columns must be 1..500 rows en columns moeten 1..500 zijn +@msg rows of objects whose appearances differ can't be reordered together rijen van objecten met een verschillende vormgeving kunnen niet samen opnieuw worden geordend +@msg sampled text would exceed the canvas (coordinates out of range) de overgenomen tekst zou buiten het canvas vallen (coördinaten buiten het bereik) +@msg save the document first: Package collects a saved document sla het document eerst op: Verpakken verzamelt een opgeslagen document +@msg save the document first: copy puts the file in its folder sla het document eerst op: copy plaatst het bestand in de map ervan +@msg savedPreset: {e} savedPreset: {e} +@msg scale `{s}`: a factor such as 2x, a width (100w), a height (100h) or a resolution (72ppi) scale `{s}`: een factor zoals 2x, een breedte (100w), een hoogte (100h) of een resolutie (72ppi) +@msg scale must be a number above 0, at most 64 scale moet een getal boven 0 zijn, maximaal 64 +@msg scale must be non-zero scale mag niet nul zijn +@msg scope must be selection or all (got {other}) scope moet selection of all zijn (kreeg {other}) +@msg scribble is too long de krabbel is te lang +@msg segment does not exist het segment bestaat niet +@msg select a Shaper group selecteer een Shaper-groep +@msg select a blend to set easing or color shift selecteer een mengsel om de versnelling of de kleurverschuiving in te stellen +@msg select a compound shape selecteer een samengestelde vorm +@msg select a graph selecteer een grafiek +@msg select a group or layer with visible, unlocked members selecteer een groep of laag met zichtbare, ontgrendelde leden +@msg select a layer selecteer een laag +@msg select a text object selecteer een tekstobject +@msg select an SVG filter selecteer een SVG-filter +@msg select an image (or an Image Trace group) selecteer een afbeelding (of een groep Afbeelding traceren) +@msg select an image, or pass id selecteer een afbeelding, of geef id op +@msg select an object (or pass `id`) selecteer een object (of geef `id` op) +@msg select an object with a 3D effect selecteer een object met een 3D-effect +@msg select an object with a 3D effect, or give its id in ids selecteer een object met een 3D-effect, of geef de id ervan in ids +@msg select an object with a freeform gradient selecteer een object met een verloop in vrije vorm +@msg select an object with an opacity mask selecteer een object met een dekkingmasker +@msg select area type selecteer vlaktekst +@msg select area type (text in a frame) selecteer vlaktekst (tekst in een kader) +@msg select area type and closed paths (at least one area type object) selecteer vlaktekst en gesloten paden (minstens één vlaktekstobject) +@msg select area type whose first line can fit its frame selecteer vlaktekst waarvan de eerste regel in het kader past +@msg select artwork to add its colours selecteer illustraties om de kleuren ervan toe te voegen +@msg select artwork to make a group of its colours selecteer illustraties om een groep van de kleuren ervan te maken +@msg select artwork to recolour, or give a colour `group` selecteer illustraties om te herkleuren, of geef een `group` met kleuren +@msg select exactly two path ends to join selecteer precies twee paduiteinden om te verbinden +@msg select members of a compound shape selecteer leden van een samengestelde vorm +@msg select objects or give ids selecteer objecten of geef ids +@msg select objects to align to the guide selecteer objecten om op de hulplijn uit te lijnen +@msg select one Intertwine group selecteer één groep Verstrengelen +@msg select one image or pass id selecteer één afbeelding of geef id op +@msg select one layer, group or object to rename selecteer één laag, groep of object om te hernoemen +@msg select paths selecteer paden +@msg select paths or compound paths selecteer paden of samengestelde paden +@msg select rows or objects to collect selecteer rijen of objecten om te verzamelen +@msg select something to export selecteer iets om te exporteren +@msg select something to export (or turn off selectedOnly) selecteer iets om te exporteren (of schakel selectedOnly uit) +@msg select text to redefine the style from selecteer tekst om de stijl mee opnieuw te definiëren +@msg select the art and, on top of it, the mask object selecteer de illustratie en, daarbovenop, het maskerobject +@msg select the art for the design selecteer de illustratie voor het ontwerp +@msg select the art for the pattern tile selecteer de illustratie voor de patroontegel +@msg select the art to add first selecteer eerst de illustratie die moet worden toegevoegd +@msg select the art to collect (or give its ids) selecteer de illustratie die moet worden verzameld (of geef de id’s ervan) +@msg select the art to weed selecteer de illustratie die moet worden gewied +@msg select the banner, or mark every artboard selecteer de banner, of markeer elk tekengebied +@msg select the content and a path on top selecteer de inhoud en een pad erbovenop +@msg select the images to relink, or pass ids selecteer de afbeeldingen die opnieuw moeten worden gekoppeld, of geef ids op +@msg select the images, or pass ids selecteer de afbeeldingen, of geef ids op +@msg select the linked images or placed documents, or pass ids selecteer de gekoppelde afbeeldingen of geplaatste documenten, of geef ids op +@msg select the object to copy from selecteer het object waarvan moet worden gekopieerd +@msg select the objects (or give their ids) selecteer de objecten (of geef de id’s ervan) +@msg select the objects to attach to the path selecteer de objecten die aan het pad moeten worden gekoppeld +@msg select the objects to bind selecteer de objecten die moeten worden gekoppeld +@msg select two or more objects to intertwine selecteer twee of meer objecten om te verstrengelen +@msg select two or more slices to combine selecteer twee of meer slices om te combineren +@msg select type on a path selecteer tekst op een pad +@msg select type on a path or area type selecteer tekst op een pad of vlaktekst +@msg selection `{m}`: one or each selection `{m}`: one of each +@msg settings is an object of document.exportForScreens params settings is een object met parameters van document.exportForScreens +@msg settings must be an object settings moet een object zijn +@msg show `{show}`: all, missing, modified or embedded show `{show}`: all, missing, modified of embedded +@msg show must be true or false show moet true of false zijn +@msg side is left or right, not `{v}` side is left of right, niet `{v}` +@msg size must be "small", "medium", "large" or a number of points over 0 up to {_1} size moet "small", "medium", "large" of een aantal punten boven 0 tot en met {_1} zijn +@msg size must be positive size moet positief zijn +@msg sizeMode is "fixed" or "pressure", not `{other}` sizeMode is "fixed" of "pressure", niet `{other}` +@msg sizeMode is "fixed" or "pressure", not {other} sizeMode is "fixed" of "pressure", niet {other} +@msg sizeVariation must be 0 or more sizeVariation moet 0 of meer zijn +@msg smallCaps must be true or false smallCaps moet true of false zijn +@msg sort `{x}`: name, kind or status sort `{x}`: name, kind of status +@msg source paths are too large for Shaper de bronpaden zijn te groot voor Shaper +@msg source text transform is collapsed or unrepresentable de teksttransformatie van de bron is samengevallen of kan niet worden weergegeven +@msg spot, mode and group apply to solid colours only spot, mode en group gelden alleen voor effen kleuren +@msg status `{s}`: linked, embedded, missing or modified status `{s}`: linked, embedded, missing of modified +@msg steps must be 1..1000 steps moet 1..1000 zijn +@msg steps must be 1..{MAX_STEPS} steps moet 1..{MAX_STEPS} zijn +@msg stop {i}: `plates` must be four numbers from 0 to 1 (C, M, Y, K) stop {i}: `plates` moet uit vier getallen van 0 tot 1 bestaan (C, M, Y, K) +@msg stopped before the archive was finished gestopt voordat het archief klaar was +@msg strokeMode must be within|along|across, got {m} strokeMode moet within|along|across zijn, kreeg {m} +@msg strokeOptions must be an object of stroke.set options strokeOptions moet een object met opties van stroke.set zijn +@msg strokeWidth must be a positive number of pixels strokeWidth moet een positief aantal pixels zijn +@msg subpath {si} is not an open subpath subpad {si} is geen open subpad +@msg subpaths required when joining the same path subpaths is vereist bij het verbinden van hetzelfde pad +@msg swatchConflict must be "merge" or "add", not {v} swatchConflict moet "merge" of "add" zijn, niet {v} +@msg table must be true or false table moet true of false zijn +@msg takes one name accepteert één naam +@msg target text transform is collapsed or unrepresentable de teksttransformatie van het doel is samengevallen of kan niet worden weergegeven +@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text moet {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} zijn +@msg text transform is collapsed or unrepresentable de teksttransformatie is samengevallen of kan niet worden weergegeven +@msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces moet een geheel getal van 2 tot 100 zijn +@msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}`: gebruik "{_1}" of "{_2}" +@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage: geef {path} of {name, dataBase64} van een afbeeldingsbestand, of een textuur zoals effect.list die geeft +@msg textureImage: {e} textureImage: {e} +@msg that makes more than {MAX_PIECES} slices dat levert meer dan {MAX_PIECES} slices op +@msg that makes too many pieces (at most 100000) or dash steps: simplify the dash pattern or make the dashes longer dat levert te veel stukken (maximaal 100000) of streepstappen op: vereenvoudig het streeppatroon of maak de strepen langer +@msg that object is not in the overlap dat object ligt niet in de overlapping +@msg the Affinity document has no page with a size het Affinity-document heeft geen pagina met een grootte +@msg the CMYK image couldn't be written de CMYK-afbeelding kon niet worden geschreven +@msg the Layers panel is not shown het paneel Lagen wordt niet getoond +@msg the Layers panel's search, filter or Show Layers Only hides its row de zoekopdracht, het filter of Alleen lagen weergeven van het paneel Lagen verbergt de rij ervan +@msg the Objects on Path group is hidden or locked de groep Objecten op pad is verborgen of vergrendeld +@msg the PDF security settings were saved without their passwords: give openPassword or permissionsPassword again, or security without passwordRequired to export unprotected de PDF-beveiligingsinstellingen zijn zonder hun wachtwoorden opgeslagen: geef openPassword of permissionsPassword opnieuw, of security zonder passwordRequired om onbeveiligd te exporteren +@msg the RTF file has too many paragraphs or formatting changes to place as type (at most {MAX_PARAGRAPHS} paragraphs and {MAX_RUNS} runs) het RTF-bestand heeft te veel alinea’s of opmaakwijzigingen om als tekst te plaatsen (maximaal {MAX_PARAGRAPHS} alinea’s en {MAX_RUNS} runs) +@msg the RTF file is too large to place as type (at most {_1} MB) het RTF-bestand is te groot om als tekst te plaatsen (maximaal {_1} MB) +@msg the SVG expands to more than {0} nested SVG images de SVG wordt uitgevouwen tot meer dan {0} geneste SVG-afbeeldingen +@msg the SVG expands to more than {0} objects de SVG wordt uitgevouwen tot meer dan {0} objecten +@msg the SVG file is larger than {MAX_IMPORT_BYTES} bytes het SVG-bestand is groter dan {MAX_IMPORT_BYTES} bytes +@msg the SVG has no drawable objects de SVG heeft geen tekenbare objecten +@msg the SVGZ file unpacks to more than {_1} MB het SVGZ-bestand wordt uitgepakt tot meer dan {_1} MB +@msg the Word document has more than {MAX_PAGES} pages of properties, too many to place het Word-document heeft meer dan {MAX_PAGES} pagina’s met eigenschappen, te veel om te plaatsen +@msg the Word document has more than {MAX_RUNS} runs of character or paragraph properties, too many to place het Word-document heeft meer dan {MAX_RUNS} runs met teken- of alinea-eigenschappen, te veel om te plaatsen +@msg the Word document has more than {_1} MB of formatting properties, too many to place het Word-document heeft meer dan {_1} MB aan opmaakeigenschappen, te veel om te plaatsen +@msg the Word document has too much text or formatting to place as type (at most {MAX_PARAGRAPHS} paragraphs, {MAX_RUNS} runs and {_1} MB of text) het Word-document heeft te veel tekst of opmaak om als tekst te plaatsen (maximaal {MAX_PARAGRAPHS} alinea’s, {MAX_RUNS} runs en {_1} MB tekst) +@msg the Word document has too much text to place as type (at most {_1} MB) het Word-document heeft te veel tekst om als tekst te plaatsen (maximaal {_1} MB) +@msg the Word document is encrypted or protected with a password; save it without one to place it het Word-document is versleuteld of met een wachtwoord beveiligd; sla het zonder wachtwoord op om het te plaatsen +@msg the Word document is too large to place (its {name} stream holds more than {_1} MB) het Word-document is te groot om te plaatsen (de stroom {name} ervan bevat meer dan {_1} MB) +@msg the Word document was last saved with fast save, which VectorCraft doesn't read; save it again with fast save turned off het Word-document is het laatst opgeslagen met snel opslaan, wat VectorCraft niet leest; sla het opnieuw op met snel opslaan uitgeschakeld +@msg the Word document was saved by Word 6.0 or Word 95, which VectorCraft doesn't read; save it as a Word 97-2003 document het Word-document is opgeslagen door Word 6.0 of Word 95, wat VectorCraft niet leest; sla het op als een Word 97-2003-document +@msg the Word document's text is made of more than {MAX_PIECES} pieces, too many to place de tekst van het Word-document bestaat uit meer dan {MAX_PIECES} stukken, te veel om te plaatsen +@msg the XML operation needs an XML or XMLList value de XML-bewerking heeft een XML- of XMLList-waarde nodig +@msg the XPath expression does not evaluate to a node-set de XPath-expressie levert geen knooppuntenset op +@msg the XPath expression ends early de XPath-expressie eindigt te vroeg +@msg the XPath expression has an unmatched ) de XPath-expressie heeft een ) zonder tegenhanger +@msg the XPath expression has an unmatched ] de XPath-expressie heeft een ] zonder tegenhanger +@msg the XPath expression has an unmatched closing bracket de XPath-expressie heeft een sluithaakje zonder tegenhanger +@msg the XPath expression selects a namespace node, which is not an XML value de XPath-expressie selecteert een naamruimteknooppunt, en dat is geen XML-waarde +@msg the XPath expression selects the root node, which is not an XML value de XPath-expressie selecteert het hoofdknooppunt, en dat is geen XML-waarde +@msg the XPath function {name} needs a node-set de XPath-functie {name} heeft een knooppuntenset nodig +@msg the XPath function {name} takes the wrong number of arguments de XPath-functie {name} krijgt het verkeerde aantal argumenten +@msg the XPath name functions need a node-set de XPath-naamfuncties hebben een knooppuntenset nodig +@msg the XPath prefix {shown} is not bound to a namespace het XPath-voorvoegsel {shown} is niet aan een naamruimte gebonden +@msg the XPath variable ${shown} is not bound de XPath-variabele ${shown} is niet gebonden +@msg the action set ids are not a list de id’s van de actieset zijn geen lijst +@msg the active paint is not a gradient de actieve verf is geen verloop +@msg the argument list is not an object de argumentenlijst is geen object +@msg the art of a graph design in a graph series is drawn again from the design: edit the design to change it de illustratie van een grafiekontwerp in een grafiekreeks wordt opnieuw vanuit het ontwerp getekend: bewerk het ontwerp om het te wijzigen +@msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size de tekengebieden passen niet op het canvas: minder tekengebieden, minder tussenruimte of een kleinere grootte +@msg the artwork is too large for EPS: what follows 256 MB of PostScript was left out de illustratie is te groot voor EPS: wat na 256 MB PostScript komt, is weggelaten +@msg the banner has no width or height de banner heeft geen breedte of hoogte +@msg the bitmaps hold more pixels than one file may de bitmaps bevatten meer pixels dan één bestand mag bevatten +@msg the character's size can't be measured de grootte van het teken kan niet worden gemeten +@msg the code runs past its last instruction de code loopt voorbij de laatste instructie +@msg the compound shape is too complex to expand de samengestelde vorm is te complex om uit te breiden +@msg the container of the listed objects is gone de container van de vermelde objecten is verdwenen +@msg the copy `{user_id}` can't be read as a library de kopie `{user_id}` kan niet als bibliotheek worden gelezen +@msg the copy would leave the canvas de kopie zou buiten het canvas vallen +@msg the curve tolerance must be from 0.01 to 10 points de curvetolerantie moet van 0,01 tot 10 punten zijn +@msg the custom dictionary couldn't be saved to {_1}: {e} het aangepaste woordenboek kon niet worden opgeslagen in {_1}: {e} +@msg the custom dictionary {_1} can't be read ({why}), so it is left as it is het aangepaste woordenboek {_1} kan niet worden gelezen ({why}), dus blijft het zoals het is +@msg the cut cannot be made on this art: {e} de snede kan niet in deze illustratie worden gemaakt: {e} +@msg the data isn't an EMF or WMF picture de gegevens zijn geen EMF- of WMF-afbeelding +@msg the data isn't an EPS or PostScript picture de gegevens zijn geen EPS- of PostScript-afbeelding +@msg the deferred paste is no longer available het uitgestelde plakken is niet meer beschikbaar +@msg the design is too big to draw at every data point of this graph het ontwerp is te groot om bij elk gegevenspunt van deze grafiek te tekenen +@msg the design is too big to draw in every column of this graph het ontwerp is te groot om in elke kolom van deze grafiek te tekenen +@msg the dialog it was opened over is no longer open het dialoogvenster waarboven het is geopend, is niet meer geopend +@msg the dictionary stack overflowed de woordenboekstack is overgelopen +@msg the document already has an SVG filter named {name} het document heeft al een SVG-filter met de naam {name} +@msg the document has another SVG filter named {name}: use svgFilter.apply, or svgFilter.define with `replace` to edit it het document heeft een ander SVG-filter met de naam {name}: gebruik svgFilter.apply, of svgFilter.define met `replace` om het te bewerken +@msg the document has no SVG filter named {name} het document heeft geen SVG-filter met de naam {name} +@msg the document has no SVG filter named {r} het document heeft geen SVG-filter met de naam {r} +@msg the document has no color swatches het document heeft geen kleurstalen +@msg the document's swatches hold {_1} colors; the document reduction takes at most 255 de stalen van het document bevatten {_1} kleuren; de documentreductie accepteert er maximaal 255 +@msg the editing data's hash has no place de hash van de bewerkingsgegevens heeft geen plaats +@msg the entities the document declares expand to too much text de entiteiten die het document declareert, worden tot te veel tekst uitgevouwen +@msg the envelope's content has no bounds de inhoud van de omvorming heeft geen grenzen +@msg the envelope's mesh is malformed het net van de omvorming is misvormd +@msg the file holds no `variableSets` element het bestand bevat geen element `variableSets` +@msg the file is larger than {_1} MB het bestand is groter dan {_1} MB +@msg the file is too large het bestand is te groot +@msg the file isn't valid SVG: {e} het bestand is geen geldige SVG: {e} +@msg the file names no plate het bestand noemt geen plaat +@msg the file was updated or encrypted already het bestand is al bijgewerkt of versleuteld +@msg the first character of a line has no character before it to kern: it moves only up and down (dy) het eerste teken van een regel heeft geen teken ervoor om mee te kernen: het beweegt alleen omhoog en omlaag (dy) +@msg the font {_1} is not available het lettertype {_1} is niet beschikbaar +@msg the format has no file extension de indeling heeft geen bestandsextensie +@msg the function's prototype is not an object het prototype van de functie is geen object +@msg the graphic can't be read: {e} de afbeelding kan niet worden gelezen: {e} +@msg the graphic is empty de afbeelding is leeg +@msg the graphic's data is damaged de gegevens van de afbeelding zijn beschadigd +@msg the graphic's document has no artboard het document van de afbeelding heeft geen tekengebied +@msg the grommet inset is too large for the banner de afstand van de zeilringen tot de rand is te groot voor de banner +@msg the guide is hidden or locked de hulplijn is verborgen of vergrendeld +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them de koptekst `{cell}` voor `{name}` zou worden teruggelezen als de variabele `{other}`: geef een van beide een andere naam +@msg the hem is too deep for the banner de zoom is te diep voor de banner +@msg the image `{path}` isn't followed: {r} de afbeelding `{path}` wordt niet gevolgd: {r} +@msg the image has no embedded pixels de afbeelding heeft geen ingesloten pixels +@msg the image is empty de afbeelding is leeg +@msg the image is fully transparent de afbeelding is volledig transparant +@msg the image is not on an artboard; pass rect de afbeelding staat niet op een tekengebied; geef rect op +@msg the image's pixels are missing de pixels van de afbeelding ontbreken +@msg the image's pixels aren't in the document de pixels van de afbeelding staan niet in het document +@msg the image's pixels can't be read: {e} de pixels van de afbeelding kunnen niet worden gelezen: {e} +@msg the image's transparency doesn't fit it de transparantie van de afbeelding past er niet bij +@msg the job would print more than {MAX_PAGES} pages de taak zou meer dan {MAX_PAGES} pagina’s afdrukken +@msg the job would print more than {_1} pages de taak zou meer dan {_1} pagina’s afdrukken +@msg the layers hold no art to mask de lagen bevatten geen illustratie om te maskeren +@msg the layout moved de indeling is verplaatst +@msg the library has a group `{name}` already de bibliotheek heeft al een groep `{name}` +@msg the library has no group `{name}` de bibliotheek heeft geen groep `{name}` +@msg the library has no item `{item}` de bibliotheek heeft geen item `{item}` +@msg the library has no item `{other}` de bibliotheek heeft geen item `{other}` +@msg the library holds {MAX_GROUPS} groups already de bibliotheek bevat al {MAX_GROUPS} groepen +@msg the library holds {MAX_ITEMS} items of this kind already de bibliotheek bevat al {MAX_ITEMS} items van dit soort +@msg the library's file is outside the read roots het bestand van de bibliotheek staat buiten de leesroots +@msg the line is too long, or the paths it passes too many, to check de lijn is te lang, of de paden die hij passeert zijn te talrijk, om te controleren +@msg the method needs an XML value de methode heeft een XML-waarde nodig +@msg the name is empty de naam is leeg +@msg the object has no fill, stroke or effect het object heeft geen vulling, contour of effect +@msg the object has no graphic style (pass `name`) het object heeft geen grafische stijl (geef `name` op) +@msg the objects don't match the plan de objecten komen niet overeen met het plan +@msg the open and permissions passwords must differ het wachtwoord voor openen en het wachtwoord voor machtigingen moeten verschillen +@msg the operand stack overflowed de operandstack is overgelopen +@msg the page has no area de pagina heeft geen oppervlak +@msg the page's type in an unread object's box isn't in its page art de tekst van de pagina in het kader van een ongelezen object zit niet in de pagina-illustratie ervan +@msg the paint behind the proxy is not a gradient de verf achter de proxy is geen verloop +@msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) de verf is geen verloop in vrije vorm (pas er een toe met paint.editGradient {kind}) +@msg the parameters or body do not form one function de parameters of de body vormen niet één functie +@msg the parent must be a layer or sublayer het bovenliggende item moet een laag of sublaag zijn +@msg the pasted SVG filter {name} draws differently from the document's filter of that name, and no free name fits it het geplakte SVG-filter {name} tekent anders dan het filter met die naam in het document, en er is geen vrije naam die past +@msg the path can't be extended het pad kan niet worden verlengd +@msg the path can't be inside one of the objects to attach het pad kan niet in een van de te koppelen objecten zitten +@msg the path has no segments to measure het pad heeft geen segmenten om te meten +@msg the path is empty het pad is leeg +@msg the path is too short to shorten that much het pad is te kort om zoveel in te korten +@msg the paths are too many or too tangled to find where they cross de paden zijn te talrijk of te verward om te vinden waar ze elkaar kruisen +@msg the pen table holds more than 255 pens de pennentabel bevat meer dan 255 pennen +@msg the picture has no objects de afbeelding heeft geen objecten +@msg the plates can't be kept de platen kunnen niet worden behouden +@msg the position table does not match the instructions de positietabel komt niet overeen met de instructies +@msg the program runs too long het programma loopt te lang +@msg the program uses too much memory het programma gebruikt te veel geheugen +@msg the prompt's text is longer than {MAX_PROMPT_BYTES} bytes de tekst van de prompt is langer dan {MAX_PROMPT_BYTES} bytes +@msg the radix must be between 2 and 36 het grondtal moet tussen 2 en 36 liggen +@msg the rectangle must have a width and a height de rechthoek moet een breedte en een hoogte hebben +@msg the rectangle needs a size and must lie on the canvas de rechthoek heeft een grootte nodig en moet op het canvas liggen +@msg the rectangle or line reaches too many paths to check de rechthoek of lijn raakt te veel paden om te controleren +@msg the right side of 'in' is not an object de rechterkant van 'in' is geen object +@msg the right side of 'instanceof' is not a function de rechterkant van 'instanceof' is geen functie +@msg the selected art has no width de geselecteerde illustratie heeft geen breedte +@msg the selected art is nested more than {MAX_DEPTH} levels deep de geselecteerde illustratie is meer dan {MAX_DEPTH} niveaus diep genest +@msg the selected art is too large to measure de geselecteerde illustratie is te groot om te meten +@msg the selection draws nothing de selectie tekent niets +@msg the selection has no area de selectie heeft geen oppervlakte +@msg the selection has no art to export de selectie heeft geen illustratie om te exporteren +@msg the selection has no bounds de selectie heeft geen grenzen +@msg the selection has no graphic style de selectie heeft geen grafische stijl +@msg the selection has no outlines to weed around de selectie heeft geen omtrekken om omheen te wieden +@msg the slice would leave the canvas de slice zou buiten het canvas vallen +@msg the spacing makes more than {MAX_GROMMETS} grommets de tussenruimte levert meer dan {MAX_GROMMETS} zeilringen op +@msg the spot colour couldn't be added de steunkleur kon niet worden toegevoegd +@msg the subpath has no ends to extend (it is closed or a single point) het subpad heeft geen uiteinden om te verlengen (het is gesloten of een enkel punt) +@msg the symbols are nested too deeply to expand their instances de symbolen zijn te diep genest om hun instanties uit te breiden +@msg the text file is too large to place as type (at most {_1} MB) het tekstbestand is te groot om als tekst te plaatsen (maximaal {_1} MB) +@msg the text is empty de tekst is leeg +@msg the text is over {_1} MB de tekst is groter dan {_1} MB +@msg the top object must be a path het bovenste object moet een pad zijn +@msg the trace was cancelled de tracering is geannuleerd +@msg the trailer has no size de trailer heeft geen grootte +@msg the type object is flattened to nothing het tekstobject is tot niets afgevlakt +@msg the value bind was called on is not a function de waarde waarop bind is aangeroepen, is geen functie +@msg the value is not a constructor de waarde is geen constructor +@msg the value is not a function de waarde is geen functie +@msg the value is not a valid XML name de waarde is geen geldige XML-naam +@msg the value is not an XML attribute name de waarde is geen XML-attribuutnaam +@msg the value is not an XML name de waarde is geen XML-naam +@msg the value of axis `{tag}` must be a number or null de waarde van as `{tag}` moet een getal of null zijn +@msg the variable library declares more than {MAX_LIBRARY_DATASETS} data sets de variabelenbibliotheek declareert meer dan {MAX_LIBRARY_DATASETS} gegevenssets +@msg the variable library declares more than {MAX_LIBRARY_ENTITIES} entities de variabelenbibliotheek declareert meer dan {MAX_LIBRARY_ENTITIES} entiteiten +@msg the variable library declares more than {MAX_LIBRARY_VARIABLES} variables de variabelenbibliotheek declareert meer dan {MAX_LIBRARY_VARIABLES} variabelen +@msg the variable library declares no variables de variabelenbibliotheek declareert geen variabelen +@msg the variable library is larger than {MAX_LIBRARY_BYTES} bytes de variabelenbibliotheek is groter dan {MAX_LIBRARY_BYTES} bytes +@msg the variable library is not UTF-8 de variabelenbibliotheek is geen UTF-8 +@msg the variable library is not well-formed XML: {e} de variabelenbibliotheek is geen welgevormde XML: {e} +@msg the variable library nests elements more than {MAX_LIBRARY_NESTING} deep de variabelenbibliotheek nest elementen meer dan {MAX_LIBRARY_NESTING} niveaus diep +@msg the variable library's document type declaration holds something other than entities of plain text de documenttypedeclaratie van de variabelenbibliotheek bevat iets anders dan entiteiten van platte tekst +@msg the variable library's entities expand to more than {MAX_LIBRARY_BYTES} bytes de entiteiten van de variabelenbibliotheek worden tot meer dan {MAX_LIBRARY_BYTES} bytes uitgevouwen +@msg the weeding lines cross the art's outlines too many times to measure; use fewer lines de wiedlijnen kruisen de omtrekken van de illustratie te vaak om te meten; gebruik minder lijnen +@msg the weeding lines pass too close to too many outline segments to measure; use fewer lines or a smaller gap de wiedlijnen lopen te dicht langs te veel omtreksegmenten om te meten; gebruik minder lijnen of een kleinere tussenruimte +@msg the weeding lines would be more than {max_pieces} pieces de wiedlijnen zouden uit meer dan {max_pieces} stukken bestaan +@msg the window has no dock het venster heeft geen dock +@msg the written PDF has no catalog de geschreven PDF heeft geen catalogus +@msg the written PDF has no cross-reference table de geschreven PDF heeft geen kruisverwijzingstabel +@msg the written PDF's metadata can't be edited de metagegevens van de geschreven PDF kunnen niet worden bewerkt +@msg the {_1} plate lies outside the file de plaat {_1} ligt buiten het bestand +@msg there are no colour swatches to draw er zijn geen kleurstalen om te tekenen +@msg there is already a design named `{name}` er is al een ontwerp met de naam `{name}` +@msg there is already a design named `{to}` er is al een ontwerp met de naam `{to}` +@msg there is already a toolbar named `{name}` er is al een werkbalk met de naam `{name}` +@msg there is already a toolbar named `{to}` er is al een werkbalk met de naam `{to}` +@msg there is no banner to mark er is geen banner om te markeren +@msg there is no library: create one first er is geen bibliotheek: maak er eerst een +@msg these paths are too degenerate for Shaper deze paden zijn te gedegenereerd voor Shaper +@msg this is a binary DXF file, which can't be read: save it from the CAD app as an ASCII DXF and open that dit is een binair DXF-bestand, dat niet kan worden gelezen: sla het vanuit de CAD-app op als ASCII-DXF en open dat bestand +@msg this warp's points can't be edited: use Reset with Mesh first de punten van deze verdraaiing kunnen niet worden bewerkt: gebruik eerst Herstellen met mesh +@msg thumbnail: no page {v} (the {what} has {count}) miniatuur: geen pagina {v} ({what} heeft er {count}) +@msg tileRange of {what}: {e} tileRange van {what}: {e} +@msg title can't be empty title mag niet leeg zijn +@msg to (the new name) is required to (de nieuwe naam) is vereist +@msg to must be fill or stroke to moet fill of stroke zijn +@msg to must be smooth or corner to moet smooth of corner zijn +@msg toExponential() digits must be between 0 and 20 het aantal cijfers van toExponential() moet tussen 0 en 20 liggen +@msg toFixed() digits must be between 0 and 20 het aantal cijfers van toFixed() moet tussen 0 en 20 liggen +@msg toISOString is not a function toISOString is geen functie +@msg toPrecision() argument must be between 1 and 21 het argument van toPrecision() moet tussen 1 en 21 liggen +@msg toSource: a getter cannot be written as source toSource: een getter kan niet als broncode worden geschreven +@msg toSource: an array with properties besides its elements, a property that is not enumerable or another prototype cannot be written as source toSource: een array met eigenschappen naast zijn elementen, een niet-opsombare eigenschap of een ander prototype kan niet als broncode worden geschreven +@msg toSource: an object with a property that is not enumerable, or whose prototype is not Object.prototype, cannot be written as source toSource: een object met een niet-opsombare eigenschap, of waarvan het prototype niet Object.prototype is, kan niet als broncode worden geschreven +@msg toSource: the source is too long toSource: de broncode is te lang +@msg toSource: the value contains itself toSource: de waarde bevat zichzelf +@msg toSource: the value has too many entries toSource: de waarde heeft te veel items +@msg toSource: the value is nested too deep toSource: de waarde is te diep genest +@msg toString is not a function toString is geen functie +@msg too large for a zip archive: package to a folder te groot voor een zip-archief: verpak naar een map +@msg too many Shaper edits te veel Shaper-bewerkingen +@msg too many `points` (at most 100000) te veel `points` (maximaal 100000) +@msg too many arguments te veel argumenten +@msg too many characters: at most {MAX_CHARS} te veel tekens: maximaal {MAX_CHARS} +@msg too many dots for this size: lower the frequency te veel punten voor deze grootte: verlaag de frequentie +@msg too many filters over one file te veel filters over één bestand +@msg too many overlapping paths for Shaper te veel overlappende paden voor Shaper +@msg too many quantifiers te veel kwantoren +@msg too many saved clips te veel opgeslagen knippaden +@msg too many saved graphics states te veel opgeslagen grafische toestanden +@msg toolbar (a toolbar's name) must be a string toolbar (de naam van een werkbalk) moet een string zijn +@msg toolbar name can't be empty de naam van een werkbalk mag niet leeg zijn +@msg transparentImages {v}: "flatten" (the default) or "omit" transparentImages {v}: "flatten" (de standaard) of "omit" +@msg turn on at least one side schakel minstens één zijde in +@msg two saved selections would be named `{_1}` twee opgeslagen selecties zouden de naam `{_1}` krijgen +@msg type dimension cannot be represented with this text transform de tekstmaatlijn kan niet worden weergegeven met deze teksttransformatie +@msg type dimension must be finite de tekstmaatlijn moet eindig zijn +@msg unexpected resources onverwachte resources +@msg unknown CMYK profile `{name}` onbekend CMYK-profiel `{name}` +@msg unknown File Info field `{k}` onbekend veld `{k}` van Bestandsinfo +@msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; prefix - to turn off; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take an alternate's number as `tag=N` with N from 0 to {_1}, as `salt=2`) onbekende OpenType-functie `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; zet er - voor om uit te schakelen; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom en aalt accepteren het nummer van een alternatief als `tag=N` met N van 0 tot {_1}, zoals `salt=2`) +@msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) onbekende OpenType-functie `{t}` in featureChanges (de tags die `features` accepteert) +@msg unknown PDF preset `{name}` (presets: {_1}) onbekende PDF-voorinstelling `{name}` (voorinstellingen: {_1}) +@msg unknown Warp style onbekende warpstijl +@msg unknown alignToPath `{a}` onbekende alignToPath `{a}` +@msg unknown arrowhead {v} onbekende pijlpunt {v} +@msg unknown artboardLayout key `{k}` (layout, columns, spacing, rightToLeft) onbekende sleutel `{k}` van artboardLayout (layout, columns, spacing, rightToLeft) +@msg unknown attribute `{attribute}` onbekend kenmerk `{attribute}` +@msg unknown attribute `{k}` onbekend kenmerk `{k}` +@msg unknown axis `{other}` (vertical|horizontal|free) onbekende as `{other}` (vertical|horizontal|free) +@msg unknown blend mode `{b}` onbekende vermengingsmodus `{b}` +@msg unknown blend mode {b} onbekende vermengingsmodus {b} +@msg unknown brush type `{o}` onbekend penseeltype `{o}` +@msg unknown category `{c}` onbekende categorie `{c}` +@msg unknown category `{c}` ({_1}) onbekende categorie `{c}` ({_1}) +@msg unknown character `{c}` onbekend teken `{c}` +@msg unknown character style number field onbekend getalveld van een tekenstijl +@msg unknown dither `{d}` (diffusion, pattern, noise or none) onbekende dither `{d}` (diffusion, pattern, noise of none) +@msg unknown effect `{e}` onbekend effect `{e}` +@msg unknown end {e} onbekend uiteinde {e} +@msg unknown flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution or a saved one: see flattener.presets.list) onbekende flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution of een opgeslagen voorinstelling: zie flattener.presets.list) +@msg unknown format `{f}` (vcswatches, gpl, ase or css) onbekende indeling `{f}` (vcswatches, gpl, ase of css) +@msg unknown from {f} onbekende from {f} +@msg unknown graph type `{t}` onbekend grafiektype `{t}` +@msg unknown grid colours `{name}` (one of {_1}) onbekende rasterkleuren `{name}` (een van {_1}) +@msg unknown gridType `{t}` onbekende gridType `{t}` +@msg unknown highlight `{v}` onbekende markering `{v}` +@msg unknown intent `{i}` onbekende intentie `{i}` +@msg unknown issue kind {id} onbekend soort probleem {id} +@msg unknown issue kind {v} onbekend soort probleem {v} +@msg unknown knockout state {k} onbekende knockoutstatus {k} +@msg unknown language `{language}` (one of {_1}) onbekende taal `{language}` (een van {_1}) +@msg unknown language `{l}` (one of {_1}) onbekende taal `{l}` (een van {_1}) +@msg unknown method `{m}` ({_1}) onbekende methode `{m}` ({_1}) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) onbekende modus `{other}` (gray, rgb, hsb, lab, cmyk of web) +@msg unknown mode `{other}` (mono|cmyk) onbekende modus `{other}` (mono|cmyk) +@msg unknown mode `{other}` (rgb|cmyk|gray|global) onbekende modus `{other}` (rgb|cmyk|gray|global) +@msg unknown mode `{other}` (set, add, subtract) onbekende modus `{other}` (set, add, subtract) +@msg unknown mode `{o}` onbekende modus `{o}` +@msg unknown mode {m} onbekende modus {m} +@msg unknown model `{other}` onbekend model `{other}` +@msg unknown model `{other}` (keep, new or document) onbekend model `{other}` (keep, new of document) +@msg unknown op {o} onbekende op {o} +@msg unknown order `{o}`: toggle, front, forward, backward or back onbekende volgorde `{o}`: toggle, front, forward, backward of back +@msg unknown overprints `{v}` (preserve, simulate or discard) onbekende overprints `{v}` (preserve, simulate of discard) +@msg unknown panel onbekend paneel +@msg unknown panel `{panel}` onbekend paneel `{panel}` +@msg unknown parameter `{key}` onbekende parameter `{key}` +@msg unknown pieLegend `{v}` (none, standard or wedges) onbekende pieLegend `{v}` (none, standard of wedges) +@msg unknown piePosition `{v}` (even, ratio or stacked) onbekende piePosition `{v}` (even, ratio of stacked) +@msg unknown pieSort `{v}` (none, all or first) onbekende pieSort `{v}` (none, all of first) +@msg unknown plate `{n}` onbekende plaat `{n}` +@msg unknown preference `{k}` onbekende voorkeur `{k}` +@msg unknown profile {id} (see stroke.widthProfile.list) onbekend profiel {id} (zie stroke.widthProfile.list) +@msg unknown proof target `{t}` onbekend proefdoel `{t}` +@msg unknown quotes key `{k}` (double, single) onbekende sleutel `{k}` van quotes (double, single) +@msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) onbekende reductie `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform of document) +@msg unknown resolution `{v}` onbekende resolutie `{v}` +@msg unknown rule `{rule}` ({_1}) onbekende regel `{rule}` ({_1}) +@msg unknown rule `{r}` (see color.harmony) onbekende regel `{r}` (zie color.harmony) +@msg unknown setting `{k}` onbekende instelling `{k}` +@msg unknown shape `{v}` (circle|ellipse|square|diamond|line) onbekende vorm `{v}` (circle|ellipse|square|diamond|line) +@msg unknown spacing `{o}` (smooth|steps|distance) onbekende spacing `{o}` (smooth|steps|distance) +@msg unknown tileType `{t}` ({_1}) onbekende tileType `{t}` ({_1}) +@msg unknown units onbekende eenheden +@msg unknown units `{u}` onbekende eenheden `{u}` +@msg unknown value axis `{v}` (left, right or both) onbekende waardeas `{v}` (left, right of both) +@msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) onbekende variatie `{v}` (tintsShades|warmCool|vividMuted) +@msg unknown warp style `{s}` onbekende warpstijl `{s}` +@msg unknown {key} `{v}` (none, short or full) onbekende {key} `{v}` (none, short of full) +@msg unknown {key} profile `{n}` onbekend {key}-profiel `{n}` +@msg unknown {k} key `{key}` (size, position) onbekende sleutel `{key}` van {k} (size, position) +@msg unmatched ')' ')' zonder tegenhanger +@msg unreadable object onleesbaar object +@msg unsafe destination file name onveilige naam voor het doelbestand +@msg unterminated character class niet-afgesloten tekenklasse +@msg unterminated group niet-afgesloten groep +@msg use paths or compound paths gebruik paden of samengestelde paden +@msg useArtboards must be true or false, not {v} useArtboards moet true of false zijn, niet {v} +@msg value for `{var}` must match its variable kind de waarde voor `{var}` moet bij het soort variabele passen +@msg variable `{_1}` is already defined variabele `{_1}` is al gedefinieerd +@msg variable `{name}` has no `trait` variabele `{name}` heeft geen `trait` +@msg variable `{name}` is already defined variabele `{name}` is al gedefinieerd +@msg variable `{name}` is declared twice variabele `{name}` is twee keer gedeclareerd +@msg variable `{to}` already exists variabele `{to}` bestaat al +@msg view is required view is vereist +@msg view must be one of {_1} view moet een van {_1} zijn +@msg warpStyle can only edit an applied Warp effect warpStyle kan alleen een toegepast warpeffect bewerken +@msg width and height must be more than 0 and at most {limit} width en height moeten meer dan 0 en maximaal {limit} zijn +@msg width factors must be finite breedtefactoren moeten eindig zijn +@msg width must be positive width moet positief zijn +@msg width out of range breedte buiten het bereik +@msg width/height must be > 0 width/height moeten > 0 zijn +@msg with no hem and no grommets there is nothing to mark zonder zoom en zonder zeilringen is er niets om te markeren +@msg wordGap and lineGap need area type in the selection wordGap en lineGap hebben vlaktekst in de selectie nodig +@msg x and y must be finite numbers x en y moeten eindige getallen zijn +@msg x and y must be given together x en y moeten samen worden opgegeven +@msg xpath needs its variables as an object xpath heeft zijn variabelen als object nodig +@msg xpath needs the expression as a string xpath heeft de expressie als string nodig +@msg zone needs an anchor: dock beside a panel with anchor, or in a new dock column with side (Start or End) zone heeft een anker nodig: dock naast een paneel met anchor, of in een nieuwe dockkolom met side (Start of End) +@msg zoom must be positive zoom moet positief zijn +@msg {C}: no effect at index {list} {C}: geen effect op index {list} +@msg {DEFAULT_PRESET} is protected and stays {DEFAULT_PRESET} is beveiligd en blijft bestaan +@msg {DEFAULT_PRESET} is protected: save the settings under another name {DEFAULT_PRESET} is beveiligd: sla de instellingen onder een andere naam op +@msg {GRANT_NOT_REMOVED}, and its settings and cache can't be moved back from {_1} to {_2}: {e} {GRANT_NOT_REMOVED}, en de instellingen en cache ervan kunnen niet van {_1} naar {_2} worden teruggezet: {e} +@msg {LABEL} produced an empty result {LABEL} heeft een leeg resultaat opgeleverd +@msg {_1} MB of document, at most {_2} MB {_1} MB aan document, maximaal {_2} MB +@msg {_1} MB of images, at most {_2} MB {_1} MB aan afbeeldingen, maximaal {_2} MB +@msg {_1} bytes of RGBA data for a {width} × {height} image {_1} bytes aan RGBA-gegevens voor een afbeelding van {width} × {height} +@msg {_1} can't be read, or changed since it was read: relink or update it first {_1} kan niet worden gelezen, of is gewijzigd sinds het is gelezen: koppel het eerst opnieuw of werk het eerst bij +@msg {_1} can't go into {into} {_1} kan niet in {into} worden geplaatst +@msg {_1} can't limit printing to low resolution: choose PDF 1.4 or later, or allow high-resolution printing {_1} kan afdrukken niet tot lage resolutie beperken: kies PDF 1.4 of later, of sta afdrukken in hoge resolutie toe +@msg {_1} files can't be opened yet {_1}-bestanden kunnen nog niet worden geopend +@msg {_1} files can't be password-protected: remove the passwords or choose no standard {_1}-bestanden kunnen niet met een wachtwoord worden beveiligd: verwijder de wachtwoorden of kies geen standaard +@msg {_1} files can't be {_2} {_1}-bestanden kunnen niet {_2} zijn +@msg {_1} files can't carry editing data: turn off preserveEditing {_1}-bestanden kunnen geen bewerkingsgegevens bevatten: schakel preserveEditing uit +@msg {_1} files can't have PDF layers: turn off createLayers {_1}-bestanden kunnen geen PDF-lagen hebben: schakel createLayers uit +@msg {_1} files need a creation date, and this platform has no clock to give one {_1}-bestanden hebben een aanmaakdatum nodig, en dit platform heeft geen klok om er een te geven +@msg {_1} is not a folder: {e} {_1} is geen map: {e} +@msg {_1} isn't a path {_1} is geen pad +@msg {_1} options: {e} opties voor {_1}: {e} +@msg {_1} paints nothing to rasterize {_1} verft niets om te rasteriseren +@msg {_1} passwords can have up to {MAX_LEGACY_PASSWORD} ASCII characters (PDF 1.7 and later take any) wachtwoorden voor {_1} mogen maximaal {MAX_LEGACY_PASSWORD} ASCII-tekens hebben (PDF 1.7 en later accepteren alle tekens) +@msg {_1} with linked images or an image map writes several files: use document.export {_1} met gekoppelde afbeeldingen of een imagemap schrijft meerdere bestanden: gebruik document.export +@msg {_1} writes one file per artboard here: use document.export, or name one artboard {_1} schrijft hier één bestand per tekengebied: gebruik document.export, of noem één tekengebied +@msg {_1} × {_2} pixels is too large for {_3} (at most {max} pixels a side): lower the scale {_1} × {_2} pixels is te groot voor {_3} (maximaal {max} pixels per zijde): verlaag de schaal +@msg {_1}: belongs to another account {_1}: hoort bij een ander account +@msg {_1}: not a folder of its own {_1}: geen eigen map +@msg {_1}: not a plain file {_1}: geen gewoon bestand +@msg {_1}: {_2} and {_3} are in the way {_1}: {_2} en {_3} staan in de weg +@msg {code}: {0} {code}: {0} +@msg {dest}: {e} {dest}: {e} +@msg {dir}: {e} {dir}: {e} +@msg {doc} has no folder {doc} heeft geen map +@msg {file} isn't linked {file} is niet gekoppeld +@msg {file} names more than one linked JavaScript file {file} noemt meer dan één gekoppeld JavaScript-bestand +@msg {folder} is not a package folder {folder} is geen pakketmap +@msg {folder}: more than {max} files and folders {folder}: meer dan {max} bestanden en mappen +@msg {folder}: {e} {folder}: {e} +@msg {g} is not a Live Paint group {g} is geen Live Paint-groep +@msg {id} is not a slice {id} is geen slice +@msg {key} must be 0–{MAX_ADD_AROUND} pt {key} moet 0–{MAX_ADD_AROUND} pt zijn +@msg {key} must be [x,y] {key} moet [x,y] zijn +@msg {key} must be a percentage {min}..100 {key} moet een percentage {min}..100 zijn +@msg {key} must be a positive number, not {n} {key} moet een positief getal zijn, niet {n} +@msg {key} must be a positive number, not {v} {key} moet een positief getal zijn, niet {v} +@msg {key} must be one of {_1} {key} moet een van {_1} zijn +@msg {key} must be {_1}, got {s} {key} moet {_1} zijn, kreeg {s} +@msg {key} must name a floating panel {key} moet een zwevend paneel noemen +@msg {key} must name a panel in another group {key} moet een paneel in een andere groep noemen +@msg {key} must name a panel that shows {key} moet een paneel noemen dat wordt getoond +@msg {key} must name a registered panel {key} moet een geregistreerd paneel noemen +@msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind}-bestanden hebben geen transparantie, en het bestand zou {what} bevatten: vlak het eerst af (object.flattenTransparency) +@msg {kind} images can't be opened (see document.formats) {kind}-afbeeldingen kunnen niet worden geopend (zie document.formats) +@msg {k} `{v}` is not one of the choices {k} `{v}` is geen van de keuzes +@msg {k} has control characters{_1} {k} bevat besturingstekens{_1} +@msg {k} is too long (at most {MAX_TEXT} characters) {k} is te lang (maximaal {MAX_TEXT} tekens) +@msg {k} must be > 0 {k} moet > 0 zijn +@msg {k} must be a number (pt) or a length such as "210 mm" {k} moet een getal (pt) of een lengte zoals "210 mm" zijn +@msg {k} must be a number from {min} to {max} {k} moet een getal van {min} tot {max} zijn +@msg {k} must be a number or "auto" {k} moet een getal of "auto" zijn +@msg {k} must be a string {k} moet een string zijn +@msg {k} must be text {k} moet tekst zijn +@msg {k} must be true or false {k} moet true of false zijn +@msg {k} must be {{size?, position?}} {k} moet {{size?, position?}} zijn +@msg {k}: a custom arrowhead's path needs an area to fill and at most {most} anchors and {most} subpaths, each anchor within {far} head units of its tip {k}: het pad van een aangepaste pijlpunt heeft een oppervlak om te vullen nodig en maximaal {most} ankers en {most} subpaden, elk anker binnen {far} kopeenheden van de punt +@msg {k}: bad custom arrowhead path: {e} {k}: ongeldig pad van een aangepaste pijlpunt: {e} +@msg {k}: bad custom arrowhead: {e} {k}: ongeldige aangepaste pijlpunt: {e} +@msg {k}: can't read `{s}` as a length {k}: kan `{s}` niet als lengte lezen +@msg {k}: custom must be a name {k}: custom moet een naam zijn +@msg {label} must be a number at most {max} {label} moet een getal van maximaal {max} zijn +@msg {label} must be a number from -1296 to 1296 {label} moet een getal van -1296 tot 1296 zijn +@msg {label} must be a number from 1 to 10000 {label} moet een getal van 1 tot 10000 zijn +@msg {name} `{s}`: {ids} {name} `{s}`: {ids} +@msg {name} is built in and can't be deleted {name} is ingebouwd en kan niet worden verwijderd +@msg {name} must be a number {name} moet een getal zijn +@msg {name}: CRC or size mismatch {name}: CRC of grootte komt niet overeen +@msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}: alleen de ingesloten voorvertoning van dit Affinity-bestand kon worden gelezen; gebruik Bestand › Openen om die met de bijbehorende waarschuwing te bekijken, of exporteer SVG of PDF vanuit Affinity voordat je plaatst +@msg {name}: {e} {name}: {e} +@msg {native}; its embedded preview can't be read either ({e}) {native}; de ingesloten voorvertoning ervan kan ook niet worden gelezen ({e}) +@msg {path}: copy takes a DCS file only when its plates are inside it; relink to it where its plate files are {path}: copy accepteert een DCS-bestand alleen wanneer de platen erin zitten; koppel het opnieuw op de plek waar de plaatbestanden staan +@msg {path}: larger than {_1} MB {path}: groter dan {_1} MB +@msg {saving} failed: {e} {saving} is mislukt: {e} +@msg {shown} is not an XPath 1.0 function {shown} is geen XPath 1.0-functie +@msg {std} files are CMYK, and the file would have colours in {_1} {std}-bestanden zijn CMYK, en het bestand zou kleuren in {_1} bevatten +@msg {std} files embed their fonts, and the file would have one that isn't {std}-bestanden sluiten hun lettertypen in, en het bestand zou er een bevatten dat niet is ingesloten +@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway {target} is het bestand waaruit dit document is gelezen, en bij het lezen zijn dingen weggelaten ({what}): door eroverheen te schrijven zouden die voorgoed verloren gaan. Schrijf in plaats daarvan een ander bestand, of geef acknowledgeLoss: true op om het toch te vervangen +@msg {ty} brushes need selected art (or params.{k}) {ty}-penselen hebben een geselecteerde illustratie nodig (of params.{k}) +@msg {v} is not an asset id {v} is geen asset-id +@msg {v} names no layer or sublayer {v} noemt geen laag of sublaag +@msg {what} can't be intertwined {what} kan niet worden verstrengeld +@msg {what} doesn't fit the paper with its bleed and marks {what} past niet op het papier met de afloop en de tekens ervan +@msg {what} is not a function {what} is geen functie +@msg {what} would print more than {MAX_COPIES_PER_SHEET} copies on a sheet: scale it up {what} zou meer dan {MAX_COPIES_PER_SHEET} exemplaren op een vel afdrukken: schaal het omhoog +@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} zou op meer dan {MAX_TILES} tegels worden afgedrukt: schaal het omlaag +@msg {what} {i} out of range {what} {i} buiten het bereik + Ruler Origin Lineaaloorsprong Reset Ruler Origin Lineaaloorsprong herstellen Column Width: Kolombreedte: @@ -6695,6 +8520,8 @@ axis Y Axis Y-as Action Options… Actieopties… Action Options Actieopties Playback Options… Afspeelopties… + Button Mode Knopmodus + No actions. Geen acties. Insert Stop… Stop invoegen… Insert Stop Stop invoegen Record Stop Stop opnemen @@ -7496,6 +9323,12 @@ breakText Glyphs Glyphs @msg open the practice sample of `{id}` first (see learn.openSample) open eerst het oefenbestand van `{id}` (zie learn.openSample) @msg finish `{id}` first (see learn.finish) voltooi eerst `{id}` (zie learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` is de laatste tutorial van zijn vaardigheid + Reset progress Voortgang opnieuw instellen + Mark Tutorial Step Stap van tutorial markeren + Reset Learn Progress Leervoortgang opnieuw instellen +@msg missing `step` (see learn.show) `step` ontbreekt (zie learn.show) +@msg `step` must be a step number from 0 to {last} `step` moet een stapnummer van 0 tot en met {last} zijn +@msg `{id}` is finished (see learn.resetProgress) `{id}` is voltooid (zie learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Uitgestelde effecten vernieuwen @@ -7519,3 +9352,121 @@ breakText Glyphs Glyphs Grommets Zeilringen Grommet Inset Afstand van zeilringen tot de rand Diameter Diameter + +# Status and error messages: 3D effects and Revolve, image export, color profiles, swatch exchange files and +# color books, regular expressions in scripts, whole-number parameters, and DXF and DWG files. +@msg 3D effects require finite coordinates within 100 million points 3D-effecten vereisen eindige coördinaten binnen 100 miljoen punten +@msg 3D effects require one to ten lights 3D-effecten vereisen één tot tien lichten +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP-diepte {_1}: 1, 4, 8, 16, 24 of 32 bits per pixel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP-codering mislukt: {width} × {height} pixels past niet in het formaat of in de pixelbuffer +@msg GIF encoding failed: the palette image is malformed GIF-codering mislukt: de paletafbeelding is ongeldig +@msg GIF encoding failed: {e} GIF-codering mislukt: {e} +@msg JPEG colour profile: {e} JPEG-kleurprofiel: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG-codering mislukt: de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg JPEG encoding failed: {e} JPEG-codering mislukt: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG-codering mislukt: de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg PNG encoding failed: the palette image is malformed PNG-codering mislukt: de paletafbeelding is ongeldig +@msg PNG encoding failed: {e} PNG-codering mislukt: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG-codering mislukt: {width} × {height} pixels is geen geldige afbeeldingsgrootte +@msg PSD colour profile: {e} PSD-kleurprofiel: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD-codering mislukt: de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg Revolve profile contains invalid coordinates Het profiel van Draaien bevat ongeldige coördinaten +@msg Revolve profile is too complex Het profiel van Draaien is te complex +@msg Revolve projection is not finite De projectie van Draaien is niet eindig +@msg Revolve requires finite profile coordinates within 100 million points Draaien vereist eindige profielcoördinaten binnen 100 miljoen punten +@msg Revolve surface is too complex; reduce Segments or simplify the profile Het oppervlak van Draaien is te complex; verlaag Segmenten of vereenvoudig het profiel +@msg Revolve surface is too complex; simplify the profile Het oppervlak van Draaien is te complex; vereenvoudig het profiel +@msg Revolve visibility cannot split the projected boundary De zichtbaarheid van Draaien kan de geprojecteerde rand niet splitsen +@msg Revolve visibility creates too many fragments De zichtbaarheid van Draaien maakt te veel fragmenten +@msg Revolve visibility creates too many vector anchors De zichtbaarheid van Draaien maakt te veel vectorankerpunten +@msg Revolve visibility exceeds its geometry work limit De zichtbaarheid van Draaien overschrijdt de werklimiet voor geometrie +@msg Revolve visibility exceeds its spatial index limit De zichtbaarheid van Draaien overschrijdt de limiet van de ruimtelijke index +@msg Revolve visibility has too many boundary crossings De zichtbaarheid van Draaien heeft te veel randkruisingen +@msg Revolve visibility has too many input anchors De zichtbaarheid van Draaien heeft te veel invoerankerpunten +@msg Revolve visibility requires convex cap sectors De zichtbaarheid van Draaien vereist convexe kapsectoren +@msg Revolve visibility requires finite projected faces De zichtbaarheid van Draaien vereist eindige geprojecteerde vlakken +@msg SVG options: {e} SVG-opties: {e} +@msg Save for Web settings: {e} Instellingen van Opslaan voor web: {e} +@msg TIFF colour profile: {e} TIFF-kleurprofiel: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF-codering mislukt: de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg TIFF encoding failed: {e} TIFF-codering mislukt: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa-diepte {_1}: 16, 24 of 32 bits per pixel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa-codering mislukt: de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg The 3D projection is not finite De 3D-projectie is niet eindig +@msg The 3D shadow is too complex; turn Shadows off or simplify the art De 3D-schaduw is te complex; zet Schaduwen uit of vereenvoudig de illustratie +@msg The shape contains invalid coordinates De vorm bevat ongeldige coördinaten +@msg Too many Revolve faces for visibility evaluation Te veel vlakken van Draaien om de zichtbaarheid te bepalen +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft leest maximaal {ASE_MAX_ENTRIES} kleuren en groepen uit een uitwisselingsbestand voor stalen, en deze bibliotheek heeft er {entries} +@msg WebP encoding failed: {e} WebP-codering mislukt: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `index` must be a whole number `index` moet een geheel getal zijn +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` moet smallThumb, mediumThumb, largeThumb, smallList of largeList zijn +@msg a line can't run from a point to itself een lijn kan niet van een punt naar zichzelf lopen +@msg a line needs at least two points een lijn heeft minstens twee punten nodig +@msg a number cannot be read een getal kan niet worden gelezen +@msg a swatch exchange block is too long een blok van een uitwisselingsbestand voor stalen is te lang +@msg a swatch exchange name is too long een naam in een uitwisselingsbestand voor stalen is te lang +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels een afbeelding van {sw} × {sh} kan niet worden geschaald naar {width} × {height} pixels +@msg a {width} × {height} image is too large een afbeelding van {width} × {height} is te groot +@msg a {width} × {height} image: {e} een afbeelding van {width} × {height}: {e} +@msg an image could not be written: {e} een afbeelding kon niet worden geschreven: {e} +@msg an image that couldn't be read was left out een afbeelding die niet gelezen kon worden, is weggelaten +@msg can't open “{name}”: {e} kan „{name}” niet openen: {e} +@msg cannot align zip entries to {align} bytes zip-items kunnen niet op {align} bytes worden uitgelijnd +@msg cannot open the automation {kind} root `{_1}`: {e} kan de hoofdmap voor automatisering ({kind}) `{_1}` niet openen: {e} +@msg cannot read profile: {0} kan het profiel niet lezen: {0} +@msg color book version {version} isn't supported (only 1) kleurenboekversie {version} wordt niet ondersteund (alleen 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) kleurenboeken in kleurruimte {other} worden niet ondersteund (alleen RGB, CMYK en Lab) +@msg file name too long to zip: {_1} bestandsnaam te lang om te zippen: {_1} +@msg file name too long to zip: {name} bestandsnaam te lang om te zippen: {name} +@msg freeform line {i}: {e} lijn in vrije vorm {i}: {e} +@msg freeform point {i}: {e} punt in vrije vorm {i}: {e} +@msg give `{key}` or `{other}`, not both geef `{key}` of `{other}`, niet beide +@msg grayscale profiles can't be working spaces yet grijswaardenprofielen kunnen nog geen werkruimte zijn +@msg input contains NaN or infinite coordinates de invoer bevat NaN of oneindige coördinaten +@msg input path could not be closed het invoerpad kon niet worden gesloten +@msg invalid ICC profile: {0} ongeldig ICC-profiel: {0} +@msg invalid scale {scale} ongeldige schaal {scale} +@msg its localized names take more than {_1} KB de gelokaliseerde namen ervan nemen meer dan {_1} KB in beslag +@msg its objects are nested too deep ({e}) de objecten ervan zijn te diep genest ({e}) +@msg its tag table lists the `{_1}` tag more than once de tagtabel ervan vermeldt de tag `{_1}` meer dan eens +@msg not a graphic style library: {e} geen bibliotheek met grafische stijlen: {e} +@msg not a swatch library (.vcswatches or .gpl) geen staalbibliotheek (.vcswatches of .gpl) +@msg not a swatch library (format `{_1}`) geen staalbibliotheek (indeling `{_1}`) +@msg not a swatch library: {e} geen staalbibliotheek: {e} +@msg not an action set file ({e}) geen actiesetbestand ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray profielkleurruimte {other} is geen RGB, CMYK of grijs +@msg regular expression too large reguliere expressie te groot +@msg script file is not UTF-8 text: {value} scriptbestand is geen UTF-8-tekst: {value} +@msg stop {i}: {e} stop {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) versie {major}.{minor} van uitwisselingsbestanden voor stalen wordt niet ondersteund (alleen 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors het kleurenboek bevat meer dan {ASE_MAX_ENTRIES} kleuren +@msg the color book is cut short het kleurenboek is afgebroken +@msg the color book's names take more than {_1} MB de namen in het kleurenboek nemen meer dan {_1} MB in beslag +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution de afbeelding zou {w} × {h} pixels worden; rasterexports zijn beperkt tot {MAX_RASTER_SIDE} pixels per zijde en {_1} megapixels: verlaag de schaal of de resolutie +@msg the optimised image can't be read back: {e} de geoptimaliseerde afbeelding kan niet worden teruggelezen: {e} +@msg the pixel buffer doesn't match the image size de pixelbuffer komt niet overeen met de afbeeldingsgrootte +@msg the preview: {e} de voorvertoning: {e} +@msg the request may not read the New Document profiles folder het verzoek mag de map met profielen voor nieuwe documenten niet lezen +@msg the shapes are too degenerate to combine de vormen zijn te gedegenereerd om te combineren +@msg the shapes cross themselves and each other too often to combine de vormen kruisen zichzelf en elkaar te vaak om te combineren +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups het uitwisselingsbestand voor stalen bevat meer dan {ASE_MAX_ENTRIES} kleuren en groepen +@msg the swatch exchange file is cut short het uitwisselingsbestand voor stalen is afgebroken +@msg the {_1} plate can't be read: {e} de drukplaat {_1} kan niet worden gelezen: {e} +@msg this binary DXF file is damaged or cut short dit binaire DXF-bestand is beschadigd of afgebroken +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that dit is een DWG-tekening, die niet gelezen kan worden: sla hem in de CAD-app op als DXF en open die +@msg too many classes te veel tekenklassen +@msg too many groups te veel groepen +@msg too many layers for PSD (at most 32767) te veel lagen voor PSD (maximaal 32767) +@msg too many swatch exchange blocks te veel blokken in het uitwisselingsbestand voor stalen +@msg unknown colour profile: {0} onbekend kleurprofiel: {0} +@msg {_1} clashes with a built-in profile name {_1} botst met een ingebouwde profielnaam +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels is te groot voor GIF (maximaal 65535 pixels per zijde): verlaag de resolutie +@msg {_1}: no usable transform to/from sRGB {_1}: geen bruikbare transformatie van of naar sRGB +@msg {name} is not a CMYK profile {name} is geen CMYK-profiel +@msg {name} is not an RGB profile {name} is geen RGB-profiel +@msg {path}: could not be read {path}: kon niet worden gelezen +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pixels is te groot voor JPEG (maximaal 65535 pixels per zijde): verlaag de resolutie +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pixels is te groot voor Targa (maximaal 65535 pixels per zijde): verlaag de resolutie +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixels is te groot voor PSD (maximaal {MAX_SIDE} pixels per zijde): verlaag de resolutie diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 48f2671c2d..08e96e6a35 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -171,6 +171,8 @@ Crop Image Kadruj obraz Image Tools Narzędzia obrazu Remove Background… Usuń tło… + Draw (Pencil) Rysuj (ołówek) + Place Image Umieść obraz Remove Background Usuń tło Background Tło Edge Color Kolor krawędzi @@ -942,6 +944,7 @@ VectorCraft Title Bar on Every Desktop Pasek tytułu VectorCraft na każdym pulpicie The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Dopóki zmienna środowiskowa VECTORCRAFT_TITLEBAR jest ustawiona, to ona wybiera pasek tytułu. System Title Bar takes precedence over this option while it is on. Dopóki Systemowy pasek tytułu jest włączony, ma pierwszeństwo przed tą opcją. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Dopóki Pasek tytułu VectorCraft na każdym pulpicie jest wyłączony, ten pulpit rysuje pasek tytułu okna niezależnie od tego, czy ta opcja jest włączona. Exit Zakończ Distort Zniekształcenie Diffuse Glow… Rozproszony blask… @@ -1511,6 +1514,7 @@ lighting Light Światło Proportional Metrics Metryka proporcjonalna Insert Aki Left Wstaw aki z lewej Insert Aki Right Wstaw aki z prawej + Tsume Tsume Character Direction Kierunek znaków Digits Cyfry Arabic Arabskie @@ -4622,6 +4626,7 @@ imageTrace Outline Kontur @msg `select` must be true or false `select` musi mieć wartość true lub false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` i `maxAnchors` muszą być liczbami całkowitymi @msg `{key}` must be a number not below 0 `{key}` musi być liczbą nie mniejszą niż 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` musi być czterema liczbami nie mniejszymi niż 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` musi mieć postać [x, y, width, height]: cztery skończone liczby, szerokość i wysokość nieujemne @msg `{min_key}` is greater than `{max_key}` `{min_key}` jest większe niż `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` podaj co najmniej jeden z parametrów `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4874,6 +4879,7 @@ imageTrace Outline Kontur @msg no action set to save brak zestawu operacji do zapisania @msg the action set file can't be read in full nie można odczytać całego pliku zestawu operacji @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Wczytano „{name}”: pominięto {n} krok|Wczytano „{name}”: pominięto {n} kroki|Wczytano „{name}”: pominięto {n} kroków +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Wczytano „{name}”: {n} krok ma nieznane polecenie i został zachowany: „{action}”, krok {step}, `{command}`|Wczytano „{name}”: {n} kroki mają nieznane polecenia i zostały zachowane; pierwszy: „{action}”, krok {step}, `{command}`|Wczytano „{name}”: {n} kroków ma nieznane polecenia i zostało zachowanych; pierwszy: „{action}”, krok {step}, `{command}` @msg not an action set file to nie jest plik zestawu operacji @msg the action set file is larger than 8 MiB plik zestawu operacji jest większy niż 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: dokumentacja byłaby większa niż {MAX_BYTES} bajtów @@ -5117,6 +5123,7 @@ imageTrace Outline Kontur @msg tool shortcuts must be a single key (optionally with Shift) skróty narzędzi muszą być pojedynczym klawiszem (opcjonalnie z Shift) @msg truncated obcięty @msg unknown command `{0}` nieznane polecenie `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` krok {step} operacji „{action}” uruchamia nieznane polecenie `{command}` @msg unknown command `{0}`; did you mean `{1}`? nieznane polecenie `{0}`; czy chodziło o `{1}`? @msg unknown effect `{id}` nieznany efekt `{id}` @msg unknown format nieznany format @@ -6244,8 +6251,8 @@ axis Y Axis Oś Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` wtyczka eksportu deklaruje od 1 do {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` najwyżej {MAX_UNGROUPED} parametrów poza grupami: pozostałym nadaj `group` @msg can't encode the input nie można zakodować danych wejściowych -@msg expected {"dataBase64"} oczekiwano {"dataBase64"} -@msg expected {"objects"} oczekiwano {"objects"} +@msg expected {{"dataBase64": "…"}} oczekiwano {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} oczekiwano {{"objects": [...]}} @msg export `{name}`: {e} eksport modułu `{name}`: {e} @msg extension {e} is listed twice rozszerzenie {e} występuje dwa razy @msg extension {e}: use 1-16 lower-case letters and digits, without the dot rozszerzenie {e}: użyj 1-16 małych liter i cyfr, bez kropki @@ -6309,11 +6316,11 @@ axis Y Axis Oś Y @msg a painted live effect returns only `objects` malujący efekt dynamiczny zwraca tylko `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` element malującego efektu dynamicznego ma tylko `path`, `fillRule`, `fills` i `strokes` @msg a read-only object was left out pominięto obiekt tylko do odczytu -@msg a read-only object was left out: return it, as {"id"} alone or as it was given pominięto obiekt tylko do odczytu: zwróć go jako samo {"id"} lub w postaci, w jakiej został przekazany +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given pominięto obiekt tylko do odczytu: zwróć go jako samo {{"id": …}} lub w postaci, w jakiej został przekazany @msg a string ciągiem znaków @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` obrys ma tylko `paint`, `width`, `join`, `cap` i `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} obrys musi mieć postać {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} efekt musi mieć postać {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} obrys musi mieć postać {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} efekt musi mieć postać {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` efekt wypełnienia zwraca tylko `fills` @msg an effect on a stroke returns only `strokes` efekt obrysu zwraca tylko `strokes` @msg an object must be a JSON object obiekt musi być obiektem JSON @@ -6455,6 +6462,8 @@ axis Y Axis Oś Y Action Options… Opcje operacji… Action Options Opcje operacji Playback Options… Opcje odtwarzania… + Button Mode Tryb przycisków + No actions. Brak operacji. Insert Stop… Wstaw zatrzymanie… Insert Stop Wstaw zatrzymanie Record Stop Nagraj zatrzymanie @@ -7320,6 +7329,12 @@ breakText Glyphs Glify @msg open the practice sample of `{id}` first (see learn.openSample) najpierw otwórz przykład do ćwiczeń samouczka `{id}` (patrz learn.openSample) @msg finish `{id}` first (see learn.finish) najpierw zakończ `{id}` (patrz learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` to ostatni samouczek swojej umiejętności + Reset progress Resetuj postępy + Mark Tutorial Step Oznacz krok samouczka + Reset Learn Progress Resetuj postępy nauki +@msg missing `step` (see learn.show) brak `step` (patrz learn.show) +@msg `step` must be a step number from 0 to {last} `step` musi być numerem kroku od 0 do {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` jest zakończony (patrz learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Odśwież odroczone efekty @@ -9159,3 +9174,119 @@ breakText Glyphs Glify @msg {what} can't be intertwined {what} nie można przeplatać @msg {what} doesn't fit the paper with its bleed and marks {what} nie mieści się na papierze wraz ze spadem i znacznikami @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what}: wydruk zająłby ponad {MAX_TILES} kafelków: zmniejsz skalę + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points Efekty 3D wymagają skończonych współrzędnych w zakresie 100 milionów punktów +@msg 3D effects require one to ten lights Efekty 3D wymagają od jednego do dziesięciu świateł +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Głębia BMP {_1}: 1, 4, 8, 16, 24 lub 32 bity na piksel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Kodowanie BMP nie powiodło się: {width} × {height} pikseli nie mieści się w formacie ani w buforze pikseli +@msg GIF encoding failed: the palette image is malformed Kodowanie GIF nie powiodło się: obraz z paletą jest nieprawidłowy +@msg GIF encoding failed: {e} Kodowanie GIF nie powiodło się: {e} +@msg JPEG colour profile: {e} Profil kolorów JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Kodowanie JPEG nie powiodło się: bufor pikseli nie odpowiada rozmiarowi obrazu +@msg JPEG encoding failed: {e} Kodowanie JPEG nie powiodło się: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Kodowanie PNG nie powiodło się: bufor pikseli nie odpowiada rozmiarowi obrazu +@msg PNG encoding failed: the palette image is malformed Kodowanie PNG nie powiodło się: obraz z paletą jest nieprawidłowy +@msg PNG encoding failed: {e} Kodowanie PNG nie powiodło się: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Kodowanie PNG nie powiodło się: {width} × {height} pikseli to nieprawidłowy rozmiar obrazu +@msg PSD colour profile: {e} Profil kolorów PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Kodowanie PSD nie powiodło się: bufor pikseli nie odpowiada rozmiarowi obrazu +@msg Revolve profile contains invalid coordinates Profil efektu Obrót zawiera nieprawidłowe współrzędne +@msg Revolve profile is too complex Profil efektu Obrót jest zbyt złożony +@msg Revolve projection is not finite Rzut efektu Obrót nie jest skończony +@msg Revolve requires finite profile coordinates within 100 million points Efekt Obrót wymaga skończonych współrzędnych profilu w zakresie 100 milionów punktów +@msg Revolve surface is too complex; reduce Segments or simplify the profile Powierzchnia efektu Obrót jest zbyt złożona; zmniejsz Segmenty lub uprość profil +@msg Revolve surface is too complex; simplify the profile Powierzchnia efektu Obrót jest zbyt złożona; uprość profil +@msg Revolve visibility cannot split the projected boundary Obliczanie widoczności efektu Obrót nie może podzielić rzutowanej granicy +@msg Revolve visibility creates too many fragments Obliczanie widoczności efektu Obrót tworzy zbyt wiele fragmentów +@msg Revolve visibility creates too many vector anchors Obliczanie widoczności efektu Obrót tworzy zbyt wiele wektorowych punktów kontrolnych +@msg Revolve visibility exceeds its geometry work limit Obliczanie widoczności efektu Obrót przekracza swój limit obliczeń geometrycznych +@msg Revolve visibility exceeds its spatial index limit Obliczanie widoczności efektu Obrót przekracza swój limit indeksu przestrzennego +@msg Revolve visibility has too many boundary crossings Obliczanie widoczności efektu Obrót napotyka zbyt wiele przecięć granicy +@msg Revolve visibility has too many input anchors Obliczanie widoczności efektu Obrót otrzymuje zbyt wiele wejściowych punktów kontrolnych +@msg Revolve visibility requires convex cap sectors Obliczanie widoczności efektu Obrót wymaga wypukłych sektorów zakończenia +@msg Revolve visibility requires finite projected faces Obliczanie widoczności efektu Obrót wymaga skończonych rzutowanych ścian +@msg SVG options: {e} Opcje SVG: {e} +@msg Save for Web settings: {e} Ustawienia Zapisz dla Internetu: {e} +@msg TIFF colour profile: {e} Profil kolorów TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Kodowanie TIFF nie powiodło się: bufor pikseli nie odpowiada rozmiarowi obrazu +@msg TIFF encoding failed: {e} Kodowanie TIFF nie powiodło się: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Głębia Targa {_1}: 16, 24 lub 32 bity na piksel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Kodowanie Targa nie powiodło się: bufor pikseli nie odpowiada rozmiarowi obrazu +@msg The 3D projection is not finite Rzut 3D nie jest skończony +@msg The 3D shadow is too complex; turn Shadows off or simplify the art Cień 3D jest zbyt złożony; wyłącz Cienie lub uprość grafikę +@msg The shape contains invalid coordinates Kształt zawiera nieprawidłowe współrzędne +@msg Too many Revolve faces for visibility evaluation Zbyt wiele ścian efektu Obrót do obliczenia widoczności +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft odczytuje z pliku wymiany próbek najwyżej {ASE_MAX_ENTRIES} kolorów i grup, a ta biblioteka ma ich {entries} +@msg WebP encoding failed: {e} Kodowanie WebP nie powiodło się: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` ma wartość smallThumb, mediumThumb, largeThumb, smallList lub largeList +@msg a line can't run from a point to itself linia nie może prowadzić od punktu do niego samego +@msg a line needs at least two points linia wymaga co najmniej dwóch punktów +@msg a number cannot be read nie można odczytać liczby +@msg a swatch exchange block is too long blok pliku wymiany próbek jest zbyt długi +@msg a swatch exchange name is too long nazwa w pliku wymiany próbek jest zbyt długa +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels nie można zmienić rozmiaru obrazu {sw} × {sh} na {width} × {height} pikseli +@msg a {width} × {height} image is too large obraz {width} × {height} jest zbyt duży +@msg a {width} × {height} image: {e} obraz {width} × {height}: {e} +@msg an image could not be written: {e} nie udało się zapisać obrazu: {e} +@msg an image that couldn't be read was left out pominięto obraz, którego nie udało się odczytać +@msg can't open “{name}”: {e} nie można otworzyć „{name}”: {e} +@msg cannot align zip entries to {align} bytes nie można wyrównać wpisów zip do {align} bajtów +@msg cannot open the automation {kind} root `{_1}`: {e} nie można otworzyć katalogu głównego automatyzacji ({kind}) `{_1}`: {e} +@msg cannot read profile: {0} nie można odczytać profilu: {0} +@msg color book version {version} isn't supported (only 1) wersja księgi kolorów {version} nie jest obsługiwana (tylko 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) księgi kolorów w przestrzeni kolorów {other} nie są obsługiwane (tylko RGB, CMYK i Lab) +@msg file name too long to zip: {_1} nazwa pliku jest zbyt długa dla archiwum zip: {_1} +@msg file name too long to zip: {name} nazwa pliku jest zbyt długa dla archiwum zip: {name} +@msg freeform line {i}: {e} dowolna linia {i}: {e} +@msg freeform point {i}: {e} dowolny punkt {i}: {e} +@msg give `{key}` or `{other}`, not both podaj `{key}` lub `{other}`, nie oba naraz +@msg grayscale profiles can't be working spaces yet profile w skali szarości nie mogą jeszcze być przestrzeniami roboczymi +@msg input contains NaN or infinite coordinates dane wejściowe zawierają współrzędne NaN lub nieskończone +@msg input path could not be closed nie udało się zamknąć ścieżki wejściowej +@msg invalid ICC profile: {0} nieprawidłowy profil ICC: {0} +@msg invalid scale {scale} nieprawidłowa skala {scale} +@msg its localized names take more than {_1} KB jego zlokalizowane nazwy zajmują ponad {_1} KB +@msg its objects are nested too deep ({e}) jego obiekty są zagnieżdżone zbyt głęboko ({e}) +@msg its tag table lists the `{_1}` tag more than once jego tablica znaczników wymienia znacznik `{_1}` więcej niż raz +@msg not a graphic style library: {e} to nie jest biblioteka stylów graficznych: {e} +@msg not a swatch library (.vcswatches or .gpl) to nie jest biblioteka próbek (.vcswatches lub .gpl) +@msg not a swatch library (format `{_1}`) to nie jest biblioteka próbek (format `{_1}`) +@msg not a swatch library: {e} to nie jest biblioteka próbek: {e} +@msg not an action set file ({e}) to nie jest plik zestawu operacji ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray przestrzeń kolorów profilu {other} nie jest RGB, CMYK ani skalą szarości +@msg regular expression too large wyrażenie regularne jest zbyt duże +@msg script file is not UTF-8 text: {value} plik skryptu nie jest tekstem UTF-8: {value} +@msg stop {i}: {e} punkt koloru {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) wersja pliku wymiany próbek {major}.{minor} nie jest obsługiwana (tylko 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors księga kolorów zawiera ponad {ASE_MAX_ENTRIES} kolorów +@msg the color book is cut short księga kolorów jest ucięta +@msg the color book's names take more than {_1} MB nazwy w księdze kolorów zajmują ponad {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution obraz miałby {w} × {h} pikseli; eksport rastrowy jest ograniczony do {MAX_RASTER_SIDE} pikseli na bok i {_1} megapikseli: zmniejsz skalę lub rozdzielczość +@msg the optimised image can't be read back: {e} nie można ponownie odczytać zoptymalizowanego obrazu: {e} +@msg the pixel buffer doesn't match the image size bufor pikseli nie odpowiada rozmiarowi obrazu +@msg the preview: {e} podgląd: {e} +@msg the request may not read the New Document profiles folder żądanie nie ma uprawnień do odczytu folderu profili nowego dokumentu +@msg the shapes are too degenerate to combine kształty są zbyt zdegenerowane, aby je połączyć +@msg the shapes cross themselves and each other too often to combine kształty zbyt często przecinają same siebie i siebie nawzajem, aby je połączyć +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups plik wymiany próbek zawiera ponad {ASE_MAX_ENTRIES} kolorów i grup +@msg the swatch exchange file is cut short plik wymiany próbek jest ucięty +@msg the {_1} plate can't be read: {e} nie można odczytać płyty {_1}: {e} +@msg this binary DXF file is damaged or cut short ten binarny plik DXF jest uszkodzony lub ucięty +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that to rysunek DWG, którego nie można odczytać: zapisz go w programie CAD jako DXF i otwórz ten plik +@msg too many classes zbyt wiele klas +@msg too many groups zbyt wiele grup +@msg too many layers for PSD (at most 32767) zbyt wiele warstw dla formatu PSD (najwyżej 32767) +@msg too many swatch exchange blocks zbyt wiele bloków pliku wymiany próbek +@msg unknown colour profile: {0} nieznany profil kolorów: {0} +@msg {_1} clashes with a built-in profile name {_1} koliduje z nazwą wbudowanego profilu +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pikseli to za dużo dla formatu GIF (najwyżej 65535 pikseli na bok): zmniejsz rozdzielczość +@msg {_1}: no usable transform to/from sRGB {_1}: brak użytecznej transformacji do lub z sRGB +@msg {name} is not a CMYK profile {name} nie jest profilem CMYK +@msg {name} is not an RGB profile {name} nie jest profilem RGB +@msg {path}: could not be read {path}: nie udało się odczytać +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pikseli to za dużo dla formatu JPEG (najwyżej 65535 pikseli na bok): zmniejsz rozdzielczość +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pikseli to za dużo dla formatu Targa (najwyżej 65535 pikseli na bok): zmniejsz rozdzielczość +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pikseli to za dużo dla formatu PSD (najwyżej {MAX_SIDE} pikseli na bok): zmniejsz rozdzielczość diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index f6e54552d4..79c4d9dc8e 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -631,6 +631,8 @@ antiAlias Sharp Nítido Crop Image Recortar Imagem Image Tools Ferramentas de imagem Remove Background… Remover Fundo… + Draw (Pencil) Desenhar (Lápis) + Place Image Colocar Imagem Remove Background Remover Fundo Background Fundo Edge Color Cor da Borda @@ -2230,6 +2232,7 @@ antiAlias Sharp Nítido Proportional Metrics Métrica Proporcional Insert Aki Left Inserir Aki à Esquerda Insert Aki Right Inserir Aki à Direita + Tsume Tsume Character Direction Direção de Caracteres Digits Dígitos Arabic Arábicos @@ -3490,6 +3493,7 @@ imageTrace Outline Contorno VectorCraft Title Bar on Every Desktop Barra de título do VectorCraft em todas as áreas de trabalho The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Enquanto estiver definida, a variável de ambiente VECTORCRAFT_TITLEBAR escolhe a barra de título. System Title Bar takes precedence over this option while it is on. Enquanto estiver ativada, Barra de título do sistema tem prioridade sobre esta opção. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Enquanto Barra de título do VectorCraft em todas as áreas de trabalho estiver desativada, esta área de trabalho desenha a barra de título da janela com esta opção ativada ou desativada. Exit Sair Distort Distorcer Diffuse Glow… Brilho difuso… @@ -3952,6 +3956,7 @@ axis Both Ambos @msg `select` must be true or false `select` deve ser true ou false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` e `maxAnchors` devem ser números inteiros @msg `{key}` must be a number not below 0 `{key}` deve ser um número não inferior a 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` deve ser quatro números não inferiores a 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` deve ser [x, y, width, height]: quatro números finitos, com largura e altura não negativas @msg `{min_key}` is greater than `{max_key}` `{min_key}` é maior que `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` informe pelo menos um de `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4194,6 +4199,7 @@ axis Both Ambos @msg no action set to save nenhum conjunto de ações para salvar @msg the action set file can't be read in full o arquivo de conjunto de ações não pode ser lido por inteiro @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out “{name}” carregado: {n} etapa foi omitida|“{name}” carregado: {n} etapas foram omitidas +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` “{name}” carregado: {n} etapa tem um comando desconhecido e foi mantida: “{action}”, etapa {step}, `{command}`|“{name}” carregado: {n} etapas têm comandos desconhecidos e foram mantidas; a primeira: “{action}”, etapa {step}, `{command}` @msg not an action set file não é um arquivo de conjunto de ações @msg the action set file is larger than 8 MiB o arquivo de conjunto de ações tem mais de 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: a referência teria mais de {MAX_BYTES} bytes @@ -4433,6 +4439,7 @@ axis Both Ambos @msg tool shortcuts must be a single key (optionally with Shift) os atalhos de ferramenta devem ser uma única tecla (opcionalmente com Shift) @msg truncated truncado @msg unknown command `{0}` comando desconhecido `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` a etapa {step} de “{action}” executa o comando desconhecido `{command}` @msg unknown command `{0}`; did you mean `{1}`? comando desconhecido `{0}`; você quis dizer `{1}`? @msg unknown effect `{id}` efeito desconhecido `{id}` @msg unknown format formato desconhecido @@ -6304,8 +6311,8 @@ axis Y Axis Eixo Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` um plug-in de exportação declara de 1 a {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` no máximo {MAX_UNGROUPED} parâmetros fora de grupos: dê um `group` aos outros @msg can't encode the input não é possível codificar a entrada -@msg expected {"dataBase64"} esperado {"dataBase64"} -@msg expected {"objects"} esperado {"objects"} +@msg expected {{"dataBase64": "…"}} esperado {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} esperado {{"objects": [...]}} @msg export `{name}`: {e} exportação do módulo `{name}`: {e} @msg extension {e} is listed twice a extensão {e} aparece duas vezes @msg extension {e}: use 1-16 lower-case letters and digits, without the dot extensão {e}: use 1-16 letras minúsculas e dígitos, sem o ponto @@ -6369,11 +6376,11 @@ axis Y Axis Eixo Y @msg a painted live effect returns only `objects` um efeito dinâmico de pintura retorna apenas `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` uma peça de um efeito dinâmico de pintura tem apenas `path`, `fillRule`, `fills` e `strokes` @msg a read-only object was left out um objeto somente leitura foi omitido -@msg a read-only object was left out: return it, as {"id"} alone or as it was given um objeto somente leitura foi omitido: retorne-o como {"id"} sozinho ou como foi recebido +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given um objeto somente leitura foi omitido: retorne-o como {{"id": …}} sozinho ou como foi recebido @msg a string uma string @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` um traçado tem apenas `paint`, `width`, `join`, `cap` e `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} um traçado deve ser {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} um efeito deve ser {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} um traçado deve ser {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} um efeito deve ser {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` um efeito em um preenchimento retorna apenas `fills` @msg an effect on a stroke returns only `strokes` um efeito em um traçado retorna apenas `strokes` @msg an object must be a JSON object um objeto deve ser um objeto JSON @@ -6515,6 +6522,8 @@ axis Y Axis Eixo Y Action Options… Opções da Ação… Action Options Opções da Ação Playback Options… Opções de Reprodução… + Button Mode Modo de Botão + No actions. Nenhuma ação. Insert Stop… Inserir Parada… Insert Stop Inserir Parada Record Stop Gravar Parada @@ -7042,6 +7051,122 @@ breakText Glyphs Glifos @msg save the document with Save As before Save and Close salve o documento com Salvar Como antes de Salvar e fechar @msg no free data set file name in destination folder Não há nome de arquivo livre para o conjunto de dados na pasta de destino +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points Os efeitos 3D exigem coordenadas finitas de até 100 milhões de pontos +@msg 3D effects require one to ten lights Os efeitos 3D exigem de uma a dez luzes +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Profundidade BMP {_1}: 1, 4, 8, 16, 24 ou 32 bits por pixel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Falha na codificação BMP: {width} × {height} pixels não cabem no formato ou no buffer de pixels +@msg GIF encoding failed: the palette image is malformed Falha na codificação GIF: a imagem de paleta está malformada +@msg GIF encoding failed: {e} Falha na codificação GIF: {e} +@msg JPEG colour profile: {e} Perfil de cor JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Falha na codificação JPEG: o buffer de pixels não corresponde ao tamanho da imagem +@msg JPEG encoding failed: {e} Falha na codificação JPEG: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Falha na codificação PNG: o buffer de pixels não corresponde ao tamanho da imagem +@msg PNG encoding failed: the palette image is malformed Falha na codificação PNG: a imagem de paleta está malformada +@msg PNG encoding failed: {e} Falha na codificação PNG: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Falha na codificação PNG: {width} × {height} pixels não é um tamanho de imagem válido +@msg PSD colour profile: {e} Perfil de cor PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Falha na codificação PSD: o buffer de pixels não corresponde ao tamanho da imagem +@msg Revolve profile contains invalid coordinates O perfil de Revolver contém coordenadas inválidas +@msg Revolve profile is too complex O perfil de Revolver é complexo demais +@msg Revolve projection is not finite A projeção de Revolver não é finita +@msg Revolve requires finite profile coordinates within 100 million points Revolver exige coordenadas de perfil finitas de até 100 milhões de pontos +@msg Revolve surface is too complex; reduce Segments or simplify the profile A superfície de Revolver é complexa demais; reduza Segmentos ou simplifique o perfil +@msg Revolve surface is too complex; simplify the profile A superfície de Revolver é complexa demais; simplifique o perfil +@msg Revolve visibility cannot split the projected boundary A visibilidade de Revolver não consegue dividir o contorno projetado +@msg Revolve visibility creates too many fragments A visibilidade de Revolver cria fragmentos demais +@msg Revolve visibility creates too many vector anchors A visibilidade de Revolver cria pontos de ancoragem vetoriais demais +@msg Revolve visibility exceeds its geometry work limit A visibilidade de Revolver excede seu limite de trabalho geométrico +@msg Revolve visibility exceeds its spatial index limit A visibilidade de Revolver excede seu limite de índice espacial +@msg Revolve visibility has too many boundary crossings A visibilidade de Revolver tem cruzamentos de contorno demais +@msg Revolve visibility has too many input anchors A visibilidade de Revolver tem pontos de ancoragem de entrada demais +@msg Revolve visibility requires convex cap sectors A visibilidade de Revolver exige setores de tampa convexos +@msg Revolve visibility requires finite projected faces A visibilidade de Revolver exige faces projetadas finitas +@msg SVG options: {e} Opções SVG: {e} +@msg Save for Web settings: {e} Configurações de Salvar para a Web: {e} +@msg TIFF colour profile: {e} Perfil de cor TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Falha na codificação TIFF: o buffer de pixels não corresponde ao tamanho da imagem +@msg TIFF encoding failed: {e} Falha na codificação TIFF: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Profundidade Targa {_1}: 16, 24 ou 32 bits por pixel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Falha na codificação Targa: o buffer de pixels não corresponde ao tamanho da imagem +@msg The 3D projection is not finite A projeção 3D não é finita +@msg The 3D shadow is too complex; turn Shadows off or simplify the art A sombra 3D é complexa demais; desative Sombras ou simplifique a arte +@msg The shape contains invalid coordinates A forma contém coordenadas inválidas +@msg Too many Revolve faces for visibility evaluation Faces de Revolver demais para avaliar a visibilidade +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} O VectorCraft lê no máximo {ASE_MAX_ENTRIES} cores e grupos de um arquivo de intercâmbio de amostras, e esta biblioteca tem {entries} +@msg WebP encoding failed: {e} Falha na codificação WebP: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` é smallThumb, mediumThumb, largeThumb, smallList ou largeList +@msg a line can't run from a point to itself uma linha não pode ir de um ponto até ele mesmo +@msg a line needs at least two points uma linha precisa de pelo menos dois pontos +@msg a number cannot be read um número não pode ser lido +@msg a swatch exchange block is too long um bloco de intercâmbio de amostras é longo demais +@msg a swatch exchange name is too long um nome de intercâmbio de amostras é longo demais +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels uma imagem de {sw} × {sh} não pode ser redimensionada para {width} × {height} pixels +@msg a {width} × {height} image is too large uma imagem de {width} × {height} é grande demais +@msg a {width} × {height} image: {e} uma imagem de {width} × {height}: {e} +@msg an image could not be written: {e} não foi possível gravar uma imagem: {e} +@msg an image that couldn't be read was left out uma imagem que não pôde ser lida foi omitida +@msg can't open “{name}”: {e} não é possível abrir “{name}”: {e} +@msg cannot align zip entries to {align} bytes não é possível alinhar as entradas do zip a {align} bytes +@msg cannot open the automation {kind} root `{_1}`: {e} não é possível abrir a raiz de {kind} da automação `{_1}`: {e} +@msg cannot read profile: {0} não é possível ler o perfil: {0} +@msg color book version {version} isn't supported (only 1) a versão {version} do livro de cores não tem suporte (somente 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) livros de cores no espaço de cores {other} não têm suporte (somente RGB, CMYK e Lab) +@msg file name too long to zip: {_1} nome de arquivo longo demais para o zip: {_1} +@msg file name too long to zip: {name} nome de arquivo longo demais para o zip: {name} +@msg freeform line {i}: {e} linha {i} de forma livre: {e} +@msg freeform point {i}: {e} ponto {i} de forma livre: {e} +@msg give `{key}` or `{other}`, not both informe `{key}` ou `{other}`, não ambos +@msg grayscale profiles can't be working spaces yet perfis em escala de cinza ainda não podem ser espaços de trabalho de cores +@msg input contains NaN or infinite coordinates a entrada contém coordenadas NaN ou infinitas +@msg input path could not be closed não foi possível fechar o caminho de entrada +@msg invalid ICC profile: {0} perfil ICC inválido: {0} +@msg invalid scale {scale} escala inválida {scale} +@msg its localized names take more than {_1} KB seus nomes localizados ocupam mais de {_1} KB +@msg its objects are nested too deep ({e}) seus objetos estão aninhados profundamente demais ({e}) +@msg its tag table lists the `{_1}` tag more than once sua tabela de tags lista a tag `{_1}` mais de uma vez +@msg not a graphic style library: {e} não é uma biblioteca de estilos gráficos: {e} +@msg not a swatch library (.vcswatches or .gpl) não é uma biblioteca de amostras (.vcswatches ou .gpl) +@msg not a swatch library (format `{_1}`) não é uma biblioteca de amostras (formato `{_1}`) +@msg not a swatch library: {e} não é uma biblioteca de amostras: {e} +@msg not an action set file ({e}) não é um arquivo de conjunto de ações ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray o espaço de cores do perfil, {other}, não é RGB, CMYK ou Cinza +@msg regular expression too large expressão regular grande demais +@msg script file is not UTF-8 text: {value} o arquivo de script não é texto UTF-8: {value} +@msg stop {i}: {e} parada {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) a versão {major}.{minor} de intercâmbio de amostras não tem suporte (somente 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors o livro de cores contém mais de {ASE_MAX_ENTRIES} cores +@msg the color book is cut short o livro de cores está incompleto +@msg the color book's names take more than {_1} MB os nomes do livro de cores ocupam mais de {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution a imagem teria {w} × {h} pixels; as exportações raster são limitadas a {MAX_RASTER_SIDE} pixels por lado e {_1} megapixels: reduza a escala ou a resolução +@msg the optimised image can't be read back: {e} a imagem otimizada não pode ser lida de volta: {e} +@msg the pixel buffer doesn't match the image size o buffer de pixels não corresponde ao tamanho da imagem +@msg the preview: {e} a visualização: {e} +@msg the request may not read the New Document profiles folder a solicitação não tem permissão para ler a pasta de perfis de Novo Documento +@msg the shapes are too degenerate to combine as formas são degeneradas demais para combinar +@msg the shapes cross themselves and each other too often to combine as formas se cruzam consigo mesmas e entre si vezes demais para combinar +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups o arquivo de intercâmbio de amostras contém mais de {ASE_MAX_ENTRIES} cores e grupos +@msg the swatch exchange file is cut short o arquivo de intercâmbio de amostras está incompleto +@msg the {_1} plate can't be read: {e} a chapa {_1} não pode ser lida: {e} +@msg this binary DXF file is damaged or cut short este arquivo DXF binário está danificado ou incompleto +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that este é um desenho DWG, que não pode ser lido: salve-o no aplicativo de CAD como DXF e abra esse arquivo +@msg too many classes classes demais +@msg too many groups grupos demais +@msg too many layers for PSD (at most 32767) camadas demais para PSD (no máximo 32767) +@msg too many swatch exchange blocks blocos de intercâmbio de amostras demais +@msg unknown colour profile: {0} perfil de cor desconhecido: {0} +@msg {_1} clashes with a built-in profile name {_1} coincide com o nome de um perfil integrado +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixels é grande demais para GIF (no máximo 65535 pixels por lado): reduza a resolução +@msg {_1}: no usable transform to/from sRGB {_1}: nenhuma transformação utilizável de/para sRGB +@msg {name} is not a CMYK profile {name} não é um perfil CMYK +@msg {name} is not an RGB profile {name} não é um perfil RGB +@msg {path}: could not be read {path}: não foi possível ler +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pixels é grande demais para JPEG (no máximo 65535 pixels por lado): reduza a resolução +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pixels é grande demais para Targa (no máximo 65535 pixels por lado): reduza a resolução +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixels é grande demais para PSD (no máximo {MAX_SIDE} pixels por lado): reduza a resolução + # Path Precision Tools add-on: Path Effects (Effect › Path Effects). Distance Distância Mode Modo @@ -7270,7 +7395,7 @@ swatch Lime Lima Line Weight: Espessura da linha: Load Variable Library Carregar biblioteca de variáveis swatch Magenta Magenta -@msg not an RTF file: it doesn't start with {\\rtf não é um arquivo RTF: ele não começa com {\\rtf +@msg not an RTF file: it doesn't start with {{\\rtf não é um arquivo RTF: ele não começa com {{\\rtf swatch Ocean Oceano shape Open Aberta swatch Orange Laranja @@ -7536,6 +7661,12 @@ swatch Yellow Green Verde-amarelado @msg open the practice sample of `{id}` first (see learn.openSample) abra primeiro a amostra de prática de `{id}` (veja learn.openSample) @msg finish `{id}` first (see learn.finish) conclua primeiro `{id}` (veja learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` é o último tutorial da sua habilidade + Reset progress Redefinir progresso + Mark Tutorial Step Marcar Etapa do Tutorial + Reset Learn Progress Redefinir Progresso de Aprendizagem +@msg missing `step` (see learn.show) falta `step` (veja learn.show) +@msg `step` must be a step number from 0 to {last} `step` deve ser um número de etapa de 0 a {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` está concluído (veja learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Atualizar Efeitos Adiados @@ -7641,7 +7772,7 @@ swatch Yellow Green Verde-amarelado @msg `alignOn` must be a string `alignOn` deve ser uma string @msg `align` is start, center or end `align` é start, center ou end @msg `align` must be a string `align` deve ser uma string -@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` deve ser uma matriz de pares [subcaminho, ponto de ancoragem] +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` deve ser uma matriz de pares [subpath, anchor] @msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` deve listar índices de pontos de ancoragem (0, 1, 2…), não {k} @msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` deve listar índices de pontos de ancoragem (0, 1, 2…), não {v} @msg `answer` for this {kind} dialog must be one of: {_1} `answer` para esta caixa de diálogo {kind} deve ser um de: {_1} @@ -7706,7 +7837,7 @@ swatch Yellow Green Verde-amarelado @msg `fidelity` must be from {lo} to {hi} pt `fidelity` deve estar entre {lo} e {hi} pt @msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` deve ter de 1 a 1000 caminhos de arquivos de fonte encontrados pela última pesquisa de text.findFontFiles @msg `focal` and `radius` cannot be used together `focal` e `radius` não podem ser usados juntos -@msg `focal` must be an array of [subpath, anchor] pairs `focal` deve ser uma matriz de pares [subcaminho, ponto de ancoragem] +@msg `focal` must be an array of [subpath, anchor] pairs `focal` deve ser uma matriz de pares [subpath, anchor] @msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal` indica [{si}, {ai}], que não é um ponto de ancoragem do caminho @msg `folder` must be an absolute folder path `folder` deve ser um caminho absoluto de pasta @msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` deve ser um objeto de tags de eixo e valores, como {"wght"} @@ -8371,7 +8502,7 @@ swatch Yellow Green Verde-amarelado @msg instruction {pc} reached with stack depths {seen} and {d} instrução {pc} alcançada com profundidades de pilha {seen} e {d} @msg invalid `color` `color` inválido @msg invalid anchor index {v}: expected a non-negative integer índice de ponto de ancoragem inválido {v}: esperado um inteiro não negativo -@msg invalid anchor reference {v}: expected [subpath, anchor] referência de ponto de ancoragem inválida {v}: esperado [subcaminho, ponto de ancoragem] +@msg invalid anchor reference {v}: expected [subpath, anchor] referência de ponto de ancoragem inválida {v}: esperado [subpath, anchor] @msg invalid angle ângulo inválido @msg invalid array length comprimento de matriz inválido @msg invalid brush: {e} pincel inválido: {e} @@ -8480,7 +8611,7 @@ swatch Yellow Green Verde-amarelado @msg missing `{k}` falta `{k}` @msg missing anchor falta o ponto de ancoragem @msg missing anchors faltam os pontos de ancoragem -@msg missing anchors [[subpath, anchor]…] faltam os pontos de ancoragem [[subcaminho, ponto de ancoragem]…] +@msg missing anchors [[subpath, anchor]…] faltam os pontos de ancoragem [[subpath, anchor]…] @msg missing array `{key}` falta a matriz `{key}` @msg missing case falta case @msg missing color falta a cor diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 8dc8336089..9f608618e7 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -703,6 +703,8 @@ font-technology Variable Вариативные Crop Image Обрезать изображение Image Tools Инструменты изображения Remove Background… Удалить фон… + Draw (Pencil) Рисовать (Карандаш) + Place Image Поместить изображение Remove Background Удалить фон Background Фон Edge Color Цвет края @@ -2693,6 +2695,7 @@ mark-style Japanese Японский Proportional Metrics Пропорциональные метрики Insert Aki Left Вставить аки слева Insert Aki Right Вставить аки справа + Tsume Цумэ Character Direction Направление символов Digits Цифры Arabic Арабские @@ -4526,6 +4529,7 @@ axis Both Оба @msg `select` must be true or false `select` должно быть true или false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` и `maxAnchors` должны быть целыми числами @msg `{key}` must be a number not below 0 `{key}` должно быть числом не меньше 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` должно быть четырьмя числами не меньше 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` должно быть [x, y, width, height]: четыре конечных числа, ширина и высота не отрицательные @msg `{min_key}` is greater than `{max_key}` `{min_key}` больше, чем `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` укажите хотя бы один из параметров `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4778,6 +4782,7 @@ axis Both Оба @msg no action set to save нет набора действий для сохранения @msg the action set file can't be read in full файл набора действий невозможно прочитать целиком @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Загружено «{name}»: пропущен {n} шаг|Загружено «{name}»: пропущено {n} шага|Загружено «{name}»: пропущено {n} шагов +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Загружено «{name}»: {n} шаг с неизвестной командой сохранён: «{action}», шаг {step}, `{command}`|Загружено «{name}»: {n} шага с неизвестными командами сохранены; первый: «{action}», шаг {step}, `{command}`|Загружено «{name}»: {n} шагов с неизвестными командами сохранены; первый: «{action}», шаг {step}, `{command}` @msg not an action set file это не файл набора действий @msg the action set file is larger than 8 MiB файл набора действий больше 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: справочник был бы больше {MAX_BYTES} байт @@ -5019,6 +5024,7 @@ axis Both Оба @msg tool shortcuts must be a single key (optionally with Shift) сочетания инструментов должны быть одной клавишей (необязательно с Shift) @msg truncated усечено @msg unknown command `{0}` неизвестная команда `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` шаг {step} действия «{action}» выполняет неизвестную команду `{command}` @msg unknown command `{0}`; did you mean `{1}`? неизвестная команда `{0}`; возможно, имелась в виду `{1}`? @msg unknown effect `{id}` неизвестный эффект `{id}` @msg unknown format неизвестный формат @@ -5362,6 +5368,7 @@ axis Both Оба VectorCraft Title Bar on Every Desktop Строка заголовка VectorCraft на любом рабочем столе The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Пока переменная среды VECTORCRAFT_TITLEBAR задана, строку заголовка выбирает она. System Title Bar takes precedence over this option while it is on. Пока включена «Системная строка заголовка», она имеет приоритет над этим параметром. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Пока «Строка заголовка VectorCraft на любом рабочем столе» выключена, этот рабочий стол рисует строку заголовка окна независимо от того, включён ли этот параметр. Value Axis Ось значений On Left Side Слева On Right Side Справа @@ -6000,8 +6007,8 @@ axis Y Axis Ось Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` модуль экспорта объявляет от 1 до {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` вне групп может быть не более {MAX_UNGROUPED} параметров: задайте остальным `group` @msg can't encode the input не удаётся закодировать входные данные -@msg expected {"dataBase64"} ожидалось {"dataBase64"} -@msg expected {"objects"} ожидалось {"objects"} +@msg expected {{"dataBase64": "…"}} ожидалось {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} ожидалось {{"objects": [...]}} @msg export `{name}`: {e} экспорт модуля `{name}`: {e} @msg extension {e} is listed twice расширение {e} указано дважды @msg extension {e}: use 1-16 lower-case letters and digits, without the dot расширение {e}: используйте 1-16 строчных букв и цифр, без точки @@ -6065,11 +6072,11 @@ axis Y Axis Ось Y @msg a painted live effect returns only `objects` рисующий динамический эффект возвращает только `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` у части рисующего динамического эффекта есть только `path`, `fillRule`, `fills` и `strokes` @msg a read-only object was left out пропущен объект только для чтения -@msg a read-only object was left out: return it, as {"id"} alone or as it was given пропущен объект только для чтения: верните его как один {"id"} или в том виде, в каком он был передан +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given пропущен объект только для чтения: верните его как один {{"id": …}} или в том виде, в каком он был передан @msg a string строка @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` у обводки есть только `paint`, `width`, `join`, `cap` и `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} обводка должна иметь вид {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} эффект должен иметь вид {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} обводка должна иметь вид {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} эффект должен иметь вид {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` эффект на заливке возвращает только `fills` @msg an effect on a stroke returns only `strokes` эффект на обводке возвращает только `strokes` @msg an object must be a JSON object объект должен быть объектом JSON @@ -6211,6 +6218,8 @@ axis Y Axis Ось Y Action Options… Параметры действия… Action Options Параметры действия Playback Options… Параметры воспроизведения… + Button Mode Режим кнопок + No actions. Нет действий. Insert Stop… Вставить остановку… Insert Stop Вставить остановку Record Stop Записать остановку @@ -7375,7 +7384,7 @@ breakText Glyphs Глифы @id pathfinder.add Объединить @msg give corners of the path: anchors between two straight sides укажите углы контура: опорные точки между двумя прямыми сторонами @msg image '{key}' has no pixels and was left out изображение '{key}' не содержит пикселов и было пропущено -@msg not an RTF file: it doesn't start with {\\rtf это не файл RTF: он не начинается с {\\rtf +@msg not an RTF file: it doesn't start with {{\\rtf это не файл RTF: он не начинается с {{\\rtf @msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), which can't be opened yet: save it as PDF, PDF-compatible .ai or SVG это файл PostScript (.ai, сохранённый в старом формате или без совместимости с PDF, либо EPS-файл), который пока нельзя открыть: сохраните его как PDF, .ai с совместимостью с PDF или SVG @msg this kind of brush has no options dialog yet у кистей этого типа пока нет диалога параметров digits Hindi Хинди @@ -7552,6 +7561,12 @@ shape Open Открытый @msg open the practice sample of `{id}` first (see learn.openSample) сначала откройте учебный пример урока `{id}` (см. learn.openSample) @msg finish `{id}` first (see learn.finish) сначала завершите `{id}` (см. learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` является последним уроком своего навыка + Reset progress Сбросить прогресс + Mark Tutorial Step Отметить шаг урока + Reset Learn Progress Сбросить прогресс обучения +@msg missing `step` (see learn.show) отсутствует `step` (см. learn.show) +@msg `step` must be a step number from 0 to {last} `step` должен быть номером шага от 0 до {last} +@msg `{id}` is finished (see learn.resetProgress) урок `{id}` завершён (см. learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Обновить отложенные эффекты @@ -7581,3 +7596,119 @@ shape Open Открытый Grommets Люверсы Grommet Inset Отступ люверсов от края Diameter Диаметр + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D-эффектам нужны конечные координаты в пределах 100 миллионов пунктов +@msg 3D effects require one to ten lights 3D-эффектам нужно от одного до десяти источников света +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel Глубина цвета BMP {_1}: допустимо 1, 4, 8, 16, 24 или 32 бита на пиксель +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer Ошибка кодирования BMP: {width} × {height} пикселей не соответствует формату или буферу пикселей +@msg GIF encoding failed: the palette image is malformed Ошибка кодирования GIF: изображение с палитрой имеет неверную структуру +@msg GIF encoding failed: {e} Ошибка кодирования GIF: {e} +@msg JPEG colour profile: {e} Цветовой профиль JPEG: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size Ошибка кодирования JPEG: буфер пикселей не соответствует размеру изображения +@msg JPEG encoding failed: {e} Ошибка кодирования JPEG: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size Ошибка кодирования PNG: буфер пикселей не соответствует размеру изображения +@msg PNG encoding failed: the palette image is malformed Ошибка кодирования PNG: изображение с палитрой имеет неверную структуру +@msg PNG encoding failed: {e} Ошибка кодирования PNG: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size Ошибка кодирования PNG: {width} × {height} пикселей — недопустимый размер изображения +@msg PSD colour profile: {e} Цветовой профиль PSD: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size Ошибка кодирования PSD: буфер пикселей не соответствует размеру изображения +@msg Revolve profile contains invalid coordinates Профиль вращения содержит недопустимые координаты +@msg Revolve profile is too complex Профиль вращения слишком сложен +@msg Revolve projection is not finite Проекция вращения не является конечной +@msg Revolve requires finite profile coordinates within 100 million points Для вращения нужны конечные координаты профиля в пределах 100 миллионов пунктов +@msg Revolve surface is too complex; reduce Segments or simplify the profile Поверхность вращения слишком сложна; уменьшите «Сегменты» или упростите профиль +@msg Revolve surface is too complex; simplify the profile Поверхность вращения слишком сложна; упростите профиль +@msg Revolve visibility cannot split the projected boundary Расчёт видимости вращения не может разделить спроецированную границу +@msg Revolve visibility creates too many fragments Расчёт видимости вращения создаёт слишком много фрагментов +@msg Revolve visibility creates too many vector anchors Расчёт видимости вращения создаёт слишком много векторных опорных точек +@msg Revolve visibility exceeds its geometry work limit Расчёт видимости вращения превышает свой предел геометрических вычислений +@msg Revolve visibility exceeds its spatial index limit Расчёт видимости вращения превышает свой предел пространственного индекса +@msg Revolve visibility has too many boundary crossings В расчёте видимости вращения слишком много пересечений границы +@msg Revolve visibility has too many input anchors В расчёте видимости вращения слишком много входных опорных точек +@msg Revolve visibility requires convex cap sectors Для расчёта видимости вращения нужны выпуклые секторы торцов +@msg Revolve visibility requires finite projected faces Для расчёта видимости вращения нужны конечные спроецированные грани +@msg SVG options: {e} Параметры SVG: {e} +@msg Save for Web settings: {e} Параметры «Сохранить для web»: {e} +@msg TIFF colour profile: {e} Цветовой профиль TIFF: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size Ошибка кодирования TIFF: буфер пикселей не соответствует размеру изображения +@msg TIFF encoding failed: {e} Ошибка кодирования TIFF: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Глубина цвета Targa {_1}: допустимо 16, 24 или 32 бита на пиксель +@msg Targa encoding failed: the pixel buffer doesn't match the image size Ошибка кодирования Targa: буфер пикселей не соответствует размеру изображения +@msg The 3D projection is not finite 3D-проекция не является конечной +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D-тень слишком сложна; отключите «Тени» или упростите графику +@msg The shape contains invalid coordinates Фигура содержит недопустимые координаты +@msg Too many Revolve faces for visibility evaluation Слишком много граней вращения для расчёта видимости +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft читает из файла обмена образцами не более {ASE_MAX_ENTRIES} цветов и групп, а в этой библиотеке их {entries} +@msg WebP encoding failed: {e} Ошибка кодирования WebP: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` принимает значения smallThumb, mediumThumb, largeThumb, smallList или largeList +@msg a line can't run from a point to itself линия не может идти от точки к самой себе +@msg a line needs at least two points линии нужны хотя бы две точки +@msg a number cannot be read не удаётся прочитать число +@msg a swatch exchange block is too long блок файла обмена образцами слишком длинный +@msg a swatch exchange name is too long имя в файле обмена образцами слишком длинное +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels размер изображения {sw} × {sh} нельзя изменить до {width} × {height} пикселей +@msg a {width} × {height} image is too large изображение {width} × {height} слишком велико +@msg a {width} × {height} image: {e} изображение {width} × {height}: {e} +@msg an image could not be written: {e} не удалось записать изображение: {e} +@msg an image that couldn't be read was left out изображение, которое не удалось прочитать, пропущено +@msg can't open “{name}”: {e} не удаётся открыть «{name}»: {e} +@msg cannot align zip entries to {align} bytes не удаётся выровнять записи zip по {align} байт +@msg cannot open the automation {kind} root `{_1}`: {e} не удаётся открыть корневую папку автоматизации ({kind}) `{_1}`: {e} +@msg cannot read profile: {0} не удаётся прочитать профиль: {0} +@msg color book version {version} isn't supported (only 1) версия цветовой книги {version} не поддерживается (только 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) цветовые книги в цветовом пространстве {other} не поддерживаются (только RGB, CMYK и Lab) +@msg file name too long to zip: {_1} имя файла слишком длинное для zip: {_1} +@msg file name too long to zip: {name} имя файла слишком длинное для zip: {name} +@msg freeform line {i}: {e} произвольная линия {i}: {e} +@msg freeform point {i}: {e} произвольная точка {i}: {e} +@msg give `{key}` or `{other}`, not both укажите `{key}` или `{other}`, но не то и другое +@msg grayscale profiles can't be working spaces yet профили оттенков серого пока не могут быть рабочими пространствами +@msg input contains NaN or infinite coordinates входные данные содержат координаты NaN или бесконечные координаты +@msg input path could not be closed не удалось замкнуть входной контур +@msg invalid ICC profile: {0} недопустимый профиль ICC: {0} +@msg invalid scale {scale} недопустимый масштаб {scale} +@msg its localized names take more than {_1} KB его локализованные имена занимают более {_1} КБ +@msg its objects are nested too deep ({e}) его объекты вложены слишком глубоко ({e}) +@msg its tag table lists the `{_1}` tag more than once в его таблице тегов тег `{_1}` указан более одного раза +@msg not a graphic style library: {e} не библиотека графических стилей: {e} +@msg not a swatch library (.vcswatches or .gpl) не библиотека образцов (.vcswatches или .gpl) +@msg not a swatch library (format `{_1}`) не библиотека образцов (формат `{_1}`) +@msg not a swatch library: {e} не библиотека образцов: {e} +@msg not an action set file ({e}) не файл набора действий ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray цветовое пространство профиля {other} не является RGB, CMYK или оттенками серого +@msg regular expression too large регулярное выражение слишком велико +@msg script file is not UTF-8 text: {value} файл скрипта не является текстом UTF-8: {value} +@msg stop {i}: {e} точка перехода {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) версия файла обмена образцами {major}.{minor} не поддерживается (только 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors в цветовой книге больше {ASE_MAX_ENTRIES} цветов +@msg the color book is cut short цветовая книга обрезана +@msg the color book's names take more than {_1} MB имена цветовой книги занимают более {_1} МБ +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution изображение имело бы размер {w} × {h} пикселей; растровый экспорт ограничен {MAX_RASTER_SIDE} пикселями по стороне и {_1} мегапикселями: уменьшите масштаб или разрешение +@msg the optimised image can't be read back: {e} оптимизированное изображение не удаётся прочитать обратно: {e} +@msg the pixel buffer doesn't match the image size буфер пикселей не соответствует размеру изображения +@msg the preview: {e} изображение для просмотра: {e} +@msg the request may not read the New Document profiles folder запросу не разрешено читать папку профилей нового документа +@msg the shapes are too degenerate to combine фигуры слишком вырождены для объединения +@msg the shapes cross themselves and each other too often to combine фигуры слишком часто пересекают себя и друг друга для объединения +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups в файле обмена образцами больше {ASE_MAX_ENTRIES} цветов и групп +@msg the swatch exchange file is cut short файл обмена образцами обрезан +@msg the {_1} plate can't be read: {e} не удаётся прочитать пластину {_1}: {e} +@msg this binary DXF file is damaged or cut short этот двоичный файл DXF повреждён или обрезан +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that это чертёж DWG, который невозможно прочитать: сохраните его из приложения CAD как DXF и откройте его +@msg too many classes слишком много классов +@msg too many groups слишком много групп +@msg too many layers for PSD (at most 32767) слишком много слоёв для PSD (не более 32767) +@msg too many swatch exchange blocks слишком много блоков в файле обмена образцами +@msg unknown colour profile: {0} неизвестный цветовой профиль: {0} +@msg {_1} clashes with a built-in profile name {_1} совпадает с именем встроенного профиля +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} пикселей — слишком большой размер для GIF (не более 65535 пикселей по стороне): уменьшите разрешение +@msg {_1}: no usable transform to/from sRGB {_1}: нет пригодного преобразования в sRGB или из sRGB +@msg {name} is not a CMYK profile {name} — не профиль CMYK +@msg {name} is not an RGB profile {name} — не профиль RGB +@msg {path}: could not be read {path}: не удалось прочитать +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} пикселей — слишком большой размер для JPEG (не более 65535 пикселей по стороне): уменьшите разрешение +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} пикселей — слишком большой размер для Targa (не более 65535 пикселей по стороне): уменьшите разрешение +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} пикселей — слишком большой размер для PSD (не более {MAX_SIDE} пикселей по стороне): уменьшите разрешение diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index cfb9d9734b..6156ca23d5 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -693,6 +693,8 @@ font-technology Variable Variabla Crop Image Beskär bild Image Tools Bildverktyg Remove Background… Ta bort bakgrund… + Draw (Pencil) Rita (blyertspenna) + Place Image Placera bild Remove Background Ta bort bakgrund Background Bakgrund Edge Color Kantfärg @@ -2601,6 +2603,7 @@ font-technology Variable Variabla Proportional Metrics Proportionella mått Insert Aki Left Infoga aki till vänster Insert Aki Right Infoga aki till höger + Tsume Tsume Character Direction Teckenriktning Digits Siffror Arabic Arabiska @@ -4397,6 +4400,7 @@ axis Both Båda @msg `select` must be true or false `select` måste vara true eller false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` och `maxAnchors` måste vara heltal @msg `{key}` must be a number not below 0 `{key}` måste vara ett tal som inte är under 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` måste vara fyra tal som inte är under 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` måste vara [x, y, width, height]: fyra ändliga tal, där bredd och höjd inte är negativa @msg `{min_key}` is greater than `{max_key}` `{min_key}` är större än `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` ange minst en av `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4641,6 +4645,7 @@ axis Both Båda @msg no action set to save ingen åtgärdsuppsättning att spara @msg the action set file can't be read in full filen med åtgärdsuppsättning kan inte läsas helt @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Läste in ”{name}”: {n} steg utelämnades|Läste in ”{name}”: {n} steg utelämnades +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Läste in ”{name}”: {n} steg har ett okänt kommando och behölls: ”{action}”, steg {step}, `{command}`|Läste in ”{name}”: {n} steg har okända kommandon och behölls; det första: ”{action}”, steg {step}, `{command}` @msg not an action set file inte en fil med åtgärdsuppsättning @msg the action set file is larger than 8 MiB filen med åtgärdsuppsättningen är större än 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: referensen skulle bli större än {MAX_BYTES} byte @@ -4875,6 +4880,7 @@ axis Both Båda @msg tool shortcuts must be a single key (optionally with Shift) kortkommandon för verktyg måste vara en enda tangent (eventuellt med Shift) @msg truncated avkortad @msg unknown command `{0}` okänt kommando `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` steg {step} i ”{action}” kör det okända kommandot `{command}` @msg unknown command `{0}`; did you mean `{1}`? okänt kommando `{0}`; menade du `{1}`? @msg unknown effect `{id}` okänd effekt `{id}` @msg unknown format okänt format @@ -5235,6 +5241,7 @@ effect Soft Mjuk VectorCraft Title Bar on Every Desktop VectorCrafts namnlist på alla skrivbord The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Miljövariabeln VECTORCRAFT_TITLEBAR väljer namnlisten så länge den är angiven. System Title Bar takes precedence over this option while it is on. Systemets namnlist har företräde framför det här alternativet så länge den är på. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Så länge VectorCrafts namnlist på alla skrivbord är av ritar det här skrivbordet fönstrets namnlist, oavsett om det här alternativet är på eller av. Value Axis Värdeaxel On Left Side På vänster sida On Right Side På höger sida @@ -6439,11 +6446,11 @@ axis Y Axis Y-axel @msg a painted live effect returns only `objects` en målande live-effekt returnerar bara `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` en del av en målande live-effekt har bara `path`, `fillRule`, `fills` och `strokes` @msg a read-only object was left out ett skrivskyddat objekt utelämnades -@msg a read-only object was left out: return it, as {"id"} alone or as it was given ett skrivskyddat objekt utelämnades: returnera det som enbart {"id"} eller som det gavs +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given ett skrivskyddat objekt utelämnades: returnera det som enbart {{"id": …}} eller som det gavs @msg a string en sträng @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` en kontur har bara `paint`, `width`, `join`, `cap` och `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} en kontur måste vara {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} en effekt måste vara {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} en kontur måste vara {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} en effekt måste vara {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` en effekt på en fyllning returnerar bara `fills` @msg an effect on a stroke returns only `strokes` en effekt på en kontur returnerar bara `strokes` @msg an object must be a JSON object ett objekt måste vara ett JSON-objekt @@ -6580,6 +6587,8 @@ axis Y Axis Y-axel Action Options… Alternativ för åtgärd… Action Options Alternativ för åtgärd Playback Options… Uppspelningsalternativ… + Button Mode Knappläge + No actions. Inga åtgärder. Insert Stop… Infoga stopp… Insert Stop Infoga stopp Record Stop Spela in stopp @@ -6988,7 +6997,7 @@ anchor Points: Punkter: VectorCraft Updates Uppdateringar för VectorCraft Yonroku-ban Yonroku-ban @msg image '{key}' has no pixels and was left out bilden '{key}' har inga pixlar och utelämnades -@msg not an RTF file: it doesn't start with {\\rtf inte en RTF-fil: den börjar inte med {\\rtf +@msg not an RTF file: it doesn't start with {{\\rtf inte en RTF-fil: den börjar inte med {{\\rtf shape Open Öppen # Color Effects add-on: Select by Color Kind. @@ -7545,7 +7554,7 @@ digits Hindi Hindi @msg `{what}` is longer than {MAX_TEXT} bytes `{what}` är längre än {MAX_TEXT} byte @msg `{what}` must be text `{what}` måste vara text @msg `align` is start, center or end `align` är start, center eller end -@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` måste vara en array av par [delbana, ankarpunkt] +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` måste vara en array av par [subpath, anchor] @msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` måste lista ankarpunktsindex (0, 1, 2…), inte {k} @msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` måste lista ankarpunktsindex (0, 1, 2…), inte {v} @msg `artboards` must be a list of artboard indices `artboards` måste vara en lista med ritytsindex @@ -7587,7 +7596,7 @@ digits Hindi Hindi @msg `expand` must be true or false `expand` måste vara true eller false @msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` måste vara 1 till 1000 sökvägar till typsnittsfiler som den senaste text.findFontFiles-sökningen hittade @msg `folder` must be an absolute folder path `folder` måste vara en absolut mappsökväg -@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` måste vara ett objekt med axeltaggar och värden, till exempel {"wght"} +@msg `fontAxes` must be an object of axis tags and values, such as {{"wght": 650}} `fontAxes` måste vara ett objekt med axeltaggar och värden, till exempel {{"wght": 650}} @msg `format` must be a string `format` måste vara en sträng @msg `format` must be one of {_1} `format` måste vara något av {_1} @msg `fractions` is chop or scale `fractions` är chop eller scale @@ -7610,12 +7619,12 @@ digits Hindi Hindi @msg `index` must be a point index `index` måste vara ett punktindex @msg `index` must be a whole number or null `index` måste vara ett heltal eller null @msg `indices` must be a non-empty array of item indices `indices` måste vara en icke-tom array av objektindex -@msg `items` is a list of {kind, item} `items` är en lista med {kind, item} +@msg `items` is a list of {{kind, item}} `items` är en lista med {{kind, item}} @msg `items` is empty `items` är tom @msg `items` must be a list of {{id, anchors?}}, not {v} `items` måste vara en lista med {{id, anchors?}}, inte {v} -@msg `items` must be a list of {id, points} `items` måste vara en lista med {id, points} +@msg `items` must be a list of {{id, points}} `items` måste vara en lista med {{id, points}} @msg `items` must be an array of {{id, corners?}}, not {v} `items` måste vara en array av {{id, corners?}}, inte {v} -@msg `items` must be an array of {id, anchors} `items` måste vara en array av {id, anchors} +@msg `items` must be an array of {{id, anchors}} `items` måste vara en array av {{id, anchors}} @msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` måste vara "none", "short", "medium", "long" eller "stylistic" @msg `kind` is one of {_1} `kind` är något av {_1} @msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind` måste vara "round", "invertedRound" eller "chamfer", inte {v} @@ -7781,7 +7790,7 @@ digits Hindi Hindi @msg artboard {i} doesn't print rityta {i} skrivs inte ut @msg artboard is a 0-based index artboard är ett 0-baserat index @msg artboard must be a 0-based index artboard måste vara ett 0-baserat index -@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout måste vara {layout?, columns?, spacing?, rightToLeft?} +@msg artboardLayout must be {{layout?, columns?, spacing?, rightToLeft?}} artboardLayout måste vara {{layout?, columns?, spacing?, rightToLeft?}} @msg artboardLayout.columns must be 1 or more artboardLayout.columns måste vara 1 eller mer @msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout måste vara gridByRow, gridByColumn, row eller column @msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft måste vara true eller false @@ -7929,13 +7938,13 @@ digits Hindi Hindi @msg DXF scale must be a positive number up to {_1}, not {scale} DXF-skalan måste vara ett positivt tal upp till {_1}, inte {scale} @msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf-enhet `{u}`: en enhet som mm, cm, in eller pt @msg dxf: {e} dxf: {e} -@msg each format is an object {format, scale?, suffix?} varje format är ett objekt {format, scale?, suffix?} +@msg each format is an object {{format, scale?, suffix?}} varje format är ett objekt {{format, scale?, suffix?}} @msg each item needs an id varje objekt behöver ett id @msg each match needs `kind` varje matchning behöver `kind` @msg each match needs a `name` varje matchning behöver ett `name` -@msg each of `fonts` is {family, style?}; 1 to 1000 of them varje post i `fonts` är {family, style?}; 1 till 1000 stycken +@msg each of `fonts` is {{family, style?}}; 1 to 1000 of them varje post i `fonts` är {{family, style?}}; 1 till 1000 stycken @msg each of `items` is {{id, corners?}} with an object id, not {it} varje post i `items` är {{id, corners?}} med ett objekt-id, inte {it} -@msg each of `items` is {kind, item} varje post i `items` är {kind, item} +@msg each of `items` is {{kind, item}} varje post i `items` är {{kind, item}} @msg each row needs `from` varje rad behöver `from` @msg each stop needs a position varje stopp behöver en position @msg each subpath needs an anchors array varje delbana behöver en anchors-array @@ -7953,8 +7962,8 @@ digits Hindi Hindi @msg EPS Save writes all artwork: use document.export for selected-only EPS När du sparar som EPS skrivs allt bildmaterial: använd document.export för EPS med bara det markerade @msg every numbered name for the result is taken alla numrerade namn för resultatet är upptagna @msg expanded SVG styles exceed the import size limit de expanderade SVG-stilarna överskrider storleksgränsen för import -@msg expected {"dataBase64"} förväntade {"dataBase64"} -@msg expected {"objects"} förväntade {"objects"} +@msg expected {{"dataBase64": "…"}} förväntade {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} förväntade {{"objects": [...]}} @msg export `{name}`: {e} export av `{name}`: {e} @msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft Exportera för skärmar skriver png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai eller vectorcraft @msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes filen med exportförinställningar är större än {MAX_PRESET_FILE_BYTES} byte @@ -7967,7 +7976,7 @@ digits Hindi Hindi @msg featureChanges must be a list of tags featureChanges måste vara en lista med taggar @msg features must be a list of tags features måste vara en lista med taggar @msg fidelity must be 0..100 fidelity måste vara 0..100 -@msg files must be {name, dataBase64} files måste vara {name, dataBase64} +@msg files must be {{name, dataBase64}} files måste vara {{name, dataBase64}} @msg fit must be none|autoHeight|shrinkText|block, got {id} fit måste vara none|autoHeight|shrinkText|block, fick {id} @msg Flare click coordinates must be finite numbers Klickkoordinaterna för Ljusreflex måste vara ändliga tal @msg flattener: {e} utplattning: {e} @@ -7985,7 +7994,7 @@ digits Hindi Hindi @msg frequency must be between 1 and 300 lines per inch frequency måste vara mellan 1 och 300 linjer per tum @msg from and to must be finite from och to måste vara ändliga @msg from must be [x0, y0, x1, y1] from måste vara [x0, y0, x1, y1] -@msg give {key, value} or {values} ange {key, value} eller {values} +@msg give {{key, value}} or {{values}} ange {{key, value}} eller {{values}} @msg give `before` or `after`, not both ange `before` eller `after`, inte båda @msg give `char` or `text` ange `char` eller `text` @msg give `colors`, or `color` and `rule` ange `colors`, eller `color` och `rule` @@ -8000,7 +8009,7 @@ digits Hindi Hindi @msg give `id` and `anchors`, or `items`, not both ange `id` och `anchors`, eller `items`, inte båda @msg give `id` or `guide`, not both ange `id` eller `guide`, inte båda @msg give `length` or `to` ange `length` eller `to` -@msg give `matches`: [{kind, name, target}] ange `matches`: [{kind, name, target}] +@msg give `matches`: [{{kind, name, target}}] ange `matches`: [{{kind, name, target}}] @msg give `name` (or edit a pattern) ange `name` (eller redigera ett mönster) @msg give `name` or `names` ange `name` eller `names` @msg give `path` (a .wasm file) or `dataBase64` (the module) ange `path` (en .wasm-fil) eller `dataBase64` (modulen) @@ -8036,7 +8045,7 @@ digits Hindi Hindi @msg give the preset a `name` ge förinställningen ett `name` @msg give the preset a name ge förinställningen ett namn @msg give the preset a name (1–64 characters) ge förinställningen ett namn (1–64 tecken) -@msg give the settings to change, e.g. {"formats"}]} ange inställningarna som ska ändras, t.ex. {"formats"}]} +@msg give the settings to change, e.g. {{"formats": [{{"format": "png", "scale": "2x"}}]}} ange inställningarna som ska ändras, t.ex. {{"formats": [{{"format": "png", "scale": "2x"}}]}} @msg give the style a name ge stilen ett namn @msg give two or more style `names` ange två eller fler stilnamn i `names` @msg give two or more swatches ange två eller fler färgrutor @@ -8070,7 +8079,7 @@ digits Hindi Hindi @msg instruction budget instruktionsbudget @msg invalid `color` ogiltig `color` @msg invalid anchor index {v}: expected a non-negative integer ogiltigt ankarindex {v}: ett icke-negativt heltal förväntades -@msg invalid anchor reference {v}: expected [subpath, anchor] ogiltig ankarreferens {v}: [delbana, ankare] förväntades +@msg invalid anchor reference {v}: expected [subpath, anchor] ogiltig ankarreferens {v}: [subpath, anchor] förväntades @msg invalid angle ogiltig vinkel @msg invalid brush: {e} ogiltig pensel: {e} @msg invalid color ogiltig färg @@ -8141,7 +8150,7 @@ digits Hindi Hindi @msg missing `library` `library` saknas @msg missing `library` (see graphicStyle.libraries) `library` saknas (se graphicStyle.libraries) @msg missing `library` (see swatch.library.list) `library` saknas (se swatch.library.list) -@msg missing `map` (rows [{from, to}] or {current}) `map` saknas (rader [{from, to}] eller {current}) +@msg missing `map` (rows [{{from, to}}] or {{current: new}}) `map` saknas (rader [{{from, to}}] eller {{current: new}}) @msg missing `matrix` [a,b,c,d,e,f] `matrix` [a,b,c,d,e,f] saknas @msg missing `name` (see gradient.presets.list) `name` saknas (se gradient.presets.list) @msg missing `offset` (a distance in points) `offset` saknas (ett avstånd i punkter) @@ -8159,7 +8168,7 @@ digits Hindi Hindi @msg missing `value` `value` saknas @msg missing anchor ankare saknas @msg missing anchors ankare saknas -@msg missing anchors [[subpath, anchor]…] ankare saknas [[delbana, ankare]…] +@msg missing anchors [[subpath, anchor]…] ankare saknas [[subpath, anchor]…] @msg missing array `{key}` arrayen `{key}` saknas @msg missing case skiftläge saknas @msg missing color färg saknas @@ -8433,7 +8442,7 @@ digits Hindi Hindi @msg print settings: {e} utskriftsinställningar: {e} @msg procedures nest too deeply procedurerna är nästlade för djupt @msg procedures nested too deeply procedurerna nästlades för djupt -@msg quotes must be {double?, single?} quotes måste vara {double?, single?} +@msg quotes must be {{double?, single?}} quotes måste vara {{double?, single?}} @msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k} måste vara ett inledande och ett avslutande citattecken, t.ex. "“”" @msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi måste vara 1–2400 (72 skärm, 150 medel, 300 hög) @msg rating must be a whole number from 0 to {MAX_RATING} rating måste vara ett heltal från 0 till {MAX_RATING} @@ -8545,13 +8554,13 @@ digits Hindi Hindi @msg SVG is not UTF-8, UTF-16 or ISO 8859-1 SVG-filen är inte i UTF-8, UTF-16 eller ISO 8859-1 @msg swatchConflict must be "merge" or "add", not {v} swatchConflict måste vara "merge" eller "add", inte {v} @msg Switch x/y is for scatter graphs Växla x/y gäller spridningsdiagram -@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text måste vara {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} +@msg text must be {{characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?}} text måste vara {{characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?}} @msg Text options: {e} Textalternativ: {e} @msg text transform is collapsed or unrepresentable texttransformeringen är kollapsad eller kan inte återges @msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}`: använd "{_1}" eller "{_2}" @msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces måste vara ett heltal från 2 till 100 @msg textureImage: {e} textureImage: {e} -@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage: ange {path} eller {name, dataBase64} för en bildfil, eller en textur så som effect.list anger den +@msg textureImage: give {{path}} or {{name, dataBase64}} of an image file, or a texture as effect.list gives it textureImage: ange {{path}} eller {{name, dataBase64}} för en bildfil, eller en textur så som effect.list anger den @msg that makes more than {MAX_PIECES} slices det ger fler än {MAX_PIECES} skivor @msg that object is not in the overlap det objektet ingår inte i överlappningen @msg the action set ids are not a list åtgärdsuppsättningarnas id:n är inte en lista @@ -8901,6 +8910,12 @@ digits Hindi Hindi @msg open the practice sample of `{id}` first (see learn.openSample) öppna först övningsexemplet för `{id}` (se learn.openSample) @msg finish `{id}` first (see learn.finish) slutför först `{id}` (se learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` är den sista självstudien i sin färdighet + Reset progress Återställ framsteg + Mark Tutorial Step Markera steg i självstudie + Reset Learn Progress Återställ inlärningsframsteg +@msg missing `step` (see learn.show) `step` saknas (se learn.show) +@msg `step` must be a step number from 0 to {last} `step` måste vara ett stegnummer från 0 till {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` är slutförd (se learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Uppdatera uppskjutna effekter @@ -8967,3 +8982,119 @@ digits Hindi Hindi Grommets Öljetter Grommet Inset Öljetternas avstånd från kanten Diameter Diameter + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D-effekter kräver ändliga koordinater inom 100 miljoner punkter +@msg 3D effects require one to ten lights 3D-effekter kräver en till tio ljuskällor +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP-djup {_1}: 1, 4, 8, 16, 24 eller 32 bitar per pixel +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP-kodningen misslyckades: {width} × {height} pixlar passar inte formatet eller pixelbufferten +@msg GIF encoding failed: the palette image is malformed GIF-kodningen misslyckades: palettbilden är felaktigt uppbyggd +@msg GIF encoding failed: {e} GIF-kodningen misslyckades: {e} +@msg JPEG colour profile: {e} JPEG-färgprofil: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG-kodningen misslyckades: pixelbufferten stämmer inte med bildens storlek +@msg JPEG encoding failed: {e} JPEG-kodningen misslyckades: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG-kodningen misslyckades: pixelbufferten stämmer inte med bildens storlek +@msg PNG encoding failed: the palette image is malformed PNG-kodningen misslyckades: palettbilden är felaktigt uppbyggd +@msg PNG encoding failed: {e} PNG-kodningen misslyckades: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG-kodningen misslyckades: {width} × {height} pixlar är inte en giltig bildstorlek +@msg PSD colour profile: {e} PSD-färgprofil: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD-kodningen misslyckades: pixelbufferten stämmer inte med bildens storlek +@msg Revolve profile contains invalid coordinates Profilen för Rotera runt axel innehåller ogiltiga koordinater +@msg Revolve profile is too complex Profilen för Rotera runt axel är för komplex +@msg Revolve projection is not finite Projektionen för Rotera runt axel är inte ändlig +@msg Revolve requires finite profile coordinates within 100 million points Rotera runt axel kräver ändliga profilkoordinater inom 100 miljoner punkter +@msg Revolve surface is too complex; reduce Segments or simplify the profile Ytan för Rotera runt axel är för komplex; minska Segment eller förenkla profilen +@msg Revolve surface is too complex; simplify the profile Ytan för Rotera runt axel är för komplex; förenkla profilen +@msg Revolve visibility cannot split the projected boundary Synlighetsberäkningen för Rotera runt axel kan inte dela den projicerade gränsen +@msg Revolve visibility creates too many fragments Synlighetsberäkningen för Rotera runt axel skapar för många fragment +@msg Revolve visibility creates too many vector anchors Synlighetsberäkningen för Rotera runt axel skapar för många vektorankarpunkter +@msg Revolve visibility exceeds its geometry work limit Synlighetsberäkningen för Rotera runt axel överskrider sin gräns för geometriarbete +@msg Revolve visibility exceeds its spatial index limit Synlighetsberäkningen för Rotera runt axel överskrider sin gräns för det rumsliga indexet +@msg Revolve visibility has too many boundary crossings Synlighetsberäkningen för Rotera runt axel har för många gränskorsningar +@msg Revolve visibility has too many input anchors Synlighetsberäkningen för Rotera runt axel har för många inkommande ankarpunkter +@msg Revolve visibility requires convex cap sectors Synlighetsberäkningen för Rotera runt axel kräver konvexa sektorer i locken +@msg Revolve visibility requires finite projected faces Synlighetsberäkningen för Rotera runt axel kräver ändliga projicerade ytor +@msg SVG options: {e} SVG-alternativ: {e} +@msg Save for Web settings: {e} Inställningar för Spara för webben: {e} +@msg TIFF colour profile: {e} TIFF-färgprofil: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF-kodningen misslyckades: pixelbufferten stämmer inte med bildens storlek +@msg TIFF encoding failed: {e} TIFF-kodningen misslyckades: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa-djup {_1}: 16, 24 eller 32 bitar per pixel +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa-kodningen misslyckades: pixelbufferten stämmer inte med bildens storlek +@msg The 3D projection is not finite 3D-projektionen är inte ändlig +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D-skuggan är för komplex; stäng av Skuggor eller förenkla grafiken +@msg The shape contains invalid coordinates Formen innehåller ogiltiga koordinater +@msg Too many Revolve faces for visibility evaluation För många ytor i Rotera runt axel för synlighetsberäkningen +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft läser högst {ASE_MAX_ENTRIES} färger och grupper från en fil för färgruteutbyte, och det här biblioteket har {entries} +@msg WebP encoding failed: {e} WebP-kodningen misslyckades: {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `index` must be a whole number `index` måste vara ett heltal +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` är smallThumb, mediumThumb, largeThumb, smallList eller largeList +@msg a line can't run from a point to itself en linje kan inte gå från en punkt till sig själv +@msg a line needs at least two points en linje behöver minst två punkter +@msg a number cannot be read ett tal kan inte läsas +@msg a swatch exchange block is too long ett block i en fil för färgruteutbyte är för långt +@msg a swatch exchange name is too long ett namn i en fil för färgruteutbyte är för långt +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels en bild på {sw} × {sh} kan inte skalas om till {width} × {height} pixlar +@msg a {width} × {height} image is too large en bild på {width} × {height} är för stor +@msg a {width} × {height} image: {e} en bild på {width} × {height}: {e} +@msg an image could not be written: {e} en bild kunde inte skrivas: {e} +@msg an image that couldn't be read was left out en bild som inte kunde läsas utelämnades +@msg can't open “{name}”: {e} kan inte öppna ”{name}”: {e} +@msg cannot align zip entries to {align} bytes kan inte justera zip-posterna till {align} byte +@msg cannot open the automation {kind} root `{_1}`: {e} kan inte öppna automatiseringens rotmapp ({kind}) `{_1}`: {e} +@msg cannot read profile: {0} kan inte läsa profilen: {0} +@msg color book version {version} isn't supported (only 1) färgboksversion {version} stöds inte (endast 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) färgböcker i färgrymden {other} stöds inte (endast RGB, CMYK och Lab) +@msg file name too long to zip: {_1} filnamnet är för långt för att zippas: {_1} +@msg file name too long to zip: {name} filnamnet är för långt för att zippas: {name} +@msg freeform line {i}: {e} fri linje {i}: {e} +@msg freeform point {i}: {e} fri punkt {i}: {e} +@msg give `{key}` or `{other}`, not both ange `{key}` eller `{other}`, inte båda +@msg grayscale profiles can't be working spaces yet gråskaleprofiler kan inte vara arbetsfärgrymder än +@msg input contains NaN or infinite coordinates indata innehåller NaN eller oändliga koordinater +@msg input path could not be closed den inkommande banan kunde inte slutas +@msg invalid ICC profile: {0} ogiltig ICC-profil: {0} +@msg invalid scale {scale} ogiltig skala {scale} +@msg its localized names take more than {_1} KB dess lokaliserade namn tar mer än {_1} KB +@msg its objects are nested too deep ({e}) dess objekt är kapslade för djupt ({e}) +@msg its tag table lists the `{_1}` tag more than once dess taggtabell listar taggen `{_1}` mer än en gång +@msg not a graphic style library: {e} inte ett bibliotek med grafiska stilar: {e} +@msg not a swatch library (.vcswatches or .gpl) inte ett färgrutebibliotek (.vcswatches eller .gpl) +@msg not a swatch library (format `{_1}`) inte ett färgrutebibliotek (format `{_1}`) +@msg not a swatch library: {e} inte ett färgrutebibliotek: {e} +@msg not an action set file ({e}) inte en fil med åtgärdsuppsättning ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray profilens färgrymd {other} är inte RGB, CMYK eller Gray +@msg regular expression too large det reguljära uttrycket är för stort +@msg script file is not UTF-8 text: {value} skriptfilen är inte UTF-8-text: {value} +@msg stop {i}: {e} stopp {i}: {e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) version {major}.{minor} av filer för färgruteutbyte stöds inte (endast 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors färgboken innehåller fler än {ASE_MAX_ENTRIES} färger +@msg the color book is cut short färgboken är avkortad +@msg the color book's names take more than {_1} MB färgbokens namn tar mer än {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution bilden skulle bli {w} × {h} pixlar; rasterexporter är begränsade till {MAX_RASTER_SIDE} pixlar per sida och {_1} megapixel: sänk skalan eller upplösningen +@msg the optimised image can't be read back: {e} den optimerade bilden kan inte läsas tillbaka: {e} +@msg the pixel buffer doesn't match the image size pixelbufferten stämmer inte med bildens storlek +@msg the preview: {e} förhandsgranskningen: {e} +@msg the request may not read the New Document profiles folder begäran får inte läsa mappen med profiler för nytt dokument +@msg the shapes are too degenerate to combine formerna är för degenererade för att kombineras +@msg the shapes cross themselves and each other too often to combine formerna korsar sig själva och varandra för ofta för att kombineras +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups filen för färgruteutbyte innehåller fler än {ASE_MAX_ENTRIES} färger och grupper +@msg the swatch exchange file is cut short filen för färgruteutbyte är avkortad +@msg the {_1} plate can't be read: {e} plåten {_1} kan inte läsas: {e} +@msg this binary DXF file is damaged or cut short den här binära DXF-filen är skadad eller avkortad +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that det här är en DWG-ritning, som inte kan läsas: spara den från CAD-appen som DXF och öppna den +@msg too many classes för många klasser +@msg too many groups för många grupper +@msg too many layers for PSD (at most 32767) för många lager för PSD (högst 32767) +@msg too many swatch exchange blocks för många block i filen för färgruteutbyte +@msg unknown colour profile: {0} okänd färgprofil: {0} +@msg {_1} clashes with a built-in profile name {_1} krockar med namnet på en inbyggd profil +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} pixlar är för stort för GIF (högst 65535 pixlar per sida): sänk upplösningen +@msg {_1}: no usable transform to/from sRGB {_1}: ingen användbar transformering till/från sRGB +@msg {name} is not a CMYK profile {name} är inte en CMYK-profil +@msg {name} is not an RGB profile {name} är inte en RGB-profil +@msg {path}: could not be read {path}: kunde inte läsas +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} pixlar är för stort för JPEG (högst 65535 pixlar per sida): sänk upplösningen +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} pixlar är för stort för Targa (högst 65535 pixlar per sida): sänk upplösningen +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} pixlar är för stort för PSD (högst {MAX_SIDE} pixlar per sida): sänk upplösningen diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 705fc68db2..602898ecce 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -3,6 +3,20 @@ use super::*; const ZH: fn() -> Lang = || Lang::from_code("zh-hant").expect("zh-hant registered"); +#[test] +fn gujarati_resolves_locales_and_takes_the_singular_for_zero_and_one() { + // The catalog is present even when this web build cannot display it. + let gu = Lang(LANGUAGES.iter().find(|l| l.code == "gu").expect("gu registered")); + let selectable = gu.0.available().then_some(gu); + assert_eq!(Lang::from_code("gu"), selectable); + for tag in ["gu", "gu-IN", "gu_IN.UTF-8", "GU-in", "gu-Gujr-IN"] { + assert_eq!(lang_from_tag(tag), selectable, "{tag}"); + } + assert_eq!(gu.name(), "ગુજરાતી"); + assert_eq!([0, 1, 2, 21].map(gu.0.plural), [0, 0, 1, 1]); + assert_eq!(tr(gu, "Save"), "સાચવો"); +} + #[test] fn hindi_resolves_locales_and_uses_zero_one_plurals() { let hi = Lang::from_code("hi").expect("hi registered"); @@ -209,6 +223,17 @@ fn tags_map_to_languages() { assert_eq!(lang_from_tag("_"), None); } +#[test] +fn gujarati_web_selection_requires_a_bundled_interface_font() { + let gu = LANGUAGES.iter().find(|l| l.code == "gu").expect("Gujarati catalog"); + assert!(gu.available_with_fonts(false, false), "native installed-font fallback"); + assert!(!gu.available_with_fonts(true, false), "web must not offer missing glyphs"); + assert!(gu.available_with_fonts(true, true)); + assert!(LANGUAGES[0].available_with_fonts(true, false), "English fallback"); + assert_eq!(Lang::from_code("gu").is_some(), gu.available()); + assert_eq!(Lang::for_picker().iter().any(|l| l.code() == "gu"), gu.available()); +} + /// The Bosnian, Georgian, Ukrainian, Hungarian, Korean, Vietnamese, Swedish and Catalan tags of /// [`tags_map_to_languages`]. fn other_tags_map_to_languages() { @@ -823,6 +848,11 @@ fn is_devanagari(c: char) -> bool { matches!(c as u32, 0x0900..=0x097F | 0x1CD0..=0x1CFF | 0xA8E0..=0xA8FF) } +#[cfg(feature = "interface-fonts")] +fn is_gujarati(c: char) -> bool { + matches!(c as u32, 0x0A80..=0x0AFF) +} + /// The UI fonts draw every character the catalogs use, in every family the UI draws text with /// (the web build has no system fonts to fall back to). Chinese and Japanese characters come from /// the craft-fonts build input, which is optional: without it they are left to the installed @@ -836,6 +866,7 @@ fn bundled_fonts_cover_the_catalogs() { let japanese_ui_font = vectorcraft_text::CRAFT_FONTS.iter().any(|f| f.is_japanese()); let georgian_ui_font = vectorcraft_text::CRAFT_FONTS.iter().any(|f| f.is_georgian()); let devanagari_ui_font = vectorcraft_text::CRAFT_FONTS.iter().any(|f| f.scripts.contains(&"Deva")); + let gujarati_ui_font = vectorcraft_text::CRAFT_FONTS.iter().any(|f| f.scripts.contains(&"Gujr")); let ctx = egui::Context::default(); crate::theme::install_fonts(&ctx); let mut output = ctx.run_ui(egui::RawInput::default(), |_| {}); @@ -859,6 +890,7 @@ fn bundled_fonts_cover_the_catalogs() { && (cjk_checked || !is_cjk(*c)) && (georgian_ui_font || !is_georgian(*c)) && (devanagari_ui_font || !is_devanagari(*c)) + && (gujarati_ui_font || !is_gujarati(*c)) }) .collect(); for family in &families { @@ -2029,6 +2061,44 @@ fn recolor_notes_on_objects_left_unchanged_translate_with_their_counts() { } } +/// Spanish shows the image encoders', color profiles', swatch exchange files', Revolve's, DXF +/// import's, the script engine's and the parameter checks' errors in Spanish, with their values, +/// backticked names and accepted values kept as the English writes them. +#[test] +fn spanish_translates_encoder_profile_swatch_revolve_and_parameter_errors() { + let es = Lang::from_code("es").expect("registered"); + for (english, spanish) in [ + ("PNG encoding failed: 0 × 0 pixels is not a valid image size", "Error al codificar PNG: 0 × 0 píxeles no es un tamaño de imagen válido"), + ( + "70000 × 10 pixels is too large for GIF (at most 65535 pixels a side): lower the resolution", + "70000 × 10 píxeles es demasiado grande para GIF (como máximo 65535 píxeles por lado): baja la resolución", + ), + ("profile colour space XYZ is not RGB, CMYK or Gray", "el espacio de color XYZ del perfil no es RGB, CMYK ni Gray"), + ( + "color books in color space HSB aren't supported (only RGB, CMYK and Lab)", + "no se admiten libros de colores en el espacio de color HSB (solo RGB, CMYK y Lab)", + ), + ( + "the swatch exchange file holds more than 65536 colors and groups", + "el archivo de intercambio de muestras contiene más de 65536 colores y grupos", + ), + ( + "Revolve surface is too complex; reduce Segments or simplify the profile", + "La superficie de Revolución es demasiado compleja; reduce Segmentos o simplifica el perfil", + ), + ("regular expression too large", "expresión regular demasiado grande"), + ("this binary DXF file is damaged or cut short", "este archivo DXF binario está dañado o truncado"), + ( + "`view` is smallThumb, mediumThumb, largeThumb, smallList or largeList", + "`view` es smallThumb, mediumThumb, largeThumb, smallList o largeList", + ), + ("give `fill` or `stroke`, not both", "indica `fill` o `stroke`, no ambos"), + ("stop 2: oops", "parada 2: oops"), + ] { + assert_eq!(message(es, english), spanish); + } +} + #[test] fn package_status_message_templates_parse() { let c = Catalog::parse(concat!( @@ -2111,6 +2181,55 @@ fn message_keys_keep_doubled_braces() { assert_eq!(as_template(r"it doesn't start with {\rtf"), r"it doesn't start with {\rtf"); } +/// The braces of a message that is not a format string (a plain literal or a `&str` constant) are +/// literal, so its catalog key doubles them; a `format!` string or an `#[error(…)]` string keeps +/// its `{{`, `}}` and placeholders. +#[test] +fn plain_message_keys_double_their_braces() { + let code = concat!( + "const SHAPE: &str = \"a shape is {\\\"kind\\\": …}\";\n", + "fn f() -> Result<()> { Err(Error::Output(\"expected {\\\"dataBase64\\\": \\\"…\\\"}\".into())) }\n", + "fn g() -> Result<()> { Err(SHAPE.into()) }\n", + "fn h() -> Result<()> { Err(bad(C, \"not an RTF file: it doesn't start with {\\\\rtf\")) }\n", + "fn i() -> Result<()> { Err(bad(C, format!(\"`{key}` must be {{min?, max?}}\"))) }\n", + "#[error(\"the file is {0} bytes, not {{size}}\")]\n", + ); + let consts: std::collections::BTreeMap> = str_consts(code).into_iter().map(|(name, value)| (name, vec![value])).collect(); + // The engine's `error(` helper also occurs in each `#[error(` attribute. + let found: std::collections::BTreeSet = source_messages(code, &[("bad(", 1), ("error(", 0)], &consts).into_iter().collect(); + let want = [ + r#"expected {{"dataBase64": "…"}}"#, + r#"a shape is {{"kind": …}}"#, + r"not an RTF file: it doesn't start with {{\rtf", + "`{key}` must be {{min?, max?}}", + "the file is {0} bytes, not {{size}}", + ]; + assert_eq!(found, want.iter().map(|s| s.to_string()).collect::>(), "{found:#?}"); + assert_eq!(as_literal_key("a {b} c}"), "a {{b}} c}}"); +} + +/// A catalog row for a message with literal braces translates that message and no other: it has no +/// placeholder to take the rest of a message with the same start. +#[test] +fn literal_brace_rows_match_only_their_message() { + let c = Catalog::parse("@msg\texpected {{\"dataBase64\": \"…\"}}\terwartet: {{\"dataBase64\": \"…\"}}\n"); + let (form, caps) = c.message(r#"expected {"dataBase64": "…"}"#).expect("matches"); + assert!(caps.is_empty(), "{caps:?}"); + assert_eq!(fill_once(form, &caps), r#"erwartet: {"dataBase64": "…"}"#); + assert!(c.message("expected value at line 1 column 1").is_none()); + assert!(c.message(r#"expected {"dataBase64"}"#).is_none()); + assert_eq!(exact_translation(&c, r#"expected {"dataBase64": "…"}"#).as_deref(), Some(r#"erwartet: {"dataBase64": "…"}"#)); + // An exact message is found at any length; a template is matched only up to its limit. + let long = format!("{{{{{}}}}}", "x".repeat(3000)); + let c = Catalog::parse(&format!("@msg\t{long}\tlong {{{{}}}}\n@msg\tshort {{x}}\tshort {{x}} (de)\n")); + let shown = format!("{{{}}}", "x".repeat(3000)); + assert_eq!(c.message(&shown).map(|(f, _)| f), Some("long {{}}")); + assert_eq!(exact_translation(&c, &shown).as_deref(), Some("long {}")); + assert_eq!(c.message("short y").map(|(f, _)| f), Some("short {x} (de)")); + // In the real catalog, a serde reason after the plug-in output error stays English. + assert_eq!(message(de(), "plug-in output: expected value at line 1 column 1"), "Plug-in-Ausgabe: expected value at line 1 column 1"); +} + /// `plugin.run` of an importer, an exporter or a live effect names the command that runs it with /// the JSON that picks it, and every complete-message catalog translates that error with the /// plug-in's id and the JSON kept. @@ -2443,6 +2562,10 @@ const COUNTED_STATUS_MESSAGES: &[(&str, &str)] = &[ ("Downloaded 1 file", "Downloaded 2 files"), ("Exported 1 file to /out", "Exported 2 files to /out"), ("Loaded “Tidy”: 1 step was left out", "Loaded “Tidy”: 2 steps were left out"), + ( + "Loaded “Tidy”: 1 step has an unknown command and was kept: “Export”, step 4, `example.finish`", + "Loaded “Tidy”: 2 steps have unknown commands and were kept; the first: “Export”, step 4.2, `example.finish`", + ), ]; /// The link, font, export and action set status messages name a count of 1 in the singular and other counts in @@ -4030,6 +4153,87 @@ fn translated_messages_keep_the_command_ids_their_english_names() { assert!(missing.is_empty(), "{} rows drop a command id their English names:\n{}", missing.len(), missing.join("\n")); } +/// Whether `word` is an ASCII name a command reads: a letter followed by letters, digits or +/// underscores. +fn is_ascii_name(word: &str) -> bool { + word.chars().next().is_some_and(|c| c.is_ascii_alphabetic()) && word.chars().all(|c| c.is_ascii_alphanumeric() || c == '_') +} + +/// The field names and accepted values that `s` spells out of its backticked spans: each name of a +/// comma-separated list in square brackets, such as `[x, y, width, height]` or +/// `[[subpath, anchor]…]`; each `a|b|c` list of values, whole; and the values an `unknown …` or +/// `bad model …` message lists in parentheses, such as `(none, standard or wedges)`, up to the first +/// item that is not a single name, so `(high, medium, low or a saved one: see …)` gives `high`, +/// `medium` and `low`, and `(or give its ids)` gives none. +fn field_names_and_values(s: &str) -> Vec { + let outside = s.split('`').step_by(2).collect::>().join(" "); + let mut found = Vec::new(); + for piece in outside.split('[').skip(1) { + let Some(end) = piece.find(']') else { continue }; + let names: Vec<&str> = piece[..end].split(',').map(str::trim).collect(); + if names.len() > 1 && names.iter().all(|name| is_ascii_name(name)) { + found.extend(names.into_iter().map(str::to_string)); + } + } + let lists = outside.split(|c: char| !(c.is_ascii_alphanumeric() || c == '_' || c == '|')); + found.extend(lists.filter(|w| w.contains('|') && w.split('|').all(is_ascii_name)).map(str::to_string)); + for (at, _) in outside.match_indices('(') { + let before = &outside[..at]; + if !(holds_ascii_word(before, "unknown") || before.contains("bad model")) { + continue; + } + let Some(end) = outside[at..].find(')') else { continue }; + let items = outside[at + 1..at + end].split(", ").flat_map(|item| item.split(" or ")); + let values: Vec<&str> = items.map(str::trim).take_while(|item| is_ascii_name(item)).collect(); + if values.len() > 1 { + found.extend(values.into_iter().map(str::to_string)); + } + } + found +} + +#[test] +fn field_names_and_values_finds_bracketed_names_and_listed_values() { + assert_eq!(field_names_and_values("`{key}` must be [x, y, width, height]: four numbers"), ["x", "y", "width", "height"]); + assert_eq!(field_names_and_values("missing anchors [[subpath, anchor]…]"), ["subpath", "anchor"]); + assert_eq!(field_names_and_values("arrowScale must be [start, end]"), ["start", "end"]); + assert_eq!(field_names_and_values("unknown pieLegend {v} (none, standard or wedges)"), ["none", "standard", "wedges"]); + assert_eq!(field_names_and_values("unknown side `{other}` (left|right|top|bottom)"), ["left|right|top|bottom"]); + assert_eq!(field_names_and_values("bad model {other} (keep, new or document)"), ["keep", "new", "document"]); + assert_eq!( + field_names_and_values("unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list)"), + ["high", "medium", "low"] + ); + assert_eq!(field_names_and_values("unknown object (or give its ids)"), Vec::::new()); + assert_eq!(field_names_and_values("unknown color `{c}` (#rrggbb or a preset name)"), Vec::::new()); + assert_eq!(field_names_and_values("unknown resolution (72 screen, 150 medium, 300 high)"), Vec::::new()); + assert_eq!(field_names_and_values("the art is [1, 2] (left, right) and `[a, b]`"), Vec::::new()); +} + +/// A translated status or error message keeps each field name and accepted value its English text +/// spells out (see [`field_names_and_values`]), as the English spells it: the message tells a user +/// what to pass, and a command reads only the English names and values. +#[test] +fn translated_messages_keep_the_field_names_and_values_their_english_lists() { + let mut missing = Vec::new(); + for l in &LANGUAGES { + let (entries, _) = parse_entries(l.source); + for (ctx, src, tr) in entries.iter().filter(|(ctx, _, _)| ctx == "@msg" || ctx == "@msgplural") { + let plural = ctx == "@msgplural"; + let english = if plural { src.rsplit('|').next().unwrap_or(src) } else { src.as_str() }; + let forms: Vec<&str> = if plural { tr.split('|').collect() } else { vec![tr.as_str()] }; + for form in forms { + for name in field_names_and_values(english) { + if !holds_ascii_word(form, &name) { + missing.push(format!("{}: {name} in {src:?} -> {form:?}", l.code)); + } + } + } + } + } + assert!(missing.is_empty(), "{} rows drop a field name or value their English lists:\n{}", missing.len(), missing.join("\n")); +} + /// Languages whose catalogs translate status and error messages; [`untranslated_report`] lists /// the messages each one lacks. const COMPLETE_MESSAGES: &[&str] = &[ @@ -4094,7 +4298,8 @@ const LATER_MESSAGE_VARIANTS: &[(&str, usize)] = &[("Disabled", 1)]; const NOT_MESSAGES: &[&str] = &["quit", "cancelled", "vc_manifest", "[{i}]{place}", ".{k}{place}"]; /// Every status and error message literal in [`MESSAGE_CRATES`] (test modules aside), as catalog -/// templates: `{}` becomes `{_1}`, `{_2}` … and format specs are dropped (`{n:?}` → `{n}`). +/// templates: `{}` becomes `{_1}`, `{_2}` … and format specs are dropped (`{n:?}` → `{n}`), and +/// the braces of a message that is not a format string are doubled. pub fn message_literals() -> std::collections::BTreeSet { message_literals_in(MESSAGE_CRATES) } @@ -4217,16 +4422,19 @@ fn named_const<'a>(rest: &str, consts: &'a std::collections::BTreeMap>) -> Vec { let code = &without_comments(code); - let after_markers = MESSAGE_MARKERS.iter().flat_map(|marker| code.match_indices(marker).map(|(at, _)| &code[at + marker.len()..])); + let after_markers = + MESSAGE_MARKERS.iter().flat_map(|marker| code.match_indices(marker).map(|(at, _)| (&code[at + marker.len()..], *marker == "#[error("))); let in_variants = ["Error::", "Fail::"].into_iter().flat_map(|enum_end| code.match_indices(enum_end)).filter_map(|(at, m)| { let rest = &code[at + m.len()..]; let (variant, args) = rest.split_at(rest.find(|c: char| !c.is_ascii_alphanumeric() && c != '_').unwrap_or(rest.len())); let named = variant.starts_with(|c: char| c.is_ascii_uppercase()) && !NAME_VARIANTS.contains(&variant); let before = LATER_MESSAGE_VARIANTS.iter().find(|(v, _)| *v == variant).map_or(0, |&(_, n)| n); - if named { skip_args(args.strip_prefix('(')?, before) } else { None } + if named { skip_args(args.strip_prefix('(')?, before).map(|rest| (rest, false)) } else { None } }); let in_map_err = code.match_indices(".map_err(").flat_map(|(at, m)| { let rest = code[at + m.len()..].trim_start(); @@ -4245,13 +4453,20 @@ fn source_messages(code: &str, helpers: &[(&str, usize)], consts: &std::collecti let in_helpers = helpers.iter().flat_map(|&(call, before)| { code.match_indices(call) .filter(|&(at, _)| call.starts_with('.') || !code[..at].ends_with(|c: char| c.is_alphanumeric() || c == '_' || c == '.')) - .filter_map(move |(at, _)| skip_args(&code[at + call.len()..], before)) + // `format!(` given as a helper, and an `error(` helper that is an `#[error(…)]` attribute, take a format string. + .filter_map(move |(at, _)| { + skip_args(&code[at + call.len()..], before).map(|rest| (rest, call == "format!(" || code[..at].ends_with("#["))) + }) }); let mut out = vec![]; - for rest in after_markers.chain(in_variants).chain(in_map_err).chain(in_handlers).chain(in_helpers) { + let in_map_err = in_map_err.map(|rest| (rest, false)); + let in_handlers = in_handlers.map(|rest| (rest, false)); + for (rest, takes_format) in after_markers.chain(in_variants).chain(in_map_err).chain(in_handlers).chain(in_helpers) { let rest = rest.trim_start(); let rest = rest.strip_prefix('&').map_or(rest, str::trim_start); - let rest = rest.strip_prefix("format!(").map_or(rest, str::trim_start); + let formatted = rest.strip_prefix("format!(").map(str::trim_start); + let format = takes_format || formatted.is_some(); + let rest = formatted.unwrap_or(rest); let lits = match rest.strip_prefix('"') { Some(quoted) => string_literal(quoted).into_iter().collect(), None => named_const(rest, consts).to_vec(), @@ -4260,7 +4475,7 @@ fn source_messages(code: &str, helpers: &[(&str, usize)], consts: &std::collecti let has_word = lit.as_bytes().windows(3).any(|w| w.iter().all(u8::is_ascii_lowercase)); let key_name = lit.len() > 1 && lit.starts_with('`') && lit.ends_with('`') && !lit.contains(' '); if has_word && !key_name && !NOT_MESSAGES.contains(&lit.as_str()) { - out.push(as_template(&lit)); + out.push(if format { as_template(&lit) } else { as_literal_key(&lit) }); } } } @@ -4455,6 +4670,12 @@ fn as_template(s: &str) -> String { out } +/// A message that is not a format string as a catalog key: each of its braces is literal, so it is +/// written `{{` or `}}`. +fn as_literal_key(s: &str) -> String { + s.replace('{', "{{").replace('}', "}}") +} + /// Render-site labels looked up in a context fall back to the plain row and then to English, and /// their templates fill in English as in any language. #[test] diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 2b3e843ba3..7120d44707 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -685,6 +685,8 @@ font-technology Variable Değişken Crop Image Resmi Kırp Image Tools Resim Araçları Remove Background… Arka Planı Kaldır… + Draw (Pencil) Çiz (Kurşun Kalem) + Place Image Resim Yerleştir Remove Background Arka Planı Kaldır Background Arka Plan Edge Color Kenar Rengi @@ -2448,6 +2450,7 @@ shape Open Açık Proportional Metrics Orantılı Metrikler Insert Aki Left Sola Aki Ekle Insert Aki Right Sağa Aki Ekle + Tsume Tsume Digits Rakamlar Arabic Arapça Hindi Hintçe @@ -4046,6 +4049,14 @@ axis Both Her İkisi @msg a script is running: stop it or wait for it to finish bir betik çalışıyor: durdurun veya bitmesini bekleyin @msg this is a compiled script, which cannot be run; use its source text bu derlenmiş bir betik, çalıştırılamaz; kaynak metnini kullanın @msg the script is not UTF-8 text betik UTF-8 metni değil +@msg script file is not UTF-8 text: {value} betik dosyası UTF-8 metni değil: {value} +@msg a number cannot be read bir sayı okunamıyor +@msg regular expression too large düzenli ifade çok büyük +@msg too many classes çok fazla karakter sınıfı +@msg too many groups çok fazla grup +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`: {why} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` smallThumb, mediumThumb, largeThumb, smallList veya largeList olmalıdır @msg the script is too large to run betik çalıştırılamayacak kadar büyük @msg a drag or an undo group is open; finish it before running a script bir sürükleme veya geri alma grubu açık; betiği çalıştırmadan önce tamamlayın @msg the script left a document that cannot be kept betik, saklanamayan bir belge bıraktı @@ -4238,6 +4249,7 @@ axis Both Her İkisi @msg `{key}` must be a string `{key}` bir dize olmalıdır @msg `{key}` must be a profile name or null `{key}` bir profil adı ya da null olmalıdır @msg `{key}` must be a whole number `{key}` bir tam sayı olmalıdır +@msg `index` must be a whole number `index` bir tam sayı olmalıdır @msg `{key}` must be a whole number between {min} and {max} (got {x}) `{key}`, {min} ile {max} arasında bir tam sayı olmalıdır ({x}'yi aldı) @msg `{key}` must be between {min} and {max} (got {x}) `{key}`, {min} ile {max} arasında olmalıdır ({x}'yi aldı) @msg `{key}` must be one of {_1} `{key}`, {_1}'den biri olmalıdır @@ -4246,6 +4258,7 @@ axis Both Her İkisi @msg `select` must be true or false `select` true veya false olmalıdır @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` ve `maxAnchors` tam sayı olmalıdır @msg `{key}` must be a number not below 0 `{key}` 0'dan küçük olmayan bir sayı olmalıdır +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` 0'dan küçük olmayan dört sayı olmalıdır: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` [x, y, width, height] olmalıdır: dört sonlu sayı, genişlik ve yükseklik negatif olmamalı @msg `{min_key}` is greater than `{max_key}` `{min_key}`, `{max_key}` değerinden büyük @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` şunlardan en az birini verin: `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4351,6 +4364,12 @@ axis Both Her İkisi @msg file version {0} is newer than this VectorCraft supports ({VERSION}) dosya sürümü {0}, VectorCraft'ın desteklediğinden daha yenidir ({VERSION}) @msg freeform point {i} needs `at` [x, y] and a valid `color` serbest biçimli nokta {i} için `at` [x, y] ve geçerli bir `color` gerekir @msg freeform line {i} must be an array of point indices Serbest biçimli çizgi {i}, bir nokta indeks dizisi olmalıdır +@msg freeform line {i}: {e} serbest biçimli çizgi {i}: {e} +@msg freeform point {i}: {e} serbest biçimli nokta {i}: {e} +@msg a line can't run from a point to itself bir çizgi bir noktadan aynı noktaya uzanamaz +@msg a line needs at least two points bir çizgi en az iki nokta gerektirir +@msg stop {i}: {e} durak {i}: {e} +@msg give `{key}` or `{other}`, not both `{key}` veya `{other}` verin, ikisini birden değil @msg give both `start` and `end` [x, y] (or neither) hem `start` hem de `end` [x, y] verin (ya da hiçbirini) @msg give corners of the path: anchors where its sides meet at an angle yolun köşelerini verin: kenarlarının belli bir açıyla buluştuğu noktalara sabitleyin @msg give horizontal or vertical yatay veya dikey ver @@ -4475,7 +4494,9 @@ axis Both Her İkisi @msg no action set to save kaydedilecek eylem seti yok @msg the action set file can't be read in full eylem seti dosyası tamamen okunamıyor @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out “{name}” yüklendi: {n} adım atlandı +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` “{name}” yüklendi: bilinmeyen komutlu {n} adım korundu; ilki: “{action}”, adım {step}, `{command}` @msg not an action set file bir eylem seti dosyası değil +@msg not an action set file ({e}) bir eylem seti dosyası değil ({e}) @msg the action set file is larger than 8 MiB eylem seti dosyası 8 MiB'den büyük @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: başvuru {MAX_BYTES} bayttan büyük olur @msg the action set file holds more than 1,000 actions eylem seti dosyası 1.000'den fazla eylem içeriyor @@ -4509,6 +4530,34 @@ axis Both Her İkisi @msg not a VectorCraft file: {0} bir VectorCraft dosyası değil: {0} @msg not a VectorCraft shortcut set (missing `overrides`) VectorCraft kısayol seti değil (`overrides` eksik) @msg not a graphic style library (format `{_1}`) grafik stili kitaplığı değil (`{_1}` biçimi) +@msg not a graphic style library: {e} grafik stili kitaplığı değil: {e} +@msg not a swatch library (.vcswatches or .gpl) renk örneği kitaplığı değil (.vcswatches veya .gpl) +@msg not a swatch library (format `{_1}`) renk örneği kitaplığı değil (`{_1}` biçimi) +@msg not a swatch library: {e} renk örneği kitaplığı değil: {e} +# Swatch exchange files, color books and color profiles. +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft bir renk örneği değişim dosyasından en fazla {ASE_MAX_ENTRIES} renk ve grup okur; bu kitaplıkta {entries} tane var +@msg a swatch exchange block is too long bir renk örneği değişim bloğu çok uzun +@msg a swatch exchange name is too long bir renk örneği değişim adı çok uzun +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) renk örneği değişim sürümü {major}.{minor} desteklenmiyor (yalnızca 1.x) +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups renk örneği değişim dosyası {ASE_MAX_ENTRIES} renk ve gruptan fazlasını içeriyor +@msg the swatch exchange file is cut short renk örneği değişim dosyası kısa kesildi +@msg too many swatch exchange blocks çok fazla renk örneği değişim bloğu +@msg color book version {version} isn't supported (only 1) renk kitabı sürümü {version} desteklenmiyor (yalnızca 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) {other} renk alanındaki renk kitapları desteklenmiyor (yalnızca RGB, CMYK ve Lab) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors renk kitabı {ASE_MAX_ENTRIES} renkten fazlasını içeriyor +@msg the color book is cut short renk kitabı kısa kesildi +@msg the color book's names take more than {_1} MB renk kitabının adları {_1} MB'tan fazla yer kaplıyor +@msg cannot read profile: {0} profil okunamıyor: {0} +@msg invalid ICC profile: {0} geçersiz ICC profili: {0} +@msg unknown colour profile: {0} bilinmeyen renk profili: {0} +@msg its localized names take more than {_1} KB yerelleştirilmiş adları {_1} KB'tan fazla yer kaplıyor +@msg its tag table lists the `{_1}` tag more than once etiket tablosu `{_1}` etiketini birden fazla kez listeliyor +@msg profile colour space {other} is not RGB, CMYK or Gray profil renk alanı {other}; RGB, CMYK veya Gray değil +@msg grayscale profiles can't be working spaces yet gri tonlamalı profiller henüz çalışma alanı olarak kullanılamaz +@msg {_1} clashes with a built-in profile name {_1}, yerleşik bir profil adıyla çakışıyor +@msg {_1}: no usable transform to/from sRGB {_1}: sRGB'ye veya sRGB'den kullanılabilir bir dönüşüm yok +@msg {name} is not a CMYK profile {name} bir CMYK profili değil +@msg {name} is not an RGB profile {name} bir RGB profili değil @msg not a shortcut set: the text doesn't start with a slash name and an opening brace bir kısayol seti değil: metin eğik çizgi adı ve açılış paranteziyle başlamıyor @msg not a stored central record saklanan merkezi bir kayıt değil @msg not a valid plug-in module: {0} geçerli bir eklenti modülü değil: {0} @@ -4516,7 +4565,7 @@ axis Both Her İkisi @msg not an HP-GL file HP-GL dosyası değil @msg not a PICT file PICT dosyası değil @msg `pens` must be an array of 1 to 255 #rrggbb colors `pens` 1 ile 255 arasında #rrggbb renginden oluşan bir dizi olmalıdır -@msg not an RTF file: it doesn't start with {\\rtf bir RTF dosyası değil: {\\rtf ile başlamıyor +@msg not an RTF file: it doesn't start with {{\\rtf bir RTF dosyası değil: {{\\rtf ile başlamıyor @msg not found bulunamadı @msg not in pattern editing mode desen düzenleme modunda değil @msg finish editing the pattern first önce deseni düzenlemeyi bitir @@ -4693,20 +4742,23 @@ axis Both Her İkisi @msg this file's PostScript couldn't be read ({why}): {what} bu dosyanın PostScript'i okunamadı ({why}): {what} @msg this format holds one artboard: export several as PDF or with document.exportForScreens bu formatta bir çalışma yüzeyi bulunur: birkaçını PDF olarak veya document.exportForScreens ile dışa aktarın @msg this is a DWG drawing, which can't be read: save it from the CAD app as an ASCII DXF and open that bu okunamayan bir DWG çizimidir: CAD uygulamasından ASCII DXF olarak kaydedin ve açın. +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that bu okunamayan bir DWG çizimidir: CAD uygulamasından DXF olarak kaydedin ve onu açın +@msg this binary DXF file is damaged or cut short bu ikili DXF dosyası hasarlı veya kısa kesilmiş @msg this is a PostScript file (an .ai saved in an older format or without PDF compatibility, or an EPS file), not a PDF: File › Open and File › Place read it as EPS bu bir PostScript dosyasıdır (eski bir formatta kaydedilmiş veya PDF uyumluluğu olmayan bir .ai veya bir EPS dosyası), PDF değil: Dosya › Aç ve Dosya › Yerleştir, EPS olarak oku @msg this is not a PostScript file bu bir PostScript dosyası değil @msg tool shortcuts must be a single key (optionally with Shift) araç kısayolları tek tuş olmalıdır (isteğe bağlı olarak Shift ile) @msg truncated kesik @msg unknown command `{0}` bilinmeyen komut `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` “{action}” eylemi, adım {step}: bilinmeyen `{command}` komutunu çalıştırıyor @msg unknown command `{0}`; did you mean `{1}`? bilinmeyen komut `{0}`; `{1}` mi demek istediniz? @msg unknown effect `{id}` bilinmeyen etki `{id}` @msg unknown format bilinmeyen format @msg unknown format `{f}` (Save writes {_1}) bilinmeyen format `{f}` (Kaydet, {_1} yazar) -@msg unknown freeform mode `{m}` (points, lines) bilinmeyen serbest biçimli mod `{m}` (noktalar, çizgiler) -@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) bilinmeyen gradyan türü `{k}` (doğrusal, radyal, konik, elmas, serbest biçimli) +@msg unknown freeform mode `{m}` (points, lines) bilinmeyen serbest biçimli mod `{m}` (points, lines) +@msg unknown gradient kind `{k}` (linear, radial, conic, diamond, freeform) bilinmeyen gradyan türü `{k}` (linear, radial, conic, diamond, freeform) @msg unknown highlight `{h}` bilinmeyen vurgu `{h}` @msg unknown option `{path}.{k}` bilinmeyen seçenek `{path}.{k}` -@msg unknown overprints `{o}` (preserve, simulate or discard) bilinmeyen üst baskılar `{o}` (koru, benzet veya at) +@msg unknown overprints `{o}` (preserve, simulate or discard) bilinmeyen üst baskılar `{o}` (preserve, simulate veya discard) @msg unknown panel `{raw}` bilinmeyen panel `{raw}` @msg panels can't be shown in Presentation Mode Sunum Modunda paneller gösterilemez @msg unknown preference `{key}` bilinmeyen tercih `{key}` @@ -4725,11 +4777,11 @@ axis Both Her İkisi @msg `{key}` must be an object `{key}` bir nesne olmalıdır @msg `prefs.import` runs on its own, not as a batch step `prefs.import` tek başına çalışır, toplu iş adımı olarak değil @msg unknown preset (one of {_1}) bilinmeyen ön ayar ({_1}'den biri) -@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) bilinmeyen ön ayar `{name}` (yüksek, orta, düşük veya kaydedilmiş bir ayar: bkz. flattener.presets.list) +@msg unknown preset `{name}` (high, medium, low or a saved one: see flattener.presets.list) bilinmeyen ön ayar `{name}` (high, medium, low veya kaydedilmiş bir ayar: bkz. flattener.presets.list) @msg unknown preset `{name}` (see flattener.presets.list) bilinmeyen ön ayar `{name}` (bkz. flattener.presets.list) @msg unknown preset `{name}` (see webExport.presets.list) bilinmeyen ön ayar `{name}` (bkz. webExport.presets.list) @msg unknown preset `{name}`: not a built-in or saved preset (see imageTrace.presets) bilinmeyen ön ayar `{name}`: yerleşik ya da kayıtlı bir ön ayar değil (bkz. imageTrace.presets) -@msg unknown side `{other}` (left|right|top|bottom) bilinmeyen taraf `{other}` (sol|sağ|üst|alt) +@msg unknown side `{other}` (left|right|top|bottom) bilinmeyen taraf `{other}` (left|right|top|bottom) @msg unknown tool `{tool}` bilinmeyen araç `{tool}` @msg unknown tool `{t}` bilinmeyen araç `{t}` @msg unknown tool or command `{key}` bilinmeyen araç veya komut `{key}` @@ -4948,6 +5000,16 @@ axis Both Her İkisi @msg automation path rejected: cannot resolve {path}: {e} otomasyon yolu reddedildi: {path} çözülemiyor: {e} @msg automation path rejected: parent traversal below a folder that doesn't exist: {path} otomasyon yolu reddedildi: var olmayan bir klasörün altında üst öğe geçişi: {path} @msg automation path rejected: reserved device names are not allowed: {path} otomasyon yolu reddedildi: ayrılmış cihaz adlarına izin verilmiyor: {path} +@msg cannot open the automation {kind} root `{_1}`: {e} otomasyon {kind} kökü `{_1}` açılamıyor: {e} +@msg cannot align zip entries to {align} bytes zip girdileri {align} bayta hizalanamıyor +@msg file name too long to zip: {_1} dosya adı zip için çok uzun: {_1} +@msg file name too long to zip: {name} dosya adı zip için çok uzun: {name} +@msg can't open “{name}”: {e} “{name}” açılamıyor: {e} +@msg {path}: could not be read {path}: okunamadı +@msg the request may not read the New Document profiles folder isteğin Yeni Belge profilleri klasörünü okuma izni yok +@msg its objects are nested too deep ({e}) nesneleri çok derin iç içe geçmiş ({e}) +@msg an image that couldn't be read was left out okunamayan bir görüntü dışarıda bırakıldı +@msg the {_1} plate can't be read: {e} {_1} baskı plakası okunamıyor: {e} @msg Multichannel PSD files can't be read: save it in RGB, CMYK or Grayscale mode Çok kanallı PSD dosyaları okunamıyor: RGB, CMYK veya Gri Tonlama modunda kaydedin @msg not a PSD file PSD dosyası değil @msg the PSD file has an unknown colour mode ({m}) PSD dosyasında bilinmeyen bir renk modu var ({m}) @@ -4979,6 +5041,42 @@ axis Both Her İkisi @msg the JPEG XL container is too large to read JPEG XL kapsayıcısı okunamayacak kadar büyük @msg CMYK JPEG XL images can't be read CMYK JPEG XL görüntüleri okunamıyor @msg the JPEG XL file can't be read: {e} JPEG XL dosyası okunamıyor: {e} +# Image export: encoders, sizes and options. +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP derinliği {_1}: piksel başına 1, 4, 8, 16, 24 veya 32 bit olmalıdır +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP kodlaması başarısız oldu: {width} × {height} piksel biçime veya piksel arabelleğine sığmıyor +@msg GIF encoding failed: the palette image is malformed GIF kodlaması başarısız oldu: palet görüntüsü bozuk biçimli +@msg GIF encoding failed: {e} GIF kodlaması başarısız oldu: {e} +@msg JPEG colour profile: {e} JPEG renk profili: {e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG kodlaması başarısız oldu: piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg JPEG encoding failed: {e} JPEG kodlaması başarısız oldu: {e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG kodlaması başarısız oldu: piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg PNG encoding failed: the palette image is malformed PNG kodlaması başarısız oldu: palet görüntüsü bozuk biçimli +@msg PNG encoding failed: {e} PNG kodlaması başarısız oldu: {e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG kodlaması başarısız oldu: {width} × {height} piksel geçerli bir görüntü boyutu değil +@msg PSD colour profile: {e} PSD renk profili: {e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD kodlaması başarısız oldu: piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg TIFF colour profile: {e} TIFF renk profili: {e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF kodlaması başarısız oldu: piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg TIFF encoding failed: {e} TIFF kodlaması başarısız oldu: {e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa derinliği {_1}: piksel başına 16, 24 veya 32 bit olmalıdır +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa kodlaması başarısız oldu: piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg WebP encoding failed: {e} WebP kodlaması başarısız oldu: {e} +@msg the pixel buffer doesn't match the image size piksel arabelleği görüntü boyutuyla eşleşmiyor +@msg too many layers for PSD (at most 32767) PSD için çok fazla katman (en fazla 32767) +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} piksel GIF için çok büyük (kenar başına en fazla 65535 piksel): çözünürlüğü düşürün +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} piksel JPEG için çok büyük (kenar başına en fazla 65535 piksel): çözünürlüğü düşürün +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} piksel Targa için çok büyük (kenar başına en fazla 65535 piksel): çözünürlüğü düşürün +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} piksel PSD için çok büyük (kenar başına en fazla {MAX_SIDE} piksel): çözünürlüğü düşürün +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution görüntü {w} × {h} piksel olurdu; raster dışa aktarmalar kenar başına {MAX_RASTER_SIDE} piksel ve {_1} megapiksel ile sınırlıdır: ölçeği veya çözünürlüğü düşürün +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels {sw} × {sh} boyutundaki bir görüntü {width} × {height} piksele yeniden boyutlandırılamaz +@msg a {width} × {height} image is too large {width} × {height} boyutundaki bir görüntü çok büyük +@msg a {width} × {height} image: {e} {width} × {height} boyutundaki bir görüntü: {e} +@msg an image could not be written: {e} bir görüntü yazılamadı: {e} +@msg invalid scale {scale} geçersiz ölçek {scale} +@msg SVG options: {e} SVG seçenekleri: {e} +@msg Save for Web settings: {e} Web için Kaydet ayarları: {e} +@msg the optimised image can't be read back: {e} en iyileştirilmiş görüntü geri okunamıyor: {e} +@msg the preview: {e} önizleme: {e} Video video De-Interlace… Taramasızlaştırma… De-Interlace Taramasızlaştırma @@ -5038,6 +5136,7 @@ effect Soft Yumuşak VectorCraft Title Bar on Every Desktop Her Masaüstünde VectorCraft Başlık Çubuğu The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. VECTORCRAFT_TITLEBAR ortam değişkeni ayarlı olduğu sürece başlık çubuğunu o seçer. System Title Bar takes precedence over this option while it is on. Sistem Başlık Çubuğu açık olduğu sürece bu seçeneğe göre önceliklidir. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Her Masaüstünde VectorCraft Başlık Çubuğu kapalı olduğu sürece, bu seçenek açık da olsa kapalı da olsa pencerenin başlık çubuğunu bu masaüstü çizer. Value Axis Değer Ekseni On Left Side Sol Tarafta On Right Side Sağ Tarafta @@ -5265,6 +5364,31 @@ lighting Light Işık @msg {label} draws no faces for this object {label} bu nesne için hiçbir yüz çizmez @msg the wireframe has more than {MAX_WIRE_EDGES} edges tel kafeste {MAX_WIRE_EDGES} kenardan fazla var @msg The 3D surface is too complex; simplify the shape 3 boyutlu yüzey çok karmaşık; şekli basitleştir +@msg 3D effects require finite coordinates within 100 million points 3D efektleri 100 milyon pt sınırı içinde sonlu koordinatlar gerektirir +@msg 3D effects require one to ten lights 3D efektleri bir ile on arasında ışık gerektirir +@msg The 3D projection is not finite 3D izdüşümü sonlu değil +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D gölgesi çok karmaşık; Gölgeler'i kapatın veya resmi basitleştirin +@msg The shape contains invalid coordinates Şekil geçersiz koordinatlar içeriyor +@msg Revolve profile contains invalid coordinates Döndür profili geçersiz koordinatlar içeriyor +@msg Revolve profile is too complex Döndür profili çok karmaşık +@msg Revolve projection is not finite Döndür izdüşümü sonlu değil +@msg Revolve requires finite profile coordinates within 100 million points Döndür, 100 milyon pt sınırı içinde sonlu profil koordinatları gerektirir +@msg Revolve surface is too complex; reduce Segments or simplify the profile Döndür yüzeyi çok karmaşık; Segmentler değerini azaltın veya profili basitleştirin +@msg Revolve surface is too complex; simplify the profile Döndür yüzeyi çok karmaşık; profili basitleştirin +@msg Revolve visibility cannot split the projected boundary Döndür görünürlüğü izdüşümü alınan sınırı bölemiyor +@msg Revolve visibility creates too many fragments Döndür görünürlüğü çok fazla parça oluşturuyor +@msg Revolve visibility creates too many vector anchors Döndür görünürlüğü çok fazla vektör bağlantı noktası oluşturuyor +@msg Revolve visibility exceeds its geometry work limit Döndür görünürlüğü geometri işlem sınırını aşıyor +@msg Revolve visibility exceeds its spatial index limit Döndür görünürlüğü uzamsal dizin sınırını aşıyor +@msg Revolve visibility has too many boundary crossings Döndür görünürlüğünde çok fazla sınır kesişimi var +@msg Revolve visibility has too many input anchors Döndür görünürlüğünde çok fazla girdi bağlantı noktası var +@msg Revolve visibility requires convex cap sectors Döndür görünürlüğü dışbükey kapak dilimleri gerektirir +@msg Revolve visibility requires finite projected faces Döndür görünürlüğü sonlu izdüşüm yüzleri gerektirir +@msg Too many Revolve faces for visibility evaluation Görünürlük değerlendirmesi için çok fazla Döndür yüzü var +@msg input contains NaN or infinite coordinates girdi NaN veya sonsuz koordinatlar içeriyor +@msg input path could not be closed girdi yolu kapatılamadı +@msg the shapes are too degenerate to combine şekiller birleştirilemeyecek kadar yozlaşmış +@msg the shapes cross themselves and each other too often to combine şekiller kendilerini ve birbirlerini birleştirilemeyecek kadar sık kesiyor Transform Objects Nesneleri Dönüştür @msg unknown parameter `{key}`; did you mean `{near}`? bilinmeyen parametre `{key}`; `{near}` mi demek istediniz? @msg unknown parameter `{key}`; the command takes no parameters bilinmeyen parametre `{key}`; komut hiçbir parametre almaz @@ -6345,8 +6469,8 @@ axis Y Axis Y ekseni @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` dışa aktarma eklentisi 1 ile {MAX_EXTENSIONS} arasında `extensions` bildirir @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` gruplar dışında en fazla {MAX_UNGROUPED} parametre olabilir: diğerlerine bir `group` verin @msg can't encode the input girdi kodlanamıyor -@msg expected {"dataBase64"} beklenen: {"dataBase64"} -@msg expected {"objects"} beklenen: {"objects"} +@msg expected {{"dataBase64": "…"}} beklenen: {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} beklenen: {{"objects": [...]}} @msg export `{name}`: {e} modül dışa aktarımı `{name}`: {e} @msg extension {e} is listed twice {e} uzantısı iki kez listelenmiş @msg extension {e}: use 1-16 lower-case letters and digits, without the dot {e} uzantısı: nokta olmadan 1-16 küçük harf ve rakam kullanın @@ -6410,11 +6534,11 @@ axis Y Axis Y ekseni @msg a painted live effect returns only `objects` boyama türü canlı efekt yalnızca `objects` döndürür @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` boyama türü canlı efektin bir parçasında yalnızca `path`, `fillRule`, `fills` ve `strokes` bulunur @msg a read-only object was left out salt okunur bir nesne atlandı -@msg a read-only object was left out: return it, as {"id"} alone or as it was given salt okunur bir nesne atlandı: onu yalnızca {"id"} olarak veya verildiği gibi döndürün +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given salt okunur bir nesne atlandı: onu yalnızca {{"id": …}} olarak veya verildiği gibi döndürün @msg a string bir dize @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` bir konturda yalnızca `paint`, `width`, `join`, `cap` ve `miterLimit` bulunur -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} bir kontur {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} biçiminde olmalıdır -@msg an effect must be {"id", "params"?, "visible"?} bir efekt {"id", "params"?, "visible"?} biçiminde olmalıdır +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} bir kontur {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} biçiminde olmalıdır +@msg an effect must be {{"id", "params"?, "visible"?}} bir efekt {{"id", "params"?, "visible"?}} biçiminde olmalıdır @msg an effect on a fill returns only `fills` dolgudaki bir efekt yalnızca `fills` döndürür @msg an effect on a stroke returns only `strokes` konturdaki bir efekt yalnızca `strokes` döndürür @msg an object must be a JSON object bir nesne bir JSON nesnesi olmalıdır @@ -6556,6 +6680,8 @@ axis Y Axis Y ekseni Action Options… Eylem Seçenekleri… Action Options Eylem Seçenekleri Playback Options… Oynatma Seçenekleri… + Button Mode Düğme Modu + No actions. Eylem yok. Insert Stop… Durak Ekle… Insert Stop Durak Ekle Record Stop Durak Kaydet @@ -7419,6 +7545,12 @@ breakText Glyphs Glifler @msg open the practice sample of `{id}` first (see learn.openSample) önce `{id}` öğreticisinin alıştırma örneğini açın (bkz. learn.openSample) @msg finish `{id}` first (see learn.finish) önce `{id}` öğreticisini bitirin (bkz. learn.finish) @msg `{id}` is the last tutorial in its skill `{id}`, becerisinin son öğreticisidir + Reset progress İlerlemeyi sıfırla + Mark Tutorial Step Öğretici Adımını İşaretle + Reset Learn Progress Öğrenme İlerlemesini Sıfırla +@msg missing `step` (see learn.show) `step` eksik (bkz. learn.show) +@msg `step` must be a step number from 0 to {last} `step`, 0 ile {last} arasında bir adım numarası olmalıdır +@msg `{id}` is finished (see learn.resetProgress) `{id}` bitirildi (bkz. learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Ertelenen Efektleri Yenile diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 50690fa0c7..84f296b0a6 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -699,6 +699,8 @@ font-technology Variable Варіативні Crop Image Обрізати зображення Image Tools Інструменти зображення Remove Background… Видалити фон… + Draw (Pencil) Малювати (Олівець) + Place Image Помістити зображення Remove Background Видалити фон Background Фон Edge Color Колір краю @@ -2698,6 +2700,7 @@ mark-style Japanese Японський Proportional Metrics Пропорційні метрики Insert Aki Left Вставити акі ліворуч Insert Aki Right Вставити акі праворуч + Tsume Цуме Character Direction Напрямок символів Digits Цифри Arabic Арабські @@ -4525,6 +4528,7 @@ axis Both Обидві @msg `select` must be true or false `select` має бути true або false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` і `maxAnchors` мають бути цілими числами @msg `{key}` must be a number not below 0 `{key}` має бути числом, не меншим за 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` має бути чотирма числами, не меншими за 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` має бути [x, y, width, height]: чотири скінченні числа, ширина й висота невід’ємні @msg `{min_key}` is greater than `{max_key}` `{min_key}` більше за `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` укажіть принаймні один із параметрів `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4777,6 +4781,7 @@ axis Both Обидві @msg no action set to save немає набору дій для збереження @msg the action set file can't be read in full файл набору дій неможливо прочитати повністю @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Завантажено «{name}»: пропущено {n} крок|Завантажено «{name}»: пропущено {n} кроки|Завантажено «{name}»: пропущено {n} кроків +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Завантажено «{name}»: {n} крок із невідомою командою збережено: «{action}», крок {step}, `{command}`|Завантажено «{name}»: {n} кроки з невідомими командами збережено; перший: «{action}», крок {step}, `{command}`|Завантажено «{name}»: {n} кроків із невідомими командами збережено; перший: «{action}», крок {step}, `{command}` @msg not an action set file це не файл набору дій @msg the action set file is larger than 8 MiB файл набору дій більший за 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: довідник був би більшим за {MAX_BYTES} байтів @@ -5018,6 +5023,7 @@ axis Both Обидві @msg tool shortcuts must be a single key (optionally with Shift) поєднання інструментів має бути однією клавішею (необов’язково з Shift) @msg truncated усічено @msg unknown command `{0}` невідома команда `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` крок {step} дії «{action}» виконує невідому команду `{command}` @msg unknown command `{0}`; did you mean `{1}`? невідома команда `{0}`; можливо, ви мали на увазі `{1}`? @msg unknown effect `{id}` невідомий ефект `{id}` @msg unknown format невідомий формат @@ -5359,6 +5365,7 @@ axis Both Обидві VectorCraft Title Bar on Every Desktop Рядок заголовка VectorCraft на будь-якій стільниці The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Поки змінну середовища VECTORCRAFT_TITLEBAR задано, рядок заголовка вибирає вона. System Title Bar takes precedence over this option while it is on. Поки ввімкнено «Системний рядок заголовка», він має пріоритет над цим параметром. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Поки «Рядок заголовка VectorCraft на будь-якій стільниці» вимкнено, ця стільниця малює рядок заголовка вікна незалежно від того, чи ввімкнено цей параметр. Value Axis Вісь значень On Left Side Ліворуч On Right Side Праворуч @@ -5995,8 +6002,8 @@ axis Y Axis Вісь Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` модуль експорту оголошує від 1 до {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` поза групами може бути не більше {MAX_UNGROUPED} параметрів: задайте решті `group` @msg can't encode the input не вдається закодувати вхідні дані -@msg expected {"dataBase64"} очікувалося {"dataBase64"} -@msg expected {"objects"} очікувалося {"objects"} +@msg expected {{"dataBase64": "…"}} очікувалося {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} очікувалося {{"objects": [...]}} @msg export `{name}`: {e} експорт модуля `{name}`: {e} @msg extension {e} is listed twice розширення {e} вказано двічі @msg extension {e}: use 1-16 lower-case letters and digits, without the dot розширення {e}: використовуйте 1-16 малих літер і цифр, без крапки @@ -6060,11 +6067,11 @@ axis Y Axis Вісь Y @msg a painted live effect returns only `objects` малювальний динамічний ефект повертає лише `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` частина малювального динамічного ефекту має лише `path`, `fillRule`, `fills` і `strokes` @msg a read-only object was left out пропущено об’єкт лише для читання -@msg a read-only object was left out: return it, as {"id"} alone or as it was given пропущено об’єкт лише для читання: поверніть його як один {"id"} або в тому вигляді, у якому його передано +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given пропущено об’єкт лише для читання: поверніть його як один {{"id": …}} або в тому вигляді, у якому його передано @msg a string рядок @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` обведення має лише `paint`, `width`, `join`, `cap` і `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} обведення має мати вигляд {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} ефект має мати вигляд {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} обведення має мати вигляд {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} ефект має мати вигляд {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` ефект на заливці повертає лише `fills` @msg an effect on a stroke returns only `strokes` ефект на обведенні повертає лише `strokes` @msg an object must be a JSON object об’єкт має бути об’єктом JSON @@ -6206,6 +6213,8 @@ axis Y Axis Вісь Y Action Options… Параметри дії… Action Options Параметри дії Playback Options… Параметри відтворення… + Button Mode Режим кнопок + No actions. Нема дій. Insert Stop… Вставити зупинку… Insert Stop Вставити зупинку Record Stop Записати зупинку @@ -7073,6 +7082,12 @@ breakText Glyphs Гліфи @msg open the practice sample of `{id}` first (see learn.openSample) спочатку відкрийте навчальний приклад уроку `{id}` (див. learn.openSample) @msg finish `{id}` first (see learn.finish) спочатку завершіть `{id}` (див. learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` є останнім уроком своєї навички + Reset progress Скинути прогрес + Mark Tutorial Step Позначити крок уроку + Reset Learn Progress Скинути прогрес навчання +@msg missing `step` (see learn.show) відсутній `step` (див. learn.show) +@msg `step` must be a step number from 0 to {last} `step` має бути номером кроку від 0 до {last} +@msg `{id}` is finished (see learn.resetProgress) урок `{id}` завершено (див. learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Оновити відкладені ефекти diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index d8469bce53..e8b9e5758f 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -806,6 +806,8 @@ font-technology Variable Biến thiên Crop Image Cắt xén ảnh Image Tools Công cụ hình ảnh Remove Background… Xóa nền… + Draw (Pencil) Vẽ (Bút chì) + Place Image Đặt hình ảnh Remove Background Xóa nền Background Nền Edge Color Màu cạnh @@ -3011,6 +3013,7 @@ mark-style Japanese Kiểu Nhật Proportional Metrics Số liệu theo tỷ lệ Insert Aki Left Chèn aki bên trái Insert Aki Right Chèn aki bên phải + Tsume Tsume Proportional Lining Số tỷ lệ đứng Position: Vị trí: Default Position Vị trí mặc định @@ -4036,6 +4039,7 @@ mark-style Japanese Kiểu Nhật VectorCraft Title Bar on Every Desktop Thanh tiêu đề VectorCraft trên mọi màn hình nền The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. Khi biến môi trường VECTORCRAFT_TITLEBAR được đặt, biến này chọn thanh tiêu đề. System Title Bar takes precedence over this option while it is on. Khi Thanh tiêu đề hệ thống được bật, tùy chọn đó được ưu tiên hơn tùy chọn này. + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. Khi Thanh tiêu đề VectorCraft trên mọi màn hình nền đang tắt, màn hình nền này vẽ thanh tiêu đề của cửa sổ dù tùy chọn này bật hay tắt. Tab Tab Tab Stops Vị trí tab Table Bảng @@ -4573,6 +4577,7 @@ theme Appearance Giao diện @msg `select` must be true or false `select` phải là true hoặc false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` và `maxAnchors` phải là số nguyên @msg `{key}` must be a number not below 0 `{key}` phải là một số không nhỏ hơn 0 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` phải là bốn số không nhỏ hơn 0: [tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` phải là [x, y, width, height]: bốn số hữu hạn, chiều rộng và chiều cao không âm @msg `{min_key}` is greater than `{max_key}` `{min_key}` lớn hơn `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` hãy cung cấp ít nhất một trong `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -5089,6 +5094,7 @@ theme Appearance Giao diện @msg no action set to save không có bộ hành động nào để lưu @msg the action set file can't be read in full không thể đọc hết tệp bộ hành động @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out Đã tải “{name}”: bỏ qua {n} bước +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` Đã tải “{name}”: giữ lại {n} bước có lệnh không xác định; bước đầu tiên: “{action}”, bước {step}, `{command}` @msg not an action set file không phải tệp bộ hành động @msg the action set file is larger than 8 MiB tệp bộ hành động lớn hơn 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`: tài liệu tham khảo sẽ lớn hơn {MAX_BYTES} byte @@ -5530,6 +5536,7 @@ theme Appearance Giao diện @msg truncated bị cắt ngắn @msg Unembedded to {_1} Đã bỏ nhúng vào {_1} @msg unknown command `{0}` lệnh không xác định `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` bước {step} của “{action}” chạy lệnh không xác định `{command}` @msg unknown command `{0}`; did you mean `{1}`? lệnh không xác định `{0}`; ý bạn là `{1}`? @msg unknown effect `{id}` hiệu ứng không xác định `{id}` @msg unknown format định dạng không xác định @@ -5996,8 +6003,8 @@ axis Y Axis Trục Y @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` plug-in xuất khai báo từ 1 đến {MAX_EXTENSIONS} `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` tối đa {MAX_UNGROUPED} tham số nằm ngoài nhóm: hãy đặt `group` cho các tham số còn lại @msg can't encode the input không thể mã hóa dữ liệu đầu vào -@msg expected {"dataBase64"} cần có {"dataBase64"} -@msg expected {"objects"} cần có {"objects"} +@msg expected {{"dataBase64": "…"}} cần có {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} cần có {{"objects": [...]}} @msg export `{name}`: {e} export `{name}` của mô-đun: {e} @msg extension {e} is listed twice phần mở rộng {e} được liệt kê hai lần @msg extension {e}: use 1-16 lower-case letters and digits, without the dot phần mở rộng {e}: dùng 1-16 chữ thường và chữ số, không có dấu chấm @@ -6061,11 +6068,11 @@ axis Y Axis Trục Y @msg a painted live effect returns only `objects` hiệu ứng động kiểu tô chỉ trả về `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` một phần của hiệu ứng động kiểu tô chỉ có `path`, `fillRule`, `fills` và `strokes` @msg a read-only object was left out một đối tượng chỉ đọc đã bị bỏ sót -@msg a read-only object was left out: return it, as {"id"} alone or as it was given một đối tượng chỉ đọc đã bị bỏ sót: hãy trả lại nó dưới dạng chỉ {"id"} hoặc như khi được nhận +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given một đối tượng chỉ đọc đã bị bỏ sót: hãy trả lại nó dưới dạng chỉ {{"id": …}} hoặc như khi được nhận @msg a string một chuỗi @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` nét chỉ có `paint`, `width`, `join`, `cap` và `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} nét phải có dạng {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} -@msg an effect must be {"id", "params"?, "visible"?} hiệu ứng phải có dạng {"id", "params"?, "visible"?} +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} nét phải có dạng {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} +@msg an effect must be {{"id", "params"?, "visible"?}} hiệu ứng phải có dạng {{"id", "params"?, "visible"?}} @msg an effect on a fill returns only `fills` hiệu ứng trên phần tô chỉ trả về `fills` @msg an effect on a stroke returns only `strokes` hiệu ứng trên nét chỉ trả về `strokes` @msg an object must be a JSON object đối tượng phải là một đối tượng JSON @@ -6207,6 +6214,8 @@ axis Y Axis Trục Y Action Options… Tùy chọn hành động… Action Options Tùy chọn hành động Playback Options… Tùy chọn phát lại… + Button Mode Chế độ nút + No actions. Không có hành động. Insert Stop… Chèn điểm dừng… Insert Stop Chèn điểm dừng Record Stop Ghi điểm dừng @@ -7074,6 +7083,12 @@ breakText Glyphs Glyph @msg open the practice sample of `{id}` first (see learn.openSample) hãy mở tệp mẫu thực hành của `{id}` trước (xem learn.openSample) @msg finish `{id}` first (see learn.finish) hãy hoàn tất `{id}` trước (xem learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` là hướng dẫn cuối cùng trong kỹ năng của nó + Reset progress Đặt lại tiến độ + Mark Tutorial Step Đánh dấu bước hướng dẫn + Reset Learn Progress Đặt lại tiến độ học +@msg missing `step` (see learn.show) thiếu `step` (xem learn.show) +@msg `step` must be a step number from 0 to {last} `step` phải là số bước từ 0 đến {last} +@msg `{id}` is finished (see learn.resetProgress) `{id}` đã hoàn tất (xem learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects Làm mới hiệu ứng bị hoãn diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index d9d9110276..719968086f 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -650,6 +650,8 @@ antiAlias Sharp 锐利 Crop Image 裁剪图像 Image Tools 图像工具 Remove Background… 移除背景… + Draw (Pencil) 绘制 (铅笔) + Place Image 置入图像 Remove Background 移除背景 Background 背景 Edge Color 边缘颜色 @@ -2561,6 +2563,7 @@ font-script Japanese 汉字 Proportional Metrics 比例度量 Insert Aki Left 在前方插入空白 Insert Aki Right 在后方插入空白 + Tsume 比例间距 Character Direction 字符方向 Digits 数字 Arabic 阿拉伯数字 @@ -4406,6 +4409,7 @@ imageTrace Outline 轮廓 @msg objects can't be nested more than 32 deep 对象的嵌套不能超过 32 层 @msg the SVG's elements are nested more than {0} deep SVG 的元素嵌套超过 {0} 层 @msg unknown command `{0}` 未知命令 `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` “{action}”的步骤 {step} 运行未知命令 `{command}` @msg unknown command `{0}`; did you mean `{1}`? 未知命令 `{0}`;您是否想输入 `{1}`? @msg `{what}` closes nothing `{what}` 没有可结束的内容 @msg `{what}` closes something it didn't open `{what}` 结束了并非由它开始的内容 @@ -4694,6 +4698,7 @@ imageTrace Outline 轮廓 @msg `select` must be true or false `select` 必须是 true 或 false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` 和 `maxAnchors` 必须是整数 @msg `{key}` must be a number not below 0 `{key}` 必须是不小于 0 的数字 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` 必须是四个不小于 0 的数字:[tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` 必须是 [x, y, width, height]:四个有限数字,宽度和高度不能为负 @msg `{min_key}` is greater than `{max_key}` `{min_key}` 大于 `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` 请至少提供以下其中之一:`name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -4740,6 +4745,7 @@ imageTrace Outline 轮廓 @msg no action set to save 没有要存储的动作组 @msg the action set file can't be read in full 无法完整读取动作组文件 @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out 已载入“{name}”:已略过 {n} 个步骤 +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` 已载入“{name}”:保留了 {n} 个含未知命令的步骤;第一个:“{action}”,步骤 {step},`{command}` @msg not an action set file 不是动作组文件 @msg the action set file is larger than 8 MiB 动作组文件大于 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`:参考将大于 {MAX_BYTES} 字节 @@ -5659,6 +5665,7 @@ effect Vertical 垂直 VectorCraft Title Bar on Every Desktop 在所有桌面上使用 VectorCraft 标题栏 The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. 设置了环境变量 VECTORCRAFT_TITLEBAR 时,由它选择标题栏。 System Title Bar takes precedence over this option while it is on. 开启系统标题栏时,它优先于此选项。 + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. 未开启“在所有桌面上使用 VectorCraft 标题栏”时,无论此选项是否开启,此桌面都会绘制窗口的标题栏。 Value Axis 数值轴 On Left Side 左侧 On Right Side 右侧 @@ -6228,8 +6235,8 @@ axis Y Axis Y 轴 @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` 导出增效工具声明 1 到 {MAX_EXTENSIONS} 个 `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` 组外最多 {MAX_UNGROUPED} 个参数:请为其余参数指定 `group` @msg can't encode the input 无法编码输入 -@msg expected {"dataBase64"} 应为 {"dataBase64"} -@msg expected {"objects"} 应为 {"objects"} +@msg expected {{"dataBase64": "…"}} 应为 {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} 应为 {{"objects": [...]}} @msg export `{name}`: {e} 模块导出 `{name}`:{e} @msg extension {e} is listed twice 扩展名 {e} 列出了两次 @msg extension {e}: use 1-16 lower-case letters and digits, without the dot 扩展名 {e}:请使用 1-16 个小写字母和数字,不带点 @@ -6293,11 +6300,11 @@ axis Y Axis Y 轴 @msg a painted live effect returns only `objects` 绘制型实时效果只返回 `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` 绘制型实时效果的片段只有 `path`、`fillRule`、`fills` 和 `strokes` @msg a read-only object was left out 漏掉了一个只读对象 -@msg a read-only object was left out: return it, as {"id"} alone or as it was given 漏掉了一个只读对象:请以单独的 {"id"} 或原样返回它 +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given 漏掉了一个只读对象:请以单独的 {{"id": …}} 或原样返回它 @msg a string 字符串 @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` 描边只有 `paint`、`width`、`join`、`cap` 和 `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 描边必须是 {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 形式 -@msg an effect must be {"id", "params"?, "visible"?} 效果必须是 {"id", "params"?, "visible"?} 形式 +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 描边必须是 {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 形式 +@msg an effect must be {{"id", "params"?, "visible"?}} 效果必须是 {{"id", "params"?, "visible"?}} 形式 @msg an effect on a fill returns only `fills` 填色上的效果只返回 `fills` @msg an effect on a stroke returns only `strokes` 描边上的效果只返回 `strokes` @msg an object must be a JSON object 对象必须是 JSON 对象 @@ -6439,6 +6446,8 @@ axis Y Axis Y 轴 Action Options… 动作选项… Action Options 动作选项 Playback Options… 播放选项… + Button Mode 按钮模式 + No actions. 没有动作。 Insert Stop… 插入停止… Insert Stop 插入停止 Record Stop 记录停止 @@ -7302,6 +7311,12 @@ breakText Glyphs 字形 @msg open the practice sample of `{id}` first (see learn.openSample) 请先打开 `{id}` 的练习示例 (请参阅 learn.openSample) @msg finish `{id}` first (see learn.finish) 请先完成 `{id}` (请参阅 learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` 是其技能的最后一个教程 + Reset progress 重置进度 + Mark Tutorial Step 标记教程步骤 + Reset Learn Progress 重置学习进度 +@msg missing `step` (see learn.show) 缺少 `step` (请参阅 learn.show) +@msg `step` must be a step number from 0 to {last} `step` 必须是 0 到 {last} 之间的步骤编号 +@msg `{id}` is finished (see learn.resetProgress) `{id}` 已完成 (请参阅 learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects 刷新延迟的效果 @@ -9145,3 +9160,119 @@ breakText Glyphs 字形 @msg {what} can't be intertwined {what} 不能交织 @msg {what} doesn't fit the paper with its bleed and marks {what} 连同出血和标记在纸张上放不下 @msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 会打印成超过 {MAX_TILES} 个拼贴:请将其缩小 + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D 效果需要 1 亿点以内的有限坐标 +@msg 3D effects require one to ten lights 3D 效果需要一到十个光源 +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP 位深度 {_1}:须为每像素 1、4、8、16、24 或 32 位 +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP 编码失败:{width} × {height} 像素与该格式或像素缓冲区不符 +@msg GIF encoding failed: the palette image is malformed GIF 编码失败:调板图像格式错误 +@msg GIF encoding failed: {e} GIF 编码失败:{e} +@msg JPEG colour profile: {e} JPEG 颜色配置文件:{e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG 编码失败:像素缓冲区与图像尺寸不符 +@msg JPEG encoding failed: {e} JPEG 编码失败:{e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG 编码失败:像素缓冲区与图像尺寸不符 +@msg PNG encoding failed: the palette image is malformed PNG 编码失败:调板图像格式错误 +@msg PNG encoding failed: {e} PNG 编码失败:{e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG 编码失败:{width} × {height} 像素不是有效的图像尺寸 +@msg PSD colour profile: {e} PSD 颜色配置文件:{e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD 编码失败:像素缓冲区与图像尺寸不符 +@msg Revolve profile contains invalid coordinates 回转轮廓包含无效坐标 +@msg Revolve profile is too complex 回转轮廓过于复杂 +@msg Revolve projection is not finite 回转投影不是有限值 +@msg Revolve requires finite profile coordinates within 100 million points 回转需要 1 亿点以内的有限轮廓坐标 +@msg Revolve surface is too complex; reduce Segments or simplify the profile 回转表面过于复杂;请减少分段数或简化轮廓 +@msg Revolve surface is too complex; simplify the profile 回转表面过于复杂;请简化轮廓 +@msg Revolve visibility cannot split the projected boundary 回转可见性计算无法分割投影边界 +@msg Revolve visibility creates too many fragments 回转可见性计算产生的碎片过多 +@msg Revolve visibility creates too many vector anchors 回转可见性计算产生的矢量锚点过多 +@msg Revolve visibility exceeds its geometry work limit 回转可见性计算超出几何运算上限 +@msg Revolve visibility exceeds its spatial index limit 回转可见性计算超出空间索引上限 +@msg Revolve visibility has too many boundary crossings 回转可见性计算中的边界交叉过多 +@msg Revolve visibility has too many input anchors 回转可见性计算的输入锚点过多 +@msg Revolve visibility requires convex cap sectors 回转可见性计算需要凸形端盖扇区 +@msg Revolve visibility requires finite projected faces 回转可见性计算需要有限的投影面 +@msg SVG options: {e} SVG 选项:{e} +@msg Save for Web settings: {e} 存储为 Web 所用格式设置:{e} +@msg TIFF colour profile: {e} TIFF 颜色配置文件:{e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF 编码失败:像素缓冲区与图像尺寸不符 +@msg TIFF encoding failed: {e} TIFF 编码失败:{e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa 位深度 {_1}:须为每像素 16、24 或 32 位 +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa 编码失败:像素缓冲区与图像尺寸不符 +@msg The 3D projection is not finite 3D 投影不是有限值 +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D 阴影过于复杂;请关闭阴影或简化图稿 +@msg The shape contains invalid coordinates 形状包含无效坐标 +@msg Too many Revolve faces for visibility evaluation 回转的面过多,无法进行可见性计算 +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft 最多从色板交换文件中读取 {ASE_MAX_ENTRIES} 个颜色和组,而此库有 {entries} 个 +@msg WebP encoding failed: {e} WebP 编码失败:{e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`:{why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` 必须是 smallThumb、mediumThumb、largeThumb、smallList 或 largeList +@msg a line can't run from a point to itself 曲线不能从一个点连到该点自身 +@msg a line needs at least two points 曲线至少需要两个点 +@msg a number cannot be read 无法读取数字 +@msg a swatch exchange block is too long 色板交换文件中的某个块过长 +@msg a swatch exchange name is too long 色板交换文件中的某个名称过长 +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels 无法将 {sw} × {sh} 的图像调整为 {width} × {height} 像素 +@msg a {width} × {height} image is too large {width} × {height} 的图像过大 +@msg a {width} × {height} image: {e} {width} × {height} 的图像:{e} +@msg an image could not be written: {e} 无法写入某个图像:{e} +@msg an image that couldn't be read was left out 已略去一个无法读取的图像 +@msg can't open “{name}”: {e} 无法打开“{name}”:{e} +@msg cannot align zip entries to {align} bytes 无法将 zip 条目对齐到 {align} 字节 +@msg cannot open the automation {kind} root `{_1}`: {e} 无法打开自动化 {kind} 根目录 `{_1}`:{e} +@msg cannot read profile: {0} 无法读取配置文件:{0} +@msg color book version {version} isn't supported (only 1) 不支持色谱版本 {version} (仅支持 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) 不支持色彩空间为 {other} 的色谱 (仅支持 RGB、CMYK 和 Lab) +@msg file name too long to zip: {_1} 文件名过长,无法放入 zip:{_1} +@msg file name too long to zip: {name} 文件名过长,无法放入 zip:{name} +@msg freeform line {i}: {e} 自由曲线 {i}:{e} +@msg freeform point {i}: {e} 自由点 {i}:{e} +@msg give `{key}` or `{other}`, not both 请提供 `{key}` 或 `{other}`,不要同时提供两者 +@msg grayscale profiles can't be working spaces yet 灰度配置文件目前还不能用作工作空间 +@msg input contains NaN or infinite coordinates 输入包含 NaN 或无穷大坐标 +@msg input path could not be closed 无法闭合输入路径 +@msg invalid ICC profile: {0} ICC 配置文件无效:{0} +@msg invalid scale {scale} 缩放比例 {scale} 无效 +@msg its localized names take more than {_1} KB 其本地化名称超过 {_1} KB +@msg its objects are nested too deep ({e}) 其对象嵌套过深 ({e}) +@msg its tag table lists the `{_1}` tag more than once 其标签表多次列出 `{_1}` 标签 +@msg not a graphic style library: {e} 不是图形样式库:{e} +@msg not a swatch library (.vcswatches or .gpl) 不是色板库 (.vcswatches 或 .gpl) +@msg not a swatch library (format `{_1}`) 不是色板库 (格式为 `{_1}`) +@msg not a swatch library: {e} 不是色板库:{e} +@msg not an action set file ({e}) 不是动作组文件 ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray 配置文件的色彩空间 {other} 不是 RGB、CMYK 或灰度 +@msg regular expression too large 正则表达式过大 +@msg script file is not UTF-8 text: {value} 脚本文件不是 UTF-8 文本:{value} +@msg stop {i}: {e} 色标 {i}:{e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) 不支持色板交换文件版本 {major}.{minor} (仅支持 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors 色谱包含的颜色超过 {ASE_MAX_ENTRIES} 种 +@msg the color book is cut short 色谱数据不完整 +@msg the color book's names take more than {_1} MB 色谱的名称超过 {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution 图像将为 {w} × {h} 像素;栅格导出限制为每边 {MAX_RASTER_SIDE} 像素和 {_1} 百万像素:请降低缩放比例或分辨率 +@msg the optimised image can't be read back: {e} 无法回读优化后的图像:{e} +@msg the pixel buffer doesn't match the image size 像素缓冲区与图像尺寸不符 +@msg the preview: {e} 预览:{e} +@msg the request may not read the New Document profiles folder 此请求无权读取新建文档配置文件文件夹 +@msg the shapes are too degenerate to combine 这些形状过于退化,无法合并 +@msg the shapes cross themselves and each other too often to combine 这些形状的自身交叉和相互交叉过多,无法合并 +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups 色板交换文件包含的颜色和组超过 {ASE_MAX_ENTRIES} 个 +@msg the swatch exchange file is cut short 色板交换文件不完整 +@msg the {_1} plate can't be read: {e} 无法读取 {_1} 印版:{e} +@msg this binary DXF file is damaged or cut short 此二进制 DXF 文件已损坏或不完整 +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that 这是 DWG 图纸,无法读取:请在 CAD 应用中将其保存为 DXF,然后打开该文件 +@msg too many classes 字符类过多 +@msg too many groups 分组过多 +@msg too many layers for PSD (at most 32767) 图层过多,PSD 无法容纳 (最多 32767 个) +@msg too many swatch exchange blocks 色板交换文件中的块过多 +@msg unknown colour profile: {0} 未知的颜色配置文件:{0} +@msg {_1} clashes with a built-in profile name {_1} 与内置配置文件名称冲突 +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} 像素对 GIF 而言过大 (每边最多 65535 像素):请降低分辨率 +@msg {_1}: no usable transform to/from sRGB {_1}:没有可用的与 sRGB 之间的转换 +@msg {name} is not a CMYK profile {name} 不是 CMYK 配置文件 +@msg {name} is not an RGB profile {name} 不是 RGB 配置文件 +@msg {path}: could not be read {path}:无法读取 +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} 像素对 JPEG 而言过大 (每边最多 65535 像素):请降低分辨率 +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} 像素对 Targa 而言过大 (每边最多 65535 像素):请降低分辨率 +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素对 PSD 而言过大 (每边最多 {MAX_SIDE} 像素):请降低分辨率 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index a0d987fe69..121a8b8c02 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -7,6 +7,7 @@ # the translation is a single string (see `plural` in i18n.rs) # anything else a disambiguating context passed to `tr_ctx` # escapes \n \t \\ inside a column. `{name}` placeholders must appear in both columns. +# In @msg rows a literal brace is written {{ or }}, as in a Rust format string. # lines starting with # and blank lines are ignored. # # Clean-room: every entry was written from the plain meaning of the English label using the @@ -667,6 +668,8 @@ font-technology Variable 可變 Crop Image 裁切影像 Image Tools 影像工具 Remove Background… 移除背景… + Draw (Pencil) 繪製 (鉛筆) + Place Image 置入影像 Remove Background 移除背景 Background 背景 Edge Color 邊緣顏色 @@ -2117,6 +2120,7 @@ file-filter Templates 範本 @msg objects can't be nested more than 32 deep 物件的巢狀層級不能超過 32 層 @msg the SVG's elements are nested more than {0} deep SVG 的元素巢狀超過 {0} 層 @msg unknown command `{0}` 未知的指令 `{0}` +@msg step {step} of “{action}” runs the unknown command `{command}` 「{action}」的步驟 {step} 執行未知的指令 `{command}` @msg unknown command `{0}`; did you mean `{1}`? 未知的指令 `{0}`;您是指 `{1}` 嗎? @msg `{what}` closes nothing `{what}` 沒有可結束的內容 @msg `{what}` closes something it didn't open `{what}` 結束了並非由它開始的內容 @@ -2408,6 +2412,7 @@ file-filter Templates 範本 @msg `select` must be true or false `select` 必須是 true 或 false @msg `minAnchors` and `maxAnchors` must be whole numbers `minAnchors` 和 `maxAnchors` 必須是整數 @msg `{key}` must be a number not below 0 `{key}` 必須是不小於 0 的數字 +@msg `{key}` must be four numbers not below 0: [tl, tr, br, bl] `{key}` 必須是四個不小於 0 的數字:[tl, tr, br, bl] @msg `{key}` must be [x, y, width, height]: four finite numbers, width and height not negative `{key}` 必須是 [x, y, width, height]:四個有限數字,寬度和高度不能為負 @msg `{min_key}` is greater than `{max_key}` `{min_key}` 大於 `{max_key}` @msg give at least one of `name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` 請至少提供下列其中之一:`name`, `kind`, `text`, `within`, `intersects`, `minWidth`, `maxWidth`, `minHeight`, `maxHeight`, `minThickness`, `maxThickness`, `minArea`, `maxArea`, `minAnchors`, `maxAnchors` @@ -2454,6 +2459,7 @@ file-filter Templates 範本 @msg no action set to save 沒有要儲存的動作組 @msg the action set file can't be read in full 無法完整讀取動作組檔案 @msgplural Loaded “{name}”: {n} step was left out|Loaded “{name}”: {n} steps were left out 已載入「{name}」:已略過 {n} 個步驟 +@msgplural Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`|Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}` 已載入「{name}」:保留了 {n} 個含未知指令的步驟;第一個:「{action}」,步驟 {step},`{command}` @msg not an action set file 不是動作組檔案 @msg the action set file is larger than 8 MiB 動作組檔案大於 8 MiB @msg `{ID}`: the reference would be larger than {MAX_BYTES} bytes `{ID}`:參考將大於 {MAX_BYTES} 位元組 @@ -3776,6 +3782,7 @@ font-script Japanese 漢字 Proportional Metrics 比例度量 Insert Aki Left 在前方插入空白 Insert Aki Right 在後方插入空白 + Tsume 比例間距 Character Direction 字元方向 Digits 數字 Arabic 阿拉伯數字 @@ -5493,6 +5500,7 @@ effect Soft 柔和 VectorCraft Title Bar on Every Desktop 在所有桌面上使用 VectorCraft 標題列 The VECTORCRAFT_TITLEBAR environment variable chooses the title bar while it is set. 設定了環境變數 VECTORCRAFT_TITLEBAR 時,由它選擇標題列。 System Title Bar takes precedence over this option while it is on. 開啟系統標題列時,它優先於此選項。 + This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off. 未開啟「在所有桌面上使用 VectorCraft 標題列」時,無論此選項是否開啟,此桌面都會繪製視窗的標題列。 Value Axis 數值軸 On Left Side 左側 On Right Side 右側 @@ -6034,8 +6042,8 @@ axis Y Axis Y 軸 @msg an exporter declares 1 to {MAX_EXTENSIONS} `extensions` 匯出增效模組宣告 1 到 {MAX_EXTENSIONS} 個 `extensions` @msg at most {MAX_UNGROUPED} parameters outside groups: give the others a `group` 群組外最多 {MAX_UNGROUPED} 個參數:請為其餘參數指定 `group` @msg can't encode the input 無法編碼輸入 -@msg expected {"dataBase64"} 應為 {"dataBase64"} -@msg expected {"objects"} 應為 {"objects"} +@msg expected {{"dataBase64": "…"}} 應為 {{"dataBase64": "…"}} +@msg expected {{"objects": [...]}} 應為 {{"objects": [...]}} @msg export `{name}`: {e} 模組匯出 `{name}`:{e} @msg extension {e} is listed twice 副檔名 {e} 列出了兩次 @msg extension {e}: use 1-16 lower-case letters and digits, without the dot 副檔名 {e}:請使用 1-16 個小寫字母和數字,不含點 @@ -6099,11 +6107,11 @@ axis Y Axis Y 軸 @msg a painted live effect returns only `objects` 繪製型即時效果只傳回 `objects` @msg a painted live effect's piece has only `path`, `fillRule`, `fills` and `strokes` 繪製型即時效果的片段只有 `path`、`fillRule`、`fills` 和 `strokes` @msg a read-only object was left out 漏掉了一個唯讀物件 -@msg a read-only object was left out: return it, as {"id"} alone or as it was given 漏掉了一個唯讀物件:請以單獨的 {"id"} 或原樣傳回它 +@msg a read-only object was left out: return it, as {{"id": …}} alone or as it was given 漏掉了一個唯讀物件:請以單獨的 {{"id": …}} 或原樣傳回它 @msg a string 字串 @msg a stroke has only `paint`, `width`, `join`, `cap` and `miterLimit` 筆畫只有 `paint`、`width`、`join`、`cap` 和 `miterLimit` -@msg a stroke must be {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 筆畫必須是 {"paint", "width"?, "join"?, "cap"?, "miterLimit"?} 形式 -@msg an effect must be {"id", "params"?, "visible"?} 效果必須是 {"id", "params"?, "visible"?} 形式 +@msg a stroke must be {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 筆畫必須是 {{"paint", "width"?, "join"?, "cap"?, "miterLimit"?}} 形式 +@msg an effect must be {{"id", "params"?, "visible"?}} 效果必須是 {{"id", "params"?, "visible"?}} 形式 @msg an effect on a fill returns only `fills` 填色上的效果只傳回 `fills` @msg an effect on a stroke returns only `strokes` 筆畫上的效果只傳回 `strokes` @msg an object must be a JSON object 物件必須是 JSON 物件 @@ -6245,6 +6253,8 @@ axis Y Axis Y 軸 Action Options… 動作選項… Action Options 動作選項 Playback Options… 播放選項… + Button Mode 按鈕模式 + No actions. 沒有動作。 Insert Stop… 插入停止… Insert Stop 插入停止 Record Stop 記錄停止 @@ -7109,6 +7119,12 @@ breakText Glyphs 字符 @msg open the practice sample of `{id}` first (see learn.openSample) 請先開啟 `{id}` 的練習範例 (請參閱 learn.openSample) @msg finish `{id}` first (see learn.finish) 請先完成 `{id}` (請參閱 learn.finish) @msg `{id}` is the last tutorial in its skill `{id}` 是其技能的最後一個教學課程 + Reset progress 重設進度 + Mark Tutorial Step 標記教學課程步驟 + Reset Learn Progress 重設學習進度 +@msg missing `step` (see learn.show) 未提供 `step` (請參閱 learn.show) +@msg `step` must be a step number from 0 to {last} `step` 必須是 0 到 {last} 之間的步驟編號 +@msg `{id}` is finished (see learn.resetProgress) `{id}` 已完成 (請參閱 learn.resetProgress) # Deferred plug-in effects Refresh Deferred Effects 重新整理延後的效果 @@ -7138,3 +7154,1934 @@ breakText Glyphs 字符 Grommets 扣眼 Grommet Inset 扣眼邊距 Diameter 直徑 + +# Messages of the effects, 3D, image export, color profiles, swatch exchange files, color books and DXF import. +@msg 3D effects require finite coordinates within 100 million points 3D 效果需要位於 1 億點以內的有限座標 +@msg 3D effects require one to ten lights 3D 效果需要 1 到 10 個光源 +@msg BMP depth {_1}: 1, 4, 8, 16, 24 or 32 bits per pixel BMP 色彩深度 {_1}:須為每像素 1、4、8、16、24 或 32 位元 +@msg BMP encoding failed: {width} × {height} pixels doesn't fit the format or the pixel buffer BMP 編碼失敗:{width} × {height} 像素不符合格式或像素緩衝區 +@msg GIF encoding failed: the palette image is malformed GIF 編碼失敗:調色盤影像格式錯誤 +@msg GIF encoding failed: {e} GIF 編碼失敗:{e} +@msg JPEG colour profile: {e} JPEG 色彩描述檔:{e} +@msg JPEG encoding failed: pixel buffer doesn't match the image size JPEG 編碼失敗:像素緩衝區與影像尺寸不符 +@msg JPEG encoding failed: {e} JPEG 編碼失敗:{e} +@msg PNG encoding failed: pixel buffer doesn't match the image size PNG 編碼失敗:像素緩衝區與影像尺寸不符 +@msg PNG encoding failed: the palette image is malformed PNG 編碼失敗:調色盤影像格式錯誤 +@msg PNG encoding failed: {e} PNG 編碼失敗:{e} +@msg PNG encoding failed: {width} × {height} pixels is not a valid image size PNG 編碼失敗:{width} × {height} 像素不是有效的影像尺寸 +@msg PSD colour profile: {e} PSD 色彩描述檔:{e} +@msg PSD encoding failed: the pixel buffer doesn't match the image size PSD 編碼失敗:像素緩衝區與影像尺寸不符 +@msg Revolve profile contains invalid coordinates 迴轉的輪廓包含無效的座標 +@msg Revolve profile is too complex 迴轉的輪廓過於複雜 +@msg Revolve projection is not finite 迴轉的投影不是有限值 +@msg Revolve requires finite profile coordinates within 100 million points 迴轉需要位於 1 億點以內的有限輪廓座標 +@msg Revolve surface is too complex; reduce Segments or simplify the profile 迴轉曲面過於複雜;請減少「分段數」或簡化輪廓 +@msg Revolve surface is too complex; simplify the profile 迴轉曲面過於複雜;請簡化輪廓 +@msg Revolve visibility cannot split the projected boundary 迴轉的可見性計算無法分割投影邊界 +@msg Revolve visibility creates too many fragments 迴轉的可見性計算產生過多片段 +@msg Revolve visibility creates too many vector anchors 迴轉的可見性計算產生過多向量錨點 +@msg Revolve visibility exceeds its geometry work limit 迴轉的可見性計算超出幾何運算量上限 +@msg Revolve visibility exceeds its spatial index limit 迴轉的可見性計算超出空間索引上限 +@msg Revolve visibility has too many boundary crossings 迴轉的可見性計算有過多邊界交叉 +@msg Revolve visibility has too many input anchors 迴轉的可見性計算有過多輸入錨點 +@msg Revolve visibility requires convex cap sectors 迴轉的可見性計算需要凸形的端蓋扇區 +@msg Revolve visibility requires finite projected faces 迴轉的可見性計算需要有限的投影面 +@msg SVG options: {e} SVG 選項:{e} +@msg Save for Web settings: {e} 儲存為網頁用設定:{e} +@msg TIFF colour profile: {e} TIFF 色彩描述檔:{e} +@msg TIFF encoding failed: the pixel buffer doesn't match the image size TIFF 編碼失敗:像素緩衝區與影像尺寸不符 +@msg TIFF encoding failed: {e} TIFF 編碼失敗:{e} +@msg Targa depth {_1}: 16, 24 or 32 bits per pixel Targa 色彩深度 {_1}:須為每像素 16、24 或 32 位元 +@msg Targa encoding failed: the pixel buffer doesn't match the image size Targa 編碼失敗:像素緩衝區與影像尺寸不符 +@msg The 3D projection is not finite 3D 投影不是有限值 +@msg The 3D shadow is too complex; turn Shadows off or simplify the art 3D 陰影過於複雜;請關閉「陰影」或簡化圖稿 +@msg The shape contains invalid coordinates 形狀包含無效的座標 +@msg Too many Revolve faces for visibility evaluation 迴轉的面過多,無法計算可見性 +@msg VectorCraft reads at most {ASE_MAX_ENTRIES} colors and groups from a swatch exchange file, and this library has {entries} VectorCraft 從色票交換檔案最多讀取 {ASE_MAX_ENTRIES} 個顏色和群組,而此資料庫有 {entries} 個 +@msg WebP encoding failed: {e} WebP 編碼失敗:{e} +@msg [{j}] `{_1}`: {why} [{j}] `{_1}`:{why} +@msg `answers[{i}]` {e} `answers[{i}]` {e} +@msg `view` is smallThumb, mediumThumb, largeThumb, smallList or largeList `view` 必須是 smallThumb、mediumThumb、largeThumb、smallList 或 largeList +@msg a line can't run from a point to itself 線條不能從一個點連到同一個點 +@msg a line needs at least two points 線條至少需要兩個點 +@msg a number cannot be read 無法讀取數字 +@msg a swatch exchange block is too long 色票交換區塊過長 +@msg a swatch exchange name is too long 色票交換名稱過長 +@msg a {sw} × {sh} image can't be resized to {width} × {height} pixels {sw} × {sh} 的影像無法調整為 {width} × {height} 像素 +@msg a {width} × {height} image is too large {width} × {height} 的影像過大 +@msg a {width} × {height} image: {e} {width} × {height} 的影像:{e} +@msg an image could not be written: {e} 無法寫入影像:{e} +@msg an image that couldn't be read was left out 已略過無法讀取的影像 +@msg can't open “{name}”: {e} 無法開啟「{name}」:{e} +@msg cannot align zip entries to {align} bytes 無法將 ZIP 項目對齊至 {align} 位元組 +@msg cannot open the automation {kind} root `{_1}`: {e} 無法開啟自動化 {kind} 根目錄 `{_1}`:{e} +@msg cannot read profile: {0} 無法讀取描述檔:{0} +@msg color book version {version} isn't supported (only 1) 不支援色票簿版本 {version} (僅支援 1) +@msg color books in color space {other} aren't supported (only RGB, CMYK and Lab) 不支援色彩空間為 {other} 的色票簿 (僅支援 RGB、CMYK 和 Lab) +@msg file name too long to zip: {_1} 檔案名稱過長,無法壓縮為 ZIP:{_1} +@msg file name too long to zip: {name} 檔案名稱過長,無法壓縮為 ZIP:{name} +@msg freeform line {i}: {e} 任意形狀線條 {i}:{e} +@msg freeform point {i}: {e} 任意形狀點 {i}:{e} +@msg give `{key}` or `{other}`, not both 請提供 `{key}` 或 `{other}`,不能同時提供兩者 +@msg grayscale profiles can't be working spaces yet 灰階描述檔目前還不能作為工作空間 +@msg input contains NaN or infinite coordinates 輸入包含 NaN 或無限大的座標 +@msg input path could not be closed 無法封閉輸入路徑 +@msg invalid ICC profile: {0} 無效的 ICC 描述檔:{0} +@msg invalid scale {scale} 無效的縮放比例 {scale} +@msg its localized names take more than {_1} KB 其本地化名稱超過 {_1} KB +@msg its objects are nested too deep ({e}) 其物件巢狀層級過深 ({e}) +@msg its tag table lists the `{_1}` tag more than once 其標記表多次列出 `{_1}` 標記 +@msg not a graphic style library: {e} 不是繪圖樣式資料庫:{e} +@msg not a swatch library (.vcswatches or .gpl) 不是色票資料庫 (.vcswatches 或 .gpl) +@msg not a swatch library (format `{_1}`) 不是色票資料庫 (格式為 `{_1}`) +@msg not a swatch library: {e} 不是色票資料庫:{e} +@msg not an action set file ({e}) 不是動作組檔案 ({e}) +@msg profile colour space {other} is not RGB, CMYK or Gray 描述檔的色彩空間 {other} 不是 RGB、CMYK 或灰階 +@msg regular expression too large 規則運算式過大 +@msg script file is not UTF-8 text: {value} 指令碼檔案不是 UTF-8 文字:{value} +@msg stop {i}: {e} 色標 {i}:{e} +@msg swatch exchange version {major}.{minor} isn't supported (only 1.x) 不支援色票交換版本 {major}.{minor} (僅支援 1.x) +@msg the color book holds more than {ASE_MAX_ENTRIES} colors 色票簿包含超過 {ASE_MAX_ENTRIES} 個顏色 +@msg the color book is cut short 色票簿不完整 +@msg the color book's names take more than {_1} MB 色票簿的名稱超過 {_1} MB +@msg the image would be {w} × {h} pixels; raster exports are limited to {MAX_RASTER_SIDE} pixels per side and {_1} megapixels: lower the scale or resolution 影像會是 {w} × {h} 像素;點陣圖匯出的上限為每邊 {MAX_RASTER_SIDE} 像素及 {_1} 百萬像素:請降低縮放比例或解析度 +@msg the optimised image can't be read back: {e} 無法讀回最佳化後的影像:{e} +@msg the pixel buffer doesn't match the image size 像素緩衝區與影像尺寸不符 +@msg the preview: {e} 預覽:{e} +@msg the request may not read the New Document profiles folder 此要求不得讀取新增文件描述檔資料夾 +@msg the shapes are too degenerate to combine 形狀過度退化,無法合併 +@msg the shapes cross themselves and each other too often to combine 形狀自身及彼此之間交叉過多,無法合併 +@msg the swatch exchange file holds more than {ASE_MAX_ENTRIES} colors and groups 色票交換檔案包含超過 {ASE_MAX_ENTRIES} 個顏色和群組 +@msg the swatch exchange file is cut short 色票交換檔案不完整 +@msg the {_1} plate can't be read: {e} 無法讀取 {_1} 色版:{e} +@msg this binary DXF file is damaged or cut short 此二進位 DXF 檔案已損毀或不完整 +@msg this is a DWG drawing, which can't be read: save it from the CAD app as a DXF and open that 這是 DWG 圖面,無法讀取:請在 CAD 應用程式中將其儲存為 DXF,再開啟該檔案 +@msg too many classes 字元類別過多 +@msg too many groups 群組過多 +@msg too many layers for PSD (at most 32767) PSD 的圖層過多 (最多 32767 個) +@msg too many swatch exchange blocks 色票交換區塊過多 +@msg unknown colour profile: {0} 未知的色彩描述檔:{0} +@msg {_1} clashes with a built-in profile name {_1} 與內建描述檔名稱衝突 +@msg {_1} × {_2} pixels is too large for GIF (at most 65535 pixels a side): lower the resolution {_1} × {_2} 像素對 GIF 來說過大 (每邊最多 65535 像素):請降低解析度 +@msg {_1}: no usable transform to/from sRGB {_1}:沒有可與 sRGB 互相轉換的可用轉換 +@msg {name} is not a CMYK profile {name} 不是 CMYK 描述檔 +@msg {name} is not an RGB profile {name} 不是 RGB 描述檔 +@msg {path}: could not be read {path}:無法讀取 +@msg {width} × {height} pixels is too large for JPEG (at most 65535 pixels a side): lower the resolution {width} × {height} 像素對 JPEG 來說過大 (每邊最多 65535 像素):請降低解析度 +@msg {width} × {height} pixels is too large for Targa (at most 65535 pixels a side): lower the resolution {width} × {height} 像素對 Targa 來說過大 (每邊最多 65535 像素):請降低解析度 +@msg {w} × {h} pixels is too large for PSD (at most {MAX_SIDE} pixels a side): lower the resolution {w} × {h} 像素對 PSD 來說過大 (每邊最多 {MAX_SIDE} 像素):請降低解析度 + +# Status and error messages of commands, scripts, file import and export, and plug-ins. +@msg 'caller', 'callee' and 'arguments' cannot be used on strict mode functions 嚴格模式的函式不能使用 'caller'、'callee' 和 'arguments' +@msg Alignment must be one of the choices 對齊方式必須是選項之一 +@msg Boolean.prototype.{name} was called on a value that is not a Boolean 在不是 Boolean 的值上呼叫了 Boolean.prototype.{name} +@msg CMYK images whose samples couldn't be read in CMYK were imported in RGB 無法以 CMYK 讀取取樣的 CMYK 影像已以 RGB 匯入 +@msg Cannot write to the location of “{name}”; choose where to save it 無法寫入「{name}」的位置;請選擇儲存位置 +@msg DCS files can only be placed linked: use File › Place with Link on DCS 檔案只能以連結方式置入:請使用「檔案 › 置入」並開啟「連結」 +@msg Date.prototype method called on a value that is not a Date object 在不是 Date 物件的值上呼叫了 Date.prototype 方法 +@msg Error.prototype.toString was called on a value that is not an object 在不是物件的值上呼叫了 Error.prototype.toString +@msg Function.prototype.toString was called on a value that is not a function 在不是函式的值上呼叫了 Function.prototype.toString +@msg Import SVG Filter reads SVG files, not SVGZ 「匯入 SVG 濾鏡」讀取 SVG 檔案,不讀取 SVGZ +@msg JSON.parse: {why} (at offset {at}) JSON.parse:{why} (位於偏移 {at}) +@msg JSON.stringify cannot write a structure that contains itself JSON.stringify 無法寫入包含自身的結構 +@msg Line Gap must be a number 行間距必須是數字 +@msg Namespace.prototype.toString needs a Namespace Namespace.prototype.toString 需要 Namespace +@msg New Document profiles need the preferences folder, which this run doesn't have 新增文件描述檔需要偏好設定資料夾,而這次執行沒有該資料夾 +@msg Number.prototype.{name} was called on a value that is not a number 在不是數字的值上呼叫了 Number.prototype.{name} +@msg Object.create's prototype must be an object or null Object.create 的原型必須是物件或 null +@msg Object.{function} was given a value that is not an object Object.{function} 收到了不是物件的值 +@msg QName.prototype.toString needs a QName QName.prototype.toString 需要 QName +@msg RegExp.prototype.{name} was called on a value that is not a RegExp object 在不是 RegExp 物件的值上呼叫了 RegExp.prototype.{name} +@msg Stencil Bridges: the selected art is too large or too detailed to bridge 鏤空版連接橋:所選圖稿過大或過於細緻,無法建立連接橋 +@msg String.prototype.toString was called on a value that is not a string 在不是字串的值上呼叫了 String.prototype.toString +@msg The {name} profile could not be read, so the new document has the default settings: {reason} 無法讀取 {name} 描述檔,因此新文件使用預設設定:{reason} +@msg Trap: more than {_1} pairs of objects lie close enough to trap, or too many objects share a horizontal range; trap fewer objects at a time 補漏白:有超過 {_1} 對物件近到需要補漏白,或有太多物件位於相同的水平範圍;請一次對較少的物件補漏白 +@msg Weed Box and Lines: no weeding line fits outside the art, and the weed box is off 除廢框與除廢線:圖稿外側放不下任何除廢線,而且除廢框已關閉 +@msg \ at end of pattern \ 出現在模式結尾 +@msg `alignOn` cannot be empty `alignOn` 不能為空 +@msg `alignOn` must be a string `alignOn` 必須是字串 +@msg `align` must be a string `align` 必須是字串 +@msg `answer` for this {kind} dialog must be one of: {_1} 此 {kind} 對話框的 `answer` 必須是下列其中之一:{_1} +@msg `answers` has more than {MAX_ANSWERS} answers `answers` 的答案超過 {MAX_ANSWERS} 個 +@msg `answers` is larger than 1 MiB `answers` 大於 1 MiB +@msg `answers` must be a list of answers `answers` 必須是答案清單 +@msg `artboard` must be the index of an artboard of the document `artboard` 必須是文件中某個工作區域的索引 +@msg `artboardsAt` must be [x, y] `artboardsAt` 必須是 [x, y] +@msg `artboards` names an artboard the document does not have `artboards` 指定了文件中沒有的工作區域 +@msg `artboards` names an artboard twice `artboards` 將同一個工作區域指定了兩次 +@msg `at` must be [x, y] (got {at}) `at` 必須是 [x, y] (收到 {at}) +@msg `at` must be a point [x, y] `at` 必須是點 [x, y] +@msg `beside` needs `side` `beside` 需要 `side` +@msg `code` must be a whole number `code` 必須是整數 +@msg `colorMode` must be one of rgb, cmyk `colorMode` 必須是 rgb、cmyk 其中之一 +@msg `colors` does not apply to the {name} reduction `colors` 不適用於 {name} 縮減 +@msg `colors` must be a whole number from 2 to 256 `colors` 必須是 2 到 256 之間的整數 +@msg `colors` must be at least 9 for the uniform reduction 使用均勻縮減時,`colors` 至少必須是 9 +@msg `colors` must be between 1 and {MAX_THEME_COLORS} (got {n}) `colors` 必須介於 1 和 {MAX_THEME_COLORS} 之間 (收到 {n}) +@msg `count` must be a whole number from 0 to {MAX_COUNT} `count` 必須是 0 到 {MAX_COUNT} 之間的整數 +@msg `ditherAmount` must be a number from 0 to 100 `ditherAmount` 必須是 0 到 100 之間的數字 +@msg `fidelity` must be from {lo} to {hi} pt `fidelity` 必須介於 {lo} 到 {hi} pt 之間 +@msg `focal` and `radius` cannot be used together `focal` 和 `radius` 不能同時使用 +@msg `focal` must be an array of [subpath, anchor] pairs `focal` 必須是 [subpath, anchor] 配對的陣列 +@msg `focal` names [{si}, {ai}], which is not an anchor of the path `focal` 指定了 [{si}, {ai}],它不是該路徑的錨點 +@msg `glyphAlternate` takes only null, which takes a glyph choice away (text.setGlyphAlternate makes one) `glyphAlternate` 只接受 null,表示移除字符選擇 (text.setGlyphAlternate 可建立選擇) +@msg `group` must be one of {_1} `group` 必須是 {_1} 其中之一 +@msg `group` must be the Objects on Path group of `member` and `target` `group` 必須是 `member` 和 `target` 所屬的「路徑上的物件」群組 +@msg `id` is an object id, not {v} `id` 是物件 ID,而非 {v} +@msg `item` needs `index` `item` 需要 `index` +@msg `kerningBefore` belongs to a line's first character, not to a character style (text.setRangeStyle sets it) `kerningBefore` 屬於一行的第一個字元,不屬於字元樣式 (由 text.setRangeStyle 設定) +@msg `kinsokuType` must be "pushInFirst", "pushOutFirst" or "pushOutOnly" `kinsokuType` 必須是 "pushInFirst"、"pushOutFirst" 或 "pushOutOnly" +@msg `leader` must be a string `leader` 必須是字串 +@msg `max` must be 1 to {MAX_SUGGESTIONS} `max` 必須是 1 到 {MAX_SUGGESTIONS} +@msg `name` must be a name that is not empty `name` 必須是不為空的名稱 +@msg `name` must not be empty `name` 不能為空 +@msg `origin` must be [x, y] in points `origin` 必須是以點為單位的 [x, y] +@msg `picks` must be an array (got {v}) `picks` 必須是陣列 (收到 {v}) +@msg `picks` must hold 1 to {MAX_PICKS} picks (got {_1}) `picks` 必須包含 1 到 {MAX_PICKS} 個選擇 (收到 {_1}) +@msg `points` must hold from 2 to 100000 points `points` 必須包含 2 到 100000 個點 +@msg `radius` must be 0 or more `radius` 必須大於或等於 0 +@msg `rect` must be [x, y, width, height] `rect` 必須是 [x, y, width, height] +@msg `rect` must be [x0, y0, x1, y1] (got {r}) `rect` 必須是 [x0, y0, x1, y1] (收到 {r}) +@msg `replace` must be a string `replace` 必須是字串 +@msg `rows` must be lists of numbers or nulls, not {r} `rows` 必須是由數字或 null 組成的清單,而非 {r} +@msg `scale` must be a number from 0.001 to 1000 `scale` 必須是 0.001 到 1000 之間的數字 +@msg `scope.{key}` must be a non-empty array `scope.{key}` 必須是非空陣列 +@msg `scope` must be "document", {artboards} or {layers} `scope` 必須是 "document"、{artboards} 或 {layers} +@msg `side` must be "left", "right", "top" or "bottom" `side` 必須是 "left"、"right"、"top" 或 "bottom" +@msg `side` places the artboard: leave out x, y, width and height `side` 會決定工作區域的位置:請不要提供 x、y、width 和 height +@msg `source` is the only path in series group `target` `source` 是系列群組 `target` 中唯一的路徑 +@msg `spacing` makes more than {MAX_COUNT} lines across the box `spacing` 會在方框內產生超過 {MAX_COUNT} 條線 +@msg `spacing` must be more than 0 and at most {MAX_DISTANCE} pt `spacing` 必須大於 0 且不超過 {MAX_DISTANCE} pt +@msg `target` must be an object of the same Objects on Path group as `member` `target` 必須是與 `member` 屬於同一個「路徑上的物件」群組的物件 +@msg `tolerance` must be from 0 to 100 pt `tolerance` 必須介於 0 到 100 pt 之間 +@msg `version` must be 0 or {_1} `version` 必須是 0 或 {_1} +@msg `version` must be 0 or {newest} `version` 必須是 0 或 {newest} +@msg `warichuAlign` must be one of {_1} `warichuAlign` 必須是 {_1} 其中之一 +@msg `warichuLines` must be a whole number from {_1} to {_2} `warichuLines` 必須是 {_1} 到 {_2} 之間的整數 +@msg `weight` must be from 0.01 to 1000 pt `weight` 必須介於 0.01 到 1000 pt 之間 +@msg `weights` must be a list of {_1} numbers, one per row (got {v}) `weights` 必須是包含 {_1} 個數字的清單,每列一個 (收到 {v}) +@msg `xml` must be a string `xml` 必須是字串 +@msg `{KEY}` entry {n} gives the paragraph at byte {start} of {_1} other indents than an entry before it `{KEY}` 項目 {n} 為 {_1} 中位於位元組 {start} 的段落指定的縮排與先前的項目不同 +@msg `{KEY}` entry {n} must be an object `{KEY}` 項目 {n} 必須是物件 +@msg `{KEY}` entry {n} sets neither `leftIndent` nor `firstLineIndent` `{KEY}` 項目 {n} 既未設定 `leftIndent`,也未設定 `firstLineIndent` +@msg `{KEY}` entry {n}: `id` must be an object id `{KEY}` 項目 {n}:`id` 必須是物件 ID +@msg `{KEY}` entry {n}: `start` must be a byte offset `{KEY}` 項目 {n}:`start` 必須是位元組偏移 +@msg `{KEY}` entry {n}: `{k}` must be a number from -{MAX_PARA} to {MAX_PARA} pt `{KEY}` 項目 {n}:`{k}` 必須是 -{MAX_PARA} 到 {MAX_PARA} pt 之間的數字 +@msg `{KEY}` entry {n}: no paragraph of {_1} starts at byte {start} `{KEY}` 項目 {n}:{_1} 中沒有從位元組 {start} 開始的段落 +@msg `{KEY}` entry {n}: unknown key `{k}` `{KEY}` 項目 {n}:未知的鍵 `{k}` +@msg `{KEY}` entry {n}: {_1} is not a type object `{KEY}` 項目 {n}:{_1} 不是文字物件 +@msg `{KEY}` is empty `{KEY}` 為空 +@msg `{KEY}` must be a list `{KEY}` 必須是清單 +@msg `{KEY}` takes at most {MAX_PARAGRAPH_INDENTS} entries (got {_1}) `{KEY}` 最多接受 {MAX_PARAGRAPH_INDENTS} 個項目 (收到 {_1}) +@msg `{KEY}` takes no `{other}` beside it `{KEY}` 不能與 `{other}` 一起使用 +@msg `{base}` is larger than {_1} MB `{base}` 大於 {_1} MB +@msg `{base}` is not in the DCS file's folder `{base}` 不在 DCS 檔案的資料夾中 +@msg `{key}` holds more than {MAX_EDIT_WORDS} words `{key}` 包含超過 {MAX_EDIT_WORDS} 個單字 +@msg `{key}` must be 0 or more `{key}` 必須大於或等於 0 +@msg `{key}` must be [x, y] numbers `{key}` 必須是 [x, y] 數字 +@msg `{key}` must be a list of words `{key}` 必須是單字清單 +@msg `{key}` must be a list, not {v} `{key}` 必須是清單,而非 {v} +@msg `{key}` must be a number or null, not {v} `{key}` 必須是數字或 null,而非 {v} +@msg `{key}` must be a whole number of 0 or more `{key}` 必須是大於或等於 0 的整數 +@msg `{key}` must be from 0 to {MAX_DISTANCE} pt `{key}` 必須介於 0 到 {MAX_DISTANCE} pt 之間 +@msg `{key}` must be from 0.01 to 1000 pt `{key}` 必須介於 0.01 到 1000 pt 之間 +@msg `{key}` must be from {lo} to {hi}, not {v} `{key}` 必須介於 {lo} 到 {hi} 之間,而非 {v} +@msg `{key}` must be one of auto, always, never `{key}` 必須是 auto、always、never 其中之一 +@msg `{key}` must be one of miter, round, bevel `{key}` 必須是 miter、round、bevel 其中之一 +@msg `{key}` must be one word of at most {_1} characters `{key}` 必須是一個不超過 {_1} 個字元的單字 +@msg `{key}` must hold single words of at most {_1} characters `{key}` 中的每一項必須是不超過 {_1} 個字元的單字 +@msg `{key}` must name an object attached to the path of an Objects on Path group `{key}` 必須指定附加在「路徑上的物件」群組路徑上的物件 +@msg `{key}` names an object that is hidden or locked `{key}` 指定的物件已隱藏或鎖定 +@msg `{name}` is a file of its own, which can only be found next to the DCS file's path `{name}` 是獨立的檔案,只能在 DCS 檔案的路徑旁找到 +@msg `{name}`: {_1}: {e} `{name}`:{_1}:{e} +@msg `{u}` is no Unicode character `{u}` 不是 Unicode 字元 +@msg `{word}` isn't in the custom dictionary `{word}` 不在自訂字典中 +@msg a CMap has too many mappings CMap 的對應過多 +@msg a \u escape needs four hexadecimal digits \u 逸出序列需要四個十六進位數字 +@msg a comma in an XPath expression must separate function arguments XPath 運算式中的逗號必須用來分隔函式引數 +@msg a document holds at most {_1} SVG filters 一份文件最多包含 {_1} 個 SVG 濾鏡 +@msg a document with unsaved changes has no recovery copy 有未儲存變更的文件沒有復原副本 +@msg a font's data is too large 字體的資料過大 +@msg a font's subroutines are too large 字體的副程式過大 +@msg a function declaration without a name 函式宣告沒有名稱 +@msg a host value has too many entries 主機值的項目過多 +@msg a host value is nested too deep 主機值的巢狀層次過深 +@msg a namespace declaration uses a reserved prefix or URI 命名空間宣告使用了保留的前置詞或 URI +@msg a namespace qualifier is undefined 命名空間限定詞未定義 +@msg a namespace with an empty URI cannot have a prefix URI 為空的命名空間不能有前置詞 +@msg a number has no digits 數值中沒有數字 +@msg a number's exponent has no digits 數值的指數部分沒有數字 +@msg a number's fraction has no digits 數值的小數部分沒有數字 +@msg a property descriptor cannot have both a value or writable and a get or set 屬性描述元不能同時具有 value 或 writable,以及 get 或 set +@msg a property descriptor must be an object 屬性描述元必須是物件 +@msg a property's {name} must be a function or undefined 屬性的 {name} 必須是函式或 undefined +@msg a stream in it would decode to more than 256 MB, or its decode parameters can't be applied 其中有一個資料流解碼後會超過 256 MB,或無法套用其解碼參數 +@msg a string holds a control character 字串包含控制字元 +@msg a string holds an escape sequence JSON does not have 字串包含 JSON 沒有的逸出序列 +@msg a string is not closed 字串未結束 +@msg an SVG filter is named by its id: give `xml` with `name` SVG 濾鏡以其 id 作為名稱:請搭配 `name` 提供 `xml` +@msg an XML element has two attributes with the same name XML 元素有兩個同名的屬性 +@msg an XML value cannot be inserted into itself or its descendants XML 值不能插入其本身或其後代 +@msg an XML value's children cannot be assigned by position 不能依位置指定 XML 值的子項 +@msg an XML value's children cannot be deleted by position 不能依位置刪除 XML 值的子項 +@msg an XMLList converts to XML only when it has one item XMLList 只有在包含一個項目時才能轉換為 XML +@msg an XPath node test is missing XPath 運算式少了節點測試 +@msg an XPath operand is missing XPath 運算式少了運算元 +@msg an XPath operator is missing XPath 運算式少了運算子 +@msg an XPath predicate or step cannot follow here 這裡不能接 XPath 述詞或步驟 +@msg an XPath predicate or step follows a value that is not a node-set XPath 述詞或步驟接在不是節點集的值之後 +@msg an XPath step is missing XPath 運算式少了步驟 +@msg an image couldn't be decoded and is missing from the picture 有一個影像無法解碼,因此未出現在圖片中 +@msg an image of {w} × {h} pixels is too large to convert (at most {_1} pixels) {w} × {h} 像素的影像過大,無法轉換 (最多 {_1} 像素) +@msg apply was called on a value that is not a function 在不是函式的值上呼叫了 apply +@msg area type in a thread cannot use Dynamic Text: {frames} 串連文字中的區域文字無法使用動態文字:{frames} +@msg array literal too long 陣列常值過長 +@msg assignment to a constant binding 對常數繫結進行了指定 +@msg at least one row that isn't excluded needs a weight above 0 至少需要一個未排除的列具有大於 0 的權重 +@msg bad point {v}: expected [x, y] 無效的點 {v}:應為 [x, y] +@msg blend must be a mode name blend 必須是模式名稱 +@msg both sides of an XPath | must select nodes XPath | 的兩側都必須選取節點 +@msg canceled 已取消 +@msg cannot convert the object to a primitive value 無法將物件轉換為基本型別值 +@msg cannot convert undefined or null to an object 無法將 undefined 或 null 轉換為物件 +@msg character dimensions cannot be represented with the source text transform 字元尺寸無法以來源文字變形表示 +@msg character dimensions cannot be represented with the target text transform 字元尺寸無法以目標文字變形表示 +@msg continuation must be an array of path chunks continuation 必須是路徑片段的陣列 +@msg continuation requires points continuation 需要 points +@msg each path chunk must contain 1 to 4096 points 每個路徑片段必須包含 1 到 4096 個點 +@msg each pick is {{at: [x, y]}} or {{rect: [x0, y0, x1, y1]}} (got {v}) 每個選擇都是 {{at: [x, y]}} 或 {{rect: [x0, y0, x1, y1]}} (收到 {v}) +@msg each weight must be a number of 0 or more (got {v}) 每個權重必須是大於或等於 0 的數字 (收到 {v}) +@msg finally table {t} out of range finally 表格 {t} 超出範圍 +@msg flags cannot be given with a RegExp object 提供 RegExp 物件時不能再提供旗標 +@msg function declaration index out of range 函式宣告索引超出範圍 +@msg give `char`, `text`, `code` or `unicode` 請提供 `char`、`text`、`code` 或 `unicode` +@msg give `count` or `spacing`, not both 請提供 `count` 或 `spacing`,不要兩者都提供 +@msg give `name`, an SVG filter's name 請提供 `name`,即 SVG 濾鏡的名稱 +@msg give `path`, an SVG file, or `svg`, SVG text 請提供 `path` (SVG 檔案) 或 `svg` (SVG 文字) +@msg give `xml`, one SVG element 請提供 `xml`,即一個 SVG 元素 +@msg give exactly one of `at`, `rect` and `points` `at`、`rect` 和 `points` 請只提供其中一個 +@msg give exactly one of `path`, `data` and `dataBase64` `path`、`data` 和 `dataBase64` 請只提供其中一個 +@msg give index or indexes, not both 請提供 index 或 indexes,不要兩者都提供 +@msg give one element 請提供一個 元素 +@msg give opacity or blend 請提供 opacity 或 blend +@msg handler at {_1} expects {_2} values but its range starts with {d} 位於 {_1} 的處理常式預期有 {_2} 個值,但其範圍的起始深度為 {d} +@msg handler depth too large 處理常式深度過大 +@msg handler range {_1}..{_2} out of range 處理常式範圍 {_1}..{_2} 超出範圍 +@msg hiddenLayers must be true or false hiddenLayers 必須是 true 或 false +@msg hvcC hvcC +@msg images in a spot ink whose samples couldn't be read were imported in RGB 取樣無法讀取的特別色油墨影像已以 RGB 匯入 +@msg images past the most pixels one file may hold were left out 超過單一檔案像素上限的影像已略過 +@msg images too large to read were left out 過大而無法讀取的影像已略過 +@msg indexes may hold at most {MAX_GUIDE_INDEXES} entries indexes 最多可包含 {MAX_GUIDE_INDEXES} 個項目 +@msg indexes must be an array of guide indexes indexes 必須是參考線索引的陣列 +@msg instruction out of range 指令超出範圍 +@msg instruction {pc} ({op}) pops below the stack 指令 {pc} ({op}) 彈出的值超出堆疊底部 +@msg instruction {pc} reached with stack depths {seen} and {d} 到達指令 {pc} 時的堆疊深度有 {seen} 和 {d} 兩種 +@msg invalid array length 陣列長度無效 +@msg invalid group 群組無效 +@msg invalid object id {v}: expected a non-negative integer 物件 ID {v} 無效:應為非負整數 +@msg invalid regular expression flag '{_1}' 無效的正規表示式旗標 '{_1}' +@msg invalid regular expression: {m} 正規表示式無效:{m} +@msg invalid time value 時間值無效 +@msg is a confirm's answer, whose `value` must be true or false 是 confirm 的答案,其 `value` 必須是 true 或 false +@msg is a prompt's answer, whose `value` must be a string or null 是 prompt 的答案,其 `value` 必須是字串或 null +@msg is an alert's answer, whose `value` must be "ok" 是 alert 的答案,其 `value` 必須是 "ok" +@msg is longer than 16 KiB 長度超過 16 KiB +@msg it draws its image through a clipping path 它透過剪裁路徑繪製影像 +@msg it draws no image 它沒有繪製影像 +@msg it is larger than {MAX_DICTIONARY_FILE_BYTES} bytes 它大於 {MAX_DICTIONARY_FILE_BYTES} 位元組 +@msg it isn't a file 它不是檔案 +@msg it names {_1} plates, and at most {MAX_PLATES} are read 它指定了 {_1} 個色版,而最多只讀取 {MAX_PLATES} 個 +@msg its art is too long or too detailed for a head 其圖稿過長或過於細緻,無法作為箭頭 +@msg its art paints nothing 其圖稿沒有繪製任何內容 +@msg its image is too large to read 其影像過大,無法讀取 +@msg its plates are too large: more than {MAX_SAMPLES} pixels together 其色版過大:合計超過 {MAX_SAMPLES} 像素 +@msg its plates are too large: {_1} plates of {w} × {h} pixels 其色版過大:{_1} 個 {w} × {h} 像素的色版 +@msg its plates can't be kept together 其色版無法保持在一起 +@msg its shapes could not be combined into one 其形狀無法合併為一個 +@msg jump to {pc}, past the end 跳躍至 {pc},已超過結尾 +@msg legacyNameEncoding must be one of {_1} legacyNameEncoding 必須是 {_1} 其中之一 +@msg localize: the first argument must be a localization object or a string localize:第一個引數必須是本地化物件或字串 +@msg missing `picks` 未提供 `picks` +@msg missing `word` 未提供 `word` +@msg must be an object with `kind` and `value` 必須是包含 `kind` 和 `value` 的物件 +@msg must have `kind` alert, confirm or prompt `kind` 必須是 alert、confirm 或 prompt +@msg must have exactly `kind` and `value` 只能有 `kind` 和 `value` +@msg needs a closing quote after the name 名稱之後需要結尾引號 +@msg needs a name 需要名稱 +@msg needs a name of at most 64 bytes 需要不超過 64 位元組的名稱 +@msg needs a name of letters, digits and _, or a quoted name 需要由字母、數字和 _ 組成的名稱,或加上引號的名稱 +@msg needs a name without control characters 需要不含控制字元的名稱 +@msg nesting too deep 巢狀層次過深 +@msg no HP-GL format 沒有 HP-GL 格式 +@msg no New Document profile called `{shown}` ({_1}) 沒有名為 `{shown}` 的新增文件描述檔 ({_1}) +@msg no SVG filter at index {k} 索引 {k} 沒有 SVG 濾鏡 +@msg no arrowheads file here 這裡沒有箭頭檔案 +@msg no character has code {code} 沒有代碼為 {code} 的字元 +@msg no custom arrowhead {name} (see stroke.arrowheads.list) 沒有自訂箭頭 {name} (請參閱 stroke.arrowheads.list) +@msg no file to open 沒有可開啟的檔案 +@msg no instructions 沒有指令 +@msg no layer to rename 沒有可重新命名的圖層 +@msg no random numbers ({e}) 沒有亂數 ({e}) +@msg no selected or given object has a visible 3D effect 所選或指定的物件都沒有可見的 3D 效果 +@msg no such artboard {v} 沒有這個工作區域 {v} +@msg no symbol named `{_1}` 沒有名為 `{_1}` 的符號 +@msg node {_1} already has the text variable `{_2}` 節點 {_1} 已有文字變數 `{_2}` +@msg not a DCS file 不是 DCS 檔案 +@msg not a RegExp object 不是 RegExp 物件 +@msg not a regular expression 不是正規表示式 +@msg not an action set: the text doesn't start with /version and a number 不是動作組:文字的開頭不是 /version 和一個數字 +@msg nothing to repeat 沒有可重複的內容 +@msg numbers out of order in {_1} quantifier {_1} 量詞中的數字順序錯誤 +@msg object {_1} needs a 3D effect 物件 {_1} 需要 3D 效果 +@msg object {_1}: a hollow Extrude & Bevel has no caps: turn on Cap to map a graphic 物件 {_1}:空心的「突出與斜角」沒有端面:請開啟「端點」才能對應圖形 +@msg object {_1}: with a depth of 0 the object has one face: map its graphics onto the front 物件 {_1}:深度為 0 時物件只有一個面:請將圖形對應到正面 +@msg object {_1}: {_2} 物件 {_1}:{_2} +@msg object {_1}: {e} 物件 {_1}:{e} +@msg object {_1}: {name} at index {index} has no lighting presets; set its lights with effect.setParams 物件 {_1}:索引 {index} 的 {name} 沒有光源預設集;請以 effect.setParams 設定其光源 +@msg opacity must be a number opacity 必須是數字 +@msg operand too large 運算元過大 +@msg order is a whole number from 0 to {others}, not `{v}` order 是 0 到 {others} 之間的整數,而非 `{v}` +@msg path chunks must share their boundary point 路徑片段必須共用其邊界點 +@msg pdfCompatible: false needs the artboards to keep the editable artwork when useArtboards is false pdfCompatible: false 在 useArtboards 為 false 時需要工作區域來保留可編輯的圖稿 +@msg point x must be a number 點的 x 必須是數字 +@msg point y must be a number 點的 y 必須是數字 +@msg points must be [x,y] pairs points 必須是 [x,y] 配對 +@msg points must be finite canvas points points 必須是有限的畫布座標點 +@msg range out of order in character class 字元類別中的範圍順序錯誤 +@msg reduce of an empty array with no initial value 對空陣列執行 reduce 時沒有初始值 +@msg regular expression flag '{_1}' given twice 正規表示式旗標 '{_1}' 提供了兩次 +@msg sampled text would exceed the canvas (coordinates out of range) 取樣的文字會超出畫布 (座標超出範圍) +@msg select an SVG filter 請選取 SVG 濾鏡 +@msg select an object with a 3D effect 請選取具有 3D 效果的物件 +@msg select an object with a 3D effect, or give its id in ids 請選取具有 3D 效果的物件,或在 ids 中提供其 ID +@msg select one layer, group or object to rename 請選取一個要重新命名的圖層、群組或物件 +@msg select the art to weed 請選取要除廢的圖稿 +@msg select the banner, or mark every artboard 請選取橫幅,或標記每個工作區域 +@msg select type on a path or area type 請選取路徑文字或區域文字 +@msg side is left or right, not `{v}` side 是 left 或 right,而非 `{v}` +@msg source text transform is collapsed or unrepresentable 來源文字變形已塌陷或無法表示 +@msg table must be true or false table 必須是 true 或 false +@msg takes one name 接受一個名稱 +@msg target text transform is collapsed or unrepresentable 目標文字變形已塌陷或無法表示 +@msg that makes too many pieces (at most 100000) or dash steps: simplify the dash pattern or make the dashes longer 這會產生過多片段 (最多 100000 個) 或虛線步數:請簡化虛線樣式或加長虛線 +@msg the Layers panel is not shown 「圖層」面板未顯示 +@msg the Layers panel's search, filter or Show Layers Only hides its row 「圖層」面板的搜尋、篩選或「僅顯示圖層」隱藏了它的列 +@msg the Objects on Path group is hidden or locked 「路徑上的物件」群組已隱藏或鎖定 +@msg the SVG file is larger than {MAX_IMPORT_BYTES} bytes SVG 檔案大於 {MAX_IMPORT_BYTES} 位元組 +@msg the XML operation needs an XML or XMLList value XML 運算需要 XML 或 XMLList 值 +@msg the XPath expression does not evaluate to a node-set XPath 運算式的結果不是節點集 +@msg the XPath expression ends early XPath 運算式提前結束 +@msg the XPath expression has an unmatched ) XPath 運算式中有不成對的 ) +@msg the XPath expression has an unmatched ] XPath 運算式中有不成對的 ] +@msg the XPath expression has an unmatched closing bracket XPath 運算式中有不成對的右括號 +@msg the XPath expression selects a namespace node, which is not an XML value XPath 運算式選取了命名空間節點,而它不是 XML 值 +@msg the XPath expression selects the root node, which is not an XML value XPath 運算式選取了根節點,而它不是 XML 值 +@msg the XPath function {name} needs a node-set XPath 函式 {name} 需要節點集 +@msg the XPath function {name} takes the wrong number of arguments XPath 函式 {name} 的引數數目不正確 +@msg the XPath name functions need a node-set XPath 名稱函式需要節點集 +@msg the XPath prefix {shown} is not bound to a namespace XPath 前置詞 {shown} 未繫結到命名空間 +@msg the XPath variable ${shown} is not bound XPath 變數 ${shown} 未繫結 +@msg the argument list is not an object 引數清單不是物件 +@msg the artwork is too large for EPS: what follows 256 MB of PostScript was left out 圖稿對 EPS 而言過大:超過 256 MB PostScript 之後的內容已略過 +@msg the banner has no width or height 橫幅沒有寬度或高度 +@msg the bitmaps hold more pixels than one file may 點陣圖的像素總數超過單一檔案的上限 +@msg the code runs past its last instruction 程式碼執行超過了最後一個指令 +@msg the curve tolerance must be from 0.01 to 10 points 曲線容許度必須介於 0.01 到 10 點之間 +@msg the custom dictionary couldn't be saved to {_1}: {e} 自訂字典無法儲存到 {_1}:{e} +@msg the custom dictionary {_1} can't be read ({why}), so it is left as it is 無法讀取自訂字典 {_1} ({why}),因此保持原狀 +@msg the document already has an SVG filter named {name} 文件中已有名為 {name} 的 SVG 濾鏡 +@msg the document has another SVG filter named {name}: use svgFilter.apply, or svgFilter.define with `replace` to edit it 文件中有另一個名為 {name} 的 SVG 濾鏡:請使用 svgFilter.apply,或以帶有 `replace` 的 svgFilter.define 編輯它 +@msg the document has no SVG filter named {name} 文件中沒有名為 {name} 的 SVG 濾鏡 +@msg the document has no SVG filter named {r} 文件中沒有名為 {r} 的 SVG 濾鏡 +@msg the document has no color swatches 文件中沒有顏色色票 +@msg the document's swatches hold {_1} colors; the document reduction takes at most 255 文件的色票包含 {_1} 種顏色;文件縮減最多接受 255 種 +@msg the file isn't valid SVG: {e} 檔案不是有效的 SVG:{e} +@msg the file names no plate 檔案未指定任何色版 +@msg the function's prototype is not an object 函式的原型不是物件 +@msg the grommet inset is too large for the banner 扣眼邊距對橫幅而言過大 +@msg the guide is hidden or locked 參考線已隱藏或鎖定 +@msg the hem is too deep for the banner 折邊對橫幅而言過深 +@msg the library's file is outside the read roots 資料庫的檔案位於讀取根目錄之外 +@msg the line is too long, or the paths it passes too many, to check 線條過長,或經過的路徑過多,無法檢查 +@msg the method needs an XML value 此方法需要 XML 值 +@msg the paint is not a freeform gradient (apply one with paint.editGradient {kind}) 此上色不是任意形狀漸層 (請以 paint.editGradient {kind} 套用) +@msg the parameters or body do not form one function 參數或主體無法構成一個函式 +@msg the pasted SVG filter {name} draws differently from the document's filter of that name, and no free name fits it 貼上的 SVG 濾鏡 {name} 的繪製結果與文件中同名的濾鏡不同,而且找不到可用的名稱 +@msg the paths are too many or too tangled to find where they cross 路徑過多或過於糾結,無法找出交叉處 +@msg the pen table holds more than 255 pens 筆表包含超過 255 支筆 +@msg the plates can't be kept 色版無法保留 +@msg the position table does not match the instructions 位置表與指令不相符 +@msg the prompt's text is longer than {MAX_PROMPT_BYTES} bytes 提示的文字超過 {MAX_PROMPT_BYTES} 位元組 +@msg the radix must be between 2 and 36 基數必須介於 2 和 36 之間 +@msg the rectangle or line reaches too many paths to check 矩形或線條觸及的路徑過多,無法檢查 +@msg the right side of 'in' is not an object 'in' 的右側不是物件 +@msg the right side of 'instanceof' is not a function 'instanceof' 的右側不是函式 +@msg the selected art is nested more than {MAX_DEPTH} levels deep 所選圖稿的巢狀層次超過 {MAX_DEPTH} 層 +@msg the selected art is too large to measure 所選圖稿過大,無法測量 +@msg the selection has no outlines to weed around 選取範圍沒有可供除廢的外框 +@msg the spacing makes more than {MAX_GROMMETS} grommets 此間距會產生超過 {MAX_GROMMETS} 個扣眼 +@msg the value bind was called on is not a function 呼叫 bind 時所用的值不是函式 +@msg the value is not a constructor 該值不是建構函式 +@msg the value is not a function 該值不是函式 +@msg the value is not a valid XML name 該值不是有效的 XML 名稱 +@msg the value is not an XML attribute name 該值不是 XML 屬性名稱 +@msg the value is not an XML name 該值不是 XML 名稱 +@msg the weeding lines cross the art's outlines too many times to measure; use fewer lines 除廢線與圖稿外框交叉的次數過多,無法測量;請減少線條 +@msg the weeding lines pass too close to too many outline segments to measure; use fewer lines or a smaller gap 除廢線過於接近太多外框線段,無法測量;請減少線條或縮小間隙 +@msg the weeding lines would be more than {max_pieces} pieces 除廢線會超過 {max_pieces} 段 +@msg the {_1} plate lies outside the file {_1} 色版位於檔案之外 +@msg there is no banner to mark 沒有可標記的橫幅 +@msg this is a binary DXF file, which can't be read: save it from the CAD app as an ASCII DXF and open that 這是二進位 DXF 檔案,無法讀取:請在 CAD 應用程式中將它儲存為 ASCII DXF,再開啟該檔案 +@msg this warp's points can't be edited: use Reset with Mesh first 無法編輯此彎曲的點:請先使用「以網格重設」 +@msg toExponential() digits must be between 0 and 20 toExponential() 的位數必須介於 0 和 20 之間 +@msg toFixed() digits must be between 0 and 20 toFixed() 的位數必須介於 0 和 20 之間 +@msg toISOString is not a function toISOString 不是函式 +@msg toPrecision() argument must be between 1 and 21 toPrecision() 的引數必須介於 1 和 21 之間 +@msg toSource: a getter cannot be written as source toSource:getter 無法寫成原始碼 +@msg toSource: an array with properties besides its elements, a property that is not enumerable or another prototype cannot be written as source toSource:除了元素之外還有其他屬性的陣列、不可列舉的屬性或其他原型都無法寫成原始碼 +@msg toSource: an object with a property that is not enumerable, or whose prototype is not Object.prototype, cannot be written as source toSource:具有不可列舉屬性的物件,或原型不是 Object.prototype 的物件,無法寫成原始碼 +@msg toSource: the source is too long toSource:原始碼過長 +@msg toSource: the value contains itself toSource:該值包含其本身 +@msg toSource: the value has too many entries toSource:該值的項目過多 +@msg toSource: the value is nested too deep toSource:該值的巢狀層次過深 +@msg toString is not a function toString 不是函式 +@msg too many arguments 引數過多 +@msg too many quantifiers 量詞過多 +@msg turn on at least one side 請至少開啟一側 +@msg unknown OpenType feature `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt; prefix - to turn off; swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom and aalt take an alternate's number as `tag=N` with N from 0 to {_1}, as `salt=2`) 未知的 OpenType 功能 `{t}` (liga, calt, dlig, smcp, frac, onum, tnum, ordn, swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom, aalt;加上前置的 - 可關閉;swsh, ss01–ss20, salt, titl, pnum, lnum, sups, subs, numr, dnom 和 aalt 可用 `tag=N` 指定替代字的編號,N 為 0 到 {_1},例如 `salt=2`) +@msg unknown dither `{d}` (diffusion, pattern, noise or none) 未知的仿色 `{d}` (diffusion、pattern、noise 或 none) +@msg unknown panel `{panel}` 未知的面板 `{panel}` +@msg unknown parameter `{key}` 未知的參數 `{key}` +@msg unknown parameter `{within}settings.{format}`; {why} 未知的參數 `{within}settings.{format}`;{why} +@msg unknown parameter `{within}{key}`; {why} 未知的參數 `{within}{key}`;{why} +@msg unknown reduction `{reduction}` (selective, perceptual, adaptive, web, gray, blackWhite, uniform or document) 未知的縮減 `{reduction}` (selective、perceptual、adaptive、web、gray、blackWhite、uniform 或 document) +@msg unmatched ')' 不成對的 ')' +@msg unterminated character class 字元類別未結束 +@msg unterminated group 群組未結束 +@msg with no hem and no grommets there is nothing to mark 沒有折邊也沒有扣眼,因此沒有可標記的內容 +@msg wordGap and lineGap need area type in the selection wordGap 和 lineGap 需要選取範圍中有區域文字 +@msg xpath needs its variables as an object xpath 需要以物件形式提供變數 +@msg xpath needs the expression as a string xpath 需要以字串形式提供運算式 +@msg {GRANT_NOT_REMOVED}, and its settings and cache can't be moved back from {_1} to {_2}: {e} {GRANT_NOT_REMOVED},而且其設定和快取無法從 {_1} 移回 {_2}:{e} +@msg {_1} is not a folder: {e} {_1} 不是資料夾:{e} +@msg {_1}: {_2} and {_3} are in the way {_1}:{_2} 和 {_3} 擋住了 +@msg {code}: {0} {code}:{0} +@msg {dir}: {e} {dir}:{e} +@msg {file} names more than one linked JavaScript file {file} 指定了多個連結的 JavaScript 檔案 +@msg {k}: a custom arrowhead's path needs an area to fill and at most {most} anchors and {most} subpaths, each anchor within {far} head units of its tip {k}:自訂箭頭的路徑需要有可填色的區域,最多 {most} 個錨點和 {most} 個子路徑,且每個錨點與箭頭尖端的距離在 {far} 個箭頭單位以內 +@msg {k}: bad custom arrowhead path: {e} {k}:自訂箭頭路徑無效:{e} +@msg {k}: bad custom arrowhead: {e} {k}:自訂箭頭無效:{e} +@msg {k}: custom must be a name {k}:custom 必須是名稱 +@msg {name} must be a number {name} 必須是數字 +@msg {path}: copy takes a DCS file only when its plates are inside it; relink to it where its plate files are {path}:只有當 DCS 檔案的色版位於檔案內時才能複製它;請在其色版檔案所在位置重新連結 +@msg {path}: larger than {_1} MB {path}:大於 {_1} MB +@msg {saving} failed: {e} {saving} 失敗:{e} +@msg {shown} is not an XPath 1.0 function {shown} 不是 XPath 1.0 函式 +@msg {v} names no layer or sublayer {v} 不是任何圖層或子圖層的名稱 +@msg {what} is not a function {what} 不是函式 +@msg {what} would print more than {MAX_COPIES_PER_SHEET} copies on a sheet: scale it up {what} 會在一張紙上列印超過 {MAX_COPIES_PER_SHEET} 份:請放大 +@msg {what} {i} out of range {what} {i} 超出範圍 +@msg A profile supports one Revolve effect. Edit the existing effect's options instead. 一個剖面只支援一個「迴轉」效果。請改為編輯現有效果的選項。 +@msg Add Points at Crossings: a path went missing 在交叉處增加錨點:有一條路徑不見了 +@msg CSS options: {e} CSS 選項:{e} +@msg CSV has a header but no data rows CSV 有標題列但沒有資料列 +@msg CSV holds NUL bytes: save it as UTF-8, or as UTF-16 with a byte-order mark CSV 包含 NUL 位元組:請儲存為 UTF-8,或帶有位元組順序記號的 UTF-16 +@msg CSV is empty CSV 為空 +@msg CSV is larger than {MAX_CSV_BYTES} bytes CSV 大於 {MAX_CSV_BYTES} 位元組 +@msg CSV is not UTF-16 CSV 不是 UTF-16 +@msg CSV is not UTF-8 CSV 不是 UTF-8 +@msg CSV would be larger than {MAX_CSV_BYTES} bytes CSV 會大於 {MAX_CSV_BYTES} 位元組 +@msg Choose original artwork, not a dimension's generated paths 請選擇原始圖稿,而不是尺寸標註產生的路徑 +@msg Contour: select paths or shapes 輪廓:請選取路徑或形狀 +@msg Contour: the Offset Path effect is not available 輪廓:無法使用「位移複製」效果 +@msg Create needs fills, strokes or both 「建立」需要填色、筆畫或兩者 +@msg DXF options: {e} DXF 選項:{e} +@msg DXF scale must be a positive number up to {_1}, not {scale} DXF 比例必須是不超過 {_1} 的正數,而非 {scale} +@msg DXF {field} `{s}`: {allowed} DXF {field} `{s}`:{allowed} +@msg Dimension is locked or hidden 尺寸標註已鎖定或隱藏 +@msg Dimension mode does not match its source 尺寸標註模式與其來源不相符 +@msg Draw Inside needs exactly one selected path, compound path or text 「內部繪圖」需要剛好選取一個路徑、複合路徑或文字 +@msg EPS Save writes all artwork: use document.export for selected-only EPS EPS 儲存會寫入所有圖稿:若只要所選圖稿的 EPS,請使用 document.export +@msg EPS flattener: {e} EPS 平面化:{e} +@msg EPS options: {e} EPS 選項:{e} +@msg EPS {field} `{s}`: {allowed} EPS {field} `{s}`:{allowed} +@msg Export for Screens writes png, png8, jpg, webp, gif, tiff, bmp, tga, psd, svg, svgz, pdf, eps, ai or vectorcraft 「匯出為螢幕適用」可寫入 png、png8、jpg、webp、gif、tiff、bmp、tga、psd、svg、svgz、pdf、eps、ai 或 vectorcraft +@msg Flare click coordinates must be finite numbers 光暈的點按座標必須是有限的數字 +@msg HTML Text applies to object slices of type only HTML 文字只適用於文字的物件切片 +@msg Identify Objects By is XML ID: the name must be a valid XML ID (start with a letter, underscore or colon; no spaces) 「識別物件依據」為 XML ID:名稱必須是有效的 XML ID (以字母、底線或冒號開頭;不含空格) +@msg Image Trace failed: internal error: its thread stopped (please report this bug) 影像描圖失敗:內部錯誤:其執行緒已停止 (請回報此錯誤) +@msg Image Trace failed: {e} 影像描圖失敗:{e} +@msg Image Trace finished, but its document was closed 影像描圖已完成,但其文件已關閉 +@msg Image Trace finished, but the image or its settings changed meanwhile: trace it again 影像描圖已完成,但影像或其設定在此期間已變更:請重新描圖 +@msg Invalid dimension offset 尺寸標註位移無效 +@msg Invalid point 點無效 +@msg Join: a subpath went missing 連接:有一條子路徑不見了 +@msg Lock Workspace is not available in VectorCraft VectorCraft 不提供「鎖定工作區」 +@msg Move Panel to New Window is not available: floating panels stay in the main window 無法使用「將面板移至新視窗」:浮動面板會留在主視窗中 +@msg Offset Path: the path is too complex to offset 位移複製:路徑過於複雜,無法位移 +@msg Offset Path: {e} 位移複製:{e} +@msg PDF content is incomplete or exceeds the reader's limits; no document was imported PDF 內容不完整或超出讀取器的限制;未匯入任何文件 +@msg PDF flattener: {e} PDF 平面化:{e} +@msg PDF options: {e} PDF 選項:{e} +@msg Recolor Artwork is no longer open 「重新上色圖稿」已不再開啟 +@msg SVG is not UTF-8, UTF-16 or ISO 8859-1 SVG 不是 UTF-8、UTF-16 或 ISO 8859-1 +@msg Save writes one artboard: name one, or export several with document.export 「儲存」只寫入一個工作區域:請指定一個,或以 document.export 匯出多個 +@msg Select a dimension first 請先選取尺寸標註 +@msg Select dimensions to update 請選取要更新的尺寸標註 +@msg Select only dimensions 請只選取尺寸標註 +@msg Select two or more objects, or a group 請選取兩個以上的物件,或一個群組 +@msg Shaper needs 1–64 source paths Shaper 需要 1–64 條來源路徑 +@msg Switch x/y is for scatter graphs 「切換 x/y」適用於散佈圖 +@msg Text options: {e} 文字選項:{e} +@msg `align` is start, center or end `align` 是 start、center 或 end +@msg `anchors` must be an array of [subpath, anchor] pairs `anchors` 必須是 [subpath, anchor] 配對的陣列 +@msg `anchors` must list anchor indices (0, 1, 2…), not {k} `anchors` 必須列出錨點索引 (0, 1, 2…),而非 {k} +@msg `anchors` must list anchor indices (0, 1, 2…), not {v} `anchors` 必須列出錨點索引 (0, 1, 2…),而非 {v} +@msg `artboards` must be a list of artboard indices `artboards` 必須是工作區域索引的清單 +@msg `asset` is the asset id (see assets.list) `asset` 是資產 ID (請參閱 assets.list) +@msg `at` must be a byte offset `at` 必須是位元組偏移 +@msg `autoLeading` must be a number `autoLeading` 必須是數字 +@msg `background` must be "", "matte" or #rrggbb `background` 必須是 ""、"matte" 或 #rrggbb +@msg `burasagari` must be "none", "standard" or "forced" `burasagari` 必須是 "none"、"standard" 或 "forced" +@msg `center` must be [x, y] `center` 必須是 [x, y] +@msg `charAlign` must be "romanBaseline", "emBoxTop", "emBoxCenter", "emBoxBottom", "icfTop" or "icfBottom" `charAlign` 必須是 "romanBaseline"、"emBoxTop"、"emBoxCenter"、"emBoxBottom"、"icfTop" 或 "icfBottom" +@msg `charDirection` must be "default", "leftToRight" or "rightToLeft" `charDirection` 必須是 "default"、"leftToRight" 或 "rightToLeft" +@msg `clearStroke` requires `stroke: false`, `ids: []` and no `stop` `clearStroke` 需要 `stroke: false`、`ids: []`,且不能有 `stop` +@msg `clear` must be a list of type object ids, not {v} `clear` 必須是文字物件 ID 的清單,而非 {v} +@msg `clear` must list type objects; {_1} is not one `clear` 必須列出文字物件;{_1} 不是文字物件 +@msg `clear` must not list `id` `clear` 不能列出 `id` +@msg `color` needs a `rule` to make the theme from `color` 需要 `rule` 才能建立主題 +@msg `colors` is empty `colors` 為空 +@msg `columnType` is vertical, uniform, repeating or sliding `columnType` 是 vertical、uniform、repeating 或 sliding +@msg `columns` must be a whole number 1..50 `columns` 必須是 1..50 的整數 +@msg `commands` must not be empty `commands` 不能為空 +@msg `contents` goes with `to` `contents` 要與 `to` 一起使用 +@msg `corners` must be sharp, round or square, not `{other}` `corners` 必須是 sharp、round 或 square,而非 `{other}` +@msg `corners` must list anchor indices (0, 1, 2…), not {v} `corners` 必須列出錨點索引 (0, 1, 2…),而非 {v} +@msg `count` must be a whole number from 1 to 100 `count` 必須是 1 到 100 之間的整數 +@msg `dataBase64` is larger than the module limit `dataBase64` 大於模組上限 +@msg `dataBase64` is not valid base64 `dataBase64` 不是有效的 base64 +@msg `defaultsOnly` cannot be combined with `ids`, `reverse` or `append` `defaultsOnly` 不能與 `ids`、`reverse` 或 `append` 一起使用 +@msg `depth` and `childLimit` slice the summary: pass `summary: true` `depth` 和 `childLimit` 用於裁切摘要:請傳入 `summary: true` +@msg `design` is a design name, or null for plain columns `design` 是設計名稱,或以 null 表示一般直條 +@msg `design` is a design name, or null for the default marker `design` 是設計名稱,或以 null 表示預設標記 +@msg `destinationFolder` is required when destination is `folder` destination 為 `folder` 時必須提供 `destinationFolder` +@msg `destination` must be `none`, `saveAndClose` or `folder` `destination` 必須是 `none`、`saveAndClose` 或 `folder` +@msg `diameter` must be from 0.1 to 2500 pt `diameter` 必須介於 0.1 到 2500 pt 之間 +@msg `digits` must be one of {_1} `digits` 必須是 {_1} 其中之一 +@msg `dimImages` is a percentage or false `dimImages` 是百分比或 false +@msg `direction` must be "auto", "leftToRight" or "rightToLeft" `direction` 必須是 "auto"、"leftToRight" 或 "rightToLeft" +@msg `each` is the value one design stands for, more than 0 `each` 是一個設計所代表的值,必須大於 0 +@msg `end` must be "start" or "end" `end` 必須是 "start" 或 "end" +@msg `ends` applies to joining exactly two paths `ends` 只適用於連接剛好兩條路徑 +@msg `event` must be one of {_1} `event` 必須是 {_1} 其中之一 +@msg `every` must be "all", "odd" or "even", not {v} `every` 必須是 "all"、"odd" 或 "even",而非 {v} +@msg `expand` must be true or false `expand` 必須是 true 或 false +@msg `files` must be 1 to 1000 paths of font files the last text.findFontFiles search found `files` 必須是 1 到 1000 個字體檔案路徑,且出自最近一次 text.findFontFiles 搜尋的結果 +@msg `folder` must be an absolute folder path `folder` 必須是絕對資料夾路徑 +@msg `fontAxes` must be an object of axis tags and values, such as {"wght"} `fontAxes` 必須是由軸標籤和值組成的物件,例如 {"wght"} +@msg `format` must be a string `format` 必須是字串 +@msg `format` must be one of {_1} `format` 必須是 {_1} 其中之一 +@msg `fractions` is chop or scale `fractions` 是 chop 或 scale +@msg `from` and `to` must differ `from` 和 `to` 必須不同 +@msg `from` has an empty frame `from` 中有空的文字框 +@msg `from` must be a non-negative integer `from` 必須是非負整數 +@msg `from` must be area type or type on a path `from` 必須是區域文字或路徑文字 +@msg `gid` must be a glyph id, not {v} `gid` 必須是字符 ID,而非 {v} +@msg `glyphAlternate` belongs to one character, not to a character style (text.setGlyphAlternate sets it) `glyphAlternate` 屬於單一字元,不屬於字元樣式 (由 text.setGlyphAlternate 設定) +@msg `guide` must be a guide index (guide.list) `guide` 必須是參考線索引 (guide.list) +@msg `hAlign` must be default, left, center or right `hAlign` 必須是 default、left、center 或 right +@msg `id` must be a node id `id` 必須是節點 ID +@msg `id` must be an object id, not {v} `id` 必須是物件 ID,而非 {v} +@msg `ids` must name Objects on Path groups or objects in them `ids` 必須指定「路徑上的物件」群組或其中的物件 +@msg `ids` takes at most {MAX_INSPECT_IDS} ids `ids` 最多接受 {MAX_INSPECT_IDS} 個 ID +@msg `imageMap` must be none, rectangle or polygon `imageMap` 必須是 none、rectangle 或 polygon +@msg `includeArtboardFill` must be true or false `includeArtboardFill` 必須是 true 或 false +@msg `includeSubdirs` must be true or false `includeSubdirs` 必須是 true 或 false +@msg `index` must be a point index `index` 必須是點的索引 +@msg `index` must be a whole number or null `index` 必須是整數或 null +@msg `indices` must be a non-empty array of item indices `indices` 必須是項目索引的非空陣列 +@msg `items` is a list of {kind, item} `items` 是 {kind, item} 的清單 +@msg `items` is empty `items` 為空 +@msg `items` must be a list of {id, points} `items` 必須是 {id, points} 的清單 +@msg `items` must be a list of {{id, anchors?}}, not {v} `items` 必須是 {{id, anchors?}} 的清單,而非 {v} +@msg `items` must be an array of {id, anchors} `items` 必須是 {id, anchors} 的陣列 +@msg `items` must be an array of {{id, corners?}}, not {v} `items` 必須是 {{id, corners?}} 的陣列,而非 {v} +@msg `kashida` must be "none", "short", "medium", "long" or "stylistic" `kashida` 必須是 "none"、"short"、"medium"、"long" 或 "stylistic" +@msg `kind` is one of {_1} `kind` 是 {_1} 其中之一 +@msg `kind` must be "round", "invertedRound" or "chamfer", not {v} `kind` 必須是 "round"、"invertedRound" 或 "chamfer",而非 {v} +@msg `kind` must be `text`, `visibility`, `image` or `graph` `kind` 必須是 `text`、`visibility`、`image` 或 `graph` +@msg `kind` must be a string `kind` 必須是字串 +@msg `kind` must be image, noImage or htmlText `kind` 必須是 image、noImage 或 htmlText +@msg `kinsoku` must be "none", "hard" or "soft" `kinsoku` 必須是 "none"、"hard" 或 "soft" +@msg `label` must be a non-empty name of at most 200 characters `label` 必須是不超過 200 個字元的非空名稱 +@msg `language` must be a language name or tag, such as "Turkish" or "tr" `language` 必須是語言名稱或標籤,例如 "Turkish" 或 "tr" +@msg `leadingModel` must be "romanBaseline" or "emBoxTop" `leadingModel` 必須是 "romanBaseline" 或 "emBoxTop" +@msg `leading` must be from 0.1 to 5000, or null for Auto `leading` 必須介於 0.1 到 5000 之間,或以 null 表示自動 +@msg `length` must be a number of at most 1000000 pt either way `length` 必須是正負都不超過 1000000 pt 的數字 +@msg `line` must be true or false `line` 必須是 true 或 false +@msg `minAngle` ({min_angle}°) can't be more than `maxAngle` ({max_angle}°) `minAngle` ({min_angle}°) 不能大於 `maxAngle` ({max_angle}°) +@msg `mode` must be "handles", "straight" or "smooth" `mode` 必須是 "handles"、"straight" 或 "smooth" +@msg `mode` must be "straight", "bezier" or "arc" `mode` 必須是 "straight"、"bezier" 或 "arc" +@msg `mode` must be one of {_1} `mode` 必須是 {_1} 其中之一 +@msg `mojikumi` must be "none", "yakumonoHankaku", "gyomatsuYakumonoHankaku", "gyomatsuYakumonoZenkaku", "yakumonoZenkaku" or "lineEndHalf" `mojikumi` 必須是 "none"、"yakumonoHankaku"、"gyomatsuYakumonoHankaku"、"gyomatsuYakumonoZenkaku"、"yakumonoZenkaku" 或 "lineEndHalf" +@msg `names` is a list of preset names `names` 是預設集名稱的清單 +@msg `names` lists preset names `names` 用來列出預設集名稱 +@msg `names` must be a list of names `names` 必須是名稱清單 +@msg `names` must be a list of swatch names `names` 必須是色票名稱的清單 +@msg `names` must be an array of style names `names` 必須是樣式名稱的陣列 +@msg `new` is a design name, or true `new` 是設計名稱,或 true +@msg `path` must be a folder `path` 必須是資料夾 +@msg `path` must be a path object `path` 必須是路徑物件 +@msg `pivot` must be a whole number from 0 to 8 `pivot` 必須是 0 到 8 之間的整數 +@msg `points` must be a list of [x, y] points `points` 必須是 [x, y] 點的清單 +@msg `points` must be a list of point indexes `points` 必須是點索引的清單 +@msg `points` must be an array of point indices `points` 必須是點索引的陣列 +@msg `points` must be point indexes `points` 必須是點的索引 +@msg `port` must be "in" or "out" `port` 必須是 "in" 或 "out" +@msg `position` is above or below `position` 是 above 或 below +@msg `preset` must be a string `preset` 必須是字串 +@msg `ratio` must be from 0.1 to 0.5 `ratio` 必須介於 0.1 到 0.5 之間 +@msg `rect` must be [x, y, width, height] with a positive size `rect` 必須是大小為正值的 [x, y, width, height] +@msg `relation` must be overlap, inside or outside `relation` 必須是 overlap、inside 或 outside +@msg `reversed` must be true or false `reversed` 必須是 true 或 false +@msg `rotate` must be a finite number `rotate` 必須是有限的數字 +@msg `rule` must be nonZero or evenOdd `rule` 必須是 nonZero 或 evenOdd +@msg `scale` must be a number in (0, 100] `scale` 必須是 (0, 100] 範圍內的數字 +@msg `scope` must be "selection" or "document", not {other} `scope` 必須是 "selection" 或 "document",而非 {other} +@msg `script` must be a string `script` 必須是字串 +@msg `seriesIndexes` is a non-empty list of series indexes `seriesIndexes` 是數列索引的非空清單 +@msg `seriesIndexes` needs a `type` or a `valueAxis` `seriesIndexes` 需要 `type` 或 `valueAxis` +@msg `shift` must be a number of points `shift` 必須是以點為單位的數字 +@msg `showCenter` must be true or false `showCenter` 必須是 true 或 false +@msg `singleWordJustification` must be "fullJustify", "alignLeft", "alignCenter" or "alignRight" `singleWordJustification` 必須是 "fullJustify"、"alignLeft"、"alignCenter" 或 "alignRight" +@msg `size` is a percentage of the base text's size, 1 to 100 `size` 是基底文字大小的百分比,1 到 100 +@msg `source` and `target` are the same object `source` 和 `target` 是同一個物件 +@msg `source` must be `folder` or `datasets` `source` 必須是 `folder` 或 `datasets` +@msg `spacing` must be a number `spacing` 必須是數字 +@msg `spacing` must be a number of points, 0 or more, or "auto" `spacing` 必須是以點為單位且大於或等於 0 的數字,或 "auto" +@msg `start` must be a finite number `start` 必須是有限的數字 +@msg `starts` must be an array of anchor indices (or nulls) `starts` 必須是錨點索引 (或 null) 的陣列 +@msg `status` must be linked, embedded, missing or modified, or a list of them `status` 必須是 linked、embedded、missing 或 modified,或由它們組成的清單 +@msg `stop` must be a stop index `stop` 必須是色標索引 +@msg `story` styles the whole story: give no `start` or `end` `story` 會設定整篇文章的樣式:請不要提供 `start` 或 `end` +@msg `story` takes the whole story: give no `start` or `end` `story` 會涵蓋整篇文章:請不要提供 `start` 或 `end` +@msg `strokeMode` applies to strokes (stroke: true) `strokeMode` 適用於筆畫 (stroke: true) +@msg `style` must be roman or japanese `style` 必須是 roman 或 japanese +@msg `subpaths` must be two integer indices `subpaths` 必須是兩個整數索引 +@msg `symbol` must be a symbol name `symbol` 必須是符號名稱 +@msg `target` must be "object" or "contents", not {v} `target` 必須是 "object" 或 "contents",而非 {v} +@msg `tint` applies to global and spot colours `tint` 適用於全域色和特別色 +@msg `tint` goes with a global or spot `swatch` `tint` 要與全域色或特別色的 `swatch` 一起使用 +@msg `tint` must be a number (%) `tint` 必須是數字 (%) +@msg `tint` needs a global or spot colour `tint` 需要全域色或特別色 +@msg `to` is already threaded `to` 已經串連 +@msg `to` is the design's new name `to` 是設計的新名稱 +@msg `to` must be [x, y] `to` 必須是 [x, y] +@msg `to` must be a closed path, area type or type on a path other than `from` `to` 必須是 `from` 以外的封閉路徑、區域文字或路徑文字 +@msg `to` must be a whole number `to` 必須是整數 +@msg `to` takes the rows of one object's stack, not aligned rows `to` 接受單一物件堆疊中的列,而非已對齊的列 +@msg `useLab` must be true or false `useLab` 必須是 true 或 false +@msg `vAlign` must be default, top, middle, baseline or bottom `vAlign` 必須是 default、top、middle、baseline 或 bottom +@msg `values` must be a list `values` 必須是清單 +@msg `values` must be an object `values` 必須是物件 +@msg `values` must name hex, rgb, cmyk, lab or gray `values` 必須指定 hex、rgb、cmyk、lab 或 gray +@msg `values` names a kind twice `values` 將同一種類指定了兩次 +@msg `{_1}` can't be edited or removed `{_1}` 無法編輯或移除 +@msg `{_1}` is built in and always listed `{_1}` 是內建項目,一律會列出 +@msg `{_1}` is not a font file the last text.findFontFiles search found `{_1}` 不是最近一次 text.findFontFiles 搜尋找到的字體檔案 +@msg `{_1}` would be overwritten by the package: choose a different folder or name `{_1}` 會被封裝覆寫:請選擇其他資料夾或名稱 +@msg `{file}` has no art to place `{file}` 沒有可置入的圖稿 +@msg `{file}` is over {_1} MB `{file}` 超過 {_1} MB +@msg `{f}` belongs to a VectorCraft that is running `{f}` 屬於執行中的 VectorCraft +@msg `{f}` is the copy of a document open now `{f}` 是目前開啟文件的副本 +@msg `{id}` is no writable format (see document.formats) `{id}` 不是可寫入的格式 (請參閱 document.formats) +@msg `{id}` isn't a loaded library `{id}` 不是已載入的資料庫 +@msg `{key}` has no colours `{key}` 沒有顏色 +@msg `{key}` is a design name `{key}` 是設計名稱 +@msg `{key}` is a design name or a list of them `{key}` 是設計名稱或設計名稱的清單 +@msg `{key}` is longer than {MAX_NAME} characters `{key}` 超過 {MAX_NAME} 個字元 +@msg `{key}` is out of range `{key}` 超出範圍 +@msg `{key}` must be [min, desired, max] or {{min?, desired?, max?}}, in percent `{key}` 必須是 [min, desired, max] 或 {{min?, desired?, max?}},以百分比表示 +@msg `{key}` must be a non-negative integer `{key}` 必須是非負整數 +@msg `{key}` must be a number {_1}..{_2} `{key}` 必須是 {_1}..{_2} 的數字 +@msg `{key}` must be a whole number of at least 0, not {n} `{key}` 必須是至少為 0 的整數,而非 {n} +@msg `{key}` must be an appearance item index (paint order) or null `{key}` 必須是外觀項目索引 (繪製順序) 或 null +@msg `{key}` must be an array of asset ids (see assets.list) `{key}` 必須是資產 ID 的陣列 (請參閱 assets.list) +@msg `{key}` must be from 0 to 180 degrees, not {a} `{key}` 必須介於 0 到 180 度之間,而非 {a} +@msg `{key}` must be from {_1} to {shift_max} `{key}` 必須介於 {_1} 到 {shift_max} 之間 +@msg `{key}`: not a colour: {v} `{key}`:不是顏色:{v} +@msg `{k}.family` is required 必須提供 `{k}.family` +@msg `{k}` is a number 0..1 `{k}` 是 0..1 的數字 +@msg `{k}` is true or false `{k}` 是 true 或 false +@msg `{k}` isn't an export setting: {_1} `{k}` 不是匯出設定:{_1} +@msg `{k}` must be a byte offset `{k}` 必須是位元組偏移 +@msg `{k}` must be a number `{k}` 必須是數字 +@msg `{k}` must be a number of points `{k}` 必須是以點為單位的數字 +@msg `{k}` must be a string `{k}` 必須是字串 +@msg `{k}` must be a whole number `{k}` 必須是整數 +@msg `{k}` must be from {lo} to {hi} for {key} 對 {key} 而言,`{k}` 必須介於 {lo} 到 {hi} 之間 +@msg `{k}` must be {what}, not {v} `{k}` 必須是 {what},而非 {v} +@msg `{l}` isn't a global or spot colour `{l}` 不是全域色或特別色 +@msg `{m}` isn't a bitmap: use clipboard.importSvg, importPdf or importText `{m}` 不是點陣圖:請使用 clipboard.importSvg、importPdf 或 importText +@msg `{name}` can't be deleted `{name}` 無法刪除 +@msg `{name}` can't be duplicated `{name}` 無法製作複本 +@msg `{name}` can't be edited `{name}` 無法編輯 +@msg `{name}` can't be edited this way `{name}` 無法以這種方式編輯 +@msg `{name}` can't be renamed `{name}` 無法重新命名 +@msg `{name}` can't name a folder `{name}` 不能作為資料夾名稱 +@msg `{name}` has no art to place `{name}` 沒有可置入的圖稿 +@msg `{name}` has no text to place `{name}` 沒有可置入的文字 +@msg `{name}` in the Word document is not UTF-8 or UTF-16 text Word 文件中的 `{name}` 不是 UTF-8 或 UTF-16 文字 +@msg `{name}` in the Word document is not well-formed XML: {e} Word 文件中的 `{name}` 不是格式正確的 XML:{e} +@msg `{name}` in the Word document nests elements more than {MAX_NESTING} deep Word 文件中的 `{name}` 的元素巢狀層次超過 {MAX_NESTING} 層 +@msg `{name}` is a built-in preset and is read-only: save it under another name `{name}` 是內建預設集,為唯讀:請以其他名稱儲存 +@msg `{name}` is a built-in preset: save under another name `{name}` 是內建預設集:請以其他名稱儲存 +@msg `{name}` is a built-in profile and stays `{name}` 是內建描述檔,會保留 +@msg `{name}` is a tint of `{base}`: edit `{base}` (a tint swatch only takes a new name) `{name}` 是 `{base}` 的色調:請編輯 `{base}` (色調色票只能變更名稱) +@msg `{name}` is a working space: choose another with edit.colorSettings first `{name}` 是工作色域:請先以 edit.colorSettings 選擇其他色域 +@msg `{name}` is built in and stays `{name}` 是內建項目,會保留 +@msg `{name}` takes a paint of its own kind (colour, gradient or pattern) `{name}` 只接受同類型的上色 (顏色、漸層或圖樣) +@msg `{n}` can't be deleted `{n}` 無法刪除 +@msg `{n}` can't be merged `{n}` 無法合併 +@msg `{n}` can't be moved `{n}` 無法移動 +@msg `{n}` is not a colour swatch `{n}` 不是顏色色票 +@msg `{n}` isn't a solid colour `{n}` 不是純色 +@msg `{n}`: colour groups hold solid colours only `{n}`:顏色群組只能包含純色 +@msg `{other}` doesn't trace an image `{other}` 不會描圖影像 +@msg `{s}`: the step's references copy in more than {_1} MB of values `{s}`:此步驟的參照複製了超過 {_1} MB 的值 +@msg `{tag}` is not an axis tag: a tag is four characters, such as "wght" `{tag}` 不是軸標籤:標籤為四個字元,例如 "wght" +@msg `{to}` is empty or already used `{to}` 為空或已被使用 +@msg `{what}` is longer than {MAX_TEXT} bytes `{what}` 超過 {MAX_TEXT} 位元組 +@msg `{what}` must be text `{what}` 必須是文字 +@msg a DXF drawing has one origin: pass useArtboards: true for one drawing per artboard DXF 圖面只有一個原點:若要每個工作區域各一份圖面,請傳入 useArtboards: true +@msg a PDF presets file with over {_1} presets PDF 預設集檔案包含超過 {_1} 個預設集 +@msg a batch preview cannot switch documents 批次預覽無法切換文件 +@msg a brush named `{nn}` exists 已有名為 `{nn}` 的筆刷 +@msg a container of the listed objects is gone 所列物件的某個容器已不存在 +@msg a content stream can't be read 有一個內容資料流無法讀取 +@msg a content stream isn't a stream 有一個內容資料流不是資料流 +@msg a design holds at most {_1} objects 一個設計最多包含 {_1} 個物件 +@msg a design needs a name 設計需要名稱 +@msg a dictionary grew too large 有一個字典變得過大 +@msg a document keeps at most {_1} graph designs 一份文件最多保留 {_1} 個圖表設計 +@msg a document keeps at most {_1} saved selections 一份文件最多保留 {_1} 個已儲存的選取範圍 +@msg a document keeps at most {_1} views 一份文件最多保留 {_1} 個檢視 +@msg a document links at most {MAX_SVG_SCRIPTS} JavaScript files 一份文件最多連結 {MAX_SVG_SCRIPTS} 個 JavaScript 檔案 +@msg a feConvolveMatrix filter's order is {x}×{y}, which overflows the kernel-size multiply usvg makes feConvolveMatrix 濾鏡的階數為 {x}×{y},會使 usvg 計算核心大小的乘法溢位 +@msg a gradient preset is already called {n} 已有名為 {n} 的漸層預設集 +@msg a graph has at most {_1} series, so it transposes with at most that many categories 一個圖表最多有 {_1} 個數列,因此轉置時最多只能有同樣數量的類別 +@msg a layer can't be merged into its own sublayer 圖層無法合併到自己的子圖層 +@msg a layer's form box isn't an array 有一個圖層的表單方框不是陣列 +@msg a layer's form can't be read 有一個圖層的表單無法讀取 +@msg a layer's form has no box 有一個圖層的表單沒有方框 +@msg a layer's form has no dictionary 有一個圖層的表單沒有字典 +@msg a legend draws at most {MAX_CHIPS} swatches 圖例最多繪製 {MAX_CHIPS} 個色票 +@msg a name names one asset: give multiple: false, or one object 一個名稱只代表一個資產:請指定 multiple: false,或提供一個物件 +@msg a page can't be read 有一個頁面無法讀取 +@msg a page object is used by something else 有一個頁面物件已被其他內容使用 +@msg a page thumbnail must be RGB pixels, 1 to {THUMBNAIL_SIZE} a side (got {w} × {h}) 頁面縮圖必須是 RGB 像素,每邊 1 到 {THUMBNAIL_SIZE} (收到 {w} × {h}) +@msg a pattern layer doesn't end what it starts 有一個圖樣圖層沒有結束它所開始的內容 +@msg a pattern layer's colors hold something else 有一個圖樣圖層的顏色包含其他內容 +@msg a pattern named `{n}` exists 已有名為 `{n}` 的圖樣 +@msg a plug-in with id {_1} is already installed 已安裝 ID 為 {_1} 的增效模組 +@msg a preset named `{n}` exists 已有名為 `{n}` 的預設集 +@msg a print presets file with over {_1} presets 列印預設集檔案包含超過 {_1} 個預設集 +@msg a profile is already called {n} 已有名為 {n} 的描述檔 +@msg a row can't go into itself 列不能移入其本身 +@msg a series goes on the left or the right value axis 數列只能放在左側或右側的數值軸上 +@msg a start must be an anchor index ≥ 0 or null 起點必須是 ≥ 0 的錨點索引或 null +@msg a style named `{name}` already exists 已有名為 `{name}` 的樣式 +@msg a style named `{to}` already exists 已有名為 `{to}` 的樣式 +@msg a swatch needs a colour, gradient or pattern 色票需要顏色、漸層或圖樣 +@msg a symbol named `{n}` already exists 已有名為 `{n}` 的符號 +@msg a theme has 1 to {THEME_SIZE} colours 一個主題有 1 到 {THEME_SIZE} 種顏色 +@msg a theme is already called {name} (replace: "{name}" overwrites it) 已有名為 {name} 的主題 (replace: "{name}" 會覆寫它) +@msg a toolbar name has at most {MAX_NAME} characters 工具列名稱最多 {MAX_NAME} 個字元 +@msg a view named `{_1}` exists 已有名為 `{_1}` 的檢視 +@msg a view named `{name}` exists 已有名為 `{name}` 的檢視 +@msg a workspace keeps at most {MAX} toolbars 一個工作區最多保留 {MAX} 個工具列 +@msg a {_1} series can't go in a {_2} graph {_1} 數列不能放在 {_2} 圖表中 +@msg aiVersion {v}: "pdf" (PDF-compatible, the default) or "7" (legacy .ai, version 7) aiVersion {v}:"pdf" (PDF 相容,預設值) 或 "7" (舊版 .ai,第 7 版) +@msg already editing an opacity mask 已在編輯不透明度遮色片 +@msg already editing another object's opacity mask 已在編輯另一個物件的不透明度遮色片 +@msg already in pattern editing mode 已在圖樣編輯模式中 +@msg an artboard is listed twice 有一個工作區域列出了兩次 +@msg an empty artboard has no width or height to scale to 空的工作區域沒有可供縮放的寬度或高度 +@msg an image is too large for DXF and was left out 有一個影像對 DXF 而言過大,已略過 +@msg an image of {_1} MB, at most {_2} MB 影像為 {_1} MB,上限為 {_2} MB +@msg an image of {declared_w} × {declared_h} pixels is too large to draw {declared_w} × {declared_h} 像素的影像過大,無法繪製 +@msg an image of {width} × {height} pixels is too large to draw {width} × {height} 像素的影像過大,無法繪製 +@msg an index must be a whole number 索引必須是整數 +@msg an inline graphic has no glyphs 行內圖形沒有字符 +@msg an invisible text form can't be read 有一個不可見文字表單無法讀取 +@msg an object is missing 有一個物件遺失 +@msg an object's header is missing 有一個物件的標頭遺失 +@msg an overprinting form can't be read 有一個疊印表單無法讀取 +@msg an unread object has no readable bounds 有一個未讀取的物件沒有可讀取的邊界 +@msg an unread object holds a frame of threaded type 有一個未讀取的物件包含串連文字的文字框 +@msg an unread object is missing from its layer 有一個未讀取的物件不在其圖層中 +@msg anchor `smooth` must be true or false 錨點的 `smooth` 必須是 true 或 false +@msg anchor `{key}` must be [x, y] 錨點的 `{key}` 必須是 [x, y] +@msg anchor `{key}` must be a number 錨點的 `{key}` 必須是數字 +@msg angle and roundness must be finite angle 和 roundness 必須是有限值 +@msg angles must be a list as long as pins (degrees or null) angles 必須是與 pins 等長的清單 (度數或 null) +@msg appearance must be flat|center|edge appearance 必須是 flat|center|edge +@msg apply is "fill" or "stroke", not `{other}` apply 是 "fill" 或 "stroke",而非 `{other}` +@msg area must be a closed polygon of 3 to 100000 [x, y] points area 必須是由 3 到 100000 個 [x, y] 點組成的封閉多邊形 +@msg area type needs a path that encloses an area 區域文字需要圍出區域的路徑 +@msg area type {_1} is named twice 區域文字 {_1} 指定了兩次 +@msg arrowAlign must be extend|tip, got {o} arrowAlign 必須是 extend|tip,收到 {o} +@msg arrowScale must be [start, end] arrowScale 必須是 [start, end] +@msg artboard is a 0-based index artboard 是從 0 起算的索引 +@msg artboard must be a 0-based index artboard 必須是從 0 起算的索引 +@msg artboard {i} doesn't print 工作區域 {i} 不會列印 +@msg artboardLayout must be {layout?, columns?, spacing?, rightToLeft?} artboardLayout 必須是 {layout?, columns?, spacing?, rightToLeft?} +@msg artboardLayout.columns must be 1 or more artboardLayout.columns 必須大於或等於 1 +@msg artboardLayout.layout must be gridByRow, gridByColumn, row or column artboardLayout.layout 必須是 gridByRow、gridByColumn、row 或 column +@msg artboardLayout.rightToLeft must be true or false artboardLayout.rightToLeft 必須是 true 或 false +@msg artboardLayout.spacing must be 0–{MAX_SPACING} pt artboardLayout.spacing 必須是 0–{MAX_SPACING} pt +@msg artboards must be a non-empty list artboards 必須是非空清單 +@msg artboards must be a number artboards 必須是數字 +@msg asset `{_1}` has no art to export 資產 `{_1}` 沒有可匯出的圖稿 +@msg at most {MAX_KEYWORDS} keywords 最多 {MAX_KEYWORDS} 個關鍵字 +@msg at most {MAX_MATCHES} matches are kept 最多保留 {MAX_MATCHES} 個相符項目 +@msg at most {MAX_POINTS} points 最多 {MAX_POINTS} 個點 +@msg at most {MAX_QUEUE} files 最多 {MAX_QUEUE} 個檔案 +@msg at must be [x, y] at 必須是 [x, y] +@msg at/rect lie outside the canvas at/rect 位於畫布之外 +@msg attribute must be size|leading|tracking|kerning|baselineShift attribute 必須是 size|leading|tracking|kerning|baselineShift +@msg attrs must be an object attrs 必須是物件 +@msg automation path rejected: the folder's name isn't valid text 已拒絕自動化路徑:資料夾名稱不是有效的文字 +@msg automation path rejected: {_1} isn't valid text 已拒絕自動化路徑:{_1} 不是有效的文字 +@msg automation path rejected: {why}: {path} 已拒絕自動化路徑:{why}:{path} +@msg axis must be "vertical", "horizontal" or an angle in degrees, not `{given}` axis 必須是 "vertical"、"horizontal" 或以度為單位的角度,而非 `{given}` +@msg backgroundContents must be transparent or white backgroundContents 必須是 transparent 或 white +@msg bad AES key AES 金鑰無效 +@msg bad `runs`: {e} `runs` 無效:{e} +@msg bad arrowScale arrowScale 無效 +@msg bad base64 base64 無效 +@msg bad color {c} 顏色 {c} 無效 +@msg bad colour 顏色無效 +@msg bad colour in `colors` `colors` 中有無效的顏色 +@msg bad colour {v} 顏色 {v} 無效 +@msg bad colour {v} in groupColors groupColors 中的顏色 {v} 無效 +@msg bad cross-reference entry 交互參照項目無效 +@msg bad cross-reference table 交互參照表無效 +@msg bad current colour {v} 目前的顏色 {v} 無效 +@msg bad dataBase64 dataBase64 無效 +@msg bad edit 編輯無效 +@msg bad fill {v} 填色 {v} 無效 +@msg bad fit: {e} fit 無效:{e} +@msg bad model {other} (keep, new or document) model {other} 無效 (keep、new 或 document) +@msg bad new colour {v} 新的顏色 {v} 無效 +@msg bad object 物件無效 +@msg bad object number 物件編號無效 +@msg bad offset 偏移無效 +@msg bad path data: {e} 路徑資料無效:{e} +@msg bad point {v}: expected [x, y] or [x, y, pressure] 無效的點 {v}:應為 [x, y] 或 [x, y, pressure] +@msg bad reference 參照無效 +@msg bad trailer size 檔尾大小無效 +@msg bad {k} colour {k} 顏色無效 +@msg batches cannot nest 批次不能巢狀 +@msg bind something to a variable first 請先將某個項目綁定到變數 +@msg bleed must be 0–{MAX_BLEED} pt: a number, [top, bottom, left, right] or {{top, bottom, left, right}} bleed 必須是 0–{MAX_BLEED} pt:一個數字、[top, bottom, left, right] 或 {{top, bottom, left, right}} +@msg brush must be a name or null brush 必須是名稱或 null +@msg by must be a number by 必須是數字 +@msg can't add page thumbnails: {why} 無法加入頁面縮圖:{why} +@msg can't add the editing data for other apps: {why} 無法加入供其他應用程式使用的編輯資料:{why} +@msg can't edit the written PDF: {why} 無法編輯已寫入的 PDF:{why} +@msg can't encrypt the PDF: {why} 無法加密 PDF:{why} +@msg can't linearise the PDF: {why} 無法將 PDF 線性化:{why} +@msg can't open `{_1}`: {_2} 無法開啟 `{_1}`:{_2} +@msg can't open `{_1}`: {e} 無法開啟 `{_1}`:{e} +@msg can't open `{name}`: not a format VectorCraft reads (see document.formats) 無法開啟 `{name}`:不是 VectorCraft 可讀取的格式 (請參閱 document.formats) +@msg can't place `{name}`: not a format VectorCraft reads (see document.formats) 無法置入 `{name}`:不是 VectorCraft 可讀取的格式 (請參閱 document.formats) +@msg can't read back the written PDF: {e} 無法讀回已寫入的 PDF:{e} +@msg can't read this Word document: {why} 無法讀取此 Word 文件:{why} +@msg can't write .{e} images: use .png, .jpg, .gif, .webp, .tif or .bmp 無法寫入 .{e} 影像:請使用 .png、.jpg、.gif、.webp、.tif 或 .bmp +@msg can't write PDF layers, overprint or invisible text: {why} 無法寫入 PDF 圖層、疊印或不可見文字:{why} +@msg can't write the file's copyright: {why} 無法寫入檔案的著作權資訊:{why} +@msg can't write the file's modification date: {why} 無法寫入檔案的修改日期:{why} +@msg can't write the pages' user units: {why} 無法寫入頁面的使用者單位:{why} +@msg cannot distort a zero-size or non-finite bounding box 無法扭曲大小為零或非有限的邊框 +@msg cannot move an object into itself 無法將物件移入其本身 +@msg case must be upper|lower|title|sentence case 必須是 upper|lower|title|sentence +@msg category `{c}`: one of {_1} 類別 `{c}`:應為 {_1} 其中之一 +@msg center must be [x, y] center 必須是 [x, y] +@msg choose at least one artboard 請至少選擇一個工作區域 +@msg choose at least one status 請至少選擇一種狀態 +@msg clip must be true or false clip 必須是 true 或 false +@msg clippingMask must be true or false clippingMask 必須是 true 或 false +@msg closed must be a boolean closed 必須是布林值 +@msg collapsed must be true or false collapsed 必須是 true 或 false +@msg color.profile: no RGB or CMYK profile is called “{profile}” color.profile:沒有名為「{profile}」的 RGB 或 CMYK 描述檔 +@msg colorMode must be rgb or cmyk, not `{m}` colorMode 必須是 rgb 或 cmyk,而非 `{m}` +@msg colorModel must be {own} (the document's mode), grayscale or bitmap colorModel 必須是 {own} (文件的模式)、grayscale 或 bitmap +@msg colour groups can't go into colour groups 顏色群組不能放入顏色群組 +@msg colour, mode and spot apply to solid-colour swatches only colour、mode 和 spot 只適用於純色色票 +@msg column {column}: `{cell}` is a `%` column of graph data files, which are not read 第 {column} 欄:`{cell}` 是圖表資料檔案的 `%` 欄,不會讀取 +@msg column {column}: `{cell}` names `{name}`, which is a {_1} variable 第 {column} 欄:`{cell}` 指定了 `{name}`,而它是 {_1} 變數 +@msg column {column}: `{cell}` names no variable 第 {column} 欄:`{cell}` 未指定任何變數 +@msg column {column}: the variable name is longer than {MAX_NAME} characters 第 {column} 欄:變數名稱超過 {MAX_NAME} 個字元 +@msg column: true floats the whole column and takes no onto, above or below column: true 會讓整欄浮動,不接受 onto、above 或 below +@msg command must be a shape.* command command 必須是 shape.* 指令 +@msg commands[{i}]: missing `command` commands[{i}]:未提供 `command` +@msg composer must be "singleLine" or "everyLine" composer 必須是 "singleLine" 或 "everyLine" +@msg compound shapes take paths, compound paths, groups, compound shapes, type, blends and envelopes 複合形狀接受路徑、複合路徑、群組、複合形狀、文字、漸變物件和封套 +@msg compound {_1} must contain exactly one open path to join 複合路徑 {_1} 必須剛好包含一條可連接的開放路徑 +@msg connect needs a path other than the one extended connect 需要延伸路徑以外的另一條路徑 +@msg connect needs id connect 需要 id +@msg connect path has no open end connect 的路徑沒有開放的端點 +@msg copy needs path: the file to copy into the document's folder copy 需要 path:要複製到文件資料夾的檔案 +@msg copy takes images only: relink placed documents where their files are copy 只接受影像:請在置入文件的檔案所在位置重新連結 +@msg copying a file isn't available on the web 網頁版無法複製檔案 +@msg copyrightStatus must be unknown, copyrighted or publicDomain copyrightStatus 必須是 unknown、copyrighted 或 publicDomain +@msg copyrightUrl must be a URL (no spaces, at most 2048 characters) copyrightUrl 必須是 URL (不含空格,最多 2048 個字元) +@msg corners must be 4 [x, y] points (TL, TR, BR, BL) corners 必須是 4 個 [x, y] 點 (TL、TR、BR、BL) +@msg counterPer `{c}`: item or file counterPer `{c}`:應為 item 或 file +@msg crop `{_1}`: only PDF pages have art, trim, bleed and media boxes; use "crop" or "bounding" crop `{_1}`:只有 PDF 頁面有 art、trim、bleed 和 media 方框;請使用 "crop" 或 "bounding" +@msg crop rectangle doesn't overlap the image 裁切矩形與影像沒有重疊 +@msg cross-reference and object streams aren't supported 不支援交互參照資料流和物件資料流 +@msg damaged compressed data: {e} 壓縮資料已損毀:{e} +@msg dash lengths must be numbers, got {v} 虛線長度必須是數字,收到 {v} +@msg dash must be a list of lengths or null, got {v} dash 必須是長度清單或 null,收到 {v} +@msg data key `{k}`: letters, digits, -, _ and . (not name or vc-…) 資料鍵 `{k}`:只能使用字母、數字、-、_ 和 . (不能是 name 或 vc-…) +@msg data must be an object of key: value, not {v} data 必須是 key: value 形式的物件,而非 {v} +@msg data set `{name}` holds a value for `{var}`, which the library doesn't declare 資料集 `{name}` 包含 `{var}` 的值,但資料庫未宣告該變數 +@msg data set `{name}` holds two values for `{var}` 資料集 `{name}` 包含 `{var}` 的兩個值 +@msg data set `{name}` is declared twice 資料集 `{name}` 宣告了兩次 +@msg data takes at most {MAX_DATA} keys at once data 一次最多接受 {MAX_DATA} 個鍵 +@msg dataset `{name}` already exists 資料集 `{name}` 已存在 +@msg dataset `{to}` already exists 資料集 `{to}` 已存在 +@msg date `{d}`: YYYY-MM-DD 日期 `{d}`:應為 YYYY-MM-DD +@msg decoded data is too large 解碼後的資料過大 +@msg define a variable first 請先定義變數 +@msg detect must be true or false detect 必須是 true 或 false +@msg direct-select anchor points of a path 請以直接選取方式選取路徑的錨點 +@msg distance must be > 0 distance 必須 > 0 +@msg dx and dy give the arrow's direction dx 和 dy 用來指定箭頭的方向 +@msg dx and dy must be numbers dx 和 dy 必須是數字 +@msg dxf fitTo must be [width, height], positive dxf fitTo 必須是正值的 [width, height] +@msg dxf must be an object of DXF import options dxf 必須是 DXF 匯入選項的物件 +@msg dxf scale must be a positive number up to {_1}, not {s} dxf scale 必須是不超過 {_1} 的正數,而非 {s} +@msg dxf unit `{u}`: a unit such as mm, cm, in or pt dxf unit `{u}`:應為 mm、cm、in 或 pt 這類單位 +@msg dxf: {e} dxf:{e} +@msg each format is an object {format, scale?, suffix?} 每個格式都是物件 {format, scale?, suffix?} +@msg each item needs an id 每個項目都需要 id +@msg each match needs `kind` 每個相符項目都需要 `kind` +@msg each match needs a `name` 每個相符項目都需要 `name` +@msg each of `fonts` is {family, style?}; 1 to 1000 of them `fonts` 的每一項都是 {family, style?};共 1 到 1000 項 +@msg each of `items` is {kind, item} `items` 的每一項都是 {kind, item} +@msg each of `items` is {{id, corners?}} with an object id, not {it} `items` 的每一項都是帶有物件 ID 的 {{id, corners?}},而非 {it} +@msg each row needs `from` 每一列都需要 `from` +@msg each stop needs a position 每個色標都需要位置 +@msg each subpath needs an anchors array 每條子路徑都需要 anchors 陣列 +@msg easingType must be easeIn, easeOut, easeInOut or easeOutIn easingType 必須是 easeIn、easeOut、easeInOut 或 easeOutIn +@msg editingData must be true or false editingData 必須是 true 或 false +@msg editingData must be true, false or "always" editingData 必須是 true、false 或 "always" +@msg edits overlap 編輯範圍重疊 +@msg effects of objects whose appearances differ can't be moved together 外觀不同的物件,其效果無法一起移動 +@msg empty header in column {_1} 第 {_1} 欄的標題為空 +@msg encoding `{_1}`: utf8 or utf16 編碼 `{_1}`:應為 utf8 或 utf16 +@msg ends must be two of "first" and "last" ends 必須是兩個值,各為 "first" 或 "last" +@msg every numbered name for the result is taken 結果可用的編號名稱都已被使用 +@msg expanded SVG styles exceed the import size limit 展開後的 SVG 樣式超過匯入大小上限 +@msg export presets file is larger than {MAX_PRESET_FILE_BYTES} bytes 匯出預設集檔案大於 {MAX_PRESET_FILE_BYTES} 位元組 +@msg exportText must be editable or appearance exportText 必須是 editable 或 appearance +@msg exportType must be movieClip or graphic, not `{s}` exportType 必須是 movieClip 或 graphic,而非 `{s}` +@msg extend needs id extend 需要 id +@msg featureChanges lists at most {MAX_FEATURE_CHANGES} tags featureChanges 最多列出 {MAX_FEATURE_CHANGES} 個標籤 +@msg featureChanges must be a list of tags featureChanges 必須是標籤清單 +@msg features must be a list of tags features 必須是標籤清單 +@msg fidelity must be 0..100 fidelity 必須是 0..100 +@msg files must be {name, dataBase64} files 必須是 {name, dataBase64} +@msg fit must be none|autoHeight|shrinkText|block, got {id} fit 必須是 none|autoHeight|shrinkText|block,收到 {id} +@msg flattener: {e} 平面化:{e} +@msg flattenerPreset `{name}`: high, medium, low or a saved one (see flattener.presets.list) flattenerPreset `{name}`:應為 high、medium、low 或已儲存的預設集 (請參閱 flattener.presets.list) +@msg flipProfile must be along|across, got {o} flipProfile 必須是 along|across,收到 {o} +@msg folders `{f}`: none, rows, format, item or itemFormat folders `{f}`:應為 none、rows、format、item 或 itemFormat +@msg folders deeper than {MAX_BATCH_DEPTH} levels 資料夾深度超過 {MAX_BATCH_DEPTH} 層 +@msg folders deeper than {MAX_DEPTH} levels 資料夾深度超過 {MAX_DEPTH} 層 +@msg font family `{family}` is not available 無法使用字體系列 `{family}` +@msg font family `{tf}` is not available 無法使用字體系列 `{tf}` +@msg format `{f}`: pdf or postscript format `{f}`:應為 pdf 或 postscript +@msg format `{f}`: text or json format `{f}`:應為 text 或 json +@msg format is `{format}` format 為 `{format}` +@msg formats must be an array of rows, not {v} formats 必須是列的陣列,而非 {v} +@msg frequency must be between 1 and 300 lines per inch frequency 必須介於每英寸 1 到 300 線之間 +@msg from and to must be finite from 和 to 必須是有限值 +@msg from must be [x0, y0, x1, y1] from 必須是 [x0, y0, x1, y1] +@msg give `before` or `after`, not both 請提供 `before` 或 `after`,不要兩者都提供 +@msg give `colors`, or `color` and `rule` 請提供 `colors`,或 `color` 和 `rule` +@msg give `event`, such as onclick 請提供 `event`,例如 onclick +@msg give `file`, the JavaScript file's path or URL 請提供 `file`,即 JavaScript 檔案的路徑或 URL +@msg give `fill` and/or `stroke` 請提供 `fill` 和/或 `stroke` +@msg give `fill`, `stroke` or both 請提供 `fill`、`stroke` 或兩者 +@msg give `folder` 請提供 `folder` +@msg give `fonts`, or open a document 請提供 `fonts`,或開啟文件 +@msg give `from` or `indices`, not both 請提供 `from` 或 `indices`,不要兩者都提供 +@msg give `id` (no text is being edited) 請提供 `id` (目前沒有正在編輯的文字) +@msg give `id` and `anchors`, or `items`, not both 請提供 `id` 和 `anchors`,或提供 `items`,不要兩者都提供 +@msg give `id` or `guide`, not both 請提供 `id` 或 `guide`,不要兩者都提供 +@msg give `length` or `to` 請提供 `length` 或 `to` +@msg give `matches`: [{kind, name, target}] 請提供 `matches`: [{kind, name, target}] +@msg give `name` (or edit a pattern) 請提供 `name` (或編輯圖樣) +@msg give `name` or `names` 請提供 `name` 或 `names` +@msg give `path` (a .wasm file) or `dataBase64` (the module) 請提供 `path` (.wasm 檔案) 或 `dataBase64` (模組) +@msg give `path`, `data` or `dataBase64` 請提供 `path`、`data` 或 `dataBase64` +@msg give `path`, `data`, `dataBase64` or `csv` 請提供 `path`、`data`、`dataBase64` 或 `csv` +@msg give `path`, `xml` or `dataBase64` 請提供 `path`、`xml` 或 `dataBase64` +@msg give `script`, the JavaScript the event runs ("" removes the event) 請提供 `script`,即事件執行的 JavaScript ("" 會移除事件) +@msg give `text` (the reading) or `remove` 請提供 `text` (讀音) 或 `remove` +@msg give `x` and `y` (and a `tolerance` of 0 or more) 請提供 `x` 和 `y` (以及大於或等於 0 的 `tolerance`) +@msg give a mode or r/g/b, c/m/y/k, gray or tint adjustments 請提供模式,或 r/g/b、c/m/y/k、gray 或 tint 調整值 +@msg give a name, or paint the active proxy with a saved preset 請提供名稱,或以已儲存的預設集為作用中的代理上色 +@msg give a name, or select a stroke with a saved profile 請提供名稱,或選取使用已儲存描述檔的筆畫 +@msg give a pattern name or select an object painted with a pattern 請提供圖樣名稱,或選取以圖樣上色的物件 +@msg give at least one of clip, invert, disabled, linked clip、invert、disabled、linked 請至少提供一個 +@msg give color, none, swatch or gradient 請提供 color、none、swatch 或 gradient +@msg give dataBase64 請提供 dataBase64 +@msg give either at (a click) or area (a path drawn around the overlaps) 請提供 at (一次點按) 或 area (圍繞重疊處繪製的路徑) 其中之一 +@msg give formats or a preset, not both 請提供 formats 或預設集,不要兩者都提供 +@msg give newName or delete 請提供 newName 或 delete +@msg give offset or by 請提供 offset 或 by +@msg give one of `to`, `rect` or `at` 請提供 `to`、`rect` 或 `at` 其中一個 +@msg give one of assets, layers, selection or fullDocument 請提供 assets、layers、selection 或 fullDocument 其中一個 +@msg give only one of onto, above, below, icon and a column place onto、above、below、icon 和欄位置只能提供其中一個 +@msg give origin: [x, y], or reset: true 請提供 origin: [x, y],或 reset: true +@msg give overprintFill, overprintStroke, showCenter, imageMap, url or note 請提供 overprintFill、overprintStroke、showCenter、imageMap、url 或 note +@msg give path (a file) or folder 請提供 path (檔案) 或 folder +@msg give path, or name and dataBase64 請提供 path,或 name 和 dataBase64 +@msg give paths or files 請提供 paths 或 files +@msg give rows, rowHeight, columns or columnWidth 請提供 rows、rowHeight、columns 或 columnWidth +@msg give svg, or dataBase64 of an SVG or SVGZ file 請提供 svg,或 SVG 或 SVGZ 檔案的 dataBase64 +@msg give text 請提供 text +@msg give the asset a name 請為資產命名 +@msg give the preset a `name` 請為預設集提供 `name` +@msg give the preset a name 請為預設集命名 +@msg give the preset a name (1–64 characters) 請為預設集命名 (1–64 個字元) +@msg give the settings to change, e.g. {"formats"}]} 請提供要變更的設定,例如 {"formats"}]} +@msg give the style a name 請為樣式命名 +@msg give two or more style `names` 請在 `names` 提供兩個以上的樣式名稱 +@msg give two or more swatches 請提供兩個以上的色票 +@msg give x, y, or a handle's length or angle 請提供 x、y,或控制把手的長度或角度 +@msg give {key, value} or {values} 請提供 {key, value} 或 {values} +@msg global must be true or false global 必須是 true 或 false +@msg glyph {_1} is not drawn for {ch} with the character's style (such as All Caps, Small Caps or a numeral system) 以該字元的樣式 (例如全部大寫、小型大寫或數字系統) 繪製 {ch} 時不會使用字符 {_1} +@msg glyph {g} is not an alternate of {ch} in {_1} {_2} 字符 {g} 不是 {_1} {_2} 中 {ch} 的替代字 +@msg gradient must be "objects" or "mesh" gradient 必須是 "objects" 或 "mesh" +@msg grays must be "profile" or "black", not `{g}` grays 必須是 "profile" 或 "black",而非 `{g}` +@msg gridColors must be a preset name or two colours gridColors 必須是預設集名稱或兩種顏色 +@msg gridSize must be small, medium or large gridSize 必須是 small、medium 或 large +@msg guide {g} is not selected 參考線 {g} 未選取 +@msg handle must be 0..3 handle 必須是 0..3 +@msg hiddenObjects {v}: "layer" (the default), "omit" or "visible" hiddenObjects {v}:應為 "layer" (預設值)、"omit" 或 "visible" +@msg highlight a layer to merge into 請反白標示要合併到的圖層 +@msg highlight two or more rows in one layer or group 請在同一個圖層或群組中反白標示兩列以上 +@msg highlight two or more rows to merge 請反白標示兩列以上以進行合併 +@msg icon docks a panel in the icon column: use window.panel.dock icon 會將面板停駐在圖示欄:請使用 window.panel.dock +@msg id must be a dimension id id 必須是尺寸標註 ID +@msg image has no bounds 影像沒有邊界 +@msg image {_1} is linked already 影像 {_1} 已經是連結影像 +@msg imageMap `{m}`: none, client or server imageMap `{m}`:應為 none、client 或 server +@msg index out of range 索引超出範圍 +@msg instances must be 1..1000 instances 必須是 1..1000 +@msg invalid `color` `color` 無效 +@msg invalid anchor index {v}: expected a non-negative integer 錨點索引 {v} 無效:應為非負整數 +@msg invalid anchor reference {v}: expected [subpath, anchor] 錨點參照 {v} 無效:應為 [subpath, anchor] +@msg invalid angle 角度無效 +@msg invalid brush: {e} 筆刷無效:{e} +@msg invalid color 顏色無效 +@msg invalid colour {c} 顏色 {c} 無效 +@msg invalid delta 位移量無效 +@msg invalid point 點無效 +@msg invalid size 大小無效 +@msg invalid t t 無效 +@msg invalid tolerance 容許度無效 +@msg its artboards all lie beyond the canvas (more than {_1} pt from the origin) 其工作區域全都位於畫布之外 (距離原點超過 {_1} pt) +@msg its clipping masks are nested too deeply 其剪裁遮色片的巢狀層次過深 +@msg its metadata has no description 其中繼資料沒有描述 +@msg its metadata has no direct length 其中繼資料沒有直接長度 +@msg join two different paths 請連接兩條不同的路徑 +@msg justify must be auto|left|center|right|justifyAll justify 必須是 auto|left|center|right|justifyAll +@msg kbps must be a positive number, not {kbps} kbps 必須是正數,而非 {kbps} +@msg keywords must be a list of words or a comma-separated string keywords 必須是單字清單或以逗號分隔的字串 +@msg keywords must be at most {MAX_KEYWORD} characters, without control characters keywords 最多 {MAX_KEYWORD} 個字元,且不含控制字元 +@msg kind must be 1, 2 or 3, or give a preset `name` (see perspective.presets.list) kind 必須是 1、2 或 3,或提供預設集的 `name` (請參閱 perspective.presets.list) +@msg kind must be graphic, fillColor, strokeColor, fillGradient, strokeGradient, fillPattern, strokePattern, charStyle or paraStyle kind 必須是 graphic、fillColor、strokeColor、fillGradient、strokeGradient、fillPattern、strokePattern、charStyle 或 paraStyle +@msg knockout must be "on", "off", "neutral" or a bool, not {v} knockout 必須是 "on"、"off"、"neutral" 或布林值,而非 {v} +@msg layer `{name}` has no art to export 圖層 `{name}` 沒有可匯出的圖稿 +@msg layer must name a layer or sublayer layer 必須指定圖層或子圖層 +@msg layers can't be intertwined: select the objects in them 圖層無法交織:請選取其中的物件 +@msg layers go only at the top level or in layers, objects in layers and groups 圖層只能放在最上層或圖層中,物件只能放在圖層和群組中 +@msg layers must be true or false layers 必須是 true 或 false +@msg layout must be gridByRow, gridByColumn, row or column layout 必須是 gridByRow、gridByColumn、row 或 column +@msg leading must be a number or "auto" leading 必須是數字或 "auto" +@msg left/right must be non-negative widths left/right 必須是非負的寬度 +@msg level `{t}`: 2 or 3 level `{t}`:應為 2 或 3 +@msg line {line}: more than {MAX_CSV_COLS} columns 第 {line} 行:超過 {MAX_CSV_COLS} 欄 +@msg line {line}: unclosed quote 第 {line} 行:引號未結束 +@msg line {line}: value for `{var}` must match its variable kind 第 {line} 行:`{var}` 的值必須符合其變數種類 +@msg lineEndings `{other}`: lf or crlf lineEndings `{other}`:應為 lf 或 crlf +@msg loading profiles from disk isn't available in the browser 瀏覽器中無法從磁碟載入描述檔 +@msg margin: a {m} pt margin leaves no imageable area on the paper margin:{m} pt 的邊界使紙張上沒有可列印區域 +@msg matrix must be finite and invertible, depth finite matrix 必須是有限且可逆的矩陣,depth 必須是有限值 +@msg matte: {e} matte:{e} +@msg member is for order front, forward, backward or back member 用於 order 為 front、forward、backward 或 back 的情況 +@msg missing `artboards` 未提供 `artboards` +@msg missing `at` [x, y] 未提供 `at` [x, y] +@msg missing `attrs` 未提供 `attrs` +@msg missing `color` or `opacity` 未提供 `color` 或 `opacity` +@msg missing `colors` 未提供 `colors` +@msg missing `commands` 未提供 `commands` +@msg missing `destinationFolder` 未提供 `destinationFolder` +@msg missing `effect` id 未提供 `effect` ID +@msg missing `family` 未提供 `family` +@msg missing `find` 未提供 `find` +@msg missing `gid` (a glyph id, or null for the default glyph) 未提供 `gid` (字符 ID,或以 null 表示預設字符) +@msg missing `group` 未提供 `group` +@msg missing `id` 未提供 `id` +@msg missing `id`: give one, or select one type object 未提供 `id`:請提供 ID,或選取一個文字物件 +@msg missing `index` (a point index, or null to clear) 未提供 `index` (點的索引,或以 null 清除) +@msg missing `index` (a stop index, or null to clear) 未提供 `index` (色標索引,或以 null 清除) +@msg missing `index` (an item index or null) 未提供 `index` (項目索引或 null) +@msg missing `item` 未提供 `item` +@msg missing `library` 未提供 `library` +@msg missing `library` (see graphicStyle.libraries) 未提供 `library` (請參閱 graphicStyle.libraries) +@msg missing `library` (see swatch.library.list) 未提供 `library` (請參閱 swatch.library.list) +@msg missing `map` (rows [{from, to}] or {current}) 未提供 `map` (列 [{from, to}] 或 {current}) +@msg missing `matrix` [a,b,c,d,e,f] 未提供 `matrix` [a,b,c,d,e,f] +@msg missing `name` (see gradient.presets.list) 未提供 `name` (請參閱 gradient.presets.list) +@msg missing `offset` (a distance in points) 未提供 `offset` (以點為單位的距離) +@msg missing `path` 未提供 `path` +@msg missing `path` (a path object id) 未提供 `path` (路徑物件 ID) +@msg missing `rule` 未提供 `rule` +@msg missing `source` id 未提供 `source` ID +@msg missing `start` (the byte offset of a character) 未提供 `start` (字元的位元組偏移) +@msg missing `status`: linked, embedded, missing or modified 未提供 `status`:應為 linked、embedded、missing 或 modified +@msg missing `target` id 未提供 `target` ID +@msg missing `text` 未提供 `text` +@msg missing `to` 未提供 `to` +@msg missing `to` (an index) 未提供 `to` (索引) +@msg missing `to`: a non-negative integer 未提供 `to`:應為非負整數 +@msg missing `type` 未提供 `type` +@msg missing `value` 未提供 `value` +@msg missing `{key}` 未提供 `{key}` +@msg missing `{k}` 未提供 `{k}` +@msg missing anchor 未提供錨點 +@msg missing anchors 未提供 anchors +@msg missing anchors [[subpath, anchor]…] 未提供 anchors [[subpath, anchor]…] +@msg missing array `{key}` 未提供陣列 `{key}` +@msg missing case 未提供 case +@msg missing color 未提供顏色 +@msg missing commands 未提供 commands +@msg missing destination folder 未提供目的地資料夾 +@msg missing from 未提供 from +@msg missing group 未提供 group +@msg missing id or ids 未提供 id 或 ids +@msg missing ids 未提供 ids +@msg missing indexes 未提供 indexes +@msg missing matrix [a,b,c,d,e,f] 未提供 matrix [a,b,c,d,e,f] +@msg missing name 未提供名稱 +@msg missing op 未提供 op +@msg missing or invalid `color` `color` 未提供或無效 +@msg missing or unknown `tool` `tool` 未提供或未知 +@msg missing point 未提供點 +@msg missing point [x,y] 未提供點 [x,y] +@msg missing point `{key}` ([x, y]) 未提供點 `{key}` ([x, y]) +@msg missing points 未提供 points +@msg missing points [[x,y]…] 未提供 points [[x,y]…] +@msg missing segment 未提供線段 +@msg missing stops 未提供色標 +@msg missing subpaths 未提供 subpaths +@msg missing target 未提供 target +@msg missing to 未提供 to +@msg missing x, y 未提供 x、y +@msg mode is set, add or toggle, not `{other}` mode 是 set、add 或 toggle,而非 `{other}` +@msg mode must be "cmyk" or "rgb" mode 必須是 "cmyk" 或 "rgb" +@msg mode must be area|onPath, got {o} mode 必須是 area|onPath,收到 {o} +@msg more than 10000 linked files: package dependencies in smaller parts 連結的檔案超過 10000 個:請分成較小的部分封裝相依檔案 +@msg more than 256 commands 超過 256 個指令 +@msg more than {MAX_BATCH_FILES} data sets 超過 {MAX_BATCH_FILES} 個資料集 +@msg more than {MAX_BATCH_FILES} files 超過 {MAX_BATCH_FILES} 個檔案 +@msg more than {MAX_CSV_ROWS} data rows 超過 {MAX_CSV_ROWS} 個資料列 +@msg more than {MAX_FILES} images 超過 {MAX_FILES} 個影像 +@msg more than {MAX_IMPORT} presets 超過 {MAX_IMPORT} 個預設集 +@msg moved must be [[x,y]…] moved 必須是 [[x,y]…] +@msg name (a toolbar's name) is required 必須提供 name (工具列的名稱) +@msg name (a toolbar's name) must be a string name (工具列的名稱) 必須是字串 +@msg name must be a toolbar's name name 必須是工具列的名稱 +@msg names is empty names 為空 +@msg names must be an array of symbol names names 必須是符號名稱的陣列 +@msg need `anchor` or `segment` + `t` 需要 `anchor`,或 `segment` + `t` +@msg need at least one anchor 至少需要一個錨點 +@msg need at least one point 至少需要一個點 +@msg need at least two points 至少需要兩個點 +@msg needs points 需要 points +@msg nineSlice must be true or false nineSlice 必須是 true 或 false +@msg nineSliceGuides must be [left, top, right, bottom], each -16..16, with left + right < 1 and top + bottom < 1 nineSliceGuides 必須是 [left, top, right, bottom],各為 -16..16,且 left + right < 1、top + bottom < 1 +@msg no PDF preset named `{n}` 沒有名為 `{n}` 的 PDF 預設集 +@msg no action set is current 目前沒有使用中的動作組 +@msg no active data set 沒有使用中的資料集 +@msg no appearance item {index} 沒有外觀項目 {index} +@msg no artboard {_1} 沒有工作區域 {_1} +@msg no artboard {artboard} (0-based; the document has {_1}) 沒有工作區域 {artboard} (從 0 起算;文件有 {_1} 個) +@msg no asset {id} 沒有資產 {id} +@msg no asset {id} (see assets.list) 沒有資產 {id} (請參閱 assets.list) +@msg no assets to export 沒有可匯出的資產 +@msg no assets yet: collect art for export first (assets.add) 尚無資產:請先收集要匯出的圖稿 (assets.add) +@msg no brush named `{n}` 沒有名為 `{n}` 的筆刷 +@msg no character at byte {start} 位元組 {start} 處沒有字元 +@msg no colour 沒有顏色 +@msg no colour group `{group}` 沒有顏色群組 `{group}` +@msg no colour group `{name}` 沒有顏色群組 `{name}` +@msg no data sets 沒有資料集 +@msg no dataset named `{from}` 沒有名為 `{from}` 的資料集 +@msg no dataset named `{name}` 沒有名為 `{name}` 的資料集 +@msg no datasets 沒有資料集 +@msg no design named `{name}` 沒有名為 `{name}` 的設計 +@msg no design named `{n}` 沒有名為 `{n}` 的設計 +@msg no design named `{old}` 沒有名為 `{old}` 的設計 +@msg no encoder for {_1} yet 尚無 {_1} 的編碼器 +@msg no export preset `{name}` (see document.exportPresets.list) 沒有匯出預設集 `{name}` (請參閱 document.exportPresets.list) +@msg no folder: pass `path` or set Preferences › Plug-ins & Scratch Disks › Additional Plug-ins Folder 沒有資料夾:請傳入 `path`,或設定「偏好設定 › 增效模組 & 暫存磁碟 › 額外的增效模組資料夾」 +@msg no fonts to look for: they are all available 沒有需要尋找的字體:所有字體都可使用 +@msg no formats to export 沒有可匯出的格式 +@msg no gradient preset `{name}` (see gradient.presets.list) 沒有漸層預設集 `{name}` (請參閱 gradient.presets.list) +@msg no graphic style `{n}` in `{_1}` `{_1}` 中沒有繪圖樣式 `{n}` +@msg no graphic style library `{key}` (see graphicStyle.libraries) 沒有繪圖樣式資料庫 `{key}` (請參閱 graphicStyle.libraries) +@msg no guide selected 未選取參考線 +@msg no guide selected (or give an index) 未選取參考線 (或請提供索引) +@msg no guide {i} 沒有參考線 {i} +@msg no images in the folder 資料夾中沒有影像 +@msg no item at index {_1} 索引 {_1} 處沒有項目 +@msg no item at index {from} 索引 {from} 處沒有項目 +@msg no item at one of the indices {idx} 索引 {idx} 中有一個沒有對應的項目 +@msg no layer 沒有圖層 +@msg no layer {id} (see layer.list) 沒有圖層 {id} (請參閱 layer.list) +@msg no layers to export 沒有可匯出的圖層 +@msg no library `{key}` 沒有資料庫 `{key}` +@msg no metafile format 沒有中繼檔格式 +@msg no object {_1} 沒有物件 {_1} +@msg no objects 沒有物件 +@msg no parent layer 沒有父圖層 +@msg no perspective grid preset named `{b}` (see perspective.presets.list) 沒有名為 `{b}` 的透視格點預設集 (請參閱 perspective.presets.list) +@msg no perspective grid preset named `{n}` 沒有名為 `{n}` 的透視格點預設集 +@msg no point selected (give `index`) 未選取任何點 (請提供 `index`) +@msg no preset called `{from}` (see file.newPresets) 沒有名為 `{from}` 的預設集 (請參閱 file.newPresets) +@msg no preset called `{name}` (see file.newPresets) 沒有名為 `{name}` 的預設集 (請參閱 file.newPresets) +@msg no preset named `{n}` 沒有名為 `{n}` 的預設集 +@msg no print preset named `{b}` (see print.presets.list) 沒有名為 `{b}` 的列印預設集 (請參閱 print.presets.list) +@msg no print preset named `{name}` (presets: {_1}) 沒有名為 `{name}` 的列印預設集 (預設集:{_1}) +@msg no print preset named `{n}` 沒有名為 `{n}` 的列印預設集 +@msg no profile named `{name}` 沒有名為 `{name}` 的描述檔 +@msg no readable files in the folder 資料夾中沒有可讀取的檔案 +@msg no recovery copy `{f}` (see file.recovery.list) 沒有復原副本 `{f}` (請參閱 file.recovery.list) +@msg no rows 沒有列 +@msg no saved PDF preset named `{name}` 沒有名為 `{name}` 的已儲存 PDF 預設集 +@msg no saved export preset `{name}` 沒有已儲存的匯出預設集 `{name}` +@msg no saved gradient preset called {name} 沒有名為 {name} 的已儲存漸層預設集 +@msg no saved gradient presets 沒有已儲存的漸層預設集 +@msg no saved preset called `{name}` 沒有名為 `{name}` 的已儲存預設集 +@msg no saved presets to export (name [Default] in `names` to export it) 沒有可匯出的已儲存預設集 (若要匯出 [Default],請在 `names` 中指定它) +@msg no saved presets to export (name built-in ones in `names`) 沒有可匯出的已儲存預設集 (內建預設集請在 `names` 中指定) +@msg no saved print preset named `{name}` 沒有名為 `{name}` 的已儲存列印預設集 +@msg no saved profile called {name} 沒有名為 {name} 的已儲存描述檔 +@msg no saved selection `{name}` 沒有已儲存的選取範圍 `{name}` +@msg no saved theme called {name} (see colorTheme.list) 沒有名為 {name} 的已儲存主題 (請參閱 colorTheme.list) +@msg no saved views 沒有已儲存的檢視 +@msg no series {i} 沒有數列 {i} +@msg no slice {n} in the image (see slice.list) 影像中沒有切片 {n} (請參閱 slice.list) +@msg no source art 沒有來源圖稿 +@msg no stop {i} (the gradient has {n}) 沒有色標 {i} (漸層有 {n} 個) +@msg no style `{name}` 沒有樣式 `{name}` +@msg no such assets (see assets.list) 沒有這些資產 (請參閱 assets.list) +@msg no such frame anchor, or the frame would reach past the canvas 沒有這個文字框錨點,或文字框會超出畫布 +@msg no such objects 沒有這些物件 +@msg no such path anchor, or the path would reach past the canvas 沒有這個路徑錨點,或路徑會超出畫布 +@msg no such rows 沒有這些列 +@msg no swatch `{keep}` 沒有色票 `{keep}` +@msg no swatch `{n}` 沒有色票 `{n}` +@msg no swatch `{n}` (swatches and colour groups move separately) 沒有色票 `{n}` (色票和顏色群組要分開移動) +@msg no swatch library `{key}` (see swatch.library.list) 沒有色票資料庫 `{key}` (請參閱 swatch.library.list) +@msg no swatch library `{key}` (see swatch.library.list; "document": the document's swatches) 沒有色票資料庫 `{key}` (請參閱 swatch.library.list;"document":文件的色票) +@msg no swatch library `{key}` (see swatch.library.list; "{DOCUMENT_SWATCHES}": the document's swatches) 沒有色票資料庫 `{key}` (請參閱 swatch.library.list;"{DOCUMENT_SWATCHES}":文件的色票) +@msg no swatch named `{n}` 沒有名為 `{n}` 的色票 +@msg no swatch or colour group `{n}` 沒有色票或顏色群組 `{n}` +@msg no swatch or colour group `{n}` in `{_1}` `{_1}` 中沒有色票或顏色群組 `{n}` +@msg no symbol named `{name}` 沒有名為 `{name}` 的符號 +@msg no text objects selected 未選取文字物件 +@msg no toolbar named `{_1}` 沒有名為 `{_1}` 的工具列 +@msg no toolbar named `{name}` 沒有名為 `{name}` 的工具列 +@msg no tracing preset `{preset}` (see imageTrace.presets) 沒有描圖預設集 `{preset}` (請參閱 imageTrace.presets) +@msg no user library folder here (save with a path, or without one to get the data) 這裡沒有使用者資料庫資料夾 (請以路徑儲存,或不提供路徑以取得資料) +@msg no variable named `{from}` 沒有名為 `{from}` 的變數 +@msg no variable named `{name}` 沒有名為 `{name}` 的變數 +@msg no variable named `{var}` 沒有名為 `{var}` 的變數 +@msg no variable named `{v}` 沒有名為 `{v}` 的變數 +@msg no view named `{name}` 沒有名為 `{name}` 的檢視 +@msg node {_1} is not a graph 節點 {_1} 不是圖表 +@msg node {_1} is not an image 節點 {_1} 不是影像 +@msg node {_1} is not type 節點 {_1} 不是文字 +@msg not a PDF presets file (format `{_1}`) 不是 PDF 預設集檔案 (格式為 `{_1}`) +@msg not a PDF presets file: {e} 不是 PDF 預設集檔案:{e} +@msg not a Word document: its WordDocument stream doesn't start with a file information block 不是 Word 文件:其 WordDocument 資料流的開頭不是檔案資訊區塊 +@msg not a Word document: its compound file has no WordDocument stream 不是 Word 文件:其複合檔案沒有 WordDocument 資料流 +@msg not a Word document: its main part is not a WordprocessingML document 不是 Word 文件:其主要部分不是 WordprocessingML 文件 +@msg not a Word document: its package has no main document part 不是 Word 文件:其封裝沒有主要文件部分 +@msg not a closed path 不是封閉路徑 +@msg not a flattener presets file (format `{_1}`) 不是平面化預設集檔案 (格式為 `{_1}`) +@msg not a flattener presets file: {e} 不是平面化預設集檔案:{e} +@msg not a layer or group 不是圖層或群組 +@msg not a library file: {e} 不是資料庫檔案:{e} +@msg not a mesh envelope point 不是網格封套的點 +@msg not a perspective grid presets file (format `{_1}`) 不是透視格點預設集檔案 (格式為 `{_1}`) +@msg not a perspective grid presets file: {e} 不是透視格點預設集檔案:{e} +@msg not a print presets file (format `{_1}`) 不是列印預設集檔案 (格式為 `{_1}`) +@msg not a print presets file: {e} 不是列印預設集檔案:{e} +@msg not a stored or deflated central record 不是以儲存或 deflate 方式寫入的中央目錄記錄 +@msg not a valid SVGZ file: {e} 不是有效的 SVGZ 檔案:{e} +@msg not an RTF file: it doesn't start with {\rtf 不是 RTF 檔案:開頭不是 {\rtf +@msg not an image VectorCraft reads (see document.formats) 不是 VectorCraft 可讀取的影像 (請參閱 document.formats) +@msg not area type (text in a frame) outside perspective 不是透視以外的區域文字 (文字框中的文字) +@msg not editing an opacity mask 目前不在編輯不透明度遮色片 +@msg not type on a path outside perspective 不是透視以外的路徑文字 +@msg nothing prints 沒有可列印的內容 +@msg nothing to bind 沒有可綁定的內容 +@msg nothing to change 沒有要變更的內容 +@msg nothing to change: give dx, dy, hScale, vScale or rotation 沒有要變更的內容:請提供 dx、dy、hScale、vScale 或 rotation +@msg nothing to crop 沒有可裁切的內容 +@msg nothing to export 沒有可匯出的內容 +@msg nothing to export: the document has no visible art 沒有可匯出的內容:文件中沒有可見的圖稿 +@msg nothing to mark 沒有可標記的內容 +@msg nothing to print: every artboard picked is blank 沒有可列印的內容:選擇的工作區域全都是空白 +@msg nothing to print: the document has no art that prints 沒有可列印的內容:文件中沒有會列印的圖稿 +@msg object is not a path 物件不是路徑 +@msg object transparency cannot be sampled onto highlighted characters; disable Transparency in Eyedropper Options or select the whole object 物件透明度無法取樣到反白標示的字元上;請在「滴管選項」中停用「透明度」,或選取整個物件 +@msg object {_1} can't be set as point type 物件 {_1} 無法設為點狀文字 +@msg object {_1} has lost its file's contents: relink it 物件 {_1} 已遺失其檔案的內容:請重新連結 +@msg object {_1} has no path 物件 {_1} 沒有路徑 +@msg object {_1} has no size 物件 {_1} 沒有大小 +@msg object {_1} is hidden or locked, or on a locked artboard 物件 {_1} 已隱藏或鎖定,或位於鎖定的工作區域上 +@msg object {_1} is not a placed document 物件 {_1} 不是置入的文件 +@msg object {_1} is not an Intertwine group 物件 {_1} 不是交織群組 +@msg object {_1} is not an image 物件 {_1} 不是影像 +@msg object {_1} is not an image or a linked file 物件 {_1} 不是影像或連結的檔案 +@msg object {_1} is not an image or a placed document 物件 {_1} 不是影像或置入的文件 +@msg object {_1} is not in this Intertwine group 物件 {_1} 不在此交織群組中 +@msg object {_1} needs a 3D effect at index {index} 物件 {_1} 在索引 {index} 處需要 3D 效果 +@msg object {id} has anchors 0–{_1} for `corners`, not {past} 物件 {id} 可用於 `corners` 的錨點為 0–{_1},沒有 {past} +@msg object {id} has {n} anchors, so no anchor {past} 物件 {id} 有 {n} 個錨點,因此沒有錨點 {past} +@msg objects must be none, move or copy objects 必須是 none、move 或 copy +@msg objects were left out 有物件已略過 +@msg offset out of range 偏移超出範圍 +@msg on must be true or false on 必須是 true 或 false +@msg only groups, layers, type and images have a Contents (Characters) row 只有群組、圖層、文字和影像有「內容 (字元)」列 +@msg only interior mesh lines can be deleted 只能刪除內部的網格線 +@msg only solid colours can be added (not gradients or patterns) 只能加入純色 (不能加入漸層或圖樣) +@msg only solid-colour swatches can be spot colours 只有純色色票可以是特別色 +@msg only this Affinity file's embedded preview could be read: use File › Open to see it with its warning, or export SVG or PDF from Affinity first 只能讀取此 Affinity 檔案的內嵌預視:請使用「檔案 › 開啟」查看它及其警告,或先從 Affinity 匯出 SVG 或 PDF +@msg only this Affinity file's embedded preview could be read; use File › Open to see it with its warning 只能讀取此 Affinity 檔案的內嵌預視;請使用「檔案 › 開啟」查看它及其警告 +@msg onto, above, below, icon and a column place belong to window.panel.float and window.panel.dock onto、above、below、icon 和欄位置屬於 window.panel.float 和 window.panel.dock +@msg onto, above, below, icon and a column place take no anchor, side, zone or before onto、above、below、icon 和欄位置不接受 anchor、side、zone 或 before +@msg onto, above, below, icon and a column place take no x, y, width or height onto、above、below、icon 和欄位置不接受 x、y、width 或 height +@msg open a document to look for its linked files 請開啟文件以尋找其連結的檔案 +@msg options must be an object (see file.formatOptions) options 必須是物件 (請參閱 file.formatOptions) +@msg order must be leftToRight or rightToLeft order 必須是 leftToRight 或 rightToLeft +@msg orientation must be portrait or landscape, not `{o}` orientation 必須是 portrait 或 landscape,而非 `{o}` +@msg outlineText {v}: true or false outlineText {v}:應為 true 或 false +@msg output intent profile: {e} 輸出目的描述檔:{e} +@msg output.destination: no RGB or CMYK profile is called “{name}” output.destination:沒有名為「{name}」的 RGB 或 CMYK 描述檔 +@msg output.destination: {_1} files are CMYK, and “{name}” is an RGB profile output.destination:{_1} 檔案為 CMYK,而「{name}」是 RGB 描述檔 +@msg output.destination: {e} output.destination:{e} +@msg output.inks: no ink is set to print output.inks:沒有任何油墨設定為列印 +@msg output.outputIntent: no profile is called “{name}”, and a {std} output intent embeds its profile output.outputIntent:沒有名為「{name}」的描述檔,而 {std} 輸出目的會內嵌其描述檔 +@msg output.outputIntent: no profile is called “{name}”: a {std} output intent embeds a profile, or names a registered printing condition (outputConditionId and registry) output.outputIntent:沒有名為「{name}」的描述檔:{std} 輸出目的會內嵌描述檔,或指定已註冊的印刷條件 (outputConditionId 和 registry) +@msg output.outputIntent: {std} files print in CMYK, and “{name}” is an RGB profile output.outputIntent:{std} 檔案以 CMYK 列印,而「{name}」是 RGB 描述檔 +@msg output.outputIntent: “{name}” is a grey profile, which can't be a {std} output intent output.outputIntent:「{name}」是灰階描述檔,不能作為 {std} 輸出目的 +@msg overlap: {o} pt is half a tile or more overlap:{o} pt 已達拼貼的一半以上 +@msg overlapping Shaper paths must be in the same layer or group 重疊的 Shaper 路徑必須位於同一個圖層或群組 +@msg overlapping edits 編輯範圍重疊 +@msg page art conflicts with image data for {key} 頁面圖稿與 {key} 的影像資料衝突 +@msg page art conflicts with pattern {name} 頁面圖稿與圖樣 {name} 衝突 +@msg page art conflicts with swatch {name} 頁面圖稿與色票 {name} 衝突 +@msg page art is missing image data for {key} 頁面圖稿沒有 {key} 的影像資料 +@msg page art is missing pattern {name} 頁面圖稿沒有圖樣 {name} +@msg page art is missing swatch {name} 頁面圖稿沒有色票 {name} +@msg page must be a whole number from 1 page 必須是從 1 起算的整數 +@msg page thumbnail: {e} 頁面縮圖:{e} +@msg page {page} of the PDF has no objects PDF 的第 {page} 頁沒有物件 +@msg page {page}: `{file}` has {n} {artboards} 第 {page} 頁:`{file}` 有 {n} {artboards} +@msg page {page}: `{name}` has {n} {pages} 第 {page} 頁:`{name}` 有 {n} {pages} +@msg pages must be a range such as "2-3" or a page number, not {v} pages 必須是 "2-3" 這類範圍或頁碼,而非 {v} +@msg pages: {e} pages:{e} +@msg panel position must be finite 面板位置必須是有限值 +@msg parameters must be an object 參數必須是物件 +@msg params must be an object params 必須是物件 +@msg passwords can have up to {MAX_PASSWORD} bytes 密碼最多 {MAX_PASSWORD} 位元組 +@msg path has no open end 路徑沒有開放的端點 +@msg paths must be strings paths 必須是字串 +@msg pdfCompatible: false needs every artboard to keep the editable artwork pdfCompatible: false 需要所有工作區域才能保留可編輯的圖稿 +@msg pdfs `{m}`: single or multiple pdfs `{m}`:應為 single 或 multiple +@msg pickColorFrom is "artwork" or "swatches", not {v} pickColorFrom 是 "artwork" 或 "swatches",而非 {v} +@msg pins and moved must be non-empty lists of the same length pins 和 moved 必須是長度相同的非空清單 +@msg pins must be [[x,y]…] pins 必須是 [[x,y]…] +@msg pins must be finite pins 必須是有限值 +@msg place is above, below or inside, not `{other}` place 是 above、below 或 inside,而非 `{other}` +@msg plane must be left|right|ground plane 必須是 left|right|ground +@msg plane must be left|right|ground|none plane 必須是 left|right|ground|none +@msg point is outside the mesh 點位於網格之外 +@msg points must be [t, left, right] with non-negative widths points 必須是寬度為非負值的 [t, left, right] +@msg points must be a non-empty [[x,y,pressure?]…] list points 必須是非空的 [[x,y,pressure?]…] 清單 +@msg points must be a non-empty list of finite [x,y] points 必須是由有限 [x,y] 組成的非空清單 +@msg points must be an array or null points 必須是陣列或 null +@msg points must be finite points 必須是有限值 +@msg points must be finite [x,y] pairs points 必須是有限的 [x,y] 配對 +@msg points must contain 1–4096 coordinates points 必須包含 1–4096 個座標 +@msg position must be normal, superscript or subscript position 必須是 normal、superscript 或 subscript +@msg position must be topLeft, topRight, bottomLeft or bottomRight position 必須是 topLeft、topRight、bottomLeft 或 bottomRight +@msg positions must be between 0 and 100000 pt positions 必須介於 0 到 100000 pt 之間 +@msg ppi must be a positive number, not {ppi} ppi 必須是正數,而非 {ppi} +@msg ppi must be between 1 and 2400 ppi 必須介於 1 和 2400 之間 +@msg preserve `{v}` is not transforms|bounds|fileDimensions|fit|fill preserve `{v}` 不是 transforms|bounds|fileDimensions|fit|fill +@msg preserveShape must be clippingMask|transparency preserveShape 必須是 clippingMask|transparency +@msg preset `{id}`: mobile or density preset `{id}`:應為 mobile 或 density +@msg preset must be standard, diffuse, topLeft or right preset 必須是 standard、diffuse、topLeft 或 right +@msg preset must be the name of a print preset preset 必須是列印預設集的名稱 +@msg previewMode must be default, pixel or overprint previewMode 必須是 default、pixel 或 overprint +@msg print settings: {e} 列印設定:{e} +@msg procedures nest too deeply 程序的巢狀層次過深 +@msg procedures nested too deeply 程序的巢狀層次過深 +@msg quotes must be {double?, single?} quotes 必須是 {double?, single?} +@msg quotes.{k} must be an opening and a closing quote, e.g. "“”" quotes.{k} 必須是一個前引號和一個後引號,例如 "“”" +@msg rasterEffectsPpi must be 1–2400 (72 screen, 150 medium, 300 high) rasterEffectsPpi 必須是 1–2400 (72 螢幕、150 中、300 高) +@msg rating must be a whole number from 0 to {MAX_RATING} rating 必須是 0 到 {MAX_RATING} 之間的整數 +@msg rect and {k} contradict each other: give the area or the artboards rect 和 {k} 互相矛盾:請提供區域或工作區域 +@msg rect applies to raster formats, not {_1} rect 適用於點陣格式,不適用於 {_1} +@msg rect is [x, y, width, height] in points rect 是以點為單位的 [x, y, width, height] +@msg rect must be [x, y, width, height] rect 必須是 [x, y, width, height] +@msg rect must be [x, y, width, height] with a positive width and height rect 必須是寬度和高度為正值的 [x, y, width, height] +@msg rect needs finite numbers and a positive width and height rect 需要有限的數字,以及正值的寬度和高度 +@msg redraw needs id redraw 需要 id +@msg redraw within must be a finite distance of 0 or more redraw 的 within 必須是大於或等於 0 的有限距離 +@msg registration must be 0..8 registration 必須是 0..8 +@msg release a layer or a group 請釋放圖層或群組 +@msg replace keeps the replaced object's place and transform: drop template, at and rect replace 會保留被取代物件的位置和變形:請不要提供 template、at 和 rect +@msg replace: select the one object to replace replace:請選取要取代的那一個物件 +@msg resolution must be a number or screen|medium|high resolution 必須是數字或 screen|medium|high +@msg resolution must be between 1 and 2400 ppi resolution 必須介於 1 到 2400 ppi 之間 +@msg rotation must be a number of degrees rotation 必須是以度為單位的數字 +@msg rotation must be finite rotation 必須是有限值 +@msg rows and cols must be 1..50 rows 和 cols 必須是 1..50 +@msg rows and columns must be 1..500 rows 和 columns 必須是 1..500 +@msg rows of objects whose appearances differ can't be reordered together 外觀不同的物件,其列無法一起重新排序 +@msg save the document first: Package collects a saved document 請先儲存文件:「封裝」會收集已儲存的文件 +@msg save the document first: copy puts the file in its folder 請先儲存文件:copy 會將檔案放入文件的資料夾 +@msg savedPreset: {e} savedPreset:{e} +@msg scale `{s}`: a factor such as 2x, a width (100w), a height (100h) or a resolution (72ppi) scale `{s}`:應為 2x 這類倍數、寬度 (100w)、高度 (100h) 或解析度 (72ppi) +@msg scale must be a number above 0, at most 64 scale 必須是大於 0 且不超過 64 的數字 +@msg scale must be non-zero scale 不能為零 +@msg scope must be selection or all (got {other}) scope 必須是 selection 或 all (收到 {other}) +@msg scribble is too long 塗抹筆跡過長 +@msg segment does not exist 線段不存在 +@msg select a Shaper group 請選取 Shaper 群組 +@msg select a blend to set easing or color shift 請選取漸變物件以設定緩動或顏色偏移 +@msg select a compound shape 請選取複合形狀 +@msg select a graph 請選取圖表 +@msg select a group or layer with visible, unlocked members 請選取含有可見且未鎖定成員的群組或圖層 +@msg select a layer 請選取圖層 +@msg select a text object 請選取文字物件 +@msg select an image (or an Image Trace group) 請選取影像 (或影像描圖群組) +@msg select an image, or pass id 請選取影像,或傳入 id +@msg select an object (or pass `id`) 請選取物件 (或傳入 `id`) +@msg select an object with a freeform gradient 請選取具有任意形狀漸層的物件 +@msg select an object with an opacity mask 請選取具有不透明度遮色片的物件 +@msg select area type 請選取區域文字 +@msg select area type (text in a frame) 請選取區域文字 (文字框中的文字) +@msg select area type and closed paths (at least one area type object) 請選取區域文字和封閉路徑 (至少一個區域文字物件) +@msg select area type whose first line can fit its frame 請選取第一行可容納於文字框的區域文字 +@msg select artwork to add its colours 請選取圖稿以加入其顏色 +@msg select artwork to make a group of its colours 請選取圖稿以將其顏色建立為群組 +@msg select artwork to recolour, or give a colour `group` 請選取要重新上色的圖稿,或提供顏色 `group` +@msg select exactly two path ends to join 請剛好選取兩個要連接的路徑端點 +@msg select members of a compound shape 請選取複合形狀的成員 +@msg select objects or give ids 請選取物件或提供 ids +@msg select objects to align to the guide 請選取要對齊參考線的物件 +@msg select one Intertwine group 請選取一個交織群組 +@msg select one image or pass id 請選取一個影像或傳入 id +@msg select paths 請選取路徑 +@msg select paths or compound paths 請選取路徑或複合路徑 +@msg select rows or objects to collect 請選取要收集的列或物件 +@msg select something to export 請選取要匯出的內容 +@msg select something to export (or turn off selectedOnly) 請選取要匯出的內容 (或關閉 selectedOnly) +@msg select text to redefine the style from 請選取用來重新定義樣式的文字 +@msg select the art and, on top of it, the mask object 請選取圖稿,以及位於其上方的遮色片物件 +@msg select the art for the design 請選取設計要使用的圖稿 +@msg select the art for the pattern tile 請選取圖樣拼貼要使用的圖稿 +@msg select the art to add first 請先選取要加入的圖稿 +@msg select the art to collect (or give its ids) 請選取要收集的圖稿 (或提供其 ids) +@msg select the content and a path on top 請選取內容以及位於上方的路徑 +@msg select the images to relink, or pass ids 請選取要重新連結的影像,或傳入 ids +@msg select the images, or pass ids 請選取影像,或傳入 ids +@msg select the linked images or placed documents, or pass ids 請選取連結的影像或置入的文件,或傳入 ids +@msg select the object to copy from 請選取要從中複製的物件 +@msg select the objects (or give their ids) 請選取物件 (或提供其 ids) +@msg select the objects to attach to the path 請選取要附加到路徑的物件 +@msg select the objects to bind 請選取要綁定的物件 +@msg select two or more objects to intertwine 請選取兩個以上要交織的物件 +@msg select two or more slices to combine 請選取兩個以上要合併的切片 +@msg select type on a path 請選取路徑文字 +@msg selection `{m}`: one or each selection `{m}`:應為 one 或 each +@msg settings is an object of document.exportForScreens params settings 是 document.exportForScreens 參數的物件 +@msg settings must be an object settings 必須是物件 +@msg show `{show}`: all, missing, modified or embedded show `{show}`:應為 all、missing、modified 或 embedded +@msg show must be true or false show 必須是 true 或 false +@msg size must be "small", "medium", "large" or a number of points over 0 up to {_1} size 必須是 "small"、"medium"、"large",或大於 0 且不超過 {_1} 的點數 +@msg size must be positive size 必須是正值 +@msg sizeMode is "fixed" or "pressure", not `{other}` sizeMode 是 "fixed" 或 "pressure",而非 `{other}` +@msg sizeMode is "fixed" or "pressure", not {other} sizeMode 是 "fixed" 或 "pressure",而非 {other} +@msg sizeVariation must be 0 or more sizeVariation 必須大於或等於 0 +@msg smallCaps must be true or false smallCaps 必須是 true 或 false +@msg sort `{x}`: name, kind or status sort `{x}`:應為 name、kind 或 status +@msg source paths are too large for Shaper 來源路徑對 Shaper 而言過大 +@msg spot, mode and group apply to solid colours only spot、mode 和 group 只適用於純色 +@msg status `{s}`: linked, embedded, missing or modified status `{s}`:應為 linked、embedded、missing 或 modified +@msg steps must be 1..1000 steps 必須是 1..1000 +@msg steps must be 1..{MAX_STEPS} steps 必須是 1..{MAX_STEPS} +@msg stop {i}: `plates` must be four numbers from 0 to 1 (C, M, Y, K) 色標 {i}:`plates` 必須是四個 0 到 1 之間的數字 (C、M、Y、K) +@msg stopped before the archive was finished 在封存檔完成之前已停止 +@msg strokeMode must be within|along|across, got {m} strokeMode 必須是 within|along|across,收到 {m} +@msg strokeOptions must be an object of stroke.set options strokeOptions 必須是 stroke.set 選項的物件 +@msg strokeWidth must be a positive number of pixels strokeWidth 必須是正的像素數 +@msg subpath {si} is not an open subpath 子路徑 {si} 不是開放的子路徑 +@msg subpaths required when joining the same path 連接同一條路徑時必須提供 subpaths +@msg swatchConflict must be "merge" or "add", not {v} swatchConflict 必須是 "merge" 或 "add",而非 {v} +@msg text must be {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} text 必須是 {characterSet?, platform?, removeLineReturns?, removeParagraphReturns?, replaceSpaces?} +@msg text transform is collapsed or unrepresentable 文字變形已塌陷或無法表示 +@msg text.replaceSpaces must be a whole number from 2 to 100 text.replaceSpaces 必須是 2 到 100 之間的整數 +@msg text.{key} `{v}`: use "{_1}" or "{_2}" text.{key} `{v}`:請使用 "{_1}" 或 "{_2}" +@msg textureImage: give {path} or {name, dataBase64} of an image file, or a texture as effect.list gives it textureImage:請提供影像檔案的 {path} 或 {name, dataBase64},或 effect.list 所提供的紋理 +@msg textureImage: {e} textureImage:{e} +@msg that makes more than {MAX_PIECES} slices 這會產生超過 {MAX_PIECES} 個切片 +@msg that object is not in the overlap 該物件不在重疊處 +@msg the Affinity document has no page with a size Affinity 文件中沒有具有大小的頁面 +@msg the CMYK image couldn't be written 無法寫入 CMYK 影像 +@msg the PDF security settings were saved without their passwords: give openPassword or permissionsPassword again, or security without passwordRequired to export unprotected PDF 安全性設定儲存時未包含密碼:請再次提供 openPassword 或 permissionsPassword,或提供不含 passwordRequired 的 security 以匯出不受保護的檔案 +@msg the RTF file has too many paragraphs or formatting changes to place as type (at most {MAX_PARAGRAPHS} paragraphs and {MAX_RUNS} runs) RTF 檔案的段落或格式變更過多,無法置入為文字 (最多 {MAX_PARAGRAPHS} 個段落和 {MAX_RUNS} 個連續格式區段) +@msg the RTF file is too large to place as type (at most {_1} MB) RTF 檔案過大,無法置入為文字 (最多 {_1} MB) +@msg the SVG expands to more than {0} nested SVG images SVG 展開後超過 {0} 個巢狀 SVG 影像 +@msg the SVG expands to more than {0} objects SVG 展開後超過 {0} 個物件 +@msg the SVG has no drawable objects SVG 中沒有可繪製的物件 +@msg the SVGZ file unpacks to more than {_1} MB SVGZ 檔案解壓縮後超過 {_1} MB +@msg the Word document has more than {MAX_PAGES} pages of properties, too many to place Word 文件的屬性超過 {MAX_PAGES} 頁,數量過多而無法置入 +@msg the Word document has more than {MAX_RUNS} runs of character or paragraph properties, too many to place Word 文件的字元或段落屬性超過 {MAX_RUNS} 個連續格式區段,數量過多而無法置入 +@msg the Word document has more than {_1} MB of formatting properties, too many to place Word 文件的格式屬性超過 {_1} MB,數量過多而無法置入 +@msg the Word document has too much text or formatting to place as type (at most {MAX_PARAGRAPHS} paragraphs, {MAX_RUNS} runs and {_1} MB of text) Word 文件的文字或格式過多,無法置入為文字 (最多 {MAX_PARAGRAPHS} 個段落、{MAX_RUNS} 個連續格式區段和 {_1} MB 的文字) +@msg the Word document has too much text to place as type (at most {_1} MB) Word 文件的文字過多,無法置入為文字 (最多 {_1} MB) +@msg the Word document is encrypted or protected with a password; save it without one to place it Word 文件已加密或受密碼保護;請儲存為沒有密碼的檔案再置入 +@msg the Word document is too large to place (its {name} stream holds more than {_1} MB) Word 文件過大,無法置入 (其 {name} 資料流超過 {_1} MB) +@msg the Word document was last saved with fast save, which VectorCraft doesn't read; save it again with fast save turned off Word 文件上次是以快速儲存方式儲存,VectorCraft 無法讀取;請關閉快速儲存後再儲存一次 +@msg the Word document was saved by Word 6.0 or Word 95, which VectorCraft doesn't read; save it as a Word 97-2003 document Word 文件是由 Word 6.0 或 Word 95 儲存,VectorCraft 無法讀取;請儲存為 Word 97-2003 文件 +@msg the Word document's text is made of more than {MAX_PIECES} pieces, too many to place Word 文件的文字由超過 {MAX_PIECES} 個片段組成,數量過多而無法置入 +@msg the action set ids are not a list 動作組 ID 不是清單 +@msg the active paint is not a gradient 作用中的上色不是漸層 +@msg the artboards don't fit on the canvas: fewer artboards, less spacing or a smaller size 工作區域無法容納於畫布:請減少工作區域、縮小間距或縮小尺寸 +@msg the character's size can't be measured 無法測量字元的大小 +@msg the compound shape is too complex to expand 複合形狀過於複雜,無法展開 +@msg the container of the listed objects is gone 所列物件的容器已不存在 +@msg the copy `{user_id}` can't be read as a library 複本 `{user_id}` 無法讀取為資料庫 +@msg the copy would leave the canvas 複本會超出畫布 +@msg the cut cannot be made on this art: {e} 無法在此圖稿上進行切割:{e} +@msg the data isn't an EMF or WMF picture 資料不是 EMF 或 WMF 圖片 +@msg the data isn't an EPS or PostScript picture 資料不是 EPS 或 PostScript 圖片 +@msg the deferred paste is no longer available 延後的貼上已無法使用 +@msg the design is too big to draw at every data point of this graph 設計過大,無法在此圖表的每個資料點繪製 +@msg the design is too big to draw in every column of this graph 設計過大,無法在此圖表的每個直條中繪製 +@msg the dialog it was opened over is no longer open 它開啟時所在的對話框已不再開啟 +@msg the dictionary stack overflowed 字典堆疊溢位 +@msg the editing data's hash has no place 編輯資料的雜湊值沒有存放位置 +@msg the entities the document declares expand to too much text 文件宣告的實體展開後的文字過多 +@msg the envelope's content has no bounds 封套的內容沒有邊界 +@msg the envelope's mesh is malformed 封套的網格格式不正確 +@msg the file holds no `variableSets` element 檔案中沒有 `variableSets` 元素 +@msg the file is larger than {_1} MB 檔案大於 {_1} MB +@msg the file is too large 檔案過大 +@msg the file was updated or encrypted already 檔案已經更新或加密 +@msg the first character of a line has no character before it to kern: it moves only up and down (dy) 一行的第一個字元前面沒有可調整字距的字元:它只能上下移動 (dy) +@msg the font {_1} is not available 無法使用字體 {_1} +@msg the format has no file extension 此格式沒有副檔名 +@msg the graphic can't be read: {e} 無法讀取圖形:{e} +@msg the graphic is empty 圖形為空 +@msg the graphic's data is damaged 圖形的資料已損毀 +@msg the graphic's document has no artboard 圖形的文件沒有工作區域 +@msg the header `{cell}` for `{name}` would read back as the variable `{other}`: rename one of them `{name}` 的標題 `{cell}` 讀回時會成為變數 `{other}`:請重新命名其中一個 +@msg the image `{path}` isn't followed: {r} 未跟隨影像 `{path}` 的連結:{r} +@msg the image has no embedded pixels 影像沒有內嵌的像素 +@msg the image is empty 影像為空 +@msg the image is fully transparent 影像完全透明 +@msg the image is not on an artboard; pass rect 影像不在工作區域上;請傳入 rect +@msg the image's pixels are missing 影像的像素遺失 +@msg the image's pixels aren't in the document 影像的像素不在文件中 +@msg the image's pixels can't be read: {e} 無法讀取影像的像素:{e} +@msg the image's transparency doesn't fit it 影像的透明度資料與影像不相符 +@msg the job would print more than {MAX_PAGES} pages 此工作會列印超過 {MAX_PAGES} 頁 +@msg the job would print more than {_1} pages 此工作會列印超過 {_1} 頁 +@msg the layers hold no art to mask 圖層中沒有可套用遮色片的圖稿 +@msg the layout moved 版面已移動 +@msg the library has a group `{name}` already 資料庫中已有群組 `{name}` +@msg the library has no group `{name}` 資料庫中沒有群組 `{name}` +@msg the library has no item `{item}` 資料庫中沒有項目 `{item}` +@msg the library has no item `{other}` 資料庫中沒有項目 `{other}` +@msg the library holds {MAX_GROUPS} groups already 資料庫已有 {MAX_GROUPS} 個群組 +@msg the library holds {MAX_ITEMS} items of this kind already 資料庫已有 {MAX_ITEMS} 個這類項目 +@msg the name is empty 名稱為空 +@msg the object has no fill, stroke or effect 物件沒有填色、筆畫或效果 +@msg the object has no graphic style (pass `name`) 物件沒有繪圖樣式 (請傳入 `name`) +@msg the objects don't match the plan 物件與計畫不相符 +@msg the open and permissions passwords must differ 開啟密碼和權限密碼必須不同 +@msg the operand stack overflowed 運算元堆疊溢位 +@msg the page has no area 頁面沒有面積 +@msg the page's type in an unread object's box isn't in its page art 頁面中位於未讀取物件方框內的文字不在其頁面圖稿中 +@msg the paint behind the proxy is not a gradient 代理所代表的上色不是漸層 +@msg the parent must be a layer or sublayer 父項必須是圖層或子圖層 +@msg the path can't be extended 路徑無法延伸 +@msg the path can't be inside one of the objects to attach 路徑不能位於要附加的物件之內 +@msg the path has no segments to measure 路徑沒有可測量的線段 +@msg the path is empty 路徑為空 +@msg the path is too short to shorten that much 路徑過短,無法縮短這麼多 +@msg the picture has no objects 圖片中沒有物件 +@msg the program runs too long 程式執行時間過長 +@msg the program uses too much memory 程式使用過多記憶體 +@msg the rectangle must have a width and a height 矩形必須有寬度和高度 +@msg the rectangle needs a size and must lie on the canvas 矩形需要有大小,而且必須位於畫布上 +@msg the selected art has no width 所選圖稿沒有寬度 +@msg the selection draws nothing 選取範圍沒有繪製任何內容 +@msg the selection has no area 選取範圍沒有面積 +@msg the selection has no art to export 選取範圍中沒有可匯出的圖稿 +@msg the selection has no bounds 選取範圍沒有邊界 +@msg the selection has no graphic style 選取範圍沒有繪圖樣式 +@msg the slice would leave the canvas 切片會超出畫布 +@msg the spot colour couldn't be added 無法加入特別色 +@msg the subpath has no ends to extend (it is closed or a single point) 子路徑沒有可延伸的端點 (它是封閉路徑或單一的點) +@msg the symbols are nested too deeply to expand their instances 符號的巢狀層次過深,無法展開其範例 +@msg the text file is too large to place as type (at most {_1} MB) 文字檔案過大,無法置入為文字 (最多 {_1} MB) +@msg the text is empty 文字為空 +@msg the text is over {_1} MB 文字超過 {_1} MB +@msg the top object must be a path 最上方的物件必須是路徑 +@msg the trace was cancelled 描圖已取消 +@msg the trailer has no size 檔尾沒有大小 +@msg the type object is flattened to nothing 文字物件平面化後沒有任何內容 +@msg the value of axis `{tag}` must be a number or null 軸 `{tag}` 的值必須是數字或 null +@msg the variable library declares more than {MAX_LIBRARY_DATASETS} data sets 變數資料庫宣告了超過 {MAX_LIBRARY_DATASETS} 個資料集 +@msg the variable library declares more than {MAX_LIBRARY_ENTITIES} entities 變數資料庫宣告了超過 {MAX_LIBRARY_ENTITIES} 個實體 +@msg the variable library declares more than {MAX_LIBRARY_VARIABLES} variables 變數資料庫宣告了超過 {MAX_LIBRARY_VARIABLES} 個變數 +@msg the variable library declares no variables 變數資料庫未宣告任何變數 +@msg the variable library is larger than {MAX_LIBRARY_BYTES} bytes 變數資料庫大於 {MAX_LIBRARY_BYTES} 位元組 +@msg the variable library is not UTF-8 變數資料庫不是 UTF-8 +@msg the variable library is not well-formed XML: {e} 變數資料庫不是格式正確的 XML:{e} +@msg the variable library nests elements more than {MAX_LIBRARY_NESTING} deep 變數資料庫的元素巢狀層次超過 {MAX_LIBRARY_NESTING} 層 +@msg the variable library's document type declaration holds something other than entities of plain text 變數資料庫的文件類型宣告包含純文字實體以外的內容 +@msg the variable library's entities expand to more than {MAX_LIBRARY_BYTES} bytes 變數資料庫的實體展開後超過 {MAX_LIBRARY_BYTES} 位元組 +@msg the window has no dock 視窗沒有停駐區 +@msg the written PDF has no catalog 已寫入的 PDF 沒有目錄 +@msg the written PDF has no cross-reference table 已寫入的 PDF 沒有交互參照表 +@msg the written PDF's metadata can't be edited 無法編輯已寫入 PDF 的中繼資料 +@msg there are no colour swatches to draw 沒有可繪製的顏色色票 +@msg there is already a design named `{name}` 已有名為 `{name}` 的設計 +@msg there is already a design named `{to}` 已有名為 `{to}` 的設計 +@msg there is already a toolbar named `{name}` 已有名為 `{name}` 的工具列 +@msg there is already a toolbar named `{to}` 已有名為 `{to}` 的工具列 +@msg there is no library: create one first 沒有資料庫:請先建立一個 +@msg these paths are too degenerate for Shaper 這些路徑過於退化,Shaper 無法處理 +@msg thumbnail: no page {v} (the {what} has {count}) thumbnail:沒有頁面 {v} ({what} 有 {count}) +@msg tileRange of {what}: {e} {what} 的 tileRange:{e} +@msg title can't be empty title 不能為空 +@msg to (the new name) is required 必須提供 to (新名稱) +@msg to must be fill or stroke to 必須是 fill 或 stroke +@msg to must be smooth or corner to 必須是 smooth 或 corner +@msg too large for a zip archive: package to a folder 對 zip 封存檔而言過大:請封裝到資料夾 +@msg too many Shaper edits Shaper 編輯過多 +@msg too many `points` (at most 100000) `points` 過多 (最多 100000 個) +@msg too many characters: at most {MAX_CHARS} 字元過多:最多 {MAX_CHARS} 個 +@msg too many dots for this size: lower the frequency 此尺寸的網點過多:請降低頻率 +@msg too many filters over one file 單一檔案上的濾鏡過多 +@msg too many overlapping paths for Shaper 重疊的路徑過多,Shaper 無法處理 +@msg too many saved clips 已儲存的剪裁過多 +@msg too many saved graphics states 已儲存的圖形狀態過多 +@msg toolbar (a toolbar's name) must be a string toolbar (工具列的名稱) 必須是字串 +@msg toolbar name can't be empty 工具列名稱不能為空 +@msg transparentImages {v}: "flatten" (the default) or "omit" transparentImages {v}:應為 "flatten" (預設值) 或 "omit" +@msg two saved selections would be named `{_1}` 會有兩個已儲存的選取範圍都名為 `{_1}` +@msg type dimension cannot be represented with this text transform 文字尺寸無法以此文字變形表示 +@msg type dimension must be finite 文字尺寸必須是有限值 +@msg unexpected resources 非預期的資源 +@msg unknown CMYK profile `{name}` 未知的 CMYK 描述檔 `{name}` +@msg unknown File Info field `{k}` 未知的「檔案資訊」欄位 `{k}` +@msg unknown OpenType feature `{t}` in featureChanges (the tags `features` takes) featureChanges 中有未知的 OpenType 功能 `{t}` (應為 `features` 接受的標籤) +@msg unknown PDF preset `{name}` (presets: {_1}) 未知的 PDF 預設集 `{name}` (預設集:{_1}) +@msg unknown Warp style 未知的彎曲樣式 +@msg unknown alignToPath `{a}` 未知的 alignToPath `{a}` +@msg unknown arrowhead {v} 未知的箭頭 {v} +@msg unknown artboardLayout key `{k}` (layout, columns, spacing, rightToLeft) 未知的 artboardLayout 鍵 `{k}` (layout、columns、spacing、rightToLeft) +@msg unknown attribute `{attribute}` 未知的屬性 `{attribute}` +@msg unknown attribute `{k}` 未知的屬性 `{k}` +@msg unknown axis `{other}` (vertical|horizontal|free) 未知的軸 `{other}` (vertical|horizontal|free) +@msg unknown blend mode `{b}` 未知的混合模式 `{b}` +@msg unknown blend mode {b} 未知的混合模式 {b} +@msg unknown brush type `{o}` 未知的筆刷類型 `{o}` +@msg unknown category `{c}` 未知的類別 `{c}` +@msg unknown category `{c}` ({_1}) 未知的類別 `{c}` ({_1}) +@msg unknown character `{c}` 未知的字元 `{c}` +@msg unknown character style number field 未知的字元樣式數字欄位 +@msg unknown effect `{e}` 未知的效果 `{e}` +@msg unknown end {e} 未知的端點 {e} +@msg unknown flattenerPreset `{name}` (High Resolution, Medium Resolution, Low Resolution or a saved one: see flattener.presets.list) 未知的 flattenerPreset `{name}` (High Resolution、Medium Resolution、Low Resolution 或已儲存的預設集:請參閱 flattener.presets.list) +@msg unknown format `{f}` (vcswatches, gpl, ase or css) 未知的格式 `{f}` (vcswatches、gpl、ase 或 css) +@msg unknown from {f} 未知的 from {f} +@msg unknown graph type `{t}` 未知的圖表類型 `{t}` +@msg unknown grid colours `{name}` (one of {_1}) 未知的格點顏色 `{name}` (應為 {_1} 其中之一) +@msg unknown gridType `{t}` 未知的 gridType `{t}` +@msg unknown highlight `{v}` 未知的 highlight `{v}` +@msg unknown intent `{i}` 未知的色彩比對方式 `{i}` +@msg unknown issue kind {id} 未知的問題種類 {id} +@msg unknown issue kind {v} 未知的問題種類 {v} +@msg unknown knockout state {k} 未知的去底狀態 {k} +@msg unknown language `{language}` (one of {_1}) 未知的語言 `{language}` (應為 {_1} 其中之一) +@msg unknown language `{l}` (one of {_1}) 未知的語言 `{l}` (應為 {_1} 其中之一) +@msg unknown method `{m}` ({_1}) 未知的方法 `{m}` ({_1}) +@msg unknown mode `{other}` (gray, rgb, hsb, lab, cmyk or web) 未知的模式 `{other}` (gray、rgb、hsb、lab、cmyk 或 web) +@msg unknown mode `{other}` (mono|cmyk) 未知的模式 `{other}` (mono|cmyk) +@msg unknown mode `{other}` (rgb|cmyk|gray|global) 未知的模式 `{other}` (rgb|cmyk|gray|global) +@msg unknown mode `{other}` (set, add, subtract) 未知的模式 `{other}` (set、add、subtract) +@msg unknown mode `{o}` 未知的模式 `{o}` +@msg unknown mode {m} 未知的模式 {m} +@msg unknown model `{other}` 未知的 model `{other}` +@msg unknown model `{other}` (keep, new or document) 未知的 model `{other}` (keep、new 或 document) +@msg unknown op {o} 未知的 op {o} +@msg unknown order `{o}`: toggle, front, forward, backward or back 未知的 order `{o}`:應為 toggle、front、forward、backward 或 back +@msg unknown overprints `{v}` (preserve, simulate or discard) 未知的 overprints `{v}` (preserve、simulate 或 discard) +@msg unknown panel 未知的面板 +@msg unknown pieLegend `{v}` (none, standard or wedges) 未知的 pieLegend `{v}` (none、standard 或 wedges) +@msg unknown piePosition `{v}` (even, ratio or stacked) 未知的 piePosition `{v}` (even、ratio 或 stacked) +@msg unknown pieSort `{v}` (none, all or first) 未知的 pieSort `{v}` (none、all 或 first) +@msg unknown plate `{n}` 未知的色版 `{n}` +@msg unknown preference `{k}` 未知的偏好設定 `{k}` +@msg unknown profile {id} (see stroke.widthProfile.list) 未知的描述檔 {id} (請參閱 stroke.widthProfile.list) +@msg unknown proof target `{t}` 未知的校樣目標 `{t}` +@msg unknown quotes key `{k}` (double, single) 未知的 quotes 鍵 `{k}` (double、single) +@msg unknown resolution `{v}` 未知的解析度 `{v}` +@msg unknown rule `{rule}` ({_1}) 未知的規則 `{rule}` ({_1}) +@msg unknown rule `{r}` (see color.harmony) 未知的規則 `{r}` (請參閱 color.harmony) +@msg unknown setting `{k}` 未知的設定 `{k}` +@msg unknown shape `{v}` (circle|ellipse|square|diamond|line) 未知的形狀 `{v}` (circle|ellipse|square|diamond|line) +@msg unknown spacing `{o}` (smooth|steps|distance) 未知的 spacing `{o}` (smooth|steps|distance) +@msg unknown tileType `{t}` ({_1}) 未知的 tileType `{t}` ({_1}) +@msg unknown units 未知的單位 +@msg unknown units `{u}` 未知的單位 `{u}` +@msg unknown value axis `{v}` (left, right or both) 未知的數值軸 `{v}` (left、right 或 both) +@msg unknown variation `{v}` (tintsShades|warmCool|vividMuted) 未知的 variation `{v}` (tintsShades|warmCool|vividMuted) +@msg unknown warp style `{s}` 未知的彎曲樣式 `{s}` +@msg unknown {key} `{v}` (none, short or full) 未知的 {key} `{v}` (none、short 或 full) +@msg unknown {key} profile `{n}` 未知的 {key} 描述檔 `{n}` +@msg unknown {k} key `{key}` (size, position) 未知的 {k} 鍵 `{key}` (size、position) +@msg unreadable object 無法讀取的物件 +@msg unsafe destination file name 目的地檔案名稱不安全 +@msg use paths or compound paths 請使用路徑或複合路徑 +@msg useArtboards must be true or false, not {v} useArtboards 必須是 true 或 false,而非 {v} +@msg value for `{var}` must match its variable kind `{var}` 的值必須符合其變數種類 +@msg variable `{_1}` is already defined 變數 `{_1}` 已定義 +@msg variable `{name}` has no `trait` 變數 `{name}` 沒有 `trait` +@msg variable `{name}` is already defined 變數 `{name}` 已定義 +@msg variable `{name}` is declared twice 變數 `{name}` 宣告了兩次 +@msg variable `{to}` already exists 變數 `{to}` 已存在 +@msg view is required 必須提供 view +@msg view must be one of {_1} view 必須是 {_1} 其中之一 +@msg warpStyle can only edit an applied Warp effect warpStyle 只能編輯已套用的彎曲效果 +@msg width and height must be more than 0 and at most {limit} 寬度和高度必須大於 0 且不超過 {limit} +@msg width factors must be finite 寬度係數必須是有限值 +@msg width must be positive width 必須是正值 +@msg width out of range 寬度超出範圍 +@msg width/height must be > 0 width/height 必須 > 0 +@msg x and y must be finite numbers x 和 y 必須是有限的數字 +@msg x and y must be given together x 和 y 必須一起提供 +@msg zone needs an anchor: dock beside a panel with anchor, or in a new dock column with side (Start or End) zone 需要 anchor:請以 anchor 停駐在面板旁,或以 side (Start 或 End) 停駐在新的停駐欄 +@msg zoom must be positive zoom 必須是正值 +@msg {C}: no effect at index {list} {C}:索引 {list} 處沒有效果 +@msg {DEFAULT_PRESET} is protected and stays {DEFAULT_PRESET} 受到保護,會保留 +@msg {DEFAULT_PRESET} is protected: save the settings under another name {DEFAULT_PRESET} 受到保護:請以其他名稱儲存設定 +@msg {LABEL} produced an empty result {LABEL} 產生了空的結果 +@msg {_1} MB of document, at most {_2} MB 文件為 {_1} MB,上限為 {_2} MB +@msg {_1} MB of images, at most {_2} MB 影像為 {_1} MB,上限為 {_2} MB +@msg {_1} bytes of RGBA data for a {width} × {height} image {width} × {height} 影像的 RGBA 資料為 {_1} 位元組 +@msg {_1} can't be read, or changed since it was read: relink or update it first {_1} 無法讀取,或在讀取後已變更:請先重新連結或更新 +@msg {_1} can't go into {into} {_1} 不能放入 {into} +@msg {_1} can't limit printing to low resolution: choose PDF 1.4 or later, or allow high-resolution printing {_1} 無法將列印限制為低解析度:請選擇 PDF 1.4 以上版本,或允許高解析度列印 +@msg {_1} files can't be opened yet 尚無法開啟 {_1} 檔案 +@msg {_1} files can't be password-protected: remove the passwords or choose no standard {_1} 檔案不能以密碼保護:請移除密碼或不要選擇標準 +@msg {_1} files can't be {_2} {_1} 檔案不能 {_2} +@msg {_1} files can't carry editing data: turn off preserveEditing {_1} 檔案不能包含編輯資料:請關閉 preserveEditing +@msg {_1} files can't have PDF layers: turn off createLayers {_1} 檔案不能有 PDF 圖層:請關閉 createLayers +@msg {_1} files need a creation date, and this platform has no clock to give one {_1} 檔案需要建立日期,而此平台沒有可提供日期的時鐘 +@msg {_1} isn't a path {_1} 不是路徑 +@msg {_1} options: {e} {_1} 選項:{e} +@msg {_1} paints nothing to rasterize {_1} 沒有繪製任何可點陣化的內容 +@msg {_1} passwords can have up to {MAX_LEGACY_PASSWORD} ASCII characters (PDF 1.7 and later take any) {_1} 密碼最多 {MAX_LEGACY_PASSWORD} 個 ASCII 字元 (PDF 1.7 以上版本接受任何字元) +@msg {_1} with linked images or an image map writes several files: use document.export 含有連結影像或影像地圖的 {_1} 會寫入多個檔案:請使用 document.export +@msg {_1} writes one file per artboard here: use document.export, or name one artboard {_1} 在這裡會為每個工作區域寫入一個檔案:請使用 document.export,或指定一個工作區域 +@msg {_1} × {_2} pixels is too large for {_3} (at most {max} pixels a side): lower the scale {_1} × {_2} 像素對 {_3} 而言過大 (每邊最多 {max} 像素):請降低縮放比例 +@msg {_1}: belongs to another account {_1}:屬於另一個帳戶 +@msg {_1}: not a folder of its own {_1}:不是獨立的資料夾 +@msg {_1}: not a plain file {_1}:不是一般檔案 +@msg {dest}: {e} {dest}:{e} +@msg {doc} has no folder {doc} 沒有資料夾 +@msg {file} isn't linked {file} 不是連結的檔案 +@msg {folder} is not a package folder {folder} 不是封裝資料夾 +@msg {folder}: more than {max} files and folders {folder}:超過 {max} 個檔案和資料夾 +@msg {folder}: {e} {folder}:{e} +@msg {g} is not a Live Paint group {g} 不是即時上色群組 +@msg {id} is not a slice {id} 不是切片 +@msg {key} must be 0–{MAX_ADD_AROUND} pt {key} 必須是 0–{MAX_ADD_AROUND} pt +@msg {key} must be [x,y] {key} 必須是 [x,y] +@msg {key} must be a percentage {min}..100 {key} 必須是 {min}..100 的百分比 +@msg {key} must be a positive number, not {n} {key} 必須是正數,而非 {n} +@msg {key} must be a positive number, not {v} {key} 必須是正數,而非 {v} +@msg {key} must be one of {_1} {key} 必須是 {_1} 其中之一 +@msg {key} must be {_1}, got {s} {key} 必須是 {_1},收到 {s} +@msg {key} must name a floating panel {key} 必須指定浮動面板 +@msg {key} must name a panel in another group {key} 必須指定另一個群組中的面板 +@msg {key} must name a panel that shows {key} 必須指定顯示中的面板 +@msg {key} must name a registered panel {key} 必須指定已註冊的面板 +@msg {kind} files have no transparency, and the file would have {what}: flatten it first (object.flattenTransparency) {kind} 檔案沒有透明度,而檔案中會有 {what}:請先將它平面化 (object.flattenTransparency) +@msg {kind} images can't be opened (see document.formats) 無法開啟 {kind} 影像 (請參閱 document.formats) +@msg {k} `{v}` is not one of the choices {k} `{v}` 不是選項之一 +@msg {k} has control characters{_1} {k} 含有控制字元{_1} +@msg {k} is too long (at most {MAX_TEXT} characters) {k} 過長 (最多 {MAX_TEXT} 個字元) +@msg {k} must be > 0 {k} 必須 > 0 +@msg {k} must be a number (pt) or a length such as "210 mm" {k} 必須是數字 (pt) 或 "210 mm" 這類長度 +@msg {k} must be a number from {min} to {max} {k} 必須是 {min} 到 {max} 之間的數字 +@msg {k} must be a number or "auto" {k} 必須是數字或 "auto" +@msg {k} must be a string {k} 必須是字串 +@msg {k} must be text {k} 必須是文字 +@msg {k} must be true or false {k} 必須是 true 或 false +@msg {k} must be {{size?, position?}} {k} 必須是 {{size?, position?}} +@msg {k}: can't read `{s}` as a length {k}:無法將 `{s}` 讀取為長度 +@msg {label} must be a number at most {max} {label} 必須是不超過 {max} 的數字 +@msg {label} must be a number from -1296 to 1296 {label} 必須是 -1296 到 1296 之間的數字 +@msg {label} must be a number from 1 to 10000 {label} 必須是 1 到 10000 之間的數字 +@msg {name} `{s}`: {ids} {name} `{s}`:{ids} +@msg {name} is built in and can't be deleted {name} 是內建項目,無法刪除 +@msg {name} must be {lo}–{hi}{unit} (got {v}) {name} 必須是 {lo}–{hi}{unit} (收到 {v}) +@msg {name}: CRC or size mismatch {name}:CRC 或大小不相符 +@msg {name}: only this Affinity file's embedded preview could be read; use File › Open to see it with its warning, or export SVG or PDF from Affinity before placing {name}:只能讀取此 Affinity 檔案的內嵌預視;請使用「檔案 › 開啟」查看它及其警告,或在置入前先從 Affinity 匯出 SVG 或 PDF +@msg {name}: {e} {name}:{e} +@msg {native}; its embedded preview can't be read either ({e}) {native};其內嵌預視也無法讀取 ({e}) +@msg {std} files are CMYK, and the file would have colours in {_1} {std} 檔案為 CMYK,而檔案中會有 {_1} 的顏色 +@msg {std} files embed their fonts, and the file would have one that isn't {std} 檔案會內嵌字體,而檔案中會有一個未內嵌的字體 +@msg {target} is the file this document was read from, and reading it left things out ({what}): writing over it would lose them for good. Write another file instead, or pass acknowledgeLoss: true to replace it anyway {target} 是讀取此文件的來源檔案,而讀取時略過了部分內容 ({what}):覆寫它會永久失去這些內容。請改為寫入另一個檔案,或傳入 acknowledgeLoss: true 以強制取代 +@msg {ty} brushes need selected art (or params.{k}) {ty} 筆刷需要選取的圖稿 (或 params.{k}) +@msg {v} is not an asset id {v} 不是資產 ID +@msg {what} can't be intertwined {what} 無法交織 +@msg {what} doesn't fit the paper with its bleed and marks {what} 連同出血和標記無法容納於紙張 +@msg {what} would print on more than {MAX_TILES} tiles: scale it down {what} 會列印在超過 {MAX_TILES} 個拼貼上:請縮小 diff --git a/crates/ui-egui/src/io.rs b/crates/ui-egui/src/io.rs index 83f463d668..ee083d7d44 100644 --- a/crates/ui-egui/src/io.rs +++ b/crates/ui-egui/src/io.rs @@ -23,16 +23,17 @@ mod tests_read_only_save; pub use export::{EXPORT_CANCELLED, cancel_exports, export, export_for_screens, export_pdf, hide_exports, reveal, save_command_output}; pub(crate) use export::{ - export_files, exported_with_notes, file_url, open_in_app, open_original, reveal_path, run_to_file, save_command_output_named, + EXPORT_SELECTION, export_files, exported_with_notes, file_url, open_in_app, open_original, reveal_path, run_to_file, save_command_output_named, + selection_path, }; pub(crate) use open::report_installed; -pub(crate) use open::{EXPORT_PRESETS, import_presets, open_with_on, opened, show_opened}; +pub(crate) use open::{EXPORT_PRESETS, import_presets, open_notes, open_with_on, opened, opened_after_notice, show_opened}; pub use open::{ MAX_RECENT_FILES, OpensAs, ask_revert, install_module, install_plugin, new_from_template, note_recent, open_bytes, open_dialog, open_document, open_path, open_path_with, open_reporting, open_with, opens_as, place_bytes, recent_files, report_open_error, }; #[cfg(test)] -pub(crate) use open::{open_file, opened_after_notice, opened_with_notes}; +pub(crate) use open::{open_file, opened_with_notes}; pub(crate) use save::save_current; pub use save::{ask_format_options, ask_pdf_options, remember_active_artboard, remember_view, save, save_pdf}; pub(crate) use save::{export_path, is_web, notes_of, report_saved, show_with_notes, target_path, write_named, write_reporting, write_to}; @@ -171,14 +172,20 @@ mod tests { app.run("file.save", json!({"path": "/out/b.vectorcraft"})).unwrap(); assert_eq!((app.ui.status.as_str(), &app.ui.status_notes), ("Saved /out/b.vectorcraft", &None)); - // A PDF export of a knockout group and of type in a font that isn't installed. + // A PDF export of a knockout group whose soft masks would draw a brushed stroke, and of type + // in a font that isn't installed. app.run("text.create", json!({"x": 5, "y": 20, "text": "Ab", "font": "Nonexistent Sans Probe"})).unwrap(); - app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap(); + let lower = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 30, "height": 20})).unwrap()["id"].clone(); + let upper = app.run("shape.rectangle", json!({"x": 25, "y": 15, "width": 30, "height": 20})).unwrap()["id"].clone(); + app.run("brush.apply", json!({"ids": [upper], "name": "3 pt. Round"})).unwrap(); + app.run("object.setProps", json!({"ids": [lower, upper], "opacity": 50, "knockoutShape": true})).unwrap(); + app.run("select.set", json!({"ids": [lower, upper]})).unwrap(); app.run("object.group", json!({})).unwrap(); app.run("transparency.set", json!({"knockout": "on"})).unwrap(); let r = export(&mut app, Some("pdf"), Some("/out/c.pdf".into()), &json!({})).unwrap(); let notes = notes_of(&r); assert_eq!(notes.len(), 2, "{r}"); + assert!(notes.iter().any(|n| n.contains("brushed strokes")), "{r}"); assert_eq!(app.ui.status, exported_with_notes("/out/c.pdf", notes.len(), ¬es[0])); assert_eq!(app.ui.status_notes, Some((app.ui.status.clone(), notes))); } @@ -430,7 +437,9 @@ mod tests { app.session.execute("file.new", &json!({"width": 60, "height": 40})).unwrap(); app.session.execute("shape.rectangle", &json!({"x": 5, "y": 5, "width": 20, "height": 10})).unwrap(); app.services.pick_save = Some(Box::new(|_: &FilePick| Some("/tmp/sel.svg".into()))); - assert_eq!(app.run("document.exportSelection", json!({})).unwrap()["path"], "/tmp/sel.svg"); + app.run("document.exportSelection", json!({})).unwrap(); + assert_eq!(app.ui.dialog.as_ref().map(|d| d.kind.as_str()), Some("svgOptions"), "the picked format's options follow"); + assert_eq!(crate::dialogs::confirm(&mut app).unwrap()["path"], "/tmp/sel.svg"); app.run("document.exportSelection", json!({"path": "/tmp/sel.png"})).unwrap(); let w = written.borrow(); assert!(String::from_utf8_lossy(&w[0].1).contains(" Result<(bool, Value), String> { + let mut p = params.clone(); + let Some(o) = p.as_object_mut() else { return Ok((false, p)) }; + match o.remove(EXPORT_SELECTION) { + None | Some(Value::Null | Value::Bool(false)) => return Ok((false, p)), + Some(Value::Bool(true)) => {} + Some(v) => return Err(format!("{EXPORT_SELECTION} must be true or false, not {v}")), + } + let strip = |o: &mut serde_json::Map| { + for k in fileio::ARTBOARD_PARAMS.iter().chain(&["useArtboards", "selectedOnly"]) { + o.remove(*k); + } + }; + strip(o); + if let Some(svg) = o.get_mut("svg").and_then(Value::as_object_mut) { + strip(svg); + } + Ok((true, p)) +} + /// File → Cancel Export (the progress dialog's Cancel): every export running in the background /// stops and writes nothing more → `{cancelled: n}`. pub fn cancel_exports(app: &mut VectorcraftApp) -> Value { @@ -29,11 +56,16 @@ pub fn hide_exports(app: &mut VectorcraftApp) -> Value { /// options…): every file it writes (one per artboard, linked images) goes next to `path`. The /// document keeps its path. → `{path, warnings, files?}` (`files`: every file when there are /// several). When automation asked for the export, `warnings` also name each option the written -/// format doesn't read, as `document.export`'s do. +/// format doesn't read, as `document.export`'s do. With [`EXPORT_SELECTION`] the file holds the +/// selection alone, cropped to it, as `document.exportSelection` writes it. With Appearance of +/// Black › Printing / Exporting set to rich black, RGB files draw a CMYK black as RGB black, as in +/// `document.export`. pub fn export(app: &mut VectorcraftApp, format: Option<&str>, path: Option, params: &Value) -> Result { // Options given as anything but an object are none: the path and format still reach the // encoder (an exporter plug-in is told the file it writes). let params = &if params.is_object() { params.clone() } else { json!({}) }; + let (selection, params) = take_selection(params)?; + let params = ¶ms; let f = fileio::writable_format(format, path.as_deref())?; // A Shape Builder merge still being computed for a click is exported with the document. let r = app.session.finish_tool_edit(); @@ -42,9 +74,13 @@ pub fn export(app: &mut VectorcraftApp, format: Option<&str>, path: Option st.doc.clone(), - std::borrow::Cow::Owned(d) => std::sync::Arc::new(d), + let doc = if selection { + std::sync::Arc::new(fileio::selection_doc(st, "document.exportSelection", f.id == "txt").map_err(|e| e.to_string())?.0) + } else { + match fileio::export_doc(st, f, params).map_err(|e| e.to_string())? { + std::borrow::Cow::Borrowed(_) => st.doc.clone(), + std::borrow::Cow::Owned(d) => std::sync::Arc::new(d), + } }; // A PDF shows its title in the viewer's title bar only when it is the document's own, not the // file name it was titled after, as `document.export` writes it. @@ -55,6 +91,9 @@ pub fn export(app: &mut VectorcraftApp, format: Option<&str>, path: Option, path: Option, path: Option Result, String> { bytes.ok_or_else(|| "no data".into()) } +/// The file an Export Selection writes, picked in a save panel (the web: the suggested name): a +/// typed extension of any format is kept, and names the format. +pub(crate) fn selection_path(app: &mut VectorcraftApp) -> Result { + target_path_keeping(app, None, "png", |_| true) +} + /// Run an engine command that returns `{dataBase64}` without its `path` and write the bytes to /// that path (else a picked or suggested name) → (path, the command's result without the data). /// The command runs before a path is asked for, so bad params never open a save dialog, except diff --git a/crates/ui-egui/src/io/open.rs b/crates/ui-egui/src/io/open.rs index 1dec3a1fc7..e0e4e4c404 100644 --- a/crates/ui-egui/src/io/open.rs +++ b/crates/ui-egui/src/io/open.rs @@ -162,7 +162,7 @@ pub(crate) fn show_opened(app: &mut VectorcraftApp, notice: Option, note /// The notes of the open `r`, those of what reading the file left out (its document's /// `import_losses`) first, each group in the order the import gave them. -fn open_notes(app: &VectorcraftApp, r: &Value) -> Vec { +pub(crate) fn open_notes(app: &VectorcraftApp, r: &Value) -> Vec { let notes = notes_of(r); let index = r["index"].as_u64().and_then(|i| usize::try_from(i).ok()); let losses = index.and_then(|i| app.session.documents().get(i)).map(|st| st.import_losses.as_slice()).unwrap_or_default(); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 4ef21414ee..50ed3d8ee5 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -235,6 +235,12 @@ pub struct VectorcraftApp { /// icon and title. Set by the desktop app when it opens the window; `false` for embedders /// without a window of their own. pub desktop_frame: bool, + /// Linux and the BSDs: `VECTORCRAFT_TITLEBAR` is unset and the desktop would draw the window's + /// frame on this session with Preferences › User Interface › System Title Bar on or off while + /// VectorCraft Title Bar on Every Desktop is off, so the dialog says so under System Title Bar. + /// It stays `true` while VectorCraft Title Bar on Every Desktop gives the app the frame. Set by + /// the desktop app when it opens the window; `false` elsewhere. + pub desktop_keeps_frame: bool, /// Last window title sent to the OS (`ViewportCommand::Title`, see `chrome::sync_window_title`): /// sent again only when it changes, so idle frames don't spam the backend. pub(crate) last_window_title: String, diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 14e5d053ef..7b7f7a6b21 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -171,6 +171,8 @@ fn run_ui_part1(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::dialogs::export_selection(app), "document.exportSelection" => { io::save_command_output(app, id, "png", if p.is_object() { p.clone() } else { json!({}) }).map(|p| json!({"path": p})) } @@ -985,6 +987,8 @@ fn run_ui_part11(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option crate::panels::actions::new_action(app, p), crate::panels::actions::ACTION_OPTIONS => crate::panels::actions::action_options(app, p), crate::panels::actions::PLAY_ACTION => crate::panels::actions::play_action(app, p), + crate::panels::actions::PLAY_AT => crate::panels::actions::play_at(app, p), + crate::panels::actions::BUTTON_MODE => crate::panels::actions::button_mode(app, p), crate::panels::actions::PLAYBACK_OPTIONS => crate::panels::actions::playback_options(app, p), crate::panels::actions::START_RECORDING => crate::panels::actions::record(app, p), crate::panels::actions::STOP_RECORDING => crate::panels::actions::stop(app, p), diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index cd311d45a8..d43d17220c 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -667,7 +667,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "learn.list", "List Tutorials", "", - "{} the Learn panel's skills in the order its Skills tab lists them: {skills: [{id, title, tutorials: [{id, title, steps: number of steps}]}]}", + "{} the Learn panel's skills in the order its Skills tab lists them, with the progress its rings, counts and check marks show: {skills: [{id, title, done: number of its tutorials finished, total: number of its tutorials, tutorials: [{id, title, steps: number of steps, finished: bool, completedSteps: [zero-based indexes of the steps marked done, every step once finished]}]}]}", ), ( "learn.skills", @@ -693,11 +693,17 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{tutorial: id (see learn.list)} open that tutorial's practice sample as a new untitled document, which becomes the active one, and move the Learn view to the tutorial, as its View more button does; each call opens another copy and open documents stay as they are; a missing, non-string or unknown id is an error and changes nothing; returns {tutorial, index, title} of the new document", ), + ( + "learn.markStep", + "Mark Tutorial Step", + "", + "{tutorial: id (see learn.list), step: zero-based step number, complete?: bool} mark a step of a tutorial whose sample learn.openSample opened as done (true, omitted or null) or not done (false), as the check box before the step does; marking does not finish the tutorial; a missing, non-string or unknown id, a missing step or one the tutorial does not have, a complete that is not true or false, a tutorial whose sample was not opened, or a finished tutorial is an error and changes nothing; the preferences keep the marks; returns {tutorial, step, complete}", + ), ( "learn.finish", "Finish Tutorial", "", - "{tutorial: id (see learn.list)} mark a tutorial whose sample learn.openSample opened as finished, as its Finish tutorial button does; finishing it again keeps one entry; a missing, non-string or unknown id, or a tutorial whose sample was not opened, is an error and changes nothing; returns {tutorial, finished: true, next: id of the next tutorial in its skill, or null after the skill's last one}", + "{tutorial: id (see learn.list)} mark a tutorial whose sample learn.openSample opened as finished, with all its steps done, as its Finish tutorial button does; finishing it again keeps one entry, and needs no sample after a restart; a missing, non-string or unknown id, or a tutorial not finished whose sample was not opened, is an error and changes nothing; the preferences keep the tutorials finished; returns {tutorial, finished: true, next: id of the next tutorial in its skill, or null after the skill's last one}", ), ( "learn.next", @@ -705,6 +711,12 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{tutorial: id (see learn.list)} show the Learn panel on the tutorial after a finished one in the same skill, as its Next Up button does, without opening a sample; a missing, non-string or unknown id, a tutorial not finished, or a skill's last tutorial is an error and changes nothing; returns {skill, tutorial, title} of the next tutorial", ), + ( + "learn.resetProgress", + "Reset Learn Progress", + "", + "{} clear the Learn panel's progress, every tutorial finished and every step marked done, as Reset progress under the list of skills does; open documents, opened practice samples and the Learn view stay as they are; returns what learn.list returns", + ), ("window.brightness", "UI Brightness", "", "{brightness: dark|mediumDark|mediumLight|light}"), ( "window.workspace", @@ -1265,7 +1277,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "ui.smoothAuto", "Auto-Smooth", "", - "{} the open Smooth slider (Object › Path › Smooth and the canvas context menu's Smooth… open it: dialog `smoothSlider` with field `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until ui.dialog.confirm keeps it as one undo step) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", + "{} the open Smooth slider (Object › Path › Smooth, the canvas context menu's Smooth… and the Contextual Task Bar's Smooth open it: dialog `smoothSlider` with field `level` 0..100, object.path.smooth's level, opening at the level object.path.smooth {auto: true} picks, previewed on the canvas until ui.dialog.confirm keeps it as one undo step) moves to the level object.path.smooth {auto: true} picks and previews it → {level}; an error when the slider isn't open", ), ( "ui.simplifyMoreOptions", @@ -1331,7 +1343,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "file.exportAs", "Export As…", "", - "{format?, useArtboards?, range?} opens Export As (then the format's options); with {path, …document.export options} writes the file(s) → {path, warnings, files?}; under automation read roots, an SVG or SVGZ is refused while the document links a JavaScript file outside them, as document.export refuses it", + "{format?, useArtboards?, range?} opens Export As (then the format's options); with {path, …document.export options} writes the file(s) → {path, warnings, files?}; exportSelection: true writes the selection alone, cropped to it, as document.exportSelection writes it (artboard options are not used); under automation read roots, an SVG or SVGZ is refused while the document links a JavaScript file outside them, as document.export refuses it", ), ( "ui.fileInfoDialog", @@ -1466,7 +1478,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ crate::panels::actions::NEW_ACTION, "New Action", "", - "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), which the panel does not show. Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", + "{set: index, name, key?: 0-15, cmd?, shift?, color?: red|yellow|green|blue|violet} add an action named name (spaces trimmed from both ends) after the last action of the Actions panel's set at set (0 is the top set) and start recording into it; Stop Playing/Recording (ui.action.stop) ends the recording. key 1 to 15 is the function key F1 to F15 that plays the action (0 or null: none), with cmd (Ctrl, Command on macOS) and shift; color is its Button Mode color (null or \"\": none), the color of its button in Button Mode (ui.action.buttonMode). Action function keys take priority over command shortcuts and preserve the command's binding. On Windows F1, Ctrl+F4 and Ctrl+F6 cannot be used. The set becomes current and the new action is selected. The panel's Create New Action button and menu's New Action… (dialog `actionNew` with set, name, key, cmd, shift and color) run this on Record. While an action is recording, and for an index past the last set, an empty name, a key or color that is not one of these, or an action that would give the set more than 1,000 actions or an action set file larger than 8 MiB, it is an error, nothing is added and no recording starts → {set, action}", ), ( crate::panels::actions::ACTION_OPTIONS, @@ -1480,6 +1492,18 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[ "", "{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last, ui.action.stop, or a step that comes due while a different document is active than after the step before → {results: [the first step's result], pending: the steps left}. An action with a stop, at any speed, plays up to the stop and waits until ui.action.continue or ui.action.stop; at Accelerated the steps between stops are one undoable batch each → {results, pending, atStop?: true when it already waits}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays", ), + ( + crate::panels::actions::PLAY_AT, + "Play Action", + "", + "{set: index, action: index} play the Actions panel's action at action in set (0 is the top set) as ui.action.play plays it, and return what ui.action.play returns. A click on an action's button in Button Mode runs this. A missing index, or one that is not a whole number or is past the last set or action, is an error and nothing plays", + ), + ( + crate::panels::actions::BUTTON_MODE, + "Button Mode", + "", + "{enabled?: bool} with true, the Actions panel shows every action of every set, in set order and then action order, as a button with its name in its Action Options color (no color: an ordinary button), without set names, steps or checkmarks, and a click on a button plays its action (ui.action.playAt); with false, it shows its list again; left out or null, it switches to the other view. The panel menu's Button Mode runs this and shows a check mark while it is on. The view is kept with the UI preferences. Turning it on while an action records, or an enabled that is not true, false or null, is an error and the view stays → {enabled}", + ), ( crate::panels::actions::PLAYBACK_OPTIONS, "Playback Options", diff --git a/crates/ui-egui/src/palette.rs b/crates/ui-egui/src/palette.rs index 7b82af2e53..ded320a5aa 100644 --- a/crates/ui-egui/src/palette.rs +++ b/crates/ui-egui/src/palette.rs @@ -7,20 +7,40 @@ use serde_json::json; use crate::theme::Tokens; use crate::{VectorcraftApp, menus}; +/// Engine commands the palette leaves out, each with the UI command of the same name that runs it +/// the way the panels and menus do: (engine id, UI command id). The Layers panel's Delete +/// Selection asks before deleting a layer that holds art, and the other UI commands open the +/// command's dialog or file chooser. Scripts and the control channel still run the engine ids. +const WRAPPED: &[(&str, &str)] = &[ + ("layer.delete", "ui.layerDelete"), + ("brush.new", "ui.newBrush"), + ("brush.options", "ui.brushOptions"), + ("symbol.options", "ui.symbolOptions"), + ("svgFilter.import", "ui.importSvgFilter"), + ("text.convertListToText", "type.convertListToText"), +]; + /// Everything the palette searches: (label, command id or `tool:`, shortcut). pub fn items() -> Vec<(String, String, String)> { let mut items = vec![]; - // Aliases kept for older scripts run a command that is listed already. + // Aliases kept for older scripts run a command that is listed already, and a wrapped engine + // command is listed as its UI command. let plugin_commands = vectorcraft_engine::cmd::plugin::command_specs(); - for c in vectorcraft_engine::command_specs().iter().filter(|c| !vectorcraft_engine::cmd::is_alias(c.id)).chain(plugin_commands) { - let path = c.menu.join(" › "); - let label = if path.is_empty() { c.label.to_string() } else { format!("{path} › {}", c.label) }; - items.push((label, c.id.to_string(), menus::shortcut_of(c.id).unwrap_or("").to_string())); + let listed = |id: &str| !vectorcraft_engine::cmd::is_alias(id) && !WRAPPED.iter().any(|(engine, _)| *engine == id); + let labeled = |menu: &[&str], label: &str| { + let path = menu.join(" › "); + if path.is_empty() { label.to_string() } else { format!("{path} › {label}") } + }; + for c in vectorcraft_engine::command_specs().iter().filter(|c| listed(c.id)).chain(plugin_commands) { + items.push((labeled(c.menu, c.label), c.id.to_string(), menus::shortcut_of(c.id).unwrap_or("").to_string())); } // `plugin.dialog` runs nothing without an id: [`build`] lists each filter instead. A script of - // the Scripts folder runs from File › Scripts, by its path. + // the Scripts folder runs from File › Scripts, by its path. A UI command that wraps an engine + // command takes that command's menu path, so a search for the path still finds it. for c in menus::UI_COMMANDS.iter().filter(|c| c.0 != "plugin.dialog" && c.0 != crate::scripts_menu::COMMAND) { - items.push((c.1.to_string(), c.0.to_string(), menus::shortcut_of(c.0).unwrap_or("").to_string())); + let engine = WRAPPED.iter().find(|(_, ui)| *ui == c.0).and_then(|(engine, _)| vectorcraft_engine::find_command(engine)); + let label = engine.map_or_else(|| c.1.to_string(), |e| labeled(e.menu, c.1)); + items.push((label, c.0.to_string(), menus::shortcut_of(c.0).unwrap_or("").to_string())); } for tool in vectorcraft_tools::catalog::all_tools() { items.push((tool.label.to_string(), format!("tool:{}", tool.id), crate::shortcut_editor::tool_shortcut(tool.id).unwrap_or("").to_string())); @@ -40,8 +60,9 @@ pub(crate) struct Entry { shortcut: String, /// The label in the UI language. shown: String, - /// The English label (what agents document), the shown label and the id, lowercased, one per - /// line: a query word (which has no line break) matches within one of them. + /// The English label (what agents document), the shown label and the id (and the id of the + /// engine command a UI command wraps), lowercased, one per line: a query word (which has no + /// line break) matches within one of them. haystack: String, } @@ -71,7 +92,12 @@ fn entries(ctx: &egui::Context, lang: crate::i18n::Lang) -> Arc> { /// item (`plugin:`), whose name is not translated. fn build(lang: crate::i18n::Lang) -> Vec { let entry = |label: String, shown: String, id: String, shortcut: String| { - let haystack = format!("{}\n{}\n{}", label.to_lowercase(), shown.to_lowercase(), id.to_lowercase()); + let mut haystack = format!("{}\n{}\n{}", label.to_lowercase(), shown.to_lowercase(), id.to_lowercase()); + // A UI command that wraps an engine command is also found by the engine command's id. + if let Some((engine, _)) = WRAPPED.iter().find(|(_, ui)| *ui == id) { + haystack.push('\n'); + haystack.push_str(&engine.to_lowercase()); + } Entry { id, shortcut, shown, haystack } }; let mut out: Vec = items() @@ -250,6 +276,73 @@ mod tests { assert_eq!((st.selection.len(), st.selection.key), (2, None), "both objects stay selected, without a key"); } + /// An engine command that a UI command of the same name runs is listed once, as the UI command: + /// the Layers panel's Delete Selection, New Brush…, Brush Options…, Symbol Options…, Import SVG + /// Filter… and Convert to Text each have one result. + #[test] + fn a_wrapped_engine_command_is_listed_once_as_its_ui_command() { + let items = items(); + for (engine, ui) in WRAPPED { + let spec = vectorcraft_engine::command_specs().iter().find(|c| c.id == *engine).unwrap_or_else(|| panic!("{engine} is a command")); + let wrapper = menus::UI_COMMANDS.iter().find(|c| c.0 == *ui).unwrap_or_else(|| panic!("{ui} is a UI command")); + assert_eq!(spec.label, wrapper.1, "{engine} and {ui} share a name"); + assert!(items.iter().all(|(_, id, _)| id != engine), "{engine} is left out"); + let listed: Vec<&str> = items.iter().filter(|(_, id, _)| id == ui).map(|(label, ..)| label.as_str()).collect(); + let path: String = spec.menu.iter().map(|m| format!("{m} › ")).collect(); + assert_eq!(listed, [format!("{path}{}", wrapper.1)], "{ui} is listed once, with {engine}'s menu path"); + } + // A search for Delete Selection, or for its menu path, finds the Layers panel's, and not the + // engine command that deletes without asking; the path translates. + let entries = build(Lang::EN); + for (engine, ui) in WRAPPED { + assert!(entries.iter().any(|e| e.id == *ui && e.haystack.contains(&engine.to_lowercase())), "a search for {engine} finds {ui}"); + } + for query in ["delete selection", "layers delete", "layer.delete"] { + let found: Vec<&str> = + entries.iter().filter(|e| query.split_whitespace().all(|w| e.haystack.contains(w))).map(|e| e.id.as_str()).collect(); + assert!(found.contains(&"ui.layerDelete") && !found.contains(&"layer.delete"), "{query}: {found:?}"); + } + let zh = Lang::from_code("zh-hant").unwrap(); + let shown = build(zh).into_iter().find(|e| e.id == "ui.layerDelete").map(|e| e.shown).unwrap(); + let want = ["Window", "Layers", "Delete Selection"].map(|s| crate::i18n::tr(zh, s)).join(" › "); + assert_eq!(shown, want); + } + + /// Every result a search for Delete Selection gives asks before deleting a layer that holds art: + /// Cancel keeps it, and OK deletes it in one undo step. A script's `layer.delete` still deletes + /// at once. + #[test] + fn a_pick_of_delete_selection_asks_before_deleting_a_layer_with_art() { + let query = "delete selection"; + let picks: Vec = + build(Lang::EN).into_iter().filter(|e| query.split_whitespace().all(|w| e.haystack.contains(w))).map(|e| e.id).collect(); + assert!(!picks.is_empty(), "the search finds Delete Selection"); + let node = |v: &serde_json::Value| vectorcraft_doc::NodeId(v.as_u64().unwrap()); + let exists = |app: &VectorcraftApp, v: &serde_json::Value| app.session.active().unwrap().doc.node(node(v)).is_some(); + let undo = |app: &VectorcraftApp| app.session.active().unwrap().history.undo.len(); + let asked = |app: &VectorcraftApp| app.ui.dialog.as_ref().is_some_and(|d| d.kind == crate::dialogs::confirm::KIND); + for pick in &picks { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 200, "height": 200})).unwrap(); + let layer = app.run("layer.new", json!({})).unwrap()["id"].clone(); + let art = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].clone(); + app.run("select.none", json!({})).unwrap(); + let before = undo(&app); + run_pick(&mut app, pick); + assert!(asked(&app), "{pick} asks first: {}", app.ui.status); + assert!(exists(&app, &layer) && exists(&app, &art) && undo(&app) == before, "{pick}: nothing is deleted yet"); + crate::dialogs::cancel(&mut app); + assert!(exists(&app, &layer) && exists(&app, &art) && undo(&app) == before, "{pick}: Cancel keeps the layer"); + run_pick(&mut app, pick); + crate::dialogs::confirm(&mut app).unwrap(); + assert!(!exists(&app, &layer) && !exists(&app, &art), "{pick}: OK deletes the layer and its art"); + assert_eq!(undo(&app), before + 1, "{pick}: one undo step"); + app.run("edit.undo", json!({})).unwrap(); + app.run("layer.delete", json!({ "ids": [layer] })).unwrap(); + assert!(app.ui.dialog.is_none() && !exists(&app, &layer), "a script deletes at once"); + } + } + /// #4864: a pick of an Asset Export command, which the palette runs with no params, opens the /// Asset Export panel instead of failing on the missing params or exporting nowhere. #[test] diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 71019385b6..0b0435b3c6 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -529,6 +529,21 @@ const DRAG_SCROLL_EDGE: f32 = 28.0; /// the list's edge. const DRAG_SCROLL_SPEED: (f32, f32) = (60.0, 280.0); +/// The scrolling [`scroll_at_edges`] asks for, in points per second (positive shows earlier rows), +/// with the pointer `depth` points below the top of a list view `view_height` points tall. Each +/// band is [`DRAG_SCROLL_EDGE`] deep, or half the view in a view shorter than two bands, so the +/// pointer is in one band at most and the middle of a short view scrolls neither way. A view with +/// no height, or a value that isn't a number, gives 0. +fn drag_scroll_speed(view_height: f32, depth: f32) -> f32 { + if !(view_height.is_finite() && view_height > 0.0) { + return 0.0; + } + let band = DRAG_SCROLL_EDGE.min(view_height / 2.0); + let (slow, more) = DRAG_SCROLL_SPEED; + let speed = |depth: f32| if (0.0..band).contains(&depth) { slow + more * (1.0 - depth / band) } else { 0.0 }; + speed(depth) - speed(view_height - depth) +} + /// While something is dragged near the top or bottom edge of a scrolled list (`ui`: its contents), /// scroll that way, faster nearer the edge, and draw the next frame so a pointer held still keeps /// it scrolling. The pointer must be over the list's width. Each frame scrolls by the time it @@ -540,9 +555,7 @@ pub(crate) fn scroll_at_edges(ui: &mut Ui) { if !view.x_range().contains(pos.x) { return; } - let (slow, more) = DRAG_SCROLL_SPEED; - let speed = |depth: f32| if (0.0..DRAG_SCROLL_EDGE).contains(&depth) { slow + more * (1.0 - depth / DRAG_SCROLL_EDGE) } else { 0.0 }; - let per_second = speed(pos.y - view.top()) - speed(view.bottom() - pos.y); + let per_second = drag_scroll_speed(view.height(), pos.y - view.top()); if per_second != 0.0 { let dt = ui.input(|i| i.stable_dt).min(0.1); ui.scroll_with_delta_animation(vec2(0.0, per_second * dt), egui::style::ScrollAnimation::none()); @@ -683,6 +696,29 @@ mod tests { let tint = Paint::Solid { color: Color::gray(0.5), swatch: Some("Ink".into()), tint: 0.5 }; assert_eq!(paint_params(&tint), json!({"swatch": "Ink", "tint": 50.0}), "a tint keeps its percentage"); } + + #[test] + fn drag_scrolling_in_a_short_list_goes_toward_the_nearer_edge() { + let near = |a: f32, b: f32| (a - b).abs() < 1e-3; + // A 40 pt view: each band is 20 pt deep, so the pointer is in one band at most. + for (depth, want) in [(5.0, 270.0), (15.0, 130.0), (20.0, 0.0), (25.0, -130.0), (35.0, -270.0)] { + let got = drag_scroll_speed(40.0, depth); + assert!(near(got, want), "40 pt view, pointer {depth} pt down: {got} pt/s, want {want}"); + } + // Just outside a 20 pt view, the pointer does not scroll the list toward the far edge. + for depth in [-1.0, 21.0] { + assert_eq!(drag_scroll_speed(20.0, depth), 0.0, "20 pt view, pointer {depth} pt down"); + } + // From 56 pt up, the bands stay 28 pt deep and the speeds are unchanged. + for (h, depth, want) in [(100.0, 5.0, 290.0), (100.0, 95.0, -290.0), (100.0, 50.0, 0.0), (56.0, 0.0, 340.0), (56.0, 27.0, 70.0)] { + let got = drag_scroll_speed(h, depth); + assert!(near(got, want), "{h} pt view, pointer {depth} pt down: {got} pt/s, want {want}"); + } + for h in [0.0, -10.0, f32::NAN, f32::INFINITY] { + assert_eq!(drag_scroll_speed(h, 5.0), 0.0, "view height {h}"); + } + assert_eq!(drag_scroll_speed(40.0, f32::NAN), 0.0); + } } #[cfg(test)] mod tests_appearance; diff --git a/crates/ui-egui/src/panels/actions.rs b/crates/ui-egui/src/panels/actions.rs index 630d81e95f..4bab22d52e 100644 --- a/crates/ui-egui/src/panels/actions.rs +++ b/crates/ui-egui/src/panels/actions.rs @@ -32,8 +32,9 @@ pub struct Action { /// saved value that is not a function key loads as none. #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_key")] pub key: Option, - /// The action's Button Mode color, one of [`COLORS`], if one is assigned. The panel does not - /// show it. A saved value that is not one of them loads as none. + /// The action's Button Mode color, one of [`COLORS`], if one is assigned: the color of its + /// button while the panel is in Button Mode ([`button_colors`]). A saved value that is not one + /// of them loads as none. #[serde(default, skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_color")] pub color: Option, } @@ -84,6 +85,70 @@ impl Action { }) .collect() } + + /// The steps whose command `known` does not hold, in order, as (step index, the index of the + /// command in a `command.batch` step, command id). A `command.batch` step's own commands are + /// checked one by one, as playback runs them ([`Action::included_commands`]); a command of one + /// with no command id has the id "". With `included_only`, excluded steps are passed over. + pub(crate) fn unknown_commands<'a>( + &'a self, + known: &'a KnownCommands, + included_only: bool, + ) -> impl Iterator, &'a str)> + 'a { + self.steps.iter().enumerate().filter(move |(i, _)| !(included_only && self.excluded_steps.contains(i))).flat_map( + |(i, (command, params))| -> Vec<(usize, Option, &'a str)> { + match params.get("commands").and_then(Value::as_array) { + Some(steps) if command == "command.batch" => steps + .iter() + .enumerate() + .map(|(j, step)| (i, Some(j), step.get("command").and_then(Value::as_str).unwrap_or_default())) + .filter(|(_, _, id)| !known.has(id)) + .collect(), + _ if known.has(command) => vec![], + _ => vec![(i, None, command.as_str())], + } + }, + ) + } +} + +/// The command ids a step of an action can run now: the built-in engine commands, the commands the +/// installed plug-ins add, the View menu commands the app plays itself ([`crate::menus::plays_in_app`]) +/// and stops ([`STOP_STEP`]). +pub(crate) struct KnownCommands(std::collections::HashSet<&'static str>); + +impl KnownCommands { + /// The command ids known when it is called: a plug-in installed or removed later is not in it. + pub(crate) fn now() -> Self { + let engine = vectorcraft_engine::command_specs().iter().map(|c| c.id); + let plugins = vectorcraft_engine::cmd::plugin::command_specs().into_iter().map(|c| c.id); + Self(engine.chain(plugins).chain([STOP_STEP]).collect()) + } + + /// Whether a step can run command `id`. + pub(crate) fn has(&self, id: &str) -> bool { + self.0.contains(id) || crate::menus::plays_in_app(id) + } +} + +/// The one-based place of a step that [`Action::unknown_commands`] gives: `3` for the third step, +/// `3.2` for the second command of a `command.batch` third step. +pub(crate) fn step_place(step: usize, in_batch: Option) -> String { + match in_batch { + Some(j) => format!("{}.{}", step + 1, j + 1), + None => (step + 1).to_string(), + } +} + +/// `text` as a status message shows it: control characters become `�`, and text past 80 +/// characters ends in `…`. +pub(crate) fn shown_text(text: &str) -> String { + const MAX: usize = 80; + let mut shown: String = text.chars().take(MAX).map(|c| if c.is_control() { '\u{fffd}' } else { c }).collect(); + if text.chars().nth(MAX).is_some() { + shown.push('…'); + } + shown } /// An action id no other action in this run has. @@ -144,6 +209,40 @@ impl FunctionKey { /// The Button Mode colors an action can have, as (value, label). pub const COLORS: [(&str, &str); 5] = [("red", "Red"), ("yellow", "Yellow"), ("green", "Green"), ("blue", "Blue"), ("violet", "Violet")]; +/// The fill of a Button Mode button in color `color`, one of [`COLORS`]: VectorCraft's own shades. +fn button_fill(color: &str) -> Option { + let rgb = egui::Color32::from_rgb; + Some(match color { + "red" => rgb(0xd4, 0x3f, 0x3f), + "yellow" => rgb(0xf0, 0xc8, 0x3c), + "green" => rgb(0x3f, 0xa8, 0x5a), + "blue" => rgb(0x3d, 0x7b, 0xd6), + "violet" => rgb(0x8e, 0x5a, 0xd0), + _ => return None, + }) +} + +/// The relative luminance of `c`, as WCAG 2 defines it. +fn luminance(c: egui::Color32) -> f32 { + let channel = |v: u8| { + let v = f32::from(v) / 255.0; + if v <= 0.040_45 { v / 12.92 } else { ((v + 0.055) / 1.055).powf(2.4) } + }; + 0.2126 * channel(c.r()) + 0.7152 * channel(c.g()) + 0.0722 * channel(c.b()) +} + +/// The (fill, text) colors of the Button Mode button of an action with color `color`: a colored +/// fill with black or white text, whichever contrasts more with it, or the theme's ordinary button +/// for an action without a color. +fn button_colors(color: Option<&str>, t: &Tokens) -> (egui::Color32, egui::Color32) { + match color.and_then(button_fill) { + // Black text contrasts more than white above this luminance. + Some(fill) if luminance(fill) > 0.179 => (fill, egui::Color32::BLACK), + Some(fill) => (fill, egui::Color32::WHITE), + None => (t.button, t.text_strong), + } +} + /// Serde reader for [`Action::key`]: a value that is not a function key is none. fn deserialize_key<'de, D: serde::Deserializer<'de>>(d: D) -> Result, D::Error> { let v = ::deserialize(d)?; @@ -222,7 +321,10 @@ pub fn default_sets() -> Vec { /// Accelerated runs every included step at once as a single undoable batch → what `command.batch` /// returns, {results}. Step by Step and Pause For run the first step now, each as its own undo step, /// and leave the rest to [`tick_playback`] → {results: [the first step's result], pending: the steps -/// left}. While a paced playback is in progress, another action does not play. +/// left}. While a paced playback is in progress, another action does not play. An action with an +/// included step whose command is not known now ([`KnownCommands`]), a plug-in's command after the +/// plug-in was removed for one, does not play: the error names the first such step and its command, +/// and no step runs. An excluded step is not checked. /// /// An action with an included stop ([`STOP_STEP`]) plays up to the stop and waits there at any speed /// ([`continue_playback`]). At Accelerated, the steps between two stops are one undo step. → {results: @@ -240,6 +342,13 @@ pub fn play(app: &mut VectorcraftApp, set: usize, idx: usize) -> Result Result } } +/// The command that plays an action by its place in the panel ([`play_at`]). +pub const PLAY_AT: &str = "ui.action.playAt"; + +/// `ui.action.playAt {set, action}`: plays the action at index `action` of set `set` (0 is the top +/// set) at the Playback Options speed, as [`play`] does; a click on an action's button in Button +/// Mode runs this. A missing index, or one that is not a whole number or is past the last set or +/// action, is an error, and then nothing plays. → what [`play`] returns +pub fn play_at(app: &mut VectorcraftApp, p: &Value) -> Result { + let index = |k: &str| p.get(k).and_then(Value::as_u64).and_then(|i| usize::try_from(i).ok()); + let (set, at) = index("set").zip(index("action")).ok_or("no such action")?; + play(app, set, at) +} + +/// The command behind the panel menu's Button Mode ([`button_mode`]). +pub const BUTTON_MODE: &str = "ui.action.buttonMode"; + +/// `ui.action.buttonMode {enabled?}`: with `enabled: true` the Actions panel shows every action of +/// every set as a button in its color ([`Action::color`]) that plays the action when clicked, and +/// with `false` it shows its list of sets, actions and steps again; left out or null, it switches +/// to the other view. The view is kept with the UI preferences. Turning Button Mode on while an +/// action records is an error, and so is an `enabled` that is not true, false or null; then the +/// view does not change. → {enabled} +pub fn button_mode(app: &mut VectorcraftApp, p: &Value) -> Result { + let enabled = crate::menus::opt_bool(p, "enabled")?.unwrap_or(!app.ui.action_button_mode); + if enabled && !app.ui.action_button_mode && app.ui.recording.is_some() { + return Err("an action is already recording".into()); + } + app.ui.action_button_mode = enabled; + Ok(json!({ "enabled": enabled })) +} + /// The command that ends a recording ([`stop`]). pub const STOP_RECORDING: &str = "ui.action.stop"; @@ -2007,9 +2147,18 @@ pub fn duplicate(app: &mut VectorcraftApp, p: &Value) -> Result { /// The panel's (≡) menu. pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + // Button Mode is off while an action records, so the Stop button the list shows stays in reach. + let buttons = app.ui.action_button_mode; + if widgets::menu_item(ui, tl!("Button Mode"), buttons || app.ui.recording.is_none(), buttons) + && let Err(e) = app.run(BUTTON_MODE, json!({})) + { + app.status(e); + } + ui.separator(); // A selected action counts only while its set is the current one, as the panel shows it: a set - // deleted since leaves the stored pair pointing at another set's action. - let selected = pstate::>(ui.ctx(), "actions-selected").filter(|&(s, _)| app.ui.action_set == Some(s)); + // deleted since leaves the stored pair pointing at another set's action. Button Mode shows no + // selected action and no current set, so the items that act on them are off there. + let selected = pstate::>(ui.ctx(), "actions-selected").filter(|&(s, _)| !buttons && app.ui.action_set == Some(s)); let has = selected.and_then(|(s, a)| app.ui.action_sets.get(s).and_then(|set| set.actions.get(a))).is_some(); if widgets::menu_item(ui, tl!("New Action…"), crate::dialogs::action_new::can_open(app), false) && let Err(e) = crate::dialogs::action_new::open(app) @@ -2019,11 +2168,11 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut egui::Ui) { if widgets::menu_item(ui, tl!("New Set…"), true, false) { crate::dialogs::action_set_options::open_new(app); } - let current = app.ui.action_set.filter(|&s| s < app.ui.action_sets.len()); + let current = app.ui.action_set.filter(|&s| !buttons && s < app.ui.action_sets.len()); if widgets::menu_item(ui, tl!("Duplicate"), current.is_some(), false) { duplicate_selection(app, ui.ctx()); } - if widgets::menu_item(ui, tl!("Delete"), has || !selected_sets(app).is_empty(), false) { + if widgets::menu_item(ui, tl!("Delete"), has || (!buttons && !selected_sets(app).is_empty()), false) { delete_selection(app, ui.ctx()); } if widgets::menu_item(ui, tl!("Set Options…"), current.is_some(), false) @@ -2156,8 +2305,78 @@ enum InclusionChange { Step(usize, usize, usize, bool), } -/// Draw action sets, steps and playback controls, keeping the list above a pinned footer. +/// Button Mode ([`button_mode`]): every action of every set, in set order and then action order, +/// as a button with its name in its color ([`button_colors`]), with no set names, steps or +/// checkmarks. A click on a button, or Enter or Space on the focused one, plays the action +/// ([`PLAY_AT`]). The footer shows only while an action plays or records: Stop Playing/Recording, +/// and Play Current Selection while a playback waits at a stop. +fn show_buttons(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + let t = Tokens::get(ui.ctx()); + let mut play_req = None; + let list_height = widgets::panel_list_height(ui, 260.0, 0.0).min(260.0); + egui::ScrollArea::vertical().id_salt("actions-buttons").max_height(list_height).min_scrolled_height(list_height.min(64.0)).show(ui, |ui| { + for (si, set) in app.ui.action_sets.iter().enumerate() { + for (ai, a) in set.actions.iter().enumerate() { + let (r, resp) = ui.allocate_exact_size(egui::vec2(ui.available_width(), 24.0), egui::Sense::click()); + resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, true, &a.name)); + let (fill, text) = button_colors(a.color.as_deref(), &t); + let button = r.shrink2(egui::vec2(2.0, 1.0)); + ui.painter().rect_filled(button, 3.0, fill); + // The pointer over a button, or the keyboard focus on it, rings it in its text color. + let (width, ring) = if resp.hovered() || resp.has_focus() { (2.0, text) } else { (1.0, t.button_border) }; + ui.painter().rect_stroke(button, 3.0, egui::Stroke::new(width, ring), egui::StrokeKind::Inside); + ui.painter().with_clip_rect(button.shrink2(egui::vec2(6.0, 0.0))).text( + button.left_center() + egui::vec2(8.0, 0.0), + egui::Align2::LEFT_CENTER, + &a.name, + egui::FontId::proportional(12.5), + text, + ); + if resp.on_hover_text(&a.name).clicked() { + play_req = Some((si, ai)); + } + } + } + }); + if app.ui.action_sets.iter().all(|s| s.actions.is_empty()) { + dim_label(ui, tl!("No actions.")); + } + let waiting = waiting_at_stop(app); + if waiting { + dim_label(ui, tl!("Press Play Current Selection in the Actions panel to go on.")); + } + let recording = app.ui.recording.is_some(); + if recording || app.ui.action_playing.is_some() { + widgets::bottom_bar(ui, |ui| { + if widgets::icon_button(ui, "square", tl!("Stop Playing/Recording"), false, 24.0).clicked() + && let Err(e) = app.run(STOP_RECORDING, json!({})) + { + app.status(e); + } + if waiting + && widgets::icon_button(ui, "dc-actions", tl!("Play Current Selection"), false, 24.0).clicked() + && let Err(e) = app.run(CONTINUE_PLAYBACK, json!({})) + { + app.status(e); + } + if recording { + ui.label(egui::RichText::new(tl!("● Recording")).color(egui::Color32::from_rgb(0xe0, 0x30, 0x30))); + } + }); + } + if let Some((si, ai)) = play_req + && let Err(e) = app.run(PLAY_AT, json!({"set": si, "action": ai})) + { + app.status(e); + } +} + +/// Draw action sets, steps and playback controls, keeping the list above a pinned footer, or in +/// Button Mode the actions as buttons ([`show_buttons`]). pub fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui) { + if app.ui.action_button_mode { + return show_buttons(app, ui); + } let t = Tokens::get(ui.ctx()); // The selected action as (set, action). Read as the type it is stored as: egui keeps a // value per type, so reading the bare pair never found it and no action stayed selected (#1629). @@ -2672,6 +2891,186 @@ mod tests { assert_eq!(names(&app), before[1..], "nothing selected after a delete: nothing more goes"); } + /// The fills of the rectangles drawn in one headless frame of the panel. + fn drawn_fills(ctx: &egui::Context, app: &mut VectorcraftApp) -> Vec { + fn collect(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Rect(r) => out.push(r.fill), + egui::Shape::Vec(v) => v.iter().for_each(|s| collect(s, out)), + _ => {} + } + } + let mut output = ctx.run_ui(egui::RawInput::default(), |ui| show(app, ui)); + output.textures_delta.clear(); + let mut fills = vec![]; + output.shapes.iter().for_each(|c| collect(&c.shape, &mut fills)); + fills + } + + /// The panel menu's Button Mode switches the panel to buttons and back, with a check mark while + /// it is on; `ui.action.buttonMode` does the same, and the view is kept with the UI preferences. + /// Turning it on while an action records is refused, so Stop stays in reach. + #[test] + fn button_mode_switches_the_view_and_is_kept_with_the_preferences() { + use super::super::tests_appearance::{click, frame_events}; + let mut app = app_with_sets(); + assert!(!app.ui.action_button_mode, "the list is the default"); + let ctx = egui::Context::default(); + let item = |ctx: &egui::Context, app: &mut VectorcraftApp| { + let texts = frame_events(ctx, app, vec![], menu); + texts.into_iter().find(|(s, _)| s.trim_start_matches('✓').trim() == "Button Mode").expect("Button Mode in the menu") + }; + let (label, at) = item(&ctx, &mut app); + assert_eq!(label, " Button Mode", "no check mark while off"); + click(&ctx, &mut app, at.center(), menu); + assert!(app.ui.action_button_mode, "the menu item turns it on"); + assert_eq!(item(&ctx, &mut app).0, "✓ Button Mode", "a check mark while on"); + let at = item(&ctx, &mut app).1; + click(&ctx, &mut app, at.center(), menu); + assert!(!app.ui.action_button_mode, "choosing it again returns to the list"); + + assert_eq!(app.run(BUTTON_MODE, json!({})).unwrap(), json!({"enabled": true}), "left out: the other view"); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(), json!({"enabled": true})); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": "no"})).unwrap_err(), "`enabled` must be true or false"); + assert!(app.ui.action_button_mode, "a bad value keeps the view"); + let saved = serde_json::to_value(&app.ui).unwrap(); + assert_eq!(saved["action_button_mode"], json!(true)); + assert!(serde_json::from_value::(saved.clone()).unwrap().action_button_mode, "kept after a restart"); + let mut older = saved; + older.as_object_mut().unwrap().remove("action_button_mode"); + assert!(!serde_json::from_value::(older).unwrap().action_button_mode, "older preferences show the list"); + + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": null})).unwrap(), json!({"enabled": false})); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + app.run(START_RECORDING, json!({})).unwrap(); + assert_eq!(app.run(BUTTON_MODE, json!({})).unwrap_err(), "an action is already recording"); + let at = item(&ctx, &mut app).1; + click(&ctx, &mut app, at.center(), menu); + assert!(!app.ui.action_button_mode, "the menu item is off while an action records"); + assert_eq!(app.run(BUTTON_MODE, json!({"enabled": false})).unwrap(), json!({"enabled": false}), "turning it off is never refused"); + app.run(STOP_RECORDING, json!({})).unwrap(); + } + + /// Button Mode shows every action of every set by its name, in set order and then action order, + /// without set names, step counts or steps, each in its Action Options color; an action without + /// a color is an ordinary button. The menu items for a selected action or the current set are + /// off, since the view shows neither. + #[test] + fn button_mode_shows_every_action_as_a_button_in_its_color() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let mut app = app_with_sets(); + app.run(ACTION_OPTIONS, json!({"set": 1, "action": 0, "color": "red"})).unwrap(); + app.run(ACTION_OPTIONS, json!({"set": 1, "action": 1, "color": "yellow"})).unwrap(); + let ctx = egui::Context::default(); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Nudge").center(), show); + assert_eq!(pstate::>(&ctx, "actions-selected"), Some((1, 0)), "selected in the list"); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let texts = frame_events(&ctx, &mut app, vec![], show); + let names: Vec<&str> = texts.iter().map(|(s, _)| s.as_str()).collect(); + assert_eq!( + names, + [ + "Duplicate and Offset 10 pt", + "Unite and Simplify", + "Center on Artboard", + "Outline Text", + "Rotate 90° CW", + "Reflect Horizontal", + "Nudge", + "Nudge Again" + ], + "only the actions' names, in set and action order" + ); + let tops: Vec = texts.iter().map(|(_, r)| r.top()).collect(); + assert!(tops.windows(2).all(|w| w[0] < w[1]), "one button under the other: {tops:?}"); + let t = Tokens::get(&ctx); + let fills = drawn_fills(&ctx, &mut app); + for color in ["red", "yellow"] { + let fill = button_fill(color).unwrap(); + assert_eq!(fills.iter().filter(|f| **f == fill).count(), 1, "{color}: {fills:?}"); + } + assert_eq!(fills.iter().filter(|f| **f == t.button).count(), 6, "the six actions without a color: {fills:?}"); + for (color, _) in COLORS { + let (fill, text) = button_colors(Some(color), &t); + let (hi, lo) = (luminance(fill).max(luminance(text)), luminance(fill).min(luminance(text))); + assert!((hi + 0.05) / (lo + 0.05) >= 4.5, "{color}: its name is legible"); + } + assert_eq!(button_colors(None, &t), (t.button, t.text_strong)); + let menu_texts = frame_events(&ctx, &mut app, vec![], menu); + click(&ctx, &mut app, text_rect(&menu_texts, " Delete").center(), menu); + click(&ctx, &mut app, text_rect(&menu_texts, " Action Options…").center(), menu); + assert!(app.ui.dialog.is_none(), "Delete and Action Options… are off in Button Mode"); + assert_eq!(set_names(&app), ["Default Actions", "Mine", "Other"]); + assert_eq!(action_names(&app, 1), ["Nudge", "Nudge Again"], "the action selected in the list stays"); + } + + /// A click on a button plays that action at once, as one undo step at Accelerated, without its + /// excluded steps, which stay excluded; `ui.action.playAt` refuses an index that names no action. + #[test] + fn a_click_on_a_button_plays_its_action_without_its_excluded_steps() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let (mut app, x) = app_with_three_moves(); + app.run(INCLUDE_STEPS, json!({"set": 0, "action": 0, "step": 1, "included": false})).unwrap(); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let ctx = egui::Context::default(); + let texts = frame_events(&ctx, &mut app, vec![], show); + let undo = undo_steps(&app); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert_eq!((x(&app), undo_steps(&app)), (5.0, undo + 1), "1 and 4 pt as one undo step; the 2 pt step is skipped"); + assert_eq!(app.ui.action_sets[0].actions[0].excluded_steps, BTreeSet::from([1]), "the exclusion stays"); + for (p, want) in [ + (json!({"set": 0, "action": 1}), "no such action"), + (json!({"set": 1, "action": 0}), "no such action"), + (json!({"set": "0", "action": 0}), "no such action"), + (json!({"set": 0}), "no such action"), + ] { + assert_eq!(app.run(PLAY_AT, p.clone()).unwrap_err(), want, "{p}"); + } + assert_eq!(x(&app), 5.0, "nothing more played"); + app.run(PLAY_AT, json!({"set": 0, "action": 0})).unwrap(); + assert_eq!(x(&app), 10.0); + } + + /// Button Mode shows no bottom bar while nothing plays or records. While an action plays step by + /// step its Stop Playing/Recording button ends the playback, and while one waits at a stop its + /// Play Current Selection button plays on. + #[test] + fn button_mode_shows_stop_and_continue_only_while_an_action_plays() { + use super::super::tests_appearance::{click, frame_events, text_rect}; + let bar = |ctx: &egui::Context, app: &mut VectorcraftApp| { + frame_events(ctx, app, vec![], show); + let mut bar = crate::toolbar::tests::widget_rects(ctx, egui::vec2(24.0, 24.0)); + bar.sort_by(|a, b| a.left().total_cmp(&b.left())); + // A button can be listed more than once in a pass. + bar.dedup(); + bar + }; + let (mut app, x) = app_with_three_moves(); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + app.run(PLAYBACK_OPTIONS, json!({"speed": "step"})).unwrap(); + let ctx = egui::Context::default(); + assert_eq!(bar(&ctx, &mut app), [], "no bottom bar while idle"); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert_eq!(x(&app), 1.0, "the first step played"); + let [stop] = bar(&ctx, &mut app)[..] else { panic!("only Stop while it plays") }; + click(&ctx, &mut app, stop.center(), show); + assert!(app.ui.action_playing.is_none(), "Stop ends the playback"); + assert_eq!(x(&app), 1.0); + + let (mut app, x) = app_with_a_stop(true); + app.run(BUTTON_MODE, json!({"enabled": true})).unwrap(); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "Three Moves").center(), show); + assert!(waiting_at_stop(&app)); + assert_eq!(x(&app), 1.0, "played up to the stop"); + let [_, play] = bar(&ctx, &mut app)[..] else { panic!("Stop and Play Current Selection at a stop") }; + click(&ctx, &mut app, play.center(), show); + assert!(app.ui.action_playing.is_none()); + assert_eq!(x(&app), 7.0, "Play Current Selection plays on"); + } + /// #3712: Create New Set asks for a name (Set 1 when free), the new set is the current one, so a /// recording goes into it, and a click on another set's name makes that one current. The sets /// are saved with the UI preferences. @@ -3582,6 +3981,112 @@ mod tests { assert_eq!(set_names(&app), before, "no set added"); } + /// A step whose command is not known loads as it is, excluded or not and in a `command.batch` + /// step too, from `data` and from `path`: the answer lists each one and the status bar names the + /// first and how many there are. A set whose commands are all known loads with neither. + #[test] + fn load_actions_reports_steps_with_unknown_commands() { + let mut app = app_with_sets(); + let files = with_files(&mut app, "/sets/unused.vcactions"); + let batch = json!({"commands": [{"command": "object.move", "params": {"dx": 1, "dy": 0}}, {"command": "example.unknown.inner"}]}); + let export = json!([ + {"command": "object.move", "params": {"dx": 1, "dy": 0}}, + {"command": "view.zoomIn", "params": {}}, + {"command": STOP_STEP, "params": {"message": "", "allowContinue": false}}, + {"command": "example.unknown.finish", "params": {"x": [1, 2]}}, + {"command": "command.batch", "params": batch}, + {"command": "example.unknown.off", "params": {}, "excluded": true}, + ]); + let tidy = json!({"name": "Tidy", "steps": [{"command": "object.move", "params": {"dx": 1, "dy": 0}}]}); + let file = json!({"format": "vcactions", "version": 6, "name": "Print", "actions": [tidy, {"name": "Export", "steps": export}]}).to_string(); + let want = json!([ + {"action": "Export", "actionIndex": 1, "step": 4, "stepIndex": 3, "command": "example.unknown.finish"}, + {"action": "Export", "actionIndex": 1, "step": 5, "stepIndex": 4, "batchStep": 2, "command": "example.unknown.inner"}, + {"action": "Export", "actionIndex": 1, "step": 6, "stepIndex": 5, "command": "example.unknown.off"}, + ]); + let r = app.run(LOAD_SET, json!({"data": file})).unwrap(); + assert_eq!(r, json!({"set": 3, "name": "Print", "actions": 2, "unknownCommands": want, "unknownCount": 3})); + assert_eq!( + app.ui.status, + "Loaded “Print”: 3 steps have unknown commands and were kept; the first: “Export”, step 4, `example.unknown.finish`" + ); + let loaded = &app.ui.action_sets[3].actions[1]; + assert_eq!(loaded.steps.len(), 6, "every step is kept"); + assert_eq!(loaded.steps[3], ("example.unknown.finish".to_string(), json!({"x": [1, 2]})), "with its params"); + assert_eq!(loaded.excluded_steps, BTreeSet::from([5])); + files.borrow_mut().insert("/sets/Print.vcactions".into(), file.into_bytes()); + let r = app.run(LOAD_SET, json!({"path": "/sets/Print.vcactions"})).unwrap(); + assert_eq!((r["name"].clone(), r["unknownCommands"].clone(), r["unknownCount"].clone()), (json!("Print 2"), want, json!(3))); + let saved = files::write_set(&app.ui.action_sets[4]); + assert!(saved.contains("example.unknown.finish") && saved.contains("example.unknown.inner"), "Save Actions… writes them back"); + app.ui.status.clear(); + let known = files::write_set(&app.ui.action_sets[1]); + assert_eq!(app.run(LOAD_SET, json!({"data": known})).unwrap(), json!({"set": 5, "name": "Mine 2", "actions": 2})); + assert_eq!(app.ui.status, "", "no message for a set whose commands are all known"); + let empty = json!({"format": "vcactions", "version": 1, "name": "Empty", "actions": []}).to_string(); + assert_eq!(app.run(LOAD_SET, json!({"data": empty})).unwrap(), json!({"set": 6, "name": "Empty", "actions": 0})); + assert_eq!(app.ui.status, ""); + } + + /// Load Actions… lists the first 1,000 steps with an unknown command and counts them all, and + /// the status bar shows an action name or command id with no control character and at most 80 + /// characters, while the set and the answer keep them as they are. One step is named in the + /// singular. + #[test] + fn load_actions_bounds_what_it_reports_of_unknown_commands() { + let mut app = app_with_sets(); + let steps = vec![json!({"command": "example.unknown"}); 1001]; + let many = json!({"format": "vcactions", "version": 1, "name": "Many", "actions": [{"name": "A", "steps": steps}]}); + let r = app.run(LOAD_SET, json!({"data": many.to_string()})).unwrap(); + assert_eq!((r["unknownCommands"].as_array().map(Vec::len), r["unknownCount"].clone()), (Some(1000), json!(1001))); + assert_eq!(r["unknownCommands"][999], json!({"action": "A", "actionIndex": 0, "step": 1000, "stepIndex": 999, "command": "example.unknown"})); + let (name, id) = ("Odd\u{1b}[31m\nname", format!("example.\r\n{}", "x".repeat(200))); + let odd = json!({"format": "vcactions", "version": 1, "name": "Odd", "actions": [{"name": name, "steps": [{"command": id}]}]}); + let r = app.run(LOAD_SET, json!({"data": odd.to_string()})).unwrap(); + assert_eq!((r["unknownCommands"][0]["action"].clone(), r["unknownCommands"][0]["command"].clone()), (json!(name), json!(id))); + assert_eq!(app.ui.action_sets.last().unwrap().actions[0].steps[0].0, id, "the set keeps the id"); + let shown_id = format!("example.\u{fffd}\u{fffd}{}…", "x".repeat(70)); + assert_eq!( + app.ui.status, + format!("Loaded “Odd”: 1 step has an unknown command and was kept: “Odd\u{fffd}[31m\u{fffd}name”, step 1, `{shown_id}`") + ); + } + + /// An action with an included step whose command is not known does not play at any speed: no + /// step runs, and the error names the step, a `command.batch` step's command by its place in + /// the batch too. An excluded step with an unknown command does not stop it. + #[test] + fn an_action_with_an_unknown_command_does_not_play() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 200, "height": 100})).unwrap(); + let id = vectorcraft_doc::NodeId( + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(), + ); + app.run("select.set", json!({"ids": [id.0]})).unwrap(); + let step = || ("object.move".to_string(), json!({"dx": 5, "dy": 0})); + let inner = json!({"commands": [{"command": "object.move", "params": {"dx": 5, "dy": 0}}, {"command": "example.unknown.inner"}]}); + app.ui.action_sets = vec![ActionSet::new( + "Test", + vec![ + Action::new("Move", vec![step(), ("example.unknown.finish".into(), json!({})), step()]), + Action::new("Batch", vec![step(), ("command.batch".into(), inner)]), + ], + )]; + let x = |app: &VectorcraftApp| app.session.active().unwrap().doc.node(id).unwrap().geometric_bounds().unwrap().x0; + let before = x(&app); + for speed in [PlaybackSpeed::Accelerated, PlaybackSpeed::Step] { + app.ui.action_playback.speed = speed; + assert_eq!(play(&mut app, 0, 0).unwrap_err(), "step 2 of “Move” runs the unknown command `example.unknown.finish`"); + assert_eq!(play(&mut app, 0, 1).unwrap_err(), "step 2.2 of “Batch” runs the unknown command `example.unknown.inner`"); + assert_eq!(x(&app), before, "no step ran"); + assert!(app.ui.action_playing.is_none()); + } + app.ui.action_playback.speed = PlaybackSpeed::Accelerated; + app.ui.action_sets[0].actions[0].excluded_steps.insert(1); + play(&mut app, 0, 0).unwrap(); + assert!((x(&app) - before - 10.0).abs() < 1e-9, "both included moves ran"); + } + /// Where the host can read part of a file, Load Actions… reads one byte past 8 MiB: a larger /// file is refused without reading all of it, and a smaller one loads. #[test] @@ -4761,7 +5266,9 @@ mod tests { fn a_failing_step_ends_a_paced_playback_with_its_error() { let (mut app, x) = app_with_three_moves(); app.run(PLAYBACK_OPTIONS, json!({"speed": "step"})).unwrap(); - app.ui.action_sets[0].actions[0].steps[1] = ("no.such.command".into(), json!({})); + // A Select Object step that finds no object fails as it plays. + app.ui.action_sets[0].actions[0].steps[1] = + (SELECT_OBJECT_STEP.into(), json!({"note": "missing", "caseSensitive": false, "wholeWord": false})); play(&mut app, 0, 0).unwrap(); assert_eq!(frame(&mut app, 0.0), None, "the frame after Play draws the first step"); assert_eq!(frame(&mut app, 0.0), None); @@ -5709,10 +6216,10 @@ mod tests { } } - /// A drag with the Selection tool (a committed preview) or the Rectangle tool (a command the - /// tool runs) that takes a recording past 10,000 steps keeps its edit and the journal, the - /// status bar names the limit as the tool ends, and Stop Playing/Recording keeps the 10,000 - /// steps that fit. One that fills the action exactly names no limit. + /// A drag with the Selection tool or the Rectangle tool (each commits its preview) that takes a + /// recording past 10,000 steps keeps its edit and the journal, the status bar names the limit + /// as the tool ends, and Stop Playing/Recording keeps the 10,000 steps that fit. One that fills + /// the action exactly names no limit. #[test] fn tool_commit_checks_recording_step_limit() { let steps = "the action already has 10,000 steps"; @@ -5765,6 +6272,115 @@ mod tests { } } + /// Drags the Enclosing Lasso away from the selected rectangle, which runs `select.set` with no + /// objects, and checks that the tool journaled that one step and cleared the selection. + fn lasso_nothing(app: &mut VectorcraftApp) { + app.select_tool(vectorcraft_tools::addons::enclosing_lasso::ID); + assert_eq!(app.session.tool_id(), vectorcraft_tools::addons::enclosing_lasso::ID); + assert!(!app.session.active().unwrap().selection.objects.is_empty()); + let journal = app.session.journal.len(); + tool_drag(app, (100.0, 80.0), (120.0, 80.0)); + assert_eq!(app.session.journal.len(), journal + 1, "the tool journals one step"); + assert_eq!(app.session.journal.last(), Some(&("select.set".to_string(), json!({"ids": []})))); + assert!(app.session.active().unwrap().selection.objects.is_empty(), "the edit stays"); + } + + /// A command a tool runs (the Enclosing Lasso's `select.set`) that takes a recording past + /// 10,000 steps keeps its edit and the journal, the status bar names the limit as the tool + /// ends, the next recorded command does not run, and Stop Playing/Recording keeps the 10,000 + /// steps that fit. One that fills the action exactly names no limit. + #[test] + fn tool_exec_checks_recording_step_limit() { + let steps = "the action already has 10,000 steps"; + for filler in [files::MAX_ACTION_STEPS, files::MAX_ACTION_STEPS - 1] { + let (mut app, _) = app_with_three_moves(); + recording_with(&mut app, filler); + app.ui.status.clear(); + lasso_nothing(&mut app); + if filler < files::MAX_ACTION_STEPS { + assert_eq!(app.ui.status, "", "10,000 steps fit"); + continue; + } + assert_eq!(app.ui.status, steps, "the status bar names the limit now"); + assert!(app.ui.recording.is_some(), "the recording goes on"); + let (journal, art) = (app.session.journal.len(), app.session.active().unwrap().doc.art_bounds()); + let r = app.run("shape.rectangle", json!({"x": 50, "y": 50, "width": 20, "height": 20})); + assert_eq!(r.unwrap_err(), steps, "no later command runs"); + assert_eq!(app.session.journal.len(), journal); + assert_eq!(app.session.active().unwrap().doc.art_bounds(), art, "no rectangle is drawn"); + assert_eq!(app.session.journal.since(recording_start(&app).unwrap()).len(), files::MAX_ACTION_STEPS + 1, "the journal keeps the step"); + app.run(STOP_RECORDING, json!({})).unwrap(); + assert_eq!(app.ui.action_sets[0].actions.last().unwrap().steps.len(), files::MAX_ACTION_STEPS); + } + } + + /// A command a tool runs (the Enclosing Lasso's `select.set`) whose step gives the recording's + /// set a file larger than 8 MiB keeps its edit, the status bar names the limit as the tool + /// ends, and Stop Playing/Recording leaves the step out of a set that Load Actions… reads. + #[test] + fn tool_exec_checks_recording_byte_limit() { + let size = "the action set would be larger than 8 MiB"; + let (mut app, _) = app_with_three_moves(); + app.run(START_RECORDING, json!({})).unwrap(); + let pad = |n: usize| ("object.move".to_string(), json!({"dx": 1, "dy": 0, "pad": "x".repeat(n)})); + app.ui.action_sets[0].actions[0].steps = vec![pad(0)]; + let room = files::MAX_SET_FILE - files::write_set(&app.ui.action_sets[0]).len(); + app.ui.action_sets[0].actions[0].steps = vec![pad(room)]; + app.ui.recording_into = Some(app.ui.action_sets[0].actions[0].id); + app.ui.status.clear(); + lasso_nothing(&mut app); + assert_eq!(app.ui.status, size, "the status bar names the limit now"); + assert_eq!(app.session.journal.since(recording_start(&app).unwrap()).len(), 1, "the journal keeps the step"); + app.run(STOP_RECORDING, json!({})).unwrap(); + assert_eq!(app.ui.action_sets[0].actions[0].steps.len(), 1, "the step is left out"); + let saved = files::write_set(&app.ui.action_sets[0]); + assert!(saved.len() <= files::MAX_SET_FILE); + assert!(files::read_set(&saved, "Test").is_ok()); + } + + /// The place cursor's `file.place` that takes a recording past 10,000 steps keeps the placed + /// file and the journal, and the status bar names the limit once the file is placed: on the + /// release when the file is read at once, and on the frame that places it when it is read off + /// the UI thread. Stop Playing/Recording keeps the 10,000 steps that fit. + #[test] + fn place_cursor_exec_checks_recording_step_limit_on_completion() { + let steps = "the action already has 10,000 steps"; + let mut png = vec![]; + image::RgbImage::new(8, 8).write_to(&mut std::io::Cursor::new(&mut png), image::ImageFormat::Png).unwrap(); + let placed = |app: &VectorcraftApp| { + let st = app.session.active().unwrap(); + st.doc.layers.iter().flat_map(|l| l.children().into_iter().flatten()).filter(|n| n.name.as_deref() == Some("a.png")).count() + }; + for background in [false, true] { + let (mut app, _) = app_with_three_moves(); + app.placing.off_the_ui_thread = background; + app.run("file.place.queue", json!({"files": [{"name": "a.png", "dataBase64": vectorcraft_format::base64_encode(&png)}]})).unwrap(); + assert_eq!(app.session.tool_id(), "place"); + recording_with(&mut app, files::MAX_ACTION_STEPS); + app.ui.status.clear(); + let journal = app.session.journal.len(); + tool_drag(&mut app, (40.0, 40.0), (80.0, 80.0)); + if background { + assert_eq!(app.session.journal.len(), journal, "the release places nothing yet"); + assert_eq!(placed(&app), 0); + assert_ne!(app.ui.status, steps, "nothing is checked before the file is placed"); + app.placing.wait_for_reads(); + let ctx = egui::Context::default(); + app.begin_host_iteration(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| app.tick(ui.ctx())); + out.textures_delta.clear(); + assert!(app.placing.pending.is_empty(), "the frame after the read places the file"); + } + assert_eq!(app.session.journal.len(), journal + 1, "background {background}: the place journals one step"); + assert_eq!(app.session.journal.last().map(|(c, _)| c.as_str()), Some("file.place")); + assert_eq!(placed(&app), 1, "background {background}: the placed file stays"); + assert_eq!(app.ui.status, steps, "background {background}: the status bar names the limit once the file is placed"); + assert!(app.ui.recording.is_some(), "the recording goes on"); + app.run(STOP_RECORDING, json!({})).unwrap(); + assert_eq!(app.ui.action_sets[0].actions.last().unwrap().steps.len(), files::MAX_ACTION_STEPS, "background {background}"); + } + } + /// A step that reaches the journal outside a command, as a panel's or a dialog's commit does, is /// checked on the app's next frame. A journal rewrite that makes a checked step larger is /// checked again, and a frame with no new step does not name the limit again. diff --git a/crates/ui-egui/src/panels/actions/files.rs b/crates/ui-egui/src/panels/actions/files.rs index b5805f9b2a..0d19a0bf2b 100644 --- a/crates/ui-egui/src/panels/actions/files.rs +++ b/crates/ui-egui/src/panels/actions/files.rs @@ -41,7 +41,8 @@ pub(super) const MAX_SET_ACTIONS: usize = 1000; /// The most steps [`read_set`] reads in one action. pub(super) const MAX_ACTION_STEPS: usize = 10_000; -/// The most left-out steps that Load Actions… lists for an action set another app saved. +/// The most left-out steps that Load Actions… lists for an action set another app saved, and the +/// most steps with an unknown command it lists for an action set file. const MAX_SKIPPED: usize = 1000; /// An action set file: a header, the set's name and its actions. @@ -488,6 +489,11 @@ fn load_aia(app: &mut VectorcraftApp, params: Value) -> Result { /// Actions… would write as a file Load Actions… refuses (larger than 8 MiB, as a file with less /// white space or a name that gets a number can give) is refused too, and no set is added. /// +/// A step whose command is not known now ([`super::KnownCommands`]), excluded or not, and a command +/// of a `command.batch` step that is not, still loads as it is. The answer then also lists them, +/// and the status bar names the first and how many there are → `{…, unknownCommands: [{action, +/// actionIndex, step, stepIndex, batchStep?, command}] (at most 1,000), unknownCount: n}`. +/// /// An action set another app saved as text (`.aia`, read with `actionSet.read`) comes in with its /// actions and the steps that stand for a VectorCraft command ([`step_name`], [`step_commands`]), /// with no params; a step that is off in the file is excluded from playback. A set with no name is @@ -537,7 +543,47 @@ pub fn load_set(app: &mut VectorcraftApp, p: &Value) -> Result { set.name = free_set_name(&app.ui.action_sets, &set.name); // A number added to the name can make a file at the limit larger than it. super::edit_keeps_set_loadable(app, None, &set)?; + let (unknown, unknown_count, first) = unknown_commands(&set); let (name, actions) = (set.name.clone(), set.actions.len()); app.ui.action_sets.push(set); - Ok(json!({ "set": app.ui.action_sets.len() - 1, "name": name, "actions": actions })) + let mut answer = json!({ "set": app.ui.action_sets.len() - 1, "name": name, "actions": actions }); + if let Some((action, step, command)) = first { + app.status(crate::i18n::msg_n( + unknown_count as u64, + "Loaded “{name}”: {n} step has an unknown command and was kept: “{action}”, step {step}, `{command}`", + "Loaded “{name}”: {n} steps have unknown commands and were kept; the first: “{action}”, step {step}, `{command}`", + &[ + ("name", &super::shown_text(&name)), + ("action", &super::shown_text(&action)), + ("step", &step), + ("command", &super::shown_text(&command)), + ], + )); + answer["unknownCommands"] = json!(unknown); + answer["unknownCount"] = json!(unknown_count); + } + Ok(answer) +} + +/// The steps of `set` whose command is not known now ([`super::KnownCommands`]), excluded steps +/// included: the first [`MAX_SKIPPED`] as `[{action, actionIndex, step, stepIndex, batchStep?, +/// command}]` (`step` and `batchStep` count from 1, the indexes from 0), how many there are, and the +/// first one's action name, place ([`super::step_place`]) and command. +fn unknown_commands(set: &ActionSet) -> (Vec, usize, Option<(String, String, String)>) { + let known = super::KnownCommands::now(); + let (mut listed, mut count, mut first) = (vec![], 0usize, None); + for (a, action) in set.actions.iter().enumerate() { + for (step, in_batch, command) in action.unknown_commands(&known, false) { + count += 1; + first.get_or_insert_with(|| (action.name.clone(), super::step_place(step, in_batch), command.to_string())); + if listed.len() < MAX_SKIPPED { + let mut entry = json!({ "action": action.name, "actionIndex": a, "step": step + 1, "stepIndex": step, "command": command }); + if let Some(j) = in_batch { + entry["batchStep"] = json!(j + 1); + } + listed.push(entry); + } + } + } + (listed, count, first) } diff --git a/crates/ui-egui/src/panels/character.rs b/crates/ui-egui/src/panels/character.rs index 44ae643e86..d003fbcbce 100644 --- a/crates/ui-egui/src/panels/character.rs +++ b/crates/ui-egui/src/panels/character.rs @@ -2,6 +2,7 @@ //! scale, baseline shift, character rotation, the anti-aliasing method and the All Caps, Small Caps, //! Superscript, Subscript, Underline and Strikethrough toggles and the Language menu. +use std::collections::HashSet; use std::sync::{Mutex, OnceLock}; use egui::{Key, Ui, vec2}; @@ -25,6 +26,8 @@ pub const SCALE_PRESETS: [f64; 8] = [25.0, 50.0, 75.0, 90.0, 100.0, 110.0, 125.0 /// Insert Aki Left and Right presets, in thousandths of an em: none, a quarter, half and a whole /// full-width space. pub const AKI_PRESETS: [f64; 4] = [0.0, 250.0, 500.0, 1000.0]; +/// Tsume presets, in percent. +pub const TSUME_PRESETS: [f64; 5] = [0.0, 25.0, 50.0, 75.0, 100.0]; /// The stored character style: the selected range's (or the caret's) while the Type /// tool edits text, else the first selected text object's first run (including groups). With it, the paragraph @@ -99,8 +102,8 @@ pub(crate) fn shared_text_flag(app: &VectorcraftApp, f: impl Fn(&vectorcraft_doc } /// `f` of the character styles the panels act on: the runs the Type tool's selection covers (the -/// caret's style at a caret), else every run of the selected type, groups' included. `None` (a -/// blank field) where they differ, or with no type. +/// caret's style at a caret), else every run of every frame of the selected stories +/// ([`selected_stories`]). `None` (a blank field) where they differ, or with no type. pub(crate) fn shared(app: &VectorcraftApp, f: impl Fn(&CharStyle) -> T) -> Option { shared_styles(app, |_, _, style, _| Some(f(style))) } @@ -162,12 +165,8 @@ fn shared_styles( None => each_paragraph_run(t, Some((a, b)), |para, style, inline| acc.add(f(t, para, style, inline))), } } else { - for n in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { - n.walk(&mut |c| { - if let NodeKind::Text(t) = &c.kind { - each_paragraph_run(t, None, |para, style, inline| acc.add(f(t, para, style, inline))); - } - }); + for t in selected_story_texts(app) { + each_paragraph_run(t, None, |para, style, inline| acc.add(f(t, para, style, inline))); } } acc.value().flatten() @@ -243,9 +242,12 @@ pub(crate) fn format(app: &mut VectorcraftApp, p: Value) { /// [`format`] that returns the command's result: `text.setRangeStyle` on the range the Type tool /// has selected (the whole text when nothing is selected) while it edits text, else -/// `text.setFormat` on the selected text objects. +/// `text.setFormat` on the selected stories ([`selected_stories`]). pub(crate) fn run_format(app: &mut VectorcraftApp, mut p: Value) -> Result { - let Some((id, a, b)) = text_editing(app) else { return app.run("text.setFormat", p) }; + let Some((id, a, b)) = text_editing(app) else { + target_selected_stories(app, &mut p); + return app.run("text.setFormat", p); + }; if let Some(first) = text_story(app).and_then(|story| story.first().copied()) { return story_style(app, first, p); } @@ -283,9 +285,11 @@ pub(crate) fn shared_warichu(app: &VectorcraftApp) -> SharedWarichu { } /// Apply character attributes: to the selected range while the Type tool edits text (the whole -/// object when nothing is selected), else to the selected text objects. -fn char_cmd(app: &mut VectorcraftApp, cmd: &str, p: Value) { +/// object when nothing is selected), else to every frame of the selected stories +/// ([`selected_stories`]). +fn char_cmd(app: &mut VectorcraftApp, cmd: &str, mut p: Value) { if text_editing(app).is_none() { + target_selected_stories(app, &mut p); app.run(cmd, p).ok(); return; } @@ -546,6 +550,55 @@ pub(crate) fn text_story(app: &VectorcraftApp) -> Option> { (ids.len() >= 2).then_some(ids) } +/// The type objects the panels act on with the Selection tool: the selected type objects and those +/// in selected groups, each with every frame of its threaded story (locked and hidden frames +/// included), each once, the frames of a story in thread order. +pub(crate) fn selected_stories(app: &VectorcraftApp) -> Vec { + let Some(st) = app.session.active() else { return Vec::new() }; + let mut frames = Vec::new(); + let mut taken = HashSet::new(); + for selected in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { + selected.walk(&mut |child| { + if matches!(child.kind, NodeKind::Text(_)) && !taken.contains(&child.id) { + for id in st.doc.story_of(child.id) { + if taken.insert(id) { + frames.push(id); + } + } + } + }); + } + frames +} + +/// The type objects of [`selected_stories`]. +pub(crate) fn selected_story_texts(app: &VectorcraftApp) -> Vec<&vectorcraft_doc::TextObject> { + let Some(st) = app.session.active() else { return Vec::new() }; + selected_stories(app) + .into_iter() + .filter_map(|id| match st.doc.node(id).map(|n| &n.kind) { + Some(NodeKind::Text(t)) => Some(t.as_ref()), + _ => None, + }) + .collect() +} + +/// Give the command parameters `p` the `ids` of [`selected_stories`], so a command run with the +/// Selection tool sets every frame of each selected story. `p` stays as it is when it names its +/// targets, with no type selected, and while an object of a symbol instance's art is selected, +/// which the commands refuse. +pub(crate) fn target_selected_stories(app: &VectorcraftApp, p: &mut Value) { + if p.get("ids").is_some() || p.get("id").is_some() || app.session.active().is_none_or(|st| st.selection.symbol_part.is_some()) { + return; + } + let ids = selected_stories(app); + if let Some(params) = p.as_object_mut() + && !ids.is_empty() + { + params.insert("ids".into(), json!(ids.iter().map(|id| id.0).collect::>())); + } +} + /// `text.setRangeStyle` with `p` on all the text of every frame of the story that `first` is a /// frame of, as one undo step. fn story_style(app: &mut VectorcraftApp, first: NodeId, mut p: Value) -> Result { @@ -795,7 +848,7 @@ fn cell(ui: &mut Ui, label: &str, tip: &str, add: impl FnOnce(&mut Ui)) { /// The Character panel's grid of fields, `w` wide: Font Size, Leading, Kerning and Tracking, /// then with `more` the scales, Baseline Shift and Character Rotation, and a row with the /// Anti-aliasing Method dropdown under Character Rotation (`s`: the style shown), and with Show East -/// Asian Options on a row with Insert Aki Left and Right. With Show Font +/// Asian Options on a row with Insert Aki Left and Right and a row with Tsume. With Show Font /// Height Options on, a row under Font Size holds the Set Font Height Reference dropdown. The /// Properties panel shows its first rows. pub(crate) fn metrics_grid(app: &mut VectorcraftApp, ui: &mut Ui, id: &str, s: &CharStyle, w: f32, more: bool) { @@ -891,6 +944,14 @@ pub(crate) fn metrics_grid(app: &mut VectorcraftApp, ui: &mut Ui, id: &str, s: & }); } ui.end_row(); + // Tsume: the share of the blank space beside each character's ink taken away. + cell(ui, "→A←", tl!("Tsume"), |ui| { + if let Some(v) = widgets::spin_plain(ui, "ch-tsume", shared(app, |s| s.tsume), "%", 1, fw, 1.0, 0.0, &TSUME_PRESETS) { + // The field stops at the largest value the command takes. + format(app, json!({ "tsume": v.min(vectorcraft_doc::text::MAX_TSUME) })); + } + }); + ui.end_row(); } }); } @@ -910,7 +971,8 @@ fn anti_alias_method(app: &mut VectorcraftApp, ui: &mut Ui, width: f32) { } /// The anti-aliasing method of the type objects the panel acts on: the one the Type tool edits, -/// else the selected type (groups' included). `None` where they differ, or with no type. +/// else every frame of the selected stories ([`selected_stories`]). `None` where they differ, or +/// with no type. fn shared_anti_alias(app: &VectorcraftApp) -> Option { let st = app.session.active()?; let mut acc = Shared::None; @@ -921,12 +983,8 @@ fn shared_anti_alias(app: &VectorcraftApp) -> Option { } } None => { - for n in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { - n.walk(&mut |c| { - if let NodeKind::Text(t) = &c.kind { - acc.add(t.anti_alias); - } - }); + for t in selected_story_texts(app) { + acc.add(t.anti_alias); } } } @@ -934,12 +992,14 @@ fn shared_anti_alias(app: &VectorcraftApp) -> Option { } /// Set the anti-aliasing method `m` of the frame the Type tool edits, whatever part of its text -/// is selected, else the selected type objects (`text.setFormat {antiAlias}`). +/// is selected, else every frame of the selected stories (`text.setFormat {antiAlias}`). fn set_anti_alias(app: &mut VectorcraftApp, m: TypeAntiAlias) { let mut p = json!({"antiAlias": m.id()}); if let Some((id, _, _)) = text_editing(app) { end_typing(app); p["ids"] = json!([id.0]); + } else { + target_selected_stories(app, &mut p); } app.run("text.setFormat", p).ok(); } @@ -1160,25 +1220,49 @@ fn axes_cmd(app: &mut VectorcraftApp, axes: Value, phase: widgets::Live) { } super::live_run(app, "Character", "text.setRangeStyle", q, phase); } - None => super::live_run(app, "Character", "text.setFormat", json!({ "fontAxes": axes }), phase), + None => { + let mut p = json!({ "fontAxes": axes }); + target_selected_stories(app, &mut p); + super::live_run(app, "Character", "text.setFormat", p, phase); + } } } /// The Control bar's type controls while type is selected or edited: the Character link (the -/// Character panel in a popover), the font family and style menus and the Font Size combo. -pub(crate) fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui) { - let Some((s, _)) = text_style(app) else { return }; - let link = ui - .link(egui::RichText::new(tl!("Character:")).size(12.0).color(Tokens::get(ui.ctx()).text).underline()) - .on_hover_text(tl!("Character options")); +/// Character panel in a popover), the font family and style menus and the Font Size combo. They +/// show whole, with `reserve` left after them, or not at all: it returns false when type is selected +/// or edited and the row has no room for them. +pub(crate) fn control_bar(app: &mut VectorcraftApp, ui: &mut Ui, reserve: f32) -> bool { + let Some((s, _)) = text_style(app) else { return true }; + if ui.available_width() < control_bar_width(ui) + reserve { + return false; + } + let link = ui.link(control_bar_link_text(ui)).on_hover_text(tl!("Character options")); widgets::popover(&link, link.clicked(), |ui| { ui.set_width(260.0); show_owned(app, ui, crate::font_menu::WheelOwner::ControlPopover(link.id)); }); - font_pickers(app, ui, &s, ("cb-font", "cb-font-style"), (150.0, 96.0)); - size_field(app, ui, "cb-font-size", 96.0); + let [family, style, size] = CONTROL_BAR_WIDTHS; + font_pickers(app, ui, &s, ("cb-font", "cb-font-style"), (family, style)); + size_field(app, ui, "cb-font-size", size); ui.add_space(4.0); crate::chrome::group_separator(ui); + true +} + +/// The Control bar's widths of the font family menu, the font style dropdown and the Font Size combo. +const CONTROL_BAR_WIDTHS: [f32; 3] = [150.0, 96.0, 96.0]; + +/// The text of the Control bar's Character link, as [`control_bar`] draws it. +fn control_bar_link_text(ui: &Ui) -> egui::RichText { + egui::RichText::new(tl!("Character:")).size(12.0).color(Tokens::get(ui.ctx()).text).underline() +} + +/// The room [`control_bar`]'s link, menus and Font Size combo take in the Control bar's row, with +/// the spacing after each. +fn control_bar_width(ui: &Ui) -> f32 { + let spacing = ui.spacing().item_spacing.x; + widgets::text_width(ui, control_bar_link_text(ui)) + CONTROL_BAR_WIDTHS.iter().sum::() + 4.0 * spacing } /// The Contextual Task Bar's widths of the font family menu, the font style dropdown and the @@ -1612,7 +1696,7 @@ fn fractional_widths_on(app: &VectorcraftApp) -> bool { /// and Small Caps off, the normal position (neither superscript nor subscript), Roman Baseline /// character alignment, Proportional Metrics, Tate-chu-yoko, Warichu, Standard Vertical Roman Alignment and /// No Break off, Tate-chu-yoko Settings Up/Down and Left/Right 0, the default Warichu Settings (2 lines, no -/// line gap, 50%, Auto alignment), Insert Aki Left and Right 0, the Default character direction, +/// line gap, 50%, Auto alignment), Insert Aki Left and Right 0, Tsume 0, the Default character direction, /// Kashidas on, the Default digits and the Em Box font height reference, whether or not Show East Asian /// Options, Show Indic Options and Show Font Height Options are on. Inside an undo group that is /// already open, the reset is part of that group's step. @@ -1632,7 +1716,7 @@ fn reset_panel(app: &mut VectorcraftApp) { "allCaps": false, "smallCaps": d.small_caps.is_some(), "position": d.position.id(), "charAlign": d.char_align, "proportionalMetrics": d.proportional_metrics, "tateChuYoko": d.tate_chu_yoko, "tcyUpDown": d.tcy_up_down, "tcyLeftRight": d.tcy_left_right, "akiLeft": d.aki_left, "akiRight": d.aki_right, - "warichu": d.warichu, "warichuLines": d.warichu_lines, "warichuGap": d.warichu_gap, "warichuScale": d.warichu_scale, + "tsume": d.tsume, "warichu": d.warichu, "warichuLines": d.warichu_lines, "warichuGap": d.warichu_gap, "warichuScale": d.warichu_scale, "warichuAlign": d.warichu_align, "standardVerticalRoman": d.standard_vertical_roman, "noBreak": d.no_break, "charDirection": "default", "kashidas": d.kashidas, "digits": d.digits, "fontHeightReference": d.font_height_reference diff --git a/crates/ui-egui/src/panels/character/tests.rs b/crates/ui-egui/src/panels/character/tests.rs index 7a2a96efb2..cdeafd2b00 100644 --- a/crates/ui-egui/src/panels/character/tests.rs +++ b/crates/ui-egui/src/panels/character/tests.rs @@ -780,6 +780,41 @@ fn insert_aki_fields_show_with_the_east_asian_options() { assert!(left(&app).iter().all(|v| *v == 1000.0), "{:?}", left(&app)); } +/// Tsume is a field of the panel with the East Asian options only, and shows the selected +/// characters' value, blank where they differ. A value typed past 100 sets 100. +#[test] +fn tsume_field_shows_with_the_east_asian_options() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 300, "height": 200})).unwrap(); + let id = app.run("text.create", json!({"x": 20, "y": 50, "text": "(日本)"})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [id]})).unwrap(); + app.run("text.setFormat", json!({"tsume": 37.5})).unwrap(); + let text = crate::tests_labels::painted_text(&mut app, show); + assert!(!text.contains("→A←") && !text.contains("37.5"), "{text}"); + app.session.prefs.show_east_asian_options = true; + let text = crate::tests_labels::painted_text(&mut app, show); + assert!(text.contains("→A←") && text.contains("37.5"), "{text}"); + // The characters differ: the field is blank. + app.run("text.setRangeStyle", json!({"id": id, "start": 3, "end": 12, "tsume": 62.5})).unwrap(); + let text = crate::tests_labels::painted_text(&mut app, show); + assert!(!text.contains("37.5") && !text.contains("62.5"), "{text}"); + app.run("text.setFormat", json!({"tsume": 62.5})).unwrap(); + use super::super::tests_appearance::{click, frame_events, text_rect}; + let ctx = egui::Context::default(); + let texts = frame_events(&ctx, &mut app, vec![], show); + click(&ctx, &mut app, text_rect(&texts, "62.5%").center(), show); + let key = |key, modifiers| egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }; + frame_events(&ctx, &mut app, vec![key(egui::Key::A, egui::Modifiers::COMMAND)], show); + frame_events(&ctx, &mut app, vec![egui::Event::Text("150".into())], show); + frame_events(&ctx, &mut app, vec![key(egui::Key::Enter, egui::Modifiers::NONE)], show); + frame_events(&ctx, &mut app, vec![], show); + let tsume = |app: &VectorcraftApp| match &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => t.runs.iter().map(|r| r.style.tsume).collect::>(), + _ => panic!("text"), + }; + assert!(tsume(&app).iter().all(|v| *v == 100.0), "{:?}", tsume(&app)); +} + /// The panel menu's Show Font Height Options shows the Set Font Height Reference dropdown, /// which shows the selected type's reference and sets the one picked (one undo step); Hide /// Font Height Options hides it again. @@ -1444,6 +1479,7 @@ fn reset_panel_resets_every_attribute_but_the_font() { s.tcy_left_right != d.tcy_left_right, s.aki_left != d.aki_left, s.aki_right != d.aki_right, + s.tsume != d.tsume, s.standard_vertical_roman != d.standard_vertical_roman, s.no_break != d.no_break, s.char_direction != d.char_direction, @@ -1458,16 +1494,16 @@ fn reset_panel_resets_every_attribute_but_the_font() { "id": id, "tracking": 50, "leading": 30, "kerning": 20, "baselineShift": 3, "hScale": 120, "vScale": 90, "rotation": 15, "underline": true, "strikethrough": true, "allCaps": true, "smallCaps": true, "position": "superscript", "charAlign": "emBoxCenter", "proportionalMetrics": true, "tateChuYoko": true, "tcyUpDown": 2, "tcyLeftRight": -3, - "akiLeft": 250, "akiRight": 500, "standardVerticalRoman": true, "noBreak": true, "charDirection": "rightToLeft", "digits": "hindi", "fontHeightReference": "capHeight" + "akiLeft": 250, "akiRight": 500, "tsume": 50, "standardVerticalRoman": true, "noBreak": true, "charDirection": "rightToLeft", "digits": "hindi", "fontHeightReference": "capHeight" }), ) .unwrap(); }; let plain = runs(&app)[0].1.clone(); - assert_eq!(differs(&plain, &CharStyle::default()), [false; 24]); + assert_eq!(differs(&plain, &CharStyle::default()), [false; 25]); custom(&mut app); let styled = runs(&app)[0].1.clone(); - assert_eq!(differs(&styled, &CharStyle::default()), [true; 24]); + assert_eq!(differs(&styled, &CharStyle::default()), [true; 25]); app.run("select.set", json!({"ids": [id]})).unwrap(); reset_panel(&mut app); assert_eq!(runs(&app), [("One 12".to_string(), plain.clone())]); @@ -1741,3 +1777,141 @@ fn story_changes_take_in_locked_and_hidden_frames() { assert_eq!(story_sizes(&app, id).iter().filter(|s| (**s - 9.0).abs() > 1e-9).count(), 0, "frame {id} takes the size"); } } + +/// [`three_frame_story`] with its second frame locked and its third hidden, a type object of its own +/// below it, and the first frame selected with the Selection tool → the app, the frames and the +/// other type object. +fn story_selected_in_its_first_frame() -> (VectorcraftApp, [u64; 3], u64) { + let (mut app, a, b, c) = three_frame_story(60); + let other = app.run("text.create", json!({"x": 10, "y": 250, "text": "Other", "size": 12})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [b]})).unwrap(); + app.run("object.lock", json!({})).unwrap(); + app.run("select.set", json!({"ids": [c]})).unwrap(); + app.run("object.hide", json!({})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + assert_eq!(text_editing(&app), None); + (app, [a, b, c], other) +} + +fn undo_steps(app: &VectorcraftApp) -> usize { + app.session.active().unwrap().history.undo.len() +} + +/// With the Selection tool, a selected frame of a threaded story stands for the whole story: the +/// panel's changes reach its locked and hidden frames, each in one undo step, and leave other type +/// alone. +#[test] +fn selection_tool_changes_reach_every_frame_of_the_story() { + let (mut app, frames, other) = story_selected_in_its_first_frame(); + assert_eq!(selected_stories(&app), frames.map(NodeId).to_vec()); + + let steps = undo_steps(&app); + style(&mut app, json!({"size": 9})); + assert_eq!(undo_steps(&app), steps + 1, "one undo step"); + for id in frames { + assert!(story_sizes(&app, id).iter().all(|s| (*s - 9.0).abs() < 1e-9), "frame {id} takes the size"); + } + assert!(story_sizes(&app, other).iter().all(|s| (*s - 12.0).abs() < 1e-9), "other type keeps its size"); + app.run("edit.undo", json!({})).unwrap(); + for id in frames { + assert!(story_sizes(&app, id).iter().all(|s| (*s - 12.0).abs() < 1e-9), "undo gives frame {id} its size back"); + } + + format(&mut app, json!({"underline": true})); + for id in frames { + assert!(story_frame(&app, id).runs.iter().all(|r| r.style.underline), "frame {id} is underlined"); + } + assert!(story_frame(&app, other).runs.iter().all(|r| !r.style.underline)); + + // Tate-chu-yoko Settings and Warichu Settings set their values through `run_format`. + run_format(&mut app, json!({"tcyUpDown": 2})).unwrap(); + for id in frames { + assert!(story_frame(&app, id).runs.iter().all(|r| (r.style.tcy_up_down - 2.0).abs() < 1e-9), "frame {id} takes Up/Down"); + } + assert!(story_frame(&app, other).runs.iter().all(|r| r.style.tcy_up_down.abs() < 1e-9)); +} + +/// With the Selection tool the anti-aliasing method goes to every frame of the selected story. +#[test] +fn selection_tool_anti_aliasing_reaches_every_frame_of_the_story() { + let (mut app, frames, other) = story_selected_in_its_first_frame(); + set_anti_alias(&mut app, TypeAntiAlias::Strong); + for id in frames { + assert_eq!(story_frame(&app, id).anti_alias, TypeAntiAlias::Strong, "frame {id}"); + } + assert_eq!(story_frame(&app, other).anti_alias, TypeAntiAlias::Sharp); + assert_eq!(shared_anti_alias(&app), Some(TypeAntiAlias::Strong)); +} + +/// With the Selection tool a Variable Font slider sets the axis on every frame of the selected +/// story, in one undo step. +#[test] +fn selection_tool_font_axes_reach_every_frame_of_the_story() { + use vectorcraft_text::test_fonts::{TWO_AXIS_FAMILY, two_axis_font}; + vectorcraft_text::FontDb::global().add_font(two_axis_font().unwrap()); + let (mut app, frames, _) = story_selected_in_its_first_frame(); + app.run("text.setStyle", json!({"ids": frames, "font": TWO_AXIS_FAMILY})).unwrap(); + app.run("select.set", json!({"ids": [frames[0]]})).unwrap(); + let steps = undo_steps(&app); + axes_cmd(&mut app, json!({"wght": 700}), widgets::Live::Released); + assert_eq!(undo_steps(&app), steps + 1, "one undo step"); + for id in frames { + let t = story_frame(&app, id); + assert!(t.runs.iter().all(|r| r.style.font_axes.get("wght") == Some(&700.0)), "frame {id}: {:?}", t.runs[0].style.font_axes); + } +} + +/// With the Selection tool a font family picked in the font menu, and its preview, go to every +/// frame of the selected story, in one undo step. +#[test] +fn selection_tool_font_family_reaches_every_frame_of_the_story() { + let (mut app, frames, other) = story_selected_in_its_first_frame(); + let family = |app: &VectorcraftApp, id: u64| story_frame(app, id).runs.iter().map(|r| r.style.font_family.clone()).collect::>(); + let before = family(&app, other); + let ctx = egui::Context::default(); + crate::font_menu::apply(&mut app, &ctx, crate::font_menu::FontPick::Preview("Source Serif 4".into(), None)); + for id in frames { + assert!(family(&app, id).iter().all(|f| f == "Source Serif 4"), "the preview shows on frame {id}"); + } + let steps = undo_steps(&app); + crate::font_menu::apply(&mut app, &ctx, crate::font_menu::FontPick::Chosen("Source Serif 4".into(), None)); + assert_eq!(undo_steps(&app), steps + 1, "one undo step"); + for id in frames { + assert!(family(&app, id).iter().all(|f| f == "Source Serif 4"), "frame {id} takes the family"); + } + assert_eq!(family(&app, other), before, "other type keeps its family"); +} + +/// The fields show a value only when every frame of the selected story has it: a hidden frame that +/// differs leaves them blank. +#[test] +fn selection_tool_fields_read_every_frame_of_the_story() { + let (mut app, [a, b, c], _) = story_selected_in_its_first_frame(); + assert_eq!(shared(&app, |s| s.size), Some(12.0)); + assert_eq!(shared_anti_alias(&app), Some(TypeAntiAlias::Sharp)); + app.run("text.setStyle", json!({"ids": [c], "size": 20})).unwrap(); + app.run("text.setFormat", json!({"ids": [b], "antiAlias": TypeAntiAlias::Crisp.id()})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + assert_eq!(shared(&app, |s| s.size), None, "the hidden frame's size differs"); + assert_eq!(shared_anti_alias(&app), None, "the locked frame's anti-aliasing differs"); +} + +/// Two frames of one story, or a frame in a selected group, count once; an unthreaded type +/// object is a story of its own. +#[test] +fn selected_stories_list_each_frame_once() { + let (mut app, [a, b, c], other) = story_selected_in_its_first_frame(); + app.run("object.unlockAll", json!({})).unwrap(); + app.run("select.set", json!({"ids": [b, a]})).unwrap(); + assert_eq!(selected_stories(&app), [a, b, c].map(NodeId).to_vec(), "thread order, each once"); + app.run("select.set", json!({"ids": [other, a]})).unwrap(); + let group = app.run("object.group", json!({})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [group]})).unwrap(); + let mut listed = selected_stories(&app); + listed.sort_by_key(|id| id.0); + let mut expected = [a, b, c, other].map(NodeId).to_vec(); + expected.sort_by_key(|id| id.0); + assert_eq!(listed, expected); + app.run("select.set", json!({"ids": []})).unwrap(); + assert!(selected_stories(&app).is_empty()); +} diff --git a/crates/ui-egui/src/panels/layers/rows.rs b/crates/ui-egui/src/panels/layers/rows.rs index 9f80d93791..b898ce8bf8 100644 --- a/crates/ui-egui/src/panels/layers/rows.rs +++ b/crates/ui-egui/src/panels/layers/rows.rs @@ -268,6 +268,66 @@ fn disclosure(ui: &Ui, view: &View, n: &Node, (r, x): (egui::Rect, f32), open: b } } +/// The row's name label or inline rename field. Returns (name_end, name_rect). +fn row_name(ui: &mut Ui, view: &View, item: &Row, r: egui::Rect, x: f32, out: &mut Out) -> (f32, egui::Rect) { + let n = &*item.node; + let doc = view.doc; + let t = &view.t; + let xml_id = view.identify_xml_id; + let name = if doc.mask_edit.is_some_and(|m| m.layer == n.id) { "".to_string() } else { n.identify_label(xml_id) }; + let font = egui::FontId::proportional(13.0); + let renaming: Option<(u64, String)> = ui.data(|d| d.get_temp(rename_id())); + let name_rect = egui::Rect::from_min_max(egui::pos2(x - 2.0, r.center().y - 10.0), egui::pos2(r.right() - 44.0, r.center().y + 10.0)); + let name_end = match renaming { + Some((rid, mut buf)) if rid == n.id.0 => { + let field = rename_id().with("field"); + let kept = crate::widgets::own_field_shift_enter(ui, field, &mut buf, &name); + let mut child = ui.new_child(egui::UiBuilder::new().max_rect(name_rect)); + let te = child + .add(egui::TextEdit::singleline(&mut buf).id(field).align(egui::Align2::LEFT_CENTER).desired_width(name_rect.width()).font(font)); + // Focus the field as it opens. Asking every frame took the focus back from Enter, + // Escape or a click elsewhere, so the rename never ended. + if !te.has_focus() && !te.lost_focus() { + te.request_focus(); + } + if te.lost_focus() { + ui.data_mut(|d| d.remove::<(u64, String)>(rename_id())); + if child.input(|i| !i.key_pressed(egui::Key::Escape)) && buf != name { + out.actions.push(("layer.setProps".into(), json!({"ids": [n.id.0], "name": buf}))); + } + } else { + // Shift+Enter renames it and keeps the field open. + if kept && buf != name { + out.actions.push(("layer.setProps".into(), json!({"ids": [n.id.0], "name": buf.clone()}))); + } + ui.data_mut(|d| d.insert_temp(rename_id(), (n.id.0, buf))); + } + name_rect.right() + } + _ => { + let painter = ui.painter().with_clip_rect(name_rect); + // Generated names ("", "") are translated where painted; the stored name stays English. + // XML IDs stay as ids (not translated). + let shown = if doc.mask_edit.is_some_and(|m| m.layer == n.id) { + tl!("").to_string() + } else if xml_id { + name + } else { + painted_name(n, &n.display_name(), crate::i18n::current()) + }; + let text = paint_name(&painter, egui::pos2(x, r.center().y), &shown, font, if item.dim { t.text_dim } else { t.text }, prints_italic(n)); + // A clipping path's name is underlined, a masked object's with a dashed line. + if item.clip_path { + painter.line_segment([text.left_bottom(), text.right_bottom()], Stroke::new(1.0, t.text)); + } else if n.extras().mask.is_some() { + painter.extend(egui::Shape::dashed_line(&[text.left_bottom(), text.right_bottom()], Stroke::new(1.0, t.text), 3.0, 2.0)); + } + text.right() + } + }; + (name_end, name_rect) +} + /// The widgets of row `item`. pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) { if let Some(i) = item.guide { @@ -277,8 +337,7 @@ pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) { return spine_row(ui, view, item, out); } let n = &*item.node; - let (depth, clip_path, has_children, open, color) = (item.depth, item.clip_path, item.opens, item.open, item.colour); - let doc = view.doc; + let (depth, has_children, open, color) = (item.depth, item.opens, item.open, item.colour); let t = &view.t; let h = view.h; let (r, resp) = ui.allocate_exact_size(vec2(ui.available_width(), h), Sense::click_and_drag()); @@ -309,60 +368,7 @@ pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) { th }); // Name (Preferences › Units › Identify Objects By: Object Name or XML ID). - let xml_id = view.identify_xml_id; - let name = if doc.mask_edit.is_some_and(|m| m.layer == n.id) { "".to_string() } else { n.identify_label(xml_id) }; - let font = egui::FontId::proportional(13.0); - let renaming: Option<(u64, String)> = ui.data(|d| d.get_temp(rename_id())); - let name_rect = egui::Rect::from_min_max(egui::pos2(x - 2.0, r.center().y - 10.0), egui::pos2(r.right() - 44.0, r.center().y + 10.0)); - let name_end; - match renaming { - Some((rid, mut buf)) if rid == n.id.0 => { - let field = rename_id().with("field"); - let kept = crate::widgets::own_field_shift_enter(ui, field, &mut buf, &name); - let mut child = ui.new_child(egui::UiBuilder::new().max_rect(name_rect)); - let te = child.add( - egui::TextEdit::singleline(&mut buf).id(field).align(egui::Align2::LEFT_CENTER).desired_width(name_rect.width()).font(font.clone()), - ); - // Focus the field as it opens. Asking every frame took the focus back from Enter, - // Escape or a click elsewhere, so the rename never ended. - if !te.has_focus() && !te.lost_focus() { - te.request_focus(); - } - if te.lost_focus() { - ui.data_mut(|d| d.remove::<(u64, String)>(rename_id())); - if child.input(|i| !i.key_pressed(egui::Key::Escape)) && buf != name { - out.actions.push(("layer.setProps".into(), json!({"ids": [n.id.0], "name": buf}))); - } - } else { - // Shift+Enter renames it and keeps the field open. - if kept && buf != name { - out.actions.push(("layer.setProps".into(), json!({"ids": [n.id.0], "name": buf.clone()}))); - } - ui.data_mut(|d| d.insert_temp(rename_id(), (n.id.0, buf))); - } - name_end = name_rect.right(); - } - _ => { - let painter = ui.painter().with_clip_rect(name_rect); - // Generated names ("", "") are translated where painted; the stored name stays English. - // XML IDs stay as ids (not translated). - let shown = if doc.mask_edit.is_some_and(|m| m.layer == n.id) { - tl!("").to_string() - } else if xml_id { - name.clone() - } else { - painted_name(n, &n.display_name(), crate::i18n::current()) - }; - let text = paint_name(&painter, egui::pos2(x, r.center().y), &shown, font, if item.dim { t.text_dim } else { t.text }, prints_italic(n)); - name_end = text.right(); - // A clipping path's name is underlined, a masked object's with a dashed line. - if clip_path { - painter.line_segment([text.left_bottom(), text.right_bottom()], Stroke::new(1.0, t.text)); - } else if n.extras().mask.is_some() { - painter.extend(egui::Shape::dashed_line(&[text.left_bottom(), text.right_bottom()], Stroke::new(1.0, t.text), 3.0, 2.0)); - } - } - } + let (name_end, name_rect) = row_name(ui, view, item, r, x, out); // Target circle and selection square. let col_x = r.right() - 43.5; ui.painter().line_segment([egui::pos2(col_x, r.top()), egui::pos2(col_x, r.bottom())], Stroke::new(1.0, t.input_border)); @@ -404,12 +410,18 @@ pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) { out.actions.push(("ui.layerOptions".into(), json!({"ids": [n.id.0]}))); } } - // Row menu: Collect for Export on this row (or every highlighted row when this is one of them). + // Row menu: context actions on this row (or every highlighted row when this is one of them). let collect_ids: Vec = if view.rows.contains(&n.id) { view.rows.iter().map(|id| id.0).collect() } else { vec![n.id.0] }; + // Right-clicking an unselected row selects it; a highlighted row keeps multiselection. + if resp.secondary_clicked() && !view.rows.contains(&n.id) { + out.actions.push(("layer.setCurrent".into(), json!({"id": n.id.0}))); + out.rows_after_click = Some(vec![n.id]); + } + if resp.secondary_clicked() { + crate::panels::set_row_keys(ui.ctx(), ROW_KEYS, true); + } resp.context_menu(|ui| { - collect_for_export_menu(ui, true, |multiple| { - out.actions.push(("assets.add".into(), json!({ "ids": collect_ids.clone(), "multiple": multiple }))); - }); + row_context_menu(ui, view, n, &collect_ids, out); }); // Dragging rows: the highlighted rows when this is one of them, else this row. Only the primary // button drags; the secondary button opens the row menu, and a drag with it moves nothing. @@ -428,6 +440,114 @@ pub(super) fn row(ui: &mut Ui, view: &View, item: &Row, out: &mut Out) { drop_target(ui, view, n, r, x - 16.0, open, &resp, out); } +/// The right-click context menu of row `n`. +fn row_context_menu(ui: &mut Ui, view: &View, n: &Node, collect_ids: &[u64], out: &mut Out) { + let is_multi = collect_ids.len() > 1; + // "Layer Options…" / "Options for Selection…" / "Options…" + let options_label = if is_multi { + "Options for Selection…" + } else if n.is_layer() { + "Layer Options…" + } else { + "Options…" + }; + if widgets::menu_item(ui, options_label, true, false) { + out.actions.push(("ui.layerOptions".into(), json!({ "ids": collect_ids }))); + ui.close(); + } + // "Duplicate """ or "Duplicate Selection" + let display = { + let raw = painted_name(n, &n.display_name(), crate::i18n::current()); + if raw.chars().count() > 20 { + let truncated: String = raw.chars().take(20).collect(); + format!("{truncated}…") + } else { + raw + } + }; + let dup_label = if is_multi { tl!("Duplicate Selection").to_string() } else { format!("{} \"{display}\"", tl!("Duplicate")) }; + if widgets::menu_item_name(ui, &dup_label, true, false) { + out.actions.push(("layer.duplicate".into(), json!({ "ids": collect_ids }))); + ui.close(); + } + // "Delete """ or "Delete Selection" + let del_label = if is_multi { tl!("Delete Selection").to_string() } else { format!("{} \"{display}\"", tl!("Delete")) }; + let del_enabled = { + let listed: std::collections::HashSet = collect_ids.iter().map(|&id| NodeId(id)).collect(); + !view.doc.layers.iter().all(|l| listed.contains(&l.id)) + }; + if widgets::menu_item_name(ui, &del_label, del_enabled, false) { + out.actions.push(("layer.delete".into(), json!({ "ids": collect_ids }))); + ui.close(); + } + ui.separator(); + // Lock Others / Unlock All Layers + { + let (lock_cmd, lock_params, lock_enabled) = multi_others_action(view.doc, collect_ids, false); + let lock_label = if lock_cmd == "layer.lockOthers" { "Lock Others" } else { "Unlock All Layers" }; + if widgets::menu_item(ui, lock_label, lock_enabled, false) { + out.actions.push((lock_cmd, lock_params)); + ui.close(); + } + } + // Hide Others / Show All Layers + { + let (hide_cmd, hide_params, hide_enabled) = multi_others_action(view.doc, collect_ids, true); + let hide_label = if hide_cmd == "layer.hideOthers" { "Hide Others" } else { "Show All Layers" }; + if widgets::menu_item(ui, hide_label, hide_enabled, false) { + out.actions.push((hide_cmd, hide_params)); + ui.close(); + } + } + ui.separator(); + // Locate Object + if widgets::menu_item(ui, "Locate Object", true, false) { + out.actions.push(("layer.locate".into(), json!({ "id": n.id.0 }))); + ui.close(); + } + ui.separator(); + // Collect for Export + let ids: Vec = collect_ids.to_vec(); + collect_for_export_menu(ui, true, move |multiple| { + out.actions.push(("assets.add".into(), json!({ "ids": ids.clone(), "multiple": multiple }))); + }); +} + +/// Context menu Others action for `ids`: Lock Others / Unlock All Layers or Hide Others / Show All Layers. +/// When any other layer is unlocked (visible), returns `lockOthers` (`hideOthers`) preserving all layers holding +/// `ids`. When all other layers are locked (hidden) already, returns `unlockAll` (`showAll`). +pub(crate) fn multi_others_action(doc: &Document, ids: &[u64], eye: bool) -> (String, Value, bool) { + let own_layers: std::collections::HashSet = ids.iter().filter_map(|&id| doc.layer_of(NodeId(id))).collect(); + let has_other_active = if eye { + doc.layers.iter().any(|l| !own_layers.contains(&l.id) && l.visible) + } else { + doc.layers.iter().any(|l| !own_layers.contains(&l.id) && !l.locked) + }; + let cmd = match (eye, has_other_active) { + (true, true) => "layer.hideOthers", + (true, false) => "layer.showAll", + (false, true) => "layer.lockOthers", + (false, false) => "layer.unlockAll", + }; + let enabled = match (eye, has_other_active) { + (true, true) | (false, true) => true, + (true, false) => any_layer_state(doc, |n| !n.visible), + (false, false) => any_layer_state(doc, |n| n.locked), + }; + let params = if cmd.ends_with("Others") { json!({ "ids": ids }) } else { json!({}) }; + (cmd.into(), params, enabled) +} + +fn any_layer_state(doc: &Document, pred: impl Fn(&Node) -> bool) -> bool { + let mut found = false; + doc.walk(|n| { + if !found && n.is_layer() && pred(n) { + found = true; + } + }); + found +} + /// Alt-clicking row `n`'s eye (`eye`) or lock: Hide Others or Lock Others, every top-level layer /// but the one holding the row; when they all are hidden (locked) already, Show All Layers (Unlock /// All Layers). Each is one undo step. diff --git a/crates/ui-egui/src/panels/layers/tests.rs b/crates/ui-egui/src/panels/layers/tests.rs index 55fa27ce58..c072a45828 100644 --- a/crates/ui-egui/src/panels/layers/tests.rs +++ b/crates/ui-egui/src/panels/layers/tests.rs @@ -2440,3 +2440,195 @@ fn guide_rows_list_by_index_whatever_the_node_order() { let indexes: Vec = rows.iter().filter_map(|r| r.guide).collect(); assert_eq!(indexes, [2, 1, 0]); } + +/// Right-clicking a row that is not highlighted selects it. +#[test] +fn context_menu_right_click_selects_unselected_row() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + app.session.execute("layer.new", &json!({})).unwrap(); + app.session.execute("layer.highlight", &json!({"ids": [], "mode": "set"})).unwrap(); + let ctx = egui::Context::default(); + // Rows top-first: Layer 2, Layer 1. Neither is highlighted. + let (circles, _) = frame(&mut app, &ctx, vec![], false); + assert_eq!(circles.len(), 2); + assert!(rows_of(&app).is_empty()); + // Secondary-click Layer 1's row (bottom row). + let pos = circles[1] - vec2(100.0, 0.0); // name area + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(pos)], false); + frame(&mut app, &ctx, vec![button_by(pos, true, egui::PointerButton::Secondary)], false); + frame(&mut app, &ctx, vec![button_by(pos, false, egui::PointerButton::Secondary)], false); + // The row is now highlighted. + let highlighted = rows_of(&app); + let layer1 = app.session.active().unwrap().doc.layers[0].id; + assert!(highlighted.contains(&layer1), "right-click selected the unselected row"); + assert!(crate::panels::has_row_keys(&ctx, super::ROW_KEYS), "secondary click claims row keys"); +} + +/// Right-clicking a row that IS highlighted preserves the multiselection. +#[test] +fn context_menu_right_click_preserves_multiselection() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + app.session.execute("layer.new", &json!({})).unwrap(); + app.session.execute("layer.new", &json!({})).unwrap(); + let doc = &app.session.active().unwrap().doc; + let ids: Vec = doc.layers.iter().map(|l| l.id.0).collect(); + // Highlight all 3 layers. + app.session.execute("layer.highlight", &json!({"ids": ids, "mode": "set"})).unwrap(); + let ctx = egui::Context::default(); + let (circles, _) = frame(&mut app, &ctx, vec![], false); + assert_eq!(circles.len(), 3); + // Secondary-click the middle row. + let pos = circles[1] - vec2(100.0, 0.0); + frame(&mut app, &ctx, vec![egui::Event::PointerMoved(pos)], false); + frame(&mut app, &ctx, vec![button_by(pos, true, egui::PointerButton::Secondary)], false); + frame(&mut app, &ctx, vec![button_by(pos, false, egui::PointerButton::Secondary)], false); + // All 3 must still be highlighted. + assert_eq!(rows_of(&app).len(), 3, "multiselection preserved after right-click on a highlighted row"); +} + +/// layer.delete removes the specified layer. +#[test] +fn context_menu_delete_dispatches_layer_delete() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let layer2_id = app.session.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap(); + let before = app.session.active().unwrap().doc.layers.len(); + // Dispatch layer.delete with explicit ids (what the context menu item does). + app.session.execute("layer.delete", &json!({"ids": [layer2_id]})).unwrap(); + let after = app.session.active().unwrap().doc.layers.len(); + assert_eq!(after, before - 1, "layer.delete removes the layer"); +} + +/// layer.duplicate adds a copy. +#[test] +fn context_menu_duplicate_dispatches_layer_duplicate() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let layer_id = app.session.active().unwrap().doc.layers[0].id.0; + let before_layers = app.session.active().unwrap().doc.layers.len(); + let before_undo = app.session.active().unwrap().history.undo.len(); + app.session.execute("layer.duplicate", &json!({"ids": [layer_id]})).unwrap(); + let after = &app.session.active().unwrap(); + assert_eq!(after.doc.layers.len(), before_layers + 1, "layer.duplicate adds a layer"); + assert_eq!(after.history.undo.len(), before_undo + 1, "one undo step"); +} + +/// layer.locate locates a specified object id without requiring a prior canvas selection. +#[test] +fn context_menu_locate_object_locates_by_id() { + let (mut app, _, [a, _]) = two_rects(); + app.session.execute("select.none", &json!({})).unwrap(); + assert!(app.session.active().unwrap().selection.objects.is_empty()); + // Context menu passes the node's id directly to layer.locate. + let result = app.session.execute("layer.locate", &json!({"id": a.0})); + assert!(result.is_ok(), "layer.locate with id succeeds without selection: {:?}", result.err()); + assert_eq!(app.session.active().unwrap().highlighted_rows(), vec![a]); +} + +/// In a 1-layer document, the Delete action in the context menu is disabled when targeting that layer. +#[test] +fn context_menu_delete_disabled_when_every_layer_targeted() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let doc = &app.session.active().unwrap().doc; + assert_eq!(doc.layers.len(), 1); + let layer_id = doc.layers[0].id; + + // Targeting every layer disables delete. + let listed: std::collections::HashSet = [layer_id].into_iter().collect(); + let del_enabled = !doc.layers.iter().all(|l| listed.contains(&l.id)); + assert!(!del_enabled, "Delete must be disabled when every layer is targeted"); + + // Add a second layer: delete is now enabled for one layer. + app.session.execute("layer.new", &json!({})).unwrap(); + let doc = &app.session.active().unwrap().doc; + assert_eq!(doc.layers.len(), 2); + let del_enabled = !doc.layers.iter().all(|l| listed.contains(&l.id)); + assert!(del_enabled, "Delete is enabled when at least one layer remains"); +} + +/// Others actions (Hide Others / Lock Others) retain all multiselected layers. +#[test] +fn context_menu_others_actions_preserve_multiselected_layers() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + app.session.execute("layer.new", &json!({})).unwrap(); + app.session.execute("layer.new", &json!({})).unwrap(); + let doc = &app.session.active().unwrap().doc; + assert_eq!(doc.layers.len(), 3); + let l1 = doc.layers[0].id.0; + let l2 = doc.layers[1].id.0; + + // Hide Others with multiselection [l1, l2] hides only l3. + let (hide_cmd, hide_params, hide_enabled) = super::rows::multi_others_action(doc, &[l1, l2], true); + assert_eq!(hide_cmd, "layer.hideOthers"); + assert!(hide_enabled); + assert_eq!(hide_params["ids"], json!([l1, l2])); + + // Lock Others with multiselection [l1, l2] locks only l3. + let (lock_cmd, lock_params, lock_enabled) = super::rows::multi_others_action(doc, &[l1, l2], false); + assert_eq!(lock_cmd, "layer.lockOthers"); + assert!(lock_enabled); + assert_eq!(lock_params["ids"], json!([l1, l2])); +} + +/// Context menu Others action resolves an object row to its holding top-level layer. +#[test] +fn context_menu_others_actions_object_row_resolves_to_holding_layer() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + // Layer 1 (current) holding a rectangle. + let rect = app.session.execute("shape.rectangle", &json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap(); + let rect_id = rect["id"].as_u64().unwrap(); + + // Create Layer 2 and hide it. + let l2 = app.session.execute("layer.new", &json!({})).unwrap()["id"].as_u64().unwrap(); + app.session.execute("layer.setProps", &json!({"ids": [l2], "visible": false})).unwrap(); + + let doc = &app.session.active().unwrap().doc; + assert_eq!(doc.layers.len(), 2); + + // Right-clicking the object in Layer 1: Layer 1 is visible, Layer 2 is hidden. + // There are no other visible layers, so the action should be Show All Layers, enabled. + let (hide_cmd, _hide_params, hide_enabled) = super::rows::multi_others_action(doc, &[rect_id], true); + assert_eq!(hide_cmd, "layer.showAll"); + assert!(hide_enabled, "Show All Layers is enabled because Layer 2 is hidden"); + + // Now make Layer 2 visible, but lock it. + app.session.execute("layer.setProps", &json!({"ids": [l2], "visible": true, "locked": true})).unwrap(); + let doc = &app.session.active().unwrap().doc; + // Right-clicking the object in Layer 1: Layer 1 is unlocked, Layer 2 is locked. + // There are no other unlocked layers, so the action should be Unlock All Layers, enabled. + let (lock_cmd, _lock_params, lock_enabled) = super::rows::multi_others_action(doc, &[rect_id], false); + assert_eq!(lock_cmd, "layer.unlockAll"); + assert!(lock_enabled, "Unlock All Layers is enabled because Layer 2 is locked"); +} + +/// Context menu Show/Unlock All Layers are enabled when sublayers are hidden or locked. +#[test] +fn context_menu_others_actions_sublayer_state_enables_all_commands() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.session.execute("file.new", &json!({"width": 200, "height": 200})).unwrap(); + let doc = &app.session.active().unwrap().doc; + assert_eq!(doc.layers.len(), 1); + let l1 = doc.layers[0].id.0; + + // Create a sublayer in Layer 1. + let sub = app.session.execute("layer.newSublayer", &json!({"parent": l1})).unwrap()["id"].as_u64().unwrap(); + + // Case 1: Sublayer is hidden while top layer is visible. + app.session.execute("layer.setProps", &json!({"ids": [sub], "visible": false})).unwrap(); + let doc = &app.session.active().unwrap().doc; + let (hide_cmd, _, hide_enabled) = super::rows::multi_others_action(doc, &[l1], true); + assert_eq!(hide_cmd, "layer.showAll"); + assert!(hide_enabled, "hidden sublayer enables Show All Layers"); + + // Case 2: Sublayer is visible, but locked while top layer is unlocked. + app.session.execute("layer.setProps", &json!({"ids": [sub], "visible": true, "locked": true})).unwrap(); + let doc = &app.session.active().unwrap().doc; + let (lock_cmd, _, lock_enabled) = super::rows::multi_others_action(doc, &[l1], false); + assert_eq!(lock_cmd, "layer.unlockAll"); + assert!(lock_enabled, "locked sublayer enables Unlock All Layers"); +} diff --git a/crates/ui-egui/src/panels/learn.rs b/crates/ui-egui/src/panels/learn.rs index ee7967c8a3..a4f2cd52e4 100644 --- a/crates/ui-egui/src/panels/learn.rs +++ b/crates/ui-egui/src/panels/learn.rs @@ -1,17 +1,23 @@ //! Learn panel (Window › Learn, and Explore tutorials at the right end of the app bar): short //! hands-on tutorials grouped by skill ([`catalog::SKILLS`]). The For you tab holds the Get started //! section with the Quick skill guide card, which opens the Skills tab. The Skills tab lists each -//! skill with an empty progress ring and its count of tutorials; a skill lists its tutorials, and a +//! skill with a progress ring that fills as its tutorials are finished and the count of tutorials +//! finished of all; a skill lists its tutorials, each finished one with a check mark, and a //! tutorial previews its numbered steps. A tool's name in a step is a link that shows where the tool //! is ([`locate`]). Back goes up one level. Under the steps, View more opens the tutorial's practice -//! sample as a new untitled document; Finish tutorial then marks it finished, and Next Up shows the -//! next tutorial in the same skill. `learn.list` lists the tutorials, `learn.skills` shows the list -//! of skills, `learn.show` opens one tutorial, `learn.locateTool` shows where a tool is, -//! `learn.openSample`, `learn.finish` and `learn.next` run the three practice controls, and -//! `window.learn` shows or hides the panel. +//! sample as a new untitled document; the check box before each step then marks it done, Finish +//! tutorial marks the tutorial finished with all its steps, and Next Up shows the next tutorial in +//! the same skill. The preferences keep the progress ([`progress`]); Reset progress under the +//! skills clears it. `learn.list` lists the tutorials with their progress, `learn.skills` shows the +//! list of skills, `learn.show` opens one tutorial, `learn.locateTool` shows where a tool is, +//! `learn.openSample`, `learn.markStep`, `learn.finish` and `learn.next` run the practice controls, +//! `learn.resetProgress` clears the progress, and `window.learn` shows or hides the panel. The Home +//! screen's Learn section shows the same card ([`guide_card`]) and the tutorials, which open the +//! panel. pub mod catalog; pub mod locate; +pub mod progress; pub mod samples; use egui::{Sense, Stroke, Ui, vec2}; @@ -40,12 +46,10 @@ pub struct View { pub tutorial: Option<&'static str>, } -/// The tutorials whose samples View more opened, and the tutorials finished, in the order they -/// were finished. Each id is listed once. +/// The tutorials whose samples View more opened while the app runs. Each id is listed once. #[derive(Clone, Debug, Default, PartialEq, Eq)] pub struct Practice { pub opened: Vec<&'static str>, - pub finished: Vec<&'static str>, } pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { @@ -68,8 +72,16 @@ fn for_you(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); crate::widgets::subheader(ui, tl!("Get started")); ui.add_space(4.0); + guide_card(app, ui, ui.scope_id().with("quick-skill-guide"), t.panel_darker); +} + +/// The Quick skill guide card, filled with `fill`, as one button with the id `id`: a click, or Enter +/// or Space while it has the keyboard focus, shows the panel's list of skills (`learn.skills`). The +/// For you tab and the Home screen's Learn section show it. +pub(crate) fn guide_card(app: &mut VectorcraftApp, ui: &mut Ui, id: egui::Id, fill: egui::Color32) { + let t = Tokens::get(ui.ctx()); let card = egui::Frame::NONE - .fill(t.panel_darker) + .fill(fill) .stroke(Stroke::new(1.0, t.border)) .corner_radius(egui::CornerRadius::same(t.radius)) .inner_margin(egui::Margin::same(10)) @@ -86,8 +98,12 @@ fn for_you(app: &mut VectorcraftApp, ui: &mut Ui) { .color(t.text_dim), )); }); - let resp = ui.interact(card.response.rect, ui.scope_id().with("quick-skill-guide"), Sense::click()); + let resp = ui.interact(card.response.rect, id, Sense::click()); resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), tl!("Quick skill guide"))); + if resp.has_focus() { + ui.painter().rect_stroke(resp.rect, egui::CornerRadius::same(t.radius), Stroke::new(1.0, t.selection), egui::StrokeKind::Inside); + } + let resp = resp.on_hover_cursor(egui::CursorIcon::PointingHand); if resp.clicked() && let Err(e) = app.run("learn.skills", json!({})) { @@ -113,17 +129,26 @@ fn skills(app: &mut VectorcraftApp, ui: &mut Ui) { } crate::widgets::subheader(ui, skill.title); for tutorial in skill.tutorials { - if row(ui, tutorial.title, None).clicked() { + if row(ui, tutorial.title, Mark::Check(app.ui.learn_progress.is_finished(tutorial.id))).clicked() { app.ui.learn.tutorial = Some(tutorial.id); } } return; } for skill in catalog::SKILLS { - if row(ui, skill.title, Some(skill.tutorials.len())).clicked() { + let ring = Mark::Ring { done: app.ui.learn_progress.done(skill), total: skill.tutorials.len() }; + if row(ui, skill.title, ring).clicked() { app.ui.learn.skill = Some(skill.id); } } + if !app.ui.learn_progress.is_empty() { + ui.add_space(6.0); + if ui.button(tl!("Reset progress")).clicked() + && let Err(e) = app.run("learn.resetProgress", json!({})) + { + app.status(e); + } + } } /// The Back button above a skill's tutorials and a tutorial's steps; true when it was clicked. @@ -131,15 +156,26 @@ fn back(ui: &mut Ui) -> bool { crate::widgets::icon_button(ui, "chevron-left", tl!("Back"), false, 22.0).clicked() } -/// A tutorial's title and its numbered steps. The tool's name in a step is a blue link: a click, or -/// Enter or Space while it has the keyboard focus, shows where the tool is (`learn.locateTool`). -fn steps(app: &mut VectorcraftApp, ui: &mut Ui, tutorial: &catalog::Tutorial) { +/// A tutorial's title and its numbered steps, each with a check box that shows whether it is done. +/// The check boxes can be changed once the tutorial's sample is open and until it is finished +/// (`learn.markStep`). The tool's name in a step is a blue link: a click, or Enter or Space while it +/// has the keyboard focus, shows where the tool is (`learn.locateTool`). +fn steps(app: &mut VectorcraftApp, ui: &mut Ui, tutorial: &'static catalog::Tutorial) { let t = Tokens::get(ui.ctx()); ui.label(egui::RichText::new(tutorial.title).size(13.0).color(t.text_strong)); ui.add_space(4.0); + let markable = app.ui.learn_practice.opened.contains(&tutorial.id) && !app.ui.learn_progress.is_finished(tutorial.id); let mut locate = None; + let mut marked = None; for (i, step) in tutorial.steps.iter().enumerate() { + let mut done = app.ui.learn_progress.step_done(tutorial, i); ui.horizontal_top(|ui| { + let resp = ui.add_enabled(markable, egui::Checkbox::without_text(&mut done)); + let name = format!("{}. {}", i + 1, step.plain()); + resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::CheckBox, markable, done, &name)); + if resp.changed() { + marked = Some((i, done)); + } ui.label(egui::RichText::new(format!("{}.", i + 1)).color(t.text_dim)); let (Some(tool), Some((before, name, after))) = (step.tool, step.tool_name()) else { ui.add(egui::Label::new(egui::RichText::new(step.text).color(t.text)).wrap()); @@ -160,6 +196,11 @@ fn steps(app: &mut VectorcraftApp, ui: &mut Ui, tutorial: &catalog::Tutorial) { }); ui.add_space(2.0); } + if let Some((step, complete)) = marked + && let Err(e) = app.run("learn.markStep", json!({ "tutorial": tutorial.id, "step": step, "complete": complete })) + { + app.status(e); + } if let Some(tool) = locate { if let Err(e) = app.run("learn.locateTool", json!({ "tool": tool })) { app.status(e); @@ -192,12 +233,11 @@ fn practice(app: &mut VectorcraftApp, ui: &mut Ui, tutorial: &'static catalog::T if ui.button(tl!("View more")).clicked() { run = Some(("learn.openSample", params.clone())); } - let done = &app.ui.learn_practice; - if done.opened.contains(&id) && !done.finished.contains(&id) && ui.button(tl!("Finish tutorial")).clicked() { + if app.ui.learn_practice.opened.contains(&id) && !app.ui.learn_progress.is_finished(id) && ui.button(tl!("Finish tutorial")).clicked() { run = Some(("learn.finish", params.clone())); } }); - if app.ui.learn_practice.finished.contains(&id) { + if app.ui.learn_progress.is_finished(id) { ui.add_space(6.0); match catalog::next(id) { Some(next) => { @@ -223,46 +263,112 @@ fn practice(app: &mut VectorcraftApp, ui: &mut Ui, tutorial: &'static catalog::T } } -/// A clickable row: `title`, and for a skill (`tutorials`) a progress ring before it and the -/// count of tutorials done of all after it. No progress is kept yet, so the ring is empty. -fn row(ui: &mut Ui, title: &str, tutorials: Option) -> egui::Response { +/// What a row shows before its title. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +enum Mark { + /// A skill: a progress ring that fills as its tutorials are finished, and after the title the + /// count of tutorials finished of all. + Ring { done: usize, total: usize }, + /// A tutorial: a check mark once it is finished (true). + Check(bool), +} + +/// The radius of a row's progress ring or check mark. +const MARK_RADIUS: f32 = 7.0; + +/// A clickable row: `title`, with `mark` before it. Screen readers get the count of a skill's +/// tutorials finished, or Finished for a finished tutorial, as the row's value. +fn row(ui: &mut Ui, title: &str, mark: Mark) -> egui::Response { let t = Tokens::get(ui.ctx()); let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), ROW_HEIGHT), Sense::click()); if resp.hovered() { ui.painter().rect_filled(rect, egui::CornerRadius::same(4), t.hover); } + let painter = ui.painter().with_clip_rect(rect); let mut left = rect.left() + 6.0; let mut right = rect.right() - 6.0; let chevron = egui::Rect::from_center_size(egui::pos2(right - 6.0, rect.center().y), vec2(12.0, 12.0)); crate::icons::paint(ui, "chevron-right", chevron, t.text_dim); right = chevron.left() - 6.0; - if let Some(total) = tutorials { - ui.painter().circle_stroke(egui::pos2(left + 8.0, rect.center().y), 7.0, Stroke::new(2.0, t.border)); - left += 24.0; - let count = ui.painter().layout_no_wrap(format!("0/{total}"), egui::FontId::proportional(11.5), t.text_dim); - right -= count.size().x; - ui.painter().galley(egui::pos2(right, rect.center().y - count.size().y / 2.0), count, t.text_dim); - right -= 6.0; - } - let name = ui.painter().layout(title.to_string(), egui::FontId::proportional(12.5), t.text, f32::INFINITY); + let at = egui::pos2(left + 8.0, rect.center().y); + left += 24.0; + let value = match mark { + Mark::Ring { done, total } => { + ring(&painter, &t, at, done, total); + let count = painter.layout_no_wrap(format!("{done}/{total}"), egui::FontId::proportional(11.5), t.text_dim); + right -= count.size().x; + painter.galley(egui::pos2(right, rect.center().y - count.size().y / 2.0), count, t.text_dim); + right -= 6.0; + Some(format!("{done}/{total}")) + } + Mark::Check(finished) => { + check(&painter, &t, at, finished); + finished.then(|| tl!("Finished").to_string()) + } + }; + let name = painter.layout(title.to_string(), egui::FontId::proportional(12.5), t.text, f32::INFINITY); let clip = egui::Rect::from_min_max(egui::pos2(left, rect.top()), egui::pos2(right.max(left), rect.bottom())); - ui.painter().with_clip_rect(clip).galley(egui::pos2(left, rect.center().y - name.size().y / 2.0), name, t.text); - resp.widget_info(|| egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), title)); + painter.with_clip_rect(clip).galley(egui::pos2(left, rect.center().y - name.size().y / 2.0), name, t.text); + resp.widget_info(|| egui::WidgetInfo { + current_text_value: value.clone(), + ..egui::WidgetInfo::labeled(egui::Role::Button, ui.is_enabled(), title) + }); resp.on_hover_cursor(egui::CursorIcon::PointingHand) } +/// A skill's progress ring at `center`: an outline, with the share `done` of `total` drawn over it +/// clockwise from the top. With no tutorials it stays empty. +fn ring(painter: &egui::Painter, t: &Tokens, center: egui::Pos2, done: usize, total: usize) { + painter.circle_stroke(center, MARK_RADIUS, Stroke::new(2.0, t.border)); + if done == 0 || total == 0 { + return; + } + let stroke = Stroke::new(2.0, t.accent); + if done >= total { + painter.circle_stroke(center, MARK_RADIUS, stroke); + return; + } + let sweep = std::f32::consts::TAU * done as f32 / total as f32; + // About one segment per 1/32 of a turn, and never fewer than two. + let segments = ((32.0 * done as f32 / total as f32).ceil() as usize).max(2); + let points = (0..=segments) + .map(|k| { + let angle = -std::f32::consts::FRAC_PI_2 + sweep * k as f32 / segments as f32; + center + MARK_RADIUS * vec2(angle.cos(), angle.sin()) + }) + .collect(); + painter.add(egui::Shape::line(points, stroke)); +} + +/// A tutorial's mark at `center`: an outline, filled with a check mark once it is finished. +fn check(painter: &egui::Painter, t: &Tokens, center: egui::Pos2, finished: bool) { + if !finished { + painter.circle_stroke(center, MARK_RADIUS, Stroke::new(1.0, t.border)); + return; + } + painter.circle_filled(center, MARK_RADIUS, t.accent); + let tick = vec![center + vec2(-3.5, 0.0), center + vec2(-1.0, 2.5), center + vec2(3.5, -2.5)]; + painter.add(egui::Shape::line(tick, Stroke::new(1.5, t.panel))); +} + /// The Learn panel's UI commands: `window.learn`, `learn.list`, `learn.skills`, `learn.show`, -/// `learn.locateTool`, `learn.openSample`, `learn.finish` and `learn.next`. +/// `learn.locateTool`, `learn.openSample`, `learn.markStep`, `learn.finish`, `learn.next` and +/// `learn.resetProgress`. pub(crate) fn command(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option> { Some(match id { "window.learn" => toggle(app, p), - "learn.list" => Ok(list()), + "learn.list" => Ok(list(&app.ui.learn_progress)), "learn.skills" => skills_list(app), "learn.show" => open(app, p), "learn.locateTool" => locate::locate_tool(app, p), "learn.openSample" => open_sample(app, p), + "learn.markStep" => mark_step(app, p), "learn.finish" => finish(app, p), "learn.next" => next(app, p), + "learn.resetProgress" => { + app.ui.learn_progress = progress::Progress::default(); + Ok(list(&app.ui.learn_progress)) + } _ => return None, }) } @@ -287,11 +393,25 @@ fn toggle(app: &mut VectorcraftApp, p: &Value) -> Result { Ok(json!(visible(&app.ui))) } -/// `learn.list`: every skill with its tutorials and their step counts. -fn list() -> Value { +/// `learn.list`: every skill with its count of tutorials finished (`done`) of all (`total`), and its +/// tutorials with their step counts, whether each is finished, and the zero-based indexes of its +/// steps marked done (`completedSteps`). +fn list(progress: &progress::Progress) -> Value { let skills = catalog::SKILLS.iter().map(|s| { - let tutorials: Vec = s.tutorials.iter().map(|t| json!({"id": t.id, "title": t.title, "steps": t.steps.len()})).collect(); - json!({"id": s.id, "title": s.title, "tutorials": tutorials}) + let tutorials: Vec = s + .tutorials + .iter() + .map(|t| { + json!({ + "id": t.id, + "title": t.title, + "steps": t.steps.len(), + "finished": progress.is_finished(t.id), + "completedSteps": progress.completed_steps(t), + }) + }) + .collect(); + json!({"id": s.id, "title": s.title, "done": progress.done(s), "total": s.tutorials.len(), "tutorials": tutorials}) }); json!({ "skills": skills.collect::>() }) } @@ -301,7 +421,7 @@ fn list() -> Value { fn skills_list(app: &mut VectorcraftApp) -> Result { crate::panel_docking::reveal_panel(app, ID)?; app.ui.learn = View { tab: Tab::Skills, skill: None, tutorial: None }; - Ok(list()) + Ok(list(&app.ui.learn_progress)) } /// `learn.show {tutorial}`: show the panel on the Skills tab with that tutorial's steps → the @@ -344,19 +464,42 @@ fn open_sample(app: &mut VectorcraftApp, p: &Value) -> Result { Ok(json!({"tutorial": id, "index": opened["index"], "title": opened["title"]})) } -/// `learn.finish {tutorial}`: Finish tutorial. Mark a tutorial whose sample was opened finished → -/// `{tutorial, finished: true, next}`, where `next` is the id of the next tutorial in its skill, or -/// null after the skill's last one. Finishing it again keeps one entry. The Learn view stays as it is. +/// `learn.markStep {tutorial, step, complete?}`: a step's check box. Mark step `step` (zero-based) +/// of a tutorial whose sample was opened done (`complete` true or omitted) or not done (false) → +/// `{tutorial, step, complete}`. A finished tutorial keeps every step done, so marking one of its +/// steps is an error; so are a step the tutorial does not have and a `complete` that is not true or +/// false. An error changes nothing. +fn mark_step(app: &mut VectorcraftApp, p: &Value) -> Result { + let (_, tutorial) = tutorial_param(p)?; + let id = tutorial.id; + let last = tutorial.steps.len().saturating_sub(1); + let step = match p.get("step") { + None | Some(Value::Null) => return Err("missing `step` (see learn.show)".into()), + Some(v) => v.as_u64().and_then(|s| usize::try_from(s).ok()).filter(|s| *s < tutorial.steps.len()), + }; + let step = step.ok_or_else(|| format!("`step` must be a step number from 0 to {last}"))?; + let complete = crate::menus::opt_bool(p, "complete")?.unwrap_or(true); + if !app.ui.learn_practice.opened.contains(&id) { + return Err(format!("open the practice sample of `{id}` first (see learn.openSample)")); + } + if app.ui.learn_progress.is_finished(id) { + return Err(format!("`{id}` is finished (see learn.resetProgress)")); + } + app.ui.learn_progress.mark(id, step, complete); + Ok(json!({"tutorial": id, "step": step, "complete": complete})) +} + +/// `learn.finish {tutorial}`: Finish tutorial. Mark a tutorial whose sample was opened finished, +/// with all its steps done → `{tutorial, finished: true, next}`, where `next` is the id of the next +/// tutorial in its skill, or null after the skill's last one. Finishing it again keeps one entry, +/// also after a restart, when its sample has not been opened again. The Learn view stays as it is. fn finish(app: &mut VectorcraftApp, p: &Value) -> Result { let (_, tutorial) = tutorial_param(p)?; let id = tutorial.id; - let practice = &mut app.ui.learn_practice; - if !practice.opened.contains(&id) { + if !app.ui.learn_practice.opened.contains(&id) && !app.ui.learn_progress.is_finished(id) { return Err(format!("open the practice sample of `{id}` first (see learn.openSample)")); } - if !practice.finished.contains(&id) { - practice.finished.push(id); - } + app.ui.learn_progress.finish(id); Ok(json!({"tutorial": id, "finished": true, "next": catalog::next(id).map(|t| t.id)})) } @@ -366,7 +509,7 @@ fn finish(app: &mut VectorcraftApp, p: &Value) -> Result { fn next(app: &mut VectorcraftApp, p: &Value) -> Result { let (skill, tutorial) = tutorial_param(p)?; let id = tutorial.id; - if !app.ui.learn_practice.finished.contains(&id) { + if !app.ui.learn_progress.is_finished(id) { return Err(format!("finish `{id}` first (see learn.finish)")); } let after = catalog::next(id).ok_or_else(|| format!("`{id}` is the last tutorial in its skill"))?; diff --git a/crates/ui-egui/src/panels/learn/progress.rs b/crates/ui-egui/src/panels/learn/progress.rs new file mode 100644 index 0000000000..a425b0e58f --- /dev/null +++ b/crates/ui-egui/src/panels/learn/progress.rs @@ -0,0 +1,122 @@ +//! What a learner has done in the Learn panel: the steps marked done in each tutorial and the +//! tutorials finished. The UI preferences keep it (`UiState::learn_progress`), so it lasts from +//! one start to the next where the preferences are saved. Saved progress is read leniently: an +//! unknown tutorial id, a step the tutorial does not have, a repeated entry or a value of the wrong +//! kind is skipped, and the rest of the preferences read as usual. + +use std::collections::BTreeMap; + +use serde::{Deserialize, Deserializer, Serialize, Serializer}; +use serde_json::Value; + +use super::catalog; + +/// The most entries read from one saved list or map; the rest are skipped. +const MAX_READ: usize = 1024; + +/// The tutorials finished and the steps marked done. +#[derive(Clone, Debug, Default, PartialEq, Eq)] +pub struct Progress { + /// The tutorials finished, in the order they were finished. Each id is listed once. + pub finished: Vec<&'static str>, + /// For each tutorial not finished, the zero-based indexes of the steps marked done, ascending. + /// A tutorial with no step marked has no entry. + pub steps: BTreeMap<&'static str, Vec>, +} + +impl Progress { + /// Nothing is finished and no step is marked. + pub fn is_empty(&self) -> bool { + self.finished.is_empty() && self.steps.is_empty() + } + + /// Whether the tutorial `id` is finished. + pub fn is_finished(&self, id: &str) -> bool { + self.finished.contains(&id) + } + + /// The zero-based indexes of `tutorial`'s steps marked done, ascending: every step of a + /// finished tutorial. + pub fn completed_steps(&self, tutorial: &catalog::Tutorial) -> Vec { + if self.is_finished(tutorial.id) { + return (0..tutorial.steps.len()).collect(); + } + self.steps.get(tutorial.id).cloned().unwrap_or_default() + } + + /// Whether step `step` of `tutorial` is marked done. + pub fn step_done(&self, tutorial: &catalog::Tutorial, step: usize) -> bool { + self.is_finished(tutorial.id) || self.steps.get(tutorial.id).is_some_and(|s| s.contains(&step)) + } + + /// Mark step `step` of the unfinished tutorial `id` done (`complete`) or not done. + pub fn mark(&mut self, id: &'static str, step: usize, complete: bool) { + let marks = self.steps.entry(id).or_default(); + match (marks.binary_search(&step), complete) { + (Err(at), true) => marks.insert(at, step), + (Ok(at), false) => { + marks.remove(at); + } + _ => {} + } + if marks.is_empty() { + self.steps.remove(id); + } + } + + /// Mark the tutorial `id` finished, with all its steps done. Finishing it again keeps one entry. + pub fn finish(&mut self, id: &'static str) { + if !self.is_finished(id) { + self.finished.push(id); + } + self.steps.remove(id); + } + + /// How many of `skill`'s tutorials are finished. + pub fn done(&self, skill: &catalog::Skill) -> usize { + skill.tutorials.iter().filter(|t| self.is_finished(t.id)).count() + } + + /// Progress read from a saved value, keeping only what the catalog knows (see the module). + fn from_value(saved: &Value) -> Self { + let mut progress = Progress::default(); + let known = |id: &Value| id.as_str().and_then(catalog::tutorial).map(|(_, t)| t); + if let Some(finished) = saved.get("finished").and_then(Value::as_array) { + for tutorial in finished.iter().take(MAX_READ).filter_map(known) { + progress.finish(tutorial.id); + } + } + if let Some(steps) = saved.get("steps").and_then(Value::as_object) { + for (id, marks) in steps.iter().take(MAX_READ) { + let Some((_, tutorial)) = catalog::tutorial(id) else { continue }; + if progress.is_finished(tutorial.id) { + continue; + } + let indexes = marks.as_array().into_iter().flatten().take(MAX_READ).filter_map(Value::as_u64); + for step in indexes.filter_map(|s| usize::try_from(s).ok()).filter(|s| *s < tutorial.steps.len()) { + progress.mark(tutorial.id, step, true); + } + } + } + progress + } +} + +/// The saved form: `{finished: [id], steps: {id: [index]}}`. +#[derive(Serialize)] +struct Saved<'a> { + finished: &'a [&'static str], + steps: &'a BTreeMap<&'static str, Vec>, +} + +impl Serialize for Progress { + fn serialize(&self, serializer: S) -> Result { + Saved { finished: &self.finished, steps: &self.steps }.serialize(serializer) + } +} + +impl<'de> Deserialize<'de> for Progress { + fn deserialize>(deserializer: D) -> Result { + Ok(Progress::from_value(&Value::deserialize(deserializer)?)) + } +} diff --git a/crates/ui-egui/src/panels/learn/tests.rs b/crates/ui-egui/src/panels/learn/tests.rs index 4bd00648d1..ea65a64fe9 100644 --- a/crates/ui-egui/src/panels/learn/tests.rs +++ b/crates/ui-egui/src/panels/learn/tests.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; -use egui::accesskit::Node; -use serde_json::json; +use egui::accesskit::{Node, Role, Toggled}; +use serde_json::{Value, json}; use vectorcraft_engine::Session; use super::{ID, Practice, Tab, View, catalog, samples, show}; @@ -225,7 +225,8 @@ fn learn_show_opens_a_tutorial_and_learn_list_lists_them() { assert_eq!(skills.len(), catalog::SKILLS.len()); let count: usize = skills.iter().map(|s| s["tutorials"].as_array().map_or(0, Vec::len)).sum(); assert_eq!(count, catalog::SKILLS.iter().map(|s| s.tutorials.len()).sum::()); - assert_eq!(skills[2]["tutorials"][1], json!({"id": "gradient", "title": "Add a gradient", "steps": 3})); + assert_eq!(skills[2]["tutorials"][1], json!({"id": "gradient", "title": "Add a gradient", "steps": 3, "finished": false, "completedSteps": []})); + assert_eq!((skills[2]["done"].clone(), skills[2]["total"].clone()), (json!(0), json!(3))); } /// Every tutorial has one sample of its own, in the catalog's order, each one small and read @@ -279,7 +280,8 @@ fn view_more_opens_the_tutorial_s_sample_as_a_new_untitled_document() { assert_eq!(docs[0].doc.node_count(), work, "the open document stays as it was"); assert!(docs[1].path.is_none() && docs[1].title().starts_with("Untitled-"), "{}", docs[1].title()); let pen = docs[1].doc.node_count(); - assert_eq!(app.ui.learn_practice, Practice { opened: vec!["pen-paths"], finished: vec![] }); + assert_eq!(app.ui.learn_practice, Practice { opened: vec!["pen-paths"] }); + assert!(app.ui.learn_progress.is_empty(), "opening a sample marks nothing"); let r = app.run("learn.openSample", json!({"tutorial": "gradient"})).unwrap(); assert_eq!(r["tutorial"], "gradient"); @@ -306,7 +308,7 @@ fn finishing_a_tutorial_offers_next_up_in_its_skill() { let text = painted_text(&mut app, show); assert!(text.contains("Finish tutorial") && !text.contains("Next Up"), "{text}"); click(&mut app, &ctx, "Finish tutorial", show); - assert_eq!(app.ui.learn_practice.finished, ["pen-paths"]); + assert_eq!(app.ui.learn_progress.finished, ["pen-paths"]); let text = painted_text(&mut app, show); assert!(text.contains("Next Up") && text.contains("Draw smooth curves") && !text.contains("Finish tutorial"), "{text}"); let docs = app.session.documents().len(); @@ -350,7 +352,7 @@ fn the_practice_controls_work_from_the_keyboard() { assert_eq!(app.ui.learn_practice.opened, ["pen-paths"]); tab_to(&mut app, &ctx, "Finish tutorial", show); key(&mut app, &ctx, egui::Key::Enter, show); - assert_eq!(app.ui.learn_practice.finished, ["pen-paths"]); + assert_eq!(app.ui.learn_progress.finished, ["pen-paths"]); tab_to(&mut app, &ctx, "Next Up", show); key(&mut app, &ctx, egui::Key::Enter, show); assert_eq!(app.ui.learn, View { tab: Tab::Skills, skill: Some("draw"), tutorial: Some("smooth-curves") }); @@ -408,13 +410,14 @@ fn learn_finish_and_learn_next_follow_the_practice() { assert_eq!(app.run("learn.finish", json!({"tutorial": "gradient"})).unwrap_err(), open); assert_eq!(app.run("learn.next", json!({"tutorial": "gradient"})).unwrap_err(), "finish `gradient` first (see learn.finish)"); assert_eq!(app.ui.learn_practice, Practice::default()); + assert!(app.ui.learn_progress.is_empty()); app.run("learn.openSample", json!({"tutorial": "gradient"})).unwrap(); assert_eq!(app.run("learn.next", json!({"tutorial": "gradient"})).unwrap_err(), "finish `gradient` first (see learn.finish)"); for _ in 0..2 { let r = app.run("learn.finish", json!({"tutorial": "gradient"})).unwrap(); assert_eq!(r, json!({"tutorial": "gradient", "finished": true, "next": "copy-colors"})); } - assert_eq!(app.ui.learn_practice.finished, ["gradient"], "finishing again keeps one entry"); + assert_eq!(app.ui.learn_progress.finished, ["gradient"], "finishing again keeps one entry"); let r = app.run("learn.next", json!({"tutorial": "gradient"})).unwrap(); assert_eq!(r, json!({"skill": "color", "tutorial": "copy-colors", "title": "Copy colors from other art"})); assert!(shown(&app)); @@ -471,6 +474,7 @@ fn the_practice_commands_reject_a_missing_or_unknown_tutorial() { assert_eq!(app.run(cmd, params).unwrap_err(), error, "{cmd}"); assert_eq!(app.ui.learn, View::default()); assert_eq!(app.ui.learn_practice, Practice::default()); + assert!(app.ui.learn_progress.is_empty()); assert_eq!(app.session.documents().len(), 1); assert!(!shown(&app)); } @@ -581,3 +585,274 @@ fn learn_locate_tool_is_unavailable_while_the_toolbars_are_hidden() { assert_eq!(reply["location"], "unavailable", "{reply}"); assert!(app.ui.learn_locate.is_none() && !app.ui.toolbar && app.ui.tab_hid.is_some(), "Tab's state stays"); } + +/// The screen-reader name of step `i` of the Pen tutorial's check box. +fn pen_step(i: usize) -> String { + let (_, tutorial) = catalog::tutorial("pen-paths").unwrap(); + format!("{}. {}", i + 1, tutorial.steps[i].plain()) +} + +/// The check boxes of what `draw` draws, from the top, as (enabled, checked). +fn check_boxes(app: &mut VectorcraftApp, ctx: &egui::Context, draw: fn(&mut VectorcraftApp, &mut egui::Ui)) -> Vec<(bool, bool)> { + let nodes = frame(app, ctx, vec![], draw); + let mut boxes: Vec<&Node> = nodes.iter().filter(|n| n.role() == Role::CheckBox).collect(); + boxes.sort_by(|a, b| a.bounds().map_or(0.0, |r| r.y0).total_cmp(&b.bounds().map_or(0.0, |r| r.y0))); + boxes.iter().map(|n| (!n.is_disabled(), n.toggled() == Some(Toggled::True))).collect() +} + +/// Each step has a check box, off until the tutorial's sample is open. A click marks only its own +/// step and a second click clears it; marking every step does not finish the tutorial. A finished +/// tutorial shows every step done, and its check boxes and `learn.markStep` no longer change them. +#[test] +fn a_step_s_check_box_marks_only_that_step() { + let mut app = app(); + let ctx = context(); + assert_eq!(check_boxes(&mut app, &ctx, pen_paths), [(false, false); 3], "off before View more"); + click(&mut app, &ctx, &pen_step(1), pen_paths); + assert!(app.ui.learn_progress.is_empty(), "a check box that is off changes nothing"); + app.run("learn.openSample", json!({"tutorial": "pen-paths"})).unwrap(); + click(&mut app, &ctx, &pen_step(1), pen_paths); + assert_eq!(check_boxes(&mut app, &ctx, pen_paths), [(true, false), (true, true), (true, false)], "{}", app.ui.status); + let list = app.run("learn.list", json!({})).unwrap(); + assert_eq!(list["skills"][1]["tutorials"][0]["completedSteps"], json!([1])); + assert_eq!(list["skills"][1]["tutorials"][1]["completedSteps"], json!([]), "other tutorials stay as they are"); + click(&mut app, &ctx, &pen_step(1), pen_paths); + assert!(app.ui.learn_progress.is_empty(), "a second click clears the mark"); + for i in 0..3 { + click(&mut app, &ctx, &pen_step(i), pen_paths); + } + assert_eq!(check_boxes(&mut app, &ctx, pen_paths), [(true, true); 3]); + assert!(!app.ui.learn_progress.is_finished("pen-paths"), "marking every step does not finish the tutorial"); + assert!(painted_text(&mut app, pen_paths).contains("Finish tutorial")); + click(&mut app, &ctx, &pen_step(0), pen_paths); + click(&mut app, &ctx, "Finish tutorial", pen_paths); + assert_eq!(app.ui.learn_progress.finished, ["pen-paths"]); + assert!(app.ui.learn_progress.steps.is_empty(), "a finished tutorial keeps no marks of its own"); + assert_eq!(check_boxes(&mut app, &ctx, pen_paths), [(false, true); 3], "Finish marks every step"); + let before = app.ui.learn_progress.clone(); + click(&mut app, &ctx, &pen_step(2), pen_paths); + let error = app.run("learn.markStep", json!({"tutorial": "pen-paths", "step": 2, "complete": false})).unwrap_err(); + assert_eq!(error, "`pen-paths` is finished (see learn.resetProgress)"); + assert_eq!(app.ui.learn_progress, before); +} + +/// The check boxes are reached with Tab and changed with Space. +#[test] +fn a_step_s_check_box_works_from_the_keyboard() { + let mut app = app(); + let ctx = context(); + app.run("learn.openSample", json!({"tutorial": "pen-paths"})).unwrap(); + frame(&mut app, &ctx, vec![], pen_paths); + tab_to(&mut app, &ctx, &pen_step(2), pen_paths); + key(&mut app, &ctx, egui::Key::Space, pen_paths); + assert_eq!(app.ui.learn_progress.steps.get("pen-paths"), Some(&vec![2]), "{}", app.ui.status); +} + +/// Finishing tutorials fills only their own skill's ring and count, once each however often they +/// are finished; the skill's tutorial rows show which are finished; `learn.list` answers the same. +#[test] +fn finishing_tutorials_fills_their_skill_s_ring_and_count() { + let mut app = app(); + let ctx = context(); + for id in ["pen-paths", "smooth-curves"] { + app.run("learn.openSample", json!({"tutorial": id})).unwrap(); + for _ in 0..2 { + app.run("learn.finish", json!({"tutorial": id})).unwrap(); + } + } + let values = |app: &mut VectorcraftApp, view: View| { + app.ui.learn = view; + let nodes = frame(app, &ctx, vec![], show); + nodes + .iter() + .filter(|n| n.role() == Role::Button) + .map(|n| (n.label().unwrap_or_default().to_string(), n.value().map(str::to_string))) + .collect::>() + }; + let skills = View { tab: Tab::Skills, skill: None, tutorial: None }; + let rows = values(&mut app, skills.clone()); + for skill in catalog::SKILLS { + let count = if skill.id == "draw" { "2/3".to_string() } else { format!("0/{}", skill.tutorials.len()) }; + assert!(rows.contains(&(skill.title.to_string(), Some(count.clone()))), "{} {count} in {rows:?}", skill.id); + } + assert!(painted_text(&mut app, show).contains("2/3")); + let list = app.run("learn.list", json!({})).unwrap(); + let draw = &list["skills"][1]; + assert_eq!((draw["done"].clone(), draw["total"].clone()), (json!(2), json!(3))); + assert_eq!(draw["tutorials"][1]["finished"], json!(true)); + assert_eq!(draw["tutorials"][1]["completedSteps"], json!([0, 1, 2])); + assert_eq!(list["skills"][2]["done"], json!(0), "other skills stay at 0"); + + let rows = values(&mut app, View { tab: Tab::Skills, skill: Some("draw"), tutorial: None }); + assert!(rows.contains(&("Draw paths with the Pen".to_string(), Some("Finished".to_string()))), "{rows:?}"); + assert!(rows.contains(&("Draw smooth curves".to_string(), Some("Finished".to_string()))), "{rows:?}"); + assert!(rows.contains(&("Sketch with the Pencil".to_string(), None)), "{rows:?}"); + + app.run("learn.openSample", json!({"tutorial": "pencil-sketch"})).unwrap(); + app.run("learn.finish", json!({"tutorial": "pencil-sketch"})).unwrap(); + let rows = values(&mut app, skills); + assert!(rows.contains(&("Draw and build".to_string(), Some("3/3".to_string()))), "every tutorial finished: {rows:?}"); +} + +/// A skill row with no tutorials, which the catalog does not have today, shows an empty ring and +/// 0/0. +fn empty_skill(_: &mut VectorcraftApp, ui: &mut egui::Ui) { + super::row(ui, "Empty skill", super::Mark::Ring { done: 0, total: 0 }); +} + +#[test] +fn a_skill_with_no_tutorials_shows_0_of_0() { + let mut app = app(); + let text = painted_text(&mut app, empty_skill); + assert!(text.contains("Empty skill") && text.contains("0/0"), "{text}"); +} + +/// `learn.markStep` marks a step done by default and with `complete: true`, clears it with `false`, +/// and answers what it did; a bad param is an error and changes nothing. +#[test] +fn learn_mark_step_checks_its_params() { + let mut app = app(); + let open = "open the practice sample of `gradient` first (see learn.openSample)"; + assert_eq!(app.run("learn.markStep", json!({"tutorial": "gradient", "step": 0})).unwrap_err(), open); + assert!(app.ui.learn_progress.is_empty()); + app.run("learn.openSample", json!({"tutorial": "gradient"})).unwrap(); + assert_eq!( + app.run("learn.markStep", json!({"tutorial": "gradient", "step": 0})).unwrap(), + json!({"tutorial": "gradient", "step": 0, "complete": true}) + ); + let before = app.ui.learn_progress.clone(); + let missing = "missing `step` (see learn.show)"; + let range = "`step` must be a step number from 0 to 2"; + for (params, error) in [ + (json!({"tutorial": "gradient"}), missing), + (json!({"tutorial": "gradient", "step": null}), missing), + (json!({"tutorial": "gradient", "step": 3}), range), + (json!({"tutorial": "gradient", "step": -1}), range), + (json!({"tutorial": "gradient", "step": 1.5}), range), + (json!({"tutorial": "gradient", "step": "1"}), range), + (json!({"tutorial": "gradient", "step": u64::MAX}), range), + (json!({"tutorial": "gradient", "step": 1, "complete": "yes"}), "`complete` must be true or false"), + (json!({"tutorial": "nope", "step": 1}), "unknown tutorial `nope` (see learn.list)"), + (json!({"step": 1}), "missing `tutorial` (see learn.list)"), + ] { + assert_eq!(app.run("learn.markStep", params.clone()).unwrap_err(), error, "{params}"); + assert_eq!(app.ui.learn_progress, before, "{params}"); + } + let r = app.run("learn.markStep", json!({"tutorial": "gradient", "step": 2, "complete": null})).unwrap(); + assert_eq!(r, json!({"tutorial": "gradient", "step": 2, "complete": true})); + let r = app.run("learn.markStep", json!({"tutorial": "gradient", "step": 0, "complete": false})).unwrap(); + assert_eq!(r, json!({"tutorial": "gradient", "step": 0, "complete": false})); + let r = app.run("learn.markStep", json!({"tutorial": "gradient", "step": 0, "complete": false})).unwrap(); + assert_eq!(r["complete"], json!(false), "clearing a step that is not marked is no error"); + assert_eq!(app.ui.learn_progress.steps.get("gradient"), Some(&vec![2])); + assert!(app.ui.learn_progress.finished.is_empty()); +} + +/// `learn.resetProgress` and Reset progress clear every tutorial finished and every step marked; +/// documents, opened samples and the Learn view stay. Reset progress shows only when there is +/// progress. +#[test] +fn reset_progress_clears_only_the_progress() { + let mut app = app(); + let ctx = context(); + let skills = View { tab: Tab::Skills, skill: None, tutorial: None }; + app.ui.learn = skills.clone(); + assert!(!painted_text(&mut app, show).contains("Reset progress")); + app.run("learn.openSample", json!({"tutorial": "pen-paths"})).unwrap(); + app.run("learn.finish", json!({"tutorial": "pen-paths"})).unwrap(); + app.run("learn.openSample", json!({"tutorial": "gradient"})).unwrap(); + app.run("learn.markStep", json!({"tutorial": "gradient", "step": 1})).unwrap(); + let view = app.ui.learn.clone(); + let docs = app.session.documents().len(); + let reply = app.run("learn.resetProgress", json!({})).unwrap(); + assert!(app.ui.learn_progress.is_empty()); + assert_eq!(reply, app.run("learn.list", json!({})).unwrap()); + assert_eq!(reply["skills"][1]["done"], json!(0)); + assert_eq!((app.ui.learn.clone(), app.session.documents().len()), (view, docs)); + assert_eq!(app.ui.learn_practice.opened, ["pen-paths", "gradient"], "opened samples stay open for practice"); + + app.run("learn.finish", json!({"tutorial": "gradient"})).unwrap(); + app.ui.learn = skills.clone(); + assert!(painted_text(&mut app, show).contains("Reset progress")); + click(&mut app, &ctx, "Reset progress", show); + assert!(app.ui.learn_progress.is_empty(), "{}", app.ui.status); + assert_eq!(app.ui.learn, skills); + assert!(!painted_text(&mut app, show).contains("Reset progress")); +} + +/// The UI state after its preferences are saved and read again, as at the next start. +fn restarted(app: &VectorcraftApp) -> crate::state::UiState { + let bytes = serde_json::to_vec(&app.ui).unwrap(); + crate::state::UiState::read_preferences(&bytes).expect("the preferences read").ui.sanitized() +} + +/// The preferences keep the tutorials finished and the steps marked; the opened samples, the +/// Learn view and a tool's mark last only while the app runs, so a step can be marked again only +/// after View more. +#[test] +fn the_preferences_keep_the_progress() { + let mut app = app(); + app.run("learn.openSample", json!({"tutorial": "pen-paths"})).unwrap(); + app.run("learn.finish", json!({"tutorial": "pen-paths"})).unwrap(); + app.run("learn.openSample", json!({"tutorial": "gradient"})).unwrap(); + for step in [2, 0] { + app.run("learn.markStep", json!({"tutorial": "gradient", "step": step})).unwrap(); + } + let list = app.run("learn.list", json!({})).unwrap(); + let ui = restarted(&app); + assert_eq!(ui.learn_progress, app.ui.learn_progress); + assert_eq!(ui.learn_progress.steps.get("gradient"), Some(&vec![0, 2])); + assert_eq!((ui.learn_practice.clone(), ui.learn.clone(), ui.learn_locate.is_none()), (Practice::default(), View::default(), true)); + + let mut next = self::app(); + next.ui = ui; + assert_eq!(next.run("learn.list", json!({})).unwrap(), list); + assert_eq!(next.run("learn.next", json!({"tutorial": "pen-paths"})).unwrap()["tutorial"], "smooth-curves"); + let again = next.run("learn.finish", json!({"tutorial": "pen-paths"})).unwrap(); + assert_eq!(again, json!({"tutorial": "pen-paths", "finished": true, "next": "smooth-curves"}), "finishing again needs no sample"); + assert_eq!(next.ui.learn_progress.finished, ["pen-paths"]); + let open = "open the practice sample of `gradient` first (see learn.openSample)"; + assert_eq!(next.run("learn.markStep", json!({"tutorial": "gradient", "step": 1})).unwrap_err(), open); +} + +/// Saved preferences with `learn_progress` set to `progress` (left out for None), and +/// `control_bar` on, read as at a start. +fn read_progress(progress: Option) -> crate::state::UiState { + let mut saved = serde_json::to_value(crate::state::UiState::default()).unwrap(); + let fields = saved.as_object_mut().unwrap(); + fields.insert("control_bar".into(), json!(true)); + match progress { + Some(p) => fields.insert("learn_progress".into(), p), + None => fields.remove("learn_progress"), + }; + let ui = crate::state::UiState::read_preferences(&serde_json::to_vec(&saved).unwrap()).expect("the preferences read").ui; + assert!(ui.control_bar, "the other preferences read as usual"); + ui +} + +/// Preferences saved before the progress was kept read with none. Saved progress keeps only the +/// catalog's tutorials and steps, each once, and a value of the wrong kind, or a huge list, does not +/// stop the rest of the preferences from reading. +#[test] +fn saved_progress_is_read_leniently() { + assert!(read_progress(None).learn_progress.is_empty()); + for bad in [json!("garbage"), json!(3), json!(null), json!([1, 2]), json!({"finished": "pen-paths", "steps": [0]})] { + assert!(read_progress(Some(bad.clone())).learn_progress.is_empty(), "{bad}"); + } + let ui = read_progress(Some(json!({ + "finished": ["pen-paths", "nope", 3, "pen-paths", "gradient"], + "steps": { + "gradient": [0], + "smooth-curves": [2, 0, 2, 99, -1, "1", 1.5], + "nope": [0], + "copy-colors": "x", + "add-headline": [], + }, + }))); + assert_eq!(ui.learn_progress.finished, ["pen-paths", "gradient"]); + let steps: Vec<(&str, Vec)> = ui.learn_progress.steps.iter().map(|(id, s)| (*id, s.clone())).collect(); + assert_eq!(steps, [("smooth-curves", vec![0, 2])], "a finished tutorial keeps no marks"); + let ui = read_progress(Some(json!({"finished": vec!["pen-paths"; 100_000], "steps": {"smooth-curves": vec![1; 100_000]}}))); + assert_eq!(ui.learn_progress.finished, ["pen-paths"]); + assert_eq!(ui.learn_progress.steps.get("smooth-curves"), Some(&vec![1])); +} diff --git a/crates/ui-egui/src/panels/links.rs b/crates/ui-egui/src/panels/links.rs index 2fb130ae3e..f9d9b524c9 100644 --- a/crates/ui-egui/src/panels/links.rs +++ b/crates/ui-egui/src/panels/links.rs @@ -360,8 +360,8 @@ fn badge(ui: &Ui, r: egui::Rect, status: &str) { } /// The tooltip of row `r`. A row outside the layer tree also names where it is stored -/// (`links.list`'s `owner`): the symbol, graph design or pattern whose art holds it, and the object -/// whose opacity mask holds it, by `mask` (that object's name) or else by its id. +/// (`links.list`'s `owner`): the symbol, graph design, pattern or brush whose art holds it, and the +/// object whose opacity mask holds it, by `mask` (that object's name) or else by its id. pub(super) fn status_tip(r: &Value, mask: Option) -> String { let tip = file_tip(r); let owner = &r["owner"]; @@ -370,6 +370,7 @@ pub(super) fn status_tip(r: &Value, mask: Option) -> String { Some("symbol") => Some(tl!("Symbols")), Some("graphDesign") => Some(tl!("Graph Design")), Some("pattern") => Some(tl!("Pattern")), + Some("brush") => Some(tl!("Brushes")), _ => None, }; let tip = match art { diff --git a/crates/ui-egui/src/panels/paragraph.rs b/crates/ui-egui/src/panels/paragraph.rs index ab53932f80..e02d81e14c 100644 --- a/crates/ui-egui/src/panels/paragraph.rs +++ b/crates/ui-egui/src/panels/paragraph.rs @@ -28,8 +28,9 @@ pub const ALIGNMENTS: [(Justify, &str, &str, &str); 7] = [ (Justify::JustifyAll, "dc-para-justify-all", "Justify all lines", "justifyAll"), ]; -/// Paragraph attributes apply to the selected text objects' paragraphs or, while the Type tool -/// edits text, to the paragraphs its selection (or caret) touches (ending its typing session). +/// Paragraph attributes apply to the paragraphs of every frame of the selected stories or, while +/// the Type tool edits text, to the paragraphs its selection (or caret) touches (ending its typing +/// session). fn format(app: &mut VectorcraftApp, p: Value) { para_cmd(app, "text.setFormat", p); } @@ -75,8 +76,16 @@ fn para_cmd(app: &mut VectorcraftApp, cmd: &str, p: Value) { run_on_paragraphs(app, cmd, p).ok(); } -/// Run `cmd` on the paragraphs the Paragraph panel acts on ([`format`]) and return its result. -pub(crate) fn run_on_paragraphs(app: &mut VectorcraftApp, cmd: &str, mut p: Value) -> Result { +/// Run `cmd` on the paragraphs the Paragraph panel acts on ([`format`]) and return its result. With +/// the Selection tool these are the paragraphs of every frame of the selected stories +/// ([`super::character::selected_stories`]). +pub(crate) fn run_on_paragraphs(app: &mut VectorcraftApp, cmd: &str, p: Value) -> Result { + run_on(app, cmd, p, true) +} + +/// [`run_on_paragraphs`], with the Selection tool on the selected type objects alone unless +/// `stories`. +fn run_on(app: &mut VectorcraftApp, cmd: &str, mut p: Value, stories: bool) -> Result { if let Some((id, a, b)) = super::character::text_editing(app) { super::character::end_typing(app); match super::character::text_story(app) { @@ -88,6 +97,8 @@ pub(crate) fn run_on_paragraphs(app: &mut VectorcraftApp, cmd: &str, mut p: Valu p["end"] = json!(b); } } + } else if stories { + super::character::target_selected_stories(app, &mut p); } app.run(cmd, p) } @@ -208,14 +219,10 @@ fn visit_paragraphs(app: &VectorcraftApp, mut f: impl FnMut(&ParaStyle)) { } return; } - for node in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { - node.walk(&mut |c| { - if let NodeKind::Text(t) = &c.kind { - for i in 0..t.paragraph_count() { - f(t.para_at(i)); - } - } - }); + for t in super::character::selected_story_texts(app) { + for i in 0..t.paragraph_count() { + f(t.para_at(i)); + } } } @@ -328,18 +335,8 @@ fn selected_paragraph_direction(app: &VectorcraftApp, fallback: &ParaStyle) -> O { return if collect_text_direction(text, Some((a, b)), &mut shared) { shared.or(default) } else { None }; } - fn collect(node: &vectorcraft_doc::Node, shared: &mut Option) -> bool { - if let NodeKind::Text(text) = &node.kind { - return collect_text_direction(text, None, shared); - } - node.children().is_none_or(|children| children.iter().all(|child| collect(child, shared))) - } - for node in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { - if !collect(node, &mut shared) { - return None; - } - } - shared.or(default) + let texts = super::character::selected_story_texts(app); + if texts.into_iter().all(|t| collect_text_direction(t, None, &mut shared)) { shared.or(default) } else { None } } /// A hyphenation option shared by every paragraph in scope, or `None` when they differ. @@ -365,18 +362,8 @@ fn selected_alignment(app: &VectorcraftApp, fallback: &ParaStyle) -> Option) -> bool { - if let NodeKind::Text(text) = &node.kind { - return collect_text_alignment(text, None, shared); - } - node.children().is_none_or(|children| children.iter().all(|child| collect(child, shared))) - } - for node in st.selection.objects.iter().filter_map(|id| st.doc.node(*id)) { - if !collect(node, &mut shared) { - return None; - } - } - shared.or(default) + let texts = super::character::selected_story_texts(app); + if texts.into_iter().all(|t| collect_text_alignment(t, None, &mut shared)) { shared.or(default) } else { None } } /// The seven alignment buttons shared by Paragraph and Properties; no button is selected @@ -492,7 +479,7 @@ pub(crate) fn number_sample(style: vectorcraft_doc::text::NumberStyle, n: u32) - /// the Type tool's anchor and caret past the characters inserted at or before them). pub(crate) fn convert_list_to_text(app: &mut VectorcraftApp) -> Result { text_style(app).ok_or("select some type first")?; - run_on_paragraphs(app, "text.convertListToText", json!({})) + run_on(app, "text.convertListToText", json!({}), false) } /// The Bullets button and the arrow beside it (Paragraph panel). The button makes the paragraphs diff --git a/crates/ui-egui/src/panels/paragraph/tests.rs b/crates/ui-egui/src/panels/paragraph/tests.rs index 50c17001db..180f0b1fa1 100644 --- a/crates/ui-egui/src/panels/paragraph/tests.rs +++ b/crates/ui-egui/src/panels/paragraph/tests.rs @@ -1035,3 +1035,58 @@ fn reset_panel_leaves_an_undo_group_open_in_another_document() { app.run("edit.undoGroup.end", json!({})).unwrap(); assert_eq!(steps(app.session.active().unwrap()), a_steps, "the later edit is part of the Batch step"); } + +/// With the Selection tool a selected frame of a threaded story stands for the whole story: the +/// Paragraph panel's changes and Reset Panel reach its locked and hidden frames, each in one undo +/// step, other type keeps its paragraphs, and the alignment buttons read every frame. +#[test] +fn selection_tool_paragraph_changes_reach_every_frame_of_the_story() { + let mut app = VectorcraftApp::new(Session::new(), Default::default()); + app.run("file.new", json!({"width": 900, "height": 300})).unwrap(); + let story = "The quick brown fox jumps over the lazy dog.\n".repeat(12); + let area = json!({"x": 10, "y": 10, "text": story, "size": 12, "area": {"width": 150, "height": 60}}); + let a = app.run("text.create", area).unwrap()["id"].as_u64().unwrap(); + let b = app.run("text.thread.add", json!({"from": a, "rect": [200, 10, 150, 60]})).unwrap()["id"].as_u64().unwrap(); + let c = app.run("text.thread.add", json!({"from": b, "rect": [400, 10, 150, 200]})).unwrap()["id"].as_u64().unwrap(); + let other = app.run("text.create", json!({"x": 10, "y": 250, "text": "Other", "size": 12})).unwrap()["id"].as_u64().unwrap(); + app.run("select.set", json!({"ids": [b]})).unwrap(); + app.run("object.lock", json!({})).unwrap(); + app.run("select.set", json!({"ids": [c]})).unwrap(); + app.run("object.hide", json!({})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + let paragraphs = |app: &VectorcraftApp, id: u64| match &app.session.active().unwrap().doc.node(NodeId(id)).unwrap().kind { + NodeKind::Text(t) => (0..t.paragraph_count()).map(|i| t.para_at(i).clone()).collect::>(), + _ => panic!("not text"), + }; + let undo_steps = |app: &VectorcraftApp| app.session.active().unwrap().history.undo.len(); + for id in [a, b, c] { + assert!(!paragraphs(&app, id).is_empty(), "frame {id} holds text"); + } + + let steps = undo_steps(&app); + format(&mut app, json!({"spaceBefore": 4})); + assert_eq!(undo_steps(&app), steps + 1, "one undo step"); + for id in [a, b, c] { + assert!(paragraphs(&app, id).iter().all(|p| (p.space_before - 4.0).abs() < 1e-9), "frame {id} takes the space"); + } + assert!(paragraphs(&app, other).iter().all(|p| p.space_before.abs() < 1e-9), "other type keeps its paragraphs"); + assert_eq!(shared_para_field(&app, |p| p.space_before), Some(4.0)); + + align(&mut app, "center").unwrap(); + for id in [a, b, c] { + assert!(paragraphs(&app, id).iter().all(|p| p.justify == Justify::Center), "frame {id} is centered"); + } + assert!(paragraphs(&app, other).iter().all(|p| p.justify != Justify::Center)); + assert_eq!(selected_alignment(&app, &ParaStyle::default()), Some(Justify::Center)); + // A hidden frame aligned otherwise leaves no alignment button on. + app.run("text.setStyle", json!({"ids": [c], "justify": "right"})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + assert_eq!(selected_alignment(&app, &ParaStyle::default()), None); + + let steps = undo_steps(&app); + reset_panel(&mut app); + assert_eq!(undo_steps(&app), steps + 1, "Reset Panel is one undo step"); + for id in [a, b, c] { + assert!(paragraphs(&app, id).iter().all(|p| p.space_before.abs() < 1e-9 && p.justify == Justify::Auto), "frame {id} is reset"); + } +} diff --git a/crates/ui-egui/src/panels/stroke.rs b/crates/ui-egui/src/panels/stroke.rs index 894b8488f8..c667f01200 100644 --- a/crates/ui-egui/src/panels/stroke.rs +++ b/crates/ui-egui/src/panels/stroke.rs @@ -167,15 +167,19 @@ pub(crate) fn weight_field(app: &mut VectorcraftApp, ui: &mut Ui, id: &str, weig /// "Stroke"): a click toggles the Stroke panel in a popover under it, and a drag scrubs the weight /// field after it ([`crate::scrub`]). pub(crate) fn link(app: &mut VectorcraftApp, ui: &mut Ui, label: &str) { - let t = Tokens::get(ui.ctx()); // A drag on it scrubs the weight field after it (#4088). - let resp = crate::scrub::link_label(ui, egui::RichText::new(label).size(12.0).color(t.text).underline()).on_hover_text(tl!("Stroke options")); + let resp = crate::scrub::link_label(ui, link_text(ui, label)).on_hover_text(tl!("Stroke options")); widgets::popover(&resp, resp.clicked(), |ui| { ui.set_width(260.0); show(app, ui); }); } +/// The text of the Stroke [`link`] labeled `label`, as it draws it and the Control bar measures it. +pub(crate) fn link_text(ui: &Ui, label: &str) -> egui::RichText { + egui::RichText::new(label).size(12.0).color(Tokens::get(ui.ctx()).text).underline() +} + pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { let t = Tokens::get(ui.ctx()); let st = current_stroke(app); @@ -491,12 +495,15 @@ pub fn paint_profile(ui: &Ui, r: Rect, points: Option<&[(f64, f64, f64)]>, color ui.painter().with_clip_rect(r).add(egui::Shape::mesh(mesh)); } +/// The width of the [`profile_dropdown`] button. +pub(crate) const PROFILE_DROPDOWN_WIDTH: f32 = 100.0; + /// The Profile dropdown (Stroke panel, Control bar): the stroke's own silhouette on the button /// (a custom profile too), the built-in profiles and then the saved ones in the list. Returns the /// id or name picked. pub(crate) fn profile_dropdown(app: &VectorcraftApp, ui: &mut Ui, cur: Option<&WidthProfile>) -> Option { let t = Tokens::get(ui.ctx()); - let (r, resp) = ui.allocate_exact_size(vec2(100.0, 24.0), Sense::click()); + let (r, resp) = ui.allocate_exact_size(vec2(PROFILE_DROPDOWN_WIDTH, 24.0), Sense::click()); ui.painter().rect_filled(r, 2, t.input); ui.painter().rect_stroke(r, 2, Stroke::new(1.0, if resp.hovered() { t.text } else { t.input_border }), StrokeKind::Inside); let body = Rect::from_min_max(r.min + vec2(6.0, 5.0), pos2(r.right() - 20.0, r.bottom() - 5.0)); diff --git a/crates/ui-egui/src/panels/tabs.rs b/crates/ui-egui/src/panels/tabs.rs index bc1f9352c3..00814646c5 100644 --- a/crates/ui-egui/src/panels/tabs.rs +++ b/crates/ui-egui/src/panels/tabs.rs @@ -419,7 +419,9 @@ fn stops_json(stops: &[TabStop]) -> Value { ) } -/// Run `text.tabs.set` with `stops` on the text the panel acts on. Returns false when it fails. +/// Run `text.tabs.set` with `stops` on the text the panel acts on: with the Selection tool, every +/// frame of the selected stories ([`super::character::selected_stories`]). Returns false when it +/// fails. fn apply(app: &mut VectorcraftApp, stops: &[TabStop]) -> bool { if let Some((id, a, b)) = super::character::text_editing(app) { super::character::end_typing(app); @@ -430,7 +432,9 @@ fn apply(app: &mut VectorcraftApp, stops: &[TabStop]) -> bool { }; app.run("text.tabs.set", p).is_ok() } else { - app.run("text.tabs.set", json!({"stops": stops_json(stops)})).is_ok() + let mut p = json!({"stops": stops_json(stops)}); + super::character::target_selected_stories(app, &mut p); + app.run("text.tabs.set", p).is_ok() } } @@ -727,6 +731,20 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { resp.on_hover_text(tl!("Click to add a tab stop, drag to move it, drag it off the ruler to delete it")); } +/// Whether a paragraph of the whole story Clear All Tabs acts on has tab stops: after Select All in +/// threaded text, every frame of the edited story; with the Selection tool, every frame of the +/// selected stories ([`super::character::selected_stories`]). +fn story_has_tabs(app: &VectorcraftApp) -> bool { + let has_tabs = |t: &TextObject| (0..t.paragraph_count()).any(|i| !t.para_at(i).tabs.is_empty()); + match (super::character::text_editing(app), super::character::text_story(app), app.session.active()) { + (Some(_), Some(story), Some(st)) => { + story.iter().any(|id| matches!(st.doc.node(*id).map(|n| &n.kind), Some(NodeKind::Text(t)) if has_tabs(t))) + } + (Some(_), _, _) => false, + (None, _, _) => super::character::selected_story_texts(app).into_iter().any(has_tabs), + } +} + pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { let Some((_, para, _)) = current_para(app) else { ui.add_enabled(false, egui::Button::new(tl!("Select text")).frame(false)); @@ -742,7 +760,7 @@ pub fn menu(app: &mut VectorcraftApp, ui: &mut Ui) { if sel >= stops.len() { sel = stops.len().saturating_sub(1); } - if menu_item(ui, tl!("Clear All Tabs"), !stops.is_empty(), false) + if menu_item(ui, tl!("Clear All Tabs"), !stops.is_empty() || story_has_tabs(app), false) && let Err(e) = super::paragraph::run_on_paragraphs(app, "text.tabs.clear", json!({})) { app.status(e); diff --git a/crates/ui-egui/src/panels/tabs/tests.rs b/crates/ui-egui/src/panels/tabs/tests.rs index 6472b1017b..e260db70ab 100644 --- a/crates/ui-egui/src/panels/tabs/tests.rs +++ b/crates/ui-egui/src/panels/tabs/tests.rs @@ -642,6 +642,43 @@ fn text_of(app: &VectorcraftApp, id: u64) -> vectorcraft_doc::TextObject { } } +/// With the Selection tool, tab stops set in the panel go to every paragraph of every frame of a +/// selected threaded story, its locked and hidden frames included. +#[test] +fn selection_tool_tab_stops_reach_every_frame_of_the_story() { + let (mut app, frames) = split_story_app(); + app.run("select.set", json!({"ids": [frames[1]]})).unwrap(); + app.run("object.lock", json!({})).unwrap(); + app.run("select.set", json!({"ids": [frames[2]]})).unwrap(); + app.run("object.hide", json!({})).unwrap(); + app.run("select.set", json!({"ids": [frames[0]]})).unwrap(); + let stop = TabStop { position: 36.0, align: Default::default(), leader: String::new(), align_on: '.' }; + assert!(apply(&mut app, std::slice::from_ref(&stop))); + for id in frames { + let t = text_of(&app, id); + assert!((0..t.paragraph_count()).all(|i| t.para_at(i).tabs == [stop.clone()]), "frame {id} takes the stop"); + } +} + +/// With the Selection tool, Clear All Tabs is on when only another frame of the selected story has +/// tab stops, and clears them there. +#[test] +fn clear_all_tabs_is_on_when_another_frame_of_the_story_has_stops() { + let (mut app, [a, b, c]) = split_story_app(); + app.run("text.tabs.set", json!({"ids": [c], "stops": [{"position": 36}]})).unwrap(); + app.run("select.set", json!({"ids": [c]})).unwrap(); + app.run("object.hide", json!({})).unwrap(); + app.run("select.set", json!({"ids": [a]})).unwrap(); + assert!(current(&app).unwrap().1.is_empty(), "the selected frame has no stops"); + assert!(story_has_tabs(&app)); + super::super::paragraph::run_on_paragraphs(&mut app, "text.tabs.clear", json!({})).unwrap(); + for id in [a, b, c] { + let t = text_of(&app, id); + assert!((0..t.paragraph_count()).all(|i| t.para_at(i).tabs.is_empty()), "frame {id} has no stops"); + } + assert!(!story_has_tabs(&app)); +} + /// Each paragraph of the story of `frames` by its first word, with its left indent and first-line /// position, counted once; each piece of a paragraph split between frames has the same values. fn story_paragraphs(app: &VectorcraftApp, frames: &[u64]) -> Vec<(String, f64, f64)> { diff --git a/crates/ui-egui/src/panels/tests_links.rs b/crates/ui-egui/src/panels/tests_links.rs index 8055c1288c..6b773e9d3b 100644 --- a/crates/ui-egui/src/panels/tests_links.rs +++ b/crates/ui-egui/src/panels/tests_links.rs @@ -189,6 +189,7 @@ fn a_nested_rows_tooltip_names_what_holds_it() { assert_eq!(tip(json!({"kind": "symbol", "name": "Mark"}), None), "/x/a.png\nSymbols: Mark"); assert_eq!(tip(json!({"kind": "pattern", "name": "Dots"}), None), "/x/a.png\nPattern: Dots"); assert_eq!(tip(json!({"kind": "graphDesign", "name": "Bar"}), None), "/x/a.png\nGraph Design: Bar"); + assert_eq!(tip(json!({"kind": "brush", "name": "Leaf", "index": 2}), None), "/x/a.png\nBrushes: Leaf"); assert_eq!(tip(json!({"kind": "layers", "maskOf": 7}), Some("")), "/x/a.png\nOpacity Mask: "); assert_eq!(tip(json!({"kind": "symbol", "name": "Mark", "maskOf": 7}), None), "/x/a.png\nSymbols: Mark\nOpacity Mask: 7"); // A row in the layers says only its file. diff --git a/crates/ui-egui/src/panels/tests_symbol_libraries.rs b/crates/ui-egui/src/panels/tests_symbol_libraries.rs index 9c58bc49c7..955b14327a 100644 --- a/crates/ui-egui/src/panels/tests_symbol_libraries.rs +++ b/crates/ui-egui/src/panels/tests_symbol_libraries.rs @@ -144,7 +144,10 @@ fn the_window_menu_and_the_symbols_panel_open_symbol_libraries() { let under = |e: &crate::menus::MenuEntry| e.path == ["Window", "Symbol Libraries"]; let opened: Vec<_> = entries.iter().filter(|e| under(e) && e.command.as_deref() == Some("window.symbolLibrary")).map(|e| e.params["library"].clone()).collect(); - assert_eq!(opened, [json!("basic-shapes"), json!("ui-frames"), json!("map-markers"), json!("inventory-icons"), json!("skill-icons")]); + assert_eq!( + opened, + [json!("basic-shapes"), json!("ui-frames"), json!("map-markers"), json!("inventory-icons"), json!("skill-icons"), json!("weather-icons")] + ); let has = |cmd: &str| entries.iter().find(|e| under(e) && e.command.as_deref() == Some(cmd)).map(|e| e.enabled); assert_eq!(has("window.symbolLibrary.other"), Some(true)); assert_eq!(has("ui.saveSymbolLibrary"), Some(false), "no symbols to save yet"); diff --git a/crates/ui-egui/src/placing.rs b/crates/ui-egui/src/placing.rs index 11ae770d5d..a627321d76 100644 --- a/crates/ui-egui/src/placing.rs +++ b/crates/ui-egui/src/placing.rs @@ -178,6 +178,23 @@ pub struct Placing { pub(crate) reading: std::sync::Arc<[std::sync::atomic::AtomicUsize; 2]>, } +impl Placing { + /// Unit tests: wait until the reader thread has finished every read started so far. The thread + /// runs its jobs in order, so a job sent after them runs once they have handed back their files. + #[cfg(test)] + pub(crate) fn wait_for_reads(&self) { + if let Some(reader) = &self.reader { + let (tx, rx) = channel(); + let marker: Job = Box::new(move || { + let _ = tx.send(()); + }); + if reader.send(marker).is_ok() { + let _ = rx.recv(); + } + } + } +} + struct PendingSwatch { clipboard: Clipboard, insertion: Insertion, diff --git a/crates/ui-egui/src/prefs_dialog.rs b/crates/ui-egui/src/prefs_dialog.rs index fbea47770b..9029459195 100644 --- a/crates/ui-egui/src/prefs_dialog.rs +++ b/crates/ui-egui/src/prefs_dialog.rs @@ -42,6 +42,9 @@ pub fn open(app: &mut VectorcraftApp, category: Option<&str>) { // Read-only: whether VECTORCRAFT_TITLEBAR chose this window's frame (System Title Bar's dimmed // row and VectorCraft Title Bar on Every Desktop's note). fields.insert("__titlebarFromEnv".into(), json!(app.titlebar_from_env)); + // Read-only: whether the desktop would draw this window's frame with System Title Bar on or off + // while VectorCraft Title Bar on Every Desktop is off (System Title Bar's note). + fields.insert("__desktopKeepsFrame".into(), json!(app.desktop_keeps_frame)); fields.insert("__search".into(), json!("")); fields.insert("__focusSearch".into(), json!(true)); app.ui.dialog = Some(Dialog { kind: "preferences".into(), fields }); @@ -535,6 +538,14 @@ fn category_fields(ui: &mut egui::Ui, app: &mut VectorcraftApp, d: &mut Dialog, if !APP_TITLE_BAR_SHOWN { ui.label(egui::RichText::new(tl!("Applies the next time VectorCraft starts.")).color(t.text_dim).size(11.0)); } + // Where the desktop draws the frame, the desktop's title bar stays with this + // option on or off until VectorCraft Title Bar on Every Desktop is turned on. + if APP_TITLE_BAR_SHOWN && d.bool("__desktopKeepsFrame") && !d.bool("__titlebarFromEnv") && !d.bool("appTitleBar") { + let note = tl!( + "This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off." + ); + ui.label(egui::RichText::new(note).color(t.text_dim).size(11.0)); + } } } // Linux and the BSDs only, where the desktop may draw the frame: dimmed while System diff --git a/crates/ui-egui/src/prefs_dialog/tests.rs b/crates/ui-egui/src/prefs_dialog/tests.rs index fe8dc72aa3..6c7382200f 100644 --- a/crates/ui-egui/src/prefs_dialog/tests.rs +++ b/crates/ui-egui/src/prefs_dialog/tests.rs @@ -581,6 +581,46 @@ fn system_title_bar_is_dimmed_while_the_environment_variable_chooses_the_frame() } } +/// Where the desktop draws the frame with System Title Bar on or off (KDE, Sway, X11, a window +/// opened through XWayland), a note under System Title Bar says so while VectorCraft Title Bar on +/// Every Desktop is off and VECTORCRAFT_TITLEBAR is unset. Linux and the BSDs only. +#[test] +fn system_title_bar_says_when_the_desktop_keeps_the_frame() { + fn texts(s: &egui::Shape, out: &mut Vec) { + match s { + egui::Shape::Text(t) => out.push(t.galley.text().to_string()), + egui::Shape::Vec(v) => v.iter().for_each(|s| texts(s, out)), + _ => {} + } + } + let note = "This desktop draws the window's title bar with this option on or off while VectorCraft Title Bar on Every Desktop is off."; + let supported = cfg!(not(any(target_arch = "wasm32", target_os = "macos", target_os = "windows"))); + for keeps in [false, true] { + for from_env in [false, true] { + for (app_title_bar, system) in [(false, false), (false, true), (true, false), (true, true)] { + let mut a = app(); + a.desktop_keeps_frame = keeps; + a.titlebar_from_env = from_env; + open(&mut a, Some("User Interface")); + let fields = &mut a.ui.dialog.as_mut().unwrap().fields; + fields.insert("appTitleBar".into(), json!(app_title_bar)); + fields.insert("systemTitleBar".into(), json!(system)); + let ctx = egui::Context::default(); + crate::theme::install_fonts(&ctx); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(&mut a, ui.ctx())); + out.textures_delta.clear(); + let mut out = ctx.run_ui(egui::RawInput::default(), |ui| show(&mut a, ui.ctx())); + out.textures_delta.clear(); + let mut shown = vec![]; + out.shapes.iter().for_each(|c| texts(&c.shape, &mut shown)); + let expected = supported && keeps && !from_env && !app_title_bar; + let label = format!("keeps {keeps}, variable {from_env}, app title bar {app_title_bar}, system {system}: {shown:?}"); + assert_eq!(shown.iter().any(|t| t == note), expected, "{label}"); + } + } + } +} + /// Performance › Linux Display Server (#2028): on Linux it shows the drawing-tablet note, and /// X11 (XWayland) When a Pen Is Attached is applied by OK and saved under the key the desktop /// app reads before the window opens. diff --git a/crates/ui-egui/src/recovery.rs b/crates/ui-egui/src/recovery.rs index 3b05ba0120..9d787954ea 100644 --- a/crates/ui-egui/src/recovery.rs +++ b/crates/ui-egui/src/recovery.rs @@ -29,6 +29,17 @@ pub struct Timer { /// The recovery folders that failure messages named, latest last, at most [`NAMED`]: replies to /// automation clients hide those outside their read roots. pub named: Vec, + /// The restored documents whose linked files are still to be asked about, next first + /// ([`ask_next`]). + links: Vec, +} + +/// The questions about the linked files of a restored document (by uid): the missing files, then +/// the modified images (ids) to offer for update ([`crate::dialogs::missing_links::ask_next`]). +struct LinkQuestions { + uid: u64, + missing: Vec, + modified: Vec, } /// How many recovery folders [`Timer::named`] keeps. @@ -114,24 +125,37 @@ fn write(app: &mut VectorcraftApp, store: &Arc, pick: impl Fn for job in jobs { let (uid, label, title) = (job.uid, format!("Saving recovery data for {}", job.title), job.title.clone()); let (done, at, saving) = (job.clone(), place.clone(), label.clone()); + // The status line before the job starts: on the worker, the job sets one line ("