elmesque
elmesque copied to clipboard
How do I embed a font?
Sorry if this is a stupid question, but how would I embed a font into my app? As far as I can tell the text object needs a filepath, so is it possible?
Edit: Right now I'm using env::temp_dir() and writing to a temporary path with include_bytes!, but hopefully there's a way that's less hacky than that.
let mut font_path = env::temp_dir();
font_path.set_file_name("inconsolata.otf");
File::create(&font_path).unwrap().write(include_bytes!("../assets/inconsolata.otf")).unwrap();