Crate embedded_mogeefont

source ·
Expand description

Unlike many other pixel fonts, MogeeFont maximizes screen space efficiency by incorporating glyphs of variable width alongside kerning tables and ligatures.

MogeeFont was originally created by Nadya Kuzmina for a pixel game that had to fit on a 64×64 pixel screen. You can read about the history of MogeeFont here.

This crate brings the font to embedded systems, it should be used together with embedded-graphics and embedded-text.

Embedded

§Usage

use embedded_text::{style::TextBoxStyle, TextBox};
use embedded_mogeefont::MogeeTextStyle;
use embedded_graphics::{
  geometry::{Size, Point},
  mock_display::MockDisplay,
  pixelcolor::BinaryColor,
  primitives::Rectangle,
  Drawable,
};

let mut display = MockDisplay::new();
let character_style = MogeeTextStyle::new(BinaryColor::On);
let textbox_style = TextBoxStyle::default();
let textbox_bounds = Rectangle::new(Point::zero(), Size::new(42, 22));
let textbox = TextBox::with_textbox_style(
   "Hello, world!",
   textbox_bounds,
   character_style,
   textbox_style,
);
textbox.draw(&mut display).unwrap();
assert_eq!(
  display,
  MockDisplay::from_pattern(&[
    "                                          ",
    "#  #     # #                       #   # #",
    "#  #     # #                       #   # #",
    "#  #  ## # # ##      # # # ##  ##  #  ## #",
    "#### # # # # # #     # # # # # # # # # # #",
    "#  # ### # # # #     # # # # # # # # # # #",
    "#  # #   # # # #     # # # # # #   # # #  ",
    "#  #  ## # #  ## #   ## #   ## #   # ##  #",
    "                 #                        ",
    "                #                         ",
  ]),
);

§Supported characters

CharsetSpecimen, upscaled to 2x
ASCIIASCII

Structs§