package font
Import Path
gonum.org/v1/plot/font (on go.dev)
Dependency Relation
imports 9 packages, and imported by 2 packages
Involved Source Files
Package font provides types to describe and select text font faces.
font.go
len.go
Package-Level Type Names (total 8)
Cache collects font faces.
Add adds a whole collection of font Faces to the font cache.
If the cache is empty, the first font Face in the collection is set
to be the default one.
(*Cache) GobDecode([]byte) error
(*Cache) GobEncode() ([]byte, error)
Has returns whether the cache contains the exact font descriptor.
Lookup returns the font Face corresponding to the provided Font descriptor,
with the provided font size set.
If no matching font Face could be found, the one corresponding to
the default typeface is selected and returned.
*Cache : encoding/gob.GobDecoder
*Cache : encoding/gob.GobEncoder
func NewCache(coll Collection) *Cache
var DefaultCache *Cache
Collection is a collection of fonts, regrouped under a common typeface.
func NewCache(coll Collection) *Cache
func (*Cache).Add(coll Collection)
Extents contains font metric information.
Ascent is the distance that the text
extends above the baseline.
Descent is the distance that the text
extends below the baseline. The descent
is given as a positive value.
Height is the distance from the lowest
descending point to the highest ascending
point.
func (*Face).Extents() Extents
Face holds a font descriptor and the associated font face.
Face *opentype.Font
Font Font
Extents returns the FontExtents for a font.
FontFace returns the opentype font face for the requested
dots-per-inch resolution.
Name returns a fully qualified name for the given font.
Width returns width of a string when drawn using the font.
*Face : github.com/polarsignals/frostdb/query/logicalplan.Named
func (*Cache).Lookup(fnt Font, size Length) Face
func gonum.org/v1/plot/vg.Canvas.FillString(f Face, pt vg.Point, text string)
func gonum.org/v1/plot/vg.CanvasSizer.FillString(f Face, pt vg.Point, text string)
func gonum.org/v1/plot/vg.CanvasWriterTo.FillString(f Face, pt vg.Point, text string)
Font represents a font face.
Size is the size of the font.
Style is the style of a font, such as Regular or Italic.
Typeface identifies the Font.
Variant is the variant of a font, such as "Mono" or "Smallcaps".
Weight is the weight of a font, such as Normal or Bold.
Name returns a fully qualified name for the given font.
*Font : github.com/polarsignals/frostdb/query/logicalplan.Named
func From(fnt Font, size Length) Font
func From(fnt Font, size Length) Font
func (*Cache).Has(fnt Font) bool
func (*Cache).Lookup(fnt Font, size Length) Face
Length is a unit-independent representation of length.
Internally, the length is stored in postscript points.
Dots returns the length in dots for the given resolution.
Points returns the length in postscript points.
func ParseLength(value string) (Length, error)
func Points(pt float64) Length
func (*Face).Width(s string) Length
func From(fnt Font, size Length) Font
func (*Cache).Lookup(fnt Font, size Length) Face
const Centimeter
const Inch
const Millimeter
const gonum.org/v1/plot/vg.Centimeter
const gonum.org/v1/plot/vg.Inch
const gonum.org/v1/plot/vg.Millimeter
Typeface identifies a particular typeface design.
The empty string denotes the default typeface.
Variant denotes a typeface variant, such as "Mono", "Smallcaps" or "Math".
Package-Level Functions (total 4)
From returns a copy of the provided font with its size set.
NewCache creates a new cache of fonts from the provided collection of
font Faces.
The first font Face in the collection is set to be the default one.
ParseLength parses a Length string.
A Length string is a possible signed floating number with a unit.
e.g. "42cm" "2.4in" "66pt"
If no unit was given, ParseLength assumes it was (postscript) points.
Currently valid units are:
- mm (millimeter)
- cm (centimeter)
- in (inch)
- pt (point)
Points returns a length for the given number of points.
Package-Level Variables (only one)
DefaultCache is the global cache for fonts.
Package-Level Constants (total 3)
Common lengths.
Common lengths.
Common lengths.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |