forked from 1b-agent/opencadstudio-upstream
fix: correct viewport stretch and SHX plots
Anchor the opposite viewport corner during grip and STRETCH resizing. Match plotted stroke-font pen widths to the SDF atlas unless CTB overrides. Closes #435
This commit is contained in:
1 parent
ceddb287f5
commit
ece5598372
4 files changed
+127
-26
No files matched your search
+25
-8
@@ -635,9 +635,6 @@ fn emit_text(
|
||||
.map(|mm| (mm * MM_TO_PT).max(0.1) / scale.max(1e-6));
|
||||
}
|
||||
}
|
||||
let lw_pt = lw_override
|
||||
.unwrap_or_else(|| (wire.line_weight_px * LW_PX_TO_PT).max(0.1) / scale.max(1e-6));
|
||||
|
||||
let mut gi = 0;
|
||||
while gi + 6 <= verts.len() {
|
||||
let quad = &verts[gi..gi + 6];
|
||||
@@ -703,13 +700,33 @@ fn emit_text(
|
||||
});
|
||||
}
|
||||
} else {
|
||||
// Stroke (LFF pen) font or hollow glyph: polylines. Bold bakes
|
||||
// at a 1.7× pen over the same centrelines, so widen to match or
|
||||
// a bold run prints at regular weight.
|
||||
// Stroke (LFF/SHX pen) font or hollow glyph: polylines.
|
||||
// Match the SDF atlas' nominal glyph-space pen instead of
|
||||
// borrowing the entity lineweight: Roman Duplex and similar
|
||||
// multi-stroke faces rely on that band to close the narrow
|
||||
// gaps between parallel centrelines. An explicit CTB
|
||||
// lineweight still wins and stays absolute under the plot CTM.
|
||||
ops.push(Op::SetOutlineColor {
|
||||
col: Color::Rgb(Rgb { r, g, b, icc_profile: None }),
|
||||
col: Color::Rgb(Rgb {
|
||||
r,
|
||||
g,
|
||||
b,
|
||||
icc_profile: None,
|
||||
}),
|
||||
});
|
||||
let pen = if ge.bold { lw_pt * 1.7 } else { lw_pt };
|
||||
let pen = if let Some(ctb_pen) = lw_override {
|
||||
if ge.bold {
|
||||
ctb_pen * 1.7
|
||||
} else {
|
||||
ctb_pen
|
||||
}
|
||||
} else {
|
||||
let glyph_unit_mm = (((tl[0] - bl[0]).powi(2) + (tl[1] - bl[1]).powi(2))
|
||||
.sqrt()
|
||||
/ sy.abs() as f64) as f32;
|
||||
(2.0 * sdf_atlas::stroke_pen_half_units(ge.bold) * glyph_unit_mm * MM_TO_PT)
|
||||
.max(0.1)
|
||||
};
|
||||
ops.push(Op::SetOutlineThickness { pt: Pt(pen) });
|
||||
for stroke in &ge.strokes {
|
||||
if stroke.len() < 2 {
|
||||
|
||||
Reference in new issue
Block a user