bmfont_parser

Crates.iobmfont_parser
lib.rsbmfont_parser
version0.2.0
sourcesrc
created_at2019-01-15 21:05:33.765502
updated_at2019-01-16 21:35:56.105008
descriptionLightweight and easy-to-use bitmap font parser (.sfl and .fnt files)
homepage
repositoryhttps://github.com/Teascade/sfl_parser
max_upload_size
id108775
size97,666
Sofia Talarmo (Teascade)

documentation

https://docs.rs/sfl_parser

README

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:
    [dependencies]
    bmfont_parser="0.2"
    
  2. To your Rust project add the following line:
    extern crate bmfont_parser;
    
  3. 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.

Commit count: 24

cargo fmt