MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / measure_text_ex

Method measure_text_ex

native/shared/src/text_renderer.rs:220–233  ·  view source on GitHub ↗
(&mut self, font_idx: usize, text: &str, size: u32, spacing: f32)

Source from the content-addressed store, hash-verified

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,

Callers 8

bloom_measure_text_exFunction · 0.80
bloom_measure_text_exFunction · 0.80
bloom_measure_text_exFunction · 0.80
bloom_measure_text_exFunction · 0.80
measure_textMethod · 0.80
bloom_measure_text_exFunction · 0.80
bloom_measure_text_exFunction · 0.80

Calls 1

rasterize_glyphMethod · 0.80

Tested by

no test coverage detected