text

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedFace

type CachedFace struct {
	font.Face
	// contains filtered or unexported fields
}

CachedFace represents a cached face

func NewFace

func NewFace(f font.Face) CachedFace

NewFace creates a cached face object.

type Render

type Render struct {
	Face    CachedFace
	Width   fixed.Int26_6
	Height  fixed.Int26_6
	LastX   fixed.Int26_6
	Last    []RenderGlyph // last line
	NotLast []RenderLine  // all lines except last
	Prev    rune
}

Render represents a text rendering engine.

func NewRender

func NewRender(face font.Face, width, dy fixed.Int26_6) *Render

NewRender creates a new text rendering engine.

func (*Render) AddText

func (p *Render) AddText(s string)

AddText renders inputed text.

func (*Render) Draw

func (p *Render) Draw(dst *ebiten.Image, x, y fixed.Int26_6, clr color.Color, mode int)

Draw draws rendered text.

func (*Render) Size

func (p *Render) Size() (fixed.Int26_6, fixed.Int26_6)

Size returns width and height of rendered text.

type RenderGlyph

type RenderGlyph struct {
	X fixed.Int26_6
	C rune
}

RenderGlyph represents a rendered text.

type RenderLine

type RenderLine struct {
	Items []RenderGlyph
	LastX fixed.Int26_6
}

RenderLine represents a rendered line.

Jump to

Keyboard shortcuts

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