INNER CODE UNIT · Rust
load_font_obj
PistonDevelopers/piston_window · src/piston_script.rs:212
pub fn load_font_obj(rt: &mut Runtime) -> Result<Variable, String> {
use dyon::embed::{to_rust_object, PushVariable};
use dyon::RustObject;
use wgpu_graphics::{Filter, TextureSettings};
use graphics::glyph_cache::rusttype::GlyphCache;
let file: Arc<String> = rt.pop()?;
let texture_context = unsafe { &*Current::<TextureContext>::new() };
let texture_settings = TextureSettings::new().filter(Filter::Nearest);
Ok(match GlyphCache::<'static, TextureContext, Texture>::new(
&**file, texture_context.clone(), texture_settings
) {
Ok(x) => Ok::<RustObject, Arc<String>>(to_rust_object(x)).push_var(),
Err(err) => Err::<RustObject, Arc<String>>(Arc::new(format!("{}", err))).push_var(),
})
}
pub fn draw(rt: &mut Runtime) -> Result<(), String> {