https://github.com/juliagraphics/fontconfig.jl
Basic Julia bindings for fontconfig
https://github.com/juliagraphics/fontconfig.jl
Last synced: 9 months ago
JSON representation
Basic Julia bindings for fontconfig
- Host: GitHub
- URL: https://github.com/juliagraphics/fontconfig.jl
- Owner: JuliaGraphics
- License: other
- Created: 2014-06-12T15:08:51.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T16:06:00.000Z (over 3 years ago)
- Last Synced: 2025-01-20T18:22:28.078Z (over 1 year ago)
- Language: Julia
- Size: 53.7 KB
- Stars: 8
- Watchers: 5
- Forks: 15
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Fontconfig
[](https://travis-ci.org/JuliaGraphics/Fontconfig.jl)
[](https://ci.appveyor.com/project/SimonDanisch/fontconfig-jl-4rmrs/branch/master)
Fontconfig.jl provides basic binding to [fontconfig](http://www.freedesktop.org/wiki/Software/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.
```julia
Fontconfig.Pattern(; args...)
```
For example
```julia
Fontconfig.Pattern(family="Helvetica", size=10, hinting=true)
```
Secondly, it can be constructed with a fontconfig specifications string
```julia
Fontconfig.Pattern(name::String)
```
For example
```julia
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.
```julia
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`.
```julia
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 `Pattern`s
```julia
list(pat::Pattern=Pattern())
```