text

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Font

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

func DefaultFont

func DefaultFont() *Font

DefaultFont discovers and loads the system UI font once. The shared font lives for the process lifetime; callers must not close it. Nil means the system has no usable font, so the caller must supply one.

func LoadFont

func LoadFont(data []byte) (*Font, error)

func NewFont

func NewFont(face *font.Face) *Font

func (*Font) Dispose

func (f *Font) Dispose() error

func (*Font) FontFace

func (f *Font) FontFace(size, dpi float64) *font.ScaledFace

FontFace creates a new font face.

func (*Font) GlyphCache

func (f *Font) GlyphCache(size, dpi float64) *GlyphCache

func (*Font) Italic

func (f *Font) Italic() *Font

Italic shares a cached font with synthetic oblique glyphs. Existing italic faces are returned unchanged. Repeated calls do not allocate.

func (*Font) MeasureString

func (f *Font) MeasureString(face *font.ScaledFace, value string) (int, int, int)

MeasureString measures the size of the string.

type Glyph

type Glyph struct {
	Atlas   int32
	X, Y    int32
	Width   int32
	Height  int32
	Rune    rune
	OffsetX float32
	OffsetY float32
	Advance float32
	// contains filtered or unexported fields
}

func (Glyph) KeepAlive

func (g Glyph) KeepAlive(canvas *graphics.Canvas2D)

KeepAlive retains the atlas until pending canvas draws have been submitted. Copied glyphs already retain their pages for the lifetime of their layout.

func (Glyph) RGBA

func (g Glyph) RGBA() bool

RGBA reports whether the atlas retains RGB channels (color or LCD glyphs).

func (Glyph) Visible

func (g Glyph) Visible() bool

type GlyphCache

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

func NewGlyphCache

func NewGlyphCache(f *Font, size, dpi float64) *GlyphCache

func (*GlyphCache) Atlas

func (c *GlyphCache) Atlas(index int32) (*graphics.Texture, bool)

func (*GlyphCache) AtlasCount

func (c *GlyphCache) AtlasCount() int

func (*GlyphCache) Dispose

func (c *GlyphCache) Dispose() error

func (*GlyphCache) FlushUploads

func (c *GlyphCache) FlushUploads()

func (*GlyphCache) Glyph

func (c *GlyphCache) Glyph(r rune) Glyph

func (*GlyphCache) GlyphAt

func (c *GlyphCache) GlyphAt(r rune, phaseX, phaseY uint8) Glyph

GlyphAt reuses a bounded set of device-pixel phases, avoiding a second bilinear blur when an axis-aligned glyph's origin is fractional.

func (*GlyphCache) GlyphGrayAt

func (c *GlyphCache) GlyphGrayAt(r rune, phaseX, phaseY uint8, color font.LCDColor) Glyph

func (*GlyphCache) GlyphLCDAt

func (c *GlyphCache) GlyphLCDAt(r rune, phaseX uint8) Glyph

func (*GlyphCache) GlyphLCDColorAt

func (c *GlyphCache) GlyphLCDColorAt(r rune, phaseX uint8, color font.LCDColor) Glyph

func (*GlyphCache) GlyphMetrics

func (c *GlyphCache) GlyphMetrics(r rune) Glyph

GlyphMetrics preserves ink bounds and bitmap padding without populating atlases. Measurement results are not inserted into the rasterized glyph cache.

func (*GlyphCache) GlyphWithReference

func (c *GlyphCache) GlyphWithReference(r rune) (Glyph, GlyphRef)

func (*GlyphCache) Kern

func (c *GlyphCache) Kern(prev, curr rune) float32

func (*GlyphCache) Metrics

func (c *GlyphCache) Metrics() font.Metrics

func (*GlyphCache) OutlineGlyph

func (c *GlyphCache) OutlineGlyph(r rune, width float32) Glyph

func (*GlyphCache) OutlineWithReference

func (c *GlyphCache) OutlineWithReference(r rune, width float32) GlyphRef

type GlyphRef

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

GlyphRef shares an immutable raster descriptor. The descriptor owns its atlas page independently of cache slots, so eviction cannot change a live layout.

func (GlyphRef) Glyph

func (ref GlyphRef) Glyph() Glyph

Directories

Path Synopsis
Package piecetree stores UTF-8 text in an AVL tree of references into an immutable original buffer and an append-only edit buffer.
Package piecetree stores UTF-8 text in an AVL tree of references into an immutable original buffer and an append-only edit buffer.

Jump to

Keyboard shortcuts

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