1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 06:10:06 -04:00

Support multiple fonts

This commit is contained in:
Emil Ernerfeldt
2019-01-13 00:55:56 +01:00
parent 1b8a45a514
commit ca9333ec3e
13 changed files with 140 additions and 70 deletions

View File

@@ -64,12 +64,8 @@ pub struct Font {
}
impl Font {
pub fn new(scale: usize, atlas: Arc<Mutex<TextureAtlas>>) -> Font {
// TODO: figure out a way to make the wasm smaller despite including a font.
// let font_data = include_bytes!("../fonts/ProggyClean.ttf"); // Use 13 for this. NOTHING ELSE.
// let font_data = include_bytes!("../fonts/DejaVuSans.ttf");
let font_data = include_bytes!("../fonts/Roboto-Regular.ttf");
let font = rusttype::Font::from_bytes(font_data as &[u8]).expect("Error constructing Font");
pub fn new(atlas: Arc<Mutex<TextureAtlas>>, font_data: &'static [u8], scale: usize) -> Font {
let font = rusttype::Font::from_bytes(font_data).expect("Error constructing Font");
// println!(
// "font.v_metrics: {:?}",