mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-06 05:53:08 -05:00
Merge main into fix/windows-font-registry-watch
This commit is contained in:
commit
8ad649086e
23 files changed
+464
-90
No files matched your search
Generated
+1
@@ -8780,6 +8780,7 @@ name = "vectorcraft-doc"
|
||||
version = "0.25.1"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-i18n",
|
||||
"craft-image-codecs",
|
||||
"craft-stream-codecs",
|
||||
"flate2",
|
||||
|
||||
@@ -29,6 +29,8 @@ craft-cdr = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9c
|
||||
# SVG parsing, limits, SVGZ and writer (craft-libs#778).
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e", features = ["tree"] }
|
||||
craft-mime = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
|
||||
# Digits typed in any script in numeric fields (`vectorcraft_doc::units`).
|
||||
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
|
||||
# EPS container, previews, ASCII85 and DSC comments (craft-libs#778).
|
||||
craft-eps = { git = "https://github.com/storytold/craft-libs", rev = "f9e5cecc9cf1b701b22f6f24a88719b14456323e" }
|
||||
# DXF tags, reader and writer (craft-libs#778, #926, #927).
|
||||
|
||||
@@ -80,7 +80,54 @@ fn a_dialog_is_marked_while_it_shows_and_not_after() {
|
||||
/// File → Show in Folder: select `path` in Finder / Explorer, or open its folder elsewhere.
|
||||
fn reveal(path: &str) -> Result<(), String> {
|
||||
explorer_safe(path)?;
|
||||
reveal_command(path).spawn().map(|_| ()).map_err(|e| format!("can't show {path}: {e}"))
|
||||
spawn_detached(&mut reveal_command(path)).map(drop).map_err(|e| format!("can't show {path}: {e}"))
|
||||
}
|
||||
|
||||
/// The thread that waits for a process [`spawn_detached`] started; it returns the exit status.
|
||||
pub(crate) type Reaper = std::thread::JoinHandle<std::io::Result<std::process::ExitStatus>>;
|
||||
|
||||
/// Starts `c` without the caller waiting for it. On Windows dropping the `Child` closes its handle,
|
||||
/// so there is no reaper. Elsewhere a thread waits for the process, so it is reaped when it ends
|
||||
/// instead of staying a zombie until the app exits. The thread starts first, so a process is never
|
||||
/// started without a waiter.
|
||||
pub(crate) fn spawn_detached(c: &mut std::process::Command) -> std::io::Result<Option<Reaper>> {
|
||||
#[cfg(windows)]
|
||||
let started = c.spawn().map(|_| None);
|
||||
#[cfg(not(windows))]
|
||||
let started = {
|
||||
let (send, receive) = std::sync::mpsc::channel::<std::process::Child>();
|
||||
let reaper = std::thread::Builder::new().name("process reaper".into()).spawn(move || match receive.recv() {
|
||||
Ok(mut child) => child.wait(),
|
||||
Err(_) => Err(std::io::Error::other("the process did not start")),
|
||||
})?;
|
||||
let child = c.spawn()?;
|
||||
// The reaper holds the receiver until it gets the child, so this send always arrives.
|
||||
let _ = send.send(child);
|
||||
Ok(Some(reaper))
|
||||
};
|
||||
started
|
||||
}
|
||||
|
||||
/// Linux keeps `/proc/<pid>` in state `Z` for a process that ended until its parent waits for it.
|
||||
/// A pid the kernel has given to a new process since is not in state `Z`.
|
||||
#[cfg(all(test, target_os = "linux"))]
|
||||
#[test]
|
||||
fn a_started_process_is_reaped_once_it_ends() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let pid_file = dir.path().join("pid");
|
||||
let mut c = std::process::Command::new("sh");
|
||||
c.arg("-c").arg("echo $$ > \"$1\"; exit 3").arg("sh").arg(&pid_file);
|
||||
let reaper = spawn_detached(&mut c).unwrap().expect("a reaper on Linux");
|
||||
let status = reaper.join().unwrap().unwrap();
|
||||
let pid = std::fs::read_to_string(&pid_file).unwrap();
|
||||
let pid = pid.trim().to_string();
|
||||
assert!(!pid.is_empty(), "the process wrote its pid");
|
||||
// `/proc/<pid>/stat` is `pid (comm) state ...`; a missing file means the pid is free.
|
||||
let state = std::fs::read_to_string(format!("/proc/{pid}/stat"))
|
||||
.ok()
|
||||
.and_then(|s| s.rsplit_once(") ").and_then(|(_, rest)| rest.split(' ').next().map(str::to_string)));
|
||||
assert_ne!(state.as_deref(), Some("Z"), "process {pid} is still a zombie");
|
||||
assert_eq!(status.code(), Some(3), "the reaper reads the process's own exit");
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
@@ -114,14 +161,14 @@ fn open_file_url(url: &str) -> Result<(), String> {
|
||||
webbrowser::open(url).map_err(|e| format!("can't open {url}: {e}"))
|
||||
}
|
||||
|
||||
/// Opens a link with the system's handler, without waiting for it:
|
||||
/// Opens a link with the system's handler, without the caller waiting for it:
|
||||
/// `craft::platform::open::open_external` on macOS and Windows, xdg-open elsewhere ([`link_command`]).
|
||||
pub(crate) fn open_link(url: &str) -> Result<(), String> {
|
||||
#[cfg(not(any(target_os = "macos", windows)))]
|
||||
{
|
||||
let mut c = link_command(url)?;
|
||||
c.stdin(std::process::Stdio::null()).stdout(std::process::Stdio::null()).stderr(std::process::Stdio::null());
|
||||
c.spawn().map(|_| ()).map_err(|e| format!("can't open {url}: {e}"))
|
||||
spawn_detached(&mut c).map(drop).map_err(|e| format!("can't open {url}: {e}"))
|
||||
}
|
||||
#[cfg(any(target_os = "macos", windows))]
|
||||
{
|
||||
@@ -265,7 +312,7 @@ fn open_file(path: &str) -> Result<(), String> {
|
||||
let mut c = std::process::Command::new("xdg-open");
|
||||
#[cfg(not(windows))]
|
||||
c.arg(path);
|
||||
c.spawn().map(|_| ()).map_err(|e| format!("can't open {path}: {e}"))
|
||||
spawn_detached(&mut c).map(drop).map_err(|e| format!("can't open {path}: {e}"))
|
||||
}
|
||||
|
||||
/// Edit Original with Preferences › File Handling › Use System Defaults for Edit Original off
|
||||
@@ -340,7 +387,7 @@ fn launch_application(app: &std::path::Path, path: &str) -> Result<bool, String>
|
||||
}
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
c.spawn().map(|_| true).map_err(|e| format!("can't open {path} in {}: {e}", app.display()))
|
||||
spawn_detached(&mut c).map(|_| true).map_err(|e| format!("can't open {path} in {}: {e}", app.display()))
|
||||
}
|
||||
|
||||
/// PhotoCraft where it is installed: the first of [`photocraft_candidates`] that is an application.
|
||||
|
||||
@@ -459,21 +459,82 @@ mod system {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
let _ = printer;
|
||||
Command::new("open")
|
||||
.arg("x-apple.systempreferences:com.apple.Print-Scan-Settings.extension")
|
||||
.spawn()
|
||||
.map(|_| ())
|
||||
.map_err(|e| e.to_string())
|
||||
let mut open = Command::new("open");
|
||||
open.arg("x-apple.systempreferences:com.apple.Print-Scan-Settings.extension");
|
||||
start_first([open]).map(drop).map_err(|e| e.to_string())
|
||||
}
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
{
|
||||
if Command::new("system-config-printer").spawn().is_ok() {
|
||||
return Ok(());
|
||||
}
|
||||
let url = printer.map_or_else(|| "http://localhost:631/printers/".to_string(), |p| format!("http://localhost:631/printers/{p}"));
|
||||
Command::new("xdg-open").arg(url).spawn().map(|_| ()).map_err(|e| e.to_string())
|
||||
start_first(setup_commands(printer)).map(drop).map_err(|e| e.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
/// The commands [`setup`] tries in order on Linux and the BSDs: the printer settings app, then the
|
||||
/// CUPS web page for `printer` (or the printer list) in the browser.
|
||||
#[cfg(not(any(windows, target_os = "macos")))]
|
||||
pub(super) fn setup_commands(printer: Option<&str>) -> [Command; 2] {
|
||||
let url = printer.map_or_else(|| "http://localhost:631/printers/".to_string(), |p| format!("http://localhost:631/printers/{p}"));
|
||||
let mut open = Command::new("xdg-open");
|
||||
open.arg(url);
|
||||
[Command::new("system-config-printer"), open]
|
||||
}
|
||||
|
||||
/// Starts the first of `commands` that starts, through [`crate::host_services::spawn_detached`], so
|
||||
/// it is reaped when it ends. Returns the last error when none starts.
|
||||
#[cfg(not(windows))]
|
||||
pub(super) fn start_first(commands: impl IntoIterator<Item = Command>) -> std::io::Result<Option<crate::host_services::Reaper>> {
|
||||
let mut last = std::io::Error::other("no command to start");
|
||||
for mut c in commands {
|
||||
match crate::host_services::spawn_detached(&mut c) {
|
||||
Ok(reaper) => return Ok(reaper),
|
||||
Err(e) => last = e,
|
||||
}
|
||||
}
|
||||
Err(last)
|
||||
}
|
||||
}
|
||||
|
||||
/// Linux keeps `/proc/<pid>` in state `Z` for a process that ended until its parent waits for it.
|
||||
#[cfg(all(test, target_os = "linux"))]
|
||||
mod setup_tests {
|
||||
use super::system::{setup_commands, start_first};
|
||||
use std::process::Command;
|
||||
|
||||
#[test]
|
||||
fn printer_setup_tries_the_settings_app_then_the_cups_page() {
|
||||
let [app, page] = setup_commands(Some("Office Laser"));
|
||||
assert_eq!(app.get_program(), "system-config-printer");
|
||||
assert_eq!(app.get_args().count(), 0);
|
||||
assert_eq!(page.get_program(), "xdg-open");
|
||||
assert_eq!(page.get_args().collect::<Vec<_>>(), ["http://localhost:631/printers/Office Laser"]);
|
||||
let [_, list] = setup_commands(None);
|
||||
assert_eq!(list.get_args().collect::<Vec<_>>(), ["http://localhost:631/printers/"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_settings_fallback_is_reaped_once_it_ends() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let pid_file = dir.path().join("pid");
|
||||
let mut fallback = Command::new("sh");
|
||||
fallback.arg("-c").arg("echo $$ > \"$1\"; exit 3").arg("sh").arg(&pid_file);
|
||||
let reaper = start_first([Command::new("vectorcraft-no-such-program"), fallback]).unwrap().expect("a reaper on Linux");
|
||||
let status = reaper.join().unwrap().unwrap();
|
||||
assert_eq!(status.code(), Some(3), "the fallback ran after the missing program");
|
||||
let pid = std::fs::read_to_string(&pid_file).unwrap();
|
||||
let pid = pid.trim();
|
||||
assert!(!pid.is_empty(), "the process wrote its pid");
|
||||
let state = std::fs::read_to_string(format!("/proc/{pid}/stat"))
|
||||
.ok()
|
||||
.and_then(|s| s.rsplit_once(") ").and_then(|(_, rest)| rest.split(' ').next().map(str::to_string)));
|
||||
assert_ne!(state.as_deref(), Some("Z"), "process {pid} is still a zombie");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_no_command_starting_the_last_error_is_returned() {
|
||||
// A missing program fails with NotFound; a directory fails with PermissionDenied.
|
||||
let err = start_first([Command::new("vectorcraft-no-such-program"), Command::new("/")]).unwrap_err();
|
||||
assert_eq!(err.kind(), std::io::ErrorKind::PermissionDenied);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(test, windows))]
|
||||
|
||||
@@ -34,6 +34,8 @@ serde_json = { workspace = true }
|
||||
sha2 = { version = "0.10", default-features = false }
|
||||
thiserror = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
# Field text in Devanagari, Gujarati and other Unicode digits (`units`).
|
||||
craft-i18n = { workspace = true }
|
||||
|
||||
[dev-dependencies]
|
||||
flate2 = { workspace = true }
|
||||
|
||||
@@ -180,7 +180,7 @@ use limits::MAX_NEXT_ID;
|
||||
pub use limits::{DocError, FORMAT_VERSION, MAX_COORD};
|
||||
pub use records::{ImageBlob, MaskEdit, NewArtIds, SavedSelection, SavedView, SvgFilter, Symbol, SymbolEdit};
|
||||
pub use stored_art::{StoredPlace, StoredRoot};
|
||||
pub use units::{ColorMode, Unit, arithmetic_signs, decimal_point, finite_in_every_unit, parse_number};
|
||||
pub use units::{ColorMode, Unit, arithmetic_signs, ascii_digits, ascii_digits_one_number, decimal_point, finite_in_every_unit, parse_number};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Document {
|
||||
|
||||
+96
-5
@@ -25,6 +25,16 @@ fn ends(segs: &[PathSeg]) -> Option<[(Point, Vec2); 2]> {
|
||||
Some([(first.start(), -tangent(first, 0.0)), (last.end(), tangent(last, 1.0))])
|
||||
}
|
||||
|
||||
/// `out` grown to take in the corners of the projecting caps, reaching `side` past each end of the
|
||||
/// open subpath `segs`.
|
||||
fn square_corners(mut out: Rect, segs: &[PathSeg], side: f64) -> Rect {
|
||||
for (at, dir) in ends(segs).into_iter().flatten() {
|
||||
let n = Vec2::new(-dir.y, dir.x) * side;
|
||||
out = out.union_pt(at + dir * side + n).union_pt(at + dir * side - n);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// The joints between consecutive segments (and, `closed`, where the subpath closes): the point
|
||||
/// and the unit tangents in and out.
|
||||
fn joints(segs: &[PathSeg], closed: bool) -> impl Iterator<Item = (Point, Vec2, Vec2)> + '_ {
|
||||
@@ -263,6 +273,9 @@ impl StrokeLayer {
|
||||
// box needed.
|
||||
let even_only = !subs.iter().any(|s| self.stops_at_corners(s.1));
|
||||
let mut even = even_only.then_some(bounds);
|
||||
// Tip-aligned arrowheads shorten the line, and its caps sit on the shortened ends.
|
||||
let pieces = crate::arrow::stroke_pieces(bp, self);
|
||||
let shortened = matches!(pieces.line, std::borrow::Cow::Owned(_));
|
||||
for (r, closed) in subs {
|
||||
let side = self.side_reach(closed);
|
||||
let butt = self.cap == LineCap::Butt && !closed;
|
||||
@@ -309,14 +322,40 @@ impl StrokeLayer {
|
||||
} else if !even_only {
|
||||
even = vectorcraft_geom::union_opt(even, segs.iter().map(ParamCurveExtrema::bounding_box).reduce(|a, b| a.union(b)));
|
||||
}
|
||||
if square {
|
||||
for (at, dir) in ends(&segs).into_iter().flatten() {
|
||||
let n = Vec2::new(-dir.y, dir.x) * side;
|
||||
out = out.union_pt(at + dir * side + n).union_pt(at + dir * side - n);
|
||||
if square && !shortened {
|
||||
out = square_corners(out, &segs, side);
|
||||
}
|
||||
}
|
||||
if shortened && self.cap == LineCap::Square {
|
||||
let line = pieces.line.elements();
|
||||
// The renderer aligns the stroke along every subpath by whether the path ends closed.
|
||||
let side = self.side_reach(matches!(bp.elements().last(), Some(vectorcraft_geom::PathEl::ClosePath)));
|
||||
for (r, closed) in subpaths(&pieces.line) {
|
||||
if side <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
if closed {
|
||||
// A closed subpath with no length, a lone anchor included, paints the dot at the
|
||||
// whole path's reach when the stroke draws dots.
|
||||
if !self.draws_dots() || vectorcraft_geom::kurbo::segments(line[r.clone()].iter().copied()).any(|s| has_length(&s)) {
|
||||
continue;
|
||||
}
|
||||
let lone = line[r.start].end_point().map(|p| Rect::from_points(p, p));
|
||||
let dot = segments(&line[r]).iter().map(ParamCurveExtrema::bounding_box).reduce(|a, b| a.union(b)).or(lone);
|
||||
out = dot.map_or(out, |d| out.union(d.inflate(side, side)));
|
||||
continue;
|
||||
}
|
||||
let segs = drawn(&line[r.clone()]);
|
||||
if segs.is_empty() {
|
||||
// A trim that leaves no length still paints the caps' dot.
|
||||
let dot = segments(&line[r]).iter().map(ParamCurveExtrema::bounding_box).reduce(|a, b| a.union(b));
|
||||
out = dot.map_or(out, |d| out.union(d.inflate(side, side)));
|
||||
} else {
|
||||
out = square_corners(out, &segs, side);
|
||||
}
|
||||
}
|
||||
}
|
||||
for head in crate::arrow::stroke_pieces(bp, self).heads {
|
||||
for head in pieces.heads {
|
||||
if !head.outline.elements().is_empty() {
|
||||
out = out.union(head.outline.bounding_box());
|
||||
}
|
||||
@@ -710,6 +749,58 @@ mod tests {
|
||||
assert_eq!(bounds.x1, b.x1, "the end has no head and a butt cap");
|
||||
}
|
||||
|
||||
/// A Tip-aligned arrowhead shortens the line, and the projecting cap sits on the shortened end:
|
||||
/// the box takes in that cap's corners, and not the corners a cap on the path's own end would have.
|
||||
#[test]
|
||||
fn projecting_caps_under_tip_aligned_arrowheads_sit_on_the_shortened_ends() {
|
||||
let l = line();
|
||||
let b = l.bounding_box();
|
||||
let st = stroke(10.0, |s| {
|
||||
s.cap = LineCap::Square;
|
||||
s.join = LineJoin::Bevel;
|
||||
s.end_arrow = Some(Arrowhead::Triangle);
|
||||
s.arrow_align = ArrowAlign::Tip;
|
||||
});
|
||||
let pieces = crate::arrow::stroke_pieces(&l, &st);
|
||||
let segs = drawn(pieces.line.elements());
|
||||
let [_, (at, dir)] = ends(&segs).unwrap_or_else(|| panic!("the arrowhead covers the whole line"));
|
||||
assert!(at.x < 95.0 && (dir.x - 1.0).abs() < 1e-9, "{at:?} {dir:?}");
|
||||
let bounds = st.bounds_on(&l, b);
|
||||
let n = Vec2::new(-dir.y, dir.x) * 5.0;
|
||||
for corner in [at + dir * 5.0 + n, at + dir * 5.0 - n] {
|
||||
assert!(bounds.inflate(1e-9, 1e-9).contains(corner), "{corner:?} outside {bounds:?}");
|
||||
}
|
||||
// Nothing is painted right of the head's tip at x = 100; a cap on the path's own end would
|
||||
// reach to x = 105.
|
||||
let head = pieces.heads.iter().map(|h| h.outline.bounding_box()).reduce(|a, h| a.union(h));
|
||||
assert_eq!(head.map(|h| h.x1), Some(100.0));
|
||||
assert_eq!(bounds.x1, 100.0, "{bounds:?}");
|
||||
// The start has no head, and its cap projects 5 in front of it.
|
||||
assert_eq!(bounds.x0, -5.0, "{bounds:?}");
|
||||
}
|
||||
|
||||
/// A closed lone anchor in a path that ends open is painted as a dot at the whole path's reach,
|
||||
/// so the box takes it in when a Tip-aligned arrowhead moves the start cap off that anchor.
|
||||
#[test]
|
||||
fn closed_lone_anchors_keep_their_dot_under_tip_aligned_arrowheads() {
|
||||
let mut p = BezPath::new();
|
||||
p.move_to((0.0, 0.0));
|
||||
p.line_to((100.0, 0.0));
|
||||
p.move_to((0.0, 0.0));
|
||||
p.close_path();
|
||||
p.move_to((110.0, 0.0));
|
||||
p.line_to((120.0, 0.0));
|
||||
let st = stroke(10.0, |s| {
|
||||
s.cap = LineCap::Square;
|
||||
s.join = LineJoin::Bevel;
|
||||
s.align = StrokeAlign::Inside;
|
||||
s.start_arrow = Some(Arrowhead::Triangle);
|
||||
s.arrow_align = ArrowAlign::Tip;
|
||||
});
|
||||
let bounds = st.bounds_on(&p, p.bounding_box());
|
||||
assert_eq!(bounds.x0, -5.0, "the lone anchor's square dot reaches 5 left of it: {bounds:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rectangles_keep_exact_bounds_and_sharp_corners_spike_up_to_the_limit() {
|
||||
let sq = square();
|
||||
|
||||
@@ -303,3 +303,43 @@ fn format_area_formats_and_trims_cleanly() {
|
||||
assert_eq!(Unit::Points.format_area(f64::NAN), "0 pt²");
|
||||
assert_eq!(Unit::Points.format_area(f64::INFINITY), "0 pt²");
|
||||
}
|
||||
|
||||
/// Typed in Devanagari or Gujarati digits, a field value reads as its ASCII spelling does:
|
||||
/// plain numbers, units, picas, arithmetic, percentages and a decimal comma.
|
||||
#[test]
|
||||
fn hindi_and_gujarati_digits_read_as_ascii_digits_do() {
|
||||
let ascii = ["12", "12.5 mm", "-3in", "2p6", "45*2", "10x2 mm", "100pt+25%", "1080/2 px", "13q"];
|
||||
let hindi = ["१२", "१२.५ mm", "-३in", "२p६", "४५*२", "१०x२ mm", "१००pt+२५%", "१०८०/२ px", "१३q"];
|
||||
let gujarati = ["૧૨", "૧૨.૫ mm", "-૩in", "૨p૬", "૪૫*૨", "૧૦x૨ mm", "૧૦૦pt+૨૫%", "૧૦૮૦/૨ px", "૧૩q"];
|
||||
for ((a, h), g) in ascii.iter().zip(hindi).zip(gujarati) {
|
||||
let want = Unit::Millimeters.parse(a);
|
||||
assert!(want.is_some(), "`{a}` should read");
|
||||
assert_eq!(Unit::Millimeters.parse(h), want, "`{h}` vs `{a}`");
|
||||
assert_eq!(Unit::Millimeters.parse(g), want, "`{g}` vs `{a}`");
|
||||
}
|
||||
assert_eq!(crate::parse_number("४५*२"), crate::parse_number("45*2"));
|
||||
assert_eq!(crate::parse_number("૪૫x૨"), crate::parse_number("45x2"));
|
||||
assert_eq!(Unit::Millimeters.parse_with_decimal_comma("०,५ mm"), Unit::Millimeters.parse("0.5 mm"));
|
||||
assert_eq!(Unit::Millimeters.parse_with_decimal_comma("૦,૫"), Unit::Millimeters.parse("0.5"));
|
||||
}
|
||||
|
||||
/// A grouped thousand is refused in any digits, as `1,000` is, rather than read as 1.
|
||||
#[test]
|
||||
fn a_native_digit_thousand_is_refused_like_an_ascii_one() {
|
||||
assert_eq!(Unit::Millimeters.parse_with_decimal_comma("1,000 mm"), None);
|
||||
assert_eq!(Unit::Millimeters.parse_with_decimal_comma("१,००० mm"), None);
|
||||
assert_eq!(Unit::Millimeters.parse_with_decimal_comma("૧,૦૦૦"), None);
|
||||
assert_eq!(crate::decimal_point("१,०००"), crate::decimal_point("1,000"));
|
||||
}
|
||||
|
||||
/// One number mixing digit sets is refused, as craft-i18n's `parse_number` refuses it; separate
|
||||
/// numbers of a sum may each use their own.
|
||||
#[test]
|
||||
fn a_number_mixing_digit_sets_reads_as_nothing() {
|
||||
for text in ["1२", "૧२", "१.5", "૧२.૫ mm", "1,२"] {
|
||||
assert_eq!(Unit::Points.parse(text), None, "`{text}`");
|
||||
assert_eq!(Unit::Points.parse_with_decimal_comma(text), None, "`{text}`");
|
||||
assert_eq!(crate::parse_number(text), None, "`{text}`");
|
||||
}
|
||||
assert_eq!(Unit::Points.parse("१२+3"), Unit::Points.parse("12+3"));
|
||||
}
|
||||
+32
-8
@@ -1,3 +1,5 @@
|
||||
use std::borrow::Cow;
|
||||
|
||||
use super::{Deserialize, Serialize};
|
||||
|
||||
/// Measurement units (display only; the model is always in points).
|
||||
@@ -203,20 +205,24 @@ impl Unit {
|
||||
///
|
||||
/// Text with more than 128 `+ - * /` signs ([`arithmetic_signs`], a multiplication sign counted
|
||||
/// as `*`) reads as nothing.
|
||||
///
|
||||
/// Digits may be any Unicode 16 decimal digits ([`ascii_digits`]): `१२ mm` is `12 mm`, `૪૫*૨` is `45*2`.
|
||||
pub fn parse(self, s: &str) -> Option<f64> {
|
||||
if arithmetic_signs(s) > MAX_MEASURE_OPERATORS {
|
||||
return None;
|
||||
}
|
||||
parse_measure(×_as_asterisks(s), self).filter(|v| v.is_finite())
|
||||
let s = ascii_digits(s)?;
|
||||
parse_measure(×_as_asterisks(&s), self).filter(|v| v.is_finite())
|
||||
}
|
||||
|
||||
/// Parse a measurement with decimal points or commas and no input locale. Refuse a
|
||||
/// number that looks like a grouped integer, even when it is part of an expression.
|
||||
pub fn parse_with_decimal_comma(self, text: &str) -> Option<f64> {
|
||||
if text.contains(',') && times_as_asterisks(text).split(['+', '-', '*', '/']).any(thousands_operand) {
|
||||
let text = ascii_digits(text)?;
|
||||
if text.contains(',') && times_as_asterisks(&text).split(['+', '-', '*', '/']).any(thousands_operand) {
|
||||
return None;
|
||||
}
|
||||
self.parse(&decimal_point(text))
|
||||
self.parse(&decimal_point(&text))
|
||||
}
|
||||
/// The value naming this unit in the Units preferences (`points`, `millimeters`,
|
||||
/// `feetInches`).
|
||||
@@ -414,9 +420,26 @@ fn percent(s: &str) -> Option<f64> {
|
||||
/// (#3837), and each number of a sum reads its own separator, so `100.5 mm-0,5` (a comma typed
|
||||
/// after the value the field shows) is 100 mm (#5684). A number written with both separators has
|
||||
/// two points once read, so `1,000.5` and `1.234,5` are refused rather than guessed at; so is a
|
||||
/// number that reads as thousands ([`thousands`]).
|
||||
pub fn decimal_point(text: &str) -> std::borrow::Cow<'_, str> {
|
||||
if text.contains(',') && !thousands(text) { text.replace(',', ".").into() } else { text.into() }
|
||||
/// number that reads as thousands ([`thousands`]). Digits in other scripts come back as ASCII
|
||||
/// ([`ascii_digits`]), so `१,०००` is refused as `1,000` is; text mixing digit sets in one number
|
||||
/// comes back as it is, for the parser to refuse.
|
||||
pub fn decimal_point(text: &str) -> Cow<'_, str> {
|
||||
let Some(text) = ascii_digits(text) else { return text.into() };
|
||||
if text.contains(',') && !thousands(&text) { text.replace(',', ".").into() } else { text }
|
||||
}
|
||||
|
||||
/// `text` with every Unicode 16 decimal digit (Devanagari `०-९`, Gujarati `૦-૯`, Bengali,
|
||||
/// Arabic-Indic, full-width, …) written as its ASCII digit, so `१२.५ mm` reads as `12.5 mm`. A
|
||||
/// number here is a run of digits, `.` and `,`, and must use one digit set: `1२` and `૧२` are
|
||||
/// `None`. Operators, unit suffixes and other characters are left as they are.
|
||||
pub fn ascii_digits(text: &str) -> Option<Cow<'_, str>> {
|
||||
craft_i18n::ascii_digits(text, |c| matches!(c, '.' | ',')).ok()
|
||||
}
|
||||
|
||||
/// [`ascii_digits`] for text that holds a single number, exponent and unit included: every digit
|
||||
/// must come from one set, so `१e२` is `1e2` and `१e2` is `None`.
|
||||
pub fn ascii_digits_one_number(text: &str) -> Option<Cow<'_, str>> {
|
||||
craft_i18n::ascii_digits(text, |_| true).ok()
|
||||
}
|
||||
|
||||
/// Does the operand contain a thousands comma? Check both parts of a compact pica value and
|
||||
@@ -455,9 +478,10 @@ pub fn finite_in_every_unit(pt: f64) -> bool {
|
||||
}
|
||||
|
||||
/// A unitless field value (percent, degrees, counts) with the same `+ - * /` arithmetic as
|
||||
/// [`Unit::parse`] (`45*2`, `45x2`, `100/3`); text other than digits, `.` and operators reads as
|
||||
/// nothing.
|
||||
/// [`Unit::parse`] (`45*2`, `45x2`, `100/3`, `४५*२`); text other than digits, `.` and operators
|
||||
/// reads as nothing.
|
||||
pub fn parse_number(s: &str) -> Option<f64> {
|
||||
let s = ascii_digits(s)?;
|
||||
if !s.chars().all(|c| c.is_ascii_digit() || " .+-*/xX×".contains(c)) {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -184,6 +184,7 @@ pub const BUILTIN: &[BuiltinBrushLibrary] = &[
|
||||
BuiltinBrushLibrary { id: "game-trails", name: "Game Trails", make: game_trails },
|
||||
BuiltinBrushLibrary { id: "energy-beams", name: "Energy Beams", make: energy_beams },
|
||||
BuiltinBrushLibrary { id: "dry-media", name: "Dry Media", make: dry_media },
|
||||
BuiltinBrushLibrary { id: "impact-bursts", name: "Impact Bursts", make: impact_bursts },
|
||||
BuiltinBrushLibrary { id: "tech-circuit", name: "Tech Circuit", make: tech_circuit },
|
||||
BuiltinBrushLibrary { id: "engraving", name: "Engraving", make: engraving },
|
||||
BuiltinBrushLibrary { id: "arrows", name: "Arrows", make: arrows },
|
||||
@@ -1216,6 +1217,70 @@ pub(crate) fn dry_media() -> BrushLibrary {
|
||||
built("Dry Media", Document::new(100.0, 100.0), brushes)
|
||||
}
|
||||
|
||||
/// Impact Bursts: art brushes for hit sparks, shocks and crack strokes (original game VFX art).
|
||||
fn impact_bursts() -> BrushLibrary {
|
||||
let star = group(vec![
|
||||
black(polygon(&[(0.0, 0.0), (100.0, -8.0), (88.0, 0.0), (100.0, 8.0)])),
|
||||
black(polygon(&[(12.0, 0.0), (70.0, -14.0), (62.0, 0.0), (70.0, 14.0)])),
|
||||
black(polygon(&[(20.0, 0.0), (48.0, -18.0), (42.0, 0.0), (48.0, 18.0)])),
|
||||
black(polygon(&[(28.0, 0.0), (40.0, -10.0), (36.0, 0.0), (40.0, 10.0)])),
|
||||
]);
|
||||
let ring_shock =
|
||||
group(vec![ring(Point::new(50.0, 0.0), 18.0, 14.0), ring(Point::new(50.0, 0.0), 28.0, 25.0), ring(Point::new(50.0, 0.0), 38.0, 36.0)]);
|
||||
let slash = {
|
||||
let n = 40;
|
||||
let half = |x: f64| {
|
||||
let t = x / 100.0;
|
||||
let arch = 10.0 * (t * std::f64::consts::PI).sin();
|
||||
1.4 + 2.2 * (1.0 - (t - 0.5).abs() * 2.0).max(0.0) + arch * 0.05
|
||||
};
|
||||
let mid = |x: f64| 8.0 * ((x / 100.0) * std::f64::consts::PI).sin() - 4.0;
|
||||
let xs = |i: usize| 100.0 * i as f64 / n as f64;
|
||||
let mut pts: Vec<Point> = (0..=n).map(xs).map(|x| Point::new(x, mid(x) - half(x))).collect();
|
||||
pts.extend((0..n).rev().map(xs).map(|x| Point::new(x, mid(x) + half(x))));
|
||||
PathData::single(SubPath::polyline(&pts, true))
|
||||
};
|
||||
let spark_fan = group(vec![
|
||||
black(polygon(&[(0.0, 0.0), (55.0, -16.0), (48.0, -12.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (70.0, -6.0), (62.0, -2.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (100.0, 0.0), (90.0, 2.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (70.0, 6.0), (62.0, 2.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (55.0, 16.0), (48.0, 12.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (35.0, -10.0), (30.0, -6.0)])),
|
||||
black(polygon(&[(0.0, 0.0), (35.0, 10.0), (30.0, 6.0)])),
|
||||
]);
|
||||
let debris = group(vec![
|
||||
black(shapes::rectangle(Rect::new(4.0, -3.0, 12.0, 1.0))),
|
||||
black(polygon(&[(18.0, 2.0), (28.0, -2.0), (30.0, 4.0)])),
|
||||
black(shapes::rectangle(Rect::new(36.0, -4.0, 44.0, -1.0))),
|
||||
black(polygon(&[(50.0, 1.0), (58.0, 5.0), (62.0, -2.0)])),
|
||||
black(shapes::rectangle(Rect::new(68.0, -2.0, 78.0, 2.0))),
|
||||
black(polygon(&[(82.0, -4.0), (90.0, -1.0), (88.0, 3.0)])),
|
||||
black(shapes::rectangle(Rect::new(92.0, 0.0, 100.0, 3.0))),
|
||||
]);
|
||||
let crack = band(100.0, 1.4, 48, |x| {
|
||||
let t = (x / 8.0).floor();
|
||||
let local = (x / 8.0) - t;
|
||||
let amp = if (t as i32) % 3 == 0 {
|
||||
5.0
|
||||
} else if (t as i32) % 3 == 1 {
|
||||
-3.5
|
||||
} else {
|
||||
2.0
|
||||
};
|
||||
if (t as i32) % 2 == 0 { amp * local } else { amp * (1.0 - local) }
|
||||
});
|
||||
let brushes = vec![
|
||||
art("Star Burst", star, Colorization::Tints),
|
||||
art("Ring Shock", ring_shock, Colorization::Tints),
|
||||
art("Slash Arc", black(slash), Colorization::Tints),
|
||||
art("Spark Fan", spark_fan, Colorization::Tints),
|
||||
art("Debris Spray", debris, Colorization::Tints),
|
||||
art("Crack Line", black(crack), Colorization::Tints),
|
||||
];
|
||||
built("Impact Bursts", Document::new(100.0, 100.0), brushes)
|
||||
}
|
||||
|
||||
// ---------- commands ----------
|
||||
|
||||
fn builtin_info(b: &BuiltinBrushLibrary) -> LibraryInfo {
|
||||
|
||||
@@ -46,9 +46,10 @@ impl ScreenSize {
|
||||
/// `2x` (or `2`), `100w`, `100h` or `72ppi`, in any case; positive numbers only.
|
||||
pub fn parse(s: &str) -> Option<Self> {
|
||||
let s = s.trim().to_ascii_lowercase();
|
||||
// Digits and `.` only: `str::parse` would also take `+2`, `1e2`, `inf` and `nan`.
|
||||
// Digits and `.` only: `str::parse` would also take `+2`, `1e2`, `inf` and `nan`. Digits of
|
||||
// other scripts read as ASCII digits do (`"२x"` is `2x`), as number fields read them.
|
||||
let num = |t: &str| {
|
||||
let t = t.trim();
|
||||
let t = vectorcraft_doc::ascii_digits(t.trim())?;
|
||||
if !t.bytes().all(|b| b.is_ascii_digit() || b == b'.') {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,17 @@ fn sizes_parse_as_factor_width_height_or_resolution() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sizes_read_digits_of_other_scripts() {
|
||||
assert_eq!(ScreenSize::parse("२x"), Some(ScreenSize::Scale(2.0)));
|
||||
assert_eq!(ScreenSize::parse("૧૦૦W"), Some(ScreenSize::Width(100.0)));
|
||||
assert_eq!(ScreenSize::parse("१४४ppi"), Some(ScreenSize::Ppi(144.0)));
|
||||
// One digit set per number, and the same grammar as ASCII digits.
|
||||
for bad in ["1२x", "१.5x", "-२x", "०w"] {
|
||||
assert_eq!(ScreenSize::parse(bad), None, "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_width_or_height_row_gives_that_many_pixels() {
|
||||
let mut s = session(1);
|
||||
|
||||
@@ -71,7 +71,11 @@ fn resolution(v: &Value) -> Result<f64> {
|
||||
"screen" => 72.0,
|
||||
"medium" => 150.0,
|
||||
"high" => 300.0,
|
||||
other => other.trim_end_matches("ppi").trim().parse::<f64>().map_err(|_| bad(C, format!("unknown resolution `{v}`")))?,
|
||||
// Digits of other scripts read as ASCII digits do (`"३००"` is 300), as number fields read them,
|
||||
// with one digit set for the whole value, exponent included (`"१e2"` is refused).
|
||||
other => vectorcraft_doc::ascii_digits_one_number(other.trim_end_matches("ppi").trim())
|
||||
.and_then(|n| n.parse::<f64>().ok())
|
||||
.ok_or_else(|| bad(C, format!("unknown resolution `{v}`")))?,
|
||||
},
|
||||
v => v.as_f64().ok_or_else(|| bad(C, "resolution must be a number or screen|medium|high"))?,
|
||||
};
|
||||
|
||||
@@ -121,6 +121,7 @@ fn the_builtin_libraries_are_original_brushes_generated_in_code() {
|
||||
"game-trails",
|
||||
"energy-beams",
|
||||
"dry-media",
|
||||
"impact-bursts",
|
||||
"tech-circuit",
|
||||
"engraving",
|
||||
"arrows",
|
||||
@@ -171,6 +172,12 @@ fn the_builtin_libraries_list_their_brush_names_and_counts() {
|
||||
[("Chalk Grain", "art"), ("Graphite Pencil", "art"), ("Wax Crayon", "art"), ("Charcoal Dust", "art")]
|
||||
);
|
||||
assert_eq!((entry("dry-media")["name"].as_str(), entry("dry-media")["count"].as_u64()), (Some("Dry Media"), Some(4)));
|
||||
let impact = run(&mut s, "brush.library", json!({"library": "impact-bursts"}));
|
||||
assert_eq!(
|
||||
impact["brushes"].as_array().unwrap().iter().map(|b| b["name"].as_str().unwrap()).collect::<Vec<_>>(),
|
||||
["Star Burst", "Ring Shock", "Slash Arc", "Spark Fan", "Debris Spray", "Crack Line"]
|
||||
);
|
||||
assert_eq!((libs[14]["name"].as_str(), libs[14]["count"].as_u64()), (Some("Impact Bursts"), Some(6)));
|
||||
let arrows = run(&mut s, "brush.library", json!({"library": "Arrows"}));
|
||||
assert_eq!(
|
||||
arrows["brushes"].as_array().unwrap().iter().map(|b| (b["name"].as_str().unwrap(), b["type"].as_str().unwrap())).collect::<Vec<_>>(),
|
||||
@@ -204,6 +211,7 @@ fn every_builtin_library_brush_has_its_kind_and_draws() {
|
||||
("game-trails", "art"),
|
||||
("energy-beams", "art"),
|
||||
("dry-media", "art"),
|
||||
("impact-bursts", "art"),
|
||||
("arrows", "art"),
|
||||
("image-brush", "scatter"),
|
||||
("artistic", "art"),
|
||||
|
||||
@@ -91,6 +91,21 @@ fn settings_report_change_in_one_step_and_reject_junk() {
|
||||
assert_eq!(s.execute(C, &json!({"colorModel": "cmyk"})).unwrap()["colorModel"], "cmyk");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_resolution_given_as_text_reads_digits_of_other_scripts() {
|
||||
let mut s = session();
|
||||
let r = s.execute(C, &json!({"resolution": "३०० ppi"})).unwrap();
|
||||
assert_eq!(r["resolution"].as_f64(), Some(300.0));
|
||||
assert_eq!(s.doc().unwrap().doc.raster_effects_ppi, 300.0);
|
||||
// One digit set per number, exponent included, and the same 1 to 2400 ppi range as ASCII digits.
|
||||
for bad in ["1५0", "५०००", "१e2", "1e२", "१e+2"] {
|
||||
assert!(s.execute(C, &json!({"resolution": bad})).is_err(), "{bad}");
|
||||
}
|
||||
assert_eq!(s.doc().unwrap().history.undo.len(), 1);
|
||||
let r = s.execute(C, &json!({"resolution": "१e२"})).unwrap();
|
||||
assert_eq!(r["resolution"].as_f64(), Some(100.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_white_background_makes_effect_images_opaque() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -101,14 +101,12 @@ pub struct FontDb {
|
||||
colours: Mutex<GlyphColours>,
|
||||
/// The installed fonts: the system font scan's faces, found by any of their names
|
||||
/// ([`FontDb::catalog`]). Lookups by family name wait for its first scan, so what they find
|
||||
/// never depends on what ran before them. The bundled faces join it on the first call of
|
||||
/// [`FontDb::catalog`], so its faces are read through that call.
|
||||
/// never depends on what ran before them. It also holds the bundled faces, added when the
|
||||
/// database is made and read from the binary in place.
|
||||
catalog: Arc<Catalog>,
|
||||
/// The registry's fonts as the catalog's last scan saw them, when the catalog does not compare
|
||||
/// them itself ([`FontDb::installed_fonts_changed`]).
|
||||
registered: Option<Arc<dirs::RegisteredFonts>>,
|
||||
/// The bundled faces were added to [`Self::catalog`].
|
||||
bundled_cataloged: std::sync::Once,
|
||||
/// Fonts files carried for their type ([`vectorcraft_doc::FileFonts`]): apart from the faces,
|
||||
/// so no family name, font menu, fallback or PostScript name lookup finds them.
|
||||
pub(super) file_faces: RwLock<FileFaces>,
|
||||
@@ -403,14 +401,25 @@ mod bundled_catalog_tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_bundled_fonts_join_the_catalog_when_it_is_first_read() {
|
||||
fn the_bundled_fonts_are_in_the_catalog_from_the_start() {
|
||||
let db = FontDb::with_font_dirs(Vec::new());
|
||||
assert!(!db.read_faces().is_empty(), "the database draws with its bundled faces from the start");
|
||||
assert_eq!(bundled_in_catalog(&db.catalog), 0, "making the database copies no bundled font into the catalog");
|
||||
let added = bundled_in_catalog(&db.catalog);
|
||||
assert!(added > 0, "making the database adds the bundled fonts to the catalog");
|
||||
// The catalog reads each bundled face from the bytes in the binary, not from a copy.
|
||||
let embedded: Vec<*const u8> = super::face::BUNDLED.iter().map(|b| b.as_ptr()).collect();
|
||||
for face in db.catalog.faces().iter().filter(|f| f.source == craft::font_catalog::Source::Bundled) {
|
||||
let data = db.catalog.face_data(face).expect("a bundled face's bytes");
|
||||
let ptr = data.bytes().as_ptr();
|
||||
assert!(
|
||||
embedded.contains(&ptr) || crate::craft_fonts::document_fonts().iter().any(|f| f.bytes.as_ptr() == ptr),
|
||||
"{} {} is read from a copy of its font file",
|
||||
face.family,
|
||||
face.style
|
||||
);
|
||||
}
|
||||
// A lookup that only the catalog answers finds a bundled face.
|
||||
assert_eq!(db.by_postscript_name("SourceSans3-Bold"), Some(("Source Sans 3".to_string(), "Bold".to_string())));
|
||||
let added = bundled_in_catalog(&db.catalog);
|
||||
assert!(added > 0, "the first read of the catalog adds the bundled fonts");
|
||||
assert!(db.catalog().families().iter().any(|f| f == "Inter"), "font pickers list a bundled family");
|
||||
assert_eq!(bundled_in_catalog(db.catalog()), added, "later reads add them no second time");
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use craft::font_catalog::{Catalog, FontEnv, Limits, Os, Source};
|
||||
use craft::font_catalog::{Catalog, FontEnv, Os, Source};
|
||||
|
||||
use super::build::make_face;
|
||||
use super::cache::{CanonicalNames, GlyphCache};
|
||||
@@ -66,6 +66,11 @@ impl FontDb {
|
||||
faces.push(Arc::new(f));
|
||||
}
|
||||
}
|
||||
// The catalog reads the bytes in place, so font pickers list the bundled faces without a
|
||||
// second copy of them in memory.
|
||||
if let Err(e) = catalog.add_static(data, Source::Bundled) {
|
||||
log::warn!("a bundled font is not in the font catalog: {e}");
|
||||
}
|
||||
}
|
||||
Self {
|
||||
faces: RwLock::new(faces),
|
||||
@@ -74,7 +79,6 @@ impl FontDb {
|
||||
colours: Mutex::new(GlyphCache::default()),
|
||||
catalog: Arc::new(catalog),
|
||||
registered,
|
||||
bundled_cataloged: std::sync::Once::new(),
|
||||
file_faces: RwLock::new(super::FileFaces::default()),
|
||||
canonical_cache: Mutex::new(CanonicalNames::new()),
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
@@ -130,19 +134,9 @@ impl FontDb {
|
||||
/// The installed fonts this database finds by name, shared with the framework's font menus and
|
||||
/// pickers. Its lookups wait for its first scan ([`FontDb::scan_in_background`]).
|
||||
///
|
||||
/// The first call adds the bundled fonts to it as [`Source::Bundled`] faces, so font pickers
|
||||
/// list them. A run that never looks a font up in the catalog, such as exporting a file without
|
||||
/// type, does not hold the catalog's copies of their bytes.
|
||||
// The catalog keeps its own copy of the bytes it is given. Adding the bundled fonts on first use
|
||||
// can go once the catalog takes static bytes without copying them (craft-libs#4888).
|
||||
/// It holds the bundled fonts as [`Source::Bundled`] faces, read from the binary in place, so
|
||||
/// font pickers list them.
|
||||
pub fn catalog(&self) -> &Arc<Catalog> {
|
||||
self.bundled_cataloged.call_once(|| {
|
||||
for data in bundled_fonts() {
|
||||
if let Err(e) = self.catalog.add_bytes(data.to_vec(), Source::Bundled, &Limits::default()) {
|
||||
log::warn!("a bundled font is not in the font catalog: {e}");
|
||||
}
|
||||
}
|
||||
});
|
||||
&self.catalog
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ use std::sync::Arc;
|
||||
use craft::behavior::{Axis, DockSide, IconId};
|
||||
use craft::ui::buttons::IconButton;
|
||||
use craft::ui::contract::{Bind, BodyCx, PlainData, Props as _, Show as _, SizeLimits, Tracked};
|
||||
use craft::ui::dialog::DialogId;
|
||||
use craft::ui::docking::{
|
||||
ColumnCards, DockCommands, DockConfig, DockEvent, DockGrid, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels,
|
||||
PanelKey, PanelSpec, PanelSpecs, actions as command_actions, move_actions, request_actions,
|
||||
@@ -74,9 +73,6 @@ pub(crate) struct Runtime {
|
||||
/// A panel just floated out of a tool rail, whose window takes over the held press on the next
|
||||
/// pass, with the pointer at this point inside it ([`continue_move`]).
|
||||
hand_over: Option<(String, egui::Vec2)>,
|
||||
/// The dialogs a panel in the open flyout opened, by id and opening serial: while one is open, Auto-Collapse Iconic
|
||||
/// Panels leaves the flyout open ([`show`]).
|
||||
flyout_dialogs: Vec<(DialogId, u64)>,
|
||||
}
|
||||
|
||||
/// `ui.docking`: the layout in use, the hidden panels, the open flyout, the focused panel, the
|
||||
@@ -1350,16 +1346,6 @@ fn raise(app: &VectorcraftApp, ctx: &egui::Context, panel: &str) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The open dialogs of the main window, by id and opening serial: a dialog closed and opened again has a new serial.
|
||||
fn open_dialogs(app: &VectorcraftApp) -> Vec<(DialogId, u64)> {
|
||||
app.dialogs().map_or_else(Vec::new, |dialogs| {
|
||||
dialogs.with(|host| {
|
||||
let host = &*host;
|
||||
host.stack().ids().filter_map(|id| Some((id, host.open_serial(id)?))).collect()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
/// The floating window holding `panel` takes over the held primary press on the next pass, with the
|
||||
/// pointer at `grab` inside it: a panel floated out of a tool rail mid-drag follows the pointer and
|
||||
/// docks where the release lands.
|
||||
@@ -1385,15 +1371,7 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
|
||||
let presenting = app.ui.screen_mode >= 3;
|
||||
// Shift+Tab, from its key, a menu or automation, closes a panel popped out of the icon column.
|
||||
let mut flyout = flyout_before.clone().filter(|_| !keeps_tools);
|
||||
let dialogs_before = open_dialogs(app);
|
||||
if flyout_before.is_some() {
|
||||
app.dock_rt.flyout_dialogs.retain(|dialog| dialogs_before.contains(dialog));
|
||||
} else {
|
||||
app.dock_rt.flyout_dialogs.clear();
|
||||
}
|
||||
// A dialog a panel of the flyout opened (the Gradient panel's stop popover) is a layer of the window's dialog host,
|
||||
// outside the flyout's: while one is open, a press in it or the focus moving into it leaves the flyout open.
|
||||
let auto_collapse = app.session.prefs.auto_collapse_icon_panels && app.dock_rt.flyout_dialogs.is_empty();
|
||||
let auto_collapse = app.session.prefs.auto_collapse_icon_panels;
|
||||
// The specs and rails leave the app for the pass, which lends the app to the panel bodies.
|
||||
let specs = std::mem::take(&mut app.dock_rt.specs);
|
||||
let rails = std::mem::take(&mut app.dock_rt.rails);
|
||||
@@ -1439,12 +1417,6 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
|
||||
if app.ui.open_panel == flyout_before {
|
||||
app.ui.open_panel = flyout;
|
||||
}
|
||||
if app.ui.open_panel.is_some() {
|
||||
let opened: Vec<_> = open_dialogs(app).into_iter().filter(|dialog| !dialogs_before.contains(dialog)).collect();
|
||||
app.dock_rt.flyout_dialogs.extend(opened);
|
||||
} else {
|
||||
app.dock_rt.flyout_dialogs.clear();
|
||||
}
|
||||
if output.error.is_some() {
|
||||
Arc::make_mut(&mut app.ui.dock_workspace).replace(default_workspace(&[]));
|
||||
app.status(tl!("Invalid panel layout; restored the default dock").to_string());
|
||||
|
||||
@@ -1351,7 +1351,8 @@ fn a_tab_menus_stock_items_start_at_the_panel_items_check_column() {
|
||||
}
|
||||
|
||||
/// With Auto-Collapse Iconic Panels on, the popover the Gradient panel's stop chip opens from the panel's flyout leaves
|
||||
/// the flyout open while it shows; once it closes, a click away from the flyout still closes it.
|
||||
/// the flyout open while it shows; once it closes, a click away from the flyout still closes it, and a press away from
|
||||
/// both closes the popover and the flyout together.
|
||||
#[test]
|
||||
fn a_popover_opened_from_an_auto_collapsing_flyout_leaves_the_flyout_open() {
|
||||
let mut h = Harness::new();
|
||||
@@ -1385,4 +1386,17 @@ fn a_popover_opened_from_an_auto_collapsing_flyout_leaves_the_flyout_open() {
|
||||
assert_eq!(h.app.ui.open_panel, flyout, "closing the popover leaves the flyout open");
|
||||
h.click(h.canvas().center());
|
||||
assert_eq!(h.app.ui.open_panel, None, "a click away from the flyout still closes it");
|
||||
|
||||
// With the popover open again, one press away from both closes the popover and the flyout.
|
||||
h.app.run("window.panel", json!({"panel": "gradient"})).unwrap();
|
||||
h.frames(3);
|
||||
assert_eq!(h.app.ui.open_panel, flyout, "the flyout opens again");
|
||||
h.click(chip.center());
|
||||
h.frames(3);
|
||||
assert!(popover_open(&h), "the chip opens the stop popover again");
|
||||
assert_eq!(h.app.ui.open_panel, flyout, "the flyout stays open while the popover shows");
|
||||
h.click(h.canvas().center());
|
||||
h.frames(2);
|
||||
assert!(!popover_open(&h), "a press away closes the popover");
|
||||
assert_eq!(h.app.ui.open_panel, None, "and the flyout with it");
|
||||
}
|
||||
@@ -139,6 +139,7 @@ fn the_window_menu_and_the_brushes_panel_open_brush_libraries() {
|
||||
json!("game-trails"),
|
||||
json!("energy-beams"),
|
||||
json!("dry-media"),
|
||||
json!("impact-bursts"),
|
||||
json!("tech-circuit"),
|
||||
json!("engraving"),
|
||||
json!("arrows"),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Localization parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-25 · **Change:** patch (Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests)
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-12-05 · **Change:** minor (number fields and command parameters read Devanagari, Gujarati and other Unicode digits, one digit set per number; previously patch: Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; UI not exposed pending upstream `storytold/craft-i18n` catalog; Hindi catalog draft complete under the translation tests; contributor loanword terminology reviewed; wider proofreading welcome; Brazilian Portuguese: 154 rows for the strings the sibling catalogs translate — smart-filter and print presets, dimension lines, swatches, canvas messages; previously minor: Bosnian (`bs`): complete catalog; previously minor: Vietnamese text: stacked diacritics tested and attach in every form, #4491; previously: Catalan (`ca`) catalog added, complete under the tests)
|
||||
|
||||
Per-language status of VectorCraft's interface. How the catalogs work and how to add a language:
|
||||
[`development.md` › Localisation](development.md#localisation). Part of
|
||||
@@ -92,6 +92,15 @@ other mark style; the untranslated report lists a catalog that lacks one of them
|
||||
Native review is still needed, and catalog coverage does not prove that every variable in the UI is
|
||||
translated.
|
||||
|
||||
## Number input
|
||||
|
||||
Number fields and command parameters given as text (MCP, the control channel, `addon.units.convert`) read the
|
||||
decimal digits of Unicode 16 (Devanagari `१२ mm`, Gujarati `૪૫*૨`, Bengali, Arabic-Indic, full-width). Units, arithmetic and the decimal
|
||||
comma work as they do with ASCII digits. One number mixing digit sets (`1२`) is refused. Both readers take their digits
|
||||
from craft-i18n (storytold/craft-libs#198 track 5): the dialog fields and parameters VectorCraft reads itself through
|
||||
`vectorcraft_doc::units` use `craft_i18n::ascii_digits`, and fields on the shared craft number field (the panels, and
|
||||
dialog rows such as Character Style Options › Tsume) use the shared reader (storytold/craft-libs#4872).
|
||||
|
||||
## Not done in any language
|
||||
|
||||
Locale-aware number and date formats, a right-to-left interface, translated help, and a Traditional Chinese UI
|
||||
@@ -101,6 +110,7 @@ font for the web build.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-12-05 | minor | Number input: number fields and command parameters given as text read Devanagari, Gujarati and other Unicode 16 decimal digits, with units, arithmetic and the decimal comma as for ASCII digits; a number mixing digit sets is refused. `vectorcraft_doc::units` uses `craft_i18n::ascii_digits`, and the shared craft number field reads the same digits after storytold/craft-libs#4872 (storytold/craft-libs#198 track 5); scores and estimates unchanged |
|
||||
| 2026-12-02 | minor | Gujarati: status and error messages translated (4,926 new `@msg`/`@msgplural` rows, machine-assisted draft, native review pending); `gu` joins `COMPLETE_MESSAGES`. Scores and estimates unchanged. |
|
||||
| 2026-12-02 | minor | Gujarati (`gu`): Web: Gujarati can be selected as the interface language; the web fetches Noto Sans Gujarati when the interface needs it (`crates/text/web-fonts.txt`, `demand`), as it does Noto Sans Devanagari for Hindi. Status/error messages remain partial. Scores and estimates unchanged. |
|
||||
| 2026-11-25 | patch | Arabic (`ar`): preparatory registration and 6-form CLDR plural routing; kept unavailable to users pending upstream `storytold/craft-i18n` catalog |
|
||||
|
||||
+4
-3
@@ -8461,9 +8461,9 @@ error.
|
||||
|
||||
## Brush libraries
|
||||
|
||||
Brush libraries are read-only sets of brushes: fifteen generated in code (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive with Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow, Bristle
|
||||
Brushes with one bristle brush for each tip shape, Pattern Borders, Decorative with Leaf Vine, Blossom Chain, Pennant Garland and Lantern String, Scatter Shapes, Stipple with Fine, Dense, Soft and Bold dot textures, Game Trails, Energy Beams, and Dry Media with the Chalk Grain, Graphite Pencil, Wax Crayon and
|
||||
Charcoal Dust art brushes, id `dry-media`, Tech Circuit with Circuit Trace (art), Bus Lines and Terminal Nodes (pattern), id `tech-circuit`, Engraving with Fine Hatching, Dense Hatching, Tapered Hatching and Broken Hatching art brushes, id `engraving`, and Arrows with Solid, Open, Double, Chevron and Dashed Arrow art brushes, id `arrows`), the `.vectorcraft` files in the user library folder of the desktop app (User
|
||||
Brush libraries are read-only sets of brushes: twenty-one generated in code (Art Ribbons, Ink and Wash, Calligraphic Nibs, Pressure Sensitive with Flex Ribbon, Pulse Stroke, Round Flow and Chisel Flow, Bristle
|
||||
Brushes with one bristle brush for each tip shape, Paint, Pattern Borders, Decorative with Leaf Vine, Blossom Chain, Pennant Garland and Lantern String, Ornamental, Scatter Shapes, Stipple with Fine, Dense, Soft and Bold dot textures, Game Trails, Energy Beams, Dry Media with the Chalk Grain, Graphite Pencil, Wax Crayon and
|
||||
Charcoal Dust art brushes, id `dry-media`, Impact Bursts with Star Burst, Ring Shock, Slash Arc, Spark Fan, Debris Spray and Crack Line art brushes, id `impact-bursts`, Tech Circuit with Circuit Trace (art), Bus Lines and Terminal Nodes (pattern), id `tech-circuit`, Engraving with Fine Hatching, Dense Hatching, Tapered Hatching and Broken Hatching art brushes, id `engraving`, Arrows with Solid, Open, Double, Chevron and Dashed Arrow art brushes, id `arrows`, Image Brush, Artistic Brushes and Vector Packs), the `.vectorcraft` files in the user library folder of the desktop app (User
|
||||
Defined) and the brushes of any document loaded with `brush.loadLibrary` (a document without brushes of its own has
|
||||
the default ones). `brush.libraries` lists them (`id`, `name`, `category`: `builtIn`, `user` or `loaded`, `count`) and
|
||||
`brush.library {library}` returns one's brushes (`name`, `type`; `library` is an id or a name). A name
|
||||
@@ -19901,6 +19901,7 @@ Converter and in its panel (`window.panel {panel: "unitConverter"}`). Neither co
|
||||
`addon.units.convert {value, unit?}` accepts a number, or text with a unit suffix and
|
||||
`+ - * /` arithmetic, where `x`, `X` and `×` multiply as `*` does (`"10mm"`, `"1in/2"`, `"2p6"`, `"1080/2 px"`,
|
||||
`"3cm*50%"`, `"2x3 mm"`, `"13q"`). The command reads an unambiguous decimal comma as a point (`"0,5 mm"`).
|
||||
Digits may be any Unicode 16 decimal digits, one set per number (`"१२ mm"`, `"૪૫*૨"`); `"1२"` is refused.
|
||||
It refuses numbers that look like grouped integers, whether alone (`"1,000 mm"`) or in arithmetic (`"1,500+2"`).
|
||||
Text may contain at most 1024 bytes and 128 `+ - * /` signs (each multiplication sign counts).
|
||||
A number without a suffix is in `unit` (a unit's name, suffix or key: `points`, `picas`, `inches`, `millimeters`,
|
||||
|
||||
@@ -359,7 +359,7 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de
|
||||
| Drawing tools (Pen, Curvature, Pencil, shapes, Shaper) | 7 | 88% | Shaper construction widget, Pencil/Pen nuances; Touch Type (#2469), the Dimension tool (#1788) and the Blob Brush options (#2367) are done; see [ui-parity.md](ui-parity.md) | 8–13 | estimated; Curvature point display regression-tested (#1236, in part); Polygon/Star exact-size count persistence regression-covered; Live Corners' Relative rounding done (#3091), score unchanged; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123), score and hours unchanged; the Pen, Smart Pen and Curvature tool show the measurement readout with the rubber band off (#7043), score, gaps and hours unchanged; Scissors shares the Pen's path/align/intersect/anchor snaps (#6470), source and headless regressions below; Eraser preserves fill-only open-path area outside fixed and varied tip sweeps and Alt-drag marquees, including compound holes; clipping masks keep their remaining contours and empty-mask role; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot be reproduced keep their existing fitting; stroked open paths retain main behavior and result structure (#6582; `crates/engine/tests/it/eraser_open_fill.rs`), score and hours unchanged; Scissors cut-point preview covered in tool and Session regressions (#8655), scores and hours unchanged |
|
||||
| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 85% | Shape Builder on the reporter's file (#937: art past 4,096 segments is cut by lines again; unconfirmed on the file itself); gap detection shares Live Paint’s finder, with a 72 pt custom cap and the existing options | 4–8 | estimated; Shape Builder Gap Detection shares Live Paint’s spatial gap finder and temporary merge bridges (#2526); Custom is capped at 72 pt in the existing options dialog; compound attributes regression-tested (#1197); single-result source names survive SVG export/import (#1293), with [SVG ID semantics](https://www.w3.org/TR/SVG2/struct.html#IDAttribute) and original-shape tests; Simplify component selection and preview regression-tested (#1272); Simplify of a Direct Selection part of a path regression-tested (`tests/simplify_part.rs`); Divide open-cutting-path geometry and appearance regression-tested (#1307); the Shape Builder's edge-source grid is bounded in memory and files a segment once per cell (`planar.rs` test `rect_index_holds_a_bounded_number_of_references`); live compound shapes (Make, Alt-click, member Shape Modes, Release, Expand, saved and exported) regression-tested (#4522); Live Paint Bucket face drags, including narrow faces and one Undo, regression-tested (#6373) |
|
||||
| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 92% | Picker Lab entry, picker libraries and Assign-row menus complete the deferred #4028 UI paths (#8031); scores and estimates unchanged; Eyedropper copies effective character dimensions across text transforms (#6404); 30.0's gradient additions are done (dither, perceptual blending, presets); freeform gradients in SVG/PDF, mixed spot/process gradients in SVG, PDF gradients mixing a spot color with RGB or Lab stops, and dithered spot gradient fills and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, which PDF export writes as images in process colors| 4–7 | estimated; Recolor model selection is available through the engine and MCP (#2520), and the dialog's color sliders (HSB, RGB, CMYK, Lab, Tint for a spot color) edit the selected row's new color in its mode, and the Edit tab's Global Adjust sliders (Saturation, Brightness, Temperature, Luminosity, -100% to 100%) change every recolored color at once (lowered from 96%: target moved); unpainted zero-width stroke restoration fixed (#1253), score and hours unchanged; Eyedropper source reads regression-tested (#1251); screen-bounded Recolor Edit chip list (#3416), score and hours unchanged; a point on a gradient mesh's outline locates on its edge on every side (#7006: `mesh_locate_takes_a_point_on_any_side_of_the_outline`, `mesh_add_line_exactly_on_the_edge_needs_no_tolerance`), score and hours unchanged; Color panel spectrum grows with the resized panel (#8005); the Color Wheel panel's Show Opacity sets the opacity of the fill, stroke, gradient stop or freeform point it edits (part of #978), score and hours unchanged; gradient stop editor color-mode menu (#7918) |
|
||||
| Strokes, brushes, width profiles | 5 | 90% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (fifteen generated libraries including Tech Circuit, Decorative, Engraving, Arrows, Stipple, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, the stylus wheel on native Wayland (it is read under X11 and XWayland, on macOS, on Windows through Wintab and in the web build), more built-in brush libraries, tilt, bearing and rotation on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) |
|
||||
| Strokes, brushes, width profiles | 5 | 90% | Shift-double-click adjoining adjustment is implemented; brush libraries are done (twenty-one generated libraries including Tech Circuit, Decorative, Engraving, Arrows, Stipple, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams, Dry Media and Impact Bursts, User Defined, Other Library…, Save Brushes); Art brush Overlap and Pattern brush auto corners are done; remaining: pen pressure on macOS, the stylus wheel on native Wayland (it is read under X11 and XWayland, on macOS, on Windows through Wintab and in the web build), more built-in brush libraries, tilt, bearing and rotation on native Wayland and the web | 8–15 | estimated; width-point creation and adjoining adjustment regression-tested; dialog layout reviewed; evidence below; finite-arithmetic follow-up regressions and full CI passed (evidence below) |
|
||||
| Appearance, transparency, graphic styles, masks | 5 | 97% | raster effect reach in preview bounds | 1–2 | estimated; Appearance panel row context menus (Duplicate, Delete, Hide/Show, Edit Effect…, Clear Appearance, Reduce to Basic Appearance) with unselected-row targeting, Transform typing, sliders, preview, and undo are covered in `crates/ui-egui/src/panels/tests_appearance.rs` |
|
||||
| Type core | 9 | 83% | Auto-leading style resets are implemented; Hyphenation… and Justification… options are done (#2310, #2755), and a paragraph's Auto Leading also sets the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Optical Margin Alignment is done for point and area type and type on a path, right-to-left paragraphs included; remaining: Middle Eastern features beyond bidi layout (the Middle Eastern & South Asian and Standard composers are done per paragraph, #4935; `.ai`/EPS/PDF files carry no composer), optional group font-size preservation; transformed character controls fixed (#1034), see [type-parity.md](type-parity.md) | 14–19 | estimated; eleven-language pattern hyphenation in both composers, with grapheme and shaping-cluster protection (#4947, `hyphen::tests` and `layout::wrapping_tests`); Sanskrit patterns pending an allowlisted source; recent-font groups in font pickers (#3515); full-name font matches regression-tested (#1258); mixed paragraph alignment indication implemented; headless regressions, full integration CI and visual review pass; localized legacy family-name fallback with loaded/catalog regressions (#2208); Fractional Widths per type object regression-tested; color emoji fonts with bitmap glyphs (`sbix`, `CBDT`) draw and export; threading ports: every selected area type and type on a path shows its in and out ports (empty, arrow, red "+"), and the Selection tool threads from either, the in port into a frame before it, and a double-click on a threaded port breaks the thread there (`threads::tests::break_splits_the_thread_and_the_story_flows_into_the_first_part`, `select::tests::a_double_click_on_a_threaded_port_breaks_the_thread`, `canvas::tests::a_double_click_on_a_threaded_out_port_breaks_the_thread`) (#2572; `select::tests::a_click_on_the_in_port_threads_into_a_frame_before_it`, `text::tests::selected_type_shows_its_ports_in_each_state`, `threads::tests::add_before_threads_the_story_from_the_new_frame_into_the_clicked_one`, live screenshot); the Glyphs panel highlights and scrolls to the character selected with the Type tool (#4908, `panels::glyphs` tests); the OpenType panel lists only `ss01`–`ss20` sets present in the selected font and uses its custom names when supplied; Type-range desktop Copy publishes styled art and keeps font family, size and color on canvas Paste after editing (#5636); paint-only Arabic harakat keep joining with conditional GDEF-mark ownership and Insert Kashidas base-letter paint (`tests::harakat`) |
|
||||
| Type advanced (CJK, spelling, Touch Type, Retype) | 4 | 60% | editable ruby text in standard SVG and PDF artwork (written as outlines; see [type-parity.md](type-parity.md)), custom Mojikumi sets and the Mojikumi Settings dialog, Retype from images, Retype panel matching depth and fused glyphs (see [type-parity.md](type-parity.md)), Touch Type along a line for a character with no immediately preceding logical character on the same line in the same direction (movement along the baseline is disabled; baseline shift still works) | 20–28 | estimated; Retype (`type.retype`, exact and tolerance-based outline matches, #4934); No Break suppresses automatic breaks within the marked run (a forced line break still breaks); upright fallback for fullwidth `!` / `?` regression-tested; score and hours unchanged |
|
||||
@@ -618,7 +618,7 @@ about 1–1.5 agent-hours each, so the other rows (estimated on the older scale)
|
||||
| Drawing tools | 7 | 86% | Eraser preserves fill when cutting fill-only open paths with fixed or varied tips or Alt-drag marquees; painted-stroke paths retain main behavior and clipping masks keep their remaining contours or empty geometry, with reproducible evaluated gradient placement preserved on ordinary paths, compounds, groups and layers (#6582); replacement-art effects, plug-ins/Rasterize, along/across strokes and placements that cannot be reproduced retain fitting; rough-square Shaper recognition and orientation steps corrected; editable Shaper Groups landed; Pencil: Alt key toggles to Smooth Tool (#2001); remaining: Shaper construction widget/gesture refinements, pencil and the remaining pen modifier nuances, Blob Brush Merge Only with Selection, Touch Type, Live Corners' Relative rounding | 7–12 |
|
||||
| Path operations, Pathfinder, Shape Builder, Live Paint | 5 | 86% | Live Paint gap options, Shape Builder gap detection, options (Tool Options dialog, clicking a stroke in merge mode) and Shift-drag marquee | 3–6 |
|
||||
| Colour, swatches, gradients, patterns, mesh, recolor | 7 | 96% | Picker Lab entry, picker libraries and Assign-row menus complete the deferred #4028 UI paths (#8031); scores and estimates unchanged; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Swatches list fills a taller panel above its footer (#1638; `the_list_fills_a_tall_panel_above_its_footer`; scores and estimates unchanged); freeform gradients in SVG/PDF and mixed spot/process gradients in SVG (exported as stops; PDF export keeps the spot inks in a DeviceN shading, except next to RGB or Lab stops; dithered fills and Perceptual gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve are written as images in process colors), pattern fills in Expand | 2–4; Eyedropper source reads regression-tested (#1251) |
|
||||
| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (fifteen generated in code including Tech Circuit, Decorative, Engraving, Arrows, Stipple, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams and Dry Media are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation on native Wayland and the web | 8–15 |
|
||||
| Strokes, brushes, width profiles | 5 | 90% | more built-in brush libraries (twenty-one generated in code including Tech Circuit, Decorative, Engraving, Arrows, Stipple, Pressure Sensitive, Ink and Wash, Bristle Brushes, Game Trails, Energy Beams, Dry Media and Impact Bursts are done; Art brush Overlap and Pattern brush auto corners are done), pen pressure on macOS (the windowing layer reports none there), Stylus Wheel, tilt, bearing and rotation on native Wayland and the web | 8–15 |
|
||||
| Appearance, transparency, graphic styles, masks | 5 | 98% | Graphic Styles list fills a taller panel above its footer (#2992; scores and estimates unchanged); raster effect reach in preview bounds (flattener presets apply in PDF, EPS and print) | 1–2 |
|
||||
| Live vector effects | 5 | 85% | Outline Object, Pathfinder Hard/Soft Mix and Trap (since done: #3061, #3063, #3785), SVG Filters, Transform Patterns and Scale Strokes & Effects on a fill's or stroke's own Transform effect | 6–10 |
|
||||
| 3D and Materials | 4 | ~25% | Initial Revolve, Extrude & Bevel, Inflate and Rotate, with simple lighting; materials, light presets, shadows, ray tracing, Rotate (Classic), Map Art and more complete visibility remain | 25–45 |
|
||||
@@ -1438,6 +1438,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Decorative library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Decorative offers Leaf Vine, Blossom Chain, Pennant Garland and Lantern String. The four original vector pattern brushes repeat plant, flower and hanging ornament tiles along paths and take the stroke color as tints. The public source identifies Decorative as a classic brush library; these preset designs are VectorCraft's own. Evidence: `decorative_brushes_repeat_distinct_art_and_survive_a_saved_library` in `crates/engine/src/tests/brushlib.rs` covers distinct finite output, add/apply and saved-library reopening, and `the_window_menu_and_the_brushes_panel_open_brush_libraries` covers opening and clicking from the UI.
|
||||
- **Paint library** ([About brushes](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Paint offers Flat Sweep, Dry Drag, Loaded Stroke and Fan Sweep. These original art brushes stretch broad, broken, loaded and fanned vector marks along a path and take the stroke color as tints. The public source describes the Paint category's varied thickness, textured edges and natural effects; the preset designs and names are VectorCraft's own. Evidence: `paint_brushes_draw_distinct_marks_and_survive_a_saved_library` in `crates/engine/src/tests/brushlib.rs` covers finite output on short, long and curved paths, add/apply and saved-library reopening; `the_window_menu_and_the_brushes_panel_open_brush_libraries` covers opening and clicking from the UI.
|
||||
- **Dry Media library** ([help page](https://helpx.adobe.com/illustrator/desktop/paint-and-fill/apply-and-edit-strokes/about-brushes.html)): Window › Brush Libraries › Dry Media holds four art brushes with textured strokes like dry drawing materials, each 100 pt long: Chalk Grain (about 8 pt high), Graphite Pencil (about 2.3 pt), Wax Crayon (about 5.5 pt) and Charcoal Dust (about 7 pt). The brushes, their names, sizes and art are VectorCraft's own: each is filled vector paths from a fixed seed, at most 80 paths and 500 anchors, stretched along the path with Tints colorization, and the chalk and crayon art has even-odd gaps where the paper shows (`brush.libraries`, `brush.addFromLibrary`; `the_dry_media_library_holds_grainy_art_brushes_with_bounded_art`).
|
||||
- **Impact Bursts library:** Window › Brush Libraries › Impact Bursts holds six art brushes for hit sparks, shock rings and crack strokes: Star Burst, Ring Shock, Slash Arc, Spark Fan, Debris Spray and Crack Line. The brushes, their names and art are VectorCraft's own, generated in code with Tints colorization (`brush.libraries`, `brush.library`, `the_builtin_libraries_list_their_brush_names_and_counts`).
|
||||
- **Arrows library:** Window › Brush Libraries › Arrows holds five art brushes, each 100 pt long: Solid Arrow, Open Arrow (an outlined head), Double Arrow (a head at each end), Chevron Arrow (a second chevron on the shaft) and Dashed Arrow (five separate dashes and a head). Each brush stretches only the part between its guides, so the shaft follows the path's length and the heads keep their proportions, with Tints colorization. The brushes, their names and their art are VectorCraft's own, generated in code (`brush.libraries`, `brush.addFromLibrary`; `arrows_library_lists_renders_and_applies_original_brushes`, `dashed_arrow_keeps_separate_dashes_and_survives_library_save`).
|
||||
- **Brush names in library panels**: a built-in brush library's panel shows its brushes' names in the UI language, in its list rows and tooltips, and its Find field matches the name shown or the English name. This is VectorCraft's own rule. A User Defined or Other Library… library's brushes, and the document's Brushes panel, show names as they are stored. A click, a drag, Add to Brushes and `brush.addFromLibrary` still use the English name, so the brush comes into the document under that name (`built_in_library_brushes_are_listed_in_the_ui_language`, `built_in_library_brush_names_are_in_complete_catalogs`).
|
||||
- A canvas context menu: right-click selects the object under the pointer and lists what applies to the selection (Undo/Redo, clipboard, group, isolation, join, Remove Anchor Points when anchors are selected, masks, compound paths, guides, Transform, Arrange, Select, Export Selection; Outline Stroke when the selection has a visible stroke to outline, #5267; and on type Bullets and Numbering and Spelling › Auto Spell Check, checked while it is on), or the view commands on empty canvas.
|
||||
|
||||
Reference in new issue
Block a user