Paint overbrace and underbrace bars
This commit is contained in:
1 parent
3f1dd0c077
commit
17d41cbffd
2 files changed
+48
-3
No files matched your search
@@ -709,9 +709,32 @@ impl Page {
|
||||
);
|
||||
}
|
||||
}
|
||||
MathAtom::Brace { base, .. }
|
||||
| MathAtom::Smash { body: base, .. }
|
||||
| MathAtom::Classed { body: base, .. } => {
|
||||
MathAtom::Brace { base, above } => {
|
||||
let base_box = math::layout_math(base, font);
|
||||
Self::paint_math(base, font, x, baseline, size, list);
|
||||
let thickness = (size / 8).max(1);
|
||||
let y = if *above {
|
||||
baseline - base_box.height - size / 2
|
||||
} else {
|
||||
baseline + base_box.depth + size / 2
|
||||
};
|
||||
list.push(DisplayItem::Rule {
|
||||
x,
|
||||
y,
|
||||
width: base_box.width,
|
||||
height: thickness,
|
||||
});
|
||||
let tick = size / 2;
|
||||
for tick_x in [x, x + base_box.width - thickness] {
|
||||
list.push(DisplayItem::Rule {
|
||||
x: tick_x,
|
||||
y: if *above { y + thickness } else { y - tick },
|
||||
width: thickness,
|
||||
height: tick,
|
||||
});
|
||||
}
|
||||
}
|
||||
MathAtom::Smash { body: base, .. } | MathAtom::Classed { body: base, .. } => {
|
||||
Self::paint_math(base, font, x, baseline, size, list)
|
||||
}
|
||||
MathAtom::Binomial {
|
||||
|
||||
Reference in new issue
Block a user