/// Return the size in pixels for the specified text, face and size.
Return the size in pixels for the specified text, face and size.
Return the size in pixels for the specified text face and size .
pub fn measure_text_width(face: &FontFace, font_size: f32, text: &str) -> f32 {
    text.chars()
        .filter_map(|c| {
            let glyph_index = face.face.glyph_index(c);
            glyph_index.and_then(|glyph_index| {
                let hor_advance = face
                    .face
                    .glyph_hor_advance(glyph_index)
                    .and_then(|hor_advance| pixel_size(face, font_size, hor_advance as i16))
                    .expect("hor_advance");
                Some(hor_advance)
            })
        })
        .sum()
}
pub fn measure_text_width ( face : & FontFace , font_size : f32 , text : & str ) -> f32 { text . chars ( ) . filter_map ( | c | { let glyph_index = face . face . glyph_index ( c ) ; glyph_index . and_then ( | glyph_index | { let hor_advance = face . face . glyph_hor_advance ( glyph_index ) . and_then ( | hor_advance | pixel_size ( face , font_size , hor_advance as i16 ) ) . expect ( " " ) ; Some ( hor_advance ) } ) } ) . sum ( ) }
Return the size in pixels for the specified text, face and size.
Return the size in pixels for the specified text face and size .
face
&FontFace
font_size
f32
text
&str