mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-29 01:34:29 +01:00
Merge pull request #8598 from storytold/train/combo4
Land 14 green community PRs, with main merged in
This commit is contained in:
40 files changed
+2971
-172
No files matched your search
Generated
+1
@@ -6644,6 +6644,7 @@ dependencies = [
|
||||
"webbrowser",
|
||||
"windows",
|
||||
"winit",
|
||||
"winreg",
|
||||
"winresource",
|
||||
"winsafe",
|
||||
"wl-clipboard-rs",
|
||||
|
||||
@@ -40,6 +40,9 @@ craft-print = { workspace = true }
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
craft-update = { workspace = true }
|
||||
clipboard-win = { workspace = true }
|
||||
# Reads a print queue's Standard TCP/IP RAW port for the direct-PDF transport (src/direct_pdf.rs).
|
||||
# MIT, already in the build through the update client.
|
||||
winreg = "0.55"
|
||||
# Which GPU drives which display (EnumDisplayDevices, src/gpu.rs), so the window is drawn on the
|
||||
# GPU that shows it: drawing on a GPU without a monitor reset the display driver. Safe wrappers over
|
||||
# Win32 (MIT); the `user` feature is User32.dll only. Only the wgpu renderer chooses an adapter.
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
use std::process::Command;
|
||||
use vectorcraft_ui_egui::print::{PrintJob, PrintService, Printer};
|
||||
|
||||
mod direct_pdf;
|
||||
|
||||
pub struct SystemPrint;
|
||||
impl PrintService for SystemPrint {
|
||||
fn printers(&mut self) -> Vec<Printer> {
|
||||
@@ -43,6 +45,9 @@ mod system {
|
||||
craft_print::printers().into_iter().map(|p| Printer { name: p.name, default: p.default }).collect()
|
||||
}
|
||||
pub fn print(job: &PrintJob) -> Result<String, String> {
|
||||
if job.direct_pdf {
|
||||
return super::direct_pdf::print(job);
|
||||
}
|
||||
// Copies, layout, marks and colour management are already in the PDF. Preserve its
|
||||
// physical sheet size and the queue's duplex default without printing copies twice.
|
||||
let settings = craft_print::Job { printer: job.printer.map(str::to_string), title: job.title.into(), ..Default::default() };
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//! Send the print-ready PDF to the printer's own PDF interpreter over its RAW TCP port.
|
||||
//!
|
||||
//! This is the opt-in escape hatch for large-format PCL drivers that rewrite a custom page
|
||||
//! (the HP DesignJet Z5200ps V4 driver emits a square PCL page for a 1067 x 480 mm sheet). The
|
||||
//! PDF already carries the paper size, so the printer's interpreter prints it as laid out.
|
||||
|
||||
#[cfg(windows)]
|
||||
mod imp {
|
||||
use std::io::Write;
|
||||
use std::net::{Shutdown, TcpStream, ToSocketAddrs};
|
||||
use std::time::Duration;
|
||||
|
||||
use vectorcraft_ui_egui::print::PrintJob;
|
||||
use winreg::RegKey;
|
||||
use winreg::enums::{HKEY_LOCAL_MACHINE, KEY_READ};
|
||||
|
||||
/// Submit one composed PDF to the selected printer's Standard TCP/IP RAW port.
|
||||
pub fn print(job: &PrintJob) -> Result<String, String> {
|
||||
let printer = job
|
||||
.printer
|
||||
.map(str::to_string)
|
||||
.or_else(|| craft_print::printers().into_iter().find(|p| p.default).map(|p| p.name))
|
||||
.ok_or("direct PDF needs a selected printer")?;
|
||||
let (host, port) = tcp_port(&printer)?;
|
||||
send(&host, port, &pjl(job.title, job.pdf))?;
|
||||
Ok(format!(" (direct PDF to {host}:{port})"))
|
||||
}
|
||||
|
||||
/// The `HostName` and port of a printer port registered as a Standard TCP/IP RAW port.
|
||||
fn tcp_port(printer: &str) -> Result<(String, u16), String> {
|
||||
let hklm = RegKey::predef(HKEY_LOCAL_MACHINE);
|
||||
let printer_key = hklm
|
||||
.open_subkey_with_flags(format!(r"SYSTEM\CurrentControlSet\Control\Print\Printers\{printer}"), KEY_READ)
|
||||
.map_err(|e| format!("direct PDF: cannot read the printer settings for {printer}: {e}"))?;
|
||||
let port_name: String = printer_key.get_value("Port").map_err(|e| format!("direct PDF: {printer} has no port: {e}"))?;
|
||||
let port_key = hklm
|
||||
.open_subkey_with_flags(format!(r"SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\{port_name}"), KEY_READ)
|
||||
.map_err(|e| format!("direct PDF: {printer} does not use a Standard TCP/IP port ({port_name}): {e}"))?;
|
||||
let protocol: u32 = port_key.get_value("Protocol").unwrap_or(1);
|
||||
if protocol != 1 {
|
||||
return Err(format!("direct PDF: {printer}'s port ({port_name}) is not a RAW TCP/IP port"));
|
||||
}
|
||||
let host = port_key
|
||||
.get_value::<String, _>("HostName")
|
||||
.ok()
|
||||
.filter(|h| !h.trim().is_empty())
|
||||
.or_else(|| port_key.get_value::<String, _>("IPAddress").ok().filter(|h| !h.trim().is_empty()))
|
||||
.ok_or_else(|| format!("direct PDF: {printer}'s port ({port_name}) has no host address"))?;
|
||||
let number = port_key.get_value::<u32, _>("PortNumber").unwrap_or(9100);
|
||||
let port = u16::try_from(number).map_err(|_| format!("direct PDF: invalid port number {number}"))?;
|
||||
Ok((host.trim().to_string(), port))
|
||||
}
|
||||
|
||||
/// Frame the PDF for the printer's PJL interpreter.
|
||||
fn pjl(title: &str, pdf: &[u8]) -> Vec<u8> {
|
||||
let mut name: String = title.chars().map(|c| if (c.is_ascii_graphic() || c == ' ') && c != '"' { c } else { '_' }).take(80).collect();
|
||||
if name.is_empty() {
|
||||
name.push_str("VectorCraft");
|
||||
}
|
||||
let mut out = Vec::with_capacity(pdf.len() + 96);
|
||||
out.extend_from_slice(b"\x1b%-12345X@PJL JOB NAME=\"");
|
||||
out.extend_from_slice(name.as_bytes());
|
||||
out.extend_from_slice(b"\"\r\n@PJL ENTER LANGUAGE=PDF\r\n");
|
||||
out.extend_from_slice(pdf);
|
||||
out.extend_from_slice(b"\r\n\x1b%-12345X@PJL EOJ\r\n");
|
||||
out
|
||||
}
|
||||
|
||||
/// Stream `data` to the first reachable address of `host:port`.
|
||||
fn send(host: &str, port: u16, data: &[u8]) -> Result<(), String> {
|
||||
let addrs = (host, port).to_socket_addrs().map_err(|e| format!("direct PDF: cannot resolve {host}: {e}"))?;
|
||||
let mut last = None;
|
||||
for addr in addrs {
|
||||
match TcpStream::connect_timeout(&addr, Duration::from_secs(10)) {
|
||||
Ok(mut stream) => {
|
||||
stream.set_write_timeout(Some(Duration::from_secs(120))).map_err(|e| format!("direct PDF: {e}"))?;
|
||||
stream.write_all(data).map_err(|e| format!("direct PDF: writing to {host}:{port} failed: {e}"))?;
|
||||
stream.shutdown(Shutdown::Write).map_err(|e| format!("direct PDF: finishing {host}:{port} failed: {e}"))?;
|
||||
return Ok(());
|
||||
}
|
||||
Err(e) => last = Some(e),
|
||||
}
|
||||
}
|
||||
Err(match last {
|
||||
Some(e) => format!("direct PDF: cannot connect to {host}:{port}: {e}"),
|
||||
None => format!("direct PDF: {host}:{port} has no addresses"),
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::Read;
|
||||
use std::net::TcpListener;
|
||||
|
||||
#[test]
|
||||
fn the_pjl_frames_the_pdf() {
|
||||
let out = pjl("witch hat\"", b"%PDF-1.7");
|
||||
let text = String::from_utf8_lossy(&out);
|
||||
assert!(text.starts_with("\u{1b}%-12345X@PJL JOB NAME=\"witch hat_\"\r\n@PJL ENTER LANGUAGE=PDF\r\n"));
|
||||
assert!(text.contains("%PDF-1.7"));
|
||||
assert!(text.ends_with("\r\n\u{1b}%-12345X@PJL EOJ\r\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_pdf_reaches_a_listening_port() {
|
||||
let listener = TcpListener::bind("127.0.0.1:0").unwrap();
|
||||
let port = listener.local_addr().unwrap().port();
|
||||
let t = std::thread::spawn(move || {
|
||||
let (mut stream, _) = listener.accept().unwrap();
|
||||
let mut got = Vec::new();
|
||||
stream.read_to_end(&mut got).unwrap();
|
||||
got
|
||||
});
|
||||
send("127.0.0.1", port, b"%PDF-1.7 test").unwrap();
|
||||
assert_eq!(t.join().unwrap(), b"%PDF-1.7 test");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
pub use imp::print;
|
||||
|
||||
#[cfg(not(windows))]
|
||||
pub fn print(_: &vectorcraft_ui_egui::print::PrintJob) -> Result<String, String> {
|
||||
Err("direct PDF printing is only available on Windows".into())
|
||||
}
|
||||
@@ -38,11 +38,13 @@ pub(crate) use blend::{MAX_BLEND_OBJECTS, MAX_KEYS as MAX_BLEND_KEYS, PLUGIN as
|
||||
pub(crate) use brush::{
|
||||
BrushesRead, MANAGER_NAME as BRUSH_MANAGER, brushes_kept, plugin_name as brush_plugin_name, read_brush_object, turn_over as turn_brush_art_over,
|
||||
};
|
||||
#[cfg(test)]
|
||||
pub(crate) use envelope::DASH_CHECKS_MADE;
|
||||
pub(crate) use envelope::DRAWN as ENVELOPE_DRAWN;
|
||||
pub(crate) use envelope::MAX_CHECKED;
|
||||
pub(crate) use envelope::TYPE_DRAWN as ENVELOPE_TYPE_DRAWN;
|
||||
pub(crate) use envelope::{GridPoint as EnvelopeGridPoint, PLUGIN as DEFORM_PLUGIN, outline as envelope_outline, upright as envelope_upright};
|
||||
pub(crate) use envelope::{MAX_ANY as ENVELOPE_MAX_ANY, MAX_SOLID as ENVELOPE_MAX_SOLID};
|
||||
pub(crate) use envelope::{MAX_CHECKED, MAX_DASH_CHECKS};
|
||||
pub(crate) use envelope::{WARPED_TYPE_DRAWN, WarpedType};
|
||||
#[cfg(test)]
|
||||
pub(crate) use frames::TEXT_FRAME_SCANS;
|
||||
@@ -67,7 +69,7 @@ pub use read::{
|
||||
#[cfg(test)]
|
||||
pub(crate) use style::ART_STYLE_PARSES;
|
||||
|
||||
pub(crate) use read::is_look_slot;
|
||||
pub(crate) use read::{clip_by_type, is_look_slot};
|
||||
pub(crate) use style::{MAX_LISTED, MAX_LISTED_NAME, warp_number};
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
//! locally, never committed): the blend's own art on `%_` lines, a group holding the key objects
|
||||
//! and the spine, each object's `/ArtDictionary` naming its part (`ShapeBlendPathType`: `K` a key,
|
||||
//! `S` the spine) and a key's id (`ShapeBlendPathID`); then the steps drawn, a group on plain
|
||||
//! lines; then `(Adobe Path Blends) 1 0 n XP` and `n` bytes as hex on `%` lines. Those bytes
|
||||
//! lines; then `(Adobe Path Blends) 1 0 n XP` and `n` bytes as hex on `%` lines (`%_%` lines
|
||||
//! for a blend in hidden art, as an opacity mask's is: all of it is on `%_` lines). Those bytes
|
||||
//! start `DCBA`. A blend whose spine was never edited has no spine part: only its keys.
|
||||
//!
|
||||
//! The reader reads the words after `DCBA` (little endian) this way. Word 1 is the spacing: 0 is
|
||||
|
||||
@@ -59,6 +59,16 @@ pub(crate) fn drawn_note(typed: bool) -> &'static str {
|
||||
pub(super) const MAX_PENDING: usize = 64;
|
||||
/// The most envelopes and warped text objects one import draws to check; more keep their drawn art.
|
||||
pub(crate) const MAX_CHECKED: usize = 256;
|
||||
/// The most strokes with dashes aligned to corners one import draws to check against their drawn
|
||||
/// looks (apart from [`MAX_CHECKED`]); more keep their drawn looks.
|
||||
pub(crate) const MAX_DASH_CHECKS: usize = 256;
|
||||
|
||||
#[cfg(test)]
|
||||
thread_local! {
|
||||
/// How many strokes with dashes aligned to corners have been drawn on this thread to check them
|
||||
/// against their looks.
|
||||
pub(crate) static DASH_CHECKS_MADE: std::cell::Cell<u64> = const { std::cell::Cell::new(0) };
|
||||
}
|
||||
/// The most rows or columns of a mesh read (Make with Mesh's own limit).
|
||||
const MAX_GRID: u32 = 50;
|
||||
/// How far, in points over width and height together, a saved size may lie from the contents'
|
||||
@@ -692,6 +702,8 @@ pub struct WarpedType {
|
||||
pub(super) checks: usize,
|
||||
pub(super) spent: Spent,
|
||||
pub(super) page: Option<Rect>,
|
||||
/// [`super::Structure::type_clips`]: type in an envelope's contents clips its clipping group too.
|
||||
pub(super) type_clips: HashMap<NodeId, NodeId>,
|
||||
/// The envelopes of type that may open live in layers built without a page, by their place
|
||||
/// among them ([`Self::open_alone`]): none when `None`.
|
||||
pub(super) alone: Option<BTreeSet<usize>>,
|
||||
@@ -811,8 +823,10 @@ impl WarpedType {
|
||||
texts.insert(slot, text);
|
||||
hidden.push(id);
|
||||
}
|
||||
let typed = |slot: NodeId| texts.get(&slot).map(|t| t.id);
|
||||
for n in before.iter_mut().chain(inner.iter_mut()) {
|
||||
put_type(n, &texts);
|
||||
super::clip_by_type(n, &self.type_clips, &typed, &mut |_| ());
|
||||
}
|
||||
// A warp that VectorCraft's own warp doesn't draw as its drawn art may still draw as the
|
||||
// grid the file saves for it: then it opens as a mesh envelope on that grid.
|
||||
@@ -980,10 +994,11 @@ pub(super) fn warps(appearance: &Appearance) -> bool {
|
||||
appearance.effects.iter().any(warp) || appearance.items.iter().any(|i| i.visible() && i.effects().iter().any(warp))
|
||||
}
|
||||
|
||||
/// Do `live` and `drawn` draw alike: few of the pixels either inks differ, and fewer still where a
|
||||
/// whole patch differs; and, on `page` (when the file has one), do they differ little enough that
|
||||
/// with the differences in `spent` the page check still takes the layers' art (it is added to
|
||||
/// `spent` when they do)? Both are drawn on `layer`, a layer id no other node has.
|
||||
/// Do `live` and `drawn` draw alike? Either neither has any paint ([`paints`]), or few of the
|
||||
/// pixels either inks differ and fewer still where a whole patch differs, and, on `page` (when the
|
||||
/// file has one), they differ little enough that with the differences in `spent` the page check
|
||||
/// still takes the layers' art (it is added to `spent` when they do). Both are drawn on `layer`, a
|
||||
/// layer id no other node has.
|
||||
pub(super) fn drawn_alike(live: &Node, drawn: &Node, layer: NodeId, shared: &Shared<'_>, page: Option<Rect>, spent: &mut Spent) -> bool {
|
||||
alike_within(live, drawn, live.visual_bounds(), layer, shared, page, spent)
|
||||
}
|
||||
@@ -997,6 +1012,12 @@ pub(super) fn warped_alike(live: &Node, drawn: &Node, layer: NodeId, shared: &Sh
|
||||
|
||||
/// [`drawn_alike`], with `live` measured as `reach`.
|
||||
fn alike_within(live: &Node, drawn: &Node, reach: Option<Rect>, layer: NodeId, shared: &Shared<'_>, page: Option<Rect>, spent: &mut Spent) -> bool {
|
||||
// Neither has any paint (type with no fill and no stroke, its drawn art the outlines unpainted):
|
||||
// both draw nothing, so they draw alike and add nothing to what the page check sees. Their
|
||||
// shapes aren't compared. Art that paints, however faintly, is compared as before.
|
||||
if !paints(live, 0) && !paints(drawn, 0) {
|
||||
return true;
|
||||
}
|
||||
let (Some(a), Some(b)) = (reach, drawn.visual_bounds()) else { return false };
|
||||
let region = a.union(b).inflate(2.0, 2.0);
|
||||
if !(region.is_finite() && region.width() > 0.0 && region.height() > 0.0) || region.width().max(region.height()) > 1e6 {
|
||||
@@ -1029,6 +1050,26 @@ fn alike_within(live: &Node, drawn: &Node, reach: Option<Rect>, layer: NodeId, s
|
||||
true
|
||||
}
|
||||
|
||||
/// Does `n`, shown, paint anything: a fill or stroke of its own or of its type with a paint, an
|
||||
/// effect, or an object of another kind than a path, type or container (an image, a mesh, a symbol
|
||||
/// instance…)? Hidden objects paint nothing. Past `depth` 64 it is taken to paint.
|
||||
fn paints(n: &Node, depth: usize) -> bool {
|
||||
if depth > 64 {
|
||||
return true;
|
||||
}
|
||||
if !n.visible {
|
||||
return false;
|
||||
}
|
||||
if n.appearance.items.iter().any(|i| i.visible() && !i.paint().is_none()) || n.appearance.effects.iter().any(|e| e.visible) {
|
||||
return true;
|
||||
}
|
||||
match &n.kind {
|
||||
NodeKind::Path { .. } => false,
|
||||
NodeKind::Text(t) => t.runs.iter().any(|r| !r.style.fill.is_none() || !r.style.stroke.is_none()),
|
||||
_ => n.children().is_none_or(|c| c.iter().any(|c| paints(c, depth + 1))),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -1056,6 +1097,41 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// A 40 × 40 square at (10, 10) filled black at `opacity`, or with no fill when `None`.
|
||||
fn square_node(id: u64, opacity: Option<f32>) -> Node {
|
||||
let mut bp = BezPath::new();
|
||||
bp.move_to((10.0, 10.0));
|
||||
bp.line_to((50.0, 10.0));
|
||||
bp.line_to((50.0, 50.0));
|
||||
bp.line_to((10.0, 50.0));
|
||||
bp.close_path();
|
||||
let mut n = Node::new(
|
||||
NodeId(id),
|
||||
NodeKind::Path { path: PathData::from_bezpath(&bp), rule: Default::default(), live: None, clipping: false, guide: false },
|
||||
);
|
||||
let mut appearance = (*n.appearance).clone();
|
||||
appearance.items.clear();
|
||||
if let Some(o) = opacity {
|
||||
appearance.items.push(AppearanceItem::Fill(vectorcraft_doc::FillLayer::new(Paint::solid(Color::BLACK))));
|
||||
n.opacity = o;
|
||||
}
|
||||
n.appearance = appearance.into();
|
||||
n
|
||||
}
|
||||
|
||||
/// Two objects with no paint draw alike; two that paint too faintly to ink a pixel (an alpha of
|
||||
/// 8 or less) aren't taken as alike, nor is one with paint against one without.
|
||||
#[test]
|
||||
fn art_with_no_paint_draws_alike_and_faint_art_is_still_compared() {
|
||||
let shared = Shared { patterns: &[], images: &BTreeMap::new() };
|
||||
let alike = |a: &Node, b: &Node| drawn_alike(a, b, NodeId(999), &shared, None, &mut Spent::default());
|
||||
let (none, other_none) = (square_node(1, None), square_node(2, None));
|
||||
assert!(alike(&none, &other_none));
|
||||
let (faint, other_faint) = (square_node(1, Some(0.02)), square_node(2, Some(0.02)));
|
||||
assert!(!alike(&faint, &other_faint));
|
||||
assert!(!alike(&none, &square_node(2, Some(1.0))));
|
||||
}
|
||||
|
||||
/// "AVA" at 40 points, at (10, 60).
|
||||
fn type_node(id: u64, style: CharStyle) -> Node {
|
||||
Node::new(NodeId(id), NodeKind::Text(Box::new(TextObject::point(Point::new(10.0, 60.0), "AVA", CharStyle { size: 40.0, ..style }))))
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
//! - Any other line starting with `%` is a [`Tok::Comment`] (the section markers).
|
||||
//! - `%_` later in a line starts tokens too, hidden (a pseudo-comment operator after its
|
||||
//! operands, as a gradient stop's `… 50 100 %_Bs`: AI7 spec §1.4.3); any other `%` later in a
|
||||
//! line starts a comment that is skipped.
|
||||
//! line starts a comment that is skipped, but for a line of hex digits after `%_` (a hidden
|
||||
//! blend's record), a hidden [`Tok::Comment`].
|
||||
//! - The binary image data after `%%BeginData:` is one [`Tok::Data`]; the binary preview of a placed
|
||||
//! file is one [`Tok::Preview`].
|
||||
//! - A document included whole (`%%BeginDocument:` … `%%EndDocument` lines, DSC 3.0 p. 68, nested
|
||||
@@ -222,6 +223,12 @@ impl<'a> Lexer<'a> {
|
||||
if prefixed && PLACE.iter().chain(&NOTES).chain(&RELATIVE).any(|m| line.starts_with(m)) {
|
||||
return Some(Token { tok: Tok::Comment(line.get(1..).unwrap_or_default()), hidden: true });
|
||||
}
|
||||
// And a line of hex digits, as a hidden blend's record is written (`%_%4443…`
|
||||
// after its `XP`), like the plain one on `%` lines.
|
||||
let digits = line.get(1..).unwrap_or_default();
|
||||
if prefixed && !digits.trim_ascii_end().is_empty() && digits.trim_ascii_end().iter().all(u8::is_ascii_hexdigit) {
|
||||
return Some(Token { tok: Tok::Comment(digits), hidden: true });
|
||||
}
|
||||
// A comment later in a line.
|
||||
continue;
|
||||
}
|
||||
@@ -470,6 +477,10 @@ mod tests {
|
||||
let toks = all(b"1 % a note (\n2 %_Bs\n3 %_ 4\n");
|
||||
let words: Vec<_> = toks.iter().map(|t| (t.tok.clone(), t.hidden)).collect();
|
||||
assert_eq!(words, [(Tok::Num(1.0), false), (Tok::Num(2.0), false), (Tok::Word(b"Bs"), true), (Tok::Num(3.0), false)]);
|
||||
// A hidden line of hex digits (a hidden blend's record) is a comment; other text after
|
||||
// `%_%` stays skipped.
|
||||
let toks = all(b"%_%44434241\n%_% not hex\n%_%\n1\n");
|
||||
assert_eq!(toks, [t(Tok::Comment(b"44434241"), true), t(Tok::Num(1.0), false)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -195,6 +195,10 @@ pub struct Structure {
|
||||
pub unread_elsewhere: Vec<(NodeId, Rect)>,
|
||||
/// The names of text objects, by their slot's id.
|
||||
pub slot_names: HashMap<NodeId, String>,
|
||||
/// The clipping groups whose type clips them, by the group's id: the text slot of that type,
|
||||
/// the group's last object ([`Reader::end_container`]). Once the slot holds its type, the type
|
||||
/// clips the group ([`clip_by_type`]).
|
||||
pub type_clips: HashMap<NodeId, NodeId>,
|
||||
/// Where the drawn looks lay that objects read with their art style took the place of (the
|
||||
/// document's coordinates): the page draws Illustrator's rendering of those styles there.
|
||||
pub restyled: Vec<Rect>,
|
||||
@@ -595,6 +599,13 @@ struct Reader<'a> {
|
||||
envelope_checks: usize,
|
||||
/// How far the live envelopes read so far draw from their drawn art ([`super::envelope::Spent`]).
|
||||
envelope_spent: super::envelope::Spent,
|
||||
/// How many more strokes with dashes aligned to corners this import may draw to check
|
||||
/// ([`super::MAX_DASH_CHECKS`]).
|
||||
dash_checks: usize,
|
||||
/// Whether this reader reads only what comes before the first layer (swatches, brushes, styles,
|
||||
/// symbols) for a file whose layers another reader reads: it makes no more checks once it
|
||||
/// reaches the layers, so it spends none of theirs.
|
||||
defs_only: bool,
|
||||
/// The text objects read with a Warp ([`super::envelope::WarpedType`]).
|
||||
warped_type: Vec<super::envelope::WarpedLook>,
|
||||
/// The envelopes of type read with their drawn art, settled once the type is laid out
|
||||
@@ -662,6 +673,8 @@ struct Reader<'a> {
|
||||
obj_hidden: bool,
|
||||
/// The names of text objects, by their slot's id.
|
||||
slot_names: HashMap<NodeId, String>,
|
||||
/// [`Structure::type_clips`].
|
||||
type_clips: HashMap<NodeId, NodeId>,
|
||||
/// [`Structure::xml_ids`].
|
||||
xml_ids: HashMap<String, Option<NodeId>>,
|
||||
/// The bytes of the ids in `xml_ids`.
|
||||
@@ -732,6 +745,40 @@ pub(crate) fn is_look_slot(name: Option<&str>) -> bool {
|
||||
name == Some(document::LOOK_SLOT)
|
||||
}
|
||||
|
||||
/// Make the clipping groups of [`Structure::type_clips`] in `n` and its groups clip by their type,
|
||||
/// once their slots are filled: where a group's slot became one text object (`typed` gives its id by
|
||||
/// the slot's) that is still the group's last object, that text object moves to the front as its
|
||||
/// clipping path, and `clipping` is called on it. Where the slot was left empty or became several
|
||||
/// objects, the group stays as read, unclipped. How many groups clip.
|
||||
pub(crate) fn clip_by_type(
|
||||
n: &mut Node,
|
||||
clips: &HashMap<NodeId, NodeId>,
|
||||
typed: &impl Fn(NodeId) -> Option<NodeId>,
|
||||
clipping: &mut impl FnMut(&mut Node),
|
||||
) -> usize {
|
||||
if clips.is_empty() || matches!(n.kind, NodeKind::Compound { .. }) {
|
||||
return 0;
|
||||
}
|
||||
let mut made = 0;
|
||||
if let Some(children) = n.children_mut() {
|
||||
for c in children.iter_mut().filter(|c| c.children().is_some_and(|k| !k.is_empty())) {
|
||||
made += clip_by_type(Arc::make_mut(c), clips, typed, clipping);
|
||||
}
|
||||
}
|
||||
let Some(text) = clips.get(&n.id).and_then(|slot| typed(*slot)) else { return made };
|
||||
if let NodeKind::Group { children, clip } = &mut n.kind
|
||||
&& !*clip
|
||||
&& children.last().is_some_and(|last| last.id == text && matches!(last.kind, NodeKind::Text(_)))
|
||||
&& let Some(mut last) = children.pop()
|
||||
{
|
||||
clipping(Arc::make_mut(&mut last));
|
||||
children.insert(0, last);
|
||||
*clip = true;
|
||||
made += 1;
|
||||
}
|
||||
made
|
||||
}
|
||||
|
||||
impl<'a> Reader<'a> {
|
||||
/// A reader of the editing data `data` as a whole, with the names its gradients and patterns
|
||||
/// get in the document and its art styles found first ([`swatch_names`]): the symbols defined
|
||||
@@ -824,6 +871,8 @@ impl<'a> Reader<'a> {
|
||||
envelopes: Vec::new(),
|
||||
envelope_checks: super::envelope::MAX_CHECKED,
|
||||
envelope_spent: super::envelope::Spent::default(),
|
||||
dash_checks: super::MAX_DASH_CHECKS,
|
||||
defs_only: false,
|
||||
warped_type: Vec::new(),
|
||||
typed_envelopes: Vec::new(),
|
||||
envelopes_drawn: Vec::new(),
|
||||
@@ -853,6 +902,7 @@ impl<'a> Reader<'a> {
|
||||
done: false,
|
||||
obj_hidden: false,
|
||||
slot_names: HashMap::new(),
|
||||
type_clips: HashMap::new(),
|
||||
xml_ids: HashMap::new(),
|
||||
xml_id_bytes: 0,
|
||||
art_size: None,
|
||||
|
||||
@@ -16,6 +16,9 @@ impl<'a> Reader<'a> {
|
||||
if matches!(kind, Kind::Layer(_)) {
|
||||
self.ensure_space();
|
||||
self.check_symbols();
|
||||
if self.defs_only {
|
||||
(self.envelope_checks, self.dash_checks) = (0, 0);
|
||||
}
|
||||
}
|
||||
let base = if matches!(kind, Kind::Obj(_)) { self.stack.len() } else { self.frames.last().map_or(0, |f| f.base) };
|
||||
self.frames.push(Frame {
|
||||
@@ -134,6 +137,15 @@ impl<'a> Reader<'a> {
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
// A clipping group (`q` … `Q`) with no clipping path whose last object is type: that type is
|
||||
// its clipping path, as Illustrator writes a clipping mask of type made from the text
|
||||
// document (`/AI11Text`), which has no `W`. The slot is filled later ([`clip_by_type`]).
|
||||
let type_clip = match kids.last() {
|
||||
Some(last) if matches!(kind, Kind::Clip) && clips.is_empty() && !super::is_look_slot(last.name.as_deref()) => {
|
||||
slot_of(last.name.as_deref()).map(|_| last.id)
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
// A compound path of clipping paths clips its clipping group.
|
||||
let clipping = matches!(kind, Kind::Compound) && !clips.is_empty();
|
||||
self.group_ended = !matches!(kind, Kind::Compound);
|
||||
@@ -179,6 +191,9 @@ impl<'a> Reader<'a> {
|
||||
if clipping && let Some(f) = self.frames.last_mut() {
|
||||
f.clips.push(f.children.len());
|
||||
}
|
||||
if let Some(slot) = type_clip {
|
||||
self.type_clips.insert(node.id, slot);
|
||||
}
|
||||
if compound_members {
|
||||
self.compound_groups.insert(node.id);
|
||||
}
|
||||
|
||||
@@ -837,11 +837,13 @@ impl<'a> Reader<'a> {
|
||||
}
|
||||
|
||||
/// Lend `sub`, a reader of a definition, what this import may still spend on laying out blends
|
||||
/// and checking envelopes ([`Reader::take_back_budgets`] takes back what is left).
|
||||
/// and checking envelopes and aligned dashes ([`Reader::take_back_budgets`] takes back what is
|
||||
/// left).
|
||||
fn lend_budgets(&mut self, sub: &mut Reader<'_>) {
|
||||
sub.blend_budget = self.blend_budget;
|
||||
sub.envelope_checks = self.envelope_checks;
|
||||
sub.envelope_spent = std::mem::take(&mut self.envelope_spent);
|
||||
sub.dash_checks = self.dash_checks;
|
||||
}
|
||||
|
||||
/// Take back from `sub` what [`Self::lend_budgets`] lent it, less what it spent.
|
||||
@@ -849,6 +851,7 @@ impl<'a> Reader<'a> {
|
||||
self.blend_budget = sub.blend_budget;
|
||||
self.envelope_checks = sub.envelope_checks;
|
||||
self.envelope_spent = std::mem::take(&mut sub.envelope_spent);
|
||||
self.dash_checks = sub.dash_checks;
|
||||
}
|
||||
|
||||
/// In a pattern's definition, the operands of its first operator start with its head,
|
||||
|
||||
@@ -336,6 +336,7 @@ fn repoint(n: &mut Node, renamed: &std::collections::BTreeMap<String, String>) {
|
||||
/// those the swatches take.
|
||||
pub fn palette(data: &[u8], patterns: &[PatternDef], names: &mut obj::Names) -> Option<PaletteSwatches> {
|
||||
let mut r = Reader::with_names(data, names.encoding);
|
||||
r.defs_only = true;
|
||||
// The palette, the gradients and the patterns it names come before the art, so an error in the
|
||||
// art leaves them read.
|
||||
let _ = r.run();
|
||||
@@ -396,6 +397,7 @@ pub fn brushes(data: &[u8], patterns: &[PatternDef], names: &mut obj::Names) ->
|
||||
// Brush objects are plug-in objects: data without one isn't read again.
|
||||
memchr::memmem::find(data, b"BeginPluginObject")?;
|
||||
let mut r = Reader::with_names(data, names.encoding);
|
||||
r.defs_only = true;
|
||||
// The brushes come before the art, so an error in the art leaves them read.
|
||||
let _ = r.run();
|
||||
let (mut lib, unread) = r.brush_library()?;
|
||||
@@ -449,6 +451,7 @@ pub fn graphic_styles(data: &[u8], large_canvas: bool, names: &mut obj::Names) -
|
||||
return (vec![], 1.0);
|
||||
}
|
||||
let mut r = Reader::with_names(data, names.encoding);
|
||||
r.defs_only = true;
|
||||
r.large_canvas = large_canvas.then_some(1.0);
|
||||
// The styles come before the art, so an error in the art leaves them read.
|
||||
let _ = r.run();
|
||||
@@ -482,6 +485,7 @@ pub struct Symbols {
|
||||
pub fn symbols(data: &[u8], names: &mut obj::Names) -> Option<Symbols> {
|
||||
crate::import::ai::find(data, b"BeginSymbol")?;
|
||||
let mut r = Reader::with_names(data, names.encoding);
|
||||
r.defs_only = true;
|
||||
// The symbols come before the art, so an error in the art leaves them read.
|
||||
let _ = r.run();
|
||||
r.check_symbols();
|
||||
@@ -536,10 +540,20 @@ pub fn symbols(data: &[u8], names: &mut obj::Names) -> Option<Symbols> {
|
||||
Some(Symbols { symbols, images, swatches, canvas_scale: r.canvas_scale, own_size: r.symbols_own_size })
|
||||
}
|
||||
|
||||
/// A reader of all of `data` for what doesn't depend on how its art draws (its artboards, its
|
||||
/// variable library): it checks no envelope and no stroke with aligned dashes against its drawn
|
||||
/// look, so it spends none of the import's checks ([`super::MAX_CHECKED`],
|
||||
/// [`super::MAX_DASH_CHECKS`]), which are the layers' reader's.
|
||||
fn reader_aside(data: &[u8]) -> Reader<'_> {
|
||||
let mut r = Reader::new(data);
|
||||
(r.envelope_checks, r.dash_checks) = (0, 0);
|
||||
r
|
||||
}
|
||||
|
||||
/// [`artboards`] as far as reading `data` from its start gets: those read before an error, and
|
||||
/// those of a `/Document` still open when it stopped (its art can be what stopped it).
|
||||
fn artboards_read(data: &[u8], names: &mut obj::Names) -> (Vec<(String, Rect)>, Option<usize>) {
|
||||
let mut r = Reader::new(data);
|
||||
let mut r = reader_aside(data);
|
||||
r.names = obj::Names::new(names.encoding);
|
||||
let _ = r.run();
|
||||
let open: Vec<Obj> = r.frames.iter().filter_map(|f| if let Kind::Obj(o) = &f.kind { Some((**o).clone()) } else { None }).collect();
|
||||
@@ -608,7 +622,7 @@ pub fn variables(data: &[u8], names: &mut obj::Names) -> VariableRead {
|
||||
if crate::import::ai::find(data, b"variableSets").is_none() {
|
||||
return VariableRead::default();
|
||||
}
|
||||
let mut r = Reader::new(data);
|
||||
let mut r = reader_aside(data);
|
||||
r.names = obj::Names::new(names.encoding);
|
||||
let _ = r.run();
|
||||
if r.variables.present {
|
||||
@@ -1385,6 +1399,7 @@ impl<'a> Reader<'a> {
|
||||
unread: self.unread,
|
||||
unread_elsewhere: self.unread_elsewhere,
|
||||
slot_names: self.slot_names,
|
||||
type_clips: self.type_clips.clone(),
|
||||
restyled: self.restyled,
|
||||
placeholders: self.placeholders,
|
||||
placed_elsewhere: self.placed_elsewhere,
|
||||
@@ -1397,6 +1412,7 @@ impl<'a> Reader<'a> {
|
||||
spent: self.envelope_spent,
|
||||
page,
|
||||
alone: None,
|
||||
type_clips: self.type_clips,
|
||||
},
|
||||
styles_read,
|
||||
text_patterns,
|
||||
@@ -1960,6 +1976,20 @@ impl LibraryWalk {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether an XML node in `o` or the dictionaries it holds has a value or a type
|
||||
/// (`xmlnode-nodevalue`, `xmlnode-nodetype`). `seen` counts the dictionaries looked at; past
|
||||
/// [`MAX_LIBRARY_NODES`] of them, or deeper than [`MAX_DEPTH`], the library is taken to hold some.
|
||||
fn holds_values(o: &Obj, seen: &mut usize, depth: usize) -> bool {
|
||||
*seen = seen.saturating_add(1);
|
||||
if *seen > MAX_LIBRARY_NODES || depth > MAX_DEPTH {
|
||||
return true;
|
||||
}
|
||||
if o.ty == "XMLNode" && (o.get("xmlnode-nodevalue").is_some() || o.get("xmlnode-nodetype").is_some()) {
|
||||
return true;
|
||||
}
|
||||
o.items().any(|c| holds_values(c, seen, depth + 1))
|
||||
}
|
||||
|
||||
/// The library of the `variableSets` element `sets` (see [`variable_library`]).
|
||||
fn read_variable_sets(sets: &Obj) -> VariableRead {
|
||||
let mut walk = LibraryWalk::default();
|
||||
@@ -1979,5 +2009,34 @@ fn read_variable_sets(sets: &Obj) -> VariableRead {
|
||||
if walk.nodes > MAX_LIBRARY_NODES {
|
||||
return VariableRead { variables: Variables::default(), bindings: vec![], bindings_skipped: 0, skipped: 1, present: true };
|
||||
}
|
||||
if vars == Variables::default() && walk.bindings.is_empty() && !holds_values(sets, &mut 0, 0) {
|
||||
// The empty library a file can keep: nodes with names and nothing else (no value, no
|
||||
// type). There is nothing in it to list, so nothing was left out.
|
||||
walk.skipped = 0;
|
||||
}
|
||||
VariableRead { variables: vars, bindings: walk.bindings, bindings_skipped: walk.bindings_skipped, skipped: walk.skipped, present: true }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::rc::Rc;
|
||||
|
||||
/// An XML node holding `child` (when given) and nothing else: no value, no type.
|
||||
fn node(child: Option<Obj>) -> Obj {
|
||||
let children = Obj { ty: "Array".into(), content: child.map(|c| V::Obj(Rc::new(c))).into_iter().collect(), ..Obj::default() };
|
||||
Obj { ty: "XMLNode".into(), entries: vec![(Some("xmlnode-children".into()), vec![V::Obj(Rc::new(children))])], ..Obj::default() }
|
||||
}
|
||||
|
||||
/// An empty library is taken to hold values past the caps on what is looked at: nested deeper
|
||||
/// than [`MAX_DEPTH`], or once [`MAX_LIBRARY_NODES`] dictionaries have been looked at.
|
||||
#[test]
|
||||
fn an_empty_library_past_the_caps_is_taken_to_hold_values() {
|
||||
let shallow = node(Some(node(None)));
|
||||
assert!(!holds_values(&shallow, &mut 0, 0));
|
||||
let deep = (0..MAX_DEPTH).fold(node(None), |inner, _| node(Some(inner)));
|
||||
assert!(holds_values(&deep, &mut 0, 0));
|
||||
let mut seen = MAX_LIBRARY_NODES;
|
||||
assert!(holds_values(&shallow, &mut seen, 0));
|
||||
}
|
||||
}
|
||||
@@ -832,15 +832,32 @@ impl<'a> Reader<'a> {
|
||||
})
|
||||
});
|
||||
// An image with a Warp is the object only where its live warp draws as its drawn look, and
|
||||
// while the import has a check left for it; otherwise its drawn look stays.
|
||||
// while the import has a check left for it; otherwise its drawn look stays. So is a stroke
|
||||
// with dashes aligned to corners and path ends, whose fitting is VectorCraft's own, within
|
||||
// checks of its own ([`crate::import::ai::MAX_DASH_CHECKS`]) and without weighing the page:
|
||||
// the envelopes' checks and share of the page check stay theirs alone. Type with such
|
||||
// dashes keeps its drawn look, as before.
|
||||
let appearance = match appearance {
|
||||
Some(ap) if aligns_dashes(&ap) && slot_of(object.name.as_deref()).is_some() => None,
|
||||
Some(ap) if matches!(object.kind, NodeKind::Image(_)) && ap.effects.iter().any(|e| e.id.starts_with("warp.")) => {
|
||||
let alike = self.envelope_checks > 0 && {
|
||||
self.envelope_checks -= 1;
|
||||
let layer = self.doc.alloc_id();
|
||||
let shared = crate::import::ai::envelope::Shared { patterns: &self.doc.patterns, images: &self.doc.images };
|
||||
let shown = !hidden && object.visible && look.visible;
|
||||
image_warp_alike(object, &ap, look, &self.hidden_ids, hidden, layer, &shared, page.filter(|_| shown), &mut self.envelope_spent)
|
||||
look_alike(object, &ap, look, &self.hidden_ids, hidden, layer, &shared, page.filter(|_| shown), &mut self.envelope_spent)
|
||||
};
|
||||
alike.then_some(ap)
|
||||
}
|
||||
Some(ap) if aligns_dashes(&ap) => {
|
||||
let alike = self.dash_checks > 0 && {
|
||||
self.dash_checks -= 1;
|
||||
#[cfg(test)]
|
||||
crate::import::ai::DASH_CHECKS_MADE.set(crate::import::ai::DASH_CHECKS_MADE.get() + 1);
|
||||
let layer = self.doc.alloc_id();
|
||||
let shared = crate::import::ai::envelope::Shared { patterns: &self.doc.patterns, images: &self.doc.images };
|
||||
let mut spent = crate::import::ai::envelope::Spent::default();
|
||||
look_alike(object, &ap, look, &self.hidden_ids, hidden, layer, &shared, None, &mut spent)
|
||||
};
|
||||
alike.then_some(ap)
|
||||
}
|
||||
@@ -1062,23 +1079,35 @@ fn tick(vals: &[V]) -> Option<(Affine, Rect, String)> {
|
||||
}
|
||||
|
||||
/// The gradients and patterns `look` paints with, placed as it draws them, by their swatch's name
|
||||
/// (the first of each; a pattern's name after `PATTERN_KEY`).
|
||||
fn placed_paints(look: &Node, out: &mut HashMap<String, Paint>, depth: usize) {
|
||||
/// (the first of each; a pattern's name after `PATTERN_KEY`). With `fill_patterns`, a pattern only
|
||||
/// where the look fills with it: a style's pattern is a fill, so a path's stack takes it from the
|
||||
/// look's fills alone (type keeps taking it from either). `moved` gets each pattern that the look
|
||||
/// also places elsewhere than its first placement.
|
||||
fn placed_paints(look: &Node, out: &mut HashMap<String, Paint>, moved: &mut HashSet<String>, fill_patterns: bool, depth: usize) {
|
||||
if depth > MAX_DEPTH {
|
||||
return;
|
||||
}
|
||||
for item in &look.appearance.items {
|
||||
let key = match item.paint() {
|
||||
Paint::Gradient(g) => g.swatch.clone(),
|
||||
Paint::Pattern { pattern, .. } => Some(format!("{PATTERN_KEY}{pattern}")),
|
||||
Paint::Pattern { pattern, .. } if item.is_fill() || !fill_patterns => Some(format!("{PATTERN_KEY}{pattern}")),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(key) = key {
|
||||
out.entry(key).or_insert_with(|| item.paint().clone());
|
||||
match out.get(&key) {
|
||||
Some(first) => {
|
||||
if matches!(first, Paint::Pattern { .. }) && first != item.paint() {
|
||||
moved.insert(key);
|
||||
}
|
||||
}
|
||||
None => {
|
||||
out.insert(key, item.paint().clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for c in look.children().into_iter().flatten() {
|
||||
placed_paints(c, out, depth + 1);
|
||||
placed_paints(c, out, moved, fill_patterns, depth + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1224,18 +1253,19 @@ fn moves_with(object: &Node, st: &crate::import::ai::style::ArtStyle) -> bool {
|
||||
|
||||
/// Is `object` an image without an opacity mask, and `st` one Warp on it with nothing else that
|
||||
/// paints ([`crate::import::ai::style::ArtStyle::image_warp`])? Such an image is read with its Warp
|
||||
/// live where that draws as its drawn look ([`image_warp_alike`]).
|
||||
/// live where that draws as its drawn look ([`look_alike`]).
|
||||
fn image_warps(object: &Node, st: &crate::import::ai::style::ArtStyle) -> bool {
|
||||
matches!(object.kind, NodeKind::Image(_)) && object.extras().mask.is_none() && st.image_warp
|
||||
}
|
||||
|
||||
/// 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; 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.
|
||||
/// Does `object` with `appearance` (an image's Warp, or a stroke with dashes aligned to corners)
|
||||
/// draw as `look`, its drawn look, compared over all that it draws, effects included
|
||||
/// ([`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; 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(
|
||||
fn look_alike(
|
||||
object: &Node,
|
||||
appearance: &Appearance,
|
||||
look: &Node,
|
||||
@@ -1261,6 +1291,11 @@ fn image_warp_alike(
|
||||
crate::import::ai::envelope::warped_alike(&live, &plain, layer, shared, page, spent)
|
||||
}
|
||||
|
||||
/// Does `appearance` stroke with dashes aligned to corners and path ends?
|
||||
fn aligns_dashes(appearance: &Appearance) -> bool {
|
||||
appearance.items.iter().any(|i| matches!(i, AppearanceItem::Stroke(s) if s.dash.as_ref().is_some_and(|d| d.align_corners && d.is_dashed())))
|
||||
}
|
||||
|
||||
/// Show every object in container `n`, at any depth.
|
||||
fn show_members(n: &mut Node) {
|
||||
for c in n.children_mut().into_iter().flatten() {
|
||||
@@ -1282,7 +1317,7 @@ fn styled(object: &Node, look: &Node, st: &crate::import::ai::style::ArtStyle, p
|
||||
let slot = slot_of(object.name.as_deref()).is_some();
|
||||
// Several fills and strokes, on a path or a compound path.
|
||||
let stacked = !slot && !st.simple && st.stacked && matches!(object.kind, NodeKind::Path { .. } | NodeKind::Compound { .. });
|
||||
// One Warp on an image, checked against its drawn look by the caller ([`image_warp_alike`]).
|
||||
// One Warp on an image, checked against its drawn look by the caller ([`look_alike`]).
|
||||
let image_warp = !st.simple && image_warps(object, st);
|
||||
// A symbol instance draws its symbol's art: it keeps its drawn look.
|
||||
if !st.plain
|
||||
@@ -1301,15 +1336,22 @@ fn styled(object: &Node, look: &Node, st: &crate::import::ai::style::ArtStyle, p
|
||||
let own_gradient = object.appearance.fill().filter(|f| matches!(f.paint, Paint::Gradient(_)));
|
||||
// A style's gradients are written in a space of the object's bounds that isn't documented; its
|
||||
// drawn look has each where the app placed it.
|
||||
let mut placed = HashMap::new();
|
||||
placed_paints(look, &mut placed, 0);
|
||||
let (mut placed, mut moved) = (HashMap::new(), HashSet::new());
|
||||
placed_paints(look, &mut placed, &mut moved, stacked, 0);
|
||||
// A stack's gradients are each its own swatch, placed where the drawn look has it: one fitted
|
||||
// to the object's bounds instead could lie elsewhere, so such a stack keeps its drawn look.
|
||||
// to the object's bounds instead could lie elsewhere, so such a stack keeps its drawn look. So
|
||||
// are its patterns, each once, and each placed one way in the look: `placed_paints` keeps the
|
||||
// first placement of each name, and which of several is the style's isn't known. The same
|
||||
// placement again (a compound path's look fills each subpath) is still one.
|
||||
if stacked {
|
||||
let mut seen = HashSet::new();
|
||||
let (mut seen, mut seen_patterns) = (HashSet::new(), HashSet::new());
|
||||
let placed_apart = st.items.iter().all(|i| match i {
|
||||
StyleItem::Gradient { name: Some(n), .. } => seen.insert(n) && placed.contains_key(paints.names.get(Global::Gradient, n)),
|
||||
StyleItem::Gradient { name: None, .. } => false,
|
||||
StyleItem::Pattern { name, .. } => {
|
||||
let key = format!("{PATTERN_KEY}{}", paints.names.get(Global::Pattern, name));
|
||||
seen_patterns.insert(key.clone()) && placed.contains_key(&key) && !moved.contains(&key)
|
||||
}
|
||||
_ => true,
|
||||
});
|
||||
if !placed_apart {
|
||||
@@ -1382,7 +1424,134 @@ fn styled(object: &Node, look: &Node, st: &crate::import::ai::style::ArtStyle, p
|
||||
} else {
|
||||
object.appearance.contents_index
|
||||
};
|
||||
Some(Appearance { items, effects: st.effects.clone(), contents_index })
|
||||
let appearance = Appearance { items, effects: st.effects.clone(), contents_index };
|
||||
// Zig Zag's ridges are placed by VectorCraft's own rule: on objects other than type it is kept
|
||||
// only where they draw the outline the drawn look has.
|
||||
if !slot && st.effects.iter().any(|e| e.id == "distort.zigZag") && !draws_look_outline(object, &appearance, look) {
|
||||
return None;
|
||||
}
|
||||
Some(appearance)
|
||||
}
|
||||
|
||||
/// How far, in points, an outline drawn with a reshaping effect may lie from its drawn look's
|
||||
/// ([`draws_look_outline`]): the look's coordinates are written to a few decimals.
|
||||
const OUTLINE_TOLERANCE: f64 = 0.25;
|
||||
|
||||
/// How far, in points, a flattened outline in [`draws_look_outline`] may lie from its curves.
|
||||
const OUTLINE_FLATNESS: f64 = OUTLINE_TOLERANCE / 10.0;
|
||||
|
||||
/// How far apart, in points, [`draws_look_outline`] checks points along each flattened segment.
|
||||
const OUTLINE_SPACING: f64 = OUTLINE_TOLERANCE / 2.0;
|
||||
|
||||
/// How close, in points, each checked point must lie to the other flattened outline: every point
|
||||
/// between two checked ones is within half the spacing of one, and both outlines are within the
|
||||
/// flatness of their curves, so the curves are then within [`OUTLINE_TOLERANCE`] of each other.
|
||||
const OUTLINE_POINT_LIMIT: f64 = OUTLINE_TOLERANCE - 2.0 * OUTLINE_FLATNESS - OUTLINE_SPACING / 2.0;
|
||||
|
||||
/// Most point-to-segment distances worked out for one object, over all its look's outlines.
|
||||
const MAX_OUTLINE_PAIRS: usize = 4_000_000;
|
||||
|
||||
/// Does path or compound path `object` with `appearance`'s effects draw every outline of its drawn look
|
||||
/// `look`, as `look` draws its own (each within [`OUTLINE_TOLERANCE`] of the other)? `false` for
|
||||
/// anything else: a look holding other than paths, outlines too detailed to compare.
|
||||
fn draws_look_outline(object: &Node, appearance: &Appearance, look: &Node) -> bool {
|
||||
fn leaves(n: &Node, out: &mut Vec<vectorcraft_geom::PathData>, depth: usize) -> bool {
|
||||
match &n.kind {
|
||||
NodeKind::Path { path, .. } => {
|
||||
out.push(path.clone());
|
||||
true
|
||||
}
|
||||
NodeKind::Compound { children, .. } => {
|
||||
out.push(vectorcraft_geom::PathData::new(
|
||||
children.iter().filter_map(|c| c.path_data()).flat_map(|p| p.subpaths.iter().cloned()).collect(),
|
||||
));
|
||||
true
|
||||
}
|
||||
NodeKind::Group { clip: false, .. } if depth < MAX_DEPTH => n.children().into_iter().flatten().all(|c| leaves(c, out, depth + 1)),
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
/// The segments of `paths` flattened, at most `max` of them.
|
||||
fn segments(paths: &[vectorcraft_geom::PathData], max: usize) -> Option<Vec<kurbo::Line>> {
|
||||
let mut out = vec![];
|
||||
let (mut start, mut last) = (None, None);
|
||||
let mut over = false;
|
||||
for p in paths {
|
||||
vectorcraft_geom::flatten(p.to_bezpath(), OUTLINE_FLATNESS, |el| {
|
||||
let mut add = |a: kurbo::Point, b: kurbo::Point| {
|
||||
if out.len() < max {
|
||||
out.push(kurbo::Line::new(a, b));
|
||||
} else {
|
||||
over = true;
|
||||
}
|
||||
};
|
||||
match el {
|
||||
kurbo::PathEl::MoveTo(q) => (start, last) = (Some(q), Some(q)),
|
||||
kurbo::PathEl::LineTo(q) => {
|
||||
if let Some(l) = last {
|
||||
add(l, q);
|
||||
}
|
||||
last = Some(q);
|
||||
}
|
||||
kurbo::PathEl::ClosePath => {
|
||||
if let (Some(l), Some(s)) = (last, start) {
|
||||
add(l, s);
|
||||
}
|
||||
last = start;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
});
|
||||
}
|
||||
(!over && !out.is_empty()).then_some(out)
|
||||
}
|
||||
/// Does every point of segments `a` lie close enough to segments `b` ([`OUTLINE_POINT_LIMIT`])?
|
||||
/// Each segment is checked at both ends (the last point of an open outline starts no segment)
|
||||
/// and at points at most [`OUTLINE_SPACING`] apart between them (two outlines can share their
|
||||
/// vertices and join them differently). Each point's distance to each segment of `b` (a
|
||||
/// projection onto it) is taken from `budget`: `false` once that runs out.
|
||||
fn near(a: &[kurbo::Line], b: &[kurbo::Line], budget: &mut usize) -> bool {
|
||||
use kurbo::{ParamCurve, ParamCurveArclen, ParamCurveNearest};
|
||||
let close = |p: kurbo::Point| b.iter().any(|t| t.nearest(p, 1e-6).distance_sq <= OUTLINE_POINT_LIMIT * OUTLINE_POINT_LIMIT);
|
||||
for s in a {
|
||||
let steps = (s.arclen(1e-6) / OUTLINE_SPACING).ceil();
|
||||
let steps = if steps.is_finite() && steps >= 1.0 { steps as usize } else { 1 };
|
||||
let Some(left) = budget.checked_sub(steps.saturating_add(1).saturating_mul(b.len())) else { return false };
|
||||
*budget = left;
|
||||
if !(0..=steps).all(|k| close(s.eval(k as f64 / steps as f64))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
/// The box round segments `lines` (`None` without any).
|
||||
fn bounds(lines: &[kurbo::Line]) -> Option<kurbo::Rect> {
|
||||
let first = lines.first()?.p0;
|
||||
Some(lines.iter().fold(kurbo::Rect::from_points(first, first), |r, l| r.union_pt(l.p0).union_pt(l.p1)))
|
||||
}
|
||||
let (mut ours, mut theirs) = (vec![], vec![]);
|
||||
if !matches!(object.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) || !leaves(object, &mut ours, 0) || !leaves(look, &mut theirs, 0) {
|
||||
return false;
|
||||
}
|
||||
// The object's outline reshaped as it is drawn: its effects from its own bounds.
|
||||
for path in &mut ours {
|
||||
let bounds = kurbo::Shape::bounding_box(&path.to_bezpath());
|
||||
*path = vectorcraft_effects::apply_geometry(&appearance.effects, path, bounds);
|
||||
}
|
||||
let max = MAX_OUTLINE_PAIRS.isqrt();
|
||||
let Some(ours) = segments(&ours, max) else { return false };
|
||||
let Some(ours_box) = bounds(&ours) else { return false };
|
||||
// Two outlines each within the tolerance of the other have boxes as close: the boxes are
|
||||
// compared first, then the points, from one budget for the object.
|
||||
let boxed = |t: &[kurbo::Line]| {
|
||||
let Some(r) = bounds(t) else { return false };
|
||||
[r.x0 - ours_box.x0, r.y0 - ours_box.y0, r.x1 - ours_box.x1, r.y1 - ours_box.y1].iter().all(|d| d.abs() <= OUTLINE_TOLERANCE)
|
||||
};
|
||||
let mut budget = MAX_OUTLINE_PAIRS;
|
||||
// Each of the look's outlines (a fill and a stroke draw the same one) is the object's.
|
||||
theirs
|
||||
.iter()
|
||||
.all(|t| segments(std::slice::from_ref(t), max).is_some_and(|t| boxed(&t) && near(&t, &ours, &mut budget) && near(&ours, &t, &mut budget)))
|
||||
}
|
||||
|
||||
/// A graphic style's appearance from art style `st`, on no object: `None` when the style isn't one
|
||||
@@ -1673,6 +1842,50 @@ mod tests {
|
||||
Arc::new(Node::path(NodeId(id), shapes::rectangle(Rect::new(0.0, 0.0, 10.0, 10.0)), Appearance::basic(fill, Paint::None, 0.0)))
|
||||
}
|
||||
|
||||
/// The outline check works from one budget for the object: a look of the outline drawn twice
|
||||
/// (a fill and a stroke) matches, one drawn thousands of times gives up and keeps the drawn
|
||||
/// look instead of comparing every copy.
|
||||
#[test]
|
||||
fn the_outline_check_has_one_budget_for_the_object() {
|
||||
let zig = vectorcraft_doc::Effect {
|
||||
id: "distort.zigZag".into(),
|
||||
params: serde_json::json!({"size": 3.0, "relative": false, "ridges": 4, "points": "corner"}),
|
||||
visible: true,
|
||||
};
|
||||
let path = shapes::rectangle(Rect::new(0.0, 0.0, 100.0, 60.0));
|
||||
let appearance = Appearance { effects: vec![zig.clone()], ..Appearance::basic(Paint::None, Paint::None, 0.0) };
|
||||
let object = Node::path(NodeId(1), path.clone(), appearance.clone());
|
||||
let outline = vectorcraft_effects::apply_geometry(std::slice::from_ref(&zig), &path, Rect::new(0.0, 0.0, 100.0, 60.0));
|
||||
let look = |copies: u64| {
|
||||
let drawn = (0..copies).map(|i| Arc::new(Node::path(NodeId(10 + i), outline.clone(), Appearance::default()))).collect();
|
||||
Node::group(NodeId(2), drawn)
|
||||
};
|
||||
assert!(draws_look_outline(&object, &appearance, &look(2)));
|
||||
let started = std::time::Instant::now();
|
||||
assert!(!draws_look_outline(&object, &appearance, &look(5_000)));
|
||||
assert!(started.elapsed() < std::time::Duration::from_secs(5), "{:?}", started.elapsed());
|
||||
}
|
||||
|
||||
/// The outline check holds for every point of the outlines, not only the points it checks: a
|
||||
/// 0.25 pt line whose look has only short pieces over its ends, 0.24 pt away, leaves the
|
||||
/// line's middle about 0.27 pt from the look, so the drawn look stays. The line drawn 0.1 pt
|
||||
/// away matches.
|
||||
#[test]
|
||||
fn the_outline_check_holds_between_the_points_it_checks() {
|
||||
use kurbo::Point;
|
||||
use vectorcraft_geom::{PathData, SubPath};
|
||||
let appearance = Appearance::basic(Paint::None, Paint::None, 0.0);
|
||||
let line = PathData::new(vec![SubPath::polyline(&[Point::new(0.0, 0.0), Point::new(0.25, 0.0)], false)]);
|
||||
let object = Node::path(NodeId(1), line, appearance.clone());
|
||||
let look = |pieces: &[[Point; 2]]| {
|
||||
let drawn = PathData::new(pieces.iter().map(|p| SubPath::polyline(p, false)).collect());
|
||||
Node::group(NodeId(2), vec![Arc::new(Node::path(NodeId(3), drawn, Appearance::default()))])
|
||||
};
|
||||
let ends = [[Point::new(0.0, 0.24), Point::new(0.01, 0.24)], [Point::new(0.24, 0.24), Point::new(0.25, 0.24)]];
|
||||
assert!(!draws_look_outline(&object, &appearance, &look(&ends)));
|
||||
assert!(draws_look_outline(&object, &appearance, &look(&[[Point::new(0.0, 0.1), Point::new(0.25, 0.1)]])));
|
||||
}
|
||||
|
||||
/// An image draws no stroke, so an image with a brush in its art style keeps its drawn look.
|
||||
#[test]
|
||||
fn an_image_with_a_brush_keeps_its_drawn_look() {
|
||||
|
||||
@@ -188,10 +188,11 @@ pub(super) struct ArtStyle {
|
||||
/// It would be [`Self::simple`] but for a Stroke Style filter's variable width written as one
|
||||
/// centered array ([`centered_widths`]): an object whose drawn look is empty takes it with its profile.
|
||||
pub uneven: bool,
|
||||
/// It is several fills and strokes in solid colours or gradients (strokes without a brush),
|
||||
/// each with its own visibility, opacity and blend mode but no effects of its own, under only
|
||||
/// the effects any object takes that don't move the outline: what a path or compound path is
|
||||
/// read with when each gradient is placed as its drawn look has it (`read::ops`' `styled`).
|
||||
/// It is several fills and strokes in solid colours, gradients or patterns (strokes without a
|
||||
/// brush), each with its own visibility, opacity and blend mode but no effects of its own, under
|
||||
/// only the effects any object takes that don't move the outline, and under none when a pattern
|
||||
/// paints: what a path or compound path is read with when each gradient and pattern is placed as
|
||||
/// its drawn look has it (`read::ops`' `styled`).
|
||||
pub stacked: bool,
|
||||
/// It is one Warp on the whole object, under fills and strokes that paint nothing and have no
|
||||
/// effects of their own: what an image is read with when its live warp draws as its drawn look
|
||||
@@ -1469,11 +1470,10 @@ fn stroke_item(f: &Filter, align: StrokeAlign) -> Result<Option<StyleItem>, ()>
|
||||
if !f.paints.0 {
|
||||
return Ok(None);
|
||||
}
|
||||
// Dashes aligned to corners and path ends draw as the look's pieces: a solid end at each end
|
||||
// and the pattern, fitted, between them.
|
||||
if f.params.get("BSDashAdj").is_some_and(|v| *v != 0.0) {
|
||||
return Err(());
|
||||
}
|
||||
// Dashes aligned to corners and path ends (the switch in the stroke's dictionary): the look
|
||||
// draws them fitted between solid ends, which the reader checks the stroke against before it
|
||||
// takes it.
|
||||
let aligned = f.params.get("BSDashAdj").is_some_and(|v| *v != 0.0);
|
||||
match &f.stroke {
|
||||
Some(p) if !f.gradient && f.pattern.is_none() => Ok(Some(StyleItem::Stroke {
|
||||
paint: p.clone(),
|
||||
@@ -1481,7 +1481,7 @@ fn stroke_item(f: &Filter, align: StrokeAlign) -> Result<Option<StyleItem>, ()>
|
||||
cap: f.cap,
|
||||
join: f.join,
|
||||
miter: f.miter,
|
||||
dash: f.dash.clone(),
|
||||
dash: f.dash.clone().map(|d| Dash { align_corners: aligned, ..d }),
|
||||
profile: width_profile(&f.arrays),
|
||||
align,
|
||||
brush: None,
|
||||
@@ -1744,8 +1744,9 @@ impl Builder<'_> {
|
||||
|
||||
/// Is `e`, on the whole object, an effect any object is read with? Of the Distort & Transform
|
||||
/// effects: Transform without copies (Random is never read), Twist, a Tweak that moves nothing,
|
||||
/// Pucker & Bloat at 0, and Free Distort when its corners make a parallelogram (an affine map).
|
||||
/// Zig Zag is left to type. Which objects Transform, Twist and Free Distort are read on is
|
||||
/// Pucker & Bloat at 0, Free Distort when its corners make a parallelogram (an affine map), and Zig
|
||||
/// Zag (on objects other than type only where it draws its drawn look's outline: `read::ops`'
|
||||
/// `styled`). Which objects Transform, Twist and Free Distort are read on is
|
||||
/// `read::ops`' `moves_with`.
|
||||
fn any_object_takes(e: &Effect) -> bool {
|
||||
match e.id.as_str() {
|
||||
@@ -1762,7 +1763,8 @@ fn any_object_takes(e: &Effect) -> bool {
|
||||
| "path.outlineObject"
|
||||
| "path.outlineStroke"
|
||||
| "distort.twist"
|
||||
| "distort.tweak" => true,
|
||||
| "distort.tweak"
|
||||
| "distort.zigZag" => true,
|
||||
// Copies are drawn as one path, its fills under all its strokes, where the file paints each
|
||||
// copy's fill and stroke in turn.
|
||||
"distort.transform" => e.params["copies"].as_i64() == Some(0),
|
||||
@@ -1861,9 +1863,15 @@ fn style(filters: &[Filter]) -> ArtStyle {
|
||||
&& st.plain
|
||||
&& !st.pathfinder
|
||||
&& !st.moves_outline()
|
||||
&& st.items.iter().all(|i| matches!(i, StyleItem::Fill(_) | StyleItem::Gradient { .. } | StyleItem::Stroke { brush: None, .. }))
|
||||
&& st.items.iter().all(|i| {
|
||||
matches!(i, StyleItem::Fill(_) | StyleItem::Gradient { .. } | StyleItem::Pattern { .. } | StyleItem::Stroke { brush: None, .. })
|
||||
})
|
||||
&& st.looks.iter().all(|l| l.effects.is_empty())
|
||||
&& st.effects.iter().all(any_object_takes);
|
||||
&& st.effects.iter().all(any_object_takes)
|
||||
// A pattern fill under the object's effects keeps the drawn look, a conservative rule: in
|
||||
// one file a Scribble over a pattern fill drew unlike its look, its tiles placed as the
|
||||
// look's are (why isn't established).
|
||||
&& (st.effects.is_empty() || !st.items.iter().any(|i| matches!(i, StyleItem::Pattern { .. })));
|
||||
st.image_warp = st.plain
|
||||
&& matches!(st.effects.as_slice(), [e] if e.id.starts_with("warp."))
|
||||
&& st.items.iter().all(|i| matches!(i, StyleItem::Fill(p) | StyleItem::Stroke { paint: p, .. } if p.is_none()))
|
||||
|
||||
@@ -61,13 +61,17 @@ fn a_uniform_or_unreadable_width_profile_stays_a_live_stroke() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn dashes_aligned_to_corners_keep_the_drawn_look() {
|
||||
// GUARDS: the look holds the fitted pattern and the solid ends the style's dash array doesn't.
|
||||
fn dashes_aligned_to_corners_read_as_aligned_dashes() {
|
||||
// The look holds the fitted pattern, which the style's dash array doesn't: the reader takes the
|
||||
// stroke only where VectorCraft's own fitting draws as that look.
|
||||
let data = b"/KnownStyle :\n(Stitches) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
|
||||
/BasicFilter :\n(Stroke Style Filter) 0 0 /Filter ,\n1 /Visible ,\n2 /FillOrStroke ,\n/Dictionary : /NotRecorded ,\n\
|
||||
/Dictionary : /NotRecorded ,\n1 /Bool (BSDashAdj) ,\n; (kAIBeautifulStrokesParamsDictKey) ,\n\
|
||||
/StrokeStyle : 0 R\n0 0 0 0 0 0 1 XA\n1 J 0 j 2 w 10 M [5 10 ]0 d\n0 XR\n1 0 Xd\n/Def ;\n (StrokeStyle) ,\n; /Dict ;\n /Part ,\n;\n";
|
||||
assert!(!art_styles(data)["Stitches"].plain);
|
||||
let style = &art_styles(data)["Stitches"];
|
||||
assert!(style.plain, "{style:?}");
|
||||
let [StyleItem::Stroke { dash: Some(dash), .. }] = style.items.as_slice() else { panic!("{:?}", style.items) };
|
||||
assert_eq!((dash.pattern.as_slice(), dash.align_corners), ([5.0, 10.0].as_slice(), true));
|
||||
}
|
||||
|
||||
/// The style `Shade`: a Drop Shadow whose dictionary holds `keys`.
|
||||
@@ -1023,7 +1027,8 @@ fn any_object_takes_the_distort_effects_that_draw_as_its_drawn_look() {
|
||||
assert!(simple("Adobe Free Distort", &corners(src, [[0.2, 0.0], [1.2, 0.0], [0.0, -1.0], [1.0, -1.0]])));
|
||||
assert!(!simple("Adobe Free Distort", &corners(src, [[0.2, 0.0], [1.2, 0.1], [0.0, -1.0], [1.0, -1.0]])));
|
||||
assert!(!simple("Adobe Punk and Bloat", "-35 /Real (d_factor) ,\n"));
|
||||
assert!(!simple("Adobe Zigzag", ""));
|
||||
// Zig Zag: objects other than type check it against their drawn look (`read::ops`).
|
||||
assert!(simple("Adobe Zigzag", ""));
|
||||
assert!(!simple("Adobe Transform", &format!("1 /Int (numCopies) ,\n{SWITCHES}")));
|
||||
// With another effect, only type takes it.
|
||||
let chain = [basic("Adobe Twirl", "45 /Real (angle) ,\n"), basic("Adobe Offset Path", "4 /Real (ofst) ,\n0 /Int (jntp) ,\n4 /Real (mlim) ,\n")];
|
||||
|
||||
@@ -1260,6 +1260,191 @@ fn a_style_pattern_fill_is_placed_as_a_direct_one() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An art style `Stacked` whose stack holds `filters` (basic filters, top first).
|
||||
fn stacked_style(filters: &[String]) -> String {
|
||||
format!(
|
||||
"%AI9_BeginArtStyles\n/KnownStyle :\n(Stacked) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
|
||||
/CompoundFilter :\n(Stack Style Filter) 0 0 /Filter ,\n1 /Visible ,\n{}\
|
||||
/BasicFilter :\n(Conduit Filter) 0 0 /Filter ,\n1 /Visible ,\n;\n /Part ,\n;\n /Part ,\n;\n%AI9_EndArtStyles\n",
|
||||
filters.concat()
|
||||
)
|
||||
}
|
||||
|
||||
/// A fill filter painting with `paint` (operators).
|
||||
fn fill_filter(paint: &str) -> String {
|
||||
format!(
|
||||
"/BasicFilter :\n(Fill Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n/FillStyle : 0 O\n{paint}\n0 1 Xd\n/Def ;\n (FillStyle) ,\n; /Dict ;\n /Part ,\n"
|
||||
)
|
||||
}
|
||||
|
||||
/// A black stroke filter `width` wide.
|
||||
fn stroke_filter(width: f64) -> String {
|
||||
format!(
|
||||
"/BasicFilter :\n(Stroke Style Filter) 0 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n\
|
||||
/StrokeStyle : 0 R\n0 0 0 1 0 0 0 XA\n0 J 0 j {width} w 10 M []0 d\n0 XR\n1 0 Xd\n/Def ;\n (StrokeStyle) ,\n; /Dict ;\n /Part ,\n"
|
||||
)
|
||||
}
|
||||
|
||||
/// The layers of a file whose object (`own`, on `%_` lines) has the style `Stacked` and the drawn
|
||||
/// look `look`.
|
||||
fn stacked_object(look: &str, own: &str) -> String {
|
||||
let own: String = own.lines().map(|l| format!("%_{l}\n")).collect();
|
||||
layer(&format!("0 Ae\nu\n{look}U\n{own}1 (Stacked) XW\n"))
|
||||
}
|
||||
|
||||
/// The pattern placement of `n`'s fill painting with a pattern.
|
||||
fn pattern_xf(n: &Node) -> [f64; 6] {
|
||||
n.appearance
|
||||
.items
|
||||
.iter()
|
||||
.find_map(|i| match i.paint() {
|
||||
Paint::Pattern { xf, .. } => Some(xf.as_coeffs()),
|
||||
_ => None,
|
||||
})
|
||||
.unwrap_or_else(|| panic!("no pattern fill: {:?}", n.appearance.items))
|
||||
}
|
||||
|
||||
/// A path or compound path whose art style fills it with a pattern (as a stack of fills and strokes
|
||||
/// can) comes in as itself with that fill, the pattern placed where the drawn look places it (not
|
||||
/// where the style's own operands would), among the style's other fills and strokes in their order.
|
||||
#[test]
|
||||
fn a_path_with_a_style_pattern_fill_comes_in_as_the_path_with_it() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let hole = rect_path(30.0, 40.0, 50.0, 60.0);
|
||||
// The style's operands and the look's differ: the look's placement is taken.
|
||||
let (style_ops, look_ops) = ("0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]", "25 30 1.5 .75 30 1 45 10 0 [.8 .1 -.2 1.1 4 -6]");
|
||||
let pattern = fill_filter(&format!("(Dots) {style_ops} p"));
|
||||
let look_xf = |shape: &str| {
|
||||
let direct = read_ok(&format!("{DOTS}{}", layer(&format!("(Dots) {look_ops} p\n{shape}f\n"))));
|
||||
pattern_xf(&art(&direct.doc)[0])
|
||||
};
|
||||
let close = |a: [f64; 6], b: [f64; 6]| a.iter().zip(b).all(|(x, y)| (x - y).abs() < 1e-9);
|
||||
// The style's operands alone would place it elsewhere.
|
||||
let style_xf = pattern_xf(&art(&read_ok(&format!("{DOTS}{}", layer(&format!("(Dots) {style_ops} p\n{rect}f\n")))).doc)[0]);
|
||||
assert!(!close(style_xf, look_xf(&rect)), "{style_xf:?}");
|
||||
// A path filled with the pattern alone.
|
||||
let look = format!("(Dots) {look_ops} p\n{rect}f\n");
|
||||
let r = read_ok(&format!("{}{DOTS}{}", stacked_style(std::slice::from_ref(&pattern)), stacked_object(&look, &format!("{rect}n"))));
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Path { .. })), "the path: {a:#?} {:?}", r.warnings);
|
||||
assert!(close(pattern_xf(&a[0]), look_xf(&rect)), "{:?} {:?}", pattern_xf(&a[0]), look_xf(&rect));
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
// A compound path, the pattern over a solid fill and under a 3 unit stroke.
|
||||
let style = stacked_style(&[stroke_filter(3.0), pattern.clone(), fill_filter("0 1 1 0 1 0 0 Xa")]);
|
||||
let look = format!("{RED}*u\n{rect}f\n{hole}f\n*U\n(Dots) {look_ops} p\n*u\n{rect}f\n{hole}f\n*U\n");
|
||||
let own = format!("*u\n{rect}n\n{hole}n\n*U");
|
||||
let r = read_ok(&format!("{style}{DOTS}{}", stacked_object(&look, &own)));
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Compound { .. })), "the compound path: {a:#?} {:?}", r.warnings);
|
||||
let items: Vec<String> = a[0]
|
||||
.appearance
|
||||
.items
|
||||
.iter()
|
||||
.map(|i| match (i, i.paint()) {
|
||||
(AppearanceItem::Fill(_), Paint::Pattern { .. }) => "pattern fill".into(),
|
||||
(AppearanceItem::Fill(_), p) => format!("fill {:?}", p.color()),
|
||||
(AppearanceItem::Stroke(s), _) => format!("stroke {}", s.width),
|
||||
})
|
||||
.collect();
|
||||
assert_eq!(items, [format!("fill {:?}", Some(Color::rgb(1.0, 0.0, 0.0))), "pattern fill".into(), "stroke 3".into()]);
|
||||
assert!(close(pattern_xf(&a[0]), look_xf(&format!("*u\n{rect}f\n{hole}f\n*U\n"))));
|
||||
}
|
||||
|
||||
/// A stack's pattern fill keeps the drawn look where the look doesn't fill with that pattern: its
|
||||
/// placement isn't known. A look that only strokes with it doesn't place the fill either.
|
||||
#[test]
|
||||
fn a_style_pattern_fill_the_look_doesnt_paint_keeps_the_drawn_look() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let ops = "0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]";
|
||||
let pattern = fill_filter(&format!("(Dots) {ops} p"));
|
||||
for (why, look) in
|
||||
[("a look without the pattern", format!("{RED}{rect}f\n")), ("a look that strokes with it", format!("(Dots) {ops} P\n{rect}S\n"))]
|
||||
{
|
||||
let r = read_ok(&format!("{}{DOTS}{}", stacked_style(std::slice::from_ref(&pattern)), stacked_object(&look, &format!("{rect}n"))));
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Group { .. })), "{why}: the drawn look: {a:#?}");
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{why}: {:?}", r.warnings);
|
||||
}
|
||||
}
|
||||
|
||||
/// A stack that fills with one pattern twice keeps the drawn look: which of the look's placements is
|
||||
/// whose isn't known.
|
||||
#[test]
|
||||
fn a_stack_with_one_pattern_twice_keeps_the_drawn_look() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let ops = "0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]";
|
||||
let pattern = fill_filter(&format!("(Dots) {ops} p"));
|
||||
let look = format!("(Dots) {ops} p\n{rect}f\n(Dots) {ops} p\n{rect}f\n");
|
||||
let r = read_ok(&format!("{}{DOTS}{}", stacked_style(&[pattern.clone(), pattern]), stacked_object(&look, &format!("{rect}n"))));
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Group { .. })), "the drawn look: {a:#?}");
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// A stack that fills with a pattern once, whose drawn look fills with it twice at different
|
||||
/// placements, keeps the drawn look: which placement is the style's isn't known. A look filling with
|
||||
/// it twice at the same placement still comes in as the path with that fill.
|
||||
#[test]
|
||||
fn a_look_placing_a_stacks_pattern_twice_keeps_the_drawn_look() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let ops = "0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]";
|
||||
let other = "25 30 1.5 .75 30 1 45 10 0 [.8 .1 -.2 1.1 4 -6]";
|
||||
let pattern = fill_filter(&format!("(Dots) {ops} p"));
|
||||
let read = |second: &str| {
|
||||
let look = format!("(Dots) {ops} p\n{rect}f\n(Dots) {second} p\n{rect}f\n");
|
||||
read_ok(&format!("{}{DOTS}{}", stacked_style(std::slice::from_ref(&pattern)), stacked_object(&look, &format!("{rect}n"))))
|
||||
};
|
||||
let r = read(other);
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Group { .. })), "the drawn look: {a:#?}");
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
let r = read(ops);
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Path { .. })), "the path: {a:#?} {:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// A style's pattern fill under an effect on the object keeps the drawn look, a conservative rule
|
||||
/// (in one file a Scribble over a pattern fill drew unlike its look; why isn't established).
|
||||
#[test]
|
||||
fn a_path_with_a_style_pattern_fill_under_an_effect_keeps_its_drawn_look() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let hidden = rect.replace('\n', "\n%_");
|
||||
let ops = "0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]";
|
||||
let shadow = "/BasicFilter :\n(Adobe Drop Shadow) 1 0 /Filter ,\n1 /Visible ,\n/Dictionary : /NotRecorded ,\n2 /Int (blnd) ,\n0.43 /Real (opac) ,\n\
|
||||
37 /Real (dark) ,\n-13 /Real (vert) ,\n11 /Real (horz) ,\n17 /Real (blur) ,\n\
|
||||
/FillStyle : 0 O\n0 0 0 0 0 1 0 Xa\n0 1 0 0 0 Xy\n0 J 0 j 1 w 10 M []0 d\n0 XR\n0 1 Xd\n/Def ;\n (sclr) ,\n0 /Int (csrc) ,\n; /Dict ;\n /Part ,\n";
|
||||
let style = tiled_style("Dots", ops);
|
||||
// After the stack, in the object's chain.
|
||||
let end = ";\n /Part ,\n;\n%AI9_EndArtStyles";
|
||||
assert!(style.contains(end));
|
||||
let style = style.replace(end, &format!(";\n /Part ,\n{shadow};\n%AI9_EndArtStyles"));
|
||||
// The style reads, with its pattern fill and the shadow: what keeps the look is the rule.
|
||||
let st = crate::import::ai::style::art_styles(style.as_bytes());
|
||||
let tiled = &st["Tiled"];
|
||||
assert!(tiled.plain && tiled.effects.len() == 1, "{tiled:?}");
|
||||
let look = format!("0 Ae\nu\n(Dots) {ops} p\n{rect}f\nU\n");
|
||||
let r = read_ok(&format!("{style}{DOTS}{}", layer(&format!("{look}%_{hidden}n\n1 (Tiled) XW\n"))));
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Group { .. })), "the drawn look: {a:#?}");
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// Type whose style fills it with a pattern takes the placement from its drawn look wherever the look
|
||||
/// paints with that pattern, a stroke of it too (as before paths took such styles): the look's
|
||||
/// fills-only rule is the path stack's.
|
||||
#[test]
|
||||
fn type_with_a_style_pattern_fill_takes_a_stroke_only_looks_placement() {
|
||||
let rect = rect_path(10.0, 20.0, 70.0, 80.0);
|
||||
let (style_ops, look_ops) = ("0 0 1 1 0 0 0 0 0 [1 0 0 1 0 0]", "25 30 1.5 .75 30 1 45 10 0 [.8 .1 -.2 1.1 4 -6]");
|
||||
let look = format!("0 Ae\nu\n/AI11Text :\n1 /FreeUndo ,\n0 /FrameIndex ,\n0 /StoryIndex ,\n;\n(Dots) {look_ops} P\n{rect}S\nU\n");
|
||||
let own = "%_/AI11Text :\n%_0 /FreeUndo ,\n%_0 /FrameIndex ,\n%_0 /StoryIndex ,\n%_;\n";
|
||||
let styled = read_ok(&format!("{}{DOTS}{}", tiled_style("Dots", style_ops), layer(&format!("{look}{own}1 (Tiled) XW\n"))));
|
||||
let stroked = read_ok(&format!("{DOTS}{}", layer(&format!("(Dots) {look_ops} P\n{rect}S\n"))));
|
||||
let Paint::Pattern { xf: got, .. } = fill(&art(&styled.doc)[0]) else { panic!("{:?} {:?}", art(&styled.doc), styled.warnings) };
|
||||
let want = pattern_xf(&art(&stroked.doc)[0]);
|
||||
assert!(got.as_coeffs().iter().zip(want).all(|(g, w)| (g - w).abs() < 1e-9), "{got:?} {want:?}");
|
||||
}
|
||||
|
||||
/// An art style's pattern fill paints with the pattern under the name it is shown with.
|
||||
#[test]
|
||||
fn a_style_pattern_fill_paints_with_the_shown_name() {
|
||||
@@ -2507,6 +2692,37 @@ fn ai_variable_library_edge_cases() {
|
||||
assert_eq!(notes, ["the file's variable library couldn't be read: the Variables panel doesn't list it"]);
|
||||
}
|
||||
|
||||
/// The empty library a file can keep, its nodes named and nothing else (no value, no type, empty
|
||||
/// attributes), has nothing to list: it comes in without a note. A node that has a value or a type
|
||||
/// isn't empty, so the same skeleton with a value, or with a type, still gets the note.
|
||||
#[test]
|
||||
fn an_empty_variable_library_gives_no_note() {
|
||||
// A node with a name and nothing else: its children, then its attributes, as `%_` lines.
|
||||
fn bare(name: &str, attributes: &[&str], children: &[String]) -> String {
|
||||
let close = |n: &str, key: &str| format!("{}%_; {key},\n", n.strip_suffix("%_;\n").unwrap_or(n));
|
||||
let attributes: String = attributes.iter().map(|a| close(&bare(a, &[], &[]), &format!("({a}) "))).collect();
|
||||
let children: String = children.iter().map(|c| close(c, "")).collect();
|
||||
format!(
|
||||
"%_/XMLNode :\n%_/Dictionary :\n{attributes}%_; (xmlnode-attributes) ,\n%_/Array :\n{children}%_; (xmlnode-children) ,\n%_({name}) /String (xmlnode-nodename) ,\n%_;\n"
|
||||
)
|
||||
}
|
||||
let data_sets = bare("v:sampleDataSets", &["xmlns:v", "xmlns"], &[]);
|
||||
let skeleton = bare("variableSets", &[], &[bare("variableSet", &["varSetName"], std::slice::from_ref(&data_sets))]);
|
||||
let (vars, notes) = read_library(&skeleton);
|
||||
assert_eq!(vars, vectorcraft_doc::Variables::default());
|
||||
assert!(notes.is_empty(), "{notes:?}");
|
||||
let unread = ["the file's variable library couldn't be read: the Variables panel doesn't list it"];
|
||||
// The same skeleton but for one entry of the data sets node: a value, then a type.
|
||||
let with = |entry: &str| {
|
||||
let data_sets = data_sets.replace("(xmlnode-nodename) ,\n", &format!("(xmlnode-nodename) ,\n{entry}"));
|
||||
bare("variableSets", &[], &[bare("variableSet", &["varSetName"], &[data_sets])])
|
||||
};
|
||||
for entry in ["%_(x) /String (xmlnode-nodevalue) ,\n", "%_1 /Int (xmlnode-nodetype) ,\n"] {
|
||||
let (_, notes) = read_library(&with(entry));
|
||||
assert_eq!(notes, unread, "{entry}");
|
||||
}
|
||||
}
|
||||
|
||||
/// When the layers can't be read, or reading stops before the library, [`variables`] still reads
|
||||
/// it, for the file read from its PDF part.
|
||||
#[test]
|
||||
@@ -3741,6 +3957,70 @@ fn placed_files_are_linked_images_showing_their_preview() {
|
||||
assert!(read(stream(&layer("~\n")).as_bytes()).unwrap_err().contains("`~`"));
|
||||
}
|
||||
|
||||
/// Type made a clipping mask: a clipping group (`q` … `Q`) with no clipping path, whose last object
|
||||
/// is a text object, is clipped by that type once its slot holds it, the type first as its
|
||||
/// clipping path. Anything else stays as it was read.
|
||||
#[test]
|
||||
fn type_that_ends_a_clipping_group_without_a_clipping_path_clips_it() {
|
||||
let text = |story: u32| format!("/AI11Text :\n0 /FreeUndo ,\n0 /FrameIndex ,\n{story} /StoryIndex ,\n;\n");
|
||||
let square = format!("{RED}{}f\n", rect_path(0.0, 0.0, 10.0, 10.0));
|
||||
let clipper = format!("{RED}{}h W n\n", rect_path(2.0, 2.0, 8.0, 8.0));
|
||||
let r = read_ok(&layer(&format!("q\n{square}{}Q\n", text(4))));
|
||||
let a = art(&r.doc);
|
||||
let [group] = a.as_slice() else { panic!("{a:#?}") };
|
||||
let slot = group.children().and_then(|c| c.last()).map(|n| n.id).unwrap();
|
||||
assert!(matches!(group.kind, NodeKind::Group { clip: false, .. }), "read as it is, until the slot holds its type");
|
||||
assert_eq!(r.type_clips.get(&group.id), Some(&slot));
|
||||
assert_eq!(r.warped_type.type_clips, r.type_clips, "envelopes' contents are clipped by their type too");
|
||||
// Filled with one text object, the slot's type clips the group.
|
||||
let typed = |doc: &Document, one: bool| {
|
||||
let mut layer = (*doc.layers[0]).clone();
|
||||
let mut n = 0;
|
||||
let put = |n: &mut Node| {
|
||||
if let NodeKind::Group { children, .. } = &mut n.kind
|
||||
&& let Some(last) = children.last_mut()
|
||||
&& last.id == slot
|
||||
{
|
||||
let t = Node::new(
|
||||
vectorcraft_doc::NodeId(9_000),
|
||||
NodeKind::Text(Box::new(vectorcraft_doc::TextObject::point(kurbo::Point::ZERO, "M", Default::default()))),
|
||||
);
|
||||
if one {
|
||||
*last = Arc::new(t);
|
||||
} else {
|
||||
let mut stroke = t.clone();
|
||||
stroke.id = vectorcraft_doc::NodeId(9_001);
|
||||
*last = Arc::new(t);
|
||||
children.push(Arc::new(stroke));
|
||||
}
|
||||
}
|
||||
};
|
||||
layer.children_mut().unwrap().iter_mut().for_each(|c| put(Arc::make_mut(c)));
|
||||
let clipped = clip_by_type(&mut layer, &r.type_clips, &|s| (s == slot).then_some(vectorcraft_doc::NodeId(9_000)), &mut |_| n += 1);
|
||||
(layer, clipped, n)
|
||||
};
|
||||
let (layer_one, clipped, called) = typed(&r.doc, true);
|
||||
assert_eq!((clipped, called), (1, 1));
|
||||
let g = &layer_one.children().unwrap()[0];
|
||||
let NodeKind::Group { children, clip: true } = &g.kind else { panic!("{g:#?}") };
|
||||
assert!(matches!(children[0].kind, NodeKind::Text(_)) && matches!(children[1].kind, NodeKind::Path { .. }), "{children:#?}");
|
||||
// Several objects in its place (the type and strokes round it): the group stays unclipped.
|
||||
let (layer_two, clipped, _) = typed(&r.doc, false);
|
||||
assert_eq!(clipped, 0);
|
||||
assert!(matches!(layer_two.children().unwrap()[0].kind, NodeKind::Group { clip: false, .. }));
|
||||
// A clipping path in the group clips it, not the type; type that isn't last doesn't; nor does a
|
||||
// group (`u` … `U`) or the type a look draws.
|
||||
for body in [
|
||||
format!("q\n{square}{clipper}{}Q\n", text(4)),
|
||||
format!("q\n{}{square}Q\n", text(4)),
|
||||
format!("u\n{square}{}U\n", text(4)),
|
||||
format!("q\n{square}/AI11Text :\n1 /FreeUndo ,\n0 /FrameIndex ,\n0 /StoryIndex ,\n;\nQ\n"),
|
||||
] {
|
||||
let r = read_ok(&layer(&body));
|
||||
assert!(r.type_clips.is_empty(), "{body}: {:?}", r.type_clips);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_objects_are_slots_named_after_their_story() {
|
||||
let words = "/AI11Text :\n0 /FreeUndo ,\n0 /FrameIndex ,\n3 /StoryIndex ,\n;\n%_/ArtDictionary :\n%_/XMLUID : (Title) ; (AI10_ArtUID) ,\n%_;\n";
|
||||
@@ -6272,21 +6552,13 @@ fn a_stroke_offset_filter_keeps_its_strokes_style() {
|
||||
}
|
||||
|
||||
/// A Stroke Offset stroke this doesn't read as a stroke keeps the object's drawn look: a switch
|
||||
/// written as another kind, dashes aligned to corners and path ends, a gradient.
|
||||
/// written as another kind, a gradient.
|
||||
#[test]
|
||||
fn a_stroke_offset_filter_with_a_stroke_this_does_not_read_keeps_the_drawn_look() {
|
||||
let outside = "0 /Bool (StrokeOffsetInside) ,\n";
|
||||
let gradient = "0 R\nBb\n0 0 0 0 Bh\n2 (Red ramp) 0 0 90 1 1 0 0 1 0 0 1 Bg\n0 BB\n0 J 0 j 2 w 10 M []0 d\n0 XR\n1 0 Xd";
|
||||
let cases = [
|
||||
("a switch written as a number", offset_stroke_style_with("Edge", "1 /Int (StrokeOffsetInside) ,\n", OFFSET_STROKE)),
|
||||
(
|
||||
"dashes aligned to corners",
|
||||
offset_stroke_style_with(
|
||||
"Edge",
|
||||
&format!("{outside}/Dictionary : /NotRecorded ,\n1 /Bool (BSDashAdj) ,\n; (kAIBeautifulStrokesParamsDictKey) ,\n"),
|
||||
&OFFSET_STROKE.replace("[]0 d", "[5 10 ]0 d"),
|
||||
),
|
||||
),
|
||||
("a gradient", offset_stroke_style_with("Edge", outside, gradient)),
|
||||
];
|
||||
for (why, style) in cases {
|
||||
@@ -6295,6 +6567,26 @@ fn a_stroke_offset_filter_with_a_stroke_this_does_not_read_keeps_the_drawn_look(
|
||||
}
|
||||
}
|
||||
|
||||
/// A Stroke Offset stroke with dashes aligned to corners and path ends reads as such a stroke,
|
||||
/// outside the path; the object takes it only where it draws as its drawn look. Here the look (a
|
||||
/// filled square) draws otherwise, so the look check keeps the drawn look.
|
||||
#[test]
|
||||
fn a_stroke_offset_with_dashes_aligned_to_corners_unlike_its_look_keeps_the_look() {
|
||||
use crate::import::ai::style::StyleItem;
|
||||
use vectorcraft_doc::StrokeAlign;
|
||||
let keys = "0 /Bool (StrokeOffsetInside) ,\n/Dictionary : /NotRecorded ,\n1 /Bool (BSDashAdj) ,\n; (kAIBeautifulStrokesParamsDictKey) ,\n";
|
||||
let style = offset_stroke_style_with("Edge", keys, &OFFSET_STROKE.replace("[]0 d", "[5 10 ]0 d"));
|
||||
let styles = crate::import::ai::style::art_styles(style.as_bytes());
|
||||
let Some(StyleItem::Stroke { dash: Some(dash), align, .. }) = styles["Edge"].items.iter().find(|i| matches!(i, StyleItem::Stroke { .. })) else {
|
||||
panic!("{:?}", styles["Edge"])
|
||||
};
|
||||
assert_eq!((dash.pattern.as_slice(), dash.align_corners, *align), ([5.0, 10.0].as_slice(), true, StrokeAlign::Outside));
|
||||
let r = read_ok(&format!("%AI9_BeginArtStyles\n{style}%AI9_EndArtStyles\n{}", layer(&styled_square("Edge"))));
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
let a = art(&r.doc);
|
||||
assert!(matches!(a.as_slice(), [n] if matches!(n.kind, NodeKind::Group { .. })), "the drawn look: {a:#?}");
|
||||
}
|
||||
|
||||
/// A listed `[Default]` style whose stroke is aligned outside comes in as the default graphic
|
||||
/// style with that stroke.
|
||||
#[test]
|
||||
@@ -7338,6 +7630,96 @@ fn an_object_with_a_distort_effect_drawn_another_way_keeps_its_drawn_look() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_path_with_zig_zag_comes_in_as_itself_where_its_look_has_that_outline() {
|
||||
// GUARDS: Zig Zag on a path came in as its drawn look even where the live effect draws the same outline.
|
||||
let keys = "3 /Real (amount) ,\n1 /Real (absoluteness) ,\n2 /Real (ridges) ,\n0 /Real (roundness) ,\n";
|
||||
let zig = vectorcraft_doc::Effect {
|
||||
id: "distort.zigZag".into(),
|
||||
params: serde_json::json!({"size": 3.0, "relative": false, "ridges": 2, "points": "corner"}),
|
||||
visible: true,
|
||||
};
|
||||
// The square as the document has it (y up in the file, down in the document).
|
||||
let plain = read_ok(&layer(&format!("{RED}{}f\n", rect_path(20.0, 20.0, 60.0, 50.0))));
|
||||
let square = art(&plain.doc)[0].path_data().unwrap().clone();
|
||||
let to_file = |p: Point| {
|
||||
let start = square.subpaths[0].anchors[0].p;
|
||||
Point::new(p.x - start.x + 20.0, start.y - p.y + 20.0)
|
||||
};
|
||||
let outline = vectorcraft_effects::apply_geometry(std::slice::from_ref(&zig), &square, square.bounds().unwrap());
|
||||
// The look: the outline the effect draws, as straight segments.
|
||||
let ops = |shift: f64| -> String {
|
||||
let mut out = String::new();
|
||||
for sp in &outline.subpaths {
|
||||
for (i, a) in sp.anchors.iter().enumerate() {
|
||||
let p = to_file(a.p);
|
||||
out.push_str(&format!("{:.4} {:.4} {}\n", p.x + shift, p.y, if i == 0 { "m" } else { "L" }));
|
||||
}
|
||||
}
|
||||
out
|
||||
};
|
||||
let hidden_rect = rect_path(20.0, 20.0, 60.0, 50.0).replace('\n', "\n%_");
|
||||
let object = |look: &str| format!("0 Ae\nu\n0 0 0 0 0 0 1 Xa\n{look}f\nU\n%_{hidden_rect}f\n1 (Bent) XW\n");
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", keys, BLUE_FILL), layer(&object(&ops(0.0)))));
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
let a = art(&r.doc);
|
||||
assert_eq!(a.len(), 1, "{a:#?}");
|
||||
assert!(matches!(a[0].kind, NodeKind::Path { .. }), "the object, not its look: {a:#?}");
|
||||
let e = &a[0].appearance.effects;
|
||||
assert_eq!(e.len(), 1, "{e:?}");
|
||||
assert_eq!(
|
||||
(e[0].id.as_str(), &e[0].params),
|
||||
("distort.zigZag", &serde_json::json!({"size": 3.0, "relative": false, "ridges": 2, "points": "corner"}))
|
||||
);
|
||||
// A look whose ridges lie elsewhere (here 1 pt to the right) keeps the drawn look.
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", keys, BLUE_FILL), layer(&object(&ops(1.0)))));
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
assert!(matches!(art(&r.doc)[0].kind, NodeKind::Group { .. }));
|
||||
// An open path (filled without closing it, `F`): its look's outline matches, and a look whose
|
||||
// last point lies 3 pt away from where the effect ends it keeps the drawn look.
|
||||
let open_path = "20 20 m\n60 20 L\n60 50 L\n";
|
||||
let plain = read_ok(&layer(&format!("{RED}{open_path}F\n")));
|
||||
let open = art(&plain.doc)[0].path_data().unwrap().clone();
|
||||
assert!(!open.subpaths[0].closed);
|
||||
let start = open.subpaths[0].anchors[0].p;
|
||||
let outline = vectorcraft_effects::apply_geometry(std::slice::from_ref(&zig), &open, open.bounds().unwrap());
|
||||
let ops = |last_shift: f64| -> String {
|
||||
let mut out = String::new();
|
||||
for sp in &outline.subpaths {
|
||||
for (i, a) in sp.anchors.iter().enumerate() {
|
||||
let shift = if i + 1 == sp.anchors.len() { last_shift } else { 0.0 };
|
||||
let p = Point::new(a.p.x - start.x + 20.0 + shift, start.y - a.p.y + 20.0);
|
||||
out.push_str(&format!("{:.4} {:.4} {}\n", p.x, p.y, if i == 0 { "m" } else { "L" }));
|
||||
}
|
||||
}
|
||||
out
|
||||
};
|
||||
let hidden_open = open_path.replace('\n', "\n%_");
|
||||
let object = |look: &str| format!("0 Ae\nu\n0 0 0 0 0 0 1 Xa\n{look}F\nU\n%_{hidden_open}F\n1 (Bent) XW\n");
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", keys, BLUE_FILL), layer(&object(&ops(0.0)))));
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", keys, BLUE_FILL), layer(&object(&ops(3.0)))));
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
// A Zig Zag of no size on an open path through the corners of its look's square, joined
|
||||
// across it: the vertices match, the segments between them don't, so the drawn look stays.
|
||||
let flat = "0 /Real (amount) ,\n1 /Real (absoluteness) ,\n0 /Real (ridges) ,\n0 /Real (roundness) ,\n";
|
||||
let bowtie = "%_20 20 m\n%_60 50 L\n%_60 20 L\n%_20 50 L\n%_F\n";
|
||||
let crossed = format!("0 Ae\nu\n0 0 0 0 0 0 1 Xa\n{}f\nU\n{bowtie}1 (Bent) XW\n", rect_path(20.0, 20.0, 60.0, 50.0));
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", flat, BLUE_FILL), layer(&crossed)));
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
// A look worked out by hand rather than by the effect: Zig Zag of 3 pt with one ridge per
|
||||
// segment and corner points, on a line from (20, 20) to (60, 20), puts the line's ends 3 pt up
|
||||
// the page and its middle 3 pt down. The same look mirrored keeps the drawn look.
|
||||
let one = "3 /Real (amount) ,\n1 /Real (absoluteness) ,\n1 /Real (ridges) ,\n0 /Real (roundness) ,\n";
|
||||
let line = "20 20 m\n60 20 L\n".replace('\n', "\n%_");
|
||||
let object = |look: &str| format!("0 Ae\nu\n0 0 0 0 0 0 1 Xa\n{look}F\nU\n%_{line}F\n1 (Bent) XW\n");
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", one, BLUE_FILL), layer(&object("20 23 m\n40 17 L\n60 23 L\n"))));
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
assert!(matches!(art(&r.doc)[0].kind, NodeKind::Path { .. }), "{:#?}", art(&r.doc));
|
||||
let r = read_ok(&format!("{}{}", distort_styles("Adobe Zigzag", one, BLUE_FILL), layer(&object("20 17 m\n40 23 L\n60 17 L\n"))));
|
||||
assert!(r.warnings.iter().any(|w| w.contains("drawn look")), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// The gradient `G`, white to black, defined for a document.
|
||||
const GRADIENT_G: &str = "%AI5_BeginGradient: (G)\n(G) 0 2 Bd\n[\n%_1 0 50 0 Bs\n%_0 0 50 100 Bs\nBD\n%AI5_EndGradient\n";
|
||||
|
||||
@@ -8746,7 +9128,7 @@ fn warped_type_on_the_page_spends_what_is_left_of_the_budget() {
|
||||
let copy = |w: &super::envelope::WarpedLook| super::envelope::WarpedLook { slot: w.slot, look: w.look.clone(), left_out: None };
|
||||
let page = Some(Rect::new(0.0, 60.0, 60.0, 100.0));
|
||||
let settle = |w: &super::envelope::WarpedLook, spent| {
|
||||
let warped = super::envelope::WarpedType { looks: vec![copy(w)], envelopes: vec![], checks: 1, spent, page, alone: None };
|
||||
let warped = super::envelope::WarpedType { looks: vec![copy(w)], checks: 1, spent, page, ..Default::default() };
|
||||
warped.settle(&mut doc.clone(), Some, &Default::default(), &mut vec![])
|
||||
};
|
||||
let spent = || super::envelope::Spent { any: MAX_DIFFERENCE / 2.0, solid: MAX_SOLID_DIFFERENCE / 2.0 };
|
||||
@@ -9519,6 +9901,22 @@ fn a_blend_comes_in_as_a_live_blend() {
|
||||
assert!(!s.warnings.iter().any(|w| w == super::blend::DRAWN), "{:?}", s.warnings);
|
||||
}
|
||||
|
||||
/// A blend in an opacity mask's art is written on `%_` lines, its record's hex digits on `%_%`
|
||||
/// lines: it comes in live there too.
|
||||
#[test]
|
||||
fn a_blend_in_an_opacity_mask_comes_in_live() {
|
||||
let body = blend_file("%_10 50 m\n%_110 50 L\n", [Some("A"), Some("B")], &blend_record(&['A', 'B']));
|
||||
let mask_art: String = body.lines().map(|l| if l.starts_with("%_") { format!("{l}\n") } else { format!("%_{l}\n") }).collect();
|
||||
assert!(mask_art.contains("\n%_%44434241"), "{mask_art}");
|
||||
let mask = format!("%_/ArtDictionary :\n%_/Mask :\n%_X=\n%_u\n{mask_art}%_U\n%_X+\n%_(Art) ,\n%_; (AI9_Mask) ,\n%_;\n");
|
||||
let s = read_ok(&layer(&format!("{RED}0 0 m\n0 80 L\n80 80 L\n80 0 L\nf\n{mask}")));
|
||||
let m = art(&s.doc)[0].extras().mask.clone().expect("a mask");
|
||||
let blend = m.art.children().and_then(|c| c.first()).cloned().unwrap_or(m.art.clone());
|
||||
let NodeKind::Blend { children, spec } = &blend.kind else { panic!("a live blend: {:?} {:?}", blend.kind, s.warnings) };
|
||||
assert_eq!((children.len(), spec.spacing), (2, vectorcraft_doc::live::BlendSpacing::Steps(3)));
|
||||
assert!(!s.warnings.iter().any(|w| w == super::blend::DRAWN), "{:?}", s.warnings);
|
||||
}
|
||||
|
||||
/// A blend whose spine was never edited has no spine written, only its keys: its spine is the
|
||||
/// straight line between the keys' centers, in the record's order, and the blend comes in live.
|
||||
/// With the record naming the keys in their order (here the left key, named `B`, first) the blend
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use super::paint::is_mesh;
|
||||
use super::paint::{is_mesh, polygon, shading_extent};
|
||||
use super::state::{GState, Space};
|
||||
use super::{
|
||||
Affine, Color, FillRule, Interp, Key, LineCap, LineJoin, MAX_DASH_ENTRIES, MAX_DASHES, MAX_GSAVE, MAX_PATH, Obj, Op, Paint, Point, PsError, Rc,
|
||||
@@ -519,29 +519,43 @@ impl Interp<'_> {
|
||||
}
|
||||
self.stroke_path(bp)?;
|
||||
}
|
||||
ShFill => {
|
||||
let d = self.pop_dict()?;
|
||||
if self.g.null {
|
||||
return Ok(());
|
||||
}
|
||||
if is_mesh(&d) {
|
||||
let m = self.xf();
|
||||
return self.mesh_fill(&d, m);
|
||||
}
|
||||
let m = self.xf();
|
||||
if let Some(g) = self.gradient(&d, m)? {
|
||||
let area = self.clip_bounds()?;
|
||||
let paint = Paint::Gradient(Box::new(g));
|
||||
let clips = self.g.clips.clone();
|
||||
self.out.fill(area.to_path(0.1), FillRule::NonZero, paint, self.g.overprint, &clips);
|
||||
if let Some((_, n)) = self.out.drawn.last() {
|
||||
let id = n.id;
|
||||
self.out.shadings.insert(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
ShFill => self.shfill()?,
|
||||
_ => self.data_op(op)?,
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// `shfill`: shading `sh` over the clip, as a gradient mesh or a gradient fill.
|
||||
fn shfill(&mut self) -> Res {
|
||||
let d = self.pop_dict()?;
|
||||
if self.g.null {
|
||||
return Ok(());
|
||||
}
|
||||
if is_mesh(&d) {
|
||||
let m = self.xf();
|
||||
return self.mesh_fill(&d, m);
|
||||
}
|
||||
let m = self.xf();
|
||||
if let Some(g) = self.gradient(&d, m)? {
|
||||
let area = self.clip_bounds()?;
|
||||
// Not extended, it paints only between its ends.
|
||||
let extent = shading_extent(&d, m, area);
|
||||
let path = match &extent {
|
||||
Some(pts) if pts.len() < 3 => return Ok(()),
|
||||
Some(pts) => polygon(pts),
|
||||
None => area.to_path(0.1),
|
||||
};
|
||||
let paint = Paint::Gradient(Box::new(g));
|
||||
let clips = self.g.clips.clone();
|
||||
self.out.fill(path, FillRule::NonZero, paint, self.g.overprint, &clips);
|
||||
// Only a fill of the whole clip can stand in for the clip's shape.
|
||||
if extent.is_none()
|
||||
&& let Some((_, n)) = self.out.drawn.last()
|
||||
{
|
||||
let id = n.id;
|
||||
self.out.shadings.insert(id);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -450,6 +450,135 @@ fn is_gradient(sh: &DictRef) -> bool {
|
||||
matches!(sh.borrow().get(&Key::name("ShadingType")).and_then(Obj::as_num), Some(2.0 | 3.0))
|
||||
}
|
||||
|
||||
/// How far (points) the sides of the polygon a radial shading's circle is cut to may lie inside it.
|
||||
const RING_TOLERANCE: f64 = 0.01;
|
||||
/// Most sides of that polygon.
|
||||
const MAX_RING: usize = 1024;
|
||||
|
||||
/// The part of `area` (in the document) that axial or radial shading `sh`, mapped into the
|
||||
/// document by `m`, paints, as a convex polygon; `None` when it paints all of it. Without
|
||||
/// `Extend` an axial shading paints only between the lines through its ends across its axis, and
|
||||
/// a radial one only over its circles (PLRM 3rd ed. §4.9.3, shading types 2 and 3: `Extend`
|
||||
/// defaults to `[false false]`). A radial shading extended at one end only, or starting from a
|
||||
/// circle with a radius, is not bounded here (it paints all of `area`).
|
||||
pub(super) fn shading_extent(sh: &DictRef, m: Affine, area: Rect) -> Option<Vec<Point>> {
|
||||
let d = sh.borrow();
|
||||
let nums = |k: &str| -> Vec<f64> {
|
||||
d.get(&Key::name(k)).and_then(Obj::items).map(|i| i.borrow().iter().filter_map(Obj::as_num).collect()).unwrap_or_default()
|
||||
};
|
||||
let extend: Vec<bool> = d
|
||||
.get(&Key::name("Extend"))
|
||||
.and_then(Obj::items)
|
||||
.map(|i| i.borrow().iter().map(|o| matches!(o, Obj::Bool(true))).collect())
|
||||
.unwrap_or_default();
|
||||
let (e0, e1) = (extend.first().copied().unwrap_or(false), extend.get(1).copied().unwrap_or(false));
|
||||
if (e0 && e1) || area.width() <= 0.0 || area.height() <= 0.0 || m.determinant().abs() < 1e-12 || !m.as_coeffs().iter().all(|v| v.is_finite()) {
|
||||
return None;
|
||||
}
|
||||
let inv = m.inverse();
|
||||
// `area` in the shading's own space, where its axis and circles are.
|
||||
let corners: Vec<Point> =
|
||||
[(area.x0, area.y0), (area.x1, area.y0), (area.x1, area.y1), (area.x0, area.y1)].map(|(x, y)| inv * Point::new(x, y)).to_vec();
|
||||
let mut poly = corners.clone();
|
||||
let c = nums("Coords");
|
||||
let at = |i: usize| c.get(i).copied().filter(|v| v.is_finite()).unwrap_or(0.0);
|
||||
match d.get(&Key::name("ShadingType")).and_then(Obj::as_num) {
|
||||
Some(2.0) => {
|
||||
let (p0, p1) = (Point::new(at(0), at(1)), Point::new(at(2), at(3)));
|
||||
let axis = p1 - p0;
|
||||
if axis.hypot2() < 1e-18 {
|
||||
return None;
|
||||
}
|
||||
if !e0 {
|
||||
poly = clip_half(&poly, |p| (p - p0).dot(axis));
|
||||
}
|
||||
if !e1 {
|
||||
poly = clip_half(&poly, |p| (p1 - p).dot(axis));
|
||||
}
|
||||
}
|
||||
Some(3.0) if !e0 && !e1 && at(2) <= 0.0 && at(5) > 0.0 => {
|
||||
// The circles from a point to a circle cover the hull of that point and circle.
|
||||
let (p0, c1, r1) = (Point::new(at(0), at(1)), Point::new(at(3), at(4)), at(5));
|
||||
// Enough sides that each lies within `RING_TOLERANCE` of the circle in the document
|
||||
// (the radius scaled by the most `m` stretches any direction), from 64 to `MAX_RING`.
|
||||
let [a, b, c, d, ..] = m.as_coeffs();
|
||||
let (sum, det) = (a * a + b * b + c * c + d * d, a * d - b * c);
|
||||
let stretch = ((sum + (sum * sum - 4.0 * det * det).max(0.0).sqrt()) / 2.0).sqrt();
|
||||
let r = r1 * stretch;
|
||||
let sides = (std::f64::consts::PI / (1.0 - RING_TOLERANCE / r).clamp(-1.0, 1.0).acos()).ceil();
|
||||
let sides = if sides.is_finite() { (sides as usize).clamp(64, MAX_RING) } else { MAX_RING };
|
||||
let ring: Vec<Point> = (0..sides).map(|i| c1 + Vec2::from_angle(i as f64 * std::f64::consts::TAU / sides as f64) * r1).collect();
|
||||
for edge in hull(&[ring, vec![p0]].concat()).windows(2) {
|
||||
if let [a, b] = edge {
|
||||
let (a, b) = (*a, *b);
|
||||
poly = clip_half(&poly, |p| (b - a).cross(p - a));
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => return None,
|
||||
}
|
||||
// Nothing cut: it paints the whole area.
|
||||
if poly.len() == 4 && poly.iter().zip(&corners).all(|(a, b)| (*a - *b).hypot2() < 1e-18) {
|
||||
return None;
|
||||
}
|
||||
Some(poly.into_iter().map(|p| m * p).collect())
|
||||
}
|
||||
|
||||
/// Convex polygon `poly` cut to where `f` (a linear function) is zero or more.
|
||||
fn clip_half(poly: &[Point], f: impl Fn(Point) -> f64) -> Vec<Point> {
|
||||
let mut out = Vec::with_capacity(poly.len() + 1);
|
||||
for (i, &a) in poly.iter().enumerate() {
|
||||
let Some(&b) = poly.get((i + 1) % poly.len()) else { continue };
|
||||
let (fa, fb) = (f(a), f(b));
|
||||
if fa >= 0.0 {
|
||||
out.push(a);
|
||||
}
|
||||
if (fa >= 0.0) != (fb >= 0.0) {
|
||||
out.push(a.lerp(b, fa / (fa - fb)));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
/// The convex hull of `pts`, counter-clockwise, its first point repeated at the end.
|
||||
fn hull(pts: &[Point]) -> Vec<Point> {
|
||||
let mut p = pts.to_vec();
|
||||
p.sort_by(|a, b| a.x.total_cmp(&b.x).then(a.y.total_cmp(&b.y)));
|
||||
let mut h: Vec<Point> = Vec::with_capacity(p.len() * 2);
|
||||
let turn = |h: &[Point], q: Point| match h {
|
||||
[.., a, b] => (*b - *a).cross(q - *a) <= 0.0,
|
||||
_ => false,
|
||||
};
|
||||
for &q in &p {
|
||||
while turn(&h, q) {
|
||||
h.pop();
|
||||
}
|
||||
h.push(q);
|
||||
}
|
||||
let lower = h.len() + 1;
|
||||
for &q in p.iter().rev().skip(1) {
|
||||
while h.len() >= lower && turn(&h, q) {
|
||||
h.pop();
|
||||
}
|
||||
h.push(q);
|
||||
}
|
||||
h
|
||||
}
|
||||
|
||||
/// A closed path through `pts`.
|
||||
pub(super) fn polygon(pts: &[Point]) -> kurbo::BezPath {
|
||||
let mut bp = kurbo::BezPath::new();
|
||||
for (i, p) in pts.iter().enumerate() {
|
||||
if i == 0 {
|
||||
bp.move_to(*p);
|
||||
} else {
|
||||
bp.line_to(*p);
|
||||
}
|
||||
}
|
||||
bp.close_path();
|
||||
bp
|
||||
}
|
||||
|
||||
/// Is shading `sh` one [`Interp::mesh_fill`] paints?
|
||||
pub(super) fn is_mesh(sh: &DictRef) -> bool {
|
||||
matches!(sh.borrow().get(&Key::name("ShadingType")).and_then(Obj::as_num), Some(1.0 | 4.0 | 5.0 | 6.0 | 7.0))
|
||||
|
||||
@@ -329,6 +329,7 @@ pub(super) fn build_weighing(
|
||||
unread,
|
||||
unread_elsewhere,
|
||||
slot_names,
|
||||
type_clips,
|
||||
restyled,
|
||||
placeholders,
|
||||
placed_elsewhere,
|
||||
@@ -527,6 +528,7 @@ pub(super) fn build_weighing(
|
||||
let mut made = vec![];
|
||||
let mut filled = std::collections::HashMap::new();
|
||||
fill_slots(&mut doc, &mut layers, &mut content.into_iter(), &slot_names, &mut empty, &mut made, &mut vec![], &mut filled);
|
||||
clip_by_type(&mut layers, &type_clips, &filled);
|
||||
doc.layers = layers;
|
||||
made.sort();
|
||||
let threaded_frames: BTreeSet<NodeId> =
|
||||
@@ -2155,6 +2157,30 @@ fn unmark(nodes: &mut [Arc<Node>], shown: bool, prints: bool, found: &mut Vec<(N
|
||||
}
|
||||
}
|
||||
|
||||
/// Make the clipping groups in `layers` that their type clips ([`Structure::type_clips`]) clip by it,
|
||||
/// where its slot became one text object (`filled`). The page shows that type by what it clips, so
|
||||
/// it is never weighed as type the page doesn't draw ([`prune_unseen`]).
|
||||
fn clip_by_type(
|
||||
layers: &mut [Arc<Node>],
|
||||
type_clips: &std::collections::HashMap<NodeId, NodeId>,
|
||||
filled: &std::collections::HashMap<NodeId, Filled>,
|
||||
) {
|
||||
let one = |slot: NodeId| {
|
||||
filled.get(&slot).and_then(|f| match f.objects.as_slice() {
|
||||
[id] => Some(*id),
|
||||
_ => None,
|
||||
})
|
||||
};
|
||||
let mut seen = |n: &mut Node| {
|
||||
if let Some(name) = n.name.as_deref().and_then(|m| m.strip_prefix(MADE)) {
|
||||
n.name = (!name.is_empty()).then(|| name.to_string());
|
||||
}
|
||||
};
|
||||
for l in layers {
|
||||
ai::clip_by_type(Arc::make_mut(l), type_clips, &one, &mut seen);
|
||||
}
|
||||
}
|
||||
|
||||
/// Take object `id` out of `nodes` (`hide`: leave it, hidden); whether it was there.
|
||||
fn take_out(nodes: &mut Vec<Arc<Node>>, id: NodeId, hide: bool) -> bool {
|
||||
if let Some(i) = nodes.iter().position(|n| n.id == id) {
|
||||
|
||||
@@ -1180,6 +1180,96 @@ fn filter_output_counts_against_the_memory_budget() {
|
||||
assert!(err.contains("too much memory"), "{err}");
|
||||
}
|
||||
|
||||
/// A shading painted with `shfill` and not extended paints only between its ends: an axial one
|
||||
/// between the lines through them across its axis, a radial one from a point over its circles
|
||||
/// (PLRM 3rd ed. §4.9.3: `Extend` is `[false false]` by default). Extended both ways it paints
|
||||
/// the whole clip.
|
||||
#[test]
|
||||
fn shadings_not_extended_paint_only_between_their_ends() {
|
||||
let shade = |kind: u8, coords: &str, extend: &str| {
|
||||
let r = read(&format!(
|
||||
"<< /ShadingType {kind} /ColorSpace /DeviceRGB /Coords [{coords}] {extend} \
|
||||
/Function << /FunctionType 2 /Domain [0 1] /C0 [1 0 0] /C1 [0 0 1] /N 1 >> >> shfill"
|
||||
));
|
||||
let n = all(&r.document).into_iter().find(|n| matches!(fill(n), Some(Paint::Gradient(_)))).expect("a gradient fill");
|
||||
bounds(&n)
|
||||
};
|
||||
// Axial, from x 10 to 90 (and its reflection in y: the document's y runs down).
|
||||
let b = shade(2, "10 0 90 0", "");
|
||||
assert!(near(b, Rect::new(10.0, 0.0, 90.0, 100.0)), "{b:?}");
|
||||
let b = shade(2, "10 0 90 0", "/Extend [false true]");
|
||||
assert!(near(b, Rect::new(10.0, 0.0, 100.0, 100.0)), "{b:?}");
|
||||
let b = shade(2, "10 0 90 0", "/Extend [true true]");
|
||||
assert!(near(b, Rect::new(0.0, 0.0, 100.0, 100.0)), "{b:?}");
|
||||
// Radial from the centre point to a circle of radius 30.
|
||||
let b = shade(3, "50 50 0 50 50 30", "");
|
||||
assert!((b.width() - 60.0).abs() < 0.5 && (b.height() - 60.0).abs() < 0.5 && (b.center().x - 50.0).abs() < 0.5, "{b:?}");
|
||||
// Its circle is cut to a polygon whose sides lie within 0.01 pt of it, also for a large one.
|
||||
let r = read(
|
||||
"<< /ShadingType 3 /ColorSpace /DeviceRGB /Coords [50 50 0 50 50 45] \
|
||||
/Function << /FunctionType 2 /Domain [0 1] /C0 [1 0 0] /C1 [0 0 1] /N 1 >> >> shfill",
|
||||
);
|
||||
let n = all(&r.document).into_iter().find(|n| matches!(fill(n), Some(Paint::Gradient(_)))).expect("a gradient fill");
|
||||
let NodeKind::Path { path, .. } = &n.kind else { panic!("{n:?}") };
|
||||
let ring: Vec<Point> = path.subpaths.iter().flat_map(|s| s.anchors.iter().map(|a| a.p)).collect();
|
||||
let centre = Point::new(50.0, 50.0);
|
||||
for (a, b) in ring.iter().zip(ring.iter().cycle().skip(1)) {
|
||||
assert!((a.distance(centre) - 45.0).abs() < 1e-6, "{a:?}");
|
||||
assert!(a.midpoint(*b).distance(centre) > 45.0 - 0.01, "{a:?} {b:?}");
|
||||
}
|
||||
// Stretched 4 times across and squashed to a quarter down (areas unchanged), the sides still
|
||||
// lie within 0.01 pt of the ellipse it becomes.
|
||||
let r = read(
|
||||
"50 50 translate 4 0.25 scale << /ShadingType 3 /ColorSpace /DeviceRGB /Coords [0 0 0 0 0 10] \
|
||||
/Function << /FunctionType 2 /Domain [0 1] /C0 [1 0 0] /C1 [0 0 1] /N 1 >> >> shfill",
|
||||
);
|
||||
let n = all(&r.document).into_iter().find(|n| matches!(fill(n), Some(Paint::Gradient(_)))).expect("a gradient fill");
|
||||
let NodeKind::Path { path, .. } = &n.kind else { panic!("{n:?}") };
|
||||
let sides = path.subpaths.iter().map(|s| s.anchors.len()).sum::<usize>();
|
||||
// A side of a regular polygon in the circle lies 1 - cos(pi / sides) of the radius inside it;
|
||||
// stretched to 40 pt across, that is at most 0.01 pt.
|
||||
assert!(40.0 * (1.0 - (std::f64::consts::PI / sides as f64).cos()) <= 0.01 + 1e-9, "{sides} sides");
|
||||
let b = shade(3, "50 50 0 50 50 30", "/Extend [true true]");
|
||||
assert!(near(b, Rect::new(0.0, 0.0, 100.0, 100.0)), "{b:?}");
|
||||
|
||||
// Axial along y, and extended at its start only.
|
||||
let b = shade(2, "0 20 0 70", "");
|
||||
assert!(near(b, Rect::new(0.0, 30.0, 100.0, 80.0)), "{b:?}");
|
||||
let b = shade(2, "10 0 90 0", "/Extend [true false]");
|
||||
assert!(near(b, Rect::new(0.0, 0.0, 90.0, 100.0)), "{b:?}");
|
||||
// Diagonal: from (60, 60) to (90, 90) it paints where x + y lies from 120 to 180, a strip
|
||||
// across the square's top-right corner whose own corners are cut off.
|
||||
let r = read(
|
||||
"<< /ShadingType 2 /ColorSpace /DeviceRGB /Coords [60 60 90 90] \
|
||||
/Function << /FunctionType 2 /Domain [0 1] /C0 [1 0 0] /C1 [0 0 1] /N 1 >> >> shfill",
|
||||
);
|
||||
let n = all(&r.document).into_iter().find(|n| matches!(fill(n), Some(Paint::Gradient(_)))).expect("a gradient fill");
|
||||
assert!(near(bounds(&n), Rect::new(20.0, 0.0, 100.0, 80.0)), "{:?}", bounds(&n));
|
||||
let NodeKind::Path { path, .. } = &n.kind else { panic!("{n:?}") };
|
||||
for a in path.subpaths.iter().flat_map(|s| s.anchors.iter()) {
|
||||
// Back in PostScript's y-up space.
|
||||
let s = a.p.x + (100.0 - a.p.y);
|
||||
assert!((120.0 - 1e-6..=180.0 + 1e-6).contains(&s), "{a:?}");
|
||||
}
|
||||
// The current transformation turns the axis: rotated a quarter turn about the centre, an axis
|
||||
// from -40 to 40 along x runs up the page from y 10 to 90.
|
||||
let r = read(
|
||||
"50 50 translate 90 rotate << /ShadingType 2 /ColorSpace /DeviceRGB /Coords [-40 0 40 0] \
|
||||
/Function << /FunctionType 2 /Domain [0 1] /C0 [1 0 0] /C1 [0 0 1] /N 1 >> >> shfill",
|
||||
);
|
||||
let n = all(&r.document).into_iter().find(|n| matches!(fill(n), Some(Paint::Gradient(_)))).expect("a gradient fill");
|
||||
assert!(near(bounds(&n), Rect::new(0.0, 10.0, 100.0, 90.0)), "{:?}", bounds(&n));
|
||||
// Radial from a point off the circle's centre covers the hull of that point and the circle.
|
||||
let b = shade(3, "20 50 0 60 50 30", "");
|
||||
assert!((b.x0 - 20.0).abs() < 0.5 && (b.x1 - 90.0).abs() < 0.5 && (b.y0 - 20.0).abs() < 0.5 && (b.y1 - 80.0).abs() < 0.5, "{b:?}");
|
||||
// Radial shadings this doesn't bound (extended at one end, or starting from a circle) still
|
||||
// paint the whole area.
|
||||
for (coords, extend) in [("50 50 0 50 50 30", "/Extend [true false]"), ("50 50 0 50 50 30", "/Extend [false true]"), ("50 50 10 50 50 30", "")] {
|
||||
let b = shade(3, coords, extend);
|
||||
assert!(near(b, Rect::new(0.0, 0.0, 100.0, 100.0)), "{coords} {extend}: {b:?}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A sampled function of one input in an axial shading: interpolated linearly, its gradient has a
|
||||
/// stop at every sample (exact, not sampled evenly); with `Order 3` it is a cubic through the
|
||||
/// samples (PLRM 3rd ed. §3.10.1, Table 3.36), kept in its range.
|
||||
|
||||
@@ -5887,12 +5887,18 @@ fn type_envelope_on(keys: &str, shape: &str, drawn: &str, after: &str) -> String
|
||||
|
||||
/// [`type_envelope_on`] around the type of story `story`.
|
||||
fn type_envelope_on_story(story: u32, keys: &str, shape: &str, drawn: &str, after: &str) -> String {
|
||||
type_envelope_holding(keys, shape, &format!("{}{after}", text_object(story)), drawn)
|
||||
}
|
||||
|
||||
/// [`type_envelope_on`] whose contents are `contents` (on plain lines, written on `%_` ones), which
|
||||
/// hold its text objects.
|
||||
fn type_envelope_holding(keys: &str, shape: &str, contents: &str, drawn: &str) -> String {
|
||||
let hidden = |s: &str| -> String { s.lines().map(|l| format!("%_{l}\n")).collect() };
|
||||
format!(
|
||||
"{}{}%_X=\n{}%_X+\n%_ (AIDeformArtKey) ,\n%_1 /Int (AIDeformStyle) ,\n%_;\n%_\n%_9 () XW\nu\n{drawn}U\n9 () XW\n(Adobe Deform Plugin) 1 0 0 XP\n",
|
||||
hidden(&format!("u\n{shape}U\n")),
|
||||
hidden(&format!("/ArtDictionary :\n{keys}")),
|
||||
hidden(&format!("u\n{}{after}U\n9 () XW\n", text_object(story))),
|
||||
hidden(&format!("u\n{contents}U\n9 () XW\n")),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -5998,6 +6004,32 @@ fn an_envelope_of_type_that_draws_as_its_drawn_art_opens_live() {
|
||||
assert!(super::tests::program_warnings(&r.warnings).is_empty(), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// An envelope of type with no fill and no stroke, its drawn art the bent outlines unpainted, opens
|
||||
/// live: neither draws a pixel, so they draw alike, and the type stays editable.
|
||||
#[test]
|
||||
fn an_envelope_of_unpainted_type_whose_drawn_art_paints_nothing_opens_live() {
|
||||
let Some(family) = installed_family() else { return };
|
||||
// The outlines come from the type filled; the file's type has its fill turned off (`/56 false`).
|
||||
let filled = type_envelope_text(&family, None);
|
||||
let mut doc = text_document(&[("FLUX\r", 0, (8170.0, 8180.0), (0.0, 0.0), 0.0)])
|
||||
.replace("(Helvetica)", &format!("({family})"))
|
||||
.replace("/53 <<", "/56 false /53 <<");
|
||||
while ascii85(doc.as_bytes()).len() % 60 == 1 {
|
||||
doc.push('\n');
|
||||
}
|
||||
assert_eq!(text_fill(&made_envelope_type(&doc)), None);
|
||||
let (drawn, _) = drawn_envelope(&arc_envelope(&made_envelope_type(&filled), 30.0));
|
||||
assert!(drawn.contains("f\n"), "{drawn}");
|
||||
let unpainted = drawn.replace("f\n", "n\n");
|
||||
let art = native_with_text(&layer("Art", true, &format!("{}\n{}", square(10, 10), type_envelope(&arc_keys(0.3), &unpainted))), &doc);
|
||||
let r = import(&eps(&page_square(10, 10), &art)).unwrap();
|
||||
assert_eq!(names(&r.document), ["Art"], "{:?}", r.warnings);
|
||||
let (envelopes, loose) = envelopes_and_type(&r.document);
|
||||
assert_eq!(envelopes, [vec!["FLUX".to_string()]], "{:?}", r.warnings);
|
||||
assert!(loose.is_empty(), "{loose:?}");
|
||||
assert!(super::tests::program_warnings(&r.warnings).is_empty(), "{:?}", r.warnings);
|
||||
}
|
||||
|
||||
/// An envelope of type whose live envelope draws apart from its drawn art (the file's art bends the
|
||||
/// other way) keeps its drawn art and its type, hidden, with a note.
|
||||
#[test]
|
||||
@@ -6556,6 +6588,86 @@ fn a_warp_of_type_opens_as_a_mesh_on_its_saved_grid_and_keeps_its_shape_when_its
|
||||
}
|
||||
}
|
||||
|
||||
/// In the layers, type from the text document made a clipping mask (a clipping group with no
|
||||
/// clipping path, the type last) clips the group's art as the page draws it: the type comes in as
|
||||
/// the group's clipping path, editable, and the art doesn't paint past it.
|
||||
#[test]
|
||||
fn type_made_a_clipping_mask_clips_its_group_in_the_layers() {
|
||||
use vectorcraft_doc::live::{EnvelopeKind, EnvelopeOptions, envelope_content_bounds};
|
||||
let Some(family) = installed_family() else { return };
|
||||
let doc = type_envelope_text(&family, None);
|
||||
// The page: the type's glyphs in the yellow of the square they clip, which covers the page, and
|
||||
// drawn through a flat mesh over their box, which leaves them where they are.
|
||||
let mut yellow = made_envelope_type(&type_envelope_text(&family, Some("/0 << /0 2 /1 [ 1.0 0.0 0.0 1.0 0.0 ] >>")));
|
||||
yellow.visible = true;
|
||||
let content = vec![std::sync::Arc::new(yellow)];
|
||||
let g = envelope_content_bounds(&content).unwrap();
|
||||
let points = vec![kurbo::Point::new(g.x0, g.y0), kurbo::Point::new(g.x1, g.y0), kurbo::Point::new(g.x0, g.y1), kurbo::Point::new(g.x1, g.y1)];
|
||||
let kind = Box::new(EnvelopeKind::Mesh { rows: 1, cols: 1, points, handles: vec![[kurbo::Vec2::ZERO; 4]; 4] });
|
||||
let options = EnvelopeOptions::NEW;
|
||||
let flat = Node::new(
|
||||
vectorcraft_doc::NodeId(1_000_000),
|
||||
NodeKind::Envelope { content, kind, fidelity: 50.0, editing: false, options, frame: Box::default() },
|
||||
);
|
||||
let (_, page) = drawn_envelope(&flat);
|
||||
let clipped = format!("q\n0 0 1 0 k\n0 0 m\n100 0 L\n100 100 L\n0 100 L\nf\n{}Q\n", text_object(0));
|
||||
let art = native_with_text(&layer("Art", true, &clipped), &doc);
|
||||
let r = import(&eps(&page, &art)).unwrap();
|
||||
// The layers are used, none of their art replaced with the page's (the note on how the type
|
||||
// differs from the page is about the edges of its glyphs).
|
||||
assert_eq!(names(&r.document), ["Art"], "{:?}", r.warnings);
|
||||
assert!(!r.warnings.iter().any(|w| w.contains("came in as its art") || w.contains("weren't read")), "{:?}", r.warnings);
|
||||
let children = r.document.layers[0].children().unwrap();
|
||||
let [group] = children.as_slice() else { panic!("{children:#?}") };
|
||||
let NodeKind::Group { children, clip: true } = &group.kind else { panic!("not clipped: {group:#?}") };
|
||||
let (NodeKind::Text(t), NodeKind::Path { .. }) = (&children[0].kind, &children[1].kind) else { panic!("{children:#?}") };
|
||||
assert_eq!(t.plain_text(), "FLUX");
|
||||
}
|
||||
|
||||
/// Type made a clipping mask in an envelope's contents (a clipping group with no clipping path, the
|
||||
/// type last) clips the art under it there, as the drawn art shows: the envelope opens live, its
|
||||
/// type editable as the group's clipping path. The art it clips covers the type's glyphs and stays
|
||||
/// inside their box, so the envelope maps from that box however the art past the type would count.
|
||||
#[test]
|
||||
fn an_envelope_whose_type_clips_its_contents_opens_live_with_the_type_clipping_them() {
|
||||
let Some(family) = installed_family() else { return };
|
||||
let doc = type_envelope_text(&family, None);
|
||||
// What it draws: the type in the yellow of the square it clips, which covers it.
|
||||
let yellow = made_envelope_type(&type_envelope_text(&family, Some("/0 << /0 2 /1 [ 1.0 0.0 0.0 1.0 0.0 ] >>")));
|
||||
let shaped = |text: Node| {
|
||||
let mut text = text;
|
||||
text.visible = true;
|
||||
let options = vectorcraft_doc::live::EnvelopeOptions::NEW;
|
||||
let content = vec![std::sync::Arc::new(text)];
|
||||
Node::new(
|
||||
vectorcraft_doc::NodeId(1_000_000),
|
||||
NodeKind::Envelope { content, kind: Box::new(rising_kind()), fidelity: 50.0, editing: false, options, frame: Box::default() },
|
||||
)
|
||||
};
|
||||
let glyphs = vectorcraft_doc::live::envelope_content_bounds(&[std::sync::Arc::new(yellow.clone())]).unwrap();
|
||||
let (drawn, page) = drawn_envelope(&shaped(yellow));
|
||||
// A yellow square over the glyphs' box, just inside it.
|
||||
let (x0, y0) = to_art(kurbo::Point::new(glyphs.x0 + 0.01, glyphs.y1 - 0.01));
|
||||
let (x1, y1) = to_art(kurbo::Point::new(glyphs.x1 - 0.01, glyphs.y0 + 0.01));
|
||||
let contents = format!("q\n0 0 1 0 k\n{x0} {y0} m\n{x1} {y0} L\n{x1} {y1} L\n{x0} {y1} L\nf\n{}Q\n", text_object(0));
|
||||
let envelope = type_envelope_holding(&arc_keys(0.3), &rising_grid(), &contents, &drawn);
|
||||
let art = native_with_text(&layer("Art", true, &format!("{}\n{envelope}", square(10, 10))), &doc);
|
||||
let r = import(&eps(&format!("{}\n{page}", page_square(10, 10)), &art)).unwrap();
|
||||
assert_eq!(names(&r.document), ["Art"], "{:?}", r.warnings);
|
||||
assert!(super::tests::program_warnings(&r.warnings).is_empty(), "{:?}", r.warnings);
|
||||
let mut live = vec![];
|
||||
r.document.walk(|n| {
|
||||
if let NodeKind::Envelope { content, .. } = &n.kind {
|
||||
live.push(content.clone());
|
||||
}
|
||||
});
|
||||
let [content] = live.as_slice() else { panic!("{:?}", r.warnings) };
|
||||
let [group] = content.as_slice() else { panic!("{content:#?}") };
|
||||
let NodeKind::Group { children, clip: true } = &group.kind else { panic!("not clipped: {group:#?}") };
|
||||
let (NodeKind::Text(t), NodeKind::Path { .. }) = (&children[0].kind, &children[1].kind) else { panic!("{children:#?}") };
|
||||
assert_eq!(t.plain_text(), "FLUX");
|
||||
}
|
||||
|
||||
/// A warp of stroked type with Distort Appearance whose drawn art maps the type's bounds with its
|
||||
/// strokes onto the grid the file saves (not its glyphs' bounds alone) opens live as a mesh envelope
|
||||
/// mapping from that box (#3179). The drawn art strokes the bent outlines at the stroke's own weight,
|
||||
@@ -7198,6 +7310,147 @@ fn warped_type_that_draws_apart_from_its_look_comes_in_as_the_look() {
|
||||
}
|
||||
}
|
||||
|
||||
/// An art style section with style `Dashed`: a black stroke 2 units wide with butt caps, miter joins
|
||||
/// and dashes of 6 and gaps of 4, aligned to corners and path ends (`BSDashAdj`).
|
||||
fn aligned_dash_style() -> String {
|
||||
"%AI9_BeginArtStyles\n/KnownStyle :\n(Dashed) /Name ,\n/ActiveStyle :\n/CompoundFilter :\n(Chain Style Filter) 0 0 /Filter ,\n1 /Visible ,\n\
|
||||
/BasicFilter :\n(Stroke Style Filter) 0 0 /Filter ,\n1 /Visible ,\n2 /FillOrStroke ,\n/Dictionary : /NotRecorded ,\n\
|
||||
/Dictionary : /NotRecorded ,\n1 /Bool (BSDashAdj) ,\n; (kAIBeautifulStrokesParamsDictKey) ,\n\
|
||||
/StrokeStyle : 0 R\n0 0 0 1 0 0 0 XA\n0 J 0 j 2 w 10 M [6 4 ]0 d\n0 XR\n1 0 Xd\n/Def ;\n (StrokeStyle) ,\n; /Dict ;\n /Part ,\n;\n%AI9_EndArtStyles\n"
|
||||
.to_string()
|
||||
}
|
||||
|
||||
/// The open path of [`aligned_dash_file`], a corner at (80, 20), in the document's coordinates.
|
||||
fn aligned_dash_path() -> kurbo::BezPath {
|
||||
let mut bp = kurbo::BezPath::new();
|
||||
bp.move_to((20.0, 20.0));
|
||||
bp.line_to((80.0, 20.0));
|
||||
bp.line_to((80.0, 70.0));
|
||||
bp
|
||||
}
|
||||
|
||||
/// What [`aligned_dash_style`] draws along [`aligned_dash_path`], with its dashes aligned to corners
|
||||
/// and path ends by VectorCraft or (`aligned` false) not, as look operators in black.
|
||||
fn aligned_dash_look(aligned: bool) -> String {
|
||||
use vectorcraft_color::{Color, Paint};
|
||||
use vectorcraft_doc::{Dash, LineCap, LineJoin, StrokeLayer};
|
||||
let mut stroke = StrokeLayer::new(Paint::solid(Color::BLACK), 2.0);
|
||||
(stroke.cap, stroke.join, stroke.miter_limit) = (LineCap::Butt, LineJoin::Miter, 10.0);
|
||||
stroke.dash = Some(Dash { pattern: vec![6.0, 4.0], offset: 0.0, align_corners: aligned });
|
||||
let outline = vectorcraft_effects::stroke::line_outline(&aligned_dash_path(), &stroke, 2.0, 0.01);
|
||||
assert!(!outline.elements().is_empty());
|
||||
drawn_as_operators(&outline).replace("0 1 1 0 1 0 0 Xa", "0 0 0 1 0 0 0 Xa")
|
||||
}
|
||||
|
||||
/// The editing copy of [`aligned_dash_path`] under [`aligned_dash_style`], with the look `drawing`.
|
||||
fn aligned_dash_file(drawing: &str) -> String {
|
||||
aligned_dash_files(drawing, 1)
|
||||
}
|
||||
|
||||
/// [`aligned_dash_file`] with `n` such paths.
|
||||
fn aligned_dash_files(drawing: &str, n: usize) -> String {
|
||||
let own = "%_0 0 0 1 0 0 0 XA\n%_2 w\n%_20 80 m\n%_80 80 L\n%_80 30 L\n%_S\n";
|
||||
let one = format!("u\n{drawing}\nU\n9 () XW\n{own}1 (Dashed) XW\n");
|
||||
native(&(aligned_dash_style() + &layer("Art", true, &one.repeat(n))))
|
||||
}
|
||||
|
||||
/// The paths of `d` that stroke with dashes, each with whether its dashes are aligned to corners.
|
||||
fn dashed_paths(d: &Document) -> Vec<bool> {
|
||||
let mut out = vec![];
|
||||
d.walk(|n| {
|
||||
if matches!(n.kind, NodeKind::Path { .. }) {
|
||||
for i in &n.appearance.items {
|
||||
if let vectorcraft_doc::AppearanceItem::Stroke(s) = i
|
||||
&& let Some(dash) = &s.dash
|
||||
{
|
||||
out.push(dash.align_corners);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
out
|
||||
}
|
||||
|
||||
/// A stroke whose dashes are aligned to corners and path ends comes in as the path with that stroke,
|
||||
/// editable, where VectorCraft's fitting draws as its drawn look.
|
||||
#[test]
|
||||
fn dashes_aligned_to_corners_that_draw_as_the_look_come_in_live() {
|
||||
let (d, notes) = crate::ai_alone(&private(&aligned_dash_file(&aligned_dash_look(true)))).unwrap();
|
||||
assert_eq!(dashed_paths(&d), [true], "{notes:?}");
|
||||
assert!(!notes.iter().any(|w| w.contains("drawn look")), "{notes:?}");
|
||||
}
|
||||
|
||||
/// Where the look draws the dashes elsewhere (here, not fitted), the path keeps its drawn look.
|
||||
#[test]
|
||||
fn dashes_aligned_to_corners_that_draw_apart_from_the_look_keep_it() {
|
||||
let (d, notes) = crate::ai_alone(&private(&aligned_dash_file(&aligned_dash_look(false)))).unwrap();
|
||||
assert!(dashed_paths(&d).is_empty(), "{notes:?}");
|
||||
let looks = d.layers[0].children().unwrap();
|
||||
assert!(matches!(looks.as_slice(), [l] if matches!(l.kind, NodeKind::Group { .. }) && l.visual_bounds().is_some()), "{looks:#?}");
|
||||
}
|
||||
|
||||
/// The strokes with aligned dashes one import checks against their looks are limited
|
||||
/// ([`crate::import::ai::MAX_DASH_CHECKS`]), apart from the envelopes' checks: past the
|
||||
/// limit, a path that would draw as its look keeps the look.
|
||||
#[test]
|
||||
fn dashes_aligned_to_corners_past_their_checks_keep_the_look() {
|
||||
let n = crate::import::ai::MAX_DASH_CHECKS;
|
||||
let (d, notes) = crate::ai_alone(&private(&aligned_dash_files(&aligned_dash_look(true), n + 1))).unwrap();
|
||||
assert_eq!(dashed_paths(&d).len(), n, "{notes:?}");
|
||||
let looks = d.layers[0].children().unwrap().iter().filter(|c| matches!(c.kind, NodeKind::Group { .. })).count();
|
||||
assert_eq!(looks, 1);
|
||||
}
|
||||
|
||||
/// The reads of a file apart from its layers check no stroke with dashes aligned to corners in its
|
||||
/// layers against its look: the import's checks ([`crate::import::ai::MAX_DASH_CHECKS`]) are its
|
||||
/// layers' reader's, though those reads go over all of the data. Its artboards and variable library
|
||||
/// are read with no checks at all, and its swatches (and so its brushes, styles and symbols, read
|
||||
/// the same way) with none once their reader reaches the layers. The layers' reader still checks
|
||||
/// the one such stroke.
|
||||
#[test]
|
||||
fn the_reads_apart_from_the_layers_check_no_aligned_dashes() {
|
||||
use vectorcraft_testkit::ai::{sample_variable_sets, variable_library_data};
|
||||
let library = variable_library_data(&sample_variable_sets("variableAndTypes", &[]));
|
||||
let own = "%_0 0 0 1 0 0 0 XA\n%_2 w\n%_20 80 m\n%_80 80 L\n%_80 30 L\n%_S\n";
|
||||
let one = format!("u\n{}\nU\n9 () XW\n{own}1 (Dashed) XW\n", aligned_dash_look(true));
|
||||
let data = native(&(library + &aligned_dash_style() + &layer("Art", true, &one)));
|
||||
let checks = |f: &dyn Fn()| {
|
||||
crate::import::ai::DASH_CHECKS_MADE.set(0);
|
||||
f();
|
||||
crate::import::ai::DASH_CHECKS_MADE.get()
|
||||
};
|
||||
let names = crate::import::ai::Names::default;
|
||||
assert_eq!(checks(&|| drop(crate::ai_alone(&private(&data)))), 1);
|
||||
assert_eq!(checks(&|| drop(crate::import::ai::artboards(data.as_bytes(), &mut names()))), 0);
|
||||
assert_eq!(checks(&|| assert!(crate::import::ai::variables(data.as_bytes(), &mut names()).present)), 0);
|
||||
assert_eq!(checks(&|| drop(crate::import::ai::palette(data.as_bytes(), &[], &mut names()))), 0);
|
||||
}
|
||||
|
||||
/// Type under a style with dashes aligned to corners keeps its drawn look, as before, and takes no
|
||||
/// such stroke: the look check isn't made for type.
|
||||
#[test]
|
||||
fn type_with_dashes_aligned_to_corners_keeps_its_drawn_look() {
|
||||
let doc = text_document(&[("TILT\r", 0, (8200.0, 8180.0), (0.0, 0.0), 0.0)]);
|
||||
let own: String = text_object(0).lines().map(|l| format!("%_{l}\n")).collect();
|
||||
let look = format!("u\n{}\nU\n9 () XW\n", aligned_dash_look(true));
|
||||
let file = native_with_text(&(aligned_dash_style() + &layer("Art", true, &format!("{look}{own}1 (Dashed) XW\n"))), &doc);
|
||||
let (d, notes) = crate::ai_alone(&private(&file)).unwrap();
|
||||
// The look stays, and the type takes no stroke with aligned dashes.
|
||||
let kids = d.layers[0].children().unwrap();
|
||||
assert!(kids.iter().any(|c| matches!(c.kind, NodeKind::Group { .. }) && c.visual_bounds().is_some()), "{notes:?}");
|
||||
let mut aligned = false;
|
||||
d.walk(|n| {
|
||||
if matches!(n.kind, NodeKind::Text(_)) {
|
||||
aligned |= n
|
||||
.appearance
|
||||
.items
|
||||
.iter()
|
||||
.any(|i| matches!(i, vectorcraft_doc::AppearanceItem::Stroke(s) if s.dash.as_ref().is_some_and(|d| d.align_corners)));
|
||||
}
|
||||
});
|
||||
assert!(!aligned, "{notes:?}");
|
||||
}
|
||||
|
||||
/// Warped type that a text variable binds stays type with the effect live and keeps its binding,
|
||||
/// though its live warp draws apart from its look.
|
||||
#[test]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! Bounded ownership of authored replacement text (ISO 32000-1, 14.9.4).
|
||||
|
||||
use super::state::Builder;
|
||||
use super::state::{Builder, HeldStroke};
|
||||
use super::{Affine, Look, Placement, Shape, TextLine, Upright};
|
||||
use crate::import_text::TextContent;
|
||||
|
||||
@@ -21,13 +21,16 @@ impl ActualText {
|
||||
self.depth = self.depth.saturating_add(1);
|
||||
}
|
||||
|
||||
pub(super) fn end(&mut self) {
|
||||
if self.owner == Some(self.depth) {
|
||||
/// `true`: the owner's span ended.
|
||||
pub(super) fn end(&mut self) -> bool {
|
||||
let ended = self.owner == Some(self.depth);
|
||||
if ended {
|
||||
self.owner = None;
|
||||
self.pending = None;
|
||||
self.empty = false;
|
||||
}
|
||||
self.depth = self.depth.saturating_sub(1);
|
||||
ended
|
||||
}
|
||||
|
||||
pub(super) fn active(&self) -> bool {
|
||||
@@ -62,13 +65,32 @@ impl Builder<'_> {
|
||||
/// against the glyph's original Unicode, not against this replacement's characters.
|
||||
pub(super) fn actual_glyph(&mut self, o: &craft_pdf::interpret::font::OutlineGlyph, m: Affine, at: Placement, look: Look, opacity: f32) -> bool {
|
||||
let key = o.font_cache_key();
|
||||
self.flush_glyphs();
|
||||
// A fill and stroke callback for the same glyph consumes its text only once.
|
||||
if let (Some(stroke), Some(line)) = (&look.stroke, &mut self.text)
|
||||
&& look.fill.is_none()
|
||||
&& line.stroke_actual(key, at, stroke.clone(), look.overprint_stroke)
|
||||
// A fill and stroke callback for the same glyph consumes its text only once: the stroke
|
||||
// goes over the glyph of the span filled, matched as the stroke pass ends as any other
|
||||
// (`Builder::hold_stroke`), on a line the operator's kerning finished too.
|
||||
let stroking = look.fill.is_none() && look.stroke.is_some();
|
||||
if let Some(stroke) = &look.stroke
|
||||
&& stroking
|
||||
{
|
||||
return true;
|
||||
let h = HeldStroke {
|
||||
font: key,
|
||||
at,
|
||||
opacity,
|
||||
text: String::new(),
|
||||
stroke: stroke.clone(),
|
||||
overprint: look.overprint_stroke,
|
||||
glyph: None,
|
||||
actual: true,
|
||||
first: (0, 0),
|
||||
};
|
||||
if self.hold_stroke(h) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.flush_glyphs();
|
||||
// Stroked type of its own ends the stroke pass of the glyphs filled before it.
|
||||
if stroking {
|
||||
self.end_fills();
|
||||
}
|
||||
let width = o.advance_width().filter(|w| w.is_finite());
|
||||
let advance = width.map_or(at.size * 0.5, |w| w as f64 / 1000.0 * at.size * at.h_scale / 100.0);
|
||||
@@ -87,7 +109,7 @@ impl Builder<'_> {
|
||||
None => line.push_content(&look, at, opacity, advance, content),
|
||||
};
|
||||
if !self.text.as_mut().is_some_and(place) {
|
||||
self.flush_text();
|
||||
self.park_text(!stroking);
|
||||
let mut line = TextLine::new(at, opacity);
|
||||
if !place(&mut line) {
|
||||
self.actual.pending = pending;
|
||||
|
||||
@@ -4,7 +4,9 @@ use super::entry::{
|
||||
UNNAMED_CHARACTERS_NOTE, max_objects,
|
||||
};
|
||||
use super::reshaped;
|
||||
use super::state::{Builder, Frame, FrameKind, GlyphRun, Saved, bounds, grouped, mean_scale, paints, round3, same_stroke, stroke_layer, type_stroke};
|
||||
use super::state::{
|
||||
Builder, Frame, FrameKind, GlyphRun, HeldStroke, Saved, bounds, grouped, mean_scale, paints, round3, same_stroke, stroke_layer, type_stroke,
|
||||
};
|
||||
use super::{
|
||||
Affine, Appearance, AppearanceItem, Arc, BezPath, BfString, BlendMode, CacheKey, Color, Colors, Families, FillLayer, FillRule, FunctionBudget,
|
||||
FunctionPaint, HashMap, HashSet, ImageBlob, ImageObject, Knockout, Look, MaskSpec, MaskType, Native, Node, NodeId, NodeKind, OpacityMask, Paint,
|
||||
@@ -12,6 +14,30 @@ use super::{
|
||||
Upright, Walked, clipped, contains, fold_stop_opacity, function_paint, gradient_shape, is_rectangle, luminance, mask_spec, shading_gradient,
|
||||
};
|
||||
|
||||
/// The most lines of type kept for a text-showing operator's stroke pass ([`Builder::park_text`]):
|
||||
/// beyond them the oldest is finished, and strokes over its glyphs come in as type of their own.
|
||||
/// They are the lines its fill pass finished, besides the open one: a `TJ` over up to 65 lines is
|
||||
/// filled and stroked, one over more is a filled object and a stroked one for each part. The
|
||||
/// pass's first stroke goes over a glyph finished so, which can match a glyph kept (a `TJ` that
|
||||
/// draws it again where it began): a first stroke that may go over one of them is type of its own
|
||||
/// too, and ends the pass ([`Builder::hold_stroke`]).
|
||||
const MAX_PARKED: usize = 64;
|
||||
|
||||
/// The most strokes of a stroke pass held to be matched to the glyphs they go over
|
||||
/// ([`Builder::hold_stroke`]): beyond them, those held are matched to the last glyphs filled one
|
||||
/// after another that they go over, with as many glyphs filled from there on as strokes held
|
||||
/// ([`Builder::replayed`]), and the pass goes on from there. The reader tells no operator's
|
||||
/// start, so the last such run is taken: the operator's fill pass is the one right before its
|
||||
/// stroke pass. An operator that fills the same run of more than this many glyphs twice at the
|
||||
/// same places may have its first strokes matched to its second copy; such a pass is matched as
|
||||
/// well as it can be, not exactly.
|
||||
const MAX_HELD: usize = 4096;
|
||||
|
||||
/// The most glyphs [`Builder::replayed`] compares to the strokes held, for bounded work on
|
||||
/// hostile input: beyond them, each stroke goes over the first glyph it may go over after the one
|
||||
/// the stroke before it goes over.
|
||||
const MAX_REPLAY_WORK: usize = 1 << 20;
|
||||
|
||||
fn is_colour_face(face: &vectorcraft_text::FontFace) -> bool {
|
||||
use skrifa::Tag;
|
||||
use skrifa::raw::TableProvider;
|
||||
@@ -37,6 +63,9 @@ impl<'p> Builder<'p> {
|
||||
type3_run: None,
|
||||
text: None,
|
||||
text_glyphs: vec![],
|
||||
parked: vec![],
|
||||
held: vec![],
|
||||
lost: None,
|
||||
text_as,
|
||||
actual: Default::default(),
|
||||
images: HashMap::new(),
|
||||
@@ -119,6 +148,9 @@ impl<'p> Builder<'p> {
|
||||
self.type3_run = None;
|
||||
self.text = None;
|
||||
self.text_glyphs.clear();
|
||||
self.parked.clear();
|
||||
self.held.clear();
|
||||
self.lost = None;
|
||||
self.mask = None;
|
||||
self.masked.clear();
|
||||
self.marked.clear();
|
||||
@@ -420,7 +452,10 @@ impl<'p> Builder<'p> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Finish the open run of glyphs kept as outlines, once the strokes held are matched
|
||||
/// ([`Self::settle_strokes`]): whatever is drawn next ends their stroke pass.
|
||||
pub(super) fn flush_glyphs(&mut self) {
|
||||
self.settle_strokes();
|
||||
let Some(run) = self.glyphs.take() else { return };
|
||||
if run.path.elements().is_empty() {
|
||||
return;
|
||||
@@ -450,11 +485,274 @@ impl<'p> Builder<'p> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Finish the open line of type. `true`: it was kept as outlines instead ([`reshaped`]), which
|
||||
/// are left open as the glyph run for an outline drawn next to join.
|
||||
/// Finish the open line of type, after the lines parked before it ([`Self::park_text`]).
|
||||
/// `true`: the open line was kept as outlines instead ([`reshaped`]), which are left open as
|
||||
/// the glyph run for an outline drawn next to join.
|
||||
pub(super) fn end_text(&mut self) -> bool {
|
||||
self.settle_strokes();
|
||||
self.release_parked(usize::MAX);
|
||||
let glyphs = std::mem::take(&mut self.text_glyphs);
|
||||
let Some(mut line) = self.text.take() else { return false };
|
||||
let Some(line) = self.text.take() else { return false };
|
||||
self.end_line(line, glyphs)
|
||||
}
|
||||
|
||||
/// Finish the first `n` parked lines ([`Self::park_text`]), in the order they were drawn.
|
||||
pub(super) fn release_parked(&mut self, n: usize) {
|
||||
let n = n.min(self.parked.len());
|
||||
if n == 0 {
|
||||
return;
|
||||
}
|
||||
let lines: Vec<_> = self.parked.drain(..n).collect();
|
||||
for (line, glyphs) in lines {
|
||||
if self.end_line(line, glyphs) {
|
||||
self.flush_glyphs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The open line ends where glyph drawn next starts another. The reader fills every glyph of
|
||||
/// a text-showing operator before it strokes them (fill and stroke rendering): a line that a
|
||||
/// stroke may still be drawn over is parked instead of finished, so that the operator's
|
||||
/// stroke pass still finds the glyphs it filled when its kerning started a new line part way
|
||||
/// through (#8543). Any other line, or with `park` false, is finished with the lines parked
|
||||
/// before it.
|
||||
///
|
||||
/// Parked lines are finished, oldest first, when the stroke pass goes past them (a stroke is
|
||||
/// drawn over a later line or the open one: [`Self::settle_strokes`]; or over none of them:
|
||||
/// [`Self::end_fills`]), when anything else ends the open line ([`Self::end_text`]), and
|
||||
/// beyond [`MAX_PARKED`] lines: the glyphs of those are kept for the stroke after them
|
||||
/// ([`Self::hold_stroke`]).
|
||||
pub(super) fn park_text(&mut self, park: bool) {
|
||||
match self.text.take() {
|
||||
Some(line) if park && line.awaits_stroke() => {
|
||||
let glyphs = std::mem::take(&mut self.text_glyphs);
|
||||
self.parked.push((line, glyphs));
|
||||
let over = self.parked.len().saturating_sub(MAX_PARKED);
|
||||
if over > 0 {
|
||||
let lost = self.lost.get_or_insert_default();
|
||||
for (line, _) in self.parked.iter().take(over) {
|
||||
lost.add(line);
|
||||
}
|
||||
}
|
||||
self.release_parked(over);
|
||||
}
|
||||
line => {
|
||||
self.text = line;
|
||||
self.flush_text();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A boundary of stroke passes: no stroke drawn from now on goes over a glyph filled before
|
||||
/// it. The strokes held are matched ([`Self::settle_strokes`]), the parked lines finished, and
|
||||
/// the open line's glyphs filled so far closed to strokes ([`TextLine::end_fills`]). A stroke
|
||||
/// that goes over no glyph filled (stroked type of its own) is one: a stroke pass replays the
|
||||
/// glyphs its operator filled last, so a stroke after it isn't part of a pass over glyphs
|
||||
/// filled before it, and stroking those would draw it under the type of its own. The start
|
||||
/// and end of an ActualText span are too: a span's glyphs are stroked within it (#8543).
|
||||
pub(super) fn end_fills(&mut self) {
|
||||
self.lost = None;
|
||||
self.settle_strokes();
|
||||
self.release_parked(usize::MAX);
|
||||
if let Some(line) = &mut self.text {
|
||||
line.end_fills();
|
||||
}
|
||||
}
|
||||
|
||||
/// The parked line at `slot` ([`Self::park_text`]), or the open line at the slot after them.
|
||||
fn line_at(&self, slot: usize) -> Option<&TextLine> {
|
||||
match self.parked.get(slot) {
|
||||
Some((line, _)) => Some(line),
|
||||
None if slot == self.parked.len() => self.text.as_ref(),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The glyph filled right after the one at `at` (a line's slot and its index among the line's
|
||||
/// filled glyphs, as [`Self::next_fill`]): the next on its line, else the first of the line
|
||||
/// after it.
|
||||
fn after_fill(&self, (slot, i): (usize, usize)) -> (usize, usize) {
|
||||
match self.line_at(slot) {
|
||||
Some(line) if i.saturating_add(1) < line.filled_len() => (slot, i.saturating_add(1)),
|
||||
_ => (slot.saturating_add(1), 0),
|
||||
}
|
||||
}
|
||||
|
||||
/// The first glyph filled after `after` that stroke `h` may go over
|
||||
/// ([`TextLine::next_filled`]), as its line's slot ([`Self::line_at`]) and its index among
|
||||
/// the line's filled glyphs: the lines in the order they were drawn, each line's glyphs in
|
||||
/// the order they were filled. From the first glyph with no `after`.
|
||||
fn next_fill(&self, after: Option<(usize, usize)>, h: &HeldStroke) -> Option<(usize, usize)> {
|
||||
let first = after.map_or(0, |(slot, _)| slot);
|
||||
(first..=self.parked.len()).find_map(|slot| {
|
||||
let from = match after {
|
||||
Some((s, i)) if s == slot => i.saturating_add(1),
|
||||
_ => 0,
|
||||
};
|
||||
let i = self.line_at(slot)?.next_filled(from, h.font, h.at, h.opacity, &h.text, h.actual)?;
|
||||
Some((slot, i))
|
||||
})
|
||||
}
|
||||
|
||||
/// The last glyph filled before `before` that stroke `h` may go over ([`Self::next_fill`]).
|
||||
/// From the last glyph with no `before`.
|
||||
fn last_fill(&self, before: Option<(usize, usize)>, h: &HeldStroke) -> Option<(usize, usize)> {
|
||||
let last = before.map_or(self.parked.len(), |(slot, _)| slot);
|
||||
(0..=last).rev().find_map(|slot| {
|
||||
let until = match before {
|
||||
Some((s, i)) if s == slot => i,
|
||||
_ => usize::MAX,
|
||||
};
|
||||
let i = self.line_at(slot)?.last_filled(until, h.font, h.at, h.opacity, &h.text, h.actual)?;
|
||||
Some((slot, i))
|
||||
})
|
||||
}
|
||||
|
||||
/// Hold stroke `h`, over a glyph filled on the open line or a parked one, until its stroke
|
||||
/// pass ends ([`Self::settle_strokes`]). `false`: no glyph filled after those the strokes
|
||||
/// held go over is one it may go over (the strokes held are matched first, and if it may go
|
||||
/// over none then, it isn't held either: it goes over the line as it stands).
|
||||
///
|
||||
/// The reader fills all the glyphs of a text-showing operator, then strokes the same glyphs
|
||||
/// in the same order (fill and stroke rendering, #8015). Which glyph a stroke goes over is
|
||||
/// only told once the pass has ended: a `TJ` can draw the same glyph at the same place twice
|
||||
/// (its kerning goes back), and an operator can fill and stroke a glyph where one filled
|
||||
/// before it stands, which the device can't tell from a glyph the operator filled (#8543).
|
||||
///
|
||||
/// The first stroke after lines were finished beyond [`MAX_PARKED`] ([`Self::park_text`])
|
||||
/// that may go over a glyph of theirs may be the start of their stroke pass, which no longer
|
||||
/// finds its first glyphs: it ends the pass ([`Self::end_fills`]) and is type of its own, as
|
||||
/// are the pass's strokes after it. Any other first stroke there is matched as ever: no
|
||||
/// stroke pass is due over those lines once another stroke is drawn.
|
||||
pub(super) fn hold_stroke(&mut self, mut h: HeldStroke) -> bool {
|
||||
if self.lost.take().is_some_and(|lost| lost.may_stroke(h.font, h.at, h.opacity, &h.text, h.actual)) {
|
||||
self.end_fills();
|
||||
return false;
|
||||
}
|
||||
if self.held.len() >= MAX_HELD {
|
||||
self.settle(false);
|
||||
}
|
||||
let mut first = self.next_fill(self.held.last().map(|l| l.first), &h);
|
||||
if first.is_none() && !self.held.is_empty() {
|
||||
self.settle_strokes();
|
||||
first = self.next_fill(None, &h);
|
||||
}
|
||||
let Some(first) = first else { return false };
|
||||
h.first = first;
|
||||
self.held.push(h);
|
||||
true
|
||||
}
|
||||
|
||||
/// Match the strokes held ([`Self::hold_stroke`]) to the glyphs they go over, now that their
|
||||
/// stroke pass has ended, and stroke them. The pass strokes the glyphs filled last, in the
|
||||
/// order they were filled: each stroke goes over the last glyph it may go over that is filled
|
||||
/// before the one the stroke after it goes over. So a `TJ` that draws a glyph twice at the
|
||||
/// same place strokes each where it filled it, and a glyph filled and stroked where one
|
||||
/// filled before it stands strokes the one filled last (#8015, #8543).
|
||||
pub(super) fn settle_strokes(&mut self) {
|
||||
self.settle(true);
|
||||
}
|
||||
|
||||
/// The glyphs the strokes `held` go over when they are the start of a stroke pass that goes
|
||||
/// on after them ([`MAX_HELD`]): the last glyphs filled one right after another that they
|
||||
/// may go over, in order, with at least as many glyphs filled from the first of them on as
|
||||
/// there are strokes held. The pass replays its operator's fill pass, the glyphs filled
|
||||
/// last, one right after another, right before the pass, so the strokes don't go over a
|
||||
/// glyph filled before those, nor skip one. The device isn't told where an operator starts:
|
||||
/// an operator before it that filled the same glyphs at the same places stays unstroked, as
|
||||
/// the first glyphs of the pass are the last such run the pass still has room for. `None`
|
||||
/// when there are none, or beyond [`MAX_REPLAY_WORK`].
|
||||
fn replayed(&self, held: &[HeldStroke]) -> Option<Vec<(usize, usize)>> {
|
||||
let (head, rest) = held.split_first()?;
|
||||
let mut work = 0usize;
|
||||
// The glyphs filled from `at` on, up to as many as there are strokes held.
|
||||
let left = |(slot, i): (usize, usize)| {
|
||||
(slot..=self.parked.len())
|
||||
.filter_map(|s| self.line_at(s).map(|line| line.filled_len().saturating_sub(if s == slot { i } else { 0 })))
|
||||
.fold(0usize, |n, len| n.saturating_add(len).min(held.len()))
|
||||
};
|
||||
let mut start = self.last_fill(None, head);
|
||||
while let Some(first) = start {
|
||||
start = self.last_fill(Some(first), head);
|
||||
work = work.saturating_add(1);
|
||||
if work > MAX_REPLAY_WORK {
|
||||
return None;
|
||||
}
|
||||
// Too few glyphs filled after it for the strokes held: not where the pass starts.
|
||||
if left(first) < held.len() {
|
||||
continue;
|
||||
}
|
||||
let mut places = Vec::with_capacity(held.len());
|
||||
places.push(first);
|
||||
let mut at = first;
|
||||
for h in rest {
|
||||
work = work.saturating_add(1);
|
||||
if work > MAX_REPLAY_WORK {
|
||||
return None;
|
||||
}
|
||||
at = self.after_fill(at);
|
||||
if !self.line_at(at.0).is_some_and(|line| line.fills_at(at.1, h.font, h.at, h.opacity, &h.text, h.actual)) {
|
||||
break;
|
||||
}
|
||||
places.push(at);
|
||||
}
|
||||
if places.len() == held.len() {
|
||||
return Some(places);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// [`Self::settle_strokes`], each stroke matched to the last glyph it may go over (`last`),
|
||||
/// or, when too many are held ([`Self::hold_stroke`]), as the start of a pass that goes on
|
||||
/// ([`Self::replayed`]).
|
||||
fn settle(&mut self, last: bool) {
|
||||
if self.held.is_empty() {
|
||||
return;
|
||||
}
|
||||
let held = std::mem::take(&mut self.held);
|
||||
let mut places = vec![];
|
||||
if last {
|
||||
let mut before = None;
|
||||
for h in held.iter().rev() {
|
||||
let Some(p) = self.last_fill(before, h) else { break };
|
||||
places.push(p);
|
||||
before = Some(p);
|
||||
}
|
||||
places.reverse();
|
||||
} else if let Some(p) = self.replayed(&held) {
|
||||
places = p;
|
||||
}
|
||||
// Each held stroke goes over the first glyph it may go over after the one before it
|
||||
// does ([`Self::hold_stroke`]), so the last ones are found too: this is only a guard.
|
||||
if places.len() != held.len() {
|
||||
places = held.iter().map(|h| h.first).collect();
|
||||
}
|
||||
// The slots of the parked lines finished so far, which the later places count in.
|
||||
let mut finished = 0usize;
|
||||
for (h, (slot, index)) in held.into_iter().zip(places) {
|
||||
let slot = slot.saturating_sub(finished);
|
||||
let parked = self.parked.len();
|
||||
// The lines before the one stroked are past the stroke pass: they are finished.
|
||||
self.release_parked(slot);
|
||||
finished = finished.saturating_add(slot.min(parked));
|
||||
let target = match self.parked.first_mut() {
|
||||
Some((line, glyphs)) if slot < parked => Some((line, glyphs)),
|
||||
_ => self.text.as_mut().map(|line| (line, &mut self.text_glyphs)),
|
||||
};
|
||||
if let Some((line, glyphs)) = target
|
||||
&& line.stroke_filled_at(index, h.stroke, h.overprint)
|
||||
{
|
||||
// Upright glyphs aren't kept as outlines (nor are those filled only): a vertical
|
||||
// line that came in as its outlines would lose the ones filled only.
|
||||
glyphs.extend(h.glyph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Finish `line` of type, whose `glyphs` are its outlines ([`Self::keep_glyph`]). `true`:
|
||||
/// it was kept as them ([`Self::end_text`]).
|
||||
fn end_line(&mut self, mut line: TextLine, glyphs: Vec<GlyphRun>) -> bool {
|
||||
let held = std::mem::take(&mut line.held);
|
||||
// Type the file names itself (ActualText) is in reading order as it stands.
|
||||
let checked = !glyphs.is_empty() && line.mapped() && !line.has_type3;
|
||||
@@ -880,13 +1178,9 @@ impl<'p> Builder<'p> {
|
||||
scale: f64,
|
||||
overprint: bool,
|
||||
) {
|
||||
let Some((paint, stroke)) = drawn else { return };
|
||||
let mut path = o.outline();
|
||||
if path.elements().is_empty() {
|
||||
return;
|
||||
if let Some(g) = glyph_run(o, m, drawn, opacity, scale, overprint) {
|
||||
self.text_glyphs.push(g);
|
||||
}
|
||||
path.apply_affine(m);
|
||||
self.text_glyphs.push(GlyphRun { path, paint, opacity, stroke, scale, overprint });
|
||||
}
|
||||
|
||||
fn type3_font_name(&mut self, key: u128) -> FontInfo {
|
||||
@@ -1150,10 +1444,22 @@ impl<'p> Builder<'p> {
|
||||
Some(top) => line.push_upright(&look, at, opacity, Upright { top }, &text),
|
||||
None => line.push(&look, at, opacity, advance, &text),
|
||||
};
|
||||
let stroking = look.fill.is_none() && look.stroke.is_some();
|
||||
// A stroke over a glyph filled before it, on the open line or one the same operator's
|
||||
// kerning finished: matched once its stroke pass ends.
|
||||
if let Some(s) = &look.stroke
|
||||
&& stroking
|
||||
{
|
||||
let glyph = if top.is_none() { glyph_run(o, m, drawn.clone(), opacity, scale, overprint) } else { None };
|
||||
let h = HeldStroke { font: key, at, opacity, text: text.clone(), stroke: s.clone(), overprint, glyph, actual: false, first: (0, 0) };
|
||||
if self.hold_stroke(h) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
self.flush_glyphs();
|
||||
// A stroke over the glyph just filled (fill and stroke rendering).
|
||||
if let (Some(s), Some(line)) = (&look.stroke, &mut self.text)
|
||||
&& look.fill.is_none()
|
||||
&& stroking
|
||||
&& line.stroke_filled(key, at, opacity, &text, s.clone(), overprint)
|
||||
{
|
||||
// Upright glyphs aren't kept as outlines (nor, below, are those filled only): a
|
||||
@@ -1163,8 +1469,12 @@ impl<'p> Builder<'p> {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
// Stroked type of its own ends the stroke pass of the glyphs filled before it.
|
||||
if stroking {
|
||||
self.end_fills();
|
||||
}
|
||||
if !self.text.as_mut().is_some_and(place) {
|
||||
self.flush_text();
|
||||
self.park_text(!stroking);
|
||||
let mut line = TextLine::new(at, opacity);
|
||||
place(&mut line);
|
||||
self.text = Some(line);
|
||||
@@ -1184,6 +1494,25 @@ impl<'p> Builder<'p> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Glyph `o` placed by `m` and drawn with `drawn` as the outline it is kept as
|
||||
/// ([`Builder::keep_glyph`]). Nothing for a glyph that shows nothing.
|
||||
fn glyph_run(
|
||||
o: &craft_pdf::interpret::font::OutlineGlyph,
|
||||
m: Affine,
|
||||
drawn: Option<(Paint, Option<StrokeProps>)>,
|
||||
opacity: f32,
|
||||
scale: f64,
|
||||
overprint: bool,
|
||||
) -> Option<GlyphRun> {
|
||||
let (paint, stroke) = drawn?;
|
||||
let mut path = o.outline();
|
||||
if path.elements().is_empty() {
|
||||
return None;
|
||||
}
|
||||
path.apply_affine(m);
|
||||
Some(GlyphRun { path, paint, opacity, stroke, scale, overprint })
|
||||
}
|
||||
|
||||
/// The characters of one glyph in the order they are drawn: a PDF names a ligature's characters
|
||||
/// in logical order (lam then alef for لا), while a horizontal line of type is gathered glyph by
|
||||
/// glyph in visual order and only then put back in logical order. Right-to-left characters are
|
||||
|
||||
@@ -453,12 +453,20 @@ impl<'a> Device<'a> for Builder<'_> {
|
||||
self.flush();
|
||||
}
|
||||
self.marked.pop();
|
||||
self.actual.end();
|
||||
// A span's glyphs are stroked within it: a stroke after it goes over none of them.
|
||||
if self.actual.end() {
|
||||
self.end_fills();
|
||||
}
|
||||
}
|
||||
|
||||
fn actual_text(&mut self, text: &[u8]) {
|
||||
let active = self.actual.active();
|
||||
if self.nested == 0 && self.text_as == crate::TextAs::Text && !self.actual.set(text) {
|
||||
self.warn("ActualText beyond the import size or nesting limit was left to glyph mappings");
|
||||
}
|
||||
// Nor does a stroke in a span go over a glyph filled before it.
|
||||
if !active && self.actual.active() {
|
||||
self.end_fills();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,24 @@ pub(super) struct GlyphRun {
|
||||
pub(super) overprint: bool,
|
||||
}
|
||||
|
||||
/// A stroke over a glyph filled before it (fill and stroke rendering), held with the stroke pass
|
||||
/// it is part of ([`Builder::hold_stroke`]): the glyph's font, placement, opacity and text, the
|
||||
/// stroke, whether it overprints, the glyph's outline as drawn (kept as for a line of type kept
|
||||
/// as outlines; none for a glyph set upright or one of an ActualText span), whether it is one of
|
||||
/// an ActualText span, and the first glyph filled so it may go over, as its line's place among
|
||||
/// the parked lines and the open one and its index in the line's filled glyphs.
|
||||
pub(super) struct HeldStroke {
|
||||
pub(super) font: u128,
|
||||
pub(super) at: super::Placement,
|
||||
pub(super) opacity: f32,
|
||||
pub(super) text: String,
|
||||
pub(super) stroke: TypeStroke,
|
||||
pub(super) overprint: bool,
|
||||
pub(super) glyph: Option<GlyphRun>,
|
||||
pub(super) actual: bool,
|
||||
pub(super) first: (usize, usize),
|
||||
}
|
||||
|
||||
/// How often a tiling pattern was read, and the art (as its paints) each reading drew with the
|
||||
/// swatch made for it.
|
||||
pub(super) type PatternReadings = (u32, Vec<(Vec<Paint>, String)>);
|
||||
@@ -94,6 +112,19 @@ pub(super) struct Builder<'p> {
|
||||
/// kept as: what the line becomes when its type wouldn't draw as the file does
|
||||
/// ([`super::reshaped`]).
|
||||
pub(super) text_glyphs: Vec<GlyphRun>,
|
||||
/// Lines of type a text-showing operator's fill pass finished (a `TJ`'s kerning starts a new
|
||||
/// line part way through) that its stroke pass may still go over, oldest first, each with
|
||||
/// its [`text_glyphs`](Self::text_glyphs): written before the open line, in this order
|
||||
/// ([`Builder::park_text`]).
|
||||
pub(super) parked: Vec<(TextLine, Vec<GlyphRun>)>,
|
||||
/// The strokes of a text-showing operator's stroke pass over glyphs it filled on the
|
||||
/// [`parked`](Self::parked) lines and the open one, held until the pass ends to be matched to
|
||||
/// the glyphs it strokes ([`Builder::settle_strokes`]).
|
||||
pub(super) held: Vec<HeldStroke>,
|
||||
/// The glyphs of the lines a fill pass finished beyond the most kept for their stroke pass that
|
||||
/// a stroke may still have gone over, until the first stroke after them
|
||||
/// ([`Builder::hold_stroke`]) or a boundary of stroke passes ([`Builder::end_fills`]).
|
||||
pub(super) lost: Option<crate::import_text::LostFills>,
|
||||
pub(super) text_as: TextAs,
|
||||
pub(super) actual: super::actual_text::ActualText,
|
||||
pub(super) images: HashMap<String, ImageBlob>,
|
||||
|
||||
+171
-40
@@ -233,10 +233,8 @@ pub(crate) struct TextLine {
|
||||
slots: Vec<Option<Slot>>,
|
||||
/// Per character: authored logical order must survive visual-to-logical reconstruction.
|
||||
authored: Vec<bool>,
|
||||
/// Fill callbacks in an authored span, for the reader's later stroke pass.
|
||||
actual_fills: HashMap<(u128, u64, u64), Option<usize>>,
|
||||
/// The glyphs filled without a stroke, in drawing order, for a stroke drawn over them later
|
||||
/// ([`stroke_filled`](Self::stroke_filled)).
|
||||
/// ([`stroke_filled`](Self::stroke_filled)), those of an ActualText span among them.
|
||||
filled: Vec<Filled>,
|
||||
/// The first of [`filled`](Self::filled) a stroke may still be drawn over: a stroke matches
|
||||
/// glyphs in the order they were filled, and each at most once.
|
||||
@@ -246,6 +244,10 @@ pub(crate) struct TextLine {
|
||||
pending: Option<PendingStroke>,
|
||||
/// The last glyph's placement.
|
||||
last_at: Placement,
|
||||
/// The last glyph was drawn before a boundary of stroke passes ([`end_fills`](Self::end_fills)):
|
||||
/// no stroke drawn since goes over it, not even as the glyph just drawn
|
||||
/// ([`stroke_last`](Self::stroke_last)).
|
||||
last_closed: bool,
|
||||
/// The first glyph was set vertically ([`Upright`]).
|
||||
upright: Option<Upright>,
|
||||
/// The glyphs make a column (vertical type), each below the last.
|
||||
@@ -279,7 +281,9 @@ struct Slot {
|
||||
}
|
||||
|
||||
/// A glyph filled without a stroke: its font and placement, and where its text is in the line's
|
||||
/// runs (the run's index, the text's byte offset in it and its length).
|
||||
/// runs (the run's index, the text's byte offset in it and its length). A glyph of an ActualText
|
||||
/// span has `actual`: `Some(true)` for the glyph whose run holds the replacement text,
|
||||
/// `Some(false)` for the glyphs after it, which add no text (`len` 0 for both).
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Filled {
|
||||
font: u128,
|
||||
@@ -287,6 +291,57 @@ struct Filled {
|
||||
run: usize,
|
||||
start: usize,
|
||||
len: usize,
|
||||
actual: Option<bool>,
|
||||
}
|
||||
|
||||
/// Whether a stroke over glyph `text` drawn at `at` in `font` at `opacity` may be drawn over a
|
||||
/// glyph `fill` filled (its font, placement, whether it is a glyph of an ActualText span, and its
|
||||
/// text) on a line that is `opaque` or not ([`TextLine::fills_at`]).
|
||||
fn may_stroke(fill: (u128, Placement, bool, Option<&str>), opaque: bool, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> bool {
|
||||
let (g_font, g_at, g_actual, g_text) = fill;
|
||||
if actual {
|
||||
let same = |a: f64, b: f64| a.to_bits() == b.to_bits();
|
||||
return g_actual && g_font == font && same(g_at.origin.x, at.origin.x) && same(g_at.origin.y, at.origin.y);
|
||||
}
|
||||
!g_actual && opacity >= 0.999 && opaque && g_font == font && g_at.same_as(&at) && g_text == Some(text)
|
||||
}
|
||||
|
||||
/// The glyphs a stroke could still go over on lines of type finished before their stroke pass
|
||||
/// could end: lines beyond the most a fill pass keeps for its stroke pass. The device isn't told
|
||||
/// where an operator starts, so a stroke pass over such a line can't be told from one over the
|
||||
/// glyphs kept: its first stroke, over a glyph finished so, may match one of them instead. Kept up
|
||||
/// to [`MAX_LOST_FILLS`](Self::MAX_LOST_FILLS), beyond which any stroke may be over one.
|
||||
#[derive(Clone, Debug, Default)]
|
||||
pub(crate) struct LostFills {
|
||||
/// Each glyph's font, placement, whether it is a glyph of an ActualText span, its text and
|
||||
/// whether its line is opaque.
|
||||
fills: Vec<(u128, Placement, bool, Option<String>, bool)>,
|
||||
/// More glyphs than [`MAX_LOST_FILLS`](Self::MAX_LOST_FILLS) were finished so.
|
||||
overflowed: bool,
|
||||
}
|
||||
|
||||
impl LostFills {
|
||||
/// The most glyphs kept, for bounded work and memory on hostile input.
|
||||
pub const MAX_LOST_FILLS: usize = 4096;
|
||||
|
||||
/// Add the glyphs `line` filled that a stroke may still go over.
|
||||
pub fn add(&mut self, line: &TextLine) {
|
||||
let opaque = line.opacity >= 0.999;
|
||||
for g in line.filled.get(line.stroked..).unwrap_or_default() {
|
||||
if self.fills.len() >= Self::MAX_LOST_FILLS {
|
||||
self.overflowed = true;
|
||||
return;
|
||||
}
|
||||
self.fills.push((g.font, g.at, g.actual.is_some(), line.glyph_text(g).map(str::to_string), opaque));
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether a stroke over glyph `text` drawn at `at` in `font` at `opacity` may be drawn over
|
||||
/// one of the glyphs ([`TextLine::fills_at`]).
|
||||
pub fn may_stroke(&self, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> bool {
|
||||
self.overflowed
|
||||
|| self.fills.iter().any(|(f, a, act, t, opaque)| may_stroke((*f, *a, *act, t.as_deref()), *opaque, font, at, opacity, text, actual))
|
||||
}
|
||||
}
|
||||
|
||||
/// Glyphs next to each other in one run that a stroke is drawn over, not yet restyled
|
||||
@@ -331,11 +386,11 @@ impl TextLine {
|
||||
text_bytes: 0,
|
||||
slots: vec![],
|
||||
authored: vec![],
|
||||
actual_fills: HashMap::new(),
|
||||
filled: vec![],
|
||||
stroked: 0,
|
||||
pending: None,
|
||||
last_at: at,
|
||||
last_closed: false,
|
||||
upright: None,
|
||||
column: false,
|
||||
ink: vec![],
|
||||
@@ -382,10 +437,10 @@ impl TextLine {
|
||||
let Some((last, _, run)) = self.runs.last_mut() else {
|
||||
self.runs.push((look.clone(), 0.0, text.to_string()));
|
||||
self.last_start = 0;
|
||||
self.record_actual_fill(look, at, content);
|
||||
self.record_filled(look, at, content);
|
||||
self.authored.extend(text.chars().map(|_| content.authored()));
|
||||
(self.upright, self.next, self.last, self.last_at) = (Some(upright), at.origin + down * at.size, at.origin, at);
|
||||
self.last_closed = false;
|
||||
return true;
|
||||
};
|
||||
let across = (at.origin - self.at.origin).dot(self.at.dir);
|
||||
@@ -420,12 +475,12 @@ impl TextLine {
|
||||
self.runs.push((look.clone(), 0.0, text.to_string()));
|
||||
self.last_start = 0;
|
||||
}
|
||||
self.record_actual_fill(look, at, content);
|
||||
self.record_filled(look, at, content);
|
||||
self.authored.extend(text.chars().map(|_| content.authored()));
|
||||
self.next = at.origin + down * at.size;
|
||||
self.last = at.origin;
|
||||
self.last_at = at;
|
||||
self.last_closed = false;
|
||||
true
|
||||
}
|
||||
|
||||
@@ -522,7 +577,6 @@ impl TextLine {
|
||||
self.runs.push((look.clone(), 0.0, text.to_string()));
|
||||
self.last_start = 0;
|
||||
}
|
||||
self.record_actual_fill(look, at, content);
|
||||
self.record_filled(look, at, content);
|
||||
self.text_bytes = self.text_bytes.saturating_add(text.len());
|
||||
if !pen {
|
||||
@@ -539,41 +593,38 @@ impl TextLine {
|
||||
}
|
||||
self.last = at.origin;
|
||||
self.last_at = at;
|
||||
self.last_closed = false;
|
||||
self.last_dir = at.dir;
|
||||
self.last_size = at.size;
|
||||
self.baseline.push(at.origin);
|
||||
true
|
||||
}
|
||||
|
||||
fn record_actual_fill(&mut self, look: &Look, at: Placement, content: TextContent<'_>) {
|
||||
if content.authored() && look.fill.is_some() {
|
||||
let run = matches!(content, TextContent::Actual(_)).then(|| self.runs.len().saturating_sub(1));
|
||||
self.actual_fills.insert((look.font, at.origin.x.to_bits(), at.origin.y.to_bits()), run);
|
||||
}
|
||||
}
|
||||
|
||||
/// Note glyph `content` just added to the last run, filled without a stroke, for a stroke
|
||||
/// drawn over it later.
|
||||
/// drawn over it later: a glyph of an ActualText span too, whose text is the replacement's
|
||||
/// (the first glyph's) or none.
|
||||
fn record_filled(&mut self, look: &Look, at: Placement, content: TextContent<'_>) {
|
||||
let len = content.text().len();
|
||||
if content.authored() || len == 0 || look.fill.is_none() || look.stroke.is_some() {
|
||||
if look.fill.is_none() || look.stroke.is_some() {
|
||||
return;
|
||||
}
|
||||
let run = self.runs.len().saturating_sub(1);
|
||||
self.filled.push(Filled { font: look.font, at, run, start: self.last_start, len });
|
||||
let (run, start) = (self.runs.len().saturating_sub(1), self.last_start);
|
||||
let (start, len, actual) = match content {
|
||||
TextContent::Mapped(text) if !text.is_empty() => (start, text.len(), None),
|
||||
TextContent::Mapped(_) => return,
|
||||
TextContent::Actual(_) => (0, 0, Some(true)),
|
||||
TextContent::Pen => (0, 0, Some(false)),
|
||||
};
|
||||
self.filled.push(Filled { font: look.font, at, run, start, len, actual });
|
||||
}
|
||||
|
||||
/// The reader fills a whole Tj/TJ before replaying its glyphs as strokes. A replay
|
||||
/// must neither consume the replacement nor rewind the pen. Only the first glyph's
|
||||
/// style belongs to the replacement; suppressed glyphs have no text to restyle.
|
||||
/// style belongs to the replacement; suppressed glyphs have no text to restyle. The stroke
|
||||
/// goes over the next glyph of the span filled in `font` at `at`, not stroked yet
|
||||
/// ([`stroke_filled_at`](Self::stroke_filled_at)).
|
||||
pub fn stroke_actual(&mut self, font: u128, at: Placement, stroke: TypeStroke, overprint: bool) -> bool {
|
||||
self.flush_stroke();
|
||||
let key = (font, at.origin.x.to_bits(), at.origin.y.to_bits());
|
||||
let Some(run) = self.actual_fills.remove(&key) else { return false };
|
||||
if let Some((look, ..)) = run.and_then(|i| self.runs.get_mut(i)) {
|
||||
(look.stroke, look.overprint_stroke) = (Some(stroke), overprint);
|
||||
}
|
||||
true
|
||||
let Some(index) = self.next_filled(0, font, at, 1.0, "", true) else { return false };
|
||||
self.stroke_filled_at(index, stroke, overprint)
|
||||
}
|
||||
|
||||
/// Has the baseline turned (more than about 3° from the first glyph to the last)?
|
||||
@@ -625,21 +676,35 @@ impl TextLine {
|
||||
// A stroke at another opacity than the fill's (`CA` and `ca` differ), or over a
|
||||
// translucent fill, is type of its own.
|
||||
let opaque = opacity >= 0.999 && self.opacity >= 0.999;
|
||||
let rest = if opaque { self.filled.get(self.stroked..) } else { None };
|
||||
let found = rest.and_then(|rest| {
|
||||
rest.iter().position(|g| {
|
||||
g.font == font
|
||||
&& g.at.same_as(&at)
|
||||
&& self.runs.get(g.run).and_then(|(.., t)| t.get(g.start..g.start.saturating_add(g.len))) == Some(text)
|
||||
})
|
||||
});
|
||||
let Some(index) = found.map(|i| self.stroked.saturating_add(i)) else {
|
||||
let Some(index) = self.next_filled(0, font, at, opacity, text, false) else {
|
||||
// Stroked text of its own (stroke rendering): no later stroke goes back over the
|
||||
// glyphs filled before it, so no stroke looks through them again.
|
||||
self.stroked = self.filled.len();
|
||||
// Nor does a translucent stroke join the glyph just filled.
|
||||
return opaque && self.stroke_last(font, at, text, stroke, overprint);
|
||||
};
|
||||
self.stroke_filled_at(index, stroke, overprint)
|
||||
}
|
||||
|
||||
/// A stroke over the glyph filled at `index` in [`filled`](Self::filled), not stroked yet
|
||||
/// ([`next_filled`](Self::next_filled), [`last_filled`](Self::last_filled)): that glyph is
|
||||
/// stroked as [`stroke_filled`](Self::stroke_filled) strokes the glyph it finds, and no later
|
||||
/// stroke goes over the glyphs filled before it. `false`: there is no such glyph.
|
||||
/// A glyph of an ActualText span restyles its replacement's run at once, if it holds it.
|
||||
pub fn stroke_filled_at(&mut self, index: usize, stroke: TypeStroke, overprint: bool) -> bool {
|
||||
if index < self.stroked || index >= self.filled.len() {
|
||||
return false;
|
||||
}
|
||||
if let Some(g) = self.filled.get(index).copied()
|
||||
&& let Some(owner) = g.actual
|
||||
{
|
||||
self.flush_stroke();
|
||||
if let Some((look, ..)) = self.runs.get_mut(g.run).filter(|_| owner) {
|
||||
(look.stroke, look.overprint_stroke) = (Some(stroke), overprint);
|
||||
}
|
||||
self.stroked = index.saturating_add(1);
|
||||
return true;
|
||||
}
|
||||
let continues = self
|
||||
.pending
|
||||
.as_ref()
|
||||
@@ -661,6 +726,68 @@ impl TextLine {
|
||||
true
|
||||
}
|
||||
|
||||
/// The first glyph from index `from` of [`filled`](Self::filled) on, not stroked yet, that a
|
||||
/// stroke over glyph `text` drawn at `at` in `font` at `opacity` may be drawn over
|
||||
/// ([`fills_at`](Self::fills_at)). `None` for a translucent fill or stroke.
|
||||
pub fn next_filled(&self, from: usize, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> Option<usize> {
|
||||
let from = from.max(self.stroked);
|
||||
let i = self.filled.get(from..)?.iter().position(|g| self.fills(g, font, at, opacity, text, actual))?;
|
||||
Some(from.saturating_add(i))
|
||||
}
|
||||
|
||||
/// The last glyph before index `before` of [`filled`](Self::filled), not stroked yet, that a
|
||||
/// stroke over glyph `text` drawn at `at` in `font` at `opacity` may be drawn over
|
||||
/// ([`fills_at`](Self::fills_at)).
|
||||
pub fn last_filled(&self, before: usize, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> Option<usize> {
|
||||
let rest = self.filled.get(self.stroked..before.min(self.filled.len()))?;
|
||||
let i = rest.iter().rposition(|g| self.fills(g, font, at, opacity, text, actual))?;
|
||||
Some(self.stroked.saturating_add(i))
|
||||
}
|
||||
|
||||
/// Whether the glyph filled at `index` in [`filled`](Self::filled), not stroked yet, is one a
|
||||
/// stroke over glyph `text` drawn at `at` in `font` at `opacity` may be drawn over: opaque,
|
||||
/// in the same font, with the same placement and text. With `actual`, a stroke over a glyph
|
||||
/// of an ActualText span instead: a glyph of the span filled in the same font at the same
|
||||
/// origin, at any opacity ([`stroke_actual`](Self::stroke_actual)): the span's replacement
|
||||
/// text goes with the glyph filled first, so a translucent stroke kept apart from its fill
|
||||
/// would be type with no text, and come in as nothing.
|
||||
pub fn fills_at(&self, index: usize, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> bool {
|
||||
index >= self.stroked && self.filled.get(index).is_some_and(|g| self.fills(g, font, at, opacity, text, actual))
|
||||
}
|
||||
|
||||
/// How many glyphs the line filled for a stroke drawn over them later, stroked or not
|
||||
/// ([`filled`](Self::filled)).
|
||||
pub fn filled_len(&self) -> usize {
|
||||
self.filled.len()
|
||||
}
|
||||
|
||||
/// [`fills_at`](Self::fills_at) for glyph `g`.
|
||||
fn fills(&self, g: &Filled, font: u128, at: Placement, opacity: f32, text: &str, actual: bool) -> bool {
|
||||
let (fill, opaque) = ((g.font, g.at, g.actual.is_some(), self.glyph_text(g)), self.opacity >= 0.999);
|
||||
may_stroke(fill, opaque, font, at, opacity, text, actual)
|
||||
}
|
||||
|
||||
/// The text of filled glyph `g` in the line's runs.
|
||||
fn glyph_text(&self, g: &Filled) -> Option<&str> {
|
||||
self.runs.get(g.run).and_then(|(.., t)| t.get(g.start..g.start.saturating_add(g.len)))
|
||||
}
|
||||
|
||||
/// Whether a stroke drawn later may still be drawn over a glyph of the line (fill and stroke
|
||||
/// rendering): an opaque glyph filled and not stroked yet, or a filled glyph of an
|
||||
/// ActualText span ([`stroke_actual`](Self::stroke_actual)).
|
||||
pub fn awaits_stroke(&self) -> bool {
|
||||
self.filled.get(self.stroked..).is_some_and(|rest| rest.iter().any(|g| g.actual.is_some() || self.opacity >= 0.999))
|
||||
}
|
||||
|
||||
/// No stroke drawn from now on goes over a glyph the line filled so far: a stroke pass does
|
||||
/// not go back past a stroke of its own (one over no glyph filled) or the start or end of an
|
||||
/// ActualText span ([`stroke_filled`](Self::stroke_filled)). Nor does one restyle the glyph
|
||||
/// drawn last ([`stroke_last`](Self::stroke_last)).
|
||||
pub fn end_fills(&mut self) {
|
||||
self.stroked = self.filled.len();
|
||||
self.last_closed = true;
|
||||
}
|
||||
|
||||
/// Restyle the glyphs gathered for a stroke ([`stroke_filled`](Self::stroke_filled)): their
|
||||
/// text becomes a run of its own with the stroke, unless the run is stroked so already, and the
|
||||
/// text before and after it in the run keeps its stroke. Text that comes right after a run
|
||||
@@ -729,9 +856,6 @@ impl TextLine {
|
||||
for g in self.filled.iter_mut().skip(from) {
|
||||
(g.run, g.start) = moved(g.run, g.start);
|
||||
}
|
||||
for i in self.actual_fills.values_mut().flatten() {
|
||||
*i = moved(*i, 0).0;
|
||||
}
|
||||
if last {
|
||||
self.last_start = moved(run, self.last_start).1;
|
||||
}
|
||||
@@ -744,7 +868,14 @@ impl TextLine {
|
||||
/// ([`Look::takes`]): then the glyph's text becomes a run of its own with this stroke, and
|
||||
/// the glyphs before it stay unstroked (#7741). The line's text is the same either way, so
|
||||
/// the characters' slots, gaps and authored flags, kept along the whole line, still line up.
|
||||
///
|
||||
/// Not a glyph drawn before a boundary of stroke passes ([`end_fills`](Self::end_fills)):
|
||||
/// a stroke after the end of an ActualText span would otherwise stroke the span's replacement
|
||||
/// text, and one after its start a glyph filled before the span (#8543).
|
||||
fn stroke_last(&mut self, font: u128, at: Placement, glyph: &str, stroke: TypeStroke, overprint: bool) -> bool {
|
||||
if self.last_closed {
|
||||
return false;
|
||||
}
|
||||
self.flush_stroke();
|
||||
let start = self.last_start;
|
||||
let last_at = self.last_at;
|
||||
|
||||
@@ -346,3 +346,225 @@ fn glyphs_filled_and_stroked_one_by_one_stay_one_run() {
|
||||
assert_eq!(type_runs(content), [vec![("ABC".to_string(), true, true)]], "{content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Fill and stroke rendering of a `TJ` whose kerning starts a new line part way through: the
|
||||
/// reader fills every glyph of the operator before it strokes them, and each part comes in as
|
||||
/// type filled and stroked, in the order drawn, not as each part filled and then each part
|
||||
/// stroked over it (#8543). So too a `TJ` that jumps back to start a line before it and one whose
|
||||
/// kerning starts two new lines. In a span with replacement text (`ActualText`) it stays one type
|
||||
/// object, on the first glyph's line and in its style, filled and stroked; small kerning keeps
|
||||
/// one line as before.
|
||||
#[test]
|
||||
fn a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked() {
|
||||
// Each type object as its text, and whether all of it is filled and all of it stroked.
|
||||
let objects = |content: &str| -> Vec<(String, bool, bool)> {
|
||||
type_runs(content)
|
||||
.into_iter()
|
||||
.map(|runs| (runs.iter().map(|r| r.0.as_str()).collect(), runs.iter().all(|r| r.1), runs.iter().all(|r| r.2)))
|
||||
.collect()
|
||||
};
|
||||
let both = |text: &str| (text.to_string(), true, true);
|
||||
for mode in ["2", "6"] {
|
||||
let cases = [
|
||||
("/F1 48 Tf 20 80 Td [(AB) -3500 (CD)] TJ", vec![both("AB"), both("CD")]),
|
||||
("/F1 24 Tf 20 80 Td [(AB) -3500 (CD) -3500 (EF)] TJ", vec![both("AB"), both("CD"), both("EF")]),
|
||||
("/F1 24 Tf 200 80 Td [(AB) 6000 (CD)] TJ", vec![both("AB"), both("CD")]),
|
||||
("/F1 48 Tf 20 80 Td [(AB) -100 (CD)] TJ", vec![both("ABCD")]),
|
||||
// In a span with replacement text, which places all of its text with the first glyph.
|
||||
("/F1 48 Tf 20 80 Td /Span << /ActualText (ABCD) >> BDC [(AB) -3500 (CD)] TJ EMC", vec![both("ABCD")]),
|
||||
];
|
||||
for (show, want) in cases {
|
||||
let content = format!("BT {mode} Tr {show} 0 Tr ET");
|
||||
assert_eq!(objects(&content), want, "{content}: {:?}", type_runs(&content));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Stroke rendering (modes 1 and 5) of a `TJ` whose kerning starts a new line stays stroke only,
|
||||
/// one type object per line (#8543).
|
||||
#[test]
|
||||
fn a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only() {
|
||||
for mode in ["1", "5"] {
|
||||
let content = format!("BT {mode} Tr /F1 48 Tf 20 80 Td [(AB) -3500 (CD)] TJ 0 Tr ET");
|
||||
let want = [vec![("AB".to_string(), false, true)], vec![("CD".to_string(), false, true)]];
|
||||
assert_eq!(type_runs(&content), want, "{content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Translucent type filled and stroked by a `TJ` whose kerning starts a new line stays a filled
|
||||
/// object and a stroked one for each part, in the order the file draws them (#8015, #8543).
|
||||
#[test]
|
||||
fn a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart() {
|
||||
use vectorcraft_testkit::pdf::{PdfPage, pdf};
|
||||
let resources = "/Font << /F1 << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >> /ExtGState << /G << /ca 0.5 /CA 0.5 >> >>";
|
||||
let content = "/G gs 0 0 0 RG 1 1 0.8 rg 3 w BT 2 Tr /F1 48 Tf 20 80 Td [(AB) -3500 (CD)] TJ 0 Tr ET";
|
||||
let bytes = pdf(&[PdfPage { resources: resources.into(), ..PdfPage::new(300.0, 200.0, content) }], None);
|
||||
let d = import(&bytes).unwrap();
|
||||
let mut types = vec![];
|
||||
d.walk(|n| {
|
||||
if let NodeKind::Text(t) = &n.kind {
|
||||
let st = t.first_style();
|
||||
types.push((t.plain_text(), n.opacity < 1.0, !st.fill.is_none(), !st.stroke.is_none()));
|
||||
}
|
||||
});
|
||||
let part = |text: &str, fill: bool| (text.to_string(), true, fill, !fill);
|
||||
assert_eq!(types, [part("AB", true), part("CD", true), part("AB", false), part("CD", false)], "{content}");
|
||||
}
|
||||
|
||||
/// Fill and stroke rendering of a `TJ` whose kerning goes back to draw a glyph again where it
|
||||
/// drew one before, on a line of its own: the reader strokes the glyphs in the order it filled
|
||||
/// them, so each copy is filled and stroked, whether the copy drawn last ends the operator (the
|
||||
/// open line) or a line after it does (a finished one), and however often it comes back
|
||||
/// (#8543). A glyph filled and stroked by an operator of its own where one filled before stands
|
||||
/// still strokes only the one filled last (#8015).
|
||||
#[test]
|
||||
fn a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy() {
|
||||
let both = |text: &str| vec![(text.to_string(), true, true)];
|
||||
// Helvetica at 48 points: A and B are 667 units wide, so 4834 back after B (3500 on from A)
|
||||
// draws A again where the first A stands.
|
||||
for mode in ["2", "6"] {
|
||||
let cases = [
|
||||
("[(A) -3500 (B) 4834 (A)] TJ", vec![both("A"), both("B"), both("A")]),
|
||||
("[(A) -3500 (B) 4834 (A) -6000 (C)] TJ", vec![both("A"), both("B"), both("A"), both("C")]),
|
||||
("[(A) -3500 (B) 4834 (A) -3500 (B)] TJ", vec![both("A"), both("B"), both("A"), both("B")]),
|
||||
("[(A) -3500 (B) 4834 (A) -3500 (B) 4834 (A)] TJ", vec![both("A"), both("B"), both("A"), both("B"), both("A")]),
|
||||
];
|
||||
for (show, want) in cases {
|
||||
let content = format!("BT {mode} Tr /F1 48 Tf 20 80 Td {show} 0 Tr ET");
|
||||
assert_eq!(type_runs(&content), want, "{content}");
|
||||
}
|
||||
}
|
||||
let content = "BT 0 Tr /F1 48 Tf 20 80 Td [(A) -3500 (B) 4834] TJ 2 Tr (A) Tj 0 Tr ET";
|
||||
let want = [vec![("A".to_string(), true, false)], vec![("B".to_string(), true, false)], both("A")];
|
||||
assert_eq!(type_runs(content), want, "{content}");
|
||||
}
|
||||
|
||||
/// A stroke pass longer than the importer holds at once ([`MAX_HELD`] strokes) is matched to its
|
||||
/// own operator's glyphs, in the order filled: an `A` filled by an operator of its own, then `A`
|
||||
/// and 4,096 `B`s filled and stroked from the same place, strokes the second `A`, not the first
|
||||
/// (#8543).
|
||||
#[test]
|
||||
fn a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before() {
|
||||
let bs = "B".repeat(4096);
|
||||
let content = format!("BT /F1 2 Tf 1 0 0 1 20 80 Tm 0 Tr (A) Tj 1 0 0 1 20 80 Tm 2 Tr (A{bs}) Tj 0 Tr ET");
|
||||
let looks: Vec<Vec<(String, bool, bool)>> = type_runs(&content);
|
||||
let want = [vec![("A".to_string(), true, false)], vec![(format!("A{bs}"), true, true)]];
|
||||
assert!(looks == want, "{:?}", looks.iter().map(|t| t.iter().map(|r| (r.0.len(), r.1, r.2)).collect::<Vec<_>>()).collect::<Vec<_>>());
|
||||
}
|
||||
|
||||
/// Stroked type of its own (a stroke over no glyph filled) ends the stroke pass of the glyphs
|
||||
/// filled before it: an `A` filled, a `B` filled on a line of its own, a `C` stroked after the
|
||||
/// `B`, then a stroke over the `A` is type of its own, drawn last, not a stroke joined to the
|
||||
/// `A` drawn under the `B` and `C` (#8543).
|
||||
#[test]
|
||||
fn a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before() {
|
||||
let content = "BT /F1 48 Tf 1 0 0 1 20 80 Tm 0 Tr (A) Tj 1 0 0 1 20 140 Tm (B) Tj 1 Tr (C) Tj 1 0 0 1 20 80 Tm (A) Tj 0 Tr ET";
|
||||
let run = |text: &str, fill: bool, stroke: bool| (text.to_string(), fill, stroke);
|
||||
let want = [vec![run("A", true, false)], vec![run("B", true, false), run("C", false, true)], vec![run("A", false, true)]];
|
||||
assert_eq!(type_runs(content), want, "{content}");
|
||||
}
|
||||
|
||||
/// A stroke in an ActualText span goes over a glyph that span filled, not one an earlier span
|
||||
/// filled at the same place: each span's replacement text comes in (#8543).
|
||||
#[test]
|
||||
fn a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph() {
|
||||
let content = "BT /F1 48 Tf 0 Tr /Span << /ActualText (First) >> BDC 1 0 0 1 20 80 Tm (A) Tj EMC 1 0 0 1 20 140 Tm (B) Tj \
|
||||
/Span << /ActualText (Second) >> BDC 1 Tr 1 0 0 1 20 80 Tm (A) Tj EMC 0 Tr ET";
|
||||
let run = |text: &str, fill: bool, stroke: bool| vec![(text.to_string(), fill, stroke)];
|
||||
assert_eq!(type_runs(content), [run("First", true, false), run("B", true, false), run("Second", false, true)], "{content}");
|
||||
}
|
||||
|
||||
/// Fill and stroke rendering of a `TJ` that draws a glyph again where it drew one, in an
|
||||
/// ActualText span: the strokes go over the glyphs in the order filled, so the replacement text,
|
||||
/// on the first glyph's line and in its style, is filled and stroked, not left to the copy drawn
|
||||
/// last, which shows no text (#8543).
|
||||
#[test]
|
||||
fn a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement() {
|
||||
for mode in ["2", "6"] {
|
||||
for show in ["[(A) 667 (A)] TJ", "[(A) -500 (B) 1834 (A)] TJ", "[(A) -3500 (B) 4834 (A)] TJ"] {
|
||||
let content = format!("BT {mode} Tr /F1 48 Tf 20 80 Td /Span << /ActualText (ABA) >> BDC {show} EMC 0 Tr ET");
|
||||
assert_eq!(type_runs(&content), [vec![("ABA".to_string(), true, true)]], "{content}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The lines of type one operator's fill pass finishes are kept for its stroke pass up to 64 at
|
||||
/// a time: a `TJ` whose kerning starts 65 lines comes in as 65 type objects filled and stroked,
|
||||
/// and one that starts 66 as a filled object and a stroked one for each part, the fills first,
|
||||
/// as the file draws them (#8543).
|
||||
#[test]
|
||||
fn a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart() {
|
||||
let content = |n: usize| format!("BT 2 Tr /F1 4 Tf 20 80 Td [{}] TJ 0 Tr ET", vec!["(A)"; n].join(" -3500 "));
|
||||
let both = vec![("A".to_string(), true, true)];
|
||||
assert_eq!(type_runs(&content(65)), vec![both; 65]);
|
||||
let (fill, stroke) = (vec![("A".to_string(), true, false)], vec![("A".to_string(), false, true)]);
|
||||
let want: Vec<_> = std::iter::repeat_n(fill, 66).chain(std::iter::repeat_n(stroke, 66)).collect();
|
||||
assert_eq!(type_runs(&content(66)), want);
|
||||
}
|
||||
|
||||
/// A `TJ` over more lines than are kept whose last part draws its first glyph again at the first
|
||||
/// glyph's origin still comes in as a filled object and a stroked one for each part: the stroke
|
||||
/// over the first glyph, whose line was finished, doesn't take the last part's fill (#8543).
|
||||
#[test]
|
||||
fn a_tj_over_more_lines_than_are_kept_that_ends_where_it_began_stays_fill_and_stroke_apart() {
|
||||
// Helvetica's A is 667 units wide: 65 As and 64 kerns of 3,500 back to the first A's origin.
|
||||
let parts = vec!["(A)"; 65].join(" -3500 ");
|
||||
let content = format!("BT 2 Tr /F1 4 Tf 20 80 Td [{parts} 267355 (A)] TJ 0 Tr ET");
|
||||
let (fill, stroke) = (vec![("A".to_string(), true, false)], vec![("A".to_string(), false, true)]);
|
||||
let want: Vec<_> = std::iter::repeat_n(fill, 66).chain(std::iter::repeat_n(stroke, 66)).collect();
|
||||
assert_eq!(type_runs(&content), want);
|
||||
}
|
||||
|
||||
/// Type filled and stroked right after a `TJ` over more lines than are kept is filled and
|
||||
/// stroked as before, whether the `TJ` was filled and stroked or filled only (#8543).
|
||||
#[test]
|
||||
fn type_after_a_tj_over_more_lines_than_are_kept_is_filled_and_stroked() {
|
||||
let parts = vec!["(A)"; 66].join(" -3500 ");
|
||||
for mode in ["2", "0"] {
|
||||
let content = format!("BT /F1 4 Tf 20 80 Td {mode} Tr [{parts}] TJ 2 Tr /F1 48 Tf 1 0 0 1 40 150 Tm (B) Tj 0 Tr ET");
|
||||
let types = type_runs(&content);
|
||||
assert_eq!(types.len(), if mode == "2" { 133 } else { 67 }, "{content}");
|
||||
assert_eq!(types.last(), Some(&vec![("B".to_string(), true, true)]), "{content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The start and end of an ActualText span end the stroke pass of the glyphs filled before them,
|
||||
/// for the stroke over the glyph filled last too: a stroke after the span over the glyph its
|
||||
/// replacement text came with, or over a glyph filled before an empty span, is type of its own,
|
||||
/// and the glyph keeps its fill only (#8543).
|
||||
#[test]
|
||||
fn a_stroke_after_an_actual_text_span_does_not_take_a_glyph_filled_before_it() {
|
||||
let run = |text: &str, fill: bool, stroke: bool| vec![(text.to_string(), fill, stroke)];
|
||||
let cases = [
|
||||
"/Span << /ActualText (A) >> BDC 1 0 0 1 20 80 Tm (A) Tj EMC 1 Tr 1 0 0 1 20 80 Tm (A) Tj",
|
||||
"1 0 0 1 20 80 Tm (A) Tj /Span << /ActualText (B) >> BDC EMC 1 Tr 1 0 0 1 20 80 Tm (A) Tj",
|
||||
];
|
||||
for show in cases {
|
||||
let content = format!("BT /F1 48 Tf 0 Tr {show} 0 Tr ET");
|
||||
assert_eq!(type_runs(&content), [run("A", true, false), run("A", false, true)], "{content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A glyph stroked twice where it was drawn, by stroke rendering or by fill and stroke rendering
|
||||
/// then stroke rendering, is one type object, as before: a stroke over the glyph drawn last
|
||||
/// restyles it when nothing ended its stroke pass (#7741, #8015).
|
||||
#[test]
|
||||
fn a_glyph_stroked_again_where_it_was_drawn_stays_one_type_object() {
|
||||
for (show, fill) in [("1 Tr (A) Tj", false), ("2 Tr (A) Tj", true)] {
|
||||
let content = format!("BT /F1 48 Tf {show} 1 Tr 1 0 0 1 20 80 Tm (A) Tj 0 Tr ET").replace("Tf ", "Tf 1 0 0 1 20 80 Tm ");
|
||||
assert_eq!(type_runs(&content), [vec![("A".to_string(), fill, true)]], "{content}");
|
||||
}
|
||||
}
|
||||
|
||||
/// A stroke pass longer than the importer holds at once ([`MAX_HELD`] strokes) goes over its own
|
||||
/// operator's glyphs, filled right before it, also when an operator before it filled the same
|
||||
/// glyphs at the same places: `A` and 4,095 `B`s filled, then `A` and 4,096 `B`s filled and
|
||||
/// stroked from the same place strokes the second operator's glyphs, not the first one's (#8543).
|
||||
#[test]
|
||||
fn a_long_stroke_pass_does_not_take_the_same_glyphs_filled_by_an_operator_before() {
|
||||
let (before, now) = ("B".repeat(4095), "B".repeat(4096));
|
||||
let content = format!("BT /F1 2 Tf 1 0 0 1 20 80 Tm 0 Tr (A{before}) Tj 1 0 0 1 20 80 Tm 2 Tr (A{now}) Tj 0 Tr ET");
|
||||
let looks: Vec<Vec<(String, bool, bool)>> = type_runs(&content);
|
||||
let want = [vec![(format!("A{before}"), true, false)], vec![(format!("A{now}"), true, true)]];
|
||||
assert!(looks == want, "{:?}", looks.iter().map(|t| t.iter().map(|r| (r.0.len(), r.1, r.2)).collect::<Vec<_>>()).collect::<Vec<_>>());
|
||||
}
|
||||
@@ -78,6 +78,48 @@ pub fn anchor_buttons(app: &mut VectorcraftApp, ui: &mut Ui, controls: AnchorCon
|
||||
}
|
||||
}
|
||||
|
||||
/// The selected paths' eligible corners, as document lengths, beside the anchor controls.
|
||||
/// Explicit partial selections with no corners contribute no target (unlike `picked`'s fallback).
|
||||
fn corner_radius(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, reserve: f32) {
|
||||
let Some(st) = app.session.active() else { return };
|
||||
let mut items = Vec::new();
|
||||
let mut radius: Option<f64> = None;
|
||||
let mut mixed = false;
|
||||
for &id in &st.selection.objects {
|
||||
let Some(lc) = st.doc.node(id).and_then(vectorcraft_doc::LiveCorners::of) else { continue };
|
||||
let corners = st.selection.partial(id).map_or_else(|| lc.all(), |anchors| lc.corners_of(anchors));
|
||||
if corners.is_empty() {
|
||||
continue;
|
||||
}
|
||||
for &k in &corners {
|
||||
// Keep absolute requested radii, even when their drawing is fitted smaller. Relative
|
||||
// storage is a fraction, but the field and setLiveShape both consume document lengths.
|
||||
let value = if lc.radii_relative() { lc.radius(k) * lc.corner(k).map_or(0.0, |c| c.max_radius()) } else { lc.radius(k) };
|
||||
if let Some(first) = radius {
|
||||
mixed |= (first - value).abs() >= 1e-9;
|
||||
} else {
|
||||
radius = Some(value);
|
||||
}
|
||||
}
|
||||
items.push(json!({"id": id, "corners": corners}));
|
||||
}
|
||||
if items.is_empty() {
|
||||
return;
|
||||
}
|
||||
let label = tl!("Corner Radius:");
|
||||
let text = egui::RichText::new(label).size(12.0).color(t.text);
|
||||
if ui.available_width() < row_width(ui, &[widgets::text_width(ui, text.clone()), INLINE_FIELD_WIDTH]) + reserve {
|
||||
return;
|
||||
}
|
||||
widgets::field_label(ui, text);
|
||||
let shown = if mixed { None } else { radius };
|
||||
let unit = app.session.general_unit();
|
||||
if let Some(radius) = widgets::num_field_named(ui, "cb-corner-radius", Some(label), shown, unit, INLINE_FIELD_WIDTH) {
|
||||
// App::run reports any command failure in the status bar, as the other inline fields do.
|
||||
app.run("object.setLiveShape", json!({"items": items, "radius": radius.max(0.0)})).ok();
|
||||
}
|
||||
}
|
||||
|
||||
/// The id of the Control bar's isolation button.
|
||||
pub(super) const ISOLATION_BUTTON: &str = "cb-isolation";
|
||||
|
||||
@@ -1035,6 +1077,8 @@ fn contents(app: &mut VectorcraftApp, ui: &mut Ui, t: &Tokens, bar: egui::Rect,
|
||||
}
|
||||
if anchors != AnchorControls::None && group_on(app, "anchors") {
|
||||
anchor_buttons(app, ui, anchors);
|
||||
let reserve = transform_reserve(app, ui, !sel.is_empty());
|
||||
corner_radius(app, ui, t, reserve);
|
||||
}
|
||||
let object_options = group_on(app, "objectOptions");
|
||||
if object_options {
|
||||
|
||||
@@ -96,6 +96,7 @@ pub fn open(app: &mut VectorcraftApp) -> Result<Value, String> {
|
||||
fields.insert("printer".into(), json!(default));
|
||||
fields.insert("toFile".into(), json!(!printers["service"].as_bool().unwrap_or(false)));
|
||||
fields.insert("__printers".into(), printers);
|
||||
app.ui.print_direct_pdf = false;
|
||||
fields.insert("__section".into(), json!(SECTIONS[0]));
|
||||
fields.insert("__sheet".into(), json!(0));
|
||||
// The saved preset these settings are, if any (else [Default], shown as [Custom] if they differ).
|
||||
@@ -217,7 +218,16 @@ fn confirm(app: &mut VectorcraftApp, d: &Dialog) -> Result<Value, String> {
|
||||
app.ui.dialog = None;
|
||||
return Ok(json!({ "settings": settings }));
|
||||
}
|
||||
let r = crate::print::run(app, &json!({ "settings": settings, "printer": d.str("printer"), "toFile": d.bool("toFile") }))?;
|
||||
let direct_pdf = app.ui.print_direct_pdf;
|
||||
let r = crate::print::run(
|
||||
app,
|
||||
&json!({
|
||||
"settings": settings,
|
||||
"printer": d.str("printer"),
|
||||
"toFile": d.bool("toFile"),
|
||||
"directPdf": direct_pdf,
|
||||
}),
|
||||
)?;
|
||||
app.ui.dialog = None;
|
||||
Ok(r)
|
||||
}
|
||||
@@ -372,6 +382,11 @@ fn printer_row(app: &mut VectorcraftApp, ui: &mut egui::Ui, d: &mut Dialog) {
|
||||
app.status(e);
|
||||
}
|
||||
});
|
||||
if service && cfg!(windows) {
|
||||
let to_file = d.bool("toFile");
|
||||
ui.add_enabled(!to_file, egui::Checkbox::new(&mut app.ui.print_direct_pdf, "Send PDF directly (bypass driver)"));
|
||||
note(ui, "Writes the print-ready PDF to the printer's TCP/IP RAW port, for PCL-only drivers that change the custom page size.");
|
||||
}
|
||||
}
|
||||
|
||||
/// `print.preview` of `settings` (an error when they can't print), cached until they or the
|
||||
|
||||
@@ -659,7 +659,7 @@ enum SpectrumHit {
|
||||
fn spectrum(ui: &mut Ui, mode: Mode, size: egui::Vec2) -> Option<SpectrumHit> {
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let (r, _) = ui.allocate_exact_size(size, Sense::hover());
|
||||
let resp = ui.interact(r, ui.scope_id().with("color-spectrum"), Sense::click_and_drag());
|
||||
let resp = ui.interact(r, ui.scope_id().with("color-spectrum"), Sense::click_and_drag()).on_hover_text(tl!(mode.label()));
|
||||
ui.painter().add(widgets::color_mesh(r, (72, 12), &|x, y| to32(&spectrum_at(mode, x, y))));
|
||||
ui.painter().rect_stroke(r, 0.0, Stroke::new(1.0, t.border), StrokeKind::Outside);
|
||||
if let Some(p) = resp.hover_pos() {
|
||||
|
||||
@@ -26,6 +26,9 @@ pub struct PrintJob<'a> {
|
||||
/// The job's name in the print queue.
|
||||
pub title: &'a str,
|
||||
pub pdf: &'a [u8],
|
||||
/// Send the PDF to the printer's own PDF interpreter over its RAW TCP port instead of
|
||||
/// spooling it through the platform driver (Windows).
|
||||
pub direct_pdf: bool,
|
||||
}
|
||||
|
||||
/// Submission callable from the desktop background worker.
|
||||
@@ -105,6 +108,7 @@ pub fn run(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
let pdf = data.as_ref().and_then(Value::as_str).and_then(vectorcraft_format::base64_decode).ok_or("the print job has no data")?;
|
||||
let title = app.session.active().map(|d| d.title()).unwrap_or_default();
|
||||
let printer = s("printer").filter(|n| !n.is_empty());
|
||||
let direct_pdf = p.get("directPdf").and_then(Value::as_bool).unwrap_or(false);
|
||||
let service = app.services.print.as_mut().ok_or("no print service")?;
|
||||
if let Some(submit) = service.shared_print() {
|
||||
let pending_printer = printer.clone();
|
||||
@@ -114,7 +118,8 @@ pub fn run(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
format!("Printing {title}"),
|
||||
None,
|
||||
move |_| {
|
||||
submit(&PrintJob { printer: printer.as_deref(), title: &title, pdf: &pdf }).map(|note| json!({ "note": note, "printer": printer }))
|
||||
submit(&PrintJob { printer: printer.as_deref(), title: &title, pdf: &pdf, direct_pdf })
|
||||
.map(|note| json!({ "note": note, "printer": printer }))
|
||||
},
|
||||
move |app, result| {
|
||||
let receipt = result?;
|
||||
@@ -135,7 +140,7 @@ pub fn run(app: &mut VectorcraftApp, p: &Value) -> Result<Value, String> {
|
||||
}
|
||||
return Ok(v);
|
||||
}
|
||||
let done = service.print(&PrintJob { printer: printer.as_deref(), title: &title, pdf: &pdf })?;
|
||||
let done = service.print(&PrintJob { printer: printer.as_deref(), title: &title, pdf: &pdf, direct_pdf })?;
|
||||
app.status(done);
|
||||
v["printer"] = json!(printer);
|
||||
v["printed"] = json!(true);
|
||||
|
||||
@@ -394,6 +394,10 @@ pub struct UiState {
|
||||
#[serde(rename = "language", skip_serializing)]
|
||||
pub legacy_language: Option<String>,
|
||||
pub brightness: Brightness,
|
||||
/// The Print dialog's opt-in direct-PDF transport. UI-only and not serialized: the control
|
||||
/// channel cannot enable a print that bypasses the printer driver.
|
||||
#[serde(skip)]
|
||||
pub print_direct_pdf: bool,
|
||||
pub dock_tab: DockTab,
|
||||
/// Tab order in the dock's tabbed group when it differs from [`DockTab::ALL`].
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
@@ -1181,6 +1185,7 @@ impl Default for UiState {
|
||||
Self {
|
||||
legacy_language: None,
|
||||
brightness: Brightness::MediumDark,
|
||||
print_direct_pdf: false,
|
||||
dock_tab: DockTab::Properties,
|
||||
dock_tab_order: Vec::new(),
|
||||
dock_collapsed: false,
|
||||
|
||||
@@ -4,12 +4,14 @@
|
||||
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
use egui::{Rect, vec2};
|
||||
use serde_json::json;
|
||||
use vectorcraft_color::Color;
|
||||
use vectorcraft_color::cms::{self, ColorSettings, DISPLAY_P3, PROPHOTO_RGB, SRGB, WIDE_GAMUT_RGB};
|
||||
use vectorcraft_engine::Session;
|
||||
use vectorcraft_tools::params::color_json;
|
||||
use vectorcraft_ui_egui::VectorcraftApp;
|
||||
use vectorcraft_ui_egui::panels::color::{Mode, components, from_components, hex_digits, parse_hex, web_safe};
|
||||
use vectorcraft_ui_egui::panels::color::{Mode, components, convert_to, from_components, hex_digits, parse_hex, show, web_safe};
|
||||
|
||||
// This integration binary contains only these tests; its app-wide CMS is independent of other
|
||||
// test binaries. Serialize its cases and restore settings even when an assertion fails.
|
||||
@@ -186,3 +188,169 @@ fn color_panel_slider_preserves_native_channels_and_undo() {
|
||||
harness.state_mut().run("edit.undo", json!({})).unwrap();
|
||||
native(harness.state().session.proxy_paints().0.color().unwrap(), [0.5, 0.3, 0.2]);
|
||||
}
|
||||
|
||||
/// An ordinary selected rectangle for Color panel hover and Shift-click checks.
|
||||
fn spectrum_app() -> VectorcraftApp {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 200, "height": 200})).unwrap();
|
||||
app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 50, "height": 50})).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
/// Every string actually painted by a headless frame, including a settled hover tooltip.
|
||||
fn spectrum_painted_texts(output: &egui::FullOutput) -> Vec<String> {
|
||||
fn collect(shape: &egui::Shape, texts: &mut Vec<String>) {
|
||||
match shape {
|
||||
egui::Shape::Text(t) => texts.push(t.galley.text().to_string()),
|
||||
egui::Shape::Vec(shapes) => shapes.iter().for_each(|shape| collect(shape, texts)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let mut texts = vec![];
|
||||
output.shapes.iter().for_each(|shape| collect(&shape.shape, &mut texts));
|
||||
texts
|
||||
}
|
||||
|
||||
/// Draw the real Color panel and return a point over its spectrum and the frame's text.
|
||||
fn spectrum_frame(
|
||||
app: &mut VectorcraftApp,
|
||||
ctx: &egui::Context,
|
||||
time: f64,
|
||||
events: Vec<egui::Event>,
|
||||
modifiers: egui::Modifiers,
|
||||
) -> (egui::Pos2, Vec<String>) {
|
||||
let screen = Rect::from_min_size(egui::Pos2::ZERO, vec2(260.0, 700.0));
|
||||
let events = std::iter::once(egui::Event::ModifiersChanged(modifiers)).chain(events).collect();
|
||||
let mut at = None;
|
||||
let input = egui::RawInput { screen_rect: Some(screen), time: Some(time), events, ..Default::default() };
|
||||
let mut output = ctx.run_ui(input, |ui| {
|
||||
show(app, ui);
|
||||
at = if app.ui.color_hide_options {
|
||||
// The existing hidden-options spectrum test uses this point right of the proxy.
|
||||
let row = ui.min_rect();
|
||||
Some(egui::pos2(row.right() - 4.0, row.center().y))
|
||||
} else {
|
||||
ctx.read_response(ui.scope_id().with("color-spectrum")).map(|r| r.rect.center())
|
||||
};
|
||||
});
|
||||
output.textures_delta.clear();
|
||||
(at.expect("the spectrum is drawn"), spectrum_painted_texts(&output))
|
||||
}
|
||||
|
||||
/// The panel's drawn text after the pointer has rested on or away from the spectrum.
|
||||
fn spectrum_hover_texts(app: &mut VectorcraftApp, ctx: &egui::Context, over: bool) -> (egui::Pos2, Vec<String>) {
|
||||
let away = egui::pos2(255.0, 695.0);
|
||||
let time = ctx.input(|i| i.time) + 1.0;
|
||||
let none = egui::Modifiers::NONE;
|
||||
let (at, _) = spectrum_frame(app, ctx, time, vec![egui::Event::PointerMoved(away)], none);
|
||||
let pos = if over { at } else { away };
|
||||
spectrum_frame(app, ctx, time + 0.1, vec![egui::Event::PointerMoved(pos)], none);
|
||||
// Allow the tooltip delay and its following layout pass, as the Appearance panel tests do.
|
||||
spectrum_frame(app, ctx, time + 2.0, vec![], none);
|
||||
(at, spectrum_frame(app, ctx, time + 2.1, vec![], none).1)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spectrum_tooltip_names_its_displayed_mode() {
|
||||
let _space = WorkingSpace::new(SRGB);
|
||||
for hidden in [false, true] {
|
||||
for mode in [Mode::Grayscale, Mode::Rgb, Mode::Hsb, Mode::Cmyk, Mode::WebSafe, Mode::Lab] {
|
||||
let mut app = spectrum_app();
|
||||
let color = convert_to(mode, &Color::rgb8(51, 102, 153));
|
||||
app.run("paint.setFill", json!({"color": color_json(&color), "keepModel": true})).unwrap();
|
||||
// Lab follows the selected paint even when the stored mode is RGB.
|
||||
app.ui.color_mode = Some(if mode == Mode::Lab { Mode::Rgb } else { mode });
|
||||
app.ui.color_hide_options = hidden;
|
||||
let ctx = egui::Context::default();
|
||||
ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1);
|
||||
let paints = app.session.proxy_paints();
|
||||
let undo = app.session.active().unwrap().history.undo.len();
|
||||
let (_, away) = spectrum_hover_texts(&mut app, &ctx, false);
|
||||
assert!(!away.iter().any(|text| text == mode.label()), "{mode:?}, hidden {hidden}: no tooltip away from the spectrum: {away:?}");
|
||||
let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true);
|
||||
assert_eq!(
|
||||
hovered.iter().filter(|text| text.as_str() == mode.label()).count(),
|
||||
1,
|
||||
"{mode:?}, hidden {hidden}: the tooltip names the displayed mode: {hovered:?}"
|
||||
);
|
||||
let (_, away) = spectrum_hover_texts(&mut app, &ctx, false);
|
||||
assert!(!away.iter().any(|text| text == mode.label()), "{mode:?}, hidden {hidden}: the tooltip hides again: {away:?}");
|
||||
assert_eq!(app.session.proxy_paints(), paints, "hovering changes no paint");
|
||||
assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "hovering adds no undo step");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spectrum_tooltip_follows_shift_cycle_without_painting() {
|
||||
let _space = WorkingSpace::new(SRGB);
|
||||
for hidden in [false, true] {
|
||||
let mut app = spectrum_app();
|
||||
app.run("paint.setFill", json!({"color": "#336699"})).unwrap();
|
||||
app.ui.color_mode = Some(Mode::Rgb);
|
||||
app.ui.color_hide_options = hidden;
|
||||
let ctx = egui::Context::default();
|
||||
ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1);
|
||||
let paints = app.session.proxy_paints();
|
||||
let undo = app.session.active().unwrap().history.undo.len();
|
||||
let (pos, hovered) = spectrum_hover_texts(&mut app, &ctx, true);
|
||||
assert!(hovered.iter().any(|text| text == "RGB"));
|
||||
let modifiers = egui::Modifiers::SHIFT;
|
||||
let button = |pressed| egui::Event::PointerButton { pos, button: egui::PointerButton::Primary, pressed, modifiers };
|
||||
let time = ctx.input(|i| i.time) + 1.0;
|
||||
spectrum_frame(&mut app, &ctx, time, vec![egui::Event::PointerMoved(pos), button(true)], modifiers);
|
||||
spectrum_frame(&mut app, &ctx, time + 0.1, vec![button(false)], modifiers);
|
||||
spectrum_frame(&mut app, &ctx, time + 0.2, vec![], egui::Modifiers::NONE);
|
||||
assert_eq!(app.ui.color_mode, Some(Mode::Hsb));
|
||||
let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true);
|
||||
assert!(hovered.iter().any(|text| text == "HSB") && !hovered.iter().any(|text| text == "RGB"), "hidden {hidden}: {hovered:?}");
|
||||
assert_eq!(app.session.proxy_paints(), paints, "RGB to HSB changes no paint");
|
||||
assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "cycling to HSB adds no undo step");
|
||||
}
|
||||
}
|
||||
|
||||
/// Spectrum hover text uses the selected UI language, in both panel layouts.
|
||||
#[test]
|
||||
fn spectrum_tooltip_uses_the_interface_language() {
|
||||
use vectorcraft_ui_egui::i18n::{self, Lang};
|
||||
|
||||
// i18n is process-global in this integration binary. Every case holds the CMS lock.
|
||||
// Restore the language before WorkingSpace releases that lock, including after a panic.
|
||||
let _space = WorkingSpace::new(SRGB);
|
||||
struct Language(Lang);
|
||||
impl Drop for Language {
|
||||
fn drop(&mut self) {
|
||||
i18n::set_current(self.0);
|
||||
}
|
||||
}
|
||||
let _language = Language(i18n::current());
|
||||
let german = Lang::from_code("de").unwrap();
|
||||
let mode = Mode::Grayscale;
|
||||
let expected = "Graustufen";
|
||||
assert_eq!(i18n::tr(german, mode.label()), expected, "use an existing, distinct catalog translation");
|
||||
|
||||
for hidden in [false, true] {
|
||||
let mut app = spectrum_app();
|
||||
app.session.prefs.interface_language = german.code().into();
|
||||
// The host normally does this in tick_frame; this harness draws the panel directly.
|
||||
assert_eq!(app.ui_language(), german);
|
||||
i18n::set_current(app.ui_language());
|
||||
let color = convert_to(mode, &Color::rgb8(51, 102, 153));
|
||||
app.run("paint.setFill", json!({"color": color_json(&color), "keepModel": true})).unwrap();
|
||||
app.ui.color_mode = Some(mode);
|
||||
app.ui.color_hide_options = hidden;
|
||||
let ctx = egui::Context::default();
|
||||
ctx.global_style_mut(|style| style.interaction.tooltip_delay = 0.1);
|
||||
let paints = app.session.proxy_paints();
|
||||
let undo = app.session.active().unwrap().history.undo.len();
|
||||
let (_, away) = spectrum_hover_texts(&mut app, &ctx, false);
|
||||
assert!(!away.iter().any(|text| text == expected), "hidden {hidden}: no translated tooltip away: {away:?}");
|
||||
let (_, hovered) = spectrum_hover_texts(&mut app, &ctx, true);
|
||||
assert_eq!(hovered.iter().filter(|text| text.as_str() == expected).count(), 1, "hidden {hidden}: translated tooltip: {hovered:?}");
|
||||
assert!(!hovered.iter().any(|text| text == mode.label()), "hidden {hidden}: no untranslated tooltip: {hovered:?}");
|
||||
let (_, away) = spectrum_hover_texts(&mut app, &ctx, false);
|
||||
assert!(!away.iter().any(|text| text == expected), "hidden {hidden}: translated tooltip hides again: {away:?}");
|
||||
assert_eq!(app.session.proxy_paints(), paints, "translated hover changes no paint");
|
||||
assert_eq!(app.session.active().unwrap().history.undo.len(), undo, "translated hover adds no undo step");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
//! Numeric selected-corner radii in the actual Control bar.
|
||||
// Tests may unwrap/panic (AGENTS.md, Robustness).
|
||||
#![allow(clippy::unwrap_used, clippy::expect_used, clippy::panic)]
|
||||
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
|
||||
use egui::{Event, Rect, vec2};
|
||||
use serde_json::json;
|
||||
use vectorcraft_doc::NodeId;
|
||||
use vectorcraft_engine::Session;
|
||||
use vectorcraft_ui_egui::{VectorcraftApp, chrome, i18n, panels, theme};
|
||||
|
||||
static CASE: Mutex<()> = Mutex::new(());
|
||||
|
||||
struct Language {
|
||||
_lock: MutexGuard<'static, ()>,
|
||||
previous: i18n::Lang,
|
||||
}
|
||||
impl Language {
|
||||
fn english() -> Self {
|
||||
let lock = CASE.lock().unwrap_or_else(|e| e.into_inner());
|
||||
let previous = i18n::current();
|
||||
i18n::set_current(i18n::Lang::EN);
|
||||
Self { _lock: lock, previous }
|
||||
}
|
||||
}
|
||||
impl Drop for Language {
|
||||
fn drop(&mut self) {
|
||||
i18n::set_current(self.previous);
|
||||
}
|
||||
}
|
||||
|
||||
fn ordinary_corner() -> (VectorcraftApp, NodeId) {
|
||||
let mut app = VectorcraftApp::new(Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 500, "height": 400, "profile": null})).unwrap();
|
||||
// A plain, original Pen-like path, not a live rectangle.
|
||||
let result = app
|
||||
.run(
|
||||
"path.create",
|
||||
json!({"anchors": [
|
||||
{"x": 100, "y": 100}, {"x": 220, "y": 100},
|
||||
{"x": 220, "y": 180}, {"x": 100, "y": 180}
|
||||
], "closed": true}),
|
||||
)
|
||||
.unwrap();
|
||||
let id = NodeId(result["id"].as_u64().unwrap());
|
||||
app.select_tool("directSelection");
|
||||
app.run("select.anchors", json!({"id": id.0, "anchors": [[0, 1]], "mode": "set"})).unwrap();
|
||||
(app, id)
|
||||
}
|
||||
|
||||
struct Painted {
|
||||
nodes: Vec<egui::accesskit::Node>,
|
||||
texts: Vec<(String, Rect)>,
|
||||
}
|
||||
impl Painted {
|
||||
fn radius_field(&self) -> Option<&egui::accesskit::Node> {
|
||||
self.nodes.iter().find(|node| {
|
||||
node.role() == egui::accesskit::Role::TextInput && node.label().is_some_and(|name| name.trim_end_matches(':') == "Corner Radius")
|
||||
})
|
||||
}
|
||||
|
||||
fn has_text(&self, name: &str) -> bool {
|
||||
self.texts.iter().any(|(text, _)| text == name)
|
||||
}
|
||||
}
|
||||
|
||||
struct Frames {
|
||||
ctx: egui::Context,
|
||||
time: f64,
|
||||
width: f32,
|
||||
properties: bool,
|
||||
}
|
||||
impl Frames {
|
||||
fn new(width: f32, properties: bool) -> Self {
|
||||
let ctx = egui::Context::default();
|
||||
ctx.enable_accesskit();
|
||||
theme::install_fonts(&ctx);
|
||||
theme::apply(&ctx, theme::Brightness::MediumDark);
|
||||
Self { ctx, time: 0.0, width, properties }
|
||||
}
|
||||
|
||||
fn frame(&mut self, app: &mut VectorcraftApp, events: Vec<Event>) -> Painted {
|
||||
self.time += 0.05;
|
||||
let mut output = self.ctx.run_ui(
|
||||
egui::RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(egui::Pos2::ZERO, vec2(self.width, 1100.0))),
|
||||
time: Some(self.time),
|
||||
focused: true,
|
||||
events,
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
if self.properties {
|
||||
panels::properties::show(app, ui);
|
||||
} else {
|
||||
chrome::control_bar(app, ui);
|
||||
}
|
||||
},
|
||||
);
|
||||
let texts = output
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|clipped| match &clipped.shape {
|
||||
egui::Shape::Text(text) => Some((text.galley.text().to_owned(), Rect::from_min_size(text.pos, text.galley.size()))),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let nodes =
|
||||
output.platform_output.accesskit_update.take().map(|update| update.nodes.into_iter().map(|(_, node)| node).collect()).unwrap_or_default();
|
||||
output.textures_delta.clear();
|
||||
Painted { nodes, texts }
|
||||
}
|
||||
|
||||
fn settled(&mut self, app: &mut VectorcraftApp) -> Painted {
|
||||
self.frame(app, vec![]);
|
||||
self.frame(app, vec![]);
|
||||
self.frame(app, vec![])
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_radius_existing_anchor_controls_and_properties_remain_available() {
|
||||
let _language = Language::english();
|
||||
let (mut app, _) = ordinary_corner();
|
||||
let bar = Frames::new(1800.0, false).settled(&mut app);
|
||||
assert!(bar.has_text("Convert:") && bar.has_text("Anchors:"), "{:?}", bar.texts);
|
||||
assert!(bar.nodes.iter().any(|node| node.label() == Some("Remove Anchor Points")));
|
||||
let properties = Frames::new(360.0, true).settled(&mut app);
|
||||
assert!(properties.has_text("Corner Radius:"), "{:?}", properties.texts);
|
||||
assert!(properties.texts.iter().any(|(text, _)| text == "0 pt"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_radius_selected_ordinary_corner_has_a_named_control_bar_field() {
|
||||
let _language = Language::english();
|
||||
let (mut app, _) = ordinary_corner();
|
||||
let bar = Frames::new(1800.0, false).settled(&mut app);
|
||||
assert!(bar.radius_field().is_some(), "no named Corner Radius input in actual Control bar: {:?}", bar.texts);
|
||||
}
|
||||
|
||||
fn node_path(app: &VectorcraftApp, id: NodeId) -> vectorcraft_geom::PathData {
|
||||
app.session.doc().unwrap().doc.node(id).unwrap().path_data().unwrap().clone()
|
||||
}
|
||||
|
||||
fn corner_state(app: &VectorcraftApp, id: NodeId) -> (vectorcraft_geom::PathData, serde_json::Value, vectorcraft_doc::Selection, usize) {
|
||||
let state = app.session.doc().unwrap();
|
||||
let node = state.doc.node(id).unwrap();
|
||||
(node.path_data().unwrap().clone(), serde_json::to_value(node.live_shape()).unwrap(), state.selection.clone(), state.history.undo.len())
|
||||
}
|
||||
|
||||
fn picked_corner(app: &mut VectorcraftApp, id: NodeId, corner: usize, mode: &str) {
|
||||
let anchors = {
|
||||
let node = app.session.doc().unwrap().doc.node(id).unwrap();
|
||||
vectorcraft_doc::LiveCorners::of(node).unwrap().anchors_of(&std::collections::BTreeSet::from([corner]))
|
||||
};
|
||||
app.run("select.anchors", json!({"id": id.0, "anchors": anchors, "mode": mode})).unwrap();
|
||||
}
|
||||
|
||||
fn radius(app: &VectorcraftApp, id: NodeId, corner: usize) -> f64 {
|
||||
let node = app.session.doc().unwrap().doc.node(id).unwrap();
|
||||
vectorcraft_doc::LiveCorners::of(node).unwrap().radius(corner)
|
||||
}
|
||||
|
||||
fn field_text(painted: &Painted) -> &str {
|
||||
painted.radius_field().unwrap().value().unwrap_or_default()
|
||||
}
|
||||
|
||||
fn close(a: f64, b: f64) -> bool {
|
||||
(a - b).abs() < 1e-8
|
||||
}
|
||||
|
||||
impl Frames {
|
||||
fn edit_radius(&mut self, app: &mut VectorcraftApp, text: &str) -> Painted {
|
||||
let painted = self.settled(app);
|
||||
let bounds = painted.radius_field().unwrap().bounds().unwrap();
|
||||
let at = egui::pos2(((bounds.x0 + bounds.x1) / 2.0) as f32, ((bounds.y0 + bounds.y1) / 2.0) as f32);
|
||||
let button = |pressed| Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: egui::Modifiers::NONE };
|
||||
self.frame(app, vec![Event::PointerMoved(at), button(true)]);
|
||||
self.frame(app, vec![button(false)]);
|
||||
let command =
|
||||
egui::Modifiers { command: true, ctrl: !cfg!(target_os = "macos"), mac_cmd: cfg!(target_os = "macos"), ..egui::Modifiers::NONE };
|
||||
let key = |key, pressed, modifiers| Event::Key { key, physical_key: Some(key), pressed, repeat: false, modifiers };
|
||||
self.frame(app, vec![Event::ModifiersChanged(command), key(egui::Key::A, true, command)]);
|
||||
self.frame(app, vec![key(egui::Key::A, false, command), Event::ModifiersChanged(egui::Modifiers::NONE), Event::Text(text.into())]);
|
||||
self.frame(app, vec![key(egui::Key::Enter, true, egui::Modifiers::NONE)]);
|
||||
self.frame(app, vec![key(egui::Key::Enter, false, egui::Modifiers::NONE)]);
|
||||
self.settled(app)
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_radius_typing_edits_only_the_selected_corner_and_undo_restores_it() {
|
||||
let _language = Language::english();
|
||||
let (mut app, id) = ordinary_corner();
|
||||
app.run("object.setLiveShape", json!({"id": id.0, "corners": [1], "radius": 160, "kind": "chamfer"})).unwrap();
|
||||
picked_corner(&mut app, id, 1, "set");
|
||||
let before = corner_state(&app, id);
|
||||
let base = {
|
||||
let node = app.session.doc().unwrap().doc.node(id).unwrap();
|
||||
let corners = vectorcraft_doc::LiveCorners::of(node).unwrap();
|
||||
assert!(corners.drawn_radius(1) < corners.radius(1), "the stored request exceeds the fitted radius");
|
||||
corners.base.clone().into_owned()
|
||||
};
|
||||
let mut frames = Frames::new(1800.0, false);
|
||||
assert_eq!(field_text(&frames.settled(&mut app)), "160 pt", "show requested absolute radius, not fitted size");
|
||||
frames.edit_radius(&mut app, "6 pt");
|
||||
let state = app.session.doc().unwrap();
|
||||
let node = state.doc.node(id).unwrap();
|
||||
let corners = vectorcraft_doc::LiveCorners::of(node).unwrap();
|
||||
assert_eq!(&*corners.base, &base, "the uncut outline does not move");
|
||||
assert!(close(corners.radius(1), 6.0));
|
||||
assert_eq!(corners.kind(1), vectorcraft_geom::shapes::CornerKind::Chamfer);
|
||||
for corner in [0, 2, 3] {
|
||||
assert_eq!(corners.radius(corner), 0.0);
|
||||
assert_eq!(corners.kind(corner), vectorcraft_geom::shapes::CornerKind::Round);
|
||||
}
|
||||
let logical = std::collections::BTreeSet::from([1]);
|
||||
assert_eq!(state.selection.objects, vec![id]);
|
||||
assert_eq!(corners.corners_of(state.selection.partial(id).unwrap()), logical);
|
||||
assert_eq!(state.selection.partial(id).unwrap(), &corners.anchors_of(&logical));
|
||||
assert_eq!(state.history.undo.len(), before.3 + 1);
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(corner_state(&app, id), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_radius_mixed_targets_resolve_relative_units_and_skip_noncorner_partials() {
|
||||
let _language = Language::english();
|
||||
let (mut app, ordinary) = ordinary_corner();
|
||||
app.run("object.setLiveShape", json!({"id": ordinary.0, "corners": [1], "radius": 6})).unwrap();
|
||||
let result = app.run("shape.rectangle", json!({"x": 300, "y": 100, "width": 100, "height": 100})).unwrap();
|
||||
let live = NodeId(result["id"].as_u64().unwrap());
|
||||
app.run("object.setLiveShape", json!({"id": live.0, "relativeRadii": true, "radius": 10})).unwrap();
|
||||
let result = app
|
||||
.run(
|
||||
"path.create",
|
||||
json!({"anchors": [
|
||||
{"x": 300, "y": 250}, {"x": 400, "y": 250},
|
||||
{"x": 400, "y": 350, "in": [400, 330], "out": [400, 370]},
|
||||
{"x": 450, "y": 400}
|
||||
]}),
|
||||
)
|
||||
.unwrap();
|
||||
let excluded = NodeId(result["id"].as_u64().unwrap());
|
||||
let excluded_before = node_path(&app, excluded);
|
||||
let noncorners = std::collections::BTreeSet::from([(0, 0), (0, 2)]);
|
||||
{
|
||||
let node = app.session.doc().unwrap().doc.node(excluded).unwrap();
|
||||
let corners = vectorcraft_doc::LiveCorners::of(node).unwrap();
|
||||
assert!(!corners.all().is_empty(), "this path has another corner that fallback must not edit");
|
||||
assert!(corners.corners_of(&noncorners).is_empty(), "an endpoint and a smooth anchor are selected");
|
||||
}
|
||||
picked_corner(&mut app, ordinary, 1, "set");
|
||||
picked_corner(&mut app, live, 1, "add");
|
||||
app.run("select.anchors", json!({"id": excluded.0, "anchors": noncorners, "mode": "add"})).unwrap();
|
||||
app.run("document.setUnits", json!({"units": "Millimeters"})).unwrap();
|
||||
let mut frames = Frames::new(1800.0, false);
|
||||
assert!(field_text(&frames.settled(&mut app)).is_empty(), "6 pt and 10 pt are mixed");
|
||||
let depth = app.session.doc().unwrap().history.undo.len();
|
||||
let shown = frames.edit_radius(&mut app, "2 mm");
|
||||
let expected = 2.0 * 72.0 / 25.4;
|
||||
assert!(close(radius(&app, ordinary, 1), expected));
|
||||
assert_eq!(field_text(&shown), app.session.general_unit().format(expected));
|
||||
let node = app.session.doc().unwrap().doc.node(live).unwrap();
|
||||
let corners = vectorcraft_doc::LiveCorners::of(node).unwrap();
|
||||
assert!(corners.radii_relative());
|
||||
let maximum = corners.corner(1).unwrap().max_radius();
|
||||
assert!(close(corners.radius(1), expected / maximum));
|
||||
for corner in [0, 2, 3] {
|
||||
assert!(close(corners.radius(corner), 0.2));
|
||||
assert_eq!(radius(&app, ordinary, corner), 0.0);
|
||||
}
|
||||
assert_eq!(node_path(&app, excluded), excluded_before);
|
||||
assert!(app.session.doc().unwrap().doc.node(excluded).unwrap().live_shape().is_none());
|
||||
assert_eq!(app.session.doc().unwrap().history.undo.len(), depth + 1, "all targets in one edit");
|
||||
// With only the non-corner partial left, there is no eligible field.
|
||||
app.run("select.anchors", json!({"id": excluded.0, "anchors": noncorners, "mode": "set"})).unwrap();
|
||||
assert!(frames.settled(&mut app).radius_field().is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn corner_radius_respects_anchor_group_and_narrow_control_bar_space() {
|
||||
let _language = Language::english();
|
||||
let (mut app, id) = ordinary_corner();
|
||||
let mut wide = Frames::new(1800.0, false);
|
||||
assert!(wide.settled(&mut app).radius_field().is_some());
|
||||
app.run("window.control.options", json!({"group": "anchors", "visible": false})).unwrap();
|
||||
let hidden = wide.settled(&mut app);
|
||||
assert!(hidden.radius_field().is_none());
|
||||
assert!(!hidden.has_text("Corner Radius:"));
|
||||
app.run("window.control.options", json!({"group": "anchors", "visible": true})).unwrap();
|
||||
let narrow = Frames::new(400.0, false).settled(&mut app);
|
||||
assert!(narrow.radius_field().is_none());
|
||||
assert!(!narrow.has_text("Corner Radius:"), "the complete label and field are omitted together");
|
||||
let menu = narrow.nodes.iter().find(|node| node.label() == Some("Panel menu")).unwrap().bounds().unwrap();
|
||||
for node in narrow.nodes.iter().filter(|node| node.role() == egui::accesskit::Role::TextInput) {
|
||||
if let Some(bounds) = node.bounds() {
|
||||
assert!(bounds.x0 >= -0.5 && bounds.x1 <= menu.x0 + 0.5, "numeric control reaches past the panel menu: {bounds:?}");
|
||||
}
|
||||
}
|
||||
app.run("select.set", json!({"ids": [id.0]})).unwrap();
|
||||
app.select_tool("selection");
|
||||
assert!(wide.settled(&mut app).radius_field().is_none(), "ordinary whole-path Selection has no anchor controls");
|
||||
app.select_tool("pen");
|
||||
assert!(wide.settled(&mut app).radius_field().is_some(), "whole-path anchor-editing tools use all eligible corners");
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
# File format parity
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF export writes the document language as the catalog's `/Lang`, #3644; PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; scores and estimates unchanged; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, not butt caps and miter joins, #7741; `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; `.ai` and EPS import: a top-object envelope whose mesh saves its sides' curves in pieces draws its contents along each whole curve, as its drawn art does, #7097; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: `.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, over a Unicode CMap, set as live type; EPS import: CMap mappings to base-font codes and glyph names; EPS import: CID-Line truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (PDF import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF export writes the document language as the catalog's `/Lang`, #3644; PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; scores and estimates unchanged; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, not butt caps and miter joins, #7741; `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; `.ai` and EPS import: a top-object envelope whose mesh saves its sides' curves in pieces draws its contents along each whole curve, as its drawn art does, #7097; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: `.ai` and EPS import: type from the text document, type a PostScript program sets and legacy `.ai` type are set in an installed face of their font's PostScript name, exact name first, in the version a text document's record keeps; the `.ai` save writes a static font's version when its name alone gives another copy, #6983; `.ai` and EPS import: type keeps the manual kerning of its text document, #6899; `.ai` and EPS import: type in an envelope with Distort Appearance is also tried mapped from the box of what it paints, its strokes' miter tips and strokes a Transform effect moves included, after its glyphs grown by half its strokes' weight, #6824; `.ai` and EPS import: type filled or stroked with a pattern swatch keeps its pattern, from the art style its text document paint names, #6856; #6865: explicitly requested oversized editing artboard; PDF import: Indic type keeps its marks on their line, and a line whose type would not draw as the file does keeps the file's glyphs as outlines, #5235; previously: newly imported SVG/SVGZ titles are filtered and bounded without changing restored titles, #3626; `.ai` and EPS import, and what every export and `.ai` save draw: type's strokes in an envelope paint at their own weight along its bent outlines, Distort Appearance on or off, #6644; `.ai` and EPS import: centred and right-aligned lines of tracked type are aligned without the tracking after their last character, as the file's page aligns them, #6610; `.ai` and EPS import: an envelope saved in Edit Contents whose mesh lies away from its drawn art by a move opens live on that art, #6570; `.ai` save and open: layer colour presets Yellow, Magenta and Cyan keep their colour, as the `Lb` colour index now follows the file's numbering, #6502; `.ai` save: stroked type keeps its stroke's cap, join and miter limit in the text document, #6472; `.ai` and EPS import, PDF import: tracking and manual kerning in horizontally scaled type take the Horizontal Scale, as the file's page spaces such type; `.ai` and EPS import: stroked type in an envelope maps from its glyphs grown by half its stroke, #3179; `.ai` and EPS import: warps of type open as mesh envelopes on their saved grid, #3179; `.ai` and EPS import: stroked type keeps its stroke's cap, join and miter limit from the text document, #6472; `.ai` save: type in a variable font's named instance names its design-space setting, #6388; `.ai` and EPS import: envelopes of type open live where they draw as their drawn art and the layers with them draw as the page, #3179; `.ai` and EPS import: a note for type in an envelope, #3179; `.ai` and EPS import: the live envelope and warped type check sees white art; PDF import: DeviceN images of one ink or of process plates keep their inks, #6348; `.ai` import: images in a spot ink's Separation space keep their ink, #6350; PDF import: Separation images keep their ink, #6314; PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; PDF import: image masks open colorized by the color they are painted in, #6313; EPS and `.ai` editing data: a ligature the page names by a private-use glyph matches its text object; EPS import: CIDFonts only named, oveLine truncated
|
||||
>
|
||||
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
|
||||
|
||||
@@ -370,8 +370,8 @@ Stop opacity on translated artboards remains outside this regression coverage.
|
||||
- [ ] Exact redistribution of one replacement over several lines/styles, and general mixed-direction paragraph layout. Replacement uses the first placed glyph's line/style. Tags deeper than 128 and replacements over 64 KiB encoded (at most 192 KiB decoded) fall back to glyph mappings with a warning; an outer accepted owner survives deeper tags.
|
||||
|
||||
- [x] Stroked type (text rendering modes 1, 2, 5 and 6, with or without `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do; glyphs stroked with another cap, join or miter limit are a run of their own, also a glyph filled and then stroked otherwise than the run its fill joined (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). The dash array is not carried to the characters yet.
|
||||
- [x] Type filled and stroked by one text-showing operator (text rendering modes 2 and 6: the reader fills all of a `Tj` or `TJ`, every string of the array, before it strokes the same glyphs) comes in as one type object, filled and stroked, as it does glyph by glyph; a stroke over no filled glyph (modes 1 and 5, or stroked type of its own) stays stroke only (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Translucent type filled and stroked stays a filled object and a stroked one, as the file composites them apiece (`translucent_fill_and_stroke_text_stays_two_objects`). A glyph filled only right after one filled and stroked (`2 Tr (B) Tj 0 Tr (C) Tj`) joins the same type object filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`).
|
||||
- [ ] PDF type filled and stroked at less than full opacity as one type object, and a `TJ` whose kerning starts a new line part way through, filled and stroked: both still come in as a filled object and a stroked one (#8015).
|
||||
- [x] Type filled and stroked by one text-showing operator (text rendering modes 2 and 6: the reader fills all of a `Tj` or `TJ`, every string of the array, before it strokes the same glyphs) comes in as one type object, filled and stroked, as it does glyph by glyph; a stroke over no filled glyph (modes 1 and 5, or stroked type of its own) stays stroke only (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Translucent type filled and stroked stays a filled object and a stroked one, as the file composites them apiece (`translucent_fill_and_stroke_text_stays_two_objects`). A glyph filled only right after one filled and stroked (`2 Tr (B) Tj 0 Tr (C) Tj`) joins the same type object filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`). A `TJ` whose kerning starts a new line part way through (`[(AB) -3500 (CD)] TJ`) comes in as a type object filled and stroked for each part, also when it jumps back or starts two new lines, and when it draws a glyph again where it drew one (`[(A) -3500 (B) 4834 (A)] TJ`: each copy is stroked where it was filled), up to 65 lines in one operator (the 64 its fill pass finished, kept back, and the open one): past them each part stays a filled object and a stroked one, the fills first, as the file draws them (`a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart`), also when its last part draws its first glyph again where it began (`a_tj_over_more_lines_than_are_kept_that_ends_where_it_began_stays_fill_and_stroke_apart`), and type filled and stroked after it still comes in filled and stroked (`type_after_a_tj_over_more_lines_than_are_kept_is_filled_and_stroked`); in an `ActualText` span it stays one replacement type object, filled and stroked, on the first glyph's line and in its style, also when it draws a glyph again; stroked only (modes 1 and 5) it stays stroke only, and translucent it stays a filled object and a stroked one for each part (#8543, `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`, `a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy`, `a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement`, `a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only`, `a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart`). A stroke pass past the 4,096 strokes held at once still strokes its own operator's glyphs, also when an operator before it filled the same glyphs at the same places (`a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before`, `a_long_stroke_pass_does_not_take_the_same_glyphs_filled_by_an_operator_before`). A stroke after stroked type of its own, in another `ActualText` span, or after a span starts or ends, goes over no glyph filled before it, the glyph drawn last included: it stays type of its own, drawn in order, and each span keeps its replacement text (`a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before`, `a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph`, `a_stroke_after_an_actual_text_span_does_not_take_a_glyph_filled_before_it`).
|
||||
- [ ] PDF type filled and stroked at less than full opacity as one type object: it still comes in as a filled object and a stroked one (#8015).
|
||||
|
||||
- [x] Place from bytes or unlinked paths, and PDF clipboard paste, keep the selected page's live text. Synthetic two-page regressions in `crates/engine/src/cmd/fileio/tests_pdffidelity.rs` cover both sources, page selection and explicit outlines. The single-page importer honors the same text choice as Open; existing PDF fallback rules are unchanged.
|
||||
|
||||
@@ -383,9 +383,11 @@ Stop opacity on translated artboards remains outside this regression coverage.
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-18 | minor | PDF import (#8543): type filled and stroked (text rendering modes 2 and 6) by a `TJ` whose kerning starts a new line part way through came in as four type objects, each part filled only and each part stroked only over it: the reader fills every glyph of the operator before it strokes them, and the line the first part was gathered on was finished before the stroke pass came back to it. Lines an operator's fill pass finishes while a stroke may still be drawn over them are now kept (up to 64 besides the open line, so a `TJ` over up to 65 lines: one over more stays a filled object and a stroked one for each part, as before) until the stroke pass goes past them, and the pass's strokes are held (up to 4096: a longer pass is matched a part at a time, each part to glyphs filled one right after another, never to one an operator before it filled) until it ends, then matched to the glyphs filled last, in the order they were filled, so each stroke finds the glyph it was filled as, also where the `TJ` draws a glyph again where it drew one (`[(A) -3500 (B) 4834 (A)] TJ`). Each part comes in as one type object filled and stroked, in the order drawn; also a `TJ` that jumps back and one whose kerning starts two new lines. In an `ActualText` span (whose stroke was lost) the replacement text stays one type object on the first glyph's line and in its style, now filled and stroked, also where the `TJ` draws a glyph again: the span's strokes are matched the same way. A stroke over no filled glyph (stroked type of its own) and the start and end of an `ActualText` span end a stroke pass: no stroke after them goes over a glyph filled before them, so none is drawn under type drawn after it, and a later span keeps its own replacement text. Stroke rendering stays stroke only, and translucent type stays a filled object and a stroked one. Tests: `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`, `a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy`, `a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only`, `a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart`, `a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before`, `a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before`, `a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph`, `a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement`, `a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart`, `a_tj_over_more_lines_than_are_kept_that_ends_where_it_began_stays_fill_and_stroke_apart`, `type_after_a_tj_over_more_lines_than_are_kept_is_filled_and_stroked`; scores and estimates unchanged. |
|
||||
| 2026-11-18 | minor | PDF export (#3644): the document language chosen in Document Setup is written as the catalog's `/Lang` (BCP 47, `en-US` by default) and as XMP `dc:language`; a language without a tag writes none. Scores and estimates unchanged. |
|
||||
| 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. |
|
||||
| 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | `.ai` and EPS import: a path or compound path whose art style fills it with a pattern (alone, or among other fills and strokes) comes in as itself with that pattern fill instead of its drawn look (#8239). As for a stack's gradients, the pattern is taken only where the drawn look fills with it, once, and is placed as the look places it (type keeps taking its style's pattern from wherever its look paints with it, as before); a stack that fills with one pattern twice, or whose look doesn't fill with the pattern, keeps the drawn look. Under effects on the object a stack with a pattern fill keeps the drawn look too, a conservative rule: in one garment file a Scribble over such a fill drew unlike the look though the tiles were placed as the look's are, for a reason not established. In 200 garment files we own (used locally, never committed), 5 files have paths or compound paths under such styles: 11 objects in 3 files no longer come in as their drawn look; one file is held back by the effects rule; in one, the objects' styles aren't stacks for another reason, not looked into. One render changes, by 0.003% of its pixels, none past the threshold (why wasn't looked into). In another 224 garment files, nothing changes. Tests `a_path_with_a_style_pattern_fill_comes_in_as_the_path_with_it`, `a_style_pattern_fill_the_look_doesnt_paint_keeps_the_drawn_look`, `a_stack_with_one_pattern_twice_keeps_the_drawn_look`, `a_look_placing_a_stacks_pattern_twice_keeps_the_drawn_look`, `a_path_with_a_style_pattern_fill_under_an_effect_keeps_its_drawn_look` and `type_with_a_style_pattern_fill_takes_a_stroke_only_looks_placement` in `crates/eps/src/import/ai/tests.rs`. Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | PDF import: fill and stroke rendering (text rendering modes 2 and 6) draws all the glyphs of a text-showing operator (`Tj`, `TJ`, `'`, `"`) filled, then the same glyphs stroked, so a word shown at once came in as two type objects: a stroke-only copy over a fill-only one. Each stroke is now matched, in order, to the glyph filled with the same placement (where, how large, how wide, slanted and turned) in the same font with the same text on the line, and only that glyph takes the stroke, so the word comes in as one type object, filled and stroked; glyphs stroked with another join part way through still split into runs of their own, and stroked type over no filled glyph (modes 1 and 5) stays stroke only (#8015; `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Scores and estimates unchanged. |
|
||||
| 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) came in with butt caps, miter joins and a miter limit of 10 whatever the file stroked it with, while paths kept the graphics state's. The characters' stroke now takes the line cap (`J`), line join (`j`) and miter limit (`M`) of the graphics state, as a path's stroke does, and glyphs stroked with other ones start a run of their own, also a glyph filled and then stroked otherwise than the run its fill joined, so the glyphs before it keep their stroke (#7741). Test `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`. Scores and estimates unchanged. |
|
||||
| 2026-11-13 | minor | `.ai` and EPS import: layers that don't draw as the page, even with the drawn art of every live envelope put back, no longer put back the drawn art of every envelope of type. Each live envelope of type is weighed in the page check's own drawing of the pages it lies on, on the pixels that it and its drawn art ink there (the two drawn together on a layer of their own, without the rest of the layers; a pixel inks with an alpha above 8 of 255): it keeps its drawn art and its type, hidden, with the note, where the layers with it differ from the page in more of those pixels than its own check allows against its drawn art (10% of them, or 3% differing with all their neighbours, away from type), or where the envelopes of type that stay live, in the order they were read, would together differ there in more of a page than half of what the page check allows (a budget of the same size as the one their own checks share, kept apart from it). Art that differs elsewhere on the page no longer costs them their editable type; art that differs on their pixels still does. An envelope of type that a clip group or a clipping sublayer clips, an opacity mask masks, or a group with an appearance of its own, another envelope, a repeat or a blend holds keeps its drawn art as before, wherever it lies: drawn on its own it would be weighed elsewhere than it draws, and what holds it can draw it onto the page from off it. An envelope on no page stays live, as the page check doesn't see it, unless the page holds all the art that prints (an EPS's page that is its art's box, where art past the page is compared too): there one reaching past the page keeps its drawn art. Past 12 of them on the pages, all keep it. This holds where the editing data is trusted, where the objects that differ come in as the page's art (the placed files' other placement weighed on its own, as it draws them elsewhere under or over the envelopes; layers that draw as the page with only the envelopes the page holds put back are used as they are; where none of the objects that differ can then come in as the page's art, because an object holds type, the drawn art of every envelope of type is put back and that is tried again, as before), and for a `.ai` whose layers would open alone, which still opens alone: its envelopes of type are all settled again as they were with the page, in the same order and with the same checks, so each that opens live draws as it was weighed, and those the page held get their drawn art back. Where putting the drawn art of every live envelope back makes the layers draw as the page, it is still put back (#5065). In 224 users' files (used locally, never committed): envelopes of type that open live go from 174 to 186, in 8 files, none fewer in any file; no file changes between its layers and its PDF part; 7 renders change, by at most 0.7% of their pixels at 40 ppi (1 closer to the page, 1 alike, 5 further, by at most 0.7 of a percentage point, where VectorCraft's own envelope draws a little apart from the drawn art, within its check); the note for type in an envelope goes from 6 files. Of the 14 envelopes of type that had opened live and lost it to the page check, 2 keep their drawn art: one where the page draws something else where it is, and one in a file that comes in as its PDF part (#7141). Tests `build::candidate_tests::the_page_holds_back_only_envelopes_of_type_where_it_differs_from_them`, `envelopes_of_type_stay_live_within_half_of_what_the_page_check_allows`, `an_envelope_of_type_differing_in_more_of_its_pixels_than_its_check_allows_is_held_back`, `envelopes_of_type_the_layers_dont_draw_in_place_are_held_back`, `on_a_page_that_holds_all_the_art_an_envelope_of_type_past_it_is_held_back`, `objects_come_in_as_the_page_art_with_every_envelope_of_type_put_back_where_a_live_one_holds_a_difference`, `tests_native::layers_that_would_open_alone_keep_an_envelope_of_type_live_where_other_art_differs_from_the_page`, `layers_that_would_open_alone_keep_live_only_the_envelopes_of_type_the_page_doesnt_hold`, `trusted_layers_that_would_open_alone_open_alone_with_an_envelope_of_type_the_page_doesnt_hold_live`, `layers_with_objects_that_come_in_as_the_page_art_keep_an_envelope_of_type_that_draws_as_the_page_live`, `trusted_layers_keep_an_envelope_of_type_live_where_other_art_differs_from_the_page`, `trusted_layers_leave_an_envelope_of_type_the_page_draws_otherwise_its_drawn_art`, `build::candidate_tests::the_other_placement_of_placed_files_is_weighed_on_its_own`, `layers_that_draw_as_the_page_with_the_held_envelopes_of_type_put_back_are_used_so` |
|
||||
|
||||
+13
-9
@@ -1,6 +1,6 @@
|
||||
# Gaps
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradient and pattern; docs Overlap/auto-corners sync; estimate 12–22 h; previously minor: interim macOS cursor delivery, #2292; native validation pending; scores and estimates unchanged; previously minor: Control bar › Snapping includes the existing Snap to Glyph and Alignment Guides Line truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (G4 and G13 Missing lists drop the shipped Touch Type, Snap to Glyph and Dimension tool, and G13's snapping entry keeps only what is still missing, the partial Snapping panel and the items not yet checked (#8387); G13 keeps one estimate (13–23 h); estimates unchanged; previously: Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: G4 type: modal Check Spelling dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: Type: the Middle Eastern & South Asian composers are done as a per-paragraph choice with the Standard composers (#4935); G5: built-in Neon & Glow graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimate unchanged (3–13 h); previously: Tech Circuit brush library, G5; previously: G5: built-in Weather Icons symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow); estimate 5–15 → 4–14 h; previously: 3D: the seams of white-light Extrude & Bevel, Inflate and Rotate, and the face seams of the 3D (Classic) effects, have round joins instead of miters; previously: PDF import: preserve Type 3 font text runs as named groups <g>, or as live text in TextAs::Text mode if ToUnicode exists on non-colour fonts (TextAs::Outlines produces grouped outlines), #6740; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: oversized editing artboard import; Glyphs panel: Alternates for Current Selection applies an OpenType feature value (`salt=2`) to the selected letter alone, so an Arabic word stays joined, and Entire Font lists the unencoded glyphs, #5514; #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: G5: built-in Energy Beams brush library; estimate 5–15 → 4–14 h; previously minor: G5: built-in Skill Icons symbol library; estimate 6–16 → 5–15 h; previously minor: ruler double-click adds a guide at the pointer, #5239; G5: built-in Status Effects graphic style library; estimate 7–17 → 6–16 h; MCP docs catch-up for UI Frames and Map Markers; previously minor: G5: built-in Inventory Icons symbol library; estimate 8–18 → 7–17 h; previously minor: G9: `.ai` save names a variable font instance's design-space setting, #6388; previously minor: G5: built-in Game Trails brush library; estimate 9–19 → 8–18 h; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: docs tidy-up, no content change: stray notes at the top moved into the revision table; scores and estimates unchanged; previously minor: G5: built-in Game HUD graphic style library; estimate 10–20 → 9–19 h; previously minor: G5: built-in Map Markers symbol library; estimate 11–21 → 10–20 h; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview; estimate 1–2 h → 0; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authored ActualText once, including empty/nested spans and authored ordering (#6165); cross-line/style layout remains approximate; scores and estimates unchanged; PDF marked-text export (#6309): compatible glyphs stay on one layout line with per-glyph offsets; scores and estimates unchanged; G5: built-in UI Frames symbol library with default 9-slice; estimate 11–21 h; previously minor: G5: dynamic symbol part on-canvas takes opacity, blend, gradienLine truncated
|
||||
|
||||
> Selection update (2026-11-11): path and compound-path interiors follow enabled non-None fill rows, including lower fills beneath a top None row (#6625). Hidden-only interiors miss; zero-opacity fills remain selectable. Cap/join follow-up (2026-11-12): hidden-fill and no-fill stroke hits must respect cap and join geometry; focused cap/join CPU regressions passed. Scores and estimates unchanged.
|
||||
|
||||
@@ -618,15 +618,19 @@ macOS cursor delivery (#2292) is narrowed to a native host adapter using the exi
|
||||
deletes saved ones; `gradient.presets.*` commands.
|
||||
- **Improved (#6164):** Control bar › Snapping also exposes the existing Snap to Glyph and Alignment Guides
|
||||
toggles through their existing commands. Floating-panel parity remains unverified; the estimate is unchanged.
|
||||
- **Missing:** the consolidated
|
||||
snapping options (30.0); artboard colors in exports and print, and managing artboards from the canvas other
|
||||
than locking and unlocking them from the Artboard tool's right-click menu (30.0); the Blend panel with ease
|
||||
in/out and separate colour acceleration (30.7);
|
||||
the Dimension tool (28.x).
|
||||
- **Missing:** the rest of the snapping enhancements (29.8.1): forced snapping to the grid, showing guides while
|
||||
snapping, and limiting snapping to the active artboard or to isolated objects; the Snapping panel is partial
|
||||
(the Control bar's Snapping quick access exists, but there is no View › Snapping submenu and floating-panel
|
||||
parity is unverified, see [ui-parity.md](ui-parity.md)). The Smart Guides snapping tolerance and 30.0's Snap to
|
||||
Tangent and Snap to Perpendicular are done. Not yet checked: snapping to the endpoints, midpoints and centers of
|
||||
rotated objects, and the reworked Snap to Grid and Snap to Pixel feedback. Also missing: artboard colors in exports and print, and
|
||||
managing artboards from the canvas other than locking and unlocking them from the Artboard tool's right-click
|
||||
menu (30.0); the Blend panel with ease in/out and separate colour acceleration (30.7). The Dimension tool (28.x)
|
||||
is done ([dimensions.md](dimensions.md)).
|
||||
- **Evidence:** Adobe's 30.0 and 30.7 release announcements, see
|
||||
[target-app-parity.md](target-app-parity.md#how-this-was-measured-2026-10-10).
|
||||
- **Estimate:** 13–23 h.
|
||||
- **Estimate:** 14–24 h.
|
||||
[target-app-parity.md](target-app-parity.md#how-this-was-measured-2026-10-10); snapping:
|
||||
[Snapping enhancements in Illustrator](https://community.adobe.com/announcements-651/snapping-enhancements-in-illustrator-1546614).
|
||||
- **Estimate:** 13–23 h (estimated; a duplicate 14–24 h line is removed).
|
||||
|
||||
## G14 Pen hardware beyond Windows pressure
|
||||
|
||||
|
||||
@@ -49,6 +49,15 @@ pages before sending it to a printer. When printing that PDF, keep its page size
|
||||
than applying another fit-to-page reduction. For a sewing pattern, measure a known length on a
|
||||
printed sheet before printing the full job.
|
||||
|
||||
## Direct PDF on PCL-only printers
|
||||
|
||||
Some Windows PCL drivers rewrite a custom page to a different physical size; the HP DesignJet
|
||||
Z5200ps V4, for example, turns a 1067 x 480 mm page into a square PCL page. In **Print**, under
|
||||
**Printer**, turn on **Send PDF directly (bypass driver)**. VectorCraft then writes the print-ready
|
||||
PDF to the selected printer's Standard TCP/IP RAW port, so the printer's own PDF interpreter prints
|
||||
the PDF's page size. It needs a printer with PDF support and a RAW TCP/IP port; it bypasses the
|
||||
Windows driver's paper, colour and finishing settings. Leave it off for ordinary driver printing.
|
||||
|
||||
## Choose a tiling mode
|
||||
|
||||
| Scaling | How it divides the drawing | When to use it |
|
||||
|
||||
+3
-2
@@ -1,6 +1,6 @@
|
||||
# Roadmap: milestones and what's next
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell Check: `edit.autoSpellCheck` underlines the unknown words, #4936; previously minor: PDF editable import preserves authoLine truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: M1: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; M1: an Alt-drag in the Layers panel copies a row above or below its own place, #8237; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; M1: Layers panel Alt-drag shows the copy cursor, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: M7: Check Spelling modal dialog (Edit › Spelling › Check Spelling…), #4936; spell check complete; previously: PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); previously: Tech Circuit brush library, G5; previously: Graphic Styles list fills a taller panel, #2992; scores and estimates unchanged; previously: PDF import: glyphs in a span with an empty ActualText come in as outlines, #6971; scores and estimates unchanged; previously: library panels' lists fill a taller panel, #2992; scores and estimates unchanged; previously: Swatches list fills a taller panel, #1638; scores and estimates unchanged; previously: icon-strip flyouts also resize from the top edge and the canvas-side top corner, keeping the moved top in workspaces (storytold/craft-libs#1094); scores and estimates unchanged; previously: #6865: explicitly requested oversized editing artboard; Live Paint Bucket fills faces crossed in one drag (#6373); previously: #6404: transform-aware Eyedropper character copying; scores and estimates unchanged; previously: M10/G5: Energy Beams brush library; MCP docs list Energy Beams; previously minor: M10/G5: Skill Icons symbol library; MCP docs list Skill Icons; previously minor: M10/G5: Status Effects graphic style library; MCP docs catch-up for symbol libraries; previously minor: M10/G5: Inventory Icons built-in symbol library; previously minor: Edit › Edit Custom Dictionary…: its dialog adds, deletes and changes the custom dictionary's words, #4936; previously minor: M10/G5: Game HUD graphic style library; previously minor: resizable icon-strip flyouts and bottom-aligned panel footers, #5713; previously minor: M10/G5: Map Markers built-in symbol library; previously minor: right-click on type: Spelling › Auto Spell Check, with its check mark, #4936; previously minor: right-click on a word Auto Spell Check underlined: its suggestions, Ignore All and Add to Dictionary, #4936; previously minor: G2: Effect Gallery thumbnails and in-dialog preview are in; Auto Spell CheckLine truncated
|
||||
>
|
||||
> Oversized artboard import update (2026-11-12): Explicit editing-data import retains a single artboard beyond a capped 14,400 pt PDF page (#6865).
|
||||
>
|
||||
@@ -168,7 +168,7 @@ Gujarati interface follow-up (2026-11-14): the catalog and zero/one plural rule
|
||||
| M1 | Selection, transform, layers, MCP (common command tools, strict keys, session resources and version-aware result hints) | ✅ mostly done (path and compound-path interior selection follows enabled fill rows (#6625); a marquee leaves locked or hidden guide paths out inside groups, as clicks do (#8538); hidden-fill and no-fill stroke cap/join CPU regressions passed; document-tab artwork drag with lossless resource transfer and one target Undo; malformed MCP app replies discard the connection without replay, #1761; bounded control socket waits and connection-slot recovery, #1726; bounded synthetic control input, #1709; no-op anchor Align keeps Undo, Redo and saved state (#1180 follow-up); transform reference point snaps to anchors/centres; rotated objects keep a rotated bounding box and their angle; Free Transform, Scale and Reflect along a rotated box pending; the Transform fields take one Tab each, the W/H link after them) | 4–6 |
|
||||
| M2 | Drawing tools + smart guides | ✅ mostly done (Eraser preserves fill outside fixed and varied tip sweeps and Alt-drag marquees on fill-only open paths and keeps their compound holes; clipping masks retain surviving contours or empty geometry in the same node; ordinary Group/Layer paints and evaluated gradient placements are preserved when the stored paint reproduces their appearance; hidden Rasterize and Along/Across stroke rows do not block visible gradients; 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 (#6582); #3380 deletion creates independent selected path pieces and keeps bounds-fitted gradients in place; endpoint highlighting remains open; Polygon/Star exact-size count persistence, with repeated-drag, tool-switch and Cancel regression coverage; Curvature point markers without direction handles (#1236, in part); Direct Selection segment click/Delete preserves neighboring edges, #1278; Flare, Reshape, Live Corners widget dragging and per-corner radii and kinds landed, on any path's corners; Shaper rough-shape recognition and orientation steps, the remaining Pen modifier nuances; Shaper Groups with editable sources and separate fill/stroke edits landed; custom ruler origin with drag preview, active-artboard reset, relative X/Y fields and native round-trip (#1212); construction widget/refinements pending); a shape just drawn moves by its centre point and turns from the zone outside a corner with its tool still active (#5477); Tangent and straight-segment perpendicular snapping use saved Smart Guides Geometric Guides preferences and Control bar quick access (#2537), including the existing Snap to Glyph and Alignment Guides toggles (#6164); no View submenu; Copy and Cut with the Pen or Curvature tool take the anchors a Cmd/Ctrl-lent Direct Selection picked (#6123) | 12–18 |
|
||||
| M3 | Paint & appearance (swatches, color, gradient, stroke, appearance, transparency, styles) | ✅ done (M3.7–M3.98): swatches, groups, libraries, tints, Lab spots and Registration; Eyedropper copies transformed character dimensions (#6404) and styles highlighted text only (atomic transparency rejection); Eyedropper reads visible locked and outside-isolation sources (#1251); Color Picker, Color panel (its spectrum grows with a resized panel, #8005), Color Guide, Color Themes, Edit Colors and Recolor Artwork (screen-bounded Edit chip list, #3416; native Lab entry and swatch libraries in the picker, Assign-row menus, #8031/#4028); gradients that follow every transform, the annotator, linked stops, freeform gradients, focal points, gradients on strokes and Expand; visible strokes when paint is added to inherited None/zero-width art (#1253); stroke geometry, arrowheads, dashes fitted to corners, stroke on type, width profiles and the Width tool (Shift-double-click enables adjoining adjustment in Width Point Edit; finite-arithmetic follow-up regressions and full CI passed ([Validation evidence](target-app-parity.md#evidence-what-ships-today-by-area))), Scale Strokes and preview bounds; Appearance targeting, container appearance, target circles, Expand Appearance; knockout, isolation, blend accuracy, CMYK blending, overprint, Attributes, masks and clipping, Flatten Transparency; graphic styles, links and libraries; CSS library export preserves fractional linear and radial gradient stop positions. Left: freeform gradients in SVG/PDF, mixed spot/process gradients in SVG and PDF gradients mixing a spot color with RGB or Lab stops export as stops or process colors; PDF export writes dithered gradient fills with spot stops, and Perceptual spot gradients with RGB or Lab stops other than white or more than 4,096 stops on their curve, as images in process colors; confirm the Scale Strokes & Effects default; Recolor model selection is available through the engine and MCP only (#2520); the dialog retains its existing controls; Library panels' lists (swatch, Color Book, brush, symbol and graphic style libraries) fill a taller panel above its footer (#2992; scores and estimates unchanged); Graphic Styles list fills 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); | 4–8 |
|
||||
| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Production Preflight checks fonts, overflow, links and image resolution with clickable findings and automatic rechecking (VectorCraft addition; estimates unchanged); PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) |
|
||||
| M4 | Files (native, SVG, PDF, raster, Export for Screens, clipboard interop) | Production Preflight checks fonts, overflow, links and image resolution with clickable findings and automatic rechecking (VectorCraft addition; estimates unchanged); PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300; estimates unchanged); PDF import: type filled and stroked by one text-showing operator comes in as one filled and stroked type object (#8015; not for type filled and stroked at less than full opacity, which still comes in as a filled object and a stroked one, as the file composites them; estimates unchanged); PDF import: type filled and stroked by a `TJ` whose kerning starts a new line part way through comes in filled and stroked, a type object for each part, also where it draws a glyph again where it drew one, in an `ActualText` span too, where it stays one replacement type object on the first glyph's line and in its style; a `TJ` over more than 65 lines (the 64 its fill pass finished, kept back, and the open one) stays a filled object and a stroked one for each part (#8543; estimates unchanged); PDF import: stroked type keeps the file's line cap, line join and miter limit (#7741; estimates unchanged); Rename artboards in Export for Screens (#7275); Explicit editing-data import keeps oversized capped-page artboards (#6865; estimates unchanged); Save refusal continuation (#6146): ordinary Save offers Save As; unchanged format keeps options, changed format opens its Save options; cancellation/automation isolation; focused UI regressions passed, native acceptance pending; PDF authored ActualText preserved once in editable import (#6165; first-glyph line/style, bounded input; estimates unchanged); PDF export keeps harakat and zero-advance Noto Arabic dot glyphs in one compatible batch per layout line, with per-glyph vertical offsets (#6309). `crates/pdf/src/tests/realtext.rs` (`mark_text_*`) checks decoded cluster mappings, mixed Arabic/Latin/digits, contour placement against outline export, vertical columns, differing path rotations and PDF/X-1a/3/4. Editable-text import preserves authored ActualText separately (#6165), with cross-line/style layout limits; separately styled or differently rotated clusters and external viewer search/copy remain outside this export-only evidence. `.ai`/EPS type from the text document keeps its paragraphs' tab stops (#6147); `.ai`/EPS type from the text document keeps auto leading per line, its hyphenation options, and may show more of the last lines the file sets in an area frame of its own, when growing the frame by its lines' deepest descent plus 0.05 pt shows them (#6137); ✅ done (M4.14–M4.98 on 2026-10-05): Save As/Save a Copy/Revert/templates, Data Recovery and background save, SVG import and export fidelity (units, text, symbols, filters, SVGZ, Preserve Editing, SVG Options), shared guarded PDF writer and windowed reader ([pdf-backend.md](pdf-backend.md)), PDF import (colours, layers, masks, editable text, security) and export (presets, marks, bleed, ICC and output intent, raster effects, subset fonts, PDF/X-1a, X-3 and X-4, PDF layers, overprint, page thumbnails, fast web view, PDF 1.3), Place and Links, Package, EPS and DXF in and out (EPS legacy mesh corners, vector opacity masks and raster page comparison verified; closed SPLINE flags round-trip and circular paths export as native CIRCLE/ARC, #1299), EMF/WMF, TIFF/BMP/Targa/PSD/GIF/PNG-8 export, Print and print presets, slices, Save for Web, TIFF in Export for Screens and Asset Export, clipboard flavours, File Info; AF.1–AF.4 add Affinity import (native layers, artboards, vectors, text and images from Affinity 1–3 files; the embedded preview only as a warned fallback; AF.4 expands current `.af` fixtures and every-board round-trip validation); EPS Save and Save As keep an opened EPS as EPS with its page frame and complete editable VectorCraft document (2026-10-26; G9 import fidelity unchanged). Left: DWG (use DXF), PSD placement as layers, overprint read back from PDF, Affinity export, polish; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke, adding no text (#6971; scores and estimates unchanged); | 3–6 (existing scope; Affinity export unestimated) |
|
||||
| M5 | Performance | 🟡 background render + caches + MT done; `vectorcraft-cli bench` and `vectorcraft-cli perf` (budget suite); opaque solid-fill knockout paths draw once in hard-edge/supersampled raster export, with analytical-AA compositing unchanged; file format v2 opens 3× faster (50k paths: 722 → 244 ms); raster effects (glows, shadows, blur, feather) no longer force the whole frame single-threaded (filtered offscreen per effect, verified equal to the single-threaded reference); Craquelure/Mosaic Tiles/Stained Glass distance searches optimized with pixel-invariance checks and the `texture_drag_perf` probe (#1257); effect-heavy demos need a clean-machine benchmark; dirty-region rendering, GPU backend spike pending | 15–25 |
|
||||
| M6 | Path operations (Pathfinder, Shape Builder, offset…) | ✅ mostly done (live compound shapes: Make, Alt-click a Shape Mode, member modes, Release, Expand (#4522); single-result Pathfinder names and SVG IDs retained (#1293); Divide open-cutting-path geometry, appearance and history verified (#1307; existing segment cap remains); Simplify preview/counts and rewritten-path component selection verified (#1272; the slider opens at the Auto-Simplify level; a Direct Selection part of a path simplifies on its own); Compound appearance and member fill-rule edits verified (#1197); Boolean precision on almost-horizontal edges fixed and the property tests made deterministic; Shape Builder gap detection, large-offset bug open); 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 | 3–6 |
|
||||
| M7 | Type (point/area/path, editing, styles, OpenType, threading, glyphs) | Spell check engine: `text.spelling.check` and `text.spelling.suggest` on craft-proof, the custom dictionary and Ignore All commands, Auto Spell Check with its right-click suggestions, Ignore All and Add to Dictionary, Spelling › Auto Spell Check in the context menu of type, the Edit Custom Dictionary dialog, and the modal Check Spelling dialog (Edit › Spelling › Check Spelling…, `Cmd+I`, `ui.checkSpelling`, #4936); 🟡 Retype phase 1: `type.retype` turns outlined text that exactly matches an available font back into point text (#4934); Right-aligned area type sets the text after a line's last tab against the right edge, the text before it at its stops (#6147); A line a soft return ends is justified as a wrapped line is (#6137); Indian-language pattern hyphenation preserves syllables in both composers (#4947); 🟡 Hanging punctuation keeps its published amounts under Glyph Scaling, and Standard burasagari counts a hung line start as room; Fullwidth `!` / `?` keep an upright fallback in vertical type; Hyphenation… and Justification… per paragraph (#2310, #2755), Auto Leading also driving the Character panel's Leading, the Alt+↑/↓ leading nudge and Fill with Placeholder Text; Document-point character controls after object/group scaling (#1034; optional font-size preservation remains separate), Character/Paragraph Styles (explicit Auto-leading resets and local leading overrides), per-paragraph paragraph attributes, mixed paragraph alignment indication (headless regressions, full integration CI and visual review pass), Area Type Options (with Width/Height, Auto Size and Shrink Text to Fit; overflow reported to agents and vertical Align), type areas resized by their handles and reshaped with Direct Selection, threaded text, Fit Headline, Glyphs (feature-valued alternates and unencoded glyphs applied in one Undo step while keeping Arabic joining, #5514), OpenType panel (including font-defined Stylistic Sets), Find Font (Document, Recent and System replacement sources, #5217), installed system fonts in every font menu (fonts registered with Windows outside its font folders, the XDG and Flatpak host font folders on Linux, and fonts installed while the app runs, listed when it comes back to the front; searchable; the Character and Properties menus show each family's sample of the selected text, preview it live under the pointer or ↑/↓, show recently applied families first (#3515), filter by script and kind, list a family's styles, and star favourites; the Glyphs panel and Find Font's Replace With use the same menu without the live preview) and found by name on open/import (full-name aliases and Missing Fonts searches verified, #1258; Windows font-service QA pending), variable fonts' named instances as styles, CJK names in the UI, input methods (marked text in place, candidate window at the caret; Japanese IME), Text Wrap (offset, invert, both sides of an object; follows edits), Type on a Path effects and Options with draggable start/centre/end brackets (slide, flip), tab stops + Tabs panel (Above Text floats it over the selected text, its ruler at the canvas zoom so stops line up with the columns, #729), inline symbols in text (beyond parity), Hebrew/Arabic bidirectional text, Paragraph Direction, Every-line/Single-line Composer per object (ragged text too) done; paint-only Arabic harakat keep joining with GDEF-mark ownership and Insert Kashidas tatweels on the base letter's paint (`tests::harakat`); tab leaders, vertical type pending | 45–60 |
|
||||
@@ -238,6 +238,7 @@ not take the artwork yet. Overflow-menu drag remains separate. Scores and hours
|
||||
| 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. |
|
||||
| 2026-11-15 | minor | M10/G5: Neon & Glow built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); estimates unchanged |
|
||||
| 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. |
|
||||
| 2026-11-14 | minor | Color panel: the spectrum names its displayed mode on hover, including after Shift-click mode changes and with Hide Options enabled (part of #7235). Spectrum rendering and vertical resizing remain open. Scores and estimates unchanged. |
|
||||
| 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-15 | minor | G12: Swatches item menus validated in all five views: 39 focused tests passed, regression fails without the menu hooks, rendered list/thumbnail layouts inspected, and fresh local deep CodeRabbit review found zero issues. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. Scores and estimates unchanged. |
|
||||
| 2026-11-12 | minor | Gujarati (`gu`): 4,286-row machine-assisted catalog reviewed by a native speaker, zero/one singular plurals, desktop font fallback and optional Gujarati craft-fonts fallback; all 72 translation tests pass; a web font and about 2,600 untranslated messages remain; scores and estimates unchanged |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Parity with Adobe Illustrator
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, or past the envelopes' share of the page check, #7141; Character panel: the Set Font Height Reference dropdown showLine truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-18 · **Change:** minor (import: type filled and stroked by a `TJ` whose kerning starts a new line comes in filled and stroked, #8543; PDF Retype phase 1 (#4934): Type › Retype (`type.retype`) turns outlined text that exactly matches an available font back into point text; scores and estimates unchanged; previously: Lock Guides: a selection marquee (Selection, Direct Selection, Group Selection, Enclosing Lasso) leaves out paths made into guides inside groups and compound paths too, as clicks do (#3074), so a group is no longer selected by a locked guide in it; an enclosing marquee measures a group without its locked or hidden guides, and Direct Selection takes no anchor or segment of a guide that can't be picked; a guide in a group still moves with its group (#8538); Production Preflight: output-aware fonts, text overflow, linked files and effective image resolution, clickable findings and automatic rechecking; scores and estimates unchanged; previously: PDF export writes the document language as the catalog's `/Lang`, #3644; Layers panel: an Alt-drag copies a row above or below itself, so the top layer dragged up, the bottom layer dragged down and a lone layer are copied, #8237; scores and estimates unchanged; previously: Twist: a strongly twisted path joins its pieces without kinks, #7069; scores and estimates unchanged; previously: PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked, #8300; PDF import: translucent type filled and stroked comes in as a filled type object and a stroked one, as the file composites them, and an upright glyph is never kept as the outline of its glyph alone, #8015; PDF import: type filled and stroked by one text-showing operator comes in as one type object, filled and stroked, not a stroked copy over a filled one, #8015; Layers panel: Alt over the list shows the copy cursor while rows or the selection square are dragged, #8217; scores and estimates unchanged; previously: Gradient panel: the add-stop strip under the ramp shows the white arrow with a plus on Windows and X11, #8241; scores and estimates unchanged; previously: Properties panel: the Character section shows the font of the Type tool's selection, not the first run's (#8189); scores and estimates unchanged; previously: Recolor Artwork follow-up (#8031, remaining #4028): native Lab input, picker swatch libraries and Assign-row menus; UI interaction regression coverage; scores and estimates unchanged; previously: Eraser review: hidden Rasterize and Along/Across stroke rows do not block preserving visible gradients; scores and estimates unchanged; previously: Eraser review: ordinary Group/Layer paints and reproducible evaluated gradient placements are preserved; other placements retain existing fitting; scores and estimates unchanged; previously: Eraser: shared fill-only area cutting for fixed and varied tips and the Alt-drag marquee, #6582; scores and estimates unchanged; previously: #8005: the Color spectrum fills a resized panel; scores and estimates unchanged; previously: Paragraph composers (#4935): the Paragraph panel menu and paragraph styles offer four composers, the Middle Eastern & South Asian Single-line and Every-line (how all type is set, and the default) and a Standard Single-line and Every-line that set Indic, Arabic and Hebrew type glyph by glyph as the font maps it, for legacy fonts that keep a script on Latin character codes; PDF import: stroked type keeps the line cap, line join and miter limit the file strokes it with, a glyph stroked otherwise than the run it joins coming in as a run of its own, #7741; G5: Neon & Glow joins built-in graphic style libraries (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor); scores and estimates unchanged; previously: Pencil ignores Smart Guides and Snap to Point and shows no Smart Guides, #7252; previously: Pencil continuation, straight-line and closing cursors; scores and estimates unchanged; previously: G5: Weather Icons joins built-in symbol libraries (Sun, Moon, Cloud, Rain, Thunder, Snow); scores and estimates unchanged; previously: a closed Pencil stroke closes with a straight segment; previously: Snap to Point with Smart Guides off draws no Smart Guides labels or lines, #7250; previously: 3D: the seams of Extrude & Bevel, Inflate and Rotate under a white light, and of the faces of Extrude & Bevel (Classic), Revolve (Classic) and Rotate (Classic), went from miter to round joins, so white-light 3D output is expected to differ from the 2026-10-17 comparison at facet corners (not measured: the scenes were not exported again); previously: `.ai` and EPS import: in layers that don't draw as the page, art that differs away from an envelope of type no longer costs it its editable type; it keeps its drawn art where, in the pixels it and its drawn art ink, the layers with it differ from the page more than its own check allows, oLine truncated
|
||||
>
|
||||
> Tech Circuit update (2026-11-14): three original procedural brushes; ten built-in brush libraries (G5).
|
||||
>
|
||||
@@ -69,10 +69,12 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-18 | minor | PDF import (#8543): type filled and stroked (text rendering modes 2 and 6) by a `TJ` whose kerning starts a new line part way through came in as four type objects, each part filled only and each part stroked only over it: the reader fills every glyph of the operator before it strokes them, and the line the first part was gathered on was finished before the stroke pass came back to it. Lines an operator's fill pass finishes while a stroke may still be drawn over them are now kept (up to 64 besides the open line, so a `TJ` over up to 65 lines: one over more stays a filled object and a stroked one for each part, as before) until the stroke pass goes past them, and the pass's strokes are held (up to 4096: a longer pass is matched a part at a time, each part to glyphs filled one right after another, never to one an operator before it filled) until it ends, then matched to the glyphs filled last, in the order they were filled, so each stroke finds the glyph it was filled as, also where the `TJ` draws a glyph again where it drew one (`[(A) -3500 (B) 4834 (A)] TJ`). Each part comes in as one type object filled and stroked, in the order drawn; also a `TJ` that jumps back and one whose kerning starts two new lines. In an `ActualText` span (whose stroke was lost) the replacement text stays one type object on the first glyph's line and in its style, now filled and stroked, also where the `TJ` draws a glyph again: the span's strokes are matched the same way. A stroke over no filled glyph (stroked type of its own) and the start and end of an `ActualText` span end a stroke pass: no stroke after them goes over a glyph filled before them, so none is drawn under type drawn after it, and a later span keeps its own replacement text. Stroke rendering stays stroke only, and translucent type stays a filled object and a stroked one. Tests: `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`, `a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy`, `a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only`, `a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart`, `a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before`, `a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before`, `a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph`, `a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement`, `a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart`, `a_tj_over_more_lines_than_are_kept_that_ends_where_it_began_stays_fill_and_stroke_apart`, `type_after_a_tj_over_more_lines_than_are_kept_is_filled_and_stroked`; scores and estimates unchanged. |
|
||||
| 2026-11-18 | minor | Hardening: PDF export writes the document language (Document Setup) as the catalog's `/Lang` and XMP `dc:language` (#3644). Scores and estimates unchanged. |
|
||||
| 2026-11-17 | minor | Distort & Transform › Twist: handles follow the rotation's derivative, so a strongly twisted path is a smooth spiral instead of pieces meeting at kinks (#7069; `twist_joins_its_pieces_smoothly` in `crates/effects/src/tests.rs`). Scores and estimates unchanged. |
|
||||
| 2026-11-17 | minor | PDF import (#8300): a glyph filled only (text rendering mode 0) right after one filled and stroked (mode 2) joined the stroked run and came in stroked too: `2 Tr (B) Tj 0 Tr (C) Tj` came in as `BC` stroked throughout. A glyph filled only now joins only a run drawn alike, so it starts a run of its own, filled only, in the same type object, and takes a stroke only when the file draws one over it (the #8015 matching); a word filled whole then stroked whole, and fill and stroke rendering glyph by glyph, still come in as one run filled and stroked. Tests: `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked`, `glyphs_filled_and_stroked_one_by_one_stay_one_run`; scores and estimates unchanged. |
|
||||
| 2026-11-17 | minor | PDF import (#8015 follow-up): type filled and stroked at less than full opacity is no longer joined into one type object, since the file composites the fill and the stroke apiece, darker where they overlap, while one object's opacity applies to both together; it stays a filled object and a stroked one, as a fill and stroke at different opacities already did. An upright glyph (vertical type) filled and stroked is no longer kept as an outline for a line that comes in as its outlines, as glyphs filled only weren't, so such a line can't lose them. The #8015 entries now say what is left: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Tests: `translucent_fill_and_stroke_text_stays_two_objects`, `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled`; scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | `.ai` and EPS import: a path or compound path whose art style fills it with a pattern comes in with that pattern fill (#8239), placed as its drawn look fills with the pattern, once per pattern, not under effects on the object (a conservative rule); type keeps taking its style's pattern as before. Tests `a_path_with_a_style_pattern_fill_comes_in_as_the_path_with_it`, `a_style_pattern_fill_the_look_doesnt_paint_keeps_the_drawn_look`, `a_stack_with_one_pattern_twice_keeps_the_drawn_look`, `a_look_placing_a_stacks_pattern_twice_keeps_the_drawn_look`, `a_path_with_a_style_pattern_fill_under_an_effect_keeps_its_drawn_look` and `type_with_a_style_pattern_fill_takes_a_stroke_only_looks_placement` in `crates/eps/src/import/ai/tests.rs`. Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | PDF import: fill and stroke rendering (text rendering modes 2 and 6) draws all the glyphs of a text-showing operator (`Tj`, `TJ`, `'`, `"`) filled, then the same glyphs stroked, so a word shown at once came in as two type objects: a stroke-only copy over a fill-only one. Each stroke is now matched, in order, to the glyph filled with the same placement (where, how large, how wide, slanted and turned) in the same font with the same text on the line, and only that glyph takes the stroke, so the word comes in as one type object, filled and stroked; glyphs stroked with another join part way through still split into runs of their own, and stroked type over no filled glyph (modes 1 and 5) stays stroke only (#8015; `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`, `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs`). Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | Recolor Artwork › Assign: native Lab entry in the Color Picker, swatch libraries access in the picker, and row context menu options (Pick from Swatches, Limit to Library) (#4028); scores and estimates unchanged. |
|
||||
| 2026-11-15 | minor | PDF import: stroked type (text rendering modes 1, 2, 5 and 6, and glyphs under `ActualText`) keeps the line cap, line join and miter limit of the graphics state it is stroked with, as paths do, instead of butt caps, miter joins and a miter limit of 10; a glyph filled and then stroked otherwise than the run its fill joined comes in as a run of its own, so the glyphs before it keep their stroke (#7741; `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`). Scores and estimates unchanged. |
|
||||
@@ -237,8 +239,8 @@ tests and the CI gate. See [Calibration](#calibration).
|
||||
and Marker; 353 and 22, 94.1%, after Extrude & Bevel, Inflate and Rotate.
|
||||
- Engine commands: ~710 ids registered with `cmd!` across `crates/engine/src/cmd` (plus macro-generated
|
||||
families), and 85 UI-only commands (`UI_COMMANDS`).
|
||||
- Tools: 91 in `crates/tools/src/catalog.rs`; Touch Type is listed but not implemented, and the Dimension
|
||||
tool (added in Illustrator 28.x) is absent.
|
||||
- Tools: 91 in `crates/tools/src/catalog.rs`; Touch Type was listed but not implemented, and the Dimension
|
||||
tool (added in Illustrator 28.x) was absent; both have since shipped (#8387).
|
||||
- Effects catalogue (`crates/effects/src/lib.rs`): see [effects-parity.md](effects-parity.md).
|
||||
- Tests: 4,924 `#[test]` functions plus 40 property-test blocks (was "~2,840" in the last estimate).
|
||||
~354k lines of Rust (was ~221k on 2026-10-07).
|
||||
@@ -285,9 +287,9 @@ dominate; 3D, graphs and automation are specialist). They sum to 105. Feature de
|
||||
| Image Trace, graphs, image tools | 3 | 75% | graph Column designs, Image Trace Create Strokes depth (Create Object Mosaic is done; junction-returning piece survival has source-generated regressions in `image-trace-quality.md`; large images trace with a warning; Auto Color keeps rare distinct colours) | 5–8 | estimated (raised from 72%); quick presets reveal adjustment controls, Properties reopens them |
|
||||
| Layers, artboards, document setup | 5 | 78% | Selected-artboard deletion is consistent across panel actions (all-selected retains artboard 1); history prunes removed indices while preserving valid multiselection; remaining: 30.0's artboard locking and colours and managing artboards from the canvas, Layers row menu commands beyond Collect for Export and menus on guide and blend spine rows (click-to-fit objects is done, #1227) | 5–8 | estimated (lowered from 82%: target moved); Artboard deletion keys keep artwork and the first of an all-selected set; Artboard Options' Show Center Mark and Show Cross Hairs draw on the canvas only (exports and print leave them out), regression-tested; Artboard Options' Show Video Safe Areas and Video Ruler Pixel Aspect Ratio (per artboard, native format) are done ([video display options](#evidence-what-ships-today-by-area)), score unchanged |
|
||||
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged); cached canvas dimensions match the renderer limit before cache-key creation, view construction and worker submission (regression evidence below) |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), no writing of Illustrator's editing data (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity, or by a `TJ` whose kerning starts a new line part way through, comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); DXF export's Include Placed Images and Include Fill Hatches options, off in CNC / CAM (`images_and_hatches_are_left_out_independently_and_the_cnc_preset_leaves_out_both`; score, gaps and hours unchanged); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`; the distance from the path under Align to Path is measured from the top of each character's em box, half the height of the top of its H or the bottom of its font's bounding box (`tests_native::aligned_type_lies_as_far_from_its_path_as_the_file_lays_it_out`), and the fit under Gravity does not reproduce the file's layout), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, textures, map art and shading in 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity, or by a `TJ` whose kerning starts a new line part way through, comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity, or by a `TJ` whose kerning starts a new line part way through, comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Save refusal continuation (#6146): `READ_ONLY_LOCATION`, Save As on ordinary UI Save only; regression execution pending; score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not yet for type filled and stroked at less than full opacity, or a `TJ` whose kerning starts a new line part way through, which still come in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), no writing of Illustrator's editing data (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); DXF export's Include Placed Images and Include Fill Hatches options, off in CNC / CAM (`images_and_hatches_are_left_out_independently_and_the_cnc_preset_leaves_out_both`; score, gaps and hours unchanged); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`; the distance from the path under Align to Path is measured from the top of each character's em box, half the height of the top of its H or the bottom of its font's bounding box (`tests_native::aligned_type_lies_as_far_from_its_path_as_the_file_lays_it_out`), and the fit under Gravity does not reproduce the file's layout), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not for type filled and stroked at less than full opacity, which still comes in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: type filled and stroked by a `TJ` whose kerning starts a new line part way through comes in filled and stroked, a type object for each part, also where it draws a glyph again where it drew one, in an `ActualText` span too, where it stays one replacement type object on the first glyph's line and in its style; a `TJ` over more than 65 lines (the 64 its fill pass finished, kept back, and the open one) stays a filled object and a stroked one for each part (#8543, `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, textures, map art and shading in 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not for type filled and stroked at less than full opacity, which still comes in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: type filled and stroked by a `TJ` whose kerning starts a new line part way through comes in filled and stroked, a type object for each part, also where it draws a glyph again where it drew one, in an `ActualText` span too, where it stays one replacement type object on the first glyph's line and in its style; a `TJ` over more than 65 lines (the 64 its fill pass finished, kept back, and the open one) stays a filled object and a stroked one for each part (#8543, `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| File formats | 6 | 75% | `.ai` files open with a flattened or wrong layer structure in real cases (#951), a saved `.ai`'s editing copy without live effects on objects other than paths, compound paths and groups that qualify (at most a fill and a stroke, a non-zero fill rule when filled, no large canvas) and whose appearance and effects the art-style writer supports, and with live objects other than grouped column, stacked column, line and area graphs the `.ai` reader reads back whole as their art (#868), FreeHand/CorelDRAW/DWG/HEIC import, 3D export; see [file-format-parity.md](file-format-parity.md); EPS legacy mesh/opacity-mask and raster comparison follow-up verified PDF marked-text batching covered by M4 evidence (#6309); cross-line/style ActualText layout (#6165) and styled-cluster limits remain.; PDF type filled and stroked at less than full opacity comes in as a filled object and a stroked one (#8015) | 10–20 | estimated (lowered from 85%: open issues); DXF control-point SPLINE import closure regression-tested (#1299 follow-up after #1320); PDF writer metadata, reader streaming and immutable backend checks in `crates/pdf/src/tests.rs`, `crates/pdf/src/tests/reader_streaming.rs` and `xtask/src/pdf_deps.rs`; PDF Place and clipboard paste retain live text (synthetic regressions); SVG CSS classes survive export and repeated import in all four styling modes (#2480); current-main integration retains event attributes and scripts; EPS ordinary Save retains the page frame and editable document (2026-10-26); `.ai`/EPS editing data checked against a user's files (2026-10-30): case setting (`ate::tests`, `tests_native::type_from_the_text_document_keeps_its_case_setting`), placed-file placements (`tests_native::a_small_placed_file_goes_where_it_draws_closer_to_the_page`), pages cropped to the art (`tests_native::type_on_the_copies_of_a_page_cropped_to_the_art_is_read_once`), mesh corner weights and state (`ai::mesh::tests::corners_with_handle_weights_of_zero_are_read`, `ai::tests::a_gradient_mesh_takes_the_transparency_written_after_it`), type on a path spacing (`tests_native::type_round_a_circle_is_spaced_as_the_file_lays_it_out`), blend state (`ai::tests::a_blends_transparency_follows_its_record`); scores and estimates unchanged. Graphs saved to `.ai` in either form open again as live graphs (`ai_editing::tests::graphs_are_written_with_their_records_and_open_live`, `legacy_ai::tests::graphs_are_written_with_their_records_and_open_live`, `cmd::graph::tests::a_drawn_graph_saved_as_ai_opens_as_a_graph_unless_the_save_warns`); other graphs are still written as their art (`graphs_the_records_cant_keep_are_written_as_their_art`); score and hours unchanged. PDF ActualText preserved in editable import (#6165; bounded synthetic coverage below); score/hours unchanged. Save refusal continuation (#6146): `READ_ONLY_LOCATION`, Save As on ordinary UI Save only; regression execution pending; score/hours unchanged. Legacy `.ai` type keeps its manual kerning pairs (`Tk`, `TK`), discretionary hyphens (`T+`, `T-`) and hyphenation language (`XL`) when it opens, and legacy `.ai` saves write manual kerning as `Tk` and soft hyphens as `T+` (`import::ai::tests::legacy_manual_pair_kerning_is_kept`, `legacy_ai::tests::manual_kerning_and_soft_hyphens_are_written_and_read_back`); score, gaps and hours unchanged. PDF import: stroked type (text rendering modes 1, 2, 5 and 6) keeps the file's line cap, line join and miter limit, as paths do (#7741, `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs`); score, gaps and hours unchanged. PDF import: type filled and stroked by one text-showing operator (rendering modes 2 and 6) comes in as one type object, filled and stroked, not a stroked copy over a filled one (#8015, `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs`); not for type filled and stroked at less than full opacity, which still comes in as a filled object and a stroked one (`translucent_fill_and_stroke_text_stays_two_objects`); score and hours unchanged. PDF import: type filled and stroked by a `TJ` whose kerning starts a new line part way through comes in filled and stroked, a type object for each part, also where it draws a glyph again where it drew one, in an `ActualText` span too, where it stays one replacement type object on the first glyph's line and in its style; a `TJ` over more than 65 lines (the 64 its fill pass finished, kept back, and the open one) stays a filled object and a stroked one for each part (#8543, `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked`); score and hours unchanged. PDF import: a glyph filled only after a glyph filled and stroked comes in filled only, not stroked (#8300, `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` in `crates/pdf/src/tests/textstroke.rs`); score and hours unchanged. |
|
||||
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged); document-tab artwork hover/copy and lossless transfer tested (2026-10-22; score/hours unchanged); cached canvas reprojection preserves scale during resize, rotation and DPI changes (regression and contributor original-file evidence below; scores/hours unchanged) |
|
||||
| View & navigation | 3 | 70% | multiple windows and the rest of Arrange (Cascade, Float in Window, Float All in Windows) | 9–14 | estimated; Window › Arrange › Tile and Consolidate All Windows done (score/hours unchanged) |
|
||||
| Guides, grids, smart guides, snapping, rulers | 3 | 80% | "intersect" smart guides for a moved selection's anchors (drawn points and dragged anchors snap to intersections, #1658) | 4–7 | estimated (lowered from 85%: target moved); Control bar snapping quick access includes Snap to Glyph and Alignment Guides (#6164); new ruler-guide Alt orientation implemented; global/artboard ruler modes (`view.globalRulers`) and video rulers (View › Rulers › Show Video Rulers, #2849) done; status-bar X/Y uses the active ruler origin and General units; score unchanged |
|
||||
@@ -616,7 +618,7 @@ since 2026-10-01.
|
||||
- **PDF authored replacement text (#6165):** `crates/pdf/src/tests/actual_text.rs` covers replacement once with suffix placement, PDF text-string decoding, empty and nested owners, sibling spans, page reset, multiple text-show operations, style/line changes, fill-and-stroke, reader windows and bounded input. Authored logical-order stretches are protected while adjacent ordinary text still undergoes reconstruction. The replacement takes its first placed glyph's style and line; its characters are not redistributed over later lines/styles. Exact mixed-direction paragraph layout is not claimed. No export changes; scores and hours stay at 75% / 10–20 h.
|
||||
- **PDF stroked type (#7741):** `imported_stroked_type_keeps_the_files_cap_join_and_miter_limit` in `crates/pdf/src/tests/textstroke.rs` covers round, projecting and butt caps, round, bevel and miter joins and a miter limit of 3 on type stroked in rendering modes 1, 2, 5 and 6, shown as a word, a glyph at a time and under `ActualText`; glyphs stroked with another join as runs of their own; and a glyph filled and stroked after one stroked otherwise, which keeps the join of the glyph before it. Synthetic PDFs written in the test (standard Helvetica, not embedded); no fonts or fixtures added. The dash array is not yet carried to the characters.
|
||||
|
||||
- **PDF type filled then stroked (#8015):** `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs` covers a word shown at once, a `TJ` array of two strings with kerning between them, a line over two `Tj` and a glyph at a time, also under `ActualText`, in text rendering modes 0, 1, 2, 4, 5 and 6: modes 2 and 6 come in as one type object `WAVE` filled #ffffcc with a 3 pt black stroke, round cap and join, modes 1 and 5 stroke only, 0 and 4 fill only; a Type 3 font is filled once in every mode (the reader paints Type 3 glyphs as their procedures draw them); a stroke join that changes between two operators keeps a run each; and filled type with stroked type of its own below it stays two objects. `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs` covers a vertical column in modes 2 and 6. `a_stroke_at_another_size_does_not_go_over_the_filled_glyph` and `a_stroke_over_one_glyph_of_a_filled_word_strokes_only_that_glyph` (also in `textstroke.rs`) cover a word filled and then its first glyph stroked from the same origin: at another size it stays type of its own, and at the same size only that glyph is stroked. `translucent_fill_and_stroke_text_stays_two_objects` (in `textstroke.rs`) covers type filled and stroked at the same opacity: at 0.5 it stays a filled object and a stroked one, as the file composites them apiece, and opaque it is one. `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled` in `crates/pdf/src/tests/reshaped.rs` covers a vertical line of Devanagari with one glyph filled and stroked: every glyph comes in filled. `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` (#8300, in `textstroke.rs`) covers a glyph filled only right after one filled and stroked, also after a glyph filled only and before another filled and stroked: it joins the same type object filled only, not stroked; `glyphs_filled_and_stroked_one_by_one_stay_one_run` covers fill and stroke rendering glyph by glyph and a word filled whole then stroked whole at the same place: one run, filled and stroked. Not covered: translucent type filled and stroked, and a `TJ` whose kerning starts a new line part way through, still come in as two objects. Synthetic PDFs written in the tests; no fonts or fixtures added.
|
||||
- **PDF type filled then stroked (#8015):** `a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type` in `crates/pdf/src/tests/textstroke.rs` covers a word shown at once, a `TJ` array of two strings with kerning between them, a line over two `Tj` and a glyph at a time, also under `ActualText`, in text rendering modes 0, 1, 2, 4, 5 and 6: modes 2 and 6 come in as one type object `WAVE` filled #ffffcc with a 3 pt black stroke, round cap and join, modes 1 and 5 stroke only, 0 and 4 fill only; a Type 3 font is filled once in every mode (the reader paints Type 3 glyphs as their procedures draw them); a stroke join that changes between two operators keeps a run each; and filled type with stroked type of its own below it stays two objects. `a_vertical_column_filled_then_stroked_is_one_filled_and_stroked_type` in `crates/pdf/src/tests/text_placement.rs` covers a vertical column in modes 2 and 6. `a_stroke_at_another_size_does_not_go_over_the_filled_glyph` and `a_stroke_over_one_glyph_of_a_filled_word_strokes_only_that_glyph` (also in `textstroke.rs`) cover a word filled and then its first glyph stroked from the same origin: at another size it stays type of its own, and at the same size only that glyph is stroked. `translucent_fill_and_stroke_text_stays_two_objects` (in `textstroke.rs`) covers type filled and stroked at the same opacity: at 0.5 it stays a filled object and a stroked one, as the file composites them apiece, and opaque it is one. `a_vertical_line_with_one_glyph_filled_and_stroked_keeps_every_glyph_filled` in `crates/pdf/src/tests/reshaped.rs` covers a vertical line of Devanagari with one glyph filled and stroked: every glyph comes in filled. `a_glyph_filled_only_after_one_filled_and_stroked_is_not_stroked` (#8300, in `textstroke.rs`) covers a glyph filled only right after one filled and stroked, also after a glyph filled only and before another filled and stroked: it joins the same type object filled only, not stroked; `glyphs_filled_and_stroked_one_by_one_stay_one_run` covers fill and stroke rendering glyph by glyph and a word filled whole then stroked whole at the same place: one run, filled and stroked. `a_tj_whose_kerning_starts_a_new_line_is_filled_and_stroked` (#8543, in `textstroke.rs`) covers a `TJ` whose kerning starts a new line part way through (`[(AB) -3500 (CD)] TJ`), one that jumps back, and one whose kerning starts two new lines, in modes 2 and 6: each part one type object, filled and stroked, in the order drawn; small kerning stays one object, and in an `ActualText` span the replacement text stays one type object, filled and stroked, on the first glyph's line and in its style. `a_tj_that_draws_a_glyph_again_where_it_drew_one_strokes_each_copy` covers a `TJ` that draws a glyph again where it drew one (`[(A) -3500 (B) 4834 (A)] TJ`, with the copy drawn last ending the operator or followed by another line, and with A and B drawn again): each copy one type object, filled and stroked; a glyph filled and stroked by an operator of its own where one filled before stands still strokes only the one filled last. `a_stroked_tj_whose_kerning_starts_a_new_line_stays_stroke_only` covers modes 1 and 5 (stroke only), and `a_translucent_tj_whose_kerning_starts_a_new_line_stays_fill_and_stroke_apart` covers it at 0.5 opacity: a filled object and a stroked one for each part, as the file draws them. `a_long_stroke_pass_strokes_its_own_glyphs_not_one_filled_before` covers a stroke pass past the 4,096 strokes held at once (an `A` filled, then `A` and 4,096 `B`s filled and stroked from the same place): the second `A` is stroked, not the first; `a_long_stroke_pass_does_not_take_the_same_glyphs_filled_by_an_operator_before` covers `A` and 4,095 `B`s filled, then `A` and 4,096 `B`s filled and stroked from the same place: the second operator's glyphs are stroked, not the first one's. `a_stroke_after_stroked_type_of_its_own_does_not_join_a_glyph_filled_before` covers a stroke over a glyph filled two lines back after stroked type of its own: it stays type of its own, drawn last. `a_stroke_in_an_actual_text_span_does_not_take_an_earlier_spans_glyph` covers a stroke in an `ActualText` span over a glyph an earlier span filled: each span's replacement text comes in. `a_stroke_after_an_actual_text_span_does_not_take_a_glyph_filled_before_it` covers a stroke after a span over the glyph its replacement text came with, and over a glyph filled before an empty span: type of its own, the glyph filled only; `a_glyph_stroked_again_where_it_was_drawn_stays_one_type_object` covers a glyph stroked again where it was drawn: one type object. `a_tj_that_draws_a_glyph_again_in_an_actual_text_span_strokes_the_replacement` covers `[(A) -3500 (B) 4834 (A)] TJ` in an `ActualText` span: one replacement type object, filled and stroked. `a_tj_over_more_lines_than_are_kept_comes_in_as_fill_and_stroke_apart` covers the limit: a `TJ` over 65 lines comes in as 65 type objects filled and stroked, one over 66 as a filled object and a stLine truncated
|
||||
- **PDF Indic type (#5235, #6906):** `crates/pdf/src/tests/reshaped.rs` covers a vowel sign the file draws before its consonant (the line keeps the file's glyphs as outlines, with a note), text in reading order (stays type), a mark with no advance (stays on its line, not vertical type of its own), outlined glyphs stroked with different dashes and translucent outlined glyphs (each keeps its own path). Synthetic font only; one real Gujarati file checked by eye on page 1. Indic type in an uninstalled font keeps the file's glyphs as outlines; reordering signs so more lines stay editable is not done. Scores and hours stay at 75% / 10-20 h.
|
||||
|
||||
|
||||
@@ -1863,6 +1865,9 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- **Swatch library and Recolor Artwork parameters:** the `swatch.library.*` commands, `swatch.resetDefaults`, the graphic style library save, load and add, the `recolor.*` commands and `color.harmony`'s `limitTo` refuse parameters of the wrong form, such as `names: "Grays"`, `limitTo: 5` or `includeImages: "false"`. Errors name the parameter, except that a `limitTo` that is not a string, such as `5`, gets an unknown-library error. A `null` counts as left out except for `recolor.apply`'s `model`, which must be a string when given.
|
||||
- **Color Wheel panel (part of #978):** Window › Color Wheel shows the Fill and Stroke proxy beside a hue ring around a square with saturation across and brightness up. It edits what the Color panel's sliders edit (the active proxy's color, the selected gradient stop or freeform point) through the same paint commands, and a drag is one undo step. Alt paints the other proxy, and Shift steps the ring by 45°. A pick goes from display sRGB into the working RGB space; an RGB, CMYK or Lab color keeps its model, and a Gray color or a tint of a global swatch becomes a process color in the document's color mode. A click gives the ring or the square the keyboard focus, and the arrow keys then step the color; both report their names and values to screen readers, and the Color Picker's color field takes the same keys. The panel menu's Box View puts a box in the wheel's place: a color field with a channel strip at its right for Hue, Saturation, Brightness, Red, Green or Blue (Box Channel), on the Color Picker's axes, kept with the preferences (`ui.colorWheel`); the strip and the Color Picker's channel slider take the arrow keys after a click. Scores and estimates are unchanged.
|
||||
- **Colour:** a Color Picker (colour field, H/S/B/R/G/B channel slider, HSB/RGB/Lab/CMYK fields, hex, web-only snapping, out-of-gamut correction); the Color panel shows a selected colour in its own model and, with nothing selected, the new-art defaults in the mode picked last, which it keeps between sessions; Alt-click paints the other proxy; proxies look through groups and show "?" for mixed paint; Invert, Complement, Apply Last Color (`,`) and Apply Last Gradient (`.`) keep the colour model; every paint command feeds the recent colours. The Color Guide has 21 harmony rules, Steps and Variation options and Limit to Library. Adjust Color Balance (its Global mode shifts tints) and Saturate preview live; Edit Colors and Recolor also reach meshes, images and patterns. Recolor Artwork has colour reduction, five recolour methods, presets, Limit to Library, a colour-wheel Edit tab and Edit Color Group; a local Color Themes panel saves five-colour themes. Fill/Stroke chips open swatch and mixer popovers (the Properties panel has the Control bar's Fill and Stroke chips, Stroke link and weight spinner, with nothing selected too), panels have Illustrator's Window menu keys (Align Shift+F7, Transform Shift+F8, Pathfinder Cmd+Shift+F9, Layers F7, Character Cmd+T…; every panel can be given one in Edit › Keyboard Shortcuts), and Eyedropper Options pick up and apply chosen attributes (Alt and Shift+Alt, image pixels). An ICC CMYK profile converts straight into the RGB working space (not through sRGB, so a wider space such as Wide Gamut RGB keeps colours sRGB can't hold) with the colour settings' black-point compensation, on the canvas and in RGB exports alike (the built-in Generic CMYK compensates both ways, so RGB black separated to a rich black displays as black again). Fills and strokes can overprint (Attributes panel, Overprint Black options), and CMYK documents blend in inks on screen, in PDF and when flattening. Document Color Mode converts the art, symbols, pattern tiles and swatches through the colour settings: Gray stays Gray, RGB grays separate into light grays in cyan, magenta and yellow only, darker four-color grays and a rich black, or go on the black plate only with `grays: "black"` (also for `document.open {colorMode}`).
|
||||
|
||||
**Color panel spectrum mode tooltip (part of #7235):** hovering the spectrum names the displayed mode (Grayscale, RGB, HSB, CMYK, Web Safe RGB or Lab), including after Shift-clicking to switch modes and with Show Options or Hide Options. Hovering changes no paint or undo history. Spectrum rendering and vertical resizing remain open. Evidence: `spectrum_tooltip_names_its_displayed_mode` and `spectrum_tooltip_follows_shift_cycle_without_painting` in `crates/ui-egui/tests/color_working_components.rs`. Scores and estimates unchanged.
|
||||
|
||||
Plain Comma and Period, and also Shift+Comma and Shift+Period, apply the last solid color and the last gradient to the active Fill or Stroke proxy in VectorCraft ([Default keyboard shortcuts](https://web.archive.org/web/20260726060015/https://helpx.adobe.com/illustrator/using/default-keyboard-shortcuts.html), "Select color fill mode" and "Select gradient fill mode").
|
||||
Recent Colors keeps the last 30 solid colors applied, newest first and each once, and the list stays the same when another document is opened or made active; a 31st color drops the oldest ([Select colors using the Color panel](https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/select-colors-using-the-color-panel.html)). The list lasts for the session. In the Color and Swatches panels the chips wrap onto further rows when the panel is too narrow for one row (`paint.recent`). Tests: `recent_colors_keep_thirty_colors_across_documents` in `crates/engine/src/tests/paintproxy.rs`, `all_thirty_recent_colors_wrap_into_a_narrow_panel` in `crates/ui-egui/src/panels/color/tests.rs`.
|
||||
Unchecking Show Recent Colors in the Color panel's menu hides its Recent Colors row, and checking it shows the row again ([Select colors using the Color panel](https://helpx.adobe.com/illustrator/desktop/manage-colors/select-and-adjust-colors/select-colors-using-the-color-panel.html)). In VectorCraft the item is checked by default and kept between sessions, applied colors still join the list while the row is hidden, Hide Options hides the row either way, and the Swatches panel keeps its row (`ui.colorPanel {recentColors}`). Tests: `show_recent_colors_hides_and_shows_the_row` in `crates/ui-egui/src/panels/color/tests.rs`.
|
||||
@@ -2979,6 +2984,7 @@ Edit › Copy and Cut put the selected ruler guides on the clipboard, with the s
|
||||
| 2026-11-16 | minor | Eraser review (#6582): ordinary Group/Layer own paints and reproducible evaluated gradient placements are preserved as members are cut. Replacement-art effects, plug-ins/Rasterize, along/across-stroke gradients and placements that cannot reproduce the original appearance keep existing fitting. Scores and estimates unchanged. |
|
||||
| 2026-11-16 | minor | Color panel: the spectrum fills the vertical space of a resized panel, with options shown or hidden (#8005). Compact auto-fit flyouts and embedded mixers keep their existing size. Evidence: panels::color::tests::the_spectrum_grows_with_the_color_panel. Scores and estimates unchanged. |
|
||||
| 2026-11-14 | minor | Paragraph composers (#4935): `text.setFormat {composer}` and paragraph styles take `singleLine` and `everyLine` (the Middle Eastern & South Asian composers, what all type used and the default) and `standardSingleLine` and `standardEveryLine`, which break lines the same way and set a complex script (Indic, Arabic, Hebrew) glyph by glyph as the font maps its characters, with no conjuncts, reordering, marks placed or joining forms. The choice is per paragraph, saved in the native file only when it is not Every-line, and not written to `.ai`, EPS or PDF files, whose composer setting this app has no recorded format for. Scores and estimates unchanged. Tests `tests::composers`. |
|
||||
| 2026-11-14 | minor | Color panel: the spectrum names its displayed mode on hover, including after Shift-click mode changes and with Hide Options enabled (part of #7235). Spectrum rendering and vertical resizing remain open. Scores and estimates unchanged. |
|
||||
| 2026-11-14 | minor | G5: Weather Icons joins Basic Shapes, UI Frames, Map Markers, Inventory Icons and Skill Icons as a sixth built-in symbol library (Sun, Moon, Cloud, Rain, Thunder, Snow; original procedural vector symbols generated in code, no default 9-slice); area score and estimate unchanged. |
|
||||
| 2026-11-14 | minor | Tech Circuit adds three original procedural brushes (Circuit Trace, Bus Lines, Terminal Nodes); ten built-in brush libraries. G5 remaining estimate 3–13 h (estimated); parity scores and headline totals unchanged. |
|
||||
| 2026-11-15 | minor | G12: Swatches item menus validated in all five views: 39 focused tests passed, regression fails without the menu hooks, rendered list/thumbnail layouts inspected, and fresh local deep CodeRabbit review found zero issues. Full workspace CI passed on Linux/WSL on the merged branch (all 13 gates), including the test-helper correction for the upstream compile error tracked in #7727; native Windows full CI has two unchanged engine-test failures. Scores and estimates unchanged. |
|
||||
|
||||
@@ -459,6 +459,7 @@ next unit in the order a right-click on a ruler lists them, from Feet back to Po
|
||||
| Select › Start Global Edit / Stop Global Edit; Properties › Quick Actions with the Global Edit Options popover (Match: Appearance, Size; On Artboards: All Artboards or a range, Include Objects On Canvas; Result(s)); Escape stops it; the matched objects are highlighted in their layer colour while it runs; a Shift-click on a highlighted match leaves it out | partial | #3521, `select.globalEdit` / `select.globalEditOptions` / `select.globalEditExclude`, `crates/engine/src/tests/globaledit.rs`; paths, compound paths, symbol instances and groups of them (similar groups, #4939: edits inside one group reach the same object in the others; [public source](https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/edit-groups-with-similar-objects.html)); a group holding type or an image is not taken, as Global Edit does not take images or text; Shift-click to leave a match out ([public source](https://helpx.adobe.com/ph_fil/illustrator/how-to/global-editing-sensei.html)); the Control bar's Global Edit Options dropdown opens the same options; the matches are highlighted before the start (`selecting_one_object_highlights_the_similar_objects_before_global_edit_starts`); rotated copies are matched and take an edit turned by their angle ([public source](https://helpx.adobe.com/vn_vi/illustrator/how-to/modern-logo-design.html); `start_global_edit_takes_rotated_copies_and_an_edit_reaches_each_turned_by_its_angle`); reflected copies are not matched (VectorCraft's own rule) |
|
||||
| Contextual task bar | done | |
|
||||
| Control bar with Transform and Stroke popovers | done | |
|
||||
| Control bar: numeric Corner Radius for eligible selected ordinary and live corners (part of #7238, request 3 only) | done | Anchor Points visibility group; common/mixed values, general document units and multi-object edits through `object.setLiveShape`, one Undo. A partial selection containing no eligible corners contributes no target. Corner kind and relative mode are retained; existing corner-widget selection, widget visibility and maximum-radius behavior are unchanged. Requests 1/2 remain open. |
|
||||
| Stroke panel: custom arrowheads after the built-in ones in both arrowhead menus, from the arrowheads file that the panel menu's Edit Arrowheads… opens; saving the file reloads the menus, and a stroke keeps a copy of its custom head's art | done | [Apply stroke on an object](https://helpx.adobe.com/illustrator/using/stroke-object.html) (Customize arrowheads); the file's layout (one symbol per head, pointing right, tip at the registration point, height drawn as wide as the built-in heads) is VectorCraft's own; `stroke.arrowheads.edit`, `stroke.arrowheads.list`, `stroke.arrowheads.reload`, `stroke.set` `{custom: name}`; engine `tests::arrowheads`, `stroke::tests_arrows::custom_heads_draw_their_own_art_at_the_tip` |
|
||||
| Control bar: Paragraph: link and Align left/center/right while type is selected (#5372) | done | After the Character controls, as the public documentation has the Control panel format paragraphs ([Paragraph panel overview](https://helpx.adobe.com/illustrator/using/formatting-paragraphs.html), [Align text](https://helpx.adobe.com/illustrator/using/align-text.html)); the link opens the Paragraph panel in a popover, as Character: does with the Character panel. The bar trims from its right end: X/Y/W/H, Distribute, Align, area type vertical alignment, then these buttons, then the link. The three-button set is our choice for room; all seven alignments are in the popover. `panels/paragraph/tests.rs` headless tests (`the_control_bar_shows_the_paragraph_alignment_of_the_selected_type`, `the_control_bar_trims_its_paragraph_section_after_the_controls_to_its_right`) |
|
||||
| Pathfinder shape results keep their source names and SVG IDs | done | #1293; Minus Front keeps the back name, Minus Back the front name; Unite/Intersect/Exclude use the backmost named input; compound output carries it once; geometry and paint unchanged |
|
||||
|
||||
Reference in new issue
Block a user