Documentation ¶
Overview ¶
Package fcfonts is an implementation of the font tooling required by Pango, using textlayout/fontconfig and textlayout/fonts.
The entry point of the package is the `NewFontMap` constructor.
Index ¶
- func DefaultLoadFace(key fonts.FaceID, format fc.FontFormat) (fonts.Face, error)
- type FaceLoader
- type Font
- func (font *Font) Describe(absolute bool) pango.FontDescription
- func (font *Font) FaceID() fonts.FaceID
- func (font *Font) GetCoverage(_ pango.Language) pango.Coverage
- func (font *Font) GetFeatures() []harfbuzz.Feature
- func (font *Font) GetFontMap() pango.FontMap
- func (font *Font) GetHarfbuzzFont() *harfbuzz.Font
- func (font *Font) GetMetrics(lang pango.Language) pango.FontMetrics
- func (font *Font) GlyphExtents(glyph pango.Glyph, inkRect, logicalRect *pango.Rectangle)
- type FontMap
- type Fontset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultLoadFace ¶
DefaultLoadFace interprets the key as a file name and load from disk.
Types ¶
type FaceLoader ¶
type FaceLoader interface { // LoadFace opens and parses the given face. See `DefaultLoadFace` for a fallback. LoadFace(key fonts.FaceID, format fc.FontFormat) (fonts.Face, error) }
FaceLoader is implemented by client application to extend loading capabilities. By default, fonts are loaded from disk, but FaceLoader may for instance load from memory.
type Font ¶
type Font struct { Pattern fc.Pattern // fully resolved pattern // contains filtered or unexported fields }
Font implements the pango.Font interface, using fontconfig.
func (*Font) GetFeatures ¶
func (*Font) GetFontMap ¶
func (*Font) GetHarfbuzzFont ¶
func (*Font) GetMetrics ¶
func (font *Font) GetMetrics(lang pango.Language) pango.FontMetrics
type FontMap ¶
type FontMap struct { // Config is the fontconfig configuration used to // transform patterns when querying the database. // This is a readonly property, see SetConfig. Config *fc.Config // Database stores all the potential fonts, coming from // a fontconfig scan (or a cache). // This value is initialised at the start and should not be mutated, // to avoid caching misuse. // This is a readonly property, see SetConfig. Database fc.Fontset // contains filtered or unexported fields }
FontMap implements pango.FontMap using 'fontconfig' and 'fonts'.
func NewFontMap ¶
NewFontMap creates a new font map, used to cache information about available fonts, and holds certain global parameters such as the resolution and the default substitute function. The `config` object will be used to query information from the `database`.
func (*FontMap) LoadFontset ¶
func (*FontMap) SetConfig ¶
SetConfig updates the config and database, and clears the internal cache.
func (*FontMap) SetFaceLoader ¶
func (fontmap *FontMap) SetFaceLoader(loader FaceLoader)
SetFaceLoader uses a custom mechanism to load fonts. Pass `nil` to restore the default, that is loading from disk.