Skip to main content

Crate embedded_departure_mono

Crate embedded_departure_mono 

Source
Expand description

§embedded-departure-mono

Departure Mono 1.500 as a no_std bitmap font for embedded-graphics.

The original 550-unit em maps exactly to a 7x14 pixel cell at its native 11 px size: 7 px advance, 11 px ascent, and 3 px descent. Larger sizes use exact integer scaling. All outline points are aligned to the 50-unit pixel grid, so the generated data is binary rather than antialiased.

use embedded_departure_mono::FONT_7X14;
use embedded_graphics::{
    mock_display::MockDisplay,
    mono_font::MonoTextStyle,
    pixelcolor::BinaryColor,
    prelude::*,
    text::{Baseline, Text},
};

let mut display = MockDisplay::<BinaryColor>::new();
display.set_allow_out_of_bounds_drawing(true);
let style = MonoTextStyle::new(&FONT_7X14, BinaryColor::On);
Text::with_baseline(
    "Departure 20:26 — ВЫХОД НА ПОСАДКУ",
    Point::new(0, 0),
    style,
    Baseline::Top,
)
.draw(&mut display)
.unwrap();

§Fonts

FeatureFull fontASCII fontSource sizeFull / ASCII bitmap
size-7x14 (default)FONT_7X14FONT_7X14_ASCII11 px13,230 / 1,176 B
size-14x28FONT_14X28FONT_14X28_ASCII22 px52,920 / 4,704 B
size-21x42FONT_21X42FONT_21X42_ASCII33 px119,070 / 10,584 B
size-28x56FONT_28X56FONT_28X56_ASCII44 px211,680 / 18,816 B

Full fonts include all 1,079 encoded Unicode characters: Latin, Cyrillic, basic Greek, box drawing, symbols, and other characters from Departure Mono 1.500. ASCII variants contain U+0020..=U+007E.

Select one size without compiling the default bitmap:

[dependencies]
embedded-departure-mono = { version = "0.1", default-features = false, features = ["size-14x28"] }

Enable several sizes together, or use all-sizes:

[dependencies]
embedded-departure-mono = { version = "0.1", default-features = false, features = ["all-sizes"] }

Unsupported characters render as ?. OpenType-only alternates—small caps, old-style numerals, ligatures, and stylistic sets—aren’t addressable by embedded-graphics’ character-to-glyph API and aren’t included.

§Demo

Install SDL2 once on macOS, then launch the simulator:

brew install sdl2 pkg-config
cargo run --example simulator

Close the window or press Escape to exit.

Preview the complete size grid:

cargo run --example sizes --no-default-features --features all-sizes

§Regeneration

The committed bitmap is deterministic output from the original OTF:

uv run --with fonttools scripts/generate_font.py
cargo test

Source font SHA-256: 4d53f663155cf8bf7ffc8e688776e719625f7bbb80a8d90073438b249261a2e0.

§License

Rust code: MIT. Departure Mono font, source OTF, and derived bitmap data: SIL Open Font License 1.1. See LICENSE-MIT and LICENSE-OFL.

Structs§

DepartureMonoGlyphMapping
Unicode mapping used by the full font variants.

Constants§

FONT_7X14
Full Departure Mono 1.500 font with 1,079 Unicode characters.
FONT_7X14_ASCII
ASCII-only Departure Mono 1.500 font containing U+0020..=U+007E.
FONT_14X28
Full Departure Mono 1.500 font with 1,079 Unicode characters.
FONT_14X28_ASCII
ASCII-only Departure Mono 1.500 font containing U+0020..=U+007E.
FONT_21X42
Full Departure Mono 1.500 font with 1,079 Unicode characters.
FONT_21X42_ASCII
ASCII-only Departure Mono 1.500 font containing U+0020..=U+007E.
FONT_28X56
Full Departure Mono 1.500 font with 1,079 Unicode characters.
FONT_28X56_ASCII
ASCII-only Departure Mono 1.500 font containing U+0020..=U+007E.
SUPPORTED_GLYPH_COUNT

Statics§

DEPARTURE_MONO_MAPPING
Unicode mapping used by the full font variants.