diff options
| author | Birk Tjelmeland <web-github@birktj.no> | 2023-04-01 16:04:38 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-01 16:04:38 +0200 |
| commit | ed79ecbb44a3132f23e3bd4d797009b5c3282fe3 (patch) | |
| tree | 23a3ed7dbe18b3abb7a73112ba9038bb0264a411 /tests | |
| parent | b2ba061fbb62478017c0a2e9ceced48710cdd291 (diff) | |
Add support for cliping content in `block` and `box` (#431)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/layout/clip.png | bin | 0 -> 44908 bytes | |||
| -rw-r--r-- | tests/ref/text/font.png | bin | 20402 -> 34487 bytes | |||
| -rw-r--r-- | tests/typ/layout/clip.typ | 42 |
3 files changed, 42 insertions, 0 deletions
diff --git a/tests/ref/layout/clip.png b/tests/ref/layout/clip.png Binary files differnew file mode 100644 index 00000000..f6ec0ba9 --- /dev/null +++ b/tests/ref/layout/clip.png diff --git a/tests/ref/text/font.png b/tests/ref/text/font.png Binary files differindex 7cf8beb5..856d556b 100644 --- a/tests/ref/text/font.png +++ b/tests/ref/text/font.png diff --git a/tests/typ/layout/clip.typ b/tests/typ/layout/clip.typ new file mode 100644 index 00000000..3baa8b80 --- /dev/null +++ b/tests/typ/layout/clip.typ @@ -0,0 +1,42 @@ +// Test clipping with the `box` and `block` containers. + +--- +// Test box clipping with a rectangle +Hello #box(width: 1em, height: 1em, clip: false)[#rect(width: 3em, height: 3em, fill: red)] +world 1 + +Space + +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 +] + +#v(2em) + +#block(width: 5em, height: 2em, clip: true, stroke: 1pt + black)[ + But, soft! what light through yonder window breaks? It is the east, and Juliet + is the sun. +] + +--- +// Test cliping svg glyphs +Emoji: #box(height: 0.5em, stroke: 1pt + black)[🐪, 🌋, 🏞] + +Emoji: #box(height: 0.5em, clip: true, stroke: 1pt + black)[🐪, 🌋, 🏞] + +--- +// Test block clipping over multiple pages. + +#set page(height: 60pt) + +First! + +#block(height: 4em, clip: true, stroke: 1pt + black)[ + But, soft! what light through yonder window breaks? It is the east, and Juliet + is the sun. +] |
