Expand description

The monospace fonts from embedded-graphics back the overhauled font handling form 0.7. The fronts provided here use the same bitmaps with new MonoFont structs.

Example

Draw the text “Hello!” to a mock display using the 6 x 8 pixel font FONT_6X8.

use embedded_graphics::{
    mock_display::MockDisplay,
    mono_font::MonoTextStyle,
    pixelcolor::BinaryColor,
    prelude::*,
    text::Text,
};
use embedded_vintage_fonts::FONT_6X8;

let mut display = MockDisplay::new();
let style = MonoTextStyle::new(&FONT_6X8, BinaryColor::On);

Text::new("Hello!", Point::new(0, FONT_6X8.baseline as i32), style)
    .draw(&mut display)?;

assert_eq!(
    display,
    MockDisplay::from_pattern(&[
        "#   #        ##    ##           #",
        "#   #         #     #           #",
        "#   #  ###    #     #    ###    #",
        "##### #   #   #     #   #   #   #",
        "#   # #####   #     #   #   #   #",
        "#   # #       #     #   #   #    ",
        "#   #  ###   ###   ###   ###    #",
    ])
);

Glyph Coverage

Most fonts from this crate provide support for ISO/IEC 8859-1 (Latin-1). FONT_6X12 supports only ASCII characters.

Constants

  • The 6 x 8 pixel font formerly known Font6x8.
  • The 6 x 12 pixel font formerly known Font6x12.
  • The 8 x 16 pixel font formerly known Font8x16.
  • The 12 x 16 pixel font formerly known Font12x16.
  • An upscaled version of FONT_12X16 previously known as Font24x32.