From 884c02872ce9d7432c3b67a920011cf385ce70b2 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Wed, 4 Dec 2024 07:00:04 -0300 Subject: Fix text fill within `clip: true` blocks in PNG export (#5502) --- tests/ref/block-clip-text.png | Bin 1268 -> 908 bytes tests/ref/block-clipping-multiple-pages.png | Bin 2047 -> 2029 bytes tests/ref/issue-5499-text-fill-in-clip-block.png | Bin 0 -> 1502 bytes tests/suite/text/font.typ | 31 +++++++++++++++++++++++ 4 files changed, 31 insertions(+) create mode 100644 tests/ref/issue-5499-text-fill-in-clip-block.png (limited to 'tests') diff --git a/tests/ref/block-clip-text.png b/tests/ref/block-clip-text.png index 744ce0f2..8c82bc30 100644 Binary files a/tests/ref/block-clip-text.png and b/tests/ref/block-clip-text.png differ diff --git a/tests/ref/block-clipping-multiple-pages.png b/tests/ref/block-clipping-multiple-pages.png index ffe2fd08..0b6e7c85 100644 Binary files a/tests/ref/block-clipping-multiple-pages.png and b/tests/ref/block-clipping-multiple-pages.png differ diff --git a/tests/ref/issue-5499-text-fill-in-clip-block.png b/tests/ref/issue-5499-text-fill-in-clip-block.png new file mode 100644 index 00000000..5f7962d3 Binary files /dev/null and b/tests/ref/issue-5499-text-fill-in-clip-block.png differ diff --git a/tests/suite/text/font.typ b/tests/suite/text/font.typ index 443be6ed..5c972ff3 100644 --- a/tests/suite/text/font.typ +++ b/tests/suite/text/font.typ @@ -81,3 +81,34 @@ I // Warning: 17-34 Typst's default font has changed from Linux Libertine to its successor Libertinus Serif // Hint: 17-34 please set the font to `"Libertinus Serif"` instead #set text(font: "Linux Libertine") + +--- issue-5499-text-fill-in-clip-block --- + +#let pat = pattern( + size: (30pt, 30pt), + relative: "parent", + square( + size: 30pt, + fill: gradient + .conic(..color.map.rainbow), + ) +) + +#block(clip: false, height: 2em, { + text(fill: blue, "Hello") + [ ] + text(fill: blue.darken(20%).transparentize(50%), "Hello") + [ ] + text(fill: gradient.linear(..color.map.rainbow), "Hello") + [ ] + text(fill: pat, "Hello") +}) +#block(clip: true, height: 2em, { + text(fill: blue, "Hello") + [ ] + text(fill: blue.darken(20%).transparentize(50%), "Hello") + [ ] + text(fill: gradient.linear(..color.map.rainbow), "Hello") + [ ] + text(fill: pat, "Hello") +}) -- cgit v1.2.3