7 releases (breaking)

0.6.0 Oct 18, 2022
0.5.0 Mar 17, 2022
0.4.0 Mar 15, 2022
0.3.0 Feb 22, 2022
0.0.1 Dec 11, 2014

#600 in Text processing

Download history 137/week @ 2022-11-25 104/week @ 2022-12-02 138/week @ 2022-12-09 225/week @ 2022-12-16 143/week @ 2022-12-23 159/week @ 2022-12-30 173/week @ 2023-01-06 157/week @ 2023-01-13 121/week @ 2023-01-20 156/week @ 2023-01-27 184/week @ 2023-02-03 191/week @ 2023-02-10 278/week @ 2023-02-17 238/week @ 2023-02-24 186/week @ 2023-03-03 129/week @ 2023-03-10

847 downloads per month
Used in 2 crates

MIT license



A wrapper around freedesktop.org's Fontconfig library, for locating fonts on a UNIX like systems such as Linux and FreeBSD. Requires Fontconfig to be installed.


  • Alpine Linux: fontconfig-dev
  • Arch Linux: fontconfig
  • Debian-based systems: libfontconfig1-dev
  • FreeBSD: fontconfig
  • Void Linux: fontconfig-devel



use fontconfig::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());

You could then, for example, use font.path to create a GlyphCache from opengl_graphics and pass it to conrod.

Cargo Features

Feature Description Default Enabled Extra Dependencies
dlopen dlopen libfontconfig at runtime

The dlopen feature enables building this crate without dynamically linking to the Fontconfig C library at link time. Instead, Fontconfig will be dynamically loaded at runtime with the dlopen function. This can be useful in cross-compiling situations as you don't need to have a version of Fontcofig available for the target platform available at compile time.

Other Fontconfig Crates

  • servo-fontconfig — This crate provides a low-level interface only. It depends on servo-fontconfig-sys, which will fall back to building a vendored version of Fontconfig if a compatible version can't be found. It in-turn depends on expat-sys, which does the same thing regarding a vendored version of Expat. This makes it easier if you are distributing a code base that needs Fontconfig, but provides less control over the libraries that will be used.
  • fontconfig-sys — superceded by yeslogic-fontconfig-sys.
  • yeslogic-fontconfig — This crate was previously published under this name before we were given to publish it as fontconfig.

For our needs in Prince we wanted higher-level bindings that did not fall back on vendored versions of libraries, which is what the crates in this repo provide.


Thanks to Austin Bonander for originally creating the fontconfig crate and allowing us to publish ours under that name.