From bbb9ed07ffe8a2a0ea0a232f6cfc52f82f7f7afe Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 10 Mar 2021 10:20:01 +0100 Subject: =?UTF-8?q?Better=20line=20spacing=20calculations=20=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Only add line spacing between lines. Previously, line spacing was added below every line, making `#box[word]` higher than just `word`. - Compute box height of text as `ascender - descender` so that the full word is contained in the box. --- tests/typ/library/box.typ | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/typ/library') diff --git a/tests/typ/library/box.typ b/tests/typ/library/box.typ index 10e2c93e..7ce56859 100644 --- a/tests/typ/library/box.typ +++ b/tests/typ/library/box.typ @@ -1,15 +1,15 @@ // Test the box function. --- -#page("a7", flip: true) +#page("a8", flip: true) // Box with fixed width, should have text height. -#box(width: 2cm, color: #9650D6)[A] +#box(width: 2cm, color: #9650D6)[Legal] Sometimes there is no box. // Box with fixed height, should span line. -#box(height: 2cm, width: 100%, color: #734CED)[B] +#box(height: 1cm, width: 100%, color: #734CED)[B] // Empty box with fixed width and height. #box(width: 6cm, height: 12pt, color: #CB4CED) @@ -18,6 +18,6 @@ Sometimes there is no box. #box(width: 2in, color: #ff0000) // These are in a row! -#box(width: 1in, height: 10pt, color: #D6CD67) -#box(width: 1in, height: 10pt, color: #EDD466) -#box(width: 1in, height: 10pt, color: #E3BE62) +#box(width: 0.5in, height: 10pt, color: #D6CD67) +#box(width: 0.5in, height: 10pt, color: #EDD466) +#box(width: 0.5in, height: 10pt, color: #E3BE62) -- cgit v1.2.3