Correct fraction depth and subscript placement
The fraction box added bar clearance twice to its depth, leaving extra space below the denominator. Use the painted extent instead. Scripts now include script space after the base, and subscripts drop by the base depth plus 2pt rather than sitting on the baseline when the base has no depth. Test count stays 1077.
This commit is contained in:
1 parent
802526c352
commit
742986e4dd
4 files changed
+9
-7
No files matched your search
@@ -1336,7 +1336,7 @@ pub fn layout_math(atom: &MathAtom, font: &Cmr10Metrics) -> MathBox {
|
||||
MathBox {
|
||||
width,
|
||||
height: numerator_box.height + numerator_box.depth + 2 * 65_536,
|
||||
depth: denominator_box.height + denominator_box.depth + 2 * 65_536,
|
||||
depth: denominator_box.height + denominator_box.depth,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1242,11 +1242,12 @@ impl Page {
|
||||
Self::paint_math(base, font, x, baseline, size, list);
|
||||
let italic = math::italic_correction(base, font);
|
||||
let small = (size as f64 * 0.7) as i64;
|
||||
let script_x = x + base_box.width + italic + 65_536 / 2;
|
||||
if let Some(sup) = sup {
|
||||
Self::paint_math(
|
||||
sup,
|
||||
font,
|
||||
x + base_box.width + italic,
|
||||
script_x,
|
||||
baseline - base_box.height * 2 / 3,
|
||||
small,
|
||||
list,
|
||||
@@ -1256,8 +1257,8 @@ impl Page {
|
||||
Self::paint_math(
|
||||
sub,
|
||||
font,
|
||||
x + base_box.width + italic,
|
||||
baseline + base_box.depth * 2 / 3,
|
||||
script_x,
|
||||
baseline + base_box.depth + 2 * 65_536,
|
||||
small,
|
||||
list,
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user