pub struct FaceCache<T> { /* private fields */ }Expand description
A cache for a single font/size pairing.
Implementations§
Source§impl<T> FaceCache<T>
impl<T> FaceCache<T>
Sourcepub fn new<I, F, E>(
font: Font,
scale: f32,
chars: I,
f: F,
) -> Result<FaceCache<T>, E>
pub fn new<I, F, E>( font: Font, scale: f32, chars: I, f: F, ) -> Result<FaceCache<T>, E>
Constructs a new FaceCache of a font at a specific scale.
The characters in chars are pre-loaded into the atlas.
If you need any more characters to draw things with, use
prepare_string.
Sourcepub fn prepare_string<F, E>(&mut self, s: &str, f: F) -> Result<(), E>
pub fn prepare_string<F, E>(&mut self, s: &str, f: F) -> Result<(), E>
Adds all the characters in the given string to the cache.
Sourcepub fn needs_preparing(&self, s: &str) -> bool
pub fn needs_preparing(&self, s: &str) -> bool
Returns true if a call to prepare_string is necessary to
draw this string.
Sourcepub fn drawing_commands(
&self,
s: &str,
) -> Result<Vec<DrawCommand<'_, T>>, FontCacheError<Void>>
pub fn drawing_commands( &self, s: &str, ) -> Result<Vec<DrawCommand<'_, T>>, FontCacheError<Void>>
Returns a vector of drawing commands that describe how to lay out characters for printing
Sourcepub fn drawing_commands_prepared<F, E>(
&mut self,
s: &str,
f: F,
) -> Result<Vec<DrawCommand<'_, T>>, E>
pub fn drawing_commands_prepared<F, E>( &mut self, s: &str, f: F, ) -> Result<Vec<DrawCommand<'_, T>>, E>
Returns a Vec of DrawCommands that pre-prepare the face-cache for drawing.
The only way that this will fail is if the rendering function f fails.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for FaceCache<T>where
T: Freeze,
impl<T> RefUnwindSafe for FaceCache<T>where
T: RefUnwindSafe,
impl<T> Send for FaceCache<T>where
T: Send,
impl<T> Sync for FaceCache<T>where
T: Sync,
impl<T> Unpin for FaceCache<T>where
T: Unpin,
impl<T> UnwindSafe for FaceCache<T>where
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