Skip to content

Commit

Permalink
Fix shadow rendering bug introduced in Typst 0.12
Browse files Browse the repository at this point in the history
Reference: #1
  • Loading branch information
T1mVo committed Oct 21, 2024
1 parent b3ca439 commit 19f42dc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib.typ
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
assert(type(y-offset) == length, message: "y-offset must be of type: Length")
assert(type(radius) == length, message: "radius must be of type: Length")

let image-height = svg-height
let image-width = svg-width

let svg-height = svg-height.pt().to-bytes()
let svg-width = svg-width.pt().to-bytes()
let blur = (blur.pt() / 2.5).to-bytes()
Expand All @@ -35,7 +38,7 @@

let buffer = __renderer.render(svg-height, svg-width, blur, color, rect-height, rect-width, x-offset, y-offset, radius)

image.decode(buffer, format: "svg", width: 100%, alt: "shadow")
image.decode(buffer, format: "svg", height: image-height, width: image-width, alt: "shadow")
}

#let shadowed(
Expand Down

0 comments on commit 19f42dc

Please sign in to comment.