diff options
author | bptato <nincsnevem662@gmail.com> | 2024-03-26 01:49:13 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-03-26 01:49:13 +0100 |
commit | 7a04d25fea9720bba9812d6912e8258c06ae2f80 (patch) | |
tree | aab04156982ef5e7cd2f92b85fecd7c953194e2f | |
parent | 62491fab5e6034f97b8ce71f1eb8454fd2adca29 (diff) | |
download | chawan-7a04d25fea9720bba9812d6912e8258c06ae2f80.tar.gz |
layout: also round line height for painting backgrounds
it's pointless to do otherwise, and results in inconsistencies between line positioning and background coloring.
-rw-r--r-- | src/layout/engine.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 8a56f110..48284408 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -436,9 +436,6 @@ proc verticalAlignLine(ictx: var InlineContext) = ictx.currentLine.minHeight = max(ictx.currentLine.minHeight, atom.offset.y - offsety + atom.size.h) - # Set the line height that will be used for painting to new top edge + old - # bottom edge, and set the baseline. - ictx.currentLine.line.height = max(bottomEdge + marginTop, lineheight) ictx.currentLine.baseline = baseline #TODO this does not really work with rounding :/ ictx.currentLine.baseline += ictx.currentLine.paddingTop @@ -453,6 +450,8 @@ proc verticalAlignLine(ictx: var InlineContext) = # we would swallow hard line breaks with <br>.) if lineheight >= ch and ictx.currentLine.size.h < ch: ictx.currentLine.size.h = ch + # Set the line height to size.h. + ictx.currentLine.line.height = ictx.currentLine.size.h proc putAtom(state: var LineBoxState; atom: InlineAtom; iastate: InlineAtomState; fragment: InlineFragment) = |