Documentation
¶
Index ¶
- type Font
- func (f *Font) Ascent() int
- func (f *Font) Close() error
- func (f *Font) Descent() int
- func (f *Font) DrawGlyph(dst draw.Image, r rune, x, y int, fg, bg color.Color)
- func (f *Font) DrawText(dst draw.Image, text string, x, y int, fg, bg color.Color)
- func (f *Font) LineHeight() int
- func (f *Font) Measure(text string) (int, int)
- func (f *Font) ShapeLine(line string) []ShapedGlyph
- type Options
- type ShapedGlyph
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font is a pure-Go anti-aliased TTF renderer.
func NewDefault ¶
NewDefault returns a TTF renderer backed by gofont/goregular.
func NewFromFile ¶
NewFromFile loads and parses a TTF file from disk.
func NewFromTTF ¶
NewFromTTF parses a TTF payload and returns a renderable face.
func (*Font) DrawText ¶
DrawText draws anti-aliased text at (x, y), where y is the top of the text box.
func (*Font) LineHeight ¶
LineHeight returns the configured line height in pixels.
func (*Font) ShapeLine ¶
func (f *Font) ShapeLine(line string) []ShapedGlyph
ShapeLine applies kerning-aware shaping to a single text line.
Click to show internal directories.
Click to hide internal directories.