A wrapper around [freedesktop.org's Fontconfig library][homepage], for locating fonts on a UNIX like systems such as Linux and FreeBSD. Requires Fontconfig to be installed.
See the Fontconfig developer reference for more information.
Dependencies
- Arch Linux:
fontconfig
- Debian-based systems:
libfontconfig1-dev
- FreeBSD:
fontconfig
- Void Linux:
fontconfig-devel
Usage
main.rs
:
use fontconfig::{Font, Fontconfig};
fn main() {
let fc = Fontconfig::new().unwrap();
// `Fontconfig::find()` returns `Option` (will rarely be `None` but still could be)
let font = fc.find("freeserif", None).unwrap();
// `name` is a `String`, `path` is a `Path`
println!("Name: {}\nPath: {}", font.name, font.path.display());
}