#embedded-graphics #font #renderer #ecosystem #subsystem #u8g2

no-std u8g2-fonts

A text renderer for embedded-graphics, based on U8g2

7 releases (4 breaking)

0.5.1 Dec 11, 2024
0.5.0 Dec 11, 2024
0.4.0 Nov 12, 2023
0.3.0 Jun 8, 2023
0.1.0 Aug 27, 2022

#229 in Embedded development

Download history 161/week @ 2024-09-22 110/week @ 2024-09-29 104/week @ 2024-10-06 31/week @ 2024-10-13 41/week @ 2024-10-20 253/week @ 2024-10-27 157/week @ 2024-11-03 131/week @ 2024-11-10 109/week @ 2024-11-17 43/week @ 2024-11-24 53/week @ 2024-12-01 376/week @ 2024-12-08 158/week @ 2024-12-15 71/week @ 2024-12-22 62/week @ 2024-12-29 106/week @ 2025-01-05

425 downloads per month
Used in lilygo-epd47

Custom license

9MB
4K SLoC

u8g2-fonts

Hello World text rendered by this crate

Crates.io Crates.io License Build Status docs.rs Coverage Status

This crate is a pure Rust reimplementation of the font subsystem of U8g2.

It is intended for the embedded-graphics ecosystem.

Licensing

While this crate is MIT / Apache-2.0 licensed, note that the fonts themselves are not.

For more information about the font licenses, read the license agreement of U8g2.

Example

let font = FontRenderer::new::<fonts::u8g2_font_haxrcorp4089_t_cyrillic>();
let text = "embedded-graphics";

font.render_aligned(
    text,
    display.bounding_box().center() + Point::new(0, 16),
    VerticalPosition::Baseline,
    HorizontalAlignment::Center,
    FontColor::Transparent(BinaryColor::On),
    &mut display,
)
.unwrap();

This example is based on the hello-world of the official embedded-graphics examples.

If we replace the text rendering section of the example with the code above, it produces this output:

Embedded-graphics example with our U8g2 font

Note that the letter i sits snug in between the h and the c, compared to the original example. This is not a monospace font.

Dependencies