fnt

package
v0.0.0-...-49ddc05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder reads and decodes a font from an input stream.

func NewDecoder

func NewDecoder(r io.ReaderAt) *Decoder

NewDecoder returns a new decoder that reads from r.

func (*Decoder) Decode

func (d *Decoder) Decode() (*Font, error)

Decode reads the encoded 3D model information from its input and returns a new model containing decoded textures and objects.

type Font

type Font struct {
	BaseAdvanceWidth uint16
	// LineHeight is the total height of each line in the font. This can be used
	// for rendering text over multiple lines.
	// For example, F_BOOKS.FNT has a line height of 14 pixels.
	LineHeight uint32
	// The BaseAdvanceHeight is the amount of pixels to advance when rendering a
	// new line of text. If this is set to 0 then the bottoms of glyphs will
	// touch the tops of glyphs from the following line.
	BaseAdvanceHeight uint16

	// TODO
	Height2  uint16
	Unknown1 uint16

	Glyphs []*Glyph
	// contains filtered or unexported fields
}

type Glyph

type Glyph struct {
	// Type provides information about how to interpret the glyph image.
	Type GlyphType
	// Image is the decoded glyph data converted into an image.Image.
	Image image.Image
	// The AdvanceWidth of the glyph. After the glyph is rendered, the start of
	// the next glyph is offset on the x-axis from the current glyph origin by
	// this amount, plus the base advance width found in Font.BaseAdvanceWidth.
	// This is always less than or equal to the width of the glyph. It is the
	// offset on the x-axis to move the current point to the start of the next
	// glyph.
	AdvanceWidth uint16

	// TODO: Both of these affect vertical/y-axis positioning when rendering.
	Unknown1 uint8
	Unknown2 uint8
}

type GlyphType

type GlyphType uint8

GlyphType provides information about how to interpret the glyph image.

const (
	// GlyphTypeNormal indicates this is a normal glyph.
	GlyphTypeNormal GlyphType = iota
	// GlyphTypeEmpty indicates the glyph is empty.
	// There is no glyph or palette data associated with this glyph.
	// The glyph's width and height are 0.
	GlyphTypeEmpty
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL