forked from 1b-agent/opencadstudio-upstream
fix(text): Middle-justified TEXT centres vertically on half its height
Middle (72 = 4) carries a Baseline vertical code, so the baseline landed on the alignment point and the text sat half a height too high. Fixes #767 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d1a6187678
commit
5ccaaad48e
1 file changed
+3
@@ -316,7 +316,10 @@ pub fn text_run_placement_at_scale(
|
||||
HA::Aligned | HA::Fit => 0.0,
|
||||
};
|
||||
// Vertical anchor uses the inked extent (cap / baseline geometry).
|
||||
// `Middle` (72 = 4) centres on half the text height whatever its
|
||||
// vertical code says; its baseline sits h/2 below the point. (#767)
|
||||
let ay = match t.vertical_alignment {
|
||||
_ if matches!(t.horizontal_alignment, HA::Middle) => height * 0.5,
|
||||
VA::Baseline => 0.0,
|
||||
VA::Bottom => b.ink_min[1],
|
||||
VA::Middle => (b.ink_min[1] + b.ink_max[1]) * 0.5,
|
||||
|
||||
Reference in new issue
Block a user