diff options
author | bptato <nincsnevem662@gmail.com> | 2023-12-11 11:38:47 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-12-11 11:43:15 +0100 |
commit | f779f672e6aa28efe03733226465c73c1a7490ad (patch) | |
tree | b2872bdbe5d178d46480f3f996518b18b9cf1a44 /src/layout | |
parent | f9a184c2b9a73097a8e0e29c111b7234d54fc22d (diff) | |
download | chawan-f779f672e6aa28efe03733226465c73c1a7490ad.tar.gz |
layout: rounding error correction fixes
* start from 1 * divide by total - 1, since we are counting the rounding error between each line
Diffstat (limited to 'src/layout')
-rw-r--r-- | src/layout/engine.nim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/layout/engine.nim b/src/layout/engine.nim index 0f2aba6f..3219f06d 100644 --- a/src/layout/engine.nim +++ b/src/layout/engine.nim @@ -1413,8 +1413,12 @@ proc layoutInline(ictx: var InlineContext, box: InlineBoxBuilder): proc positionAtoms(ictx: var InlineContext) = if ictx.lines.len == 0: return - let erry = ictx.errorY / ictx.lines.len - var i = 0 + let H = ictx.lines.len - 1 + let erry = if H != 0: + ictx.errorY / H + else: + 0 + var i = 1 for line in ictx.lines: let erry0 = erry * i for atom in line.atoms: |