Documentation
¶
Overview ¶
Package ratlas generates rune atlas images given a slice of runes and a TTF font. Atlas and atlas item information can also be saved and loaded. Values are stored as float32 for ease of use with OpenGL.
Index ¶
- type Atlas
- func (atlas *Atlas) Ascent() float32
- func (atlas *Atlas) Descent() float32
- func (atlas *Atlas) GobDecode(buf []byte) error
- func (atlas *Atlas) GobEncode() ([]byte, error)
- func (atlas *Atlas) Height() float32
- func (atlas *Atlas) Kern(a, b rune) float32
- func (atlas *Atlas) LoadGobFile(fileName string) error
- func (atlas *Atlas) LoadImageFiles(imageFilenames []string) error
- func (atlas *Atlas) ReloadFont(ttfData *[]byte) error
- func (atlas *Atlas) SaveGobFile(fileName string) error
- func (atlas *Atlas) SaveImageFiles(name string) error
- func (atlas *Atlas) ScaleNumbers(v float32)
- type AtlasItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atlas ¶
type Atlas struct {
Face font.Face
FontPt float64
Pad int
Items map[rune]*AtlasItem
Images []draw.Image
}
func (*Atlas) Ascent ¶
Ascent returns a float32 of the distance from the top of a line to its baseline.
func (*Atlas) Descent ¶
Descent returns a float32 of the distance from the bottom of a line to its baseline.
func (*Atlas) Height ¶
Height returns a float32 of the recommended amount of vertical space between two lines of text.
func (*Atlas) LoadGobFile ¶
LoadGobFile populates an empty atlas per the contents of an exported gob file.
func (*Atlas) LoadImageFiles ¶
LoadImageFiles loads a slice of strings that point to image files to load into the atlas.
func (*Atlas) ReloadFont ¶
ReloadFont parses TTF data in order to generate a font.Face for the atlas.
func (*Atlas) SaveGobFile ¶
SaveGobFile dumps atlas info to a gob file.
func (*Atlas) SaveImageFiles ¶
SaveImageFiles dumps all generated atlas images to disk.
func (*Atlas) ScaleNumbers ¶
ScaleNumbers scales the numbers within an Atlas and its AtlasItem(s), for example, if a loaded image was scaled since saving the atlas info.
type AtlasItem ¶
type AtlasItem struct {
Rune rune
Advance float32
BearingX float32
Descent float32
PercentPosX float32
PercentPosY float32
PercentWidth float32
PercentHeight float32
Width int
Height int
Node *node
ImageIndex int
}
AtlasItem contains all the information needed to draw a specific rune within an Atlas.
