Crates.io | fontconfig-rs |
lib.rs | fontconfig-rs |
version | 0.1.1 |
source | src |
created_at | 2022-06-21 07:44:35.934012 |
updated_at | 2022-06-21 08:23:49.70819 |
description | Safe, higher-level wrapper around the fontconfig library |
homepage | https://github.com/songww/fontconfig-rs |
repository | https://github.com/songww/fontconfig-rs |
max_upload_size | |
id | 610084 |
size | 116,269 |
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.
fontconfig-dev
fontconfig
libfontconfig1-dev
fontconfig
fontconfig-devel
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
.
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.