font

package
v0.0.0-...-94f88f4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const NewLine = 0x14

FIXME: put this somewhere else

Variables

This section is empty.

Functions

func MakeGPUSpriteMap

func MakeGPUSpriteMap(font *LbxFont) (*ebiten.Image, int, int, int, int)

func MakeGPUSpriteMapWithPalette

func MakeGPUSpriteMapWithPalette(font *LbxFont, palette color.Palette) (*ebiten.Image, int, int, int, int)

Types

type Font

type Font struct {
	Image       *ebiten.Image
	GlyphWidth  int
	GlyphHeight int
	Rows        int
	Columns     int
	Glyphs      []Glyph
	// contains filtered or unexported fields
}

func MakeOptimizedFont

func MakeOptimizedFont(font *LbxFont) *Font

func MakeOptimizedFontWithPalette

func MakeOptimizedFontWithPalette(font *LbxFont, palette color.Palette) *Font

func (*Font) CreateWrappedText

func (font *Font) CreateWrappedText(maxWidth float64, scale float64, text string) WrappedText

precompute an object that can be used to render a wrapped string

func (*Font) Height

func (font *Font) Height() int

func (*Font) MeasureTextWidth

func (font *Font) MeasureTextWidth(text string, scale float64) float64

func (*Font) Print

func (font *Font) Print(image *ebiten.Image, x float64, y float64, scale float64, colorScale ebiten.ColorScale, text string)

func (*Font) PrintCenter

func (font *Font) PrintCenter(image *ebiten.Image, x float64, y float64, scale float64, colorScale ebiten.ColorScale, text string)

func (*Font) PrintRight

func (font *Font) PrintRight(image *ebiten.Image, x float64, y float64, scale float64, colorScale ebiten.ColorScale, text string)

func (*Font) PrintWrap

func (font *Font) PrintWrap(image *ebiten.Image, x float64, y float64, maxWidth float64, scale float64, colorScale ebiten.ColorScale, text string)

func (*Font) PrintWrapCenter

func (font *Font) PrintWrapCenter(image *ebiten.Image, x float64, y float64, maxWidth float64, scale float64, colorScale ebiten.ColorScale, text string)

func (*Font) RenderWrapped

func (font *Font) RenderWrapped(image *ebiten.Image, x float64, y float64, wrapped WrappedText, colorScale ebiten.ColorScale, center bool)

type Glyph

type Glyph struct {
	Data   []byte
	Width  int
	Height int
}

func (*Glyph) MakeImage

func (glyph *Glyph) MakeImage() image.Image

func (*Glyph) MakeImageWithPalette

func (glyph *Glyph) MakeImageWithPalette(palette color.Palette) image.Image

type LbxFont

type LbxFont struct {
	Height            int
	HorizontalSpacing int
	VerticalSpacing   int
	Glyphs            []Glyph
}

func ReadFont

func ReadFont(lbxFile *lbx.LbxFile, entry int, fontIndex int) (*LbxFont, error)

func ReadFonts

func ReadFonts(lbxFile *lbx.LbxFile, entry int) ([]*LbxFont, error)

func (*LbxFont) GlyphCount

func (font *LbxFont) GlyphCount() int

func (*LbxFont) GlyphForRune

func (font *LbxFont) GlyphForRune(r rune) *Glyph

type WrappedText

type WrappedText struct {
	Lines       []string
	TotalHeight float64
	MaxWidth    float64
	Scale       float64
}

func (*WrappedText) Clear

func (text *WrappedText) Clear()

Jump to

Keyboard shortcuts

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