Documentation
¶
Overview ¶
Package fnt implements reading of Total Annihilation bitmap font files.
FNT files contain 1-bit-per-pixel glyph data for up to 256 characters. Format:
- 2 bytes: uint16 glyph height (all glyphs share the same height)
- 2 bytes: uint16 unknown/flags
- 256 × 2 bytes: uint16 offset table (offset from file start to each glyph, 0 = not present)
- Glyph data: for each glyph at its offset:
- 1 byte: pixel width
- ceil(width * height / 8) bytes: 1bpp pixel data, MSB-first continuous bit stream
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Font ¶
type Font struct {
Height int // Glyph height in pixels
Flags uint16 // Unknown flags field
Glyphs [256]*Glyph // Glyph for each character (nil if not present)
}
Font is a parsed FNT file.
func LoadFromReader ¶
func LoadFromReader(r io.ReadSeeker) (*Font, error)
LoadFromReader parses an FNT file.
func (*Font) GlyphCount ¶
GlyphCount returns the number of defined glyphs.
func (*Font) RenderSheet ¶
RenderSheet renders all glyphs as a sprite sheet (16 columns).
Click to show internal directories.
Click to hide internal directories.