Crate embedded_bitmap_fonts

Crate embedded_bitmap_fonts 

Source
Expand description

§embedded-bitmap-fonts

A comprehensive collection of bitmap fonts for the embedded-graphics crate.

This crate provides high-quality bitmap fonts from the Tecate bitmap-fonts collection for use with embedded-graphics. Key features include:

  • Pixel-doubling: Scale fonts by 2x, 3x, or more with no additional flash cost
  • Multiple font families: Tamzen, Cherry, Terminus, Spleen, and many more
  • Feature flags: Include only the fonts you need to minimize binary size
  • No-std compatible: Works on embedded systems without an allocator

§Usage

use embedded_bitmap_fonts::{BitmapFont, TextStyle};
use embedded_bitmap_fonts::tamzen::FONT_8x15;
use embedded_graphics::{pixelcolor::BinaryColor, prelude::*, text::Text};

// Draw text with a bitmap font
let text = Text::new(
    "Hello World!",
    Point::zero(),
    TextStyle::new(&FONT_8x15, BinaryColor::On)
);
text.draw(&mut display)?;

// Use pixel-doubled font for larger text (same flash cost!)
let doubled = FONT_8x15.pixel_double();
let large_text = Text::new(
    "Big Text!",
    Point::new(0, 20),
    TextStyle::new(&doubled, BinaryColor::On)
);
large_text.draw(&mut display)?;

§Available Font Families

Enable fonts using feature flags in your Cargo.toml:

[dependencies]
embedded-bitmap-fonts = { version = "0.1", features = ["tamzen", "cherry"] }

Or enable all fonts:

[dependencies]
embedded-bitmap-fonts = { version = "0.1", features = ["all-fonts"] }

Modules§

terminus
terminus font family

Structs§

BitmapFont
Stores the font bitmap and metadata for rendering.
TextStyle
Text style for rendering with a BitmapFont.