Documentation
¶
Overview ¶
Package text is fonts, their glyphs drawn on demand into a sheet of their own, and the fixed debug text.
Index ¶
- func DebugPrintAt(dst *gfx.Image, s string, x, y int)
- func Glyphs(f *Font, s string, dst []gpu.Piece) []gpu.Piece
- func Ink(glyphs []gpu.Piece) (x, y, w, h float32)
- func NumberGlyphs(f *Font, n int, dst []gpu.Piece) []gpu.Piece
- func NumberInk(n int) (x, y, w, h float32)
- func Sheet(f *Font) *gfx.Image
- type Font
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DebugPrintAt ¶
DebugPrintAt prints s with its top-left corner at (x, y), a line of it under another at each newline.
func Glyphs ¶ added in v0.20.0
Glyphs appends to dst the glyphs of s in f, each where it lies from the top-left of the first line, a line under another at each newline, and where it is on f's Sheet.
func Ink ¶ added in v0.20.0
Ink is the box round the glyphs laid: its top-left and its size; zero for none.
func NumberGlyphs ¶ added in v0.20.0
NumberGlyphs appends to dst the glyphs of n written in f, as Glyphs lays a string.
Types ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font is a typeface at a size, its glyphs drawn on demand into a sheet of its own.
func DefaultBoldFont ¶
func DefaultBoldFont() *Font
DefaultBoldFont is Go Bold at 14 pixels, DefaultFont's weight for a heading.
func DefaultFont ¶
func DefaultFont() *Font
DefaultFont is Go Regular at 14 pixels, which has the Latin letters of every European language.
func DefaultLargeFont ¶
func DefaultLargeFont() *Font
DefaultLargeFont is Go Bold at 28 pixels, for a screen's title.
func NumberFont ¶ added in v0.20.0
func NumberFont() *Font
NumberFont is Go Bold at 10 pixels, the face a badge's number is drawn in.
func (*Font) Draw ¶
Draw draws s in the font, c its colour, its first line's top-left at (x, y) of dst, a line under another at each newline.
func (*Font) LineHeight ¶
LineHeight is how far one line of text lies under the one before it.