font-map 0.2.9

Macros and utilities for parsing font files
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use font_map::codegen::FontDesc;
use font_map::error::ParseResult;
use font_map::font::Font;

fn main() -> ParseResult<()> {
    //
    // Load the font, and create a code generator from it
    let font = Font::from_file("nerd_font/font.ttf")?;
    let generator = FontDesc::from_font("Icon", &font, false);

    //
    // We can optionally inject extra code into the generated enum's impl block
    let code_tokens = generator.codegen(None);
    println!("Generated some code: {}", !code_tokens.is_empty());
    Ok(())
}