Expand description

bitmap-font 0.1 works with embedded-graphics 0.6! Version 0.7 includes a lot of changes to the font/text rendering system, including the introduction of the MonoFont type that is similar to the BitmapFont type from this crate. However, it seems to be impossible to use pixel-double versions of the fonts included in eg 0.7, so it does not offer all functionality of this crate.

This crate provides bitmap fonts for the embedded-graphics crate without requiring generics. All fonts provided are concrete, constant instances of BitmapFont. This means you can use these bitmap fonts without any generics, unlike those fonts shipped with embedded-graphics where each font is implemented via its own struct. Also, this allows pixel-double fonts to share their bitmap data with the non-doubled font, reducing the flash size required.

Usage Example

use bitmap_font::{BitmapFont, WithFont, FONT_7x13};
use embedded_graphics::{fonts::Text, prelude::*};

let font: BitmapFont = FONT_7x13;
let text = Text::new("Hello World!", Point::zero());
text.with_font(font, BinaryColor::On).draw(&mut display)?;

Structs

Stores the font bitmap and some additional info for each font.

Constants

Tamzen 5x9 Font.

Tamzen 5x9 Bold Font.

Tamzen 6x12 Font.

Tamzen 6x12 Bold Font.

Tamzen 7x13 Font.

Tamzen 7x13 Bold Font.

Tamzen 7x14 Font.

Tamzen 7x14 Bold Font.

Tamzen 8x15 Font.

Tamzen 8x15 Bold Font.

Tamzen 8x16 Font.

Tamzen 8x16 Bold Font.

Pixel-double version of FONT_5x9.

Pixel-double version of FONT_5x9_BOLD.

Tamzen 10x20 Font.

Tamzen 10x20 Bold Font.

Pixel-double version of FONT_6x12.

Pixel-double version of FONT_6x12_BOLD.

Pixel-double version of FONT_7x13.

Pixel-double version of FONT_7x13_BOLD.

Pixel-double version of FONT_7x14.

Pixel-double version of FONT_7x14_BOLD.

Pixel-double version of FONT_8x15.

Pixel-double version of FONT_8x15_BOLD.

Pixel-double version of FONT_8x16.

Pixel-double version of FONT_8x16_BOLD.

Pixel-double version of FONT_10x20.

Pixel-double version of FONT_10x20_BOLD.

Traits

Style a Text with a font and color.