Documentation
¶
Overview ¶
Package glyph is a bitmap font of several cell sizes, the software rasterizer that draws a cell grid with one of them (the reference drawer of any graphical host and the fallback of every one) and what a drawer in another runtime paints from: a cell size as one texture, and frames encoded for it.
Index ¶
- type Atlas
- type Font
- type Probe
- type Raster
- func (r *Raster) Bounds() (width, height int)
- func (r *Raster) ColorMode() terminal.ColorMode
- func (r *Raster) Flush(cells []terminal.Cell, width, height int)
- func (r *Raster) Frame(dst []byte, cells []terminal.Cell, cols, rows int, changed []uint64) []byte
- func (r *Raster) Pix() []byte
- func (r *Raster) Sync()
- type Texture
- type Zoom
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atlas ¶
type Atlas struct {
Width, Height int
// contains filtered or unexported fields
}
Atlas is one strike of a Font. A glyph's rows are whole bytes each, the leftmost column the first one's highest bit, so a cell is at most 32 pixels wide.
type Font ¶
type Font struct {
Name string
// contains filtered or unexported fields
}
Font is one face at several cell sizes, its strikes, read where a font file's bytes lie: the README lays the file out
func Parse ¶
Parse reads a font file, as tool/font-atlas writes it. The font keeps data and reads its glyphs from it, so the caller leaves it as it is.
func (*Font) Cell ¶
Cell is the pixels a cell dp tall takes on a screen of density pixels to a dp, whole ones at the face's aspect and never under its smallest strike, and the strike that draws it: the largest no taller than the cell
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
Probe is a frame of every glyph in the font under each color rule the raster applies, with the raster's pixels for it: the oracle a drawer is checked against, same frame, same pixels
type Raster ¶
type Raster struct {
// contains filtered or unexported fields
}
Raster draws a cell grid into an RGBA framebuffer with a strike. It is a terminal.Surface: Flush takes a whole frame and draws the cells that changed since the last one.
func (*Raster) Flush ¶
Flush draws a frame of width by height cells, row-major; a frame short of its own size is dropped, as a terminal drops one
func (*Raster) Frame ¶
Frame is the terminal.FrameEncoder of a drawer that shows the raster's pixels: little-endian words cols and rows, then Pix. It draws the cells that differ from its own last frame, every one for a nil changed.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture is a strike as a cell drawer takes it: every glyph with a set bit as one slot of a mask, one byte a pixel, and the slot of each rune. A blank glyph has no slot and is painted as background.
func NewTexture ¶
NewTexture encodes a as little-endian words and bytes: cell width, height and slot count, each slot's rows one below the last with 255 where the glyph is set, then each slot's rune as a word