Documentation
¶
Overview ¶
Package text turns label strings into glyph outlines. Plain text is set in DejaVu Sans (matplotlib's default font) through go-opentype; TeX between dollar signs is typeset by go-tex/math, a real TeX math typesetter, except for matplotlib's \mathdefault{...} (what tick labels use), which is set in the text font with matplotlib's own superscript and subscript rules so that tick labels look like matplotlib's.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Default ¶
type Default struct {
// contains filtered or unexported fields
}
Default is the built-in Renderer: DejaVu Sans for text, go-tex/math for TeX.
type Layout ¶
type Layout struct {
Path *render.Path
Width float64
Ascent float64 // above the baseline
Descent float64 // below the baseline
}
Layout is a laid-out line of text. Path holds the glyph outlines in pixels with the pen origin at (0, 0) on the baseline and y pointing down.
Width, Ascent and Descent are the metrics matplotlib aligns text by. The box starts at the pen origin. For plain text the width is the advance of the string (kerned), which is what FreeType's bounding box of the rendered string comes to in matplotlib within a pixel or two (matplotlib's is hinted, each glyph a whole number of pixels); the ascent and descent are those of the ink. For math, the TeX box.
type Renderer ¶
type Renderer interface {
Layout(s string, sizePx float64) Layout
// LineMetrics returns the font's typographic ascent, descent and line gap
// at sizePx: the minimum box matplotlib gives every line.
LineMetrics(sizePx float64) (ascent, descent, gap float64)
}
A Renderer lays out one line of text at a size in pixels.