WMF: arcs on whole units, text by its font's ascent, no chords

Arcs and pies are cut at whole multiples of 1/99 turn round the
ellipse's whole-unit centre and radii, rounded down, from the start ray
to the end ray. Text sits the font's ascent below its reference point
and is four fifths of it tall; its style is WMF-<face><n> on the
installed file of that face. CHORD records are not read.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-16 19:12:47 +03:00
1 parent 8e9bd7db69
commit 9ddc103bcc
3 files changed
+215 -50

No files matched your search

+14 -15
View File
@@ -145,22 +145,21 @@ impl OpenCADStudio {
};
self.push_undo_snapshot(i, if prompt { "WMFIN" } else { "IMPORT" });
let scene = &mut self.tabs[i].scene;
// A text style per font, named WMF-<n> after the first free number.
// A text style per face, `WMF-<face><n>` with `n` counting the
// face's bold and italic variants; the style's font is the
// installed file of that face, none when it is not installed. A
// style the drawing already has is used as it is.
let mut styles: Vec<String> = Vec::new();
for _ in &picture.fonts {
let mut n = 0;
let name = loop {
let name = format!("WMF-{n}");
if !scene.document.text_styles.contains(&name) && !styles.contains(&name) {
break name;
}
n += 1;
};
let mut style = codec::tables::TextStyle::new(name.as_str());
style.handle = scene.document.allocate_handle();
// No font of its own, as the metafile names the face only.
style.font_file = String::new();
let _ = scene.document.text_styles.add(style);
for (k, face) in picture.fonts.iter().enumerate() {
let n = picture.fonts[..k].iter().filter(|f| f.name == face.name).count();
let name = format!("WMF-{}{n}", face.name);
if !scene.document.text_styles.contains(&name) {
let mut style = codec::tables::TextStyle::new(name.as_str());
style.handle = scene.document.allocate_handle();
style.font_file =
crate::scene::text::sysfont::face_file(&face.name, face.bold, face.italic).unwrap_or_default();
let _ = scene.document.text_styles.add(style);
}
styles.push(name);
}
for (at, font) in &picture.text_fonts {