bmfont_parser

Build Status Docs Crates.io

A lightweight and easy-to-use .sfl and .fnt file (bitmap font) parser made with Rust.

Test fonts are generated with Fontbuilder

How to use

Documentation at docs.rs or simply:

  1. Add the following to your dependencies:
    toml [dependencies] bmfont_parser="0.2"
  2. To your Rust project add the following line: rust extern crate bmfont_parser;
  3. You're done! Here is an example of how to use it: ```rust use bmfont_parser::{BMFont, Format};

    let bmfont = match BMFont::frompath(Format::SFL, "examples/fonts/iosevka.sfl") { Ok(bmfont) => bmfont, Err() => panic!("Failed to load iosevka.sfl"), };

    println!("bmfont: {}", bmfont);

    // Or Alternatively

    let iosevkasfl = includestr!("examples/fonts/iosevka.sfl");

    let bmfont = match BMFont::fromloaded(Format::SFL, iosevkasfl, "examples/fonts/iosevka.sfl") { Ok(bmfont) => bmfont, Err(_) => panic!("Failed to load iosevka.sfl"), };

    println!("bmfont: {}", bmfont); ```

License

This crate is distributed under the terms of the MIT License.