Fontconfig.jl provides basic binding to fontconfig.
Pattern
corresponds to the fontconfig type FcPattern
. It respresents a set
of font properties used to match specific fonts.
It can be constructed in two ways. First with zero or more keyword arguments corresponding to fontconfig font properties.
Fontconfig.Pattern(; args...)
For example
Fontconfig.Pattern(family="Helvetica", size=10, hinting=true)
Secondly, it can be constructed with a fontconfig specifications string
Fontconfig.Pattern(name::String)
For example
Fontconfig.Pattern("Helvetica-10")
The primary functionality fontconfig provides is matching font patterns. In
Fontconfig.jl this is done with the match
function, corresponding to FcMatch
in fontconfig.
match(pat::Pattern)
It takes a Pattern
and return a Pattern
corresponding to the nearest
matching installed font.
Extracting property values from a Pattern
can be done with the format
function, which wraps FcPatternFormat
.
format(pat::Pattern, fmt::String="%{=fclist}")
See man FcPatternFormat
for the format string specification.
Fontconfig also provides a function list
to enumerate all installed
fonts. Optionally, a Pattern
can be provided to list just matching fonts. The
function will return a vector of Pattern
s
list(pat::Pattern=Pattern())