Skip to content

Commit

Permalink
canvas: Fix bug when using canvas insides tablex (#346)
Browse files Browse the repository at this point in the history
Fixes #345.

For some reason, `line` measures 0pt in width (with `length: 1cm`). This
only happens insides `tablex`. Using `box` works.
  • Loading branch information
johannes-wolf authored Dec 19, 2023
1 parent b02c5a2 commit 0826cb3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/canvas.typ
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
let length = if type(length) == ratio {
length * ly.width
} else {
measure(line(length: length), st).width
measure(box(width: length, height: length), st).width
}

assert(length / 1cm != 0,
message: "Canvas length must be != 0!")

let ctx = (
typst-style: st,
Expand Down

0 comments on commit 0826cb3

Please sign in to comment.