pub struct MathBox {
pub width: Dim,
pub height: Dim,
pub depth: Dim,
pub italic: Dim,
pub shift: Dim,
pub content: BoxContent,
}Expand description
TeX-style box: width, height above baseline, depth below, italic correction.
§Examples
use latex_rust::{Dim, MathBox};
let packed = MathBox::hpack(vec![
MathBox::rule(Dim::one(), Dim::zero(), Dim::zero()),
MathBox::rule(Dim::ratio(1, 2), Dim::zero(), Dim::zero()),
]);
assert_eq!(packed.width, Dim::ratio(3, 2));Fields§
§width: DimWidth.
height: DimHeight above the baseline.
depth: DimDepth below the baseline.
italic: DimItalic correction.
shift: DimBaseline raise relative to the parent list (positive is up).
content: BoxContentPayload.
Implementations§
Source§impl MathBox
impl MathBox
Sourcepub fn rule(width: Dim, height: Dim, depth: Dim) -> Self
pub fn rule(width: Dim, height: Dim, depth: Dim) -> Self
Rule with explicit dimensions (fraction bar, strut).
Sourcepub fn from_glyph(font: &MathFont, ch: char) -> Result<Self, Error>
pub fn from_glyph(font: &MathFont, ch: char) -> Result<Self, Error>
Box from a font glyph. Errors if the face has no glyph for ch.
Sourcepub fn hpack(children: Vec<Self>) -> Self
pub fn hpack(children: Vec<Self>) -> Self
Pack boxes in a row. Width sums; height and depth are maxima.
Sourcepub fn vpack(children: Vec<Self>) -> Self
pub fn vpack(children: Vec<Self>) -> Self
Pack boxes in a column, first child on the baseline.
Subsequent children sit below the previous (height + depth stacked).
Sourcepub fn with_shift(self, shift: Dim) -> Self
pub fn with_shift(self, shift: Dim) -> Self
Raise this box’s baseline by shift (positive is up).
Trait Implementations§
impl Eq for MathBox
impl StructuralPartialEq for MathBox
Auto Trait Implementations§
impl Freeze for MathBox
impl RefUnwindSafe for MathBox
impl Send for MathBox
impl Sync for MathBox
impl Unpin for MathBox
impl UnsafeUnpin for MathBox
impl UnwindSafe for MathBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more