From bb38a01d0625d5bdab0af50daf479e60c774d90e Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 20 Dec 2024 12:35:57 +0000 Subject: Fix math size resolving (#5596) --- tests/ref/math-size-arbitrary-content.png | Bin 0 -> 603 bytes tests/ref/math-size-math-content-1.png | Bin 0 -> 2098 bytes tests/ref/math-size-math-content-2.png | Bin 0 -> 1472 bytes tests/ref/math-size-math-content-3.png | Bin 0 -> 877 bytes tests/ref/math-size-resolve.png | Bin 0 -> 460 bytes tests/ref/math-text-size.png | Bin 0 -> 1265 bytes tests/suite/math/interactions.typ | 38 ++++++++++++++++++++++++++++++ 7 files changed, 38 insertions(+) create mode 100644 tests/ref/math-size-arbitrary-content.png create mode 100644 tests/ref/math-size-math-content-1.png create mode 100644 tests/ref/math-size-math-content-2.png create mode 100644 tests/ref/math-size-math-content-3.png create mode 100644 tests/ref/math-size-resolve.png create mode 100644 tests/ref/math-text-size.png (limited to 'tests') diff --git a/tests/ref/math-size-arbitrary-content.png b/tests/ref/math-size-arbitrary-content.png new file mode 100644 index 00000000..3b6e35aa Binary files /dev/null and b/tests/ref/math-size-arbitrary-content.png differ diff --git a/tests/ref/math-size-math-content-1.png b/tests/ref/math-size-math-content-1.png new file mode 100644 index 00000000..385433d5 Binary files /dev/null and b/tests/ref/math-size-math-content-1.png differ diff --git a/tests/ref/math-size-math-content-2.png b/tests/ref/math-size-math-content-2.png new file mode 100644 index 00000000..6e5e0e4d Binary files /dev/null and b/tests/ref/math-size-math-content-2.png differ diff --git a/tests/ref/math-size-math-content-3.png b/tests/ref/math-size-math-content-3.png new file mode 100644 index 00000000..75eddaba Binary files /dev/null and b/tests/ref/math-size-math-content-3.png differ diff --git a/tests/ref/math-size-resolve.png b/tests/ref/math-size-resolve.png new file mode 100644 index 00000000..63a1b5d2 Binary files /dev/null and b/tests/ref/math-size-resolve.png differ diff --git a/tests/ref/math-text-size.png b/tests/ref/math-text-size.png new file mode 100644 index 00000000..7c430a3a Binary files /dev/null and b/tests/ref/math-text-size.png differ diff --git a/tests/suite/math/interactions.typ b/tests/suite/math/interactions.typ index 9a9b13ec..209f2f1b 100644 --- a/tests/suite/math/interactions.typ +++ b/tests/suite/math/interactions.typ @@ -114,3 +114,41 @@ Inline $2 baz(x,y,baz(u, v))$. $ 2 foo(alpha, (M+foo(a, b))) $ $ 2 bar(alpha, (M+foo(a, b))) $ $ 2 baz(x,y,baz(u, v)) $ + +--- math-size-resolve --- +#let length = context repr(measure("--").width) +$ a length a ^ length $ + +--- math-size-arbitrary-content --- +// Test sizing of both relative and absolute non math content in math sizes. +#let stuff = square(inset: 0pt)[hello] +#let square = square(size: 5pt) +$ stuff sum^stuff_square square $ + +--- math-size-math-content-1 --- +// Nested math content has styles overwritten by the inner equation. +// Ideally the widths would match the actual length of the arrows. +#let arrow = $stretch(->)^"much text"$ +$ arrow A^arrow A^A^arrow $ +#let width = context measure(arrow).width +$ width A^width A^A^width $ + +--- math-size-math-content-2 --- +// Nested math content has styles overwritten by the inner equation. +// Ideally the heights would match the actual height of the sums. +#let sum = $sum^2$ +#let height(x) = context measure(x).height +$sum = height(sum) $ +$ sum != height(sum) $ + +--- math-size-math-content-3 --- +// Sum doesn't get wrapped in math as it is a single expr. +// Ideally the height would match the actual height of the sum. +#let height(x) = context measure(x).height +$ sum != height(sum) $ + +--- math-text-size --- +// Values retrieved from function are not resolved at the moment. +// Ideally the left size would match the right size. +#let size = context [#text.size.to-absolute() #1em.to-absolute()] +$ size x^size x^x^size $ -- cgit v1.2.3