Fix bug in math.frac
layout code (#5177)
@ -130,8 +130,9 @@ fn layout(
|
||||
)?;
|
||||
|
||||
let around = FRAC_AROUND.at(font_size);
|
||||
let num_gap = (shift_up - axis - num.descent()).max(num_min + thickness / 2.0);
|
||||
let denom_gap = (shift_down + axis - denom.ascent()).max(denom_min + thickness / 2.0);
|
||||
let num_gap = (shift_up - (axis + thickness / 2.0) - num.descent()).max(num_min);
|
||||
let denom_gap =
|
||||
(shift_down + (axis - thickness / 2.0) - denom.ascent()).max(denom_min);
|
||||
|
||||
let line_width = num.width().max(denom.width());
|
||||
let width = line_width + 2.0 * around;
|
||||
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 787 B After Width: | Height: | Size: 733 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 327 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 979 B |
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 764 B |
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 597 B |
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 538 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 339 B |
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 915 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 621 B After Width: | Height: | Size: 624 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 484 B After Width: | Height: | Size: 474 B |
Before Width: | Height: | Size: 594 B After Width: | Height: | Size: 610 B |
BIN
tests/ref/math-frac-gap.png
Normal file
After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 563 B After Width: | Height: | Size: 573 B |
Before Width: | Height: | Size: 506 B After Width: | Height: | Size: 521 B |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 847 B After Width: | Height: | Size: 954 B |
Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 672 B |
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 602 B |
Before Width: | Height: | Size: 396 B After Width: | Height: | Size: 398 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 469 B |
Before Width: | Height: | Size: 349 B After Width: | Height: | Size: 346 B |
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 950 B |
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 540 B |
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 818 B |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 894 B |
Before Width: | Height: | Size: 552 B After Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 685 B After Width: | Height: | Size: 689 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 343 B After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 956 B After Width: | Height: | Size: 957 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 648 B |
Before Width: | Height: | Size: 729 B After Width: | Height: | Size: 715 B |
Before Width: | Height: | Size: 784 B After Width: | Height: | Size: 765 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
@ -41,3 +41,7 @@ $ a_1/b_2, 1/f(x), zeta(x)/2, "foo"[|x|]/2 \
|
||||
+[x]/2, 1(x)/2, 2[x]/2 \
|
||||
(a)b/2, b(a)[b]/2 \
|
||||
n!/2, 5!/2, n !/2, 1/n!, 1/5! $
|
||||
|
||||
--- math-frac-gap ---
|
||||
// Test that the gap above and below the fraction rule is correct.
|
||||
$ sqrt(n^(2/3)) $
|
||||
|
@ -497,7 +497,7 @@ $ nabla dot bold(E) = frac(rho, epsilon_0) $
|
||||
#show math.equation: set text(fill: gradient.linear(..color.map.rainbow))
|
||||
#show math.equation: box
|
||||
|
||||
$ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $
|
||||
$ x_"1,2" = frac(-b plus.minus sqrt(b^2 - 4 a c), 2 a) $
|
||||
|
||||
--- gradient-math-mat ---
|
||||
// Test on matrix
|
||||
@ -529,7 +529,7 @@ $ A = mat(
|
||||
7, 8, 9
|
||||
) $
|
||||
|
||||
$ x_"1,2" = frac(-b +- sqrt(b^2 - 4 a c), 2 a) $
|
||||
$ x_"1,2" = frac(-b plus.minus sqrt(b^2 - 4 a c), 2 a) $
|
||||
|
||||
--- gradient-math-misc ---
|
||||
// Test miscellaneous
|
||||
|