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/full/coma.typ | 2 +- tests/typ/library/box.typ | 12 ++++++------ tests/typ/repr.typ | 3 +-- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'tests/typ') diff --git a/tests/typ/full/coma.typ b/tests/typ/full/coma.typ index 39404a35..d324627f 100644 --- a/tests/typ/full/coma.typ +++ b/tests/typ/full/coma.typ @@ -1,5 +1,5 @@ // Configuration with `page` and `font` functions. -#page(width: 450pt, height: 380pt, margins: 1cm) +#page(width: 450pt, margins: 1cm) // There are variables and they can take normal values like strings, ... #let city = "Berlin" 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) diff --git a/tests/typ/repr.typ b/tests/typ/repr.typ index 6eead75e..96eb710e 100644 --- a/tests/typ/repr.typ +++ b/tests/typ/repr.typ @@ -32,9 +32,8 @@ {12e1pt} \ {2.5rad} \ {45deg} \ - // Not in monospace via repr. -#repr(45deg) +#repr(45deg) \ --- // Colors. -- cgit v1.2.3