forked from 1b-agent/opencadstudio-upstream
fix(render): DXF leader hookline width + SHAPE name fallback; bump acadrust
Companion to the acadrust DXF-fidelity sweep (bump to 379ce12): - Legacy LEADER hookline: underline the annotation using the leader's own stored text width (DXF code 41) when the MTEXT has no computed extents, so the landing spans the text instead of a short stub. - SHAPE: resolve the glyph by name when the shape number is 0 (DXF SHAPE carries only the name), and search shape-file text styles when the entity has no direct style reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7dc62ffa5
commit
ce49f4da0a
3 files changed
+77
-30
No files matched your search
+17
-7
@@ -761,14 +761,24 @@ impl LeaderTess for Leader {
|
||||
.or_else(|| style.map(|s| s.dimtad))
|
||||
.unwrap_or(0);
|
||||
if dimtad != 0 {
|
||||
if let Some(acadrust::entities::EntityType::MText(mt)) =
|
||||
document.get_entity(self.annotation_handle)
|
||||
{
|
||||
if mt.extents_width > 0.0 {
|
||||
let to_far_edge =
|
||||
sign * (mt.insertion_point.x - last.x) + mt.extents_width;
|
||||
land_len = land_len.max(to_far_edge);
|
||||
let mt = match document.get_entity(self.annotation_handle) {
|
||||
Some(acadrust::entities::EntityType::MText(mt)) => {
|
||||
Some((mt.extents_width, mt.insertion_point.x))
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
// Underline width: the annotation MTEXT's laid-out extents when
|
||||
// known, otherwise the leader's own stored annotation width
|
||||
// (DXF code 41) — a DXF-loaded MTEXT often has no computed
|
||||
// extents (extents_width == 0), which left the hook too short.
|
||||
let width = mt
|
||||
.map(|(w, _)| w)
|
||||
.filter(|w| *w > 0.0)
|
||||
.unwrap_or(self.text_width);
|
||||
if width > 0.0 {
|
||||
let ins_x = mt.map(|(_, x)| x).unwrap_or(last.x);
|
||||
let to_far_edge = sign * (ins_x - last.x) + width;
|
||||
land_len = land_len.max(to_far_edge);
|
||||
}
|
||||
}
|
||||
points.push([f64::NAN; 3]);
|
||||
|
||||
Reference in new issue
Block a user