Documentation
¶
Overview ¶
Package trunic provides image-related functionality for the Trunic writing system.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Renderer ¶
type Renderer struct {
Color color.Color // Default: color.Black
TextHeight float64 // Default: 72
Thickness float64 // Default: 5
// contains filtered or unexported fields
}
Renderer draws Trunic text to an image.
func (*Renderer) Append ¶
Append is a high-level function that appends text to the Renderer's internal buffer. The text is expected to be a sequence of words written in IPA characters. Leading and trailing whitespace is trimmed, all unrecognized characters are stripped via Normalize, the characters in words are parsed into pairs via Runes, and these are then appended one-by-one via [AppendRune].
If there is already anything in the buffer when Append is called, a space is inserted first.
If the length of the text to be inserted after normalization is zero, this method is a no-op.
func (*Renderer) AppendRune ¶
AppendRune is a low-level method that appends pieces of runes to the Renderer's internal buffer. Each call appends a single rune which is drawn by overlapping all of the symbols corresponding to the strings passed. Generally speaking, this is a single vowel and a single consonant, possibly including a reversing circle.
func (*Renderer) Bounds ¶
Bounds returns the minimum bounding box that will contain the result of rendering the Renderer's current state with the top-left corner at (0, 0). Note that this is a minimum that does not take into account the thickness of the lines. Default thickness usually requires about 10 pixels of padding or so to fit the result without anything getting clipped.