Expand description
Helpers for using formel embedded in a host application which provides its own DOM representation of the MathML.
The host exposes its DOM structure through the MathTree trait. An implementor of that trait will
have to supply the relevant subset of CSS values for MathML (MathComputedStyle) for every node.
layout_math then runs the MathML layout algorithms directly over the host DOM tree.
The results are communicated back via the MathLayoutHost trait. Hosts can either implement this
trait themselves or use the provided LayoutCollector implementation which provides a HashMap
mapping from a DOM node to its layout results.
All lengths are CSS px.
In the guide submodule there is more extensive documentation for the host integration.
Modules§
- guide
- How to integrate formel into a host application
Structs§
- Accents
- Which scripts of an under/over element are accents.
- Composite
Font - A
MathFontmade of several fonts. See the module documentation. - Decoded
Glyph - A glyph of a
CompositeFontfound in its face. - 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.
- Font
Face - A font and what it is to be used for in a
CompositeFont. - Font
Features - A small list of OpenType feature settings, as in CSS
font-feature-settings(for exampless03orcv01with value 2). - 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, using CSS terminology.
- 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.
- Size
Variants - The size variants of a glyph in one direction and whether it also has a glyph assembly, as the
MathGlyphConstructionof the font’s MathVariants table says. - Token
Text - The text of a token element after
text-transform, asMathTree::textreturns it. - Unicode
Ranges - A set of Unicode codepoints, as the
unicode-rangedescriptor of CSS. Ranges may overlap. - Vector
- A point or offset in font units. The y coordinate increases downwards.
Enums§
- Composite
Font Error - Why a
CompositeFontcould not be made. - 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.
- Token
Segment - One piece of the content of a token element that mixes text and foreign content, in
document order. See
MathTree::token_content.
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
Structure - Read access to the markup of the document, without style or fonts.
- Math
Tree - Read access to the host’s tree: structure, computed style and fonts.
- UaStyle
Host - Receives the styles from
resolve_ua_stylesand may change them.
Functions§
- accents
- The effective
accentunderandaccentofelement, resolved as inscript_is_accent. Both arefalsefor an element that is not<munder>,<mover>or<munderover>. - axis_
height - The height of the math axis above the baseline of
node. - core_
operator - The
<mo>at the core ofnodeif it is an embellished operator (MathML Core 3.2.4.1). - 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. - is_
space_ like - Whether
nodeis space-like (MathML Core 3.2.5.1). Space-like elements don’t count when deciding whether a row is an embellished operator, or an operator’s form. - layout_
math - Lays out the MathML subtree rooted at
root, usually a<math>element. - resolve_
ua_ styles - Computes the user agent style of
rootand every MathML element below it, top-down, and hands each tohost(seeUaStyleHost). - script_
is_ accent - Whether the child at
indexofparentis an accent: the overscript of<mover>or<munderover>(accent), or the underscript of<munder>or<munderover>(accentunder).falsefor any other child, and for a script that is missing. - script_
scale_ factor - The factor by which
font-size: mathscales the font size whenmath-depthchanges fromparent_depthtodepth(CSS Fonts 4 / MathML Core). - token_
text - The text of the token element
elementwith the raw contenttext, after thetext-transformthat itsmathvariantmaps to.
Type Aliases§
- Glyph
Code - An identifier of a glyph inside a font.