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) 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 ¶ added in v0.0.2
DefaultLoadFace interprets the key as a file name and load from disk.
Types ¶
type FaceLoader ¶ added in v0.0.2
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. Custom implementations may use `DefaultLoadFace` as a fallback.
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
Font implements the pango.Font interface.
func (*Font) Describe ¶
func (font *Font) Describe(absolute bool) pango.FontDescription
func (*Font) GetFeatures ¶
func (*Font) GetFontMap ¶
func (*Font) GetHarfbuzzFont ¶ added in v0.0.2
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 ¶ added in v0.0.2
SetConfig updates the config and database, and clears the internal cache.
func (*FontMap) SetFaceLoader ¶ added in v0.0.2
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.