From 92a46cf87861db593e8145ffc317dc7d72a13281 Mon Sep 17 00:00:00 2001 From: bptato Date: Wed, 12 Apr 2023 12:20:00 +0200 Subject: renderdocument: fix img position --- src/render/renderdocument.nim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/render/renderdocument.nim') diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim index 31bdfcf2..30da6257 100644 --- a/src/render/renderdocument.nim +++ b/src/render/renderdocument.nim @@ -329,13 +329,13 @@ proc renderBlockBox(grid: var FlexibleGrid, box: BlockBox, x, y: int, window: Wi # ugly hack for background-image display... TODO actually display images let s = "[img]" let w = s.len * window.ppc - var x = x + var ix = x if box.width < w: # text is larger than image; center it to minimize error - x -= w div 2 - x += box.width div 2 - x = x div window.ppc - y = y div window.ppl + ix -= w div 2 + ix += box.width div 2 + let x = ix div window.ppc + let y = y div window.ppl if y >= 0 and x + w >= 0: grid.setText(s, ComputedFormat(node: box.node), x, y) -- cgit 1.4.1-2-gfad0