pub struct MathBox {
pub width: usize,
pub height: usize,
pub baseline: usize,
/* private fields */
}Expand description
Represents a box of grapheme clusters for rendering math expressions. Uses a 2D grid with baseline tracking for proper vertical alignment. Each cell holds a grapheme cluster (base char + combining marks).
Fields§
§width: usize§height: usize§baseline: usizeThe baseline row (0-indexed from top)
Implementations§
Source§impl MathBox
impl MathBox
Sourcepub fn empty(width: usize, height: usize, baseline: usize) -> Self
pub fn empty(width: usize, height: usize, baseline: usize) -> Self
Create an empty MathBox with specified dimensions
Sourcepub fn from_lines(lines: Vec<String>, baseline: usize) -> Self
pub fn from_lines(lines: Vec<String>, baseline: usize) -> Self
Create a MathBox from multiple lines
Sourcepub fn get(&self, x: usize, y: usize) -> char
pub fn get(&self, x: usize, y: usize) -> char
Get grapheme at position (returns space if out of bounds or empty)
Sourcepub fn get_grapheme(&self, x: usize, y: usize) -> &str
pub fn get_grapheme(&self, x: usize, y: usize) -> &str
Get full grapheme cluster at position
Sourcepub fn set_grapheme(&mut self, x: usize, y: usize, g: &str)
pub fn set_grapheme(&mut self, x: usize, y: usize, g: &str)
Set grapheme cluster at position
Sourcepub fn blit(&mut self, other: &MathBox, x_offset: usize, y_offset: usize)
pub fn blit(&mut self, other: &MathBox, x_offset: usize, y_offset: usize)
Copy another MathBox into this one at the specified offset
Sourcepub fn concat_horizontal(boxes: &[MathBox]) -> MathBox
pub fn concat_horizontal(boxes: &[MathBox]) -> MathBox
Concatenate horizontally, aligning by baseline
Sourcepub fn stack_vertical(boxes: &[MathBox]) -> MathBox
pub fn stack_vertical(boxes: &[MathBox]) -> MathBox
Stack vertically, centered horizontally
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MathBox
impl RefUnwindSafe for MathBox
impl Send for MathBox
impl Sync for MathBox
impl Unpin 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
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