[][src]Trait embedded_graphics::fonts::Font

pub trait Font<'a, C>: WithStyle<C> + Dimensions where
    C: PixelColor
{ fn render_str(chars: &'a str) -> Self;
fn dimensions(&self) -> UnsignedCoord; }

Common methods for all fonts

Required methods

fn render_str(chars: &'a str) -> Self

Render a string in the implementing font's typeface.

Defaults to 1u8 for stroke_color and 0u8 for fill_color

fn main() {
    let disp: Display = Display {};
    // Render a string with a 8bit color
    let text = Font6x8::render_str("Hello world")
        .with_style(Style::with_stroke(1u8.into()));

    disp.draw(text.into_iter());
}

fn dimensions(&self) -> UnsignedCoord

Deprecated since 0.4.5:

use .size() instead

Get the dimensions of a piece of text rendered in a particular font

Loading content...

Implementors

impl<'a, C, Conf> Font<'a, C> for FontBuilder<'a, C, Conf> where
    C: PixelColor,
    Conf: FontBuilderConf
[src]

Loading content...