From f4c3fc7f61e1a58bb85055376aad6a46e06c8572 Mon Sep 17 00:00:00 2001 From: Daniel Romell Date: Tue, 25 Aug 2026 14:39:38 +0200 Subject: [PATCH] fix: measure the description width instead of estimating it With left-labels a description is placed by subtracting its width from desc-x. That width was estimated as half the font size per character, which undershoots Ubuntu Mono's advance of 0.56em by 12%, so the leader line struck through the last letter of every label, as it does on the manual's own cover page. Proportional fonts were off by more. render is now a context block, so the text can be measured instead. The font has to be passed explicitly: the set rule at the top of render is not in scope for a measure further down the same context block. --- src/renderer.typ | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/renderer.typ b/src/renderer.typ index 6070c3b..426a0a7 100644 --- a/src/renderer.typ +++ b/src/renderer.typ @@ -190,10 +190,15 @@ if config.left-labels { // desc-x is the right edge of the label when they are on the left, so shift - // to its left edge: exactly the box width when wrapping, an estimate from - // the character count otherwise + // to its left edge txt-x -= if config.description-width == none { - range_.description.len() * config.default-font-size / 2pt + // the set rule in render is not in scope here, so measure the text with + // the font it will be drawn in + measure(text( + range_.description, + font: config.default-font-family, + size: config.default-font-size + )).width.pt() } else { config.description-width }