pub fn rasterize_indexed(&self, index: usize, px: f32) -> (Metrics, Vec<u8>) {
        let glyph = &self.glyphs[index];
        let scale = Font::scale_factor(px, self.units_per_em);
        let bounds = glyph.bounds.scale(scale);

        let mut offset_x = fract(bounds.xmin);
        if is_negative(offset_x) {
            offset_x += 1.0;
        }
        let height = scale * glyph.height;
        let mut offset_y = ceil(height) - height - fract(bounds.ymin);
        if is_negative(offset_y) {
            offset_y += 1.0;
        }

        let metrics = Metrics {
            width: as_i32(ceil(scale * glyph.width + offset_x)) as usize,
            height: as_i32(ceil(height + offset_y)) as usize,
            advance_width: scale * glyph.advance_width,
            advance_height: scale * glyph.advance_height,
            bounds,
        };
        let mut canvas = Raster::new(metrics.width, metrics.height);
        canvas.draw(&glyph.geometry, scale, offset_x, offset_y);
        (metrics, canvas.get_bitmap())
    }
/// Retrieves the layout metrics and rasterized bitmap at the given index. You normally want to
/// be using rasterize(char, f32) instead, unless your glyphs are pre-indexed.
/// # Arguments
///
/// * `index` - The glyph index in the font to rasterize.
/// * `px` - The size to render the character at. Cannot be negative.
/// # Returns
///
/// * `Metrics` - Sizing and positioning metadata for the rasterized glyph.
/// * `Vec<u8>` - Coverage vector for the glyph. Coverage is a linear scale where 0 represents
/// 0% coverage of that pixel by the glyph and 255 represents 100% coverage. The vec starts at
/// the top left corner of the glyph.
Retrieves the layout metrics and rasterized bitmap at the given index. You normally want to
be using rasterize(char, f32) instead, unless your glyphs are pre-indexed.
Retrieves the layout metrics and rasterized bitmap at the given index . You normally want to be using rasterize ( char f32 ) instead unless your glyphs are pre - indexed .
pub fn rasterize_indexed(&self, index: usize, px: f32) -> (Metrics, Vec<u8>) {
        let glyph = &self.glyphs[index];
        let scale = Font::scale_factor(px, self.units_per_em);
        let bounds = glyph.bounds.scale(scale);
        let mut offset_x = fract(bounds.xmin);
        if is_negative(offset_x) {
            offset_x += 1.0;
        }
        let height = scale * glyph.height;
        let mut offset_y = ceil(height) - height - fract(bounds.ymin);
        if is_negative(offset_y) {
            offset_y += 1.0;
        }
        let metrics = Metrics {
            width: as_i32(ceil(scale * glyph.width + offset_x)) as usize,
            height: as_i32(ceil(height + offset_y)) as usize,
            advance_width: scale * glyph.advance_width,
            advance_height: scale * glyph.advance_height,
            bounds,
        };
        let mut canvas = Raster::new(metrics.width, metrics.height);
        canvas.draw(&glyph.geometry, scale, offset_x, offset_y);
        (metrics, canvas.get_bitmap())
    }
pub fn rasterize_indexed ( & self , index : usize , px : f32 ) -> ( Metrics , Vec < u8 > ) { let glyph = & self . glyphs [ index ] ; let scale = Font :: scale_factor ( px , self . units_per_em ) ; let bounds = glyph . bounds . scale ( scale ) ; let mut offset_x = fract ( bounds . xmin ) ; if is_negative ( offset_x ) { offset_x += 1.0 ; } let height = scale * glyph . height ; let mut offset_y = ceil ( height ) - height - fract ( bounds . ymin ) ; if is_negative ( offset_y ) { offset_y += 1.0 ; } let metrics = Metrics { width : as_i32 ( ceil ( scale * glyph . width + offset_x ) ) as usize , height : as_i32 ( ceil ( height + offset_y ) ) as usize , advance_width : scale * glyph . advance_width , advance_height : scale * glyph . advance_height , bounds , } ; let mut canvas = Raster :: new ( metrics . width , metrics . height ) ; canvas . draw ( & glyph . geometry , scale , offset_x , offset_y ) ; ( metrics , canvas . get_bitmap ( ) ) }
Retrieves the layout metrics and rasterized bitmap at the given index.
Retrieves the layout metrics and rasterized bitmap at the given index .
&self
index
usize
px
f32
`Metrics` - Sizing and positioning metadata for the rasterized glyph.
`Vec` - Coverage vector for the glyph. Coverage is a linear scale where 0 represents
0% coverage of that pixel by the glyph and 255 represents 100% coverage. The vec starts at
the top left corner of the glyph.
` Metrics ` - Sizing and positioning metadata for the rasterized glyph . ` Vec ` - Coverage vector for the glyph . Coverage is a linear scale where 0 represents 0% coverage of that pixel by the glyph and 255 represents 100% coverage . The vec starts at the top left corner of the glyph .
&self
index
usize
px
f32