Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Default embed.FS
var Embedded = []fs.FS{Default}
Embedded are embedded filesystems to get fonts from. By default, this includes a set of Noto Sans and Roboto Mono fonts. System fonts are automatically supported separate from this. Use AddEmbedded to add to this. This must be called before the text shaper is created to have an effect.
On web, Embedded is only used for font metrics, as the actual font rendering happens through web fonts. See https://github.com/MobinYengejehi/core/font for more information.
var InfoExample = "AaBbCcIiPpQq12369$€¢?.:/()àáâãäåæç日本中国⇧⌘"
InfoExample is example text to demonstrate fonts.
Functions ¶
func Style ¶
Style sets the rich.Style and text.Style for the given font.Face.
func UseEmbeddedInMap ¶
UseEmbeddedInMap adds the fonts from the current Embedded list to the given map.
Types ¶
type Data ¶
type Data struct {
// Family name.
Family string
// Weight: normal, bold, etc.
Weight rich.Weights
// Slant: normal or italic.
Slant rich.Slants
// Stretch: normal, expanded, condensed, etc.
Stretch rich.Stretch
// Data contains the font data.
Data []byte `display:"-"`
// Font contains the loaded font face(s).
Fonts []*font.Face
}
Data contains font information for embedded font data.
type Family ¶
type Family struct {
// Family name.
Family string
// example text, styled according to font family in chooser.
Example string
}
Family is used for selecting a font family in a font chooser.
type Info ¶
type Info struct {
// Family name.
Family string
// Weight: normal, bold, etc
Weight rich.Weights
// Slant: normal or italic
Slant rich.Slants
// Stretch: normal, expanded, condensed, etc
Stretch rich.Stretch
// Font contains info about the location, family, etc of the font file.
Font fontscan.Footprint `display:"-"`
}
Info contains basic font information for aviailable fonts. This is used for a chooser for example.
Directories
¶
| Path | Synopsis |
|---|---|
|
Command metricsonly extracts font metrics from font files, discarding all the glyph outlines and other data.
|
Command metricsonly extracts font metrics from font files, discarding all the glyph outlines and other data. |