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§
- FONT_
6X8 - The 6 x 8 pixel font formerly known
Font6x8. - FONT_
6X12 - The 6 x 12 pixel font formerly known
Font6x12. - FONT_
8X16 - The 8 x 16 pixel font formerly known
Font8x16. - FONT_
12X16 - The 12 x 16 pixel font formerly known
Font12x16. - FONT_
24X32 - An upscaled version of
FONT_12X16previously known asFont24x32.