Rasterizing
let glyph = font.rasterize_glyph(gid, 32.0, &[]).expect("has ink");
glyph.metrics.width; // usize
glyph.metrics.height; // usize
glyph.metrics.xmin; // i32, left edge in device pixels
glyph.metrics.advance_width; // f32, already in pixels
glyph.bitmap; // Vec<u8>, one coverage byte per pixelNone means the glyph draws nothing. A space is an answer, not a failure.
Options
use daegun::{HintMode, RasterOptions};
let opts = RasterOptions::default().with_hinting(HintMode::Auto).with_gamma(1.8);
let glyph = font.rasterize_glyph_with(gid, 32.0, &[], &opts).expect("has ink");| Builder | Effect |
|---|---|
with_layout | Grayscale, RGB or BGR stripes, or your own filter weights. |
with_gamma | Coverage raised to 1/gamma at byte conversion. |
with_transform | An affine in font units, applied before rasterizing. |
with_hinting | None, Subpixel (v40), Classic (v35), Auto, AutoForce. |
with_stroke | Stroke the outline instead of filling it. |
with_embolden | Synthetic bold. Widens the advance too. |
with_oblique | Synthetic slant, as a tangent from vertical. |