winit-ui 0.2.0

A UI crate built around winit and pixels
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
pub struct Font {
    font: fontdue::Font,
}

impl Font {
    pub fn new(path: &str) -> Self {
        let font_data = std::fs::read(path).unwrap();
        let font = fontdue::Font::from_bytes(font_data, fontdue::FontSettings::default()).unwrap();
        Self { font }
    }

    pub fn rasterize(&self, char: char, size: f32) -> (fontdue::Metrics, Vec<u8>) {
        self.font.rasterize(char, size)
    }
}