Paint binomial parentheses around stacked arguments
This commit is contained in:
1 parent
0446a35b8c
commit
c00edaf357
2 files changed
+60
-11
No files matched your search
@@ -551,22 +551,31 @@ impl Page {
|
||||
let num = math::layout_math(numerator, font);
|
||||
let den = math::layout_math(denominator, font);
|
||||
let width = num.width.max(den.width);
|
||||
Self::paint_math(
|
||||
numerator,
|
||||
font,
|
||||
x + (width - num.width) / 2,
|
||||
baseline - 8 * 65_536,
|
||||
size,
|
||||
list,
|
||||
);
|
||||
let bracket = (size as f64 * 1.2) as i64;
|
||||
let inner_x = x + (width - num.width) / 2 + 2 * 65_536;
|
||||
Self::paint_math(numerator, font, inner_x, baseline - 8 * 65_536, size, list);
|
||||
Self::paint_math(
|
||||
denominator,
|
||||
font,
|
||||
x + (width - den.width) / 2,
|
||||
x + (width - den.width) / 2 + 2 * 65_536,
|
||||
baseline + 12 * 65_536,
|
||||
size,
|
||||
list,
|
||||
);
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
x,
|
||||
y: baseline,
|
||||
size: bracket,
|
||||
text: "(".to_string(),
|
||||
});
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
x: x + width + 4 * 65_536,
|
||||
y: baseline,
|
||||
size: bracket,
|
||||
text: ")".to_string(),
|
||||
});
|
||||
list.push(DisplayItem::Rule {
|
||||
x,
|
||||
y: baseline - 2 * 65_536,
|
||||
@@ -751,10 +760,11 @@ impl Page {
|
||||
let num = math::layout_math(numerator, font);
|
||||
let den = math::layout_math(denominator, font);
|
||||
let width = num.width.max(den.width);
|
||||
let bracket = (size as f64 * 1.2) as i64;
|
||||
Self::paint_math(
|
||||
numerator,
|
||||
font,
|
||||
x + (width - num.width) / 2,
|
||||
x + (width - num.width) / 2 + 2 * 65_536,
|
||||
baseline - 8 * 65_536,
|
||||
size,
|
||||
list,
|
||||
@@ -762,11 +772,25 @@ impl Page {
|
||||
Self::paint_math(
|
||||
denominator,
|
||||
font,
|
||||
x + (width - den.width) / 2,
|
||||
x + (width - den.width) / 2 + 2 * 65_536,
|
||||
baseline + 12 * 65_536,
|
||||
size,
|
||||
list,
|
||||
);
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
x,
|
||||
y: baseline,
|
||||
size: bracket,
|
||||
text: "(".to_string(),
|
||||
});
|
||||
list.push(DisplayItem::Text {
|
||||
font: FontFace::Roman,
|
||||
x: x + width + 4 * 65_536,
|
||||
y: baseline,
|
||||
size: bracket,
|
||||
text: ")".to_string(),
|
||||
});
|
||||
}
|
||||
MathAtom::BigOperator { name } => {
|
||||
for (index, character) in name.chars().enumerate() {
|
||||
|
||||
Reference in new issue
Block a user