Struct opengl_graphics::glyph_cache::GlyphCache [] [src]

pub struct GlyphCache<'a> {
    pub face: Face<'a>,
    // some fields omitted
}

A struct used for caching rendered font.

Fields

face

The font face.

Methods

impl<'a> GlyphCache<'a>

fn new<P>(font: P) -> Result<GlyphCache<'static>, Error> where P: AsRef<Path>

Constructor for a GlyphCache.

fn from_bytes(font: &'a [u8]) -> Result<GlyphCache<'a>, Error>

Creates a GlyphCache for a font stored in memory.

fn preload_chars<I>(&mut self, size: FontSize, chars: I) where I: Iterator<Item=char>

Load all characters in the chars iterator for size

fn preload_printable_ascii(&mut self, size: FontSize)

Load all the printable ASCII characters for size. Includes space.

fn opt_character(&self, size: FontSize, ch: char) -> Option<Character>

Return ch for size if it's already cached. Don't load. See the preload_* functions.

Trait Implementations

impl<'b> CharacterCache for GlyphCache<'b>

type Texture = Texture

fn character<'a>(&'a mut self, size: FontSize, ch: char) -> Character<'a>

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