bmfont_parser 0.2.0

Lightweight and easy-to-use bitmap font parser (.sfl and .fnt files)
Documentation
  • Coverage
  • 92.45%
    49 out of 53 items documented3 out of 9 items with examples
  • Size
  • Source code size: 97.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.24 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Teascade/sfl_parser
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Teascade

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.