Documentation
¶
Overview ¶
Package formula lays out the equations of the formats with the layout of math of okage, the package texmath (okage D78), and draws them on the display list. A format builds a tree of texmath from its equation, such as an equation of Office Math with OMML. A Typesetter lays out the tree, and the result is an Object that the layout of HTML and CSS places as an object of a Source, as it places a chart (D62).
The equations take STIX Two Math, the math font that okage holds. The glyphs are drawn as runs of glyphs with their text, so that a writer of PDF keeps the text of an equation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Atoms ¶
Atoms appends the atoms of the characters of s to l, as Office Math and MathML set the characters of a run. Each letter is an atom of its own, in the math alphabet v. A run of digits, with a decimal point between them, is one atom. Each other character is an atom of its class in TeX, such as a binary operator for +, so that texmath gives it the space of TeX. A hyphen-minus is the minus sign, and white space is left out, as the equations of Word and MathML do.
func MathML ¶
MathML returns the tree of a formula of Presentation MathML, the math element e or an element in it, and whether its attribute display is block. The elements of Content MathML and the annotations draw nothing.
Types ¶
type Element ¶
Element is an element of MathML, as a format reads it: its local name, its attributes, its text and its child elements. The text of a token element, such as mi or mo, is its characters.
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object is an equation laid out. It is a picture that a format draws itself, which satisfies the interface Object of the package layout. Its methods are safe for concurrent use.
func (*Object) Depth ¶
Depth returns the depth of the equation below its baseline, in points. A format moves the object down by its depth, so that the baseline of the equation sits on the baseline of the line.
type Typesetter ¶
type Typesetter struct {
// contains filtered or unexported fields
}
Typesetter lays out equations with STIX Two Math. It is not safe for concurrent use, because the face of okage that it reads is not. The Objects that it returns are safe for concurrent use.
func New ¶
func New() (*Typesetter, error)
New returns a Typesetter. It returns an error that wraps ivy.ErrFormat if the math font cannot be read.
func (*Typesetter) Layout ¶
func (t *Typesetter) Layout(n texmath.Node, size float64, style texmath.Style, color okage.Color) (*Object, error)
Layout lays out the tree n at the size, in points, in the style, such as texmath.Display for an equation on a line of its own. color is the color of the items that the tree does not color. It returns an error that wraps ivy.ErrLimit when the tree goes past a limit.