font

package
v0.0.0-...-35c5657 Latest Latest
Warning

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

Go to latest
Published: May 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var XMargin int

XMargin sets a per glyph clipping of Width/4 on the left and right of a glyph

Functions

This section is empty.

Types

type Font

type Font struct {
	Name     string    `json:"name"`
	Author   string    `json:"author"`
	Date     time.Time `json:"date"`
	Revision int       `json:"revision"`
	Glyphs   []*Glyph  `json:"sprites"`
	// contains filtered or unexported fields
}

Font represents one or more glyphs belonging to a single face

func Decode

func Decode(raw []byte) (f *Font)

Decode a Font from a embedded JSON file

func (*Font) Describe

func (f *Font) Describe()

Describe summarizes a Font according to its metadata

func (*Font) Render

func (f *Font) Render()

Render generates images for each Glyph to be later used in the rendering process

func (*Font) SetPalette

func (f *Font) SetPalette(p *Palette)

SetPalette sets the color Palette for the Glyphs in this Font

func (*Font) Size

func (f *Font) Size() (width, height int)

Size returns the square dimension of each glyph

type Glyph

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

Glyph holds the data for a single glyph

func (*Glyph) Bounds

func (g *Glyph) Bounds() image.Rectangle

Bounds returns the bounding box for this Glyph

func (*Glyph) Image

func (g *Glyph) Image() *ebiten.Image

Image returns the internal image as an ebiten image

func (*Glyph) Render

func (g *Glyph) Render(crop image.Rectangle)

Render generates an ebiten Image for this glyph, cropped accordingly

func (*Glyph) SetPalette

func (g *Glyph) SetPalette(colors *Palette)

SetPalette changes the color palette for this Glyph and crops as needed

func (*Glyph) UnmarshalJSON

func (g *Glyph) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON is a custom unmarshaler for the Glyph type

type Palette

type Palette struct {
	Name     string          `json:"name"`
	Author   string          `json:"author"`
	Date     time.Time       `json:"date"`
	Revision int             `json:"revision"`
	Colors   encoding.Colors `json:"colors"`
}

Palette is a color picker for a Palette of colors

func DecodePalette

func DecodePalette(raw []byte) (p *Palette)

DecodePalette decodes a Palette from an embedded JSON file and unmarshals it

func (*Palette) Describe

func (p *Palette) Describe()

Describe privides a simple description of the Palette with its Metadata

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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