PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Support typed font sizes and Fill and Sign text colours (#2444, #2496)
FredApps1d5c20c5c41a
diff --git a/ROADMAP.md b/ROADMAP.mdindex fe9723fdf..88625a7f4 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -1,5 +1,7 @@# PdfCraft roadmap+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (typed small Edit font sizes and Fill & Sign text/date colour, #2444/#2496; estimates unchanged)+**Stage: alpha** · next: beta, ~25% (ready for real work 50% → 75%) and ~400–700 h away> **Last reviewed:** 2026-10-13 · **Last updated:** 2026-10-14 · **Change:** minor (M14: the Italian catalog has every entry the other catalogs had and the code looks up; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)diff --git a/crates/automation/README.md b/crates/automation/README.mdindex 4e27702a3..ddd844df1 100644--- a/crates/automation/README.md+++ b/crates/automation/README.md@@ -209,3 +209,10 @@ behavior. Back/Forwardreturns to page tops, does not restore zoom, does not switch documents, and is not saved acrossrestarts. Standalone engine/MCP sessions have no viewport, so they do not have a separatenavigation-history tool; use the opt-in UI control channel to navigate the displayed document.++## Fill & Sign text appearance++`fill_sign_add` accepts `font_size` (4–300 pt, default 10) and `color`+(`#RRGGBB`, default black) for `text` and `date`. The colour is saved in the+FreeText appearance and survives reopening. Other mark/signature types reject+`color`; their appearance controls are separate.diff --git a/crates/automation/src/comments.rs b/crates/automation/src/comments.rsindex 302688f72..481d75f74 100644--- a/crates/automation/src/comments.rs+++ b/crates/automation/src/comments.rs@@ -477,6 +477,10 @@ impl Automation {if sensitivity.is_some() && !scan {return Err(ToolError::InvalidArgs("sensitivity is only for scan: true".into()));}+ let requested_color = a.color("color")?;+ if requested_color.is_some() && !matches!(kind, "text" | "date") {+ return Err(ToolError::InvalidArgs("color is only for type text or date".into()));+ }let requested_size = a.opt_num("font_size")?;if requested_size.is_some() && !matches!(kind, "text" | "date") {return Err(ToolError::InvalidArgs("font_size is only for type text or date".into()));@@ -555,7 +559,10 @@ impl Automation {(Shape::Mark { rect: [at[0] - w / 2.0, at[1] - h / 2.0, at[0] + w / 2.0, at[1] + h / 2.0], mark }, String::new())}};- let style = Style::default_for(&shape);+ let mut style = Style::default_for(&shape);+ if let Some(color) = requested_color {+ style.color = color;+ }self.apply(a, Edit::AddAnnotation(NewAnnotation { page, shape, style, contents, author }))}diff --git a/crates/automation/src/tools.rs b/crates/automation/src/tools.rsindex 5e89aef78..1bf59596f 100644--- a/crates/automation/src/tools.rs+++ b/crates/automation/src/tools.rs@@ -1162,7 +1162,7 @@ pub fn tools() -> Vec<ToolDef> {t("fill_sign_add","Fill & Sign: type text or place a mark",- "Fill in a form that has no fields, as Acrobat's Fill & Sign does: type text (`text`, default 10 pt; `font_size` 4–300 pt), place a check, cross, dot or line, today's date (in Preferences ▸ Date format, see fill_sign_date_format, or `format`; `font_size` also applies), or a signature or initials (either `text` drawn in a script font, or `path` to a local PNG/JPEG image up to 4 MiB and 32 megapixels, scaled down to 4 megapixels, preserving transparency; with `scan: true`, `path` is instead a photo of a signature on paper, within the same limits: the signature is found, and the paper, shadows and table around it are removed, with `sensitivity` 0–100, default 50, picking up fainter ink when higher). `at` [x, y] is in points from the top-left of the page: text's top-left, mark's centre, signature's left edge centred vertically. Image signatures fit within 150 pt wide and 32 pt tall (24 pt for initials). Creates movable, undoable annotations. Typed text the standard fonts can't draw is saved and drawn as `?` (`warnings` in the result says so); a typed signature neither the script font nor its fallback can draw is refused (pass `path` instead).",+ "Fill in a form that has no fields, as Acrobat's Fill & Sign does: type text (`text`, default 10 pt; `font_size` 4–300 pt; optional `color` as #RRGGBB for text/date, default black), place a check, cross, dot or line, today's date (in Preferences ▸ Date format, see fill_sign_date_format, or `format`; `font_size` also applies), or a signature or initials (either `text` drawn in a script font, or `path` to a local PNG/JPEG image up to 4 MiB and 32 megapixels, scaled down to 4 megapixels, preserving transparency; with `scan: true`, `path` is instead a photo of a signature on paper, within the same limits: the signature is found, and the paper, shadows and table around it are removed, with `sensitivity` 0–100, default 50, picking up fainter ink when higher). `at` [x, y] is in points from the top-left of the page: text's top-left, mark's centre, signature's left edge centred vertically. Image signatures fit within 150 pt wide and 32 pt tall (24 pt for initials). Creates movable, undoable annotations. Typed text the standard fonts can't draw is saved and drawn as `?` (`warnings` in the result says so); a typed signature neither the script font nor its fallback can draw is refused (pass `path` instead).",).cmd("sign.fill.text").with(schema(@@ -1173,6 +1173,7 @@ pub fn tools() -> Vec<ToolDef> {"at": point(),"text": { "type": "string", "minLength": 1 },"font_size": { "type": "number", "minimum": 4, "maximum": 300, "description": "For type text or date (default 10 pt)." },+ "color": color(),"path": { "type": "string", "description": "PNG or JPEG for signature/initials; pass either path or text." },"scan": { "type": "boolean", "description": "With path: scan a photo of a signature on paper (default false)." },"sensitivity": { "type": "integer", "minimum": 0, "maximum": 100, "description": "With scan: how faint ink may be, 0–100 (default 50)." },diff --git a/crates/automation/tests/automation.rs b/crates/automation/tests/automation.rsindex 1e662d8f3..21b1794cf 100644--- a/crates/automation/tests/automation.rs+++ b/crates/automation/tests/automation.rs@@ -2785,6 +2785,38 @@ fn fill_sign_text_font_size_is_saved_and_validated() {));}+#[test]+fn fill_sign_text_and_date_colours_are_saved_and_validated() {+ let dir = workdir("fill-sign-text-colour");+ let mut a = auto(&dir);+ let doc = ok(&mut a, "doc_open", json!({ "path": "a.pdf" }))["doc"].as_u64().unwrap();+ for (kind, y) in [("text", 40), ("date", 80)] {+ ok(+ &mut a,+ "fill_sign_add",+ json!({ "doc": doc, "page": 1, "type": kind, "at": [20, y], "text": "Blue", "color": "#3366CC", "font_size": 6.5 }),+ );+ }+ for (kind, color) in [("text", "not-a-colour"), ("signature", "#3366CC"), ("check", "#3366CC")] {+ assert!(matches!(+ a.call("fill_sign_add", &json!({ "doc": doc, "page": 1, "type": kind, "at": [20, 100], "text": "No", "color": color })),+ Err(ToolError::InvalidArgs(_))+ ));+ }+ ok(&mut a, "doc_save", json!({ "doc": doc, "path": "coloured.pdf" }));+ let pdf = pdfcraft_cos::Document::open(std::sync::Arc::new(std::fs::read(dir.join("coloured.pdf")).unwrap())).unwrap();+ let page = pdfcraft_model::pages(&pdf).remove(0);+ let annotations = pdf.resolve(page.dict.get(b"Annots").unwrap());+ let annotations = annotations.as_array().unwrap();+ assert_eq!(annotations.len(), 2, "invalid requests add nothing");+ for reference in annotations {+ let annotation = pdf.resolve(reference);+ // FreeText stores its text colour in DA; C is the annotation background.+ let da = annotation.as_dict().unwrap().get(b"DA").unwrap().as_string().unwrap();+ assert_eq!(String::from_utf8(da.bytes.to_vec()).unwrap(), "0.2 0.4 0.8 rg /Helv 6.5 Tf");+ }+}+#[test]fn image_signatures_through_tools_preserve_transparency_and_survive_save() {let dir = workdir("image-signatures");diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex 989b731b7..42454d7d9 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -2850,6 +2850,7 @@ pub fn document_area(app: &mut PdfCraftApp, index: usize, ui: &mut egui::Ui) {info,ft,app.fill_text_size,+ app.fill_text_color,view,signature.as_ref(),initials.as_ref(),@@ -4436,6 +4437,14 @@ fn quick_bar(app: &mut PdfCraftApp, area: Rect, ui: &mut egui::Ui) {.suffix(" pt"),);}+ if matches!(current_fill, Some(crate::fill_sign::FillTool::Text | crate::fill_sign::FillTool::Date)) {+ ui.menu_button(tl!("Colour"), |ui| {+ if let Some(color) = comments::swatch_grid(ui, Some(app.fill_text_color)) {+ app.fill_text_color = color;+ ui.close();+ }+ });+ }if let QuickTool::Comment(tool) = app.quick_tool {let (r, _) = ui.allocate_exact_size(vec2(32.0, 9.0), Sense::hover());ui.painter().hline(r.x_range().shrink(6.0), r.center().y, Stroke::new(1.0, t.divider));diff --git a/crates/ui-egui/src/content_ui.rs b/crates/ui-egui/src/content_ui.rsindex 5f5ef32f7..110e60815 100644--- a/crates/ui-egui/src/content_ui.rs+++ b/crates/ui-egui/src/content_ui.rs@@ -605,6 +605,43 @@ fn finish(cv: &mut ContentView, d: TextDraft, added: &[Added]) -> Option<Edit> {}}+/// Commit a typed size once (Enter or leaving the field), rather than one undo step per key.+/// The bounds match AddedText validation, so the panel also accepts coloured text below 8 pt.+fn font_size_input(ui: &mut egui::Ui, size: &mut f64) {+ let id = ui.make_persistent_id("font-size-input");+ let (previous, mut text) = ui.data(|d| d.get_temp::<(u64, String)>(id)).unwrap_or_else(|| (size.to_bits(), size.to_string()));+ if previous != size.to_bits() {+ text = size.to_string();+ }+ let response = ui.add(egui::TextEdit::singleline(&mut text).id(id).desired_width(44.0));+ response.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::TextEdit, ui.is_enabled(), tl!("Font size:")));+ let cancel = response.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Escape));+ if cancel {+ text = size.to_string();+ response.surrender_focus();+ } else if response.lost_focus() || (response.has_focus() && ui.input(|i| i.key_pressed(egui::Key::Enter))) {+ if let Some(value) = typed_font_size(&text) {+ *size = value;+ }+ text = size.to_string();+ }+ let before = *size;+ egui::ComboBox::from_id_salt("font-size").selected_text("pt").width(28.0).show_ui(ui, |ui| {+ for value in [4.0, 6.0, 8.0, 9.0, 10.0, 11.0, 12.0, 14.0, 16.0, 18.0, 20.0, 24.0, 28.0, 36.0, 48.0, 72.0] {+ ui.selectable_value(size, value, format!("{value} pt"));+ }+ });+ if *size != before {+ text = size.to_string();+ }+ ui.data_mut(|d| d.insert_temp(id, (size.to_bits(), text)));+}++fn typed_font_size(text: &str) -> Option<f64> {+ let value = text.trim().parse::<f64>().ok()?;+ (value.is_finite() && (1.0..=500.0).contains(&value)).then_some(value)+}+/// Format text (shown in the Edit panel while a text item is selected, or for new text)./// Returns the changed style; for a selected item the caller turns it into an update.pub(crate) fn format_panel(ui: &mut egui::Ui, t: &Tokens, style: &AddedText) -> Option<AddedText> {@@ -616,12 +653,7 @@ pub(crate) fn format_panel(ui: &mut egui::Ui, t: &Tokens, style: &AddedText) ->ui.selectable_value(&mut s.family, f, f.label());}});- // A list rather than a drag value: every change is an undo step.- egui::ComboBox::from_id_salt("font-size").selected_text(format!("{} pt", s.size)).width(70.0).show_ui(ui, |ui| {- for size in [8.0, 9.0, 10.0, 11.0, 12.0, 14.0, 16.0, 18.0, 20.0, 24.0, 28.0, 36.0, 48.0, 72.0] {- ui.selectable_value(&mut s.size, size, format!("{size} pt"));- }- });+ font_size_input(ui, &mut s.size);});ui.horizontal(|ui| {if ui.selectable_label(s.bold, egui::RichText::new("B").strong()).on_hover_text(tl!("Bold")).clicked() {@@ -911,6 +943,45 @@ mod tests {use super::*;+ #[test]+ fn typed_sizes_accept_small_fractional_values_and_reject_invalid_input() {+ for value in ["1", "4", "6.5", " 13.25 ", "500"] {+ assert_eq!(typed_font_size(value), Some(value.trim().parse().unwrap()));+ }+ for value in ["", "0", "-1", "0.5", "501", "NaN", "inf", "1e999", "small"] {+ assert_eq!(typed_font_size(value), None, "{value}");+ }+ }++ #[test]+ fn typed_size_commits_once_and_invalid_input_preserves_the_style() {+ let mut h = egui_kittest::Harness::new_ui_state(+ |ui, state: &mut (f64, usize)| {+ let before = state.0;+ ui.horizontal(|ui| font_size_input(ui, &mut state.0));+ if state.0 != before {+ state.1 += 1;+ }+ },+ (12.0, 0),+ );+ h.run();+ let enter = || egui::Event::Key { key: egui::Key::Enter, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::NONE };+ let select_all =+ || egui::Event::Key { key: egui::Key::A, physical_key: None, pressed: true, repeat: false, modifiers: egui::Modifiers::COMMAND };+ for (text, expected, changes) in [("6.5", 6.5, 1), ("NaN", 6.5, 1), ("0", 6.5, 1), ("13.25", 13.25, 2)] {+ h.get_by_role_and_label(egui::accesskit::Role::TextInput, "Font size:").click();+ h.run();+ h.event(select_all());+ h.event(egui::Event::Text(text.into()));+ h.run_steps(2);+ assert_eq!(h.state().1, changes - usize::from(text == "6.5" || text == "13.25"), "typing alone does not commit");+ h.event(enter());+ h.run_steps(2);+ assert_eq!(*h.state(), (expected, changes));+ }+ }+/// The image a flip button leaves behind, as the panel returns it.fn flipped(tooltip: &str) -> pdfcraft_engine::AddedImage {let img = pdfcraft_engine::AddedImage::new([0.0, 0.0, 100.0, 50.0], pdfcraft_cos::ObjRef::new(7, 0));diff --git a/crates/ui-egui/src/editing.rs b/crates/ui-egui/src/editing.rsindex be1347d68..38a26b871 100644--- a/crates/ui-egui/src/editing.rs+++ b/crates/ui-egui/src/editing.rs@@ -531,7 +531,7 @@ impl PdfCraftApp {}let author = self.comment_prefs.author.clone();let rotation = self.session.get(id).map_or(0, |doc| crate::comments::page_rotation(&doc.info, tb.page));- let edit = crate::fill_sign::typed(tb.page, tb.at, &text, tb.size, rotation, &author);+ let edit = crate::fill_sign::typed_with_color(tb.page, tb.at, &text, tb.size, rotation, &author, tb.color);if self.apply_edit(edit) {if let Some(view) = self.views.get_mut(i) {view.fill_text = None;diff --git a/crates/ui-egui/src/fill_sign.rs b/crates/ui-egui/src/fill_sign.rsindex 794fe0bf1..084b5290f 100644--- a/crates/ui-egui/src/fill_sign.rs+++ b/crates/ui-egui/src/fill_sign.rs@@ -404,6 +404,7 @@ pub struct TypeBox {pub at: [f64; 2],pub text: String,pub size: f64,+ pub color: [f64; 3],pub focus: bool,}@@ -416,6 +417,10 @@ pub fn valid_text_size(size: f64) -> Option<f64> {(size.is_finite() && (MIN_TEXT_SIZE..=MAX_TEXT_SIZE).contains(&size)).then_some(size)}+pub fn valid_text_color(color: [f64; 3]) -> Option<[f64; 3]> {+ color.iter().all(|v| v.is_finite() && (0.0..=1.0).contains(v)).then_some(color)+}+fn to_user(xf: &PageXform, info: &DocInfo, page: usize, p: Pos2) -> [f64; 2] {let (vx, vy) = xf.screen_to_view(p);let u = info.pages[page].view_to_user(vx, vy);@@ -430,8 +435,16 @@ fn new(page: usize, shape: Shape, contents: String, author: &str) -> Edit {/// A typewriter annotation sized to its text, its displayed top-left at `at` on a page turned by/// `rotation` (its `/Rotate`).pub fn typed(page: usize, at: [f64; 2], text: &str, size: f64, rotation: i64, author: &str) -> Edit {+ typed_with_color(page, at, text, size, rotation, author, [0.0; 3])+}++/// Typed text/date colour applies to its annotation appearance and survives saving.+pub fn typed_with_color(page: usize, at: [f64; 2], text: &str, size: f64, rotation: i64, author: &str, color: [f64; 3]) -> Edit {let rect = crate::comments::text_box_rect(at, text, size, rotation);- new(page, Shape::Typewriter { rect, font_size: size }, text.to_string(), author)+ let shape = Shape::Typewriter { rect, font_size: size };+ let mut style = Style::default_for(&shape);+ style.color = valid_text_color(color).unwrap_or([0.0; 3]);+ Edit::AddAnnotation(NewAnnotation { page, shape, style, contents: text.to_string(), author: author.to_string() })}/// Place a saved signature (strokes normalised to a 0–1 box, y up) with its left edge at `at`,@@ -620,6 +633,7 @@ pub(crate) fn page_input(info: &DocInfo,tool: FillTool,text_size: f64,+ text_color: [f64; 3],view: &mut DocView,signature: Option<&SavedSig>,initials: Option<&SavedSig>,@@ -657,13 +671,21 @@ pub(crate) fn page_input(FillTool::Text => {// Clicking away from an open box commits it: the page sees this click before the box// sees its lost focus, so replacing the box first would drop what was typed.- let open = view.fill_text.replace(TypeBox { page, at: top, text: String::new(), size: text_size, focus: true });+ let open = view.fill_text.replace(TypeBox { page, at: top, text: String::new(), size: text_size, color: text_color, focus: true });open.filter(|tb| !tb.text.trim().is_empty()).map(|tb| {- FillAction::Edit(Box::new(typed(tb.page, tb.at, tb.text.trim(), tb.size, crate::comments::page_rotation(info, tb.page), author)))+ FillAction::Edit(Box::new(typed_with_color(+ tb.page,+ tb.at,+ tb.text.trim(),+ tb.size,+ crate::comments::page_rotation(info, tb.page),+ author,+ tb.color,+ )))})}FillTool::Date => Some(match date_text {- Ok(text) => FillAction::Edit(Box::new(typed(page, top, text, text_size, rotation, author))),+ Ok(text) => FillAction::Edit(Box::new(typed_with_color(page, top, text, text_size, rotation, author, text_color))),Err(why) => FillAction::Refused(why.clone()),}),FillTool::Signature => match signature {@@ -719,7 +741,7 @@ pub(crate) fn type_box(ctx: &egui::Context, view: &mut DocView, info: &DocInfo,.font(egui::FontId::proportional((t.size as f32 * zoom).max(8.0))).desired_width(width).background_color(Color32::from_rgba_unmultiplied(255, 255, 255, 230))- .text_color(Color32::BLACK)+ .text_color(crate::comments::color32(t.color)).hint_text(tl!("Type text")).id_salt("fill-text-edit"),);@@ -740,7 +762,7 @@ pub(crate) fn type_box(ctx: &egui::Context, view: &mut DocView, info: &DocInfo,if commit {let tb = view.fill_text.take()?;if !tb.text.trim().is_empty() {- return Some(typed(tb.page, tb.at, tb.text.trim(), tb.size, crate::comments::page_rotation(info, tb.page), author));+ return Some(typed_with_color(tb.page, tb.at, tb.text.trim(), tb.size, crate::comments::page_rotation(info, tb.page), author, tb.color));}}Nonediff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex d101d812e..576784e19 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -550,6 +550,8 @@ pub struct PdfCraftApp {pub flatten_fill_sign_on_save: bool,/// Point size for new Fill & Sign text and dates, kept across launches.pub fill_text_size: f64,+ /// Colour for new Fill & Sign text and dates, kept across launches.+ pub fill_text_color: [f64; 3],pub dialog: Option<Dialog>,/// How to ask for the latest release (the desktop app sets it; see `updates`).pub update_source: Option<updates::UpdateSource>,@@ -921,6 +923,7 @@ impl PdfCraftApp {ui_scale_applied: None,flatten_fill_sign_on_save: false,fill_text_size: fill_sign::TEXT_SIZE,+ fill_text_color: [0.0; 3],dialog: None,update_source: None,updates: updates::Updates::default(),@@ -2276,6 +2279,7 @@ impl PdfCraftApp {"right_panel_closed": self.right_panel_closed,});// Set apart: one more key inside the macro above passes serde_json's recursion limit.+ v["fill_text_color"] = serde_json::json!(self.fill_text_color);v["redact_prefs"] = self.redact_defaults.to_json();// Set outside json! above, which is at serde_json's macro recursion limit.v["hide_empty_highlight_hover"] = serde_json::Value::Bool(self.comment_prefs.hide_empty_highlight_hover);@@ -2357,6 +2361,11 @@ impl PdfCraftApp {if let Some(size) = v["fill_text_size"].as_f64().and_then(fill_sign::valid_text_size) {self.fill_text_size = size;}+ if let Ok(color) = serde_json::from_value::<[f64; 3]>(v["fill_text_color"].clone())+ && let Some(color) = fill_sign::valid_text_color(color)+ {+ self.fill_text_color = color;+ }if let Some(prefs) = RedactPrefs::from_json(&v["redact_prefs"]) {self.redact_prefs = prefs.clone();self.redact_defaults = prefs;diff --git a/crates/ui-egui/tests/control.rs b/crates/ui-egui/tests/control.rsindex 88ed1c0a9..a93e035c7 100644--- a/crates/ui-egui/tests/control.rs+++ b/crates/ui-egui/tests/control.rs@@ -1425,8 +1425,14 @@ fn rail_reveals_its_remembered_inactive_inspector_then_closes_the_visible_panel(#[test]fn control_quit_retains_inactive_fill_sign_typing_after_cancel() {let (mut h, c) = harness();- h.state_mut().views[0].fill_text =- Some(pdfcraft_ui_egui::fill_sign::TypeBox { page: 0, at: [40.0, 200.0], text: "Unsaved signature note".into(), size: 10.0, focus: false });+ h.state_mut().views[0].fill_text = Some(pdfcraft_ui_egui::fill_sign::TypeBox {+ page: 0,+ at: [40.0, 200.0],+ text: "Unsaved signature note".into(),+ size: 10.0,+ color: [0.0; 3],+ focus: false,+ });h.state_mut().active = None;assert!(!h.state().session.get(h.state().views[0].id).unwrap().dirty);assert_eq!(ok(&mut h, &c, "ui.quit", json!({})), json!({"quitting":false,"needs_confirmation":true}));diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex f8db52575..4a3178424 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -2876,6 +2876,41 @@ fn the_format_panel_restyles_the_paragraph_being_edited() {assert!(s.views[0].line_editor.as_ref().is_some_and(|e| e.extras.underline));}+#[test]+fn typed_small_coloured_text_size_survives_save_and_reopen() {+ let mut h = harness(1, |_| {});+ assert!(h.state_mut().execute("edit.edit_text"));+ h.run_steps(2);+ let r = h.state().views[0].page_screen_rect(0).unwrap();+ let at = egui::pos2(r.left() + 40.0 / 200.0 * r.width(), r.top() + (300.0 - 158.0) / 300.0 * r.height());+ h.hover_at(at);+ h.run_steps(1);+ h.drag_at(at);+ h.run_steps(1);+ h.drop_at(at);+ h.run_steps(3);+ assert!(h.state().views[0].line_editor.is_some());+ h.get_by_label("Font size:").click();+ h.run_steps(1);+ h.key_press_modifiers(Modifiers::COMMAND, Key::A);+ h.event(egui::Event::Text("6.5".into()));+ h.key_press(Key::Enter);+ h.run_steps(4);+ h.get_by_label("Blue").click();+ h.run_steps(4);+ let id = h.state().views[0].id;+ let lines = h.state().session.get(id).unwrap().text_lines(0);+ assert!(!lines.is_empty());+ for line in &lines {+ assert!((line.size - 6.5).abs() < 0.01, "{line:?}");+ assert!(line.color[2] > line.color[0], "the small text stays blue: {line:?}");+ }+ let saved = h.state().session.save_bytes(id).unwrap();+ let mut reopened = pdfcraft_engine::Session::new();+ let rid = reopened.open("small-blue.pdf", None, saved, None).unwrap();+ assert_eq!(reopened.get(rid).unwrap().text_lines(0), lines);+}+#[test]fn selected_text_formatting_keeps_the_rest_of_the_paragraph_and_reopens() {let mut h = harness(1, |_| {});diff --git a/crates/ui-egui/tests/fill_sign.rs b/crates/ui-egui/tests/fill_sign.rsindex 27fd6dd8a..b888e1e23 100644--- a/crates/ui-egui/tests/fill_sign.rs+++ b/crates/ui-egui/tests/fill_sign.rs@@ -168,6 +168,53 @@ fn fill_text_size_controls_new_text_and_survives_settings_restore() {assert_eq!(restored.fill_text_size, 24.0, "invalid settings do not change the size");}+#[test]+fn fill_text_colour_survives_preview_commit_settings_and_save() {+ let mut h = harness();+ h.state_mut().execute("sign.fill.text");+ h.run_steps(2);+ h.get_by_label("Colour").click();+ h.run_steps(2);+ h.get_by_label("Blue").click();+ h.run_steps(2);+ let color = h.state().fill_text_color;+ assert!(color[2] > color[0], "blue was selected: {color:?}");+ click(&mut h, 50.0, 250.0);+ assert_eq!(h.state().views[0].fill_text.as_ref().unwrap().color, color, "the editor uses the selected colour");+ h.event(egui::Event::Text("Blue form text".into()));+ h.run_steps(2);+ h.key_press(egui::Key::Enter);+ h.run_steps(3);+ let id = h.state().views[0].id;+ let expected = color.map(|v| v as f32);+ let annotation = h.state().session.get(id).unwrap().info.annotations.iter().find(|a| a.contents.as_deref() == Some("Blue form text")).unwrap();+ assert_eq!(annotation.color, Some(expected));+ let bytes = h.state().session.save_bytes(id).unwrap();+ let reopened = harness_bytes(&bytes);+ let saved = reopened+ .state()+ .session+ .get(reopened.state().views[0].id)+ .unwrap()+ .info+ .annotations+ .iter()+ .find(|a| a.contents.as_deref() == Some("Blue form text"))+ .unwrap();+ assert_eq!(saved.color, Some(expected));+ let mut restored = PdfCraftApp::new();+ restored.restore(&h.state().persist());+ assert_eq!(restored.fill_text_color, color);+ restored.restore(r#"{"fill_text_color":[2,0,0]}"#);+ assert_eq!(restored.fill_text_color, color, "invalid saved colours are ignored");+ h.state_mut().execute("edit.undo");+ h.run_steps(2);+ assert!(!items(&h).iter().any(|(_, text)| text.as_deref() == Some("Blue form text")));+ h.state_mut().execute("edit.redo");+ h.run_steps(2);+ assert!(items(&h).iter().any(|(_, text)| text.as_deref() == Some("Blue form text")));+}+#[test]fn the_type_box_grows_as_text_is_typed() {let mut h = harness();@@ -995,7 +1042,7 @@ fn saving_flattens_fill_and_sign_only_when_the_preference_is_on() {app.open_bytes("form.pdf", None, FIXTURE.to_vec()).unwrap();let id = app.views[0].id;app.session.apply(id, mark).unwrap();- app.views[0].fill_text = Some(TypeBox { page: 0, at: [40.0, 200.0], text: "Typed".into(), size: 10.0, focus: false });+ app.views[0].fill_text = Some(TypeBox { page: 0, at: [40.0, 200.0], text: "Typed".into(), size: 10.0, color: [0.0; 3], focus: false });let kept = dir.join("kept.pdf");app.save_override = Some(kept.to_string_lossy().into_owned());assert!(app.save_active(SaveTarget::InPlace));@@ -1006,7 +1053,7 @@ fn saving_flattens_fill_and_sign_only_when_the_preference_is_on() {assert!(texts.iter().any(|t| t == "Typed"), "an open type box is saved: {texts:?}");assert_eq!(reopened.session.get(reopened.views[0].id).unwrap().info.annotations.len(), 2, "the check mark stays too");- app.views[0].fill_text = Some(TypeBox { page: 0, at: [40.0, 160.0], text: "More".into(), size: 10.0, focus: false });+ app.views[0].fill_text = Some(TypeBox { page: 0, at: [40.0, 160.0], text: "More".into(), size: 10.0, color: [0.0; 3], focus: false });app.flatten_fill_sign_on_save = true;let flat = dir.join("flat.pdf");app.save_override = Some(flat.to_string_lossy().into_owned());diff --git a/docs/roadmap.md b/docs/roadmap.mdindex 3148823ea..ffb34ffd7 100644--- a/docs/roadmap.md+++ b/docs/roadmap.md@@ -1,5 +1,7 @@# PdfCraft roadmap: milestones and what's next+> **Last reviewed:** 2026-10-15 · **Last updated:** 2026-10-15 · **Change:** minor (typed small Edit font sizes and Fill & Sign text/date colour, #2444/#2496; estimates unchanged)+> **Last reviewed:** 2026-10-13 · **Last updated:** 2026-10-14 · **Change:** minor (M14: the Italian catalog has every entry the other catalogs had and the code looks up, 2,528 entries; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-12 · **Last updated:** 2026-10-13 · **Change:** minor (M2/M6: spot-colour images convert once per pixel value; widget placement and the Fields panel scale with the field count; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)> **Last reviewed:** 2026-10-14 · **Last updated:** 2026-10-14 · **Change:** minor (M3 candidate: coordinate control clicks on slow frames and coalesced text selection; estimates unchanged) · **Target:** Adobe Acrobat Pro (Acrobat DC, continuous track 26.002.21931, macOS)diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex 533013b54..7c35e73b5 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -1926,8 +1926,8 @@ milestone = "M7"status = "shipped"commands = ["edit.edit_text", "edit.text"]tools = ["text_edit", "content_update"]-evidence = ["crates/edit/src/tests.rs::paragraphs_take_new_formatting", "crates/ui-egui/tests/editing.rs::the_format_panel_restyles_the_paragraph_being_edited", "crates/automation/tests/automation.rs::editing_existing_text_through_tools"]-notes = "existing paragraphs and added text: font family (Helvetica, Times, Courier) with bold and italic, size, colour; existing paragraphs are rewrapped"+evidence = ["crates/edit/src/tests.rs::paragraphs_take_new_formatting", "crates/ui-egui/tests/editing.rs::the_format_panel_restyles_the_paragraph_being_edited", "crates/automation/tests/automation.rs::editing_existing_text_through_tools", "crates/ui-egui/src/content_ui.rs::typed_sizes_accept_small_fractional_values_and_reject_invalid_input", "crates/ui-egui/src/content_ui.rs::typed_size_commits_once_and_invalid_input_preserves_the_style", "crates/ui-egui/tests/editing.rs::typed_small_coloured_text_size_survives_save_and_reopen"]+notes = "existing paragraphs and added text: font family (Helvetica, Times, Courier) with bold and italic, size, colour; existing paragraphs are rewrapped; the Edit font-size field accepts typed fractional values from 1–500 pt, including below 8 pt; Enter/focus loss commits once and invalid input preserves the previous value"[[feature]]id = "edit.text-format-style"@@ -5268,8 +5268,8 @@ milestone = "M5"status = "shipped"commands = ["sign.fill.text"]tools = ["fill_sign_add"]-evidence = ["crates/ui-egui/tests/fill_sign.rs::text_marks_and_date", "crates/annot/src/tests.rs::fill_and_sign_items_are_drawn", "crates/automation/tests/automation.rs::fill_and_sign_through_tools", "crates/engine/src/tests.rs::typed_text_reads_across_as_displayed_on_rotated_pages"]-notes = "typewriter FreeText, 10 pt Helvetica. Reads across as displayed on pages with /Rotate (sideways-stored scans): the box follows the displayed axes and the appearance is turned back (PdfCraft key /PCTextRotate); other apps that regenerate the appearance from /DA draw it unturned. A later page rotation does not re-turn it. Field detection does not work on scanned (image-only) forms yet"+evidence = ["crates/ui-egui/tests/fill_sign.rs::text_marks_and_date", "crates/annot/src/tests.rs::fill_and_sign_items_are_drawn", "crates/automation/tests/automation.rs::fill_and_sign_through_tools", "crates/engine/src/tests.rs::typed_text_reads_across_as_displayed_on_rotated_pages", "crates/ui-egui/tests/fill_sign.rs::fill_text_colour_survives_preview_commit_settings_and_save", "crates/automation/tests/automation.rs::fill_sign_text_and_date_colours_are_saved_and_validated"]+notes = "typewriter FreeText, 10 pt Helvetica. Reads across as displayed on pages with /Rotate (sideways-stored scans): the box follows the displayed axes and the appearance is turned back (PdfCraft key /PCTextRotate); other apps that regenerate the appearance from /DA draw it unturned. A later page rotation does not re-turn it. Field detection does not work on scanned (image-only) forms yet; text/date colour is selectable, remembered and preserved in saved appearances; fill_sign_add exposes color and font_size"[[feature]]id = "form.fill-sign-marks"@@ -5292,8 +5292,8 @@ milestone = "M5"status = "shipped"commands = ["sign.fill.date"]tools = ["fill_sign_add", "fill_sign_date_format"]-evidence = ["crates/ui-egui/tests/fill_sign.rs::text_marks_and_date", "crates/automation/tests/automation.rs::fill_and_sign_through_tools", "crates/ui-egui/tests/date_format.rs::fill_and_sign_dates_follow_the_date_format_preference_and_it_is_remembered", "crates/engine/src/dates.rs::presets_write_the_day_in_their_own_order", "crates/engine/src/dates.rs::names_follow_the_date_language", "crates/ui-egui/tests/date_format.rs::month_names_follow_the_date_language_or_else_the_interface_language", "crates/ui-egui/tests/date_format.rs::a_date_the_pdf_cannot_hold_is_refused_with_a_warning_first"]-notes = "local date in Preferences ▸ Date format (default m/d/yyyy; 12 presets or any pattern in Acrobat date letters with \\ escapes, checked and previewed as typed, remembered; only whole date codes accepted; month and weekday names in the interface languages, Czech months in the genitive after a day, following the interface language unless one is picked; fill_sign_add takes a one-off format and language). Beyond Acrobat: its Fill & Sign has no format setting (only Acrobat Sign accounts do). Missing: Fill & Sign text is Helvetica/WinAnsi, so a date with letters outside Western European (Czech ř, Japanese, Chinese names) is refused with a warning instead of being saved as ?; the OS locale's format isn't offered as a preset; names in languages without an interface translation"+evidence = ["crates/ui-egui/tests/fill_sign.rs::text_marks_and_date", "crates/automation/tests/automation.rs::fill_and_sign_through_tools", "crates/ui-egui/tests/date_format.rs::fill_and_sign_dates_follow_the_date_format_preference_and_it_is_remembered", "crates/engine/src/dates.rs::presets_write_the_day_in_their_own_order", "crates/engine/src/dates.rs::names_follow_the_date_language", "crates/ui-egui/tests/date_format.rs::month_names_follow_the_date_language_or_else_the_interface_language", "crates/ui-egui/tests/date_format.rs::a_date_the_pdf_cannot_hold_is_refused_with_a_warning_first", "crates/automation/tests/automation.rs::fill_sign_text_and_date_colours_are_saved_and_validated"]+notes = "local date in Preferences ▸ Date format (default m/d/yyyy; 12 presets or any pattern in Acrobat date letters with \\ escapes, checked and previewed as typed, remembered; only whole date codes accepted; month and weekday names in the interface languages, Czech months in the genitive after a day, following the interface language unless one is picked; fill_sign_add takes a one-off format and language). Beyond Acrobat: its Fill & Sign has no format setting (only Acrobat Sign accounts do). Missing: Fill & Sign text is Helvetica/WinAnsi, so a date with letters outside Western European (Czech ř, Japanese, Chinese names) is refused with a warning instead of being saved as ?; the OS locale's format isn't offered as a preset; names in languages without an interface translation; shares the Fill & Sign text colour preference and tool argument"[[feature]]id = "form.fill-sign-signature"