ibm437 0.4.0

IBM437 bitmap font — works with embedded-graphics and raw framebuffers (minifb, softbuffer, SDL2…)
Documentation

IBM437

The IBM437 bitmap font, extracted from the original AM9264 chip (MDA/CGA card), for Rust projects.

Two rendering backends are available, selected via Cargo features:

  • embedded-graphics-backend — provides MonoFont constants for the embedded-graphics ecosystem. Ideal for embedded or simulated displays.
  • framebuffer — renders text into any &mut [u32] ARGB pixel buffer. Works with minifb, softbuffer, SDL2, or any raw framebuffer.

Both backends can be enabled simultaneously. The raw font data and the Unicode → IBM437 mapping are always available regardless of backend choice.

Available fonts

Three variants can be toggled individually via features (regular8x8, bold8x8, regular9x14). All three are enabled by default.

8×8 regular

8×8 regular IBM437

8×8 bold

8×8 bold IBM437

9×14 regular

9×14 regular IBM437

Usage with embedded-graphics

This is the default configuration — no extra feature flags needed.

[dependencies]
ibm437 = "0.4"
use embedded_graphics::{mono_font::MonoTextStyle, pixelcolor::Rgb888, prelude::*, text::Text};
use ibm437::IBM437_8X8_REGULAR;

let style = MonoTextStyle::new(&IBM437_8X8_REGULAR, Rgb888::WHITE);
Text::new("Hello!", Point::new(10, 20), style)
    .draw(&mut display)?;

Usage with minifb / softbuffer / raw framebuffers

[dependencies]
ibm437 = { version = "0.4", default-features = false, features = ["framebuffer", "regular8x8"] }
use ibm437::framebuffer::FbFont;

let font = FbFont::regular_8x8();
let mut buffer = vec![0u32; 640 * 480];

// Draw with yellow foreground, transparent background
font.draw_str(&mut buffer, 640, 10, 10, "Hello, IBM437!", 0x00FFFF00, None);

// Draw with white on blue
font.draw_str(&mut buffer, 640, 10, 20, "Line 2", 0x00FFFFFF, Some(0x000000AA));

A complete minifb example is available in examples/minifb_hello.rs.

Feature reference

Feature Default Description
embedded-graphics-backend MonoFont constants for embedded-graphics
framebuffer FbFont renderer for &mut [u32] buffers
regular8x8 Include the 8×8 regular font
bold8x8 Include the 8×8 bold font
regular9x14 Include the 9×14 regular font
generate Binary to regenerate fonts from the ROM dump

Character set

Glyph offsets are optimised for UTF-8: most Latin-1 characters map to their Unicode code point. The full mapping is available in doc/Characters.txt.

License

MIT