fontstashmini

package
v0.0.0-...-1c1e04b Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2021 License: Zlib Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FONS_VERTEX_COUNT     = 1024
	FONS_SCRATCH_BUF_SIZE = 16000
	FONS_INIT_FONTS       = 4
	FONS_INIT_GLYPHS      = 256
	FONS_INIT_ATLAS_NODES = 256
	INVALID               = -1
)
View Source
const (
	// Horizontal Align
	ALIGN_LEFT   FONSAlign = 1 << 0 // Default
	ALIGN_CENTER           = 1 << 1
	ALIGN_RIGHT            = 1 << 2
	// Vertical Align
	ALIGN_TOP      = 1 << 3
	ALIGN_MIDDLE   = 1 << 4
	ALIGN_BOTTOM   = 1 << 5
	ALIGN_BASELINE = 1 << 6 // Default
)
View Source
const (
	APREC = 16
	ZPREC = 7
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Atlas

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

type AtlasNode

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

type FONSAlign

type FONSAlign int

type Font

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

type FontStash

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

func New

func New(width, height int) *FontStash

func (*FontStash) AddFont

func (stash *FontStash) AddFont(name, path string) int

func (*FontStash) AddFontFromMemory

func (stash *FontStash) AddFontFromMemory(name string, data []byte, freeData uint8) int

func (*FontStash) GetFontByName

func (stash *FontStash) GetFontByName(name string) int

func (*FontStash) GetFontName

func (stash *FontStash) GetFontName() string

func (*FontStash) GetTextureData

func (stash *FontStash) GetTextureData() ([]byte, int, int)

func (*FontStash) LineBounds

func (stash *FontStash) LineBounds(y float32) (minY, maxY float32)

func (*FontStash) ResetAtlas

func (stash *FontStash) ResetAtlas(width, height int)

func (*FontStash) SetAlign

func (stash *FontStash) SetAlign(align FONSAlign)

func (*FontStash) SetBlur

func (stash *FontStash) SetBlur(blur float32)

func (*FontStash) SetFont

func (stash *FontStash) SetFont(font int)

func (*FontStash) SetSize

func (stash *FontStash) SetSize(size float32)

func (*FontStash) SetSpacing

func (stash *FontStash) SetSpacing(spacing float32)

func (*FontStash) TextBounds

func (stash *FontStash) TextBounds(x, y float32, str string) (float32, []float32)

func (*FontStash) TextBoundsOfRunes

func (stash *FontStash) TextBoundsOfRunes(x, y float32, runes []rune) (float32, []float32)

func (*FontStash) TextIter

func (stash *FontStash) TextIter(x, y float32, str string) *TextIterator

func (*FontStash) TextIterForRunes

func (stash *FontStash) TextIterForRunes(x, y float32, runes []rune) *TextIterator

func (*FontStash) ValidateTexture

func (stash *FontStash) ValidateTexture() []int

func (*FontStash) VerticalMetrics

func (stash *FontStash) VerticalMetrics() (float32, float32, float32)

type Glyph

type Glyph struct {
	Index int
	// contains filtered or unexported fields
}

type GlyphKey

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

type Params

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

type Quad

type Quad struct {
	X0, Y0, S0, T0 float32
	X1, Y1, S1, T1 float32
}

type State

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

type TextIterator

type TextIterator struct {
	X, Y, NextX, NextY, Scale, Spacing float32
	CodePoint                          rune
	Size, Blur                         int
	PrevGlyph                          *Glyph
	CurrentIndex                       int
	NextIndex                          int
	End                                int
	Runes                              []rune
	// contains filtered or unexported fields
}

func (*TextIterator) Next

func (iter *TextIterator) Next() (quad Quad, ok bool)

Directories

Path Synopsis
This library processes TrueType files: - parse files - extract glyph metrics - extract glyph shapes - render glyphs to one-channel bitmaps with antialiasing (box filter)
This library processes TrueType files: - parse files - extract glyph metrics - extract glyph shapes - render glyphs to one-channel bitmaps with antialiasing (box filter)

Jump to

Keyboard shortcuts

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