Skip to main content

BoxContent

Enum BoxContent 

Source
pub enum BoxContent {
Show 20 variants HBox(Vec<LayoutBox>), VBox(Vec<VBoxChild>), Glyph { font_id: FontId, char_code: u32, }, Rule { thickness: f64, raise: f64, }, Kern, Fraction { numer: Box<LayoutBox>, denom: Box<LayoutBox>, numer_shift: f64, denom_shift: f64, bar_thickness: f64, numer_scale: f64, denom_scale: f64, }, SupSub { base: Box<LayoutBox>, sup: Option<Box<LayoutBox>>, sub: Option<Box<LayoutBox>>, sup_shift: f64, sub_shift: f64, sup_scale: f64, sub_scale: f64, center_scripts: bool, }, Radical { body: Box<LayoutBox>, index: Option<Box<LayoutBox>>, index_offset: f64, rule_thickness: f64, inner_height: f64, }, OpLimits { base: Box<LayoutBox>, sup: Option<Box<LayoutBox>>, sub: Option<Box<LayoutBox>>, base_shift: f64, sup_kern: f64, sub_kern: f64, slant: f64, sup_scale: f64, sub_scale: f64, }, Accent { base: Box<LayoutBox>, accent: Box<LayoutBox>, clearance: f64, skew: f64, is_below: bool, }, LeftRight { left: Box<LayoutBox>, right: Box<LayoutBox>, inner: Box<LayoutBox>, }, Array { cells: Vec<Vec<LayoutBox>>, col_widths: Vec<f64>, col_aligns: Vec<u8>, row_heights: Vec<f64>, row_depths: Vec<f64>, col_gap: f64, offset: f64, }, SvgPath { commands: Vec<PathCommand>, fill: bool, }, Framed { body: Box<LayoutBox>, padding: f64, border_thickness: f64, has_border: bool, bg_color: Option<Color>, border_color: Color, }, RaiseBox { body: Box<LayoutBox>, shift: f64, }, Scaled { body: Box<LayoutBox>, child_scale: f64, }, Angl { path_commands: Vec<PathCommand>, body: Box<LayoutBox>, }, Overline { body: Box<LayoutBox>, rule_thickness: f64, }, Underline { body: Box<LayoutBox>, rule_thickness: f64, }, Empty,
}
Expand description

What a LayoutBox contains.

Variants§

§

HBox(Vec<LayoutBox>)

Horizontal list of child boxes laid out left-to-right.

§

VBox(Vec<VBoxChild>)

Vertical list of child boxes laid out top-to-bottom.

§

Glyph

A single glyph character.

Fields

§font_id: FontId
§char_code: u32
§

Rule

Filled rectangle from \rule[<raise>]{width}{height}. thickness is the ink height; raise is the distance (in em) from the baseline to the bottom edge of the rectangle, positive toward the top of the line.

Fields

§thickness: f64
§raise: f64
§

Kern

Empty space (kern).

§

Fraction

A fraction: numerator over denominator with optional bar.

Fields

§numer_shift: f64
§denom_shift: f64
§bar_thickness: f64
§numer_scale: f64
§denom_scale: f64
§

SupSub

Superscript/subscript layout.

Fields

§sup_shift: f64
§sub_shift: f64
§sup_scale: f64
§sub_scale: f64
§center_scripts: bool

When true, place scripts centered on the base width (e.g. \overbrace / \underbrace).

§

Radical

A radical (square root).

Fields

§index_offset: f64

Horizontal offset (in em) of the surd/body from the left edge when index is present.

§rule_thickness: f64
§inner_height: f64
§

OpLimits

An operator with limits above/below (e.g. \sum_{i=0}^{n}).

Fields

§base_shift: f64
§sup_kern: f64
§sub_kern: f64
§slant: f64
§sup_scale: f64
§sub_scale: f64
§

Accent

An accent above or below its base.

Fields

§accent: Box<LayoutBox>
§clearance: f64
§skew: f64
§is_below: bool
§

LeftRight

A stretchy delimiter (\left, \right) wrapping inner content.

Fields

§

Array

A matrix/array: rows × columns of cells.

Fields

§col_widths: Vec<f64>
§col_aligns: Vec<u8>

Per-column alignment: b’l’, b’c’, or b’r’.

§row_heights: Vec<f64>
§row_depths: Vec<f64>
§col_gap: f64
§offset: f64
§

SvgPath

An SVG-style path (arrows, braces, etc.).

Fields

§commands: Vec<PathCommand>
§fill: bool
§

Framed

A framed/colored box (fbox, colorbox, fcolorbox). body is the inner content; padding and border add to the outer dimensions.

Fields

§padding: f64
§border_thickness: f64
§has_border: bool
§bg_color: Option<Color>
§border_color: Color
§

RaiseBox

A raised/lowered box (raisebox). shift > 0 moves content up, shift < 0 moves content down.

Fields

§shift: f64
§

Scaled

A scaled box (for \scriptstyle, \scriptscriptstyle in inline context). The child is rendered at child_scale relative to the parent.

Fields

§child_scale: f64
§

Angl

Actuarial angle \angl{body}: path (horizontal roof + vertical bar) and body share the same baseline.

Fields

§path_commands: Vec<PathCommand>
§

Overline

\overline{body}: body with a horizontal rule drawn above it. The rule sits 2 * rule_thickness above the body’s top (clearance), and is rule_thickness thick.

Fields

§rule_thickness: f64
§

Underline

\underline{body}: body with a horizontal rule drawn below it. The rule sits 2 * rule_thickness below the body’s bottom (clearance), and is rule_thickness thick.

Fields

§rule_thickness: f64
§

Empty

Empty placeholder.

Trait Implementations§

Source§

impl Clone for BoxContent

Source§

fn clone(&self) -> BoxContent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BoxContent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.