bevy/crates/bevy_text/src/font_loader.rs
2020-05-21 17:21:33 -07:00

18 lines
409 B
Rust

use crate::Font;
use anyhow::Result;
use bevy_asset::AssetLoader;
use std::path::Path;
#[derive(Default)]
pub struct FontLoader;
impl AssetLoader<Font> for FontLoader {
fn from_bytes(&self, _asset_path: &Path, bytes: Vec<u8>) -> Result<Font> {
Ok(Font::try_from_bytes(bytes)?)
}
fn extensions(&self) -> &[&str] {
static EXTENSIONS: &[&str] = &["ttf"];
EXTENSIONS
}
}