package kaiju_font
Types
Atlas
struct
FontData
struct
type FontData struct {
Glyphs []Glyph `json:"glyphs"`
Atlas Atlas `json:"atlas"`
Metrics Metrics `json:"metrics"`
Kerning []Kerning `json:"kerning"`
}
Glyph
struct
type Glyph struct {
Unicode int `json:"unicode"`
Advance float32 `json:"advance"`
PlaneBounds Rect `json:"planeBounds"`
AtlasBounds Rect `json:"atlasBounds"`
}
KaijuFont
struct
KaijuFont is a base primitive representing a single font including each character's details along with the MSDF PNG image. Typically this structure is generated when importing a font into the engine using a function like [font_to_msdf.ProcessTTF]. From this point, it is typically serialized and stored into the content database. When reading a font from the content database, it will return a KaijuFont.
Deserialize
Deserialize will construct a KaijuFont from the given array of bytes. This deserialization uses the built-in gob.Decoder
KaijuFont.Serialize
Serialize will convert a KaijuFont into a byte array for saving to the database or later use. This serialization uses the built-in gob.Encoder
Kerning
struct
type Kerning struct {
Unicode1 int32 `json:"unicode1"`
Unicode2 int32 `json:"unicode2"`
Advance float32 `json:"advance"`
}
Metrics
struct
type Metrics struct {
EmSize float32 `json:"emSize"`
LineHeight float32 `json:"lineHeight"`
Ascender float32 `json:"ascender"`
Descender float32 `json:"descender"`
UnderlineY float32 `json:"underlineY"`
UnderlineThickness float32 `json:"underlineThickness"`
}
Rect
struct