#embedded-graphics #font #renderer #no-std #rendered #u8g2

no-std u8g2-fonts

A text renderer for embedded-graphics, based on U8g2

5 releases (3 breaking)

0.4.0 Nov 12, 2023
0.3.0 Jun 8, 2023
0.2.0 Sep 7, 2022
0.1.0 Aug 27, 2022
0.1.0-alpha.1 Aug 26, 2022

#320 in Embedded development

Download history 11/week @ 2024-03-02 16/week @ 2024-03-09 12/week @ 2024-03-16 1/week @ 2024-03-23 82/week @ 2024-03-30 21/week @ 2024-04-06 111/week @ 2024-04-13 82/week @ 2024-04-20 37/week @ 2024-04-27 46/week @ 2024-05-04 46/week @ 2024-05-11 22/week @ 2024-05-18 67/week @ 2024-05-25 49/week @ 2024-06-01 22/week @ 2024-06-08 31/week @ 2024-06-15

171 downloads per month

Custom license

30MB
10K 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 snuck in between the h and the c, compared to the original example. This is not a monospace font.

Dependencies