Popularity
6 Stars
Updated Last
1 Year Ago
Started In
June 2014

Fontconfig

Build Status Build status

Fontconfig.jl provides basic binding to fontconfig.

Pattern

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")

Match

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.

Format

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.

List

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 Patterns

list(pat::Pattern=Pattern())

Required Packages

No packages found.