3 unstable releases
0.2.0 | Jan 16, 2019 |
---|---|
0.1.1 | Jan 16, 2019 |
0.1.0 | Jan 15, 2019 |
#2701 in Parser implementations
Used in glerminal
37KB
889 lines
bmfont_parser
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:
- Add the following to your dependencies:
[dependencies] bmfont_parser="0.2"
- To your Rust project add the following line:
extern crate bmfont_parser;
- You're done! Here is an example of how to use it:
use bmfont_parser::{BMFont, Format}; let bmfont = match BMFont::from_path(Format::SFL, "examples/fonts/iosevka.sfl") { Ok(bmfont) => bmfont, Err(_) => panic!("Failed to load iosevka.sfl"), }; println!("bmfont: {}", bmfont); // Or Alternatively let iosevka_sfl = include_str!("examples/fonts/iosevka.sfl"); let bmfont = match BMFont::from_loaded(Format::SFL, iosevka_sfl, "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.