From 7a1cd362aa150045371cc85578ef50bef2951be2 Mon Sep 17 00:00:00 2001 From: damaxwell Date: Mon, 17 Jul 2023 08:19:46 -0800 Subject: Support for bounding box text edges (#1626) --- tests/ref/bugs/math-realize.png | Bin 21228 -> 21192 bytes tests/ref/math/accent.png | Bin 8038 -> 8080 bytes tests/ref/math/alignment.png | Bin 8040 -> 7924 bytes tests/ref/math/attach.png | Bin 28615 -> 30373 bytes tests/ref/math/cancel.png | Bin 24765 -> 24765 bytes tests/ref/math/cases.png | Bin 2947 -> 2979 bytes tests/ref/math/content.png | Bin 7883 -> 7891 bytes tests/ref/math/font-features.png | Bin 3005 -> 3023 bytes tests/ref/math/frac.png | Bin 28719 -> 28867 bytes tests/ref/math/matrix-alignment.png | Bin 14228 -> 14102 bytes tests/ref/math/multiline.png | Bin 13479 -> 13437 bytes tests/ref/math/op.png | Bin 6730 -> 6576 bytes tests/ref/math/spacing.png | Bin 17881 -> 18031 bytes tests/ref/math/style.png | Bin 23804 -> 23825 bytes tests/ref/math/underover.png | Bin 4797 -> 4731 bytes tests/ref/text/edge.png | Bin 15244 -> 28077 bytes tests/typ/math/attach.typ | 6 ++++++ tests/typ/text/edge.typ | 18 ++++++++++++++++-- 18 files changed, 22 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/ref/bugs/math-realize.png b/tests/ref/bugs/math-realize.png index 2a17f629..5ce129f6 100644 Binary files a/tests/ref/bugs/math-realize.png and b/tests/ref/bugs/math-realize.png differ diff --git a/tests/ref/math/accent.png b/tests/ref/math/accent.png index 5a963b38..1065576e 100644 Binary files a/tests/ref/math/accent.png and b/tests/ref/math/accent.png differ diff --git a/tests/ref/math/alignment.png b/tests/ref/math/alignment.png index c92e0ea9..9b5ebaf9 100644 Binary files a/tests/ref/math/alignment.png and b/tests/ref/math/alignment.png differ diff --git a/tests/ref/math/attach.png b/tests/ref/math/attach.png index 9d01e7bf..370a2ba7 100644 Binary files a/tests/ref/math/attach.png and b/tests/ref/math/attach.png differ diff --git a/tests/ref/math/cancel.png b/tests/ref/math/cancel.png index 571edcc2..146bb855 100644 Binary files a/tests/ref/math/cancel.png and b/tests/ref/math/cancel.png differ diff --git a/tests/ref/math/cases.png b/tests/ref/math/cases.png index c824a801..b9e54e75 100644 Binary files a/tests/ref/math/cases.png and b/tests/ref/math/cases.png differ diff --git a/tests/ref/math/content.png b/tests/ref/math/content.png index ce727e66..a5f5f137 100644 Binary files a/tests/ref/math/content.png and b/tests/ref/math/content.png differ diff --git a/tests/ref/math/font-features.png b/tests/ref/math/font-features.png index 1fff3547..f7c4b914 100644 Binary files a/tests/ref/math/font-features.png and b/tests/ref/math/font-features.png differ diff --git a/tests/ref/math/frac.png b/tests/ref/math/frac.png index adb9ad0c..94990208 100644 Binary files a/tests/ref/math/frac.png and b/tests/ref/math/frac.png differ diff --git a/tests/ref/math/matrix-alignment.png b/tests/ref/math/matrix-alignment.png index b272a290..c0acd958 100644 Binary files a/tests/ref/math/matrix-alignment.png and b/tests/ref/math/matrix-alignment.png differ diff --git a/tests/ref/math/multiline.png b/tests/ref/math/multiline.png index 84dcb87d..19276846 100644 Binary files a/tests/ref/math/multiline.png and b/tests/ref/math/multiline.png differ diff --git a/tests/ref/math/op.png b/tests/ref/math/op.png index 15c7329d..863c6684 100644 Binary files a/tests/ref/math/op.png and b/tests/ref/math/op.png differ diff --git a/tests/ref/math/spacing.png b/tests/ref/math/spacing.png index 5e717eff..4767f6f4 100644 Binary files a/tests/ref/math/spacing.png and b/tests/ref/math/spacing.png differ diff --git a/tests/ref/math/style.png b/tests/ref/math/style.png index cec04ba5..cf962574 100644 Binary files a/tests/ref/math/style.png and b/tests/ref/math/style.png differ diff --git a/tests/ref/math/underover.png b/tests/ref/math/underover.png index 24c96b21..62dcfefc 100644 Binary files a/tests/ref/math/underover.png and b/tests/ref/math/underover.png differ diff --git a/tests/ref/text/edge.png b/tests/ref/text/edge.png index da8ed34d..2226af9d 100644 Binary files a/tests/ref/text/edge.png and b/tests/ref/text/edge.png differ diff --git a/tests/typ/math/attach.typ b/tests/typ/math/attach.typ index 0f404ac7..d471551a 100644 --- a/tests/typ/math/attach.typ +++ b/tests/typ/math/attach.typ @@ -64,6 +64,12 @@ $ sqrt(a_(1/2)^zeta), sqrt(a_alpha^(1/2)), sqrt(a_(1/2)^(3/4)) \ sqrt(attach(a, tl: 1/2, bl: 3/4)), sqrt(attach(a, tl: 1/2, bl: 3/4, tr: 1/2, br: 3/4)) $ +--- +// Test for no collisions between descenders/ascenders and attachments + +$ sup_(x in P_i) quad inf_(x in P_i) $ +$ op("fff",limits: #true)^(y) quad op("yyy", limits:#true)_(f) $ + --- // Test frame base. $ (-1)^n + (1/2 + 3)^(-1/2) $ diff --git a/tests/typ/text/edge.typ b/tests/typ/text/edge.typ index 85aff68a..053576e8 100644 --- a/tests/typ/text/edge.typ +++ b/tests/typ/text/edge.typ @@ -9,17 +9,31 @@ From #top to #bottom ] +#let try-bounds(top, bottom) = rect(inset: 0pt, fill: conifer)[ + #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) + #top to #bottom: "yay, Typst" +] + #try("ascender", "descender") #try("ascender", "baseline") #try("cap-height", "baseline") #try("x-height", "baseline") +#try-bounds("cap-height", "baseline") +#try-bounds("bounds", "baseline") +#try-bounds("bounds", "bounds") +#try-bounds("x-height", "bounds") + #try(4pt, -2pt) #try(1pt + 0.3em, -0.15em) --- -// Error: 21-23 expected "ascender", "cap-height", "x-height", "baseline", "descender", or length, found array +// Error: 21-23 expected "ascender", "cap-height", "x-height", "baseline", "bounds", or length, found array #set text(top-edge: ()) --- -// Error: 24-26 expected "ascender", "cap-height", "x-height", "baseline", "descender", or length +// Error: 24-26 expected "baseline", "descender", "bounds", or length #set text(bottom-edge: "") + +--- +// Error: 24-36 expected "baseline", "descender", "bounds", or length +#set text(bottom-edge: "cap-height") -- cgit v1.2.3