1 unstable release

0.0.1 Nov 3, 2024

#28 in #bitmap-font

Download history 34/week @ 2024-11-16 43/week @ 2024-11-23 118/week @ 2024-11-30 104/week @ 2024-12-07 44/week @ 2024-12-14 1/week @ 2024-12-21 56/week @ 2024-12-28 59/week @ 2025-01-04 86/week @ 2025-01-11 48/week @ 2025-01-18 11/week @ 2025-01-25 17/week @ 2025-02-01 16/week @ 2025-02-08 24/week @ 2025-02-15 36/week @ 2025-02-22 108/week @ 2025-03-01

190 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