Struct piston_window::glyph_cache::rusttype::GlyphCache
source · pub struct GlyphCache<'a, F, T> {
pub font: Font<'a>,
pub factory: F,
/* private fields */
}
Expand description
A struct used for caching rendered font.
Fields§
§font: Font<'a>
The font.
factory: F
The factory used to create textures.
Implementations§
source§impl<'a, F, T> GlyphCache<'a, F, T>where
T: CreateTexture<F> + UpdateTexture<F> + ImageSize,
impl<'a, F, T> GlyphCache<'a, F, T>where T: CreateTexture<F> + UpdateTexture<F> + ImageSize,
sourcepub fn from_font(
font: Font<'a>,
factory: F,
settings: TextureSettings
) -> GlyphCache<'a, F, T>
pub fn from_font( font: Font<'a>, factory: F, settings: TextureSettings ) -> GlyphCache<'a, F, T>
Constructs a GlyphCache from a Font.
sourcepub fn new<P>(
font: P,
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'static, F, T>, Error>where
P: AsRef<Path>,
pub fn new<P>( font: P, factory: F, settings: TextureSettings ) -> Result<GlyphCache<'static, F, T>, Error>where P: AsRef<Path>,
Constructor for a GlyphCache.
sourcepub fn from_bytes(
font: &'a [u8],
factory: F,
settings: TextureSettings
) -> Result<GlyphCache<'a, F, T>, ()>
pub fn from_bytes( font: &'a [u8], factory: F, settings: TextureSettings ) -> Result<GlyphCache<'a, F, T>, ()>
Creates a GlyphCache for a font stored in memory.
sourcepub fn preload_chars<I>(
&mut self,
size: u32,
chars: I
) -> Result<(), <T as TextureOp<F>>::Error>where
I: Iterator<Item = char>,
pub fn preload_chars<I>( &mut self, size: u32, chars: I ) -> Result<(), <T as TextureOp<F>>::Error>where I: Iterator<Item = char>,
Load all characters in the chars
iterator for size
Trait Implementations§
source§impl<'b, F, T> CharacterCache for GlyphCache<'b, F, T>where
T: ImageSize + CreateTexture<F> + UpdateTexture<F>,
impl<'b, F, T> CharacterCache for GlyphCache<'b, F, T>where T: ImageSize + CreateTexture<F> + UpdateTexture<F>,
source§fn character(
&mut self,
size: u32,
ch: char
) -> Result<Character<'_, T>, <GlyphCache<'b, F, T> as CharacterCache>::Error>
fn character( &mut self, size: u32, ch: char ) -> Result<Character<'_, T>, <GlyphCache<'b, F, T> as CharacterCache>::Error>
Get reference to character.
Auto Trait Implementations§
impl<'a, F, T> RefUnwindSafe for GlyphCache<'a, F, T>where F: RefUnwindSafe, T: RefUnwindSafe,
impl<'a, F, T> Send for GlyphCache<'a, F, T>where F: Send, T: Send,
impl<'a, F, T> Sync for GlyphCache<'a, F, T>where F: Sync, T: Sync,
impl<'a, F, T> Unpin for GlyphCache<'a, F, T>where F: Unpin, T: Unpin,
impl<'a, F, T> UnwindSafe for GlyphCache<'a, F, T>where F: UnwindSafe, T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more