From 9bca0bce73cffe44dc85fa5f45d1736b473f9823 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20d=27Herbais=20de=20Thun?= Date: Tue, 10 Oct 2023 11:51:22 +0200 Subject: Fix clipping when a box/block has a `radius` (#2338) --- tests/ref/layout/clip.png | Bin 25673 -> 29586 bytes tests/typ/layout/clip.typ | 20 +++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/ref/layout/clip.png b/tests/ref/layout/clip.png index 53565a98..c847fc63 100644 Binary files a/tests/ref/layout/clip.png and b/tests/ref/layout/clip.png differ diff --git a/tests/typ/layout/clip.typ b/tests/typ/layout/clip.typ index 3baa8b80..d05fdb74 100644 --- a/tests/typ/layout/clip.typ +++ b/tests/typ/layout/clip.typ @@ -7,13 +7,13 @@ world 1 Space -Hello #box(width: 1em, height: 1em, clip: true)[#rect(width: 3em, height: 3em, fill: red)] +Hello #box(width: 1em, height: 1em, clip: true)[#rect(width: 3em, height: 3em, fill: red)] world 2 --- // Test cliping text #block(width: 5em, height: 2em, clip: false, stroke: 1pt + black)[ - But, soft! what light through + But, soft! what light through ] #v(2em) @@ -24,7 +24,7 @@ world 2 ] --- -// Test cliping svg glyphs +// Test clipping svg glyphs Emoji: #box(height: 0.5em, stroke: 1pt + black)[🐪, 🌋, 🏞] Emoji: #box(height: 0.5em, clip: true, stroke: 1pt + black)[🐪, 🌋, 🏞] @@ -40,3 +40,17 @@ First! But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. ] + +--- +// Test clipping with `radius`. + +#set page(height: 60pt) + +#box( + radius: 5pt, + stroke: 2pt + black, + width: 20pt, + height: 20pt, + clip: true, + image("/files/rhino.png", width: 30pt) +) -- cgit v1.2.3