about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-04-26 20:17:41 +0200
committerbptato <nincsnevem662@gmail.com>2024-04-26 20:17:41 +0200
commit39a0678199431bf6bfdcec79007f2ac794cab72c (patch)
tree714482974f0c7c745c046aa42dd0601cc6a30ba0
parent601ad98818f3b966686181445339c52f74f75979 (diff)
downloadchawan-39a0678199431bf6bfdcec79007f2ac794cab72c.tar.gz
layout: fix image baseline
-rw-r--r--src/layout/engine.nim5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 30afb066..e5093084 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -1503,14 +1503,15 @@ proc layoutInline(ictx: var InlineContext; box: InlineBoxBuilder):
     ictx.firstTextFragment = fragment
   ictx.lastTextFragment = fragment
   if box.bmp != nil:
+    let h = int(box.bmp.height).toLayoutUnit().ceilTo(ictx.cellheight)
     let iastate = InlineAtomState(
       vertalign: state.computed{"vertical-align"},
-      baseline: ictx.cellheight
+      baseline: h
     )
     let atom = InlineAtom(
       t: iatImage,
       bmp: box.bmp,
-      size: Size(w: int(box.bmp.width), h: int(box.bmp.height)) #TODO overflow
+      size: Size(w: int(box.bmp.width), h: h), #TODO overflow
     )
     discard ictx.addAtom(state, iastate, atom)
   else: