Skip to main content

typeset_math

Function typeset_math 

Source
pub fn typeset_math(
    tex: String,
    display: bool,
    size: f64,
    r: u8,
    g: u8,
    b: u8,
    a: u8,
) -> Result<MathPicture, LeafError>
Expand description

Typeset tex — the text between a formula’s delimiters, as a MathView hands it over — to a picture. display is the view’s display; size is the font size in points the formula is set at (an inline formula takes the run’s, a block the body’s); r, g, b, a are the ink, as bytes. A theme change is a re-render with a new colour.

Pure layout over fonts embedded in the binary — no I/O, fast enough to call from a layout pass — so a renderer caches by (tex, display, size, colour) and nothing more. TeX the typesetter cannot read is a LeafError::Math; the renderer shows the revealed source in its place.