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 <textPath> cannot reproduce is. With Kurikaeshi
Moji Shori off it stays live text.
This commit is contained in:
dotCooCoo
2026-11-15 10:18:45 -08:00
parent 3ca38f2237
commit 9548a669a0
3 changed files with 38 additions and 1 deletions
+5
View File
@@ -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);
+31
View File
@@ -941,3 +941,34 @@ fn a_repeat_mark_at_a_line_start_is_written_as_the_character_it_draws() {
}
}
}
/// Kurikaeshi Moji Shori: a `<textPath>` 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("<textPath") && warned, "{:?}: {}", out.warnings, out.svg);
} else {
assert!(out.svg.contains(">々龘々<") && !warned, "{:?}: {}", out.warnings, out.svg);
}
}
}
+2 -1
View File
@@ -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