fntconv

package module
v0.0.0-...-9cc3bdf Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 11 Imported by: 0

README

Package fntconv serializes TTF fonts to a compact binary format and rasterizes them.

Documentation

Index

Constants

View Source
const ASCII = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"

ASCII defines all ascii characters.

View Source
const Magic = "FNCV"
View Source
const MagicSDF = "FSDF"

Variables

View Source
var InvalidBinary = fmt.Errorf("fntconv: invalid binary")

Functions

func Marshal

func Marshal(fnt *opentype.Font, options *opentype.FaceOptions, codepoints string) ([]byte, error)

Marshal serializes an OpenType font to a binary format for glyph mapping and rasterization.

Types

type Glyph

type Glyph struct {
	Segments []sfnt.Segment
	Char     rune
	Advance  fixed.Int26_6
}

type Glyphs

type Glyphs struct {
	Glyphs     []Glyph
	MaxAdvance fixed.Int26_6
	PPEM       fixed.Int26_6
	Ascent     fixed.Int26_6
	Height     fixed.Int26_6
	// contains filtered or unexported fields
}

func Unmarshal

func Unmarshal(bin []byte) (Glyphs, error)

Unmarshal decodes a binary font representation into a Glyphs structure, returning an error if the format is invalid.

func (Glyphs) AsImage

func (gs Glyphs) AsImage() (_ *image.RGBA, tileSize image.Point, _ error)

AsImage converts a serialized binary font representation into an image.Image, arranging glyphs in a grid layout.

func (Glyphs) AsTexture

func (gs Glyphs) AsTexture() (glen.TextureFont, error)

Directories

Path Synopsis
cmd
fntconv command

Jump to

Keyboard shortcuts

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