Skip to main content

MathInfo

Struct MathInfo 

Source
pub struct MathInfo {
    pub rows_span: Range<usize>,
    pub row: usize,
    pub glyph: Option<usize>,
    pub tex: String,
    pub display: bool,
    pub src: usize,
}
Expand description

One formula as a frontend sees it: where its picture goes, and the TeX to typeset for it. Two shapes, told apart by glyph:

  • An inline atom — $E = mc^2$ in a line of prose — is one Role::Math glyph on row at index glyph, standing for the whole formula. A frontend that paints pictures in a line typesets the TeX at the run’s font size and draws the picture in the glyph’s place, as wide as the picture is and with the text baseline through it at its height — a run delegate on Apple, an inline element on the web. The glyph is a caret stop at the formula’s start; the stop after it is the next glyph’s.
  • A display block — a paragraph holding nothing but $$…$$ — is the placeholder row (∑ tex, every glyph at the formula’s start) plus the blank fillers rows_span reserves under it, exactly a MediaInfo’s shape. A frontend skips those rows and paints the picture there, centred on the measure.

Either way the frontend supplies the width: core lays out in glyphs and cannot know how wide a typeset formula is, which is why an inline atom is one glyph and not a run of them. Only in a column-wrapped build does that matter to the wrap: a terminal never asks for atoms (see Surface::inline_pictures), and the web re-fits a row the picture overflows.

A plain surface paints the glyphs as they are — ∑ for an atom, the labelled row for a block — and needs none of this. Derived from VRow::math by [math_spans], so it survives the row reuse of BlockCache and build_spliced.

Fields§

§rows_span: Range<usize>

The VisualMap::rows rows this formula occupies: row..row + 1 for an atom, the placeholder row and its fillers for a block.

§row: usize

The row the atom glyph, or the block’s placeholder label, is on.

§glyph: Option<usize>

The atom’s index into that row’s glyphs, or None for a block.

§tex: String

The TeX between the delimiters, verbatim.

§display: bool

Display style rather than text style — see MathMark::display.

§src: usize

The formula’s source start: where a click on its picture lands the caret, and the same offset every placeholder glyph carries.

Trait Implementations§

Source§

impl Clone for MathInfo

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for MathInfo

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for MathInfo

Source§

impl PartialEq for MathInfo

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for MathInfo

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.