font

package
v0.0.0-...-4a525b6 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Family

type Family struct {
	Name       string
	CellWidth  int
	CellHeight int

	TextureAtlas *textureatlas.TextureAtlas
	Regular      *FontTextureAtlas
	Bold         *FontTextureAtlas
	BoldItalic   *FontTextureAtlas
	Italic       *FontTextureAtlas
}

func NewFamily

func NewFamily(newRenderer NewRenderer, dpi int, height float64) *Family

type FontTextureAtlas

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

func NewFontTextureAtlas

func NewFontTextureAtlas(renderer Renderer, textureAtlas *textureatlas.TextureAtlas) *FontTextureAtlas

func (*FontTextureAtlas) GetGlyph

func (fta *FontTextureAtlas) GetGlyph(rune rune) *textureatlas.TextureItem

type Glyph

type Glyph struct {
	Bitmap       *[]byte
	BitmapWidth  int
	BitmapHeight int

	TopBearing  float64
	LeftBearing float64
}

Glyph provides a glyph's bitmap, and associated metrics.

type Metrics

type Metrics struct {
	// vertical
	Ascent  int
	Descent int
	LineGap int

	// horizontal
	Advance int
}

Metrics contains font metrics, such as ascent, descent and linegap

type NewRenderer

type NewRenderer func(name string, fontData []byte, dpi int, pixelHeight float64) (Renderer, error)

NewRenderer creates a Renderer.

type Renderer

type Renderer interface {
	GetName() string
	GetMetrics() *Metrics
	GetGlyph(char rune) (*Glyph, error)
}

Renderer can provide metrics and Glyph details for a font.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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