[−]Struct piston_window::glyph_cache::rusttype::GlyphCache
A struct used for caching rendered font.
Fields
font: Font<'a>
The font.
factory: F
The factory used to create textures.
Methods
impl<'a, F, T> GlyphCache<'a, F, T> where
T: CreateTexture<F> + UpdateTexture<F, Error = <T as CreateTexture<F>>::Error> + ImageSize,
T: CreateTexture<F> + UpdateTexture<F, Error = <T as CreateTexture<F>>::Error> + ImageSize,
pub fn from_font(
font: Font<'a>,
factory: F,
settings: TextureSettings
) -> GlyphCache<'a, F, T>
font: Font<'a>,
factory: F,
settings: TextureSettings
) -> GlyphCache<'a, F, T>
Constructs a GlyphCache from a Font.
pub fn new<P>(
font: P,
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'static, F, T>, Error> where
P: AsRef<Path>,
font: P,
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'static, F, T>, Error> where
P: AsRef<Path>,
Constructor for a GlyphCache.
pub fn from_bytes(
font: &'a [u8],
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'a, F, T>, ()>
font: &'a [u8],
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'a, F, T>, ()>
Creates a GlyphCache for a font stored in memory.
pub fn preload_chars<I>(
&mut self,
size: u32,
chars: I
) -> Result<(), <T as CreateTexture<F>>::Error> where
I: Iterator<Item = char>,
&mut self,
size: u32,
chars: I
) -> Result<(), <T as CreateTexture<F>>::Error> where
I: Iterator<Item = char>,
Load all characters in the chars
iterator for size
pub fn preload_printable_ascii(
&mut self,
size: u32
) -> Result<(), <T as CreateTexture<F>>::Error>
&mut self,
size: u32
) -> Result<(), <T as CreateTexture<F>>::Error>
Load all the printable ASCII characters for size
. Includes space.
pub fn opt_character(&self, size: u32, ch: char) -> Option<Character<T>>
Return ch
for size
if it's already cached. Don't load.
See the preload_*
functions.
Trait Implementations
impl<'b, F, T> CharacterCache for GlyphCache<'b, F, T> where
T: ImageSize + CreateTexture<F> + UpdateTexture<F, Error = <T as CreateTexture<F>>::Error>,
T: ImageSize + CreateTexture<F> + UpdateTexture<F, Error = <T as CreateTexture<F>>::Error>,
type Texture = T
The texture type associated with the character cache.
type Error = <T as CreateTexture<F>>::Error
The error type associated with the character cache.
fn character(
&'a mut self,
size: u32,
ch: char
) -> Result<Character<'a, T>, <GlyphCache<'b, F, T> as CharacterCache>::Error>
&'a mut self,
size: u32,
ch: char
) -> Result<Character<'a, T>, <GlyphCache<'b, F, T> as CharacterCache>::Error>
fn width(&mut self, size: u32, text: &str) -> Result<f64, Self::Error>
Return the width for some given text.
Auto Trait Implementations
impl<'a, F, T> Send for GlyphCache<'a, F, T> where
F: Send,
T: Send,
F: Send,
T: Send,
impl<'a, F, T> Sync for GlyphCache<'a, F, T> where
F: Sync,
T: Sync,
F: Sync,
T: Sync,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
Sets value
as a parameter of self
.