Crates.io | bmfont_parser |
lib.rs | bmfont_parser |
version | 0.2.0 |
source | src |
created_at | 2019-01-15 21:05:33.765502 |
updated_at | 2019-01-16 21:35:56.105008 |
description | Lightweight and easy-to-use bitmap font parser (.sfl and .fnt files) |
homepage | |
repository | https://github.com/Teascade/sfl_parser |
max_upload_size | |
id | 108775 |
size | 97,666 |
A lightweight and easy-to-use .sfl and .fnt file (bitmap font) parser made with Rust.
Test fonts are generated with Fontbuilder
Documentation at docs.rs or simply:
[dependencies]
bmfont_parser="0.2"
extern crate bmfont_parser;
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);
This crate is distributed under the terms of the MIT License.