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(font: &Path) -> Result<GlyphCache<'static>, Error>

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<'a> CharacterCache for GlyphCache<'a>

type Texture = Texture

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

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

Derived Implementations

impl<'a> Clone for GlyphCache<'a>

fn clone(&self) -> GlyphCache<'a>

fn clone_from(&mut self, source: &Self)