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
| Feature | Full font | ASCII font | Source size | Full / ASCII bitmap |
|---|---|---|---|---|
size-7x14 (default) | FONT_7X14 | FONT_7X14_ASCII | 11 px | 13,230 / 1,176 B |
size-14x28 | FONT_14X28 | FONT_14X28_ASCII | 22 px | 52,920 / 4,704 B |
size-21x42 | FONT_21X42 | FONT_21X42_ASCII | 33 px | 119,070 / 10,584 B |
size-28x56 | FONT_28X56 | FONT_28X56_ASCII | 44 px | 211,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 simulatorClose 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 testSource 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§
- Departure
Mono Glyph Mapping - 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.