(&mut self, font_idx: usize, text: &str, size: u32, spacing: f32)
| 218 | } |
| 219 | |
| 220 | pub fn measure_text_ex(&mut self, font_idx: usize, text: &str, size: u32, spacing: f32) -> f64 { |
| 221 | let idx = if font_idx < self.fonts.len() { font_idx } else { 0 }; |
| 222 | let mut width = 0.0f32; |
| 223 | let mut first = true; |
| 224 | for ch in text.chars() { |
| 225 | if !first && spacing != 0.0 { |
| 226 | width += spacing; |
| 227 | } |
| 228 | first = false; |
| 229 | let glyph = self.rasterize_glyph(idx, ch, size); |
| 230 | width += glyph.advance; |
| 231 | } |
| 232 | width as f64 |
| 233 | } |
| 234 | |
| 235 | pub fn draw_text( |
| 236 | &mut self, |
no test coverage detected