Git Product home page Git Product logo

fontconfig-rs's Introduction

fontconfig


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

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

Usage

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.

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.

Credits

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

fontconfig-rs's People

Contributors

wezm avatar manuel-rhdt avatar abonander avatar adrianwong avatar be-ing avatar songww avatar brendanzab avatar emberian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.