#font #fontconfig #search

sys fontconfig-sys

Bindings to fontconfig for locating font files

1 stable release

Uses old Rust 2015

2.11.1 Dec 11, 2014

#12 in #fontconfig

MIT license

24KB
461 lines

fontconfig-rs

NOTICE: this repository is no longer the source repo for the fontconfig crate; see https://github.com/yeslogic/fontconfig-rs for the current source

A wrapper around freedesktop's fontconfig utility, for locating fontfiles on a Linux-based system. Requires libfontconfig to be installed.

Prerequisites

####Ubuntu-based system:

sudo apt-get install libfontconfig libfontconfig1-dev

Usage

Cargo.toml:

[dependencies]
fontconfig = "*"

main.rs:

extern crate fontconfig;

use fontconfig::Font;

fn main() {
    `Font::find()` returns `Option` (will rarely be `None` but still could be)
    let font = Font::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.

Documentation

TODO: RustCI integration

git clone https://github.com/cybergeek94/fontconfig-rs
cd fontconfig-rs
cargo doc --open

Dependencies