Documentation ¶
Overview ¶
Package text supports a few simple functions for doing distance field font rendering. Dictionaries are created from truetype font files using the text/tool binary. One of these .dict files can be loaded using text.LoadDictionary(), then font can be rendered using dict.RenderString().
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dictionary ¶
type Dictionary struct { Runes map[rune]RuneInfo Kerning map[RunePair]int // Width and height of the atlas Dx, Dy int32 // Greyscale bytes of the atlas Pix []byte // Maximum bounds of any glyphs. GlyphMax image.Rectangle // contains filtered or unexported fields }
Dictionary contains all of the information about a font necessary for rendering it using distance field font rendering.
func LoadDictionary ¶
func LoadDictionary(r io.Reader) (*Dictionary, error)
LoadDictionary reads a gobbed Dictionary object from r, registers its atlas texture with opengl, and returns a Dictionary that is ready to render text.
func (*Dictionary) RenderString ¶
func (d *Dictionary) RenderString(str string, x, y, height float64)
RenderString must be called on the render thread. x and y are the initial position of the pen, in screen coordinates, and height is the height of a full line of text, in screen coordinates.
func (*Dictionary) SetFontColor ¶
func (d *Dictionary) SetFontColor(r, g, b float64)
Directories ¶
Path | Synopsis |
---|---|
Binary tool generates dictionary files that can be used by the text package to render text using the distance field font rendering method.
|
Binary tool generates dictionary files that can be used by the text package to render text using the distance field font rendering method. |