embedded_graphics

Macro egtext

Source
macro_rules! egtext {
    (text = $text:expr, top_left = $position:expr,
        style = $style:expr $(,)?) => { ... };
}
Expand description

Creates a styled text.

The egtext macro expects the text, the position and styling properties as arguments.

The style property accepts a TextStyle object. This can be an object literal, usage of the text_style macro, or something else like a function call that returns TextStyle.

ยงExamples

use embedded_graphics::{egtext, fonts::Font6x8, pixelcolor::Rgb888, prelude::*, text_style};

let text = egtext!(
    text = "text",
    top_left = Point::zero(),
    style = text_style!(
        font = Font6x8, // Font must to be the first styling property
        text_color = Rgb888::RED,
    )
);