[][src]Type Definition embedded_picofont::FontPico

type FontPico<'a, C> = FontBuilder<'a, C, FontPicoConf>;

The 4x6 pixel monospace font used by the PICO-fantasy 8 console.

Examples

Write some text to the screen at the default (0, 0) position

use embedded_graphics::prelude::*;
use embedded_picofont::FontPico;
use embedded_picofont::text_pico;

// Use struct methods directly
display.draw(FontPico::render_str("Hello Rust!"));

// Use a macro instead
display.draw(text_pico!("Hello Rust!"));

Translate text by (20px, 30px)

use embedded_graphics::prelude::*;
use embedded_picofont::FontPico;

display.draw(
    FontPico::render_str("Hello Rust!").translate(Coord::new(20, 30))
);

Add some styling to the text

Use any method provided by the WithStyle trait. Properties like fill or stroke passed to the text_pico macro are converted into method calls verbatim.

use embedded_graphics::prelude::*;
use embedded_picofont::text_pico;
use embedded_picofont::FontPico;

display.draw(text_pico!(
    "Hello Rust!",
    fill = Some(1u8),
    stroke = Some(0u8)
));

display.draw(
    FontPico::render_str("Hello Rust!")
        .translate(Coord::new(20, 30))
        .fill(Some(1u8))
        .stroke(Some(0u8)),
);