yeslogic-fontconfig

Crates.ioyeslogic-fontconfig
lib.rsyeslogic-fontconfig
version0.1.1
sourcesrc
created_at2019-12-05 02:56:00.061107
updated_at2020-06-11 05:59:40.994391
descriptionRENAMED: use the fontconfig crate instead.
homepagehttps://github.com/yeslogic/fontconfig-rs
repositoryhttps://github.com/yeslogic/fontconfig-rs
max_upload_size
id186604
size14,980
Developers (prince) (github:yeslogic:developers-prince)

documentation

https://docs.rs/crate/yeslogic-fontconfig

README

fontconfig-rs

Build Status Documentation Version 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.

Dependencies

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

Usage

Cargo.toml:

[dependencies]
yeslogic-fontconfig = "0.1.0"

main.rs:

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.

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 + fontconfig-sys — These crates have not been updated since Dec 2014.

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.

Commit count: 120

cargo fmt