pub struct VectorFont(/* private fields */);
Expand description
VectorFonts allow drawing characters from TTF files
They store the glyphs as a collection of triangles, allowing them to be scaled up or down
without losing quality. To draw characters to the screen, use the to_renderer
method to
create a FontRenderer
.
Implementations§
Source§impl VectorFont
impl VectorFont
Sourcepub fn from_slice(data: &[u8]) -> Self
pub fn from_slice(data: &[u8]) -> Self
Create a VectorFont from a slice of binary TTF data
Sourcepub fn from_bytes(data: Vec<u8>) -> Self
pub fn from_bytes(data: Vec<u8>) -> Self
Create a VectorFont from an owned Vec of TTF data
Sourcepub async fn load(path: impl AsRef<Path>) -> Result<Self>
pub async fn load(path: impl AsRef<Path>) -> Result<Self>
Load a VectorFont from a TTF file at the given path
Sourcepub fn to_renderer(
&self,
gfx: &Graphics,
font_size: f32,
) -> Result<FontRenderer>
pub fn to_renderer( &self, gfx: &Graphics, font_size: f32, ) -> Result<FontRenderer>
Convert a VectorFont to a FontRenderer
for actual use
Auto Trait Implementations§
impl Freeze for VectorFont
impl RefUnwindSafe for VectorFont
impl Send for VectorFont
impl Sync for VectorFont
impl Unpin for VectorFont
impl UnwindSafe for VectorFont
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