From 601a97b4dd844f5eca034ed25ff96e723aca9642 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Thu, 15 Oct 2026 01:35:34 +0300 Subject: [PATCH] properties: a text given a style takes its height, width and oblique (#503) Changing a TEXT's style in the Properties panel only swapped the font, so a style that differs in its fixed height, width factor or oblique angle seemed to change nothing. The text now takes the style's fixed height (when it sets one), width factor and oblique angle, and an MTEXT the fixed height. Co-Authored-By: Claude Opus 5.5 --- src/app/update/command.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app/update/command.rs b/src/app/update/command.rs index c0d6666b5..4c2f087a9 100644 --- a/src/app/update/command.rs +++ b/src/app/update/command.rs @@ -3461,6 +3461,11 @@ impl OpenCADStudio { } else { crate::command::WorkingPlane::default() }; + // A text taking a style takes what the style fixes: its height + // when the style sets one, its width factor and oblique angle. + let text_style = (field == "style") + .then(|| self.tabs[i].scene.document.text_styles.get(&value).cloned()) + .flatten(); for &handle in &handles { let mline_style = self.tabs[i] @@ -3488,6 +3493,19 @@ impl OpenCADStudio { crate::scene::view::dispatch::apply_geom_prop_in_working_plane( entity, field, &value, plane, ); + match (entity as &mut codec::EntityType, text_style.as_ref()) { + (codec::EntityType::Text(text), Some(style)) => { + if style.height > 0.0 { + text.height = style.height; + } + text.width_factor = style.width_factor; + text.oblique_angle = style.oblique_angle; + } + (codec::EntityType::MText(text), Some(style)) if style.height > 0.0 => { + text.height = style.height; + } + _ => {} + } if matches!(field, "ml_justification" | "ml_scale") { if let (codec::EntityType::MLine(mline), Some(style)) = (entity, mline_style.as_ref())