Documentation
¶
Overview ¶
Package fontconfig binds libfontconfig (through purego, SPEC §8.1) to match a font family, weight, slant and language to the font files of the system, in the fallback order the user's fontconfig settings give. The Linux engine of Flutter asks fontconfig the same way.
Flutter: no counterpart (engine/src/flutter/third_party/txt uses Skia's SkFontMgr_fontconfig)
Index ¶
Constants ¶
const LibraryEnv = "GLUTTER_FONTCONFIG_LIBRARY"
LibraryEnv names the environment variable that overrides the path of libfontconfig, for setups such as NixOS (SPEC §8.1).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is a loaded fontconfig configuration with the system fonts. It is safe for concurrent use.
Flutter: no counterpart
func Open ¶
Open loads libfontconfig and the user's fontconfig configuration, which reads the configuration files and scans the font directories. It fails with FontconfigLoadFailed when the library is not there, with FontconfigInitFailed when it cannot load a configuration, and with FontconfigCanceled when ctx is done. Close the Config when done.
Flutter: no counterpart
func (*Config) Close ¶
func (c *Config) Close()
Close releases the configuration. The Config must not be used after.
Flutter: no counterpart
func (*Config) Match ¶
func (c *Config) Match(ctx context.Context, family string, weight int, italic bool, lang string) ([]File, error)
Match returns the font files for the family in the order of fontconfig's fallback: the best match first, then the fonts the family and language substitution rules and the user's preferences put next. family may be a generic name such as "sans-serif" or "emoji"; weight is an OpenType weight (400 regular, 700 bold); lang is a BCP 47 tag such as "ja" or "" for the default. It fails with FontconfigMatchFailed when fontconfig cannot sort the fonts, with FontconfigPatternFailed when it cannot build the query, with FontconfigClosed after Close, and with FontconfigCanceled when ctx is done.
Flutter: no counterpart (SkFontMgr_fontconfig::onMatchFamilyStyle)
type File ¶
type File struct {
// Path is the font file.
Path string
// Index is fontconfig's FC_INDEX: the face in a collection in the low 16 bits,
// and for a variable font, 1 + the named instance in the high 16 bits (0 means
// the default instance).
Index int
// Family is the first family name of the font, or "".
Family string
}
File is one font that fontconfig matched.
Flutter: no counterpart