Expand description
Math layout on behalf of a host HTML/CSS layout engine.
The host exposes its document through MathTree: the structure, the computed CSS of each
node (MathComputedStyle) and fonts (MathFont). layout_math then runs the MathML
layout algorithms directly over that tree. Every node’s result (border box, baseline, and
the glyphs and rules it paints) goes back through MathLayoutHost::set_layout.
CSS is the source of truth: font-size (including font-size: math), math-depth,
math-style, math-shift, padding, border and margin are all read from the host and never
derived by mlayout. All lengths are CSS px.
Structs§
- Edges
- Values for the four sides of a box, e.g. padding, border widths or margins.
- Extents
- The ink extents of a glyph, in font units.
- Foreign
Metrics - The margin-box metrics of foreign content, measured from its baseline.
- Layout
Collector - Wraps a
MathTreeand collects the layout results in a map, for hosts that would rather not implementMathLayoutHostthemselves. - Math
Computed Style - Computed style of a node, as resolved by the host’s CSS engine.
- Math
Glyph - A structure that describes an individual glyph in a font.
- Node
Layout - The layout of one node.
- Operator
Overrides - Operator properties that override the MathML operator dictionary.
- Point
- A point (or offset) in CSS pixels. The y coordinate increases downwards.
- Positioned
Glyph - A glyph positioned relative to the origin of its
Fragment::Glyphsrun. - Rect
- An axis-aligned rectangle in CSS pixels.
- Shape
Options - Options that affect glyph selection when shaping.
- Size
- A size in CSS pixels.
- Vector
- A point or offset in font units. The y coordinate increases downwards.
Enums§
- Corner
Position - Possible positions of multiscripts relative to the base. The values match HarfBuzz’
hb_ot_math_kern_t. - Direction
- The CSS
directionproperty. - Form
- The form of an operator: its position relative to its operands.
- Fragment
- One painted item.
- Math
Constant - The constants of the OpenType MATH table, in table order.
- Math
Element - The MathML elements mlayout knows how to lay out.
- Math
Shift - The CSS
math-shiftproperty. - Math
Style - The CSS
math-styleproperty. - Node
Kind - What kind of box a node is.
Traits§
- Math
Font - A font with an OpenType MATH table.
- Math
Layout Host - A host that can lay out foreign content and receive the results.
- Math
Tree - Read access to the host’s tree: structure, computed style and fonts.
Functions§
- axis_
height - The height of the math axis above the baseline of
node, in px: the font’sAxisHeightat the node’sfont-size. Fractions, stretchy operators and tables are centered on it. - default_
operator_ overrides - The default implementation of
MathTree::operator_overrides, for hosts that override it but still want the attribute-based values for some properties. - intrinsic_
inline_ size - The inline size (width of the border box) of
node. Math content has no line breaks, so this is both the min-content and the max-content size. Nothing is reported toMathLayoutHost::set_layout. - layout_
math - Lays out the MathML subtree rooted at
root, usually a<math>element. - parse_
math_ length - Parses a MathML/CSS length such as
"0.5em","3px"or"thinmathspace"into px. - script_
scale_ factor - The factor by which
font-size: mathscales the font size whenmath-depthchanges fromparent_depthtodepth(CSS Fonts 4 / MathML Core).
Type Aliases§
- Glyph
Code - An identifier of a glyph inside a font.