1 unstable release

0.0.1 Nov 3, 2024

#28 in #bitmap-font

Download history 83/week @ 2024-10-28 100/week @ 2024-11-04 71/week @ 2024-11-11 42/week @ 2024-11-18 54/week @ 2024-11-25 107/week @ 2024-12-02 110/week @ 2024-12-09

314 downloads per month
Used in 17 crates (via swamp-font)

MIT license

14KB
184 lines

bmf-parser 🖋️

bmf-parser is a Rust crate for reading and parsing BMFont binary files, a popular font format for bitmap fonts often used in games and graphical applications. With bmf-parser, you can easily load BMFont data into a BMFont struct.

✨ Features

  • Simple API: Load BMFont binary data directly into a BMFont structure using a single method.
  • Comprehensive Font Data: Access font metadata, character properties, page details, and kerning pairs.
  • Efficient Parsing: Designed to be fast and efficient, perfect for games and applications needing bitmap font support.

📦 Installation

To start using bmf-parser, add it as a dependency in your Cargo.toml:

[dependencies]
bmf-parser = "0.0.1"

Usage

use bmf_parser::BMFont;
use std::{fs, io};

fn main() -> std::io::Result<()> {
    let mut octets = fs::read("path/to/font.fnt")?;

    let font = BMFont::from_octets(&octets)?;

    println!("Font info: {:?}", font.info);
    println!("Character count: {}", font.chars.len());

    Ok(())
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~115KB