pub struct FontLoader;Expand description
Asset loader for font files.
Supports loading .ttf, .otf, .woff, .woff2, .ttc, and .otc files.
§Example
ⓘ
use astrelis_assets::AssetServer;
use astrelis_text::FontLoader;
let mut server = AssetServer::new();
server.register_loader(FontLoader);
// Now you can load font files
let handle = server.load_sync::<FontAsset>("fonts/Roboto-Regular.ttf");Trait Implementations§
Source§impl AssetLoader for FontLoader
impl AssetLoader for FontLoader
Source§fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
The file extensions this loader handles (without dots). Read more
Source§fn load(&self, ctx: LoadContext<'_>) -> AssetResult<Self::Asset>
fn load(&self, ctx: LoadContext<'_>) -> AssetResult<Self::Asset>
Load an asset from the provided context.
Auto Trait Implementations§
impl Freeze for FontLoader
impl RefUnwindSafe for FontLoader
impl Send for FontLoader
impl Sync for FontLoader
impl Unpin for FontLoader
impl UnsafeUnpin for FontLoader
impl UnwindSafe for FontLoader
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<L> ErasedAssetLoader for L
impl<L> ErasedAssetLoader for L
Source§fn asset_type_id(&self) -> TypeId
fn asset_type_id(&self) -> TypeId
Get the type ID of the asset this loader produces.
Source§fn asset_type_name(&self) -> &'static str
fn asset_type_name(&self) -> &'static str
Get a human-readable name for the asset type.
Source§fn extensions(&self) -> &[&str]
fn extensions(&self) -> &[&str]
Get the file extensions this loader handles.
Source§fn load_erased(
&self,
ctx: LoadContext<'_>,
) -> Result<Box<dyn Any + Sync + Send>, AssetError>
fn load_erased( &self, ctx: LoadContext<'_>, ) -> Result<Box<dyn Any + Sync + Send>, AssetError>
Load an asset and return it as a boxed Any.
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more