diff --git a/crates/pdf/src/import_text.rs b/crates/pdf/src/import_text.rs index 08a2ff54e5..34d31374ce 100644 --- a/crates/pdf/src/import_text.rs +++ b/crates/pdf/src/import_text.rs @@ -61,6 +61,17 @@ impl Placement { fn up(&self) -> Vec2 { Vec2::new(self.dir.y, -self.dir.x) } + + /// Is a glyph placed with `other` drawn where this one is, the same size, width, slant and + /// direction (a stroke the reader draws over a glyph it filled has the very same placement; + /// the tolerances only allow for rounding)? + fn same_as(&self, other: &Placement) -> bool { + (self.origin - other.origin).hypot() < self.size * 1e-3 + && (self.size - other.size).abs() <= self.size * 1e-3 + && (self.h_scale - other.h_scale).abs() < 0.05 + && (self.slant - other.slant).abs() < 1e-3 + && self.dir.dot(other.dir) > 1.0 - 1e-6 + } } /// A glyph set vertically (WMode 1: no horizontal advance) and the top centre of its em box: a @@ -225,6 +236,11 @@ pub(crate) struct TextLine { /// 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. stroked: usize, + /// Glyphs stroked so far that are still to be restyled: a stroke pass over a word restyles it + /// once, as a whole ([`flush_stroke`](Self::flush_stroke)). + pending: Option, + /// The last glyph's placement. + last_at: Placement, /// The first glyph was set vertically ([`Upright`]). upright: Option, /// The glyphs make a column (vertical type), each below the last. @@ -257,17 +273,28 @@ struct Slot { advance: Option, } -/// A glyph filled without a stroke: its font and baseline origin, and where its text is in the -/// line's runs (the run's index, the text's byte offset in it and its length). +/// 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). #[derive(Clone, Copy, Debug)] struct Filled { font: u128, - origin: Point, + at: Placement, run: usize, start: usize, len: usize, } +/// Glyphs next to each other in one run that a stroke is drawn over, not yet restyled +/// ([`TextLine::stroke_filled`]): the run's index, the text's byte range in it, and the stroke. +#[derive(Clone, Debug)] +struct PendingStroke { + run: usize, + start: usize, + end: usize, + stroke: TypeStroke, + overprint: bool, +} + /// What a finished line of type tells beyond its text object (see [`crate::import_lines`]). #[derive(Clone, Debug, Default)] pub(crate) struct LineFacts { @@ -302,6 +329,8 @@ impl TextLine { actual_fills: HashMap::new(), filled: vec![], stroked: 0, + pending: None, + last_at: at, upright: None, column: false, ink: vec![], @@ -332,6 +361,7 @@ impl TextLine { } pub fn push_upright_content(&mut self, look: &Look, at: Placement, opacity: f32, upright: Upright, content: TextContent<'_>) -> bool { + self.flush_stroke(); let text = content.text(); if !text.is_empty() && self.authored.is_empty() && self.upright.is_some() { // Suppressed vertical glyphs likewise provide no text anchor. @@ -350,7 +380,7 @@ impl TextLine { 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) = (Some(upright), at.origin + down * at.size, at.origin); + (self.upright, self.next, self.last, self.last_at) = (Some(upright), at.origin + down * at.size, at.origin, at); return true; }; let across = (at.origin - self.at.origin).dot(self.at.dir); @@ -390,6 +420,7 @@ impl TextLine { self.authored.extend(text.chars().map(|_| content.authored())); self.next = at.origin + down * at.size; self.last = at.origin; + self.last_at = at; true } @@ -400,6 +431,7 @@ impl TextLine { } pub fn push_content(&mut self, look: &Look, at: Placement, opacity: f32, advance: f64, content: TextContent<'_>) -> bool { + self.flush_stroke(); let text = content.text(); let pen = matches!(content, TextContent::Pen); // A vertical line (even a single upright glyph) takes no horizontal glyphs. @@ -501,6 +533,7 @@ impl TextLine { self.visible = self.next; } self.last = at.origin; + self.last_at = at; self.last_dir = at.dir; self.last_size = at.size; self.baseline.push(at.origin); @@ -522,13 +555,14 @@ impl TextLine { return; } let run = self.runs.len().saturating_sub(1); - self.filled.push(Filled { font: look.font, origin: at.origin, run, start: self.last_start, len }); + self.filled.push(Filled { font: look.font, at, run, start: self.last_start, len }); } /// 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. 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)) { @@ -572,66 +606,124 @@ impl TextLine { /// /// The reader fills all the glyphs a text-showing operator (`Tj`, `TJ`, `'`, `"`) draws /// before it strokes them (#8015), or fills and strokes glyph by glyph: either way each - /// stroke is matched to the next glyph filled at the same place in the same font with the - /// same text, in order. The glyph's text and the text after it in its run take the stroke: - /// those after it are the rest of the same operator's glyphs, whose strokes come next (and - /// split their text off again only when theirs differs), so a run filled whole is stroked - /// whole. The glyphs before it in the run keep their own stroke or none (#7741). + /// stroke is matched to the next glyph filled with the same placement (where, how large, how + /// wide, slanted and turned), in the same font with the same text, in order. Only that + /// glyph's text takes the stroke; strokes over glyphs next to each other in a run gather and + /// restyle their text as one run, so a word filled whole and stroked whole stays one run. The + /// glyphs around them keep their own stroke or none (#7741). pub fn stroke_filled(&mut self, font: u128, at: Placement, opacity: f32, text: &str, stroke: TypeStroke, overprint: bool) -> bool { - let tolerance = self.at.size * 1e-3; // A stroke at another opacity than the fill's (`CA` and `ca` differ) is type of its own. let rest = if opacity == self.opacity { self.filled.get(self.stroked..) } else { None }; let found = rest.and_then(|rest| { rest.iter().position(|g| { g.font == font - && (g.origin - at.origin).hypot() < tolerance + && 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(glyph) = found.and_then(|i| self.filled.get(self.stroked + i).copied().map(|g| (i, g))) else { + let Some(index) = found.map(|i| self.stroked.saturating_add(i)) 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(); return self.stroke_last(font, at, stroke, overprint); }; - let (i, g) = glyph; - self.stroked = self.stroked.saturating_add(i).saturating_add(1); - self.stroke_from(g.run, g.start, stroke, overprint); + let continues = self + .pending + .as_ref() + .zip(self.filled.get(index)) + .is_some_and(|(p, g)| p.run == g.run && p.end == g.start && p.stroke == stroke && p.overprint == overprint); + if continues { + let end = self.filled.get(index).map(|g| g.start.saturating_add(g.len)); + if let (Some(p), Some(end)) = (&mut self.pending, end) { + p.end = end; + } + } else { + // Restyling what was gathered can move this glyph's text to another run: look it up after. + self.flush_stroke(); + if let Some(g) = self.filled.get(index) { + self.pending = Some(PendingStroke { run: g.run, start: g.start, end: g.start.saturating_add(g.len), stroke, overprint }); + } + } + self.stroked = index.saturating_add(1); true } - /// Stroke run `run` from byte `start` on: split there into a run of its own when the run is - /// stroked otherwise and `start` isn't its first glyph. - fn stroke_from(&mut self, run: usize, start: usize, stroke: TypeStroke, overprint: bool) { + /// 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. A run they make up whole is stroked + /// whole; text that comes right after a run drawn alike joins it. + fn flush_stroke(&mut self) { + let Some(PendingStroke { run, start, end, stroke, overprint }) = self.pending.take() else { return }; let last = run.saturating_add(1) == self.runs.len(); + let previous = run.checked_sub(1).and_then(|i| self.runs.get(i)).map(|(l, sh, t)| (l.clone(), *sh, t.len())); let Some((look, shift, text)) = self.runs.get_mut(run) else { return }; if look.stroke.as_ref() == Some(&stroke) && look.overprint_stroke == overprint { return; } - if !(start > 0 && start < text.len() && text.is_char_boundary(start)) { + if !(start < end && end <= text.len() && text.is_char_boundary(start) && text.is_char_boundary(end)) { + return; + } + if start == 0 && end == text.len() { (look.stroke, look.overprint_stroke) = (Some(stroke), overprint); return; } - let tail = text.split_off(start); + let tail = text.split_off(end); + let glyphs = text.split_off(start); + let head = std::mem::take(text); let mut own = look.clone(); (own.stroke, own.overprint_stroke) = (Some(stroke), overprint); - let shift = *shift; - self.runs.insert(run + 1, (own, shift, tail)); - // The runs after it move up one; the glyphs still to be stroked in the tail move with it. - for g in self.filled.iter_mut().skip(self.stroked) { - if g.run == run && g.start >= start { - (g.run, g.start) = (run + 1, g.start - start); - } else if g.run > run { - g.run += 1; + let (old, shift) = (look.clone(), *shift); + // The stroked text joins the run before when nothing is left before it in its own run and + // that run is drawn alike. + let joins = match &previous { + Some((l, sh, _)) => head.is_empty() && *l == own && (sh - shift).abs() < 1e-3, + None => false, + }; + let joined_at = previous.as_ref().map_or(0, |(.., len)| *len); + let mut pieces = vec![]; + if !head.is_empty() { + pieces.push((old.clone(), shift, head.clone())); + } + // Where each part of the run's text goes: its run and how far its new run's text starts + // before it (bytes), for the head, the stroked glyphs and the tail. + let head_at = (run, 0usize); + let glyphs_at = if joins { + (run.saturating_sub(1), joined_at) + } else { + pieces.push((own, shift, glyphs.clone())); + (run.saturating_add(pieces.len()).saturating_sub(1), 0) + }; + if !tail.is_empty() { + pieces.push((old, shift, tail)); + } + let tail_at = run.saturating_add(pieces.len()).saturating_sub(1); + let count = pieces.len(); + if joins && let Some((.., t)) = run.checked_sub(1).and_then(|i| self.runs.get_mut(i)) { + t.push_str(&glyphs); + } + self.runs.splice(run..run.saturating_add(1), pieces); + let moved = |r: usize, at: usize| -> (usize, usize) { + if r > run { + (r.saturating_add(count).saturating_sub(1), at) + } else if r < run { + (r, at) + } else if at < start { + (head_at.0, at) + } else if at < end { + (glyphs_at.0, at.saturating_sub(start).saturating_add(glyphs_at.1)) + } else { + (tail_at, at.saturating_sub(end)) } + }; + let from = self.stroked.min(self.filled.len()); + 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() { - if *i > run { - *i += 1; - } + *i = moved(*i, 0).0; } if last { - self.last_start = self.last_start.saturating_sub(start); + self.last_start = moved(run, self.last_start).1; } } @@ -644,10 +736,10 @@ impl TextLine { /// (#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. fn stroke_last(&mut self, font: u128, at: Placement, stroke: TypeStroke, overprint: bool) -> bool { + self.flush_stroke(); let start = self.last_start; - let Some((look, shift, text)) = - self.runs.last_mut().filter(|(l, ..)| l.font == font && (at.origin - self.last).hypot() < self.at.size * 1e-3) - else { + let last_at = self.last_at; + let Some((look, shift, text)) = self.runs.last_mut().filter(|(l, ..)| l.font == font && last_at.same_as(&at)) else { return false; }; let same = look.stroke.as_ref() == Some(&stroke) && look.overprint_stroke == overprint; @@ -668,6 +760,7 @@ impl TextLine { /// The point type object, its opacity and what else the line tells. pub fn finish(mut self) -> Option<(TextObject, f32, LineFacts)> { + self.flush_stroke(); let mut facts = LineFacts { ink: std::mem::take(&mut self.ink), ..LineFacts::default() }; // Turned along a curve: type on a path through the glyphs. let path = if self.curved() { self.baseline_path() } else { None }; diff --git a/crates/pdf/src/tests/textstroke.rs b/crates/pdf/src/tests/textstroke.rs index 8f71cbb441..e0bcfaa45c 100644 --- a/crates/pdf/src/tests/textstroke.rs +++ b/crates/pdf/src/tests/textstroke.rs @@ -204,3 +204,44 @@ fn a_word_filled_then_stroked_imports_as_one_filled_and_stroked_type() { let looks: Vec<_> = types.iter().flat_map(|t| &t.runs).map(|r| (r.style.fill == cream, !r.style.stroke.is_none())).collect(); assert_eq!(looks, [(true, false), (false, true)], "{content}"); } + +/// Helvetica PDF page drawing `content`, imported: each run of type as its text, size, and +/// whether it is filled and stroked, in text order. +fn word_runs(content: &str) -> Vec<(String, f64, bool, bool)> { + use vectorcraft_testkit::pdf::{PdfPage, pdf}; + let resources = "/Font << /F1 << /Type /Font /Subtype /Type1 /BaseFont /Helvetica >> >>"; + let bytes = pdf(&[PdfPage { resources: resources.into(), ..PdfPage::new(300.0, 200.0, content) }], None); + let d = import(&bytes).unwrap(); + let mut runs = vec![]; + d.walk(|n| { + if let NodeKind::Text(t) = &n.kind { + runs.extend(t.runs.iter().map(|r| (r.text.clone(), r.style.size, !r.style.fill.is_none(), !r.style.stroke.is_none()))); + } + }); + runs.sort_by(|a, b| a.0.cmp(&b.0).then(a.1.total_cmp(&b.1))); + runs +} + +/// A stroke goes only over a glyph filled with the very same placement: a word filled, then its +/// first glyph stroked at another size from the same origin, is two pieces of type, the word +/// unstroked and the glyph at its own size (#8015). +#[test] +fn a_stroke_at_another_size_does_not_go_over_the_filled_glyph() { + for mode in ["1", "2"] { + let content = format!("0 0 0 RG 1 1 0.8 rg 3 w BT /F1 60 Tf 40 110 Td (WAVE) Tj ET BT {mode} Tr /F1 30 Tf 40 110 Td (W) Tj 0 Tr ET"); + let filled = mode == "2"; + assert_eq!(word_runs(&content), [("W".to_string(), 30.0, filled, true), ("WAVE".to_string(), 60.0, true, false)], "{content}"); + } +} + +/// A stroke over one glyph of a filled word strokes that glyph alone, not the rest of the word +/// (#8015). +#[test] +fn a_stroke_over_one_glyph_of_a_filled_word_strokes_only_that_glyph() { + // W alone stroked at the same size from the same origin: W is stroked, AVE not. + let content = "0 0 0 RG 1 1 0.8 rg 3 w BT /F1 60 Tf 40 110 Td (WAVE) Tj ET BT 1 Tr /F1 60 Tf 40 110 Td (W) Tj 0 Tr ET"; + assert_eq!(word_runs(content), [("AVE".to_string(), 60.0, true, false), ("W".to_string(), 60.0, true, true)], "{content}"); + // Filled and stroked there instead: that W is drawn again, over the word, as type of its own. + let content = "0 0 0 RG 1 1 0.8 rg 3 w BT /F1 60 Tf 40 110 Td (WAVE) Tj ET BT 2 Tr /F1 60 Tf 40 110 Td (W) Tj 0 Tr ET"; + assert_eq!(word_runs(content), [("W".to_string(), 60.0, true, true), ("WAVE".to_string(), 60.0, true, false)], "{content}"); +} diff --git a/docs/file-format-parity.md b/docs/file-format-parity.md index 6fb1e13606..96e331c03a 100644 --- a/docs/file-format-parity.md +++ b/docs/file-format-parity.md @@ -345,7 +345,7 @@ Stop opacity on translated artboards remains outside this regression coverage. | Date | Change | Summary | |---|---|---| -| 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 at the same place in the same font with the same text on the line, 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 | 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` | | 2026-11-13 | minor | PDF import: glyphs inside a marked-content span with an empty `ActualText` come in as outlines in their fill and stroke instead of being left out, adding no text (#6971; `empty_actual_text_keeps_the_glyphs_art` in `crates/pdf/src/tests/actual_text.rs`). Scores and estimates unchanged. | diff --git a/docs/roadmap.md b/docs/roadmap.md index d909aae29b..67356d68dc 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -208,7 +208,7 @@ separate. Scores and hours unchanged. [Behavior and command details](development | Date | Change | Summary | |---|---|---| -| 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 at the same place in the same font with the same text on the line, 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 | 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 | 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-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 | diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index b78f00514b..8a2222402c 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -61,7 +61,7 @@ Artboard Options forwards the active Artboard tool's Scale Artwork with Artboard | Date | Change | Summary | |---|---|---| -| 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 at the same place in the same font with the same text on the line, 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 | 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`) 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 | G5: Neon & Glow joins Shadows and Glows, Outlines and Rules, Hand-Drawn, Textures, Painted and Sketched, Gradient Finishes, Shape Effects, Blends and Transparency, Game HUD and Status Effects as an eleventh built-in graphic style library (Cyan Neon, Magenta Laser, Amber Tube, Electric Lime, Pulse Violet, Cobalt Phosphor; original procedural styles generated in code); area score and estimate 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. | @@ -589,7 +589,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. 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. Synthetic PDFs written in the tests; no fonts or fixtures added. - **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.