winit_ui/lib.rs
1pub mod canvas;
2pub mod color;
3pub mod font;
4pub mod app;
5
6pub use app::App;
7pub use font::Font;
8pub use color::Color;
9
10pub fn get_text_width(text: &str, size: f32, font: &Font) -> u32 {
11 let mut width = 0;
12 for char in text.chars() {
13 let (metrics, _) = font.rasterize(char, size);
14 width += metrics.advance_width as u32;
15 }
16 width
17}