pub trait CharacterCache {
    type Texture: ImageSize;
    type Error: Debug;

    // Required method
    fn character(
        &mut self,
        font_size: u32,
        ch: char
    ) -> Result<Character<'_, Self::Texture>, Self::Error>;

    // Provided method
    fn width(&mut self, size: u32, text: &str) -> Result<f64, Self::Error> { ... }
}
Expand description

Stores characters in a buffer and loads them by demand.

Required Associated Types§

source

type Texture: ImageSize

The texture type associated with the character cache.

source

type Error: Debug

The error type associated with the character cache.

Required Methods§

source

fn character( &mut self, font_size: u32, ch: char ) -> Result<Character<'_, Self::Texture>, Self::Error>

Get reference to character.

Provided Methods§

source

fn width(&mut self, size: u32, text: &str) -> Result<f64, Self::Error>

Return the width for some given text.

Implementors§

source§

impl<'b, F, T> CharacterCache for GlyphCache<'b, F, T>where T: ImageSize + CreateTexture<F> + UpdateTexture<F>,

§

type Texture = T

§

type Error = <T as TextureOp<F>>::Error