/// Creates a new texture representing a font stored in a `FontTexture`.
/// This function is very expensive as it needs to rasterize font into a
/// texture.  Complexity grows as `font_size**2 * characters_list.len()`.
/// **Avoid rasterizing everything at once as it will be slow and end up in
/// out of memory abort.**
Creates a new texture representing a font stored in a `FontTexture`.
This function is very expensive as it needs to rasterize font into a
texture.
Creates a new texture representing a font stored in a ` FontTexture ` . This function is very expensive as it needs to rasterize font into a texture .
pub fn new<R, F, I>(facade: &F, font: R, font_size: u32, characters_list: I) -> Result<FontTexture, Error>
    where
        R: Read,
        F: Facade,
        I: IntoIterator<Item = char>,
    {
        // building the freetype face object
        let font: Vec<u8> = font.bytes().map(|c| c.unwrap()).collect();
        let collection = ::rusttype::FontCollection::from_bytes(&font[..])?;
        let font = collection.into_font().unwrap();
        // building the infos
        let (texture_data, chr_infos) = build_font_image(&font, characters_list.into_iter(), font_size)?;
        // we load the texture in the display
        let texture = glium::texture::Texture2d::new(facade, &texture_data).unwrap();
        Ok(FontTexture {
            texture,
            character_infos: chr_infos,
        })
    }
pub fn new < R , F , I > ( facade : & F , font : R , font_size : u32 , characters_list : I ) -> Result < FontTexture , Error > where R : Read , F : Facade , I : IntoIterator < Item = char > , { // building the freetype face object let font : Vec < u8 > = font . bytes ( ) . map ( | c | c . unwrap ( ) ) . collect ( ) ; let collection = :: rusttype :: FontCollection :: from_bytes ( & font [ .. ] ) ? ; let font = collection . into_font ( ) . unwrap ( ) ; // building the infos let ( texture_data , chr_infos ) = build_font_image ( & font , characters_list . into_iter ( ) , font_size ) ? ; // we load the texture in the display let texture = glium :: texture :: Texture2d :: new ( facade , & texture_data ) . unwrap ( ) ; Ok ( FontTexture { texture , character_infos : chr_infos , } ) }
Creates a new texture representing a font stored in a `FontTexture`.
Creates a new texture representing a font stored in a ` FontTexture ` .
facade
&F
font
R
font_size
u32
characters_list
I