From 9548a669a0e3c89435f4730a07cae2a0a2e3e7ea Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 15 Nov 2026 10:17:36 -0800 Subject: [PATCH] SVG export: type on a path that starts with a drawn repeat mark is outlined Type on a path whose frame starts with a repeat mark drawn as the character it repeats is now written as outlines with a warning, as other type on a path that a cannot reproduce is. With Kurikaeshi Moji Shori off it stays live text. --- crates/svg/src/export/text.rs | 5 +++++ crates/svg/tests/it/text_layout.rs | 31 ++++++++++++++++++++++++++++++ docs/mcp.md | 3 ++- 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/crates/svg/src/export/text.rs b/crates/svg/src/export/text.rs index 5a1e811062..907068c56d 100644 --- a/crates/svg/src/export/text.rs +++ b/crates/svg/src/export/text.rs @@ -294,6 +294,11 @@ impl Writer<'_> { self.warn("type on a path with bullets or numbers is outlined to keep its look"); return self.text_outlines(n, t); } + // Nor the character a repeat mark is drawn as in the mark's width (Kurikaeshi Moji Shori). + if !lay.repeat_marks.is_empty() { + self.warn("type on a path that starts with a repeat mark drawn as the character it repeats is outlined to keep its look"); + return self.text_outlines(n, t); + } return self.text_on_path(n, t, path, *start); } self.note_fonts(t, &lay); diff --git a/crates/svg/tests/it/text_layout.rs b/crates/svg/tests/it/text_layout.rs index a190f21dea..ff27c96955 100644 --- a/crates/svg/tests/it/text_layout.rs +++ b/crates/svg/tests/it/text_layout.rs @@ -941,3 +941,34 @@ fn a_repeat_mark_at_a_line_start_is_written_as_the_character_it_draws() { } } } + +/// Kurikaeshi Moji Shori: a `` cannot draw a character in another character's width, so +/// type on a path whose threaded frame starts with a repeat mark drawn as the character it repeats +/// is outlined, with a warning; with the setting off it stays live text. +#[test] +fn a_repeat_mark_starting_a_frame_on_a_path_is_outlined() { + use vectorcraft_text::test_fonts::{RARE_REPEAT_MARK_FAMILY, rare_repeat_mark_font}; + vectorcraft_text::FontDb::global().add_font(rare_repeat_mark_font().unwrap()); + let st = CharStyle { font_family: RARE_REPEAT_MARK_FAMILY.into(), ..style(12.0) }; + let mut line = BezPath::new(); + line.move_to((20.0, 40.0)); + line.line_to((280.0, 40.0)); + for on in [false, true] { + let mut t = TextObject::point(Point::ZERO, "々龘々", st.clone()); + t.kind = TextKind::OnPath { path: PathData::from_bezpath(&line), start: 0.0, end: None }; + t.para.kurikaeshi_moji_shori = on; + t.first_para_continues = true; + t.first_para_lead = Some('龘'); + let mut d = Document::new(300.0, 200.0); + let n = Node::new(d.alloc_id(), NodeKind::Text(Box::new(t))); + let l = d.layers[0].id; + d.insert(Some(l), 0, n).unwrap(); + let out = vectorcraft_svg::export_full(&d, &ExportOptions::default(), None); + let warned = out.warnings.iter().any(|w| w.contains("repeat mark")); + if on { + assert!(!out.svg.contains("々龘々<") && !warned, "{:?}: {}", out.warnings, out.svg); + } + } +} diff --git a/docs/mcp.md b/docs/mcp.md index 9dadf1c1d2..89393a9ae6 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -9458,7 +9458,8 @@ options) turns it on or off for the paragraphs of the selected type (or `ids`, o range touches). On, a repeat mark that starts a line of point or area type, horizontal or vertical, or starts a frame of type on a path (which holds one line), is drawn as the character it repeats, so both characters show when a line break separates them. The text keeps the mark: copying, searching, the caret and the line breaks stay as they were, and the drawn character takes the mark's place and width. -SVG export with live type writes the drawn character, and embeds its glyph when fonts are embedded. +SVG export with live type writes the drawn character, and embeds its glyph when fonts are embedded; it writes type on a +path that starts with such a mark as outlines, with a warning. VectorCraft's set of marks and its rules: 々 repeats a Han ideograph, ゝ and ゞ a hiragana, and ヽ and ヾ a katakana; the repeated character is the last one before the mark in the paragraph that is not a repeat mark, a soft return or a combining voicing mark (U+3099, U+309A), looking back into the frames before when threaded type continues a paragraph