Fonts and font families#
Font families#
A font family is a collection of faces that appear in different font weight and styles:
You can add faces to the font family:
where the font source is:
type FontSource struct {
Name string
FontFeatures []string
Location string
Data []byte
SizeAdjust float64 // 1 - SizeAdjust is the relative adjustment.
// The sub font index within the font file.
Index int
}
and the weight is a number between 100 and 900 or a predefined name FontWeight100
, FontWeight200
, ..., FontWeight900
and the style is FontStyleNormal
, FontStyleItalic
or FontStyleOblique
.
You can retrieve a font source with
which will give you the closest match.
Converting font weight and style from string#
To get a font weight or a font style from a string you can use these two functions:
The inherited value for the font weight is used when the string is “bolder”.