Struct graphics::glyph_cache::rusttype::GlyphCache [−][src]
pub struct GlyphCache<'a, F, T> { pub font: Font<'a>, pub factory: F, // some fields omitted }
A struct used for caching rendered font.
Fields
font: Font<'a>
The font.
factory: F
The factory used to create textures.
Implementations
impl<'a, F, T> GlyphCache<'a, F, T> where
T: CreateTexture<F> + UpdateTexture<F> + ImageSize,
[src]
T: CreateTexture<F> + UpdateTexture<F> + ImageSize,
pub fn from_font(font: Font<'a>, factory: F, settings: TextureSettings) -> Self
[src]
Constructs a GlyphCache from a Font.
pub fn new<P>(
font: P,
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'static, F, T>> where
P: AsRef<Path>,
[src]
font: P,
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'static, F, T>> where
P: AsRef<Path>,
Constructor for a GlyphCache.
pub fn from_bytes(
font: &'a [u8],
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'a, F, T>, ()>
[src]
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: FontSize,
chars: I
) -> Result<(), T::Error> where
I: Iterator<Item = char>,
[src]
&mut self,
size: FontSize,
chars: I
) -> Result<(), T::Error> where
I: Iterator<Item = char>,
Load all characters in the chars
iterator for size
pub fn preload_printable_ascii(
&mut self,
size: FontSize
) -> Result<(), T::Error>
[src]
&mut self,
size: FontSize
) -> Result<(), T::Error>
Load all the printable ASCII characters for size
. Includes space.
pub fn opt_character(
&self,
size: FontSize,
ch: char
) -> Option<Character<'_, T>>
[src]
&self,
size: FontSize,
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: ImageSize> CharacterCache for GlyphCache<'b, F, T> where
T: CreateTexture<F> + UpdateTexture<F>,
[src]
T: CreateTexture<F> + UpdateTexture<F>,
type Texture = T
The texture type associated with the character cache.
type Error = T::Error
The error type associated with the character cache.
fn character<'a>(
&'a mut self,
size: FontSize,
ch: char
) -> Result<Character<'a, T>, Self::Error>
[src]
&'a mut self,
size: FontSize,
ch: char
) -> Result<Character<'a, T>, Self::Error>
fn width(&mut self, size: FontSize, text: &str) -> Result<Scalar, Self::Error>
[src]
Auto Trait Implementations
impl<'a, F, T> RefUnwindSafe for GlyphCache<'a, F, T> where
F: RefUnwindSafe,
T: RefUnwindSafe,
F: RefUnwindSafe,
T: RefUnwindSafe,
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,
impl<'a, F, T> Unpin for GlyphCache<'a, F, T> where
F: Unpin,
T: Unpin,
F: Unpin,
T: Unpin,
impl<'a, F, T> UnwindSafe for GlyphCache<'a, F, T> where
F: UnwindSafe,
T: UnwindSafe,
F: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub 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>,