pub struct Config { /* private fields */ }Expand description
Raster configuration
Implementations§
source§impl Config
impl Config
sourcepub fn new(
mode: u8,
scale_steps: u8,
subpixel_threshold: u8,
subpixel_steps: u8
) -> Self
pub fn new(
mode: u8,
scale_steps: u8,
subpixel_threshold: u8,
subpixel_steps: u8
) -> Self
Construct configuration
For large glyphs the effects of configuration will be mostly unnoticeable but for small glyphs effects are more significant. The defaults will usually be a good choice. Results may depend on the font used.
The mode parameter selects rendering mode (though depending on crate
features, not all options will be available):
mode == 0(default): useab_glyphfor rasteringmode == 1: useab_glyphand align glyphs to side bearingsmode == 2: usefontduefor rastering
Fonts sizes, in pixels per Em, are rounded to a multiple of 1 / scale_steps.
The default is scale_steps == 4.
For font sizes (in pixels per Em) less than subpixel_threshold, sub-pixel positioning is
enabled with subpixel_steps (supporting between 1 and 16 steps). Sub-pixel positioning
allows better glyph spacing for small fonts potentially at the cost of minor blurring
(though blurring may be present in any case), and makes words drawn with very small font
sizes more faithfully represent scaled versions drawn with larger fonts.
Subjectively, readability and apparent quality is better up to around dpem=18 (~13.5pt),
thus we recommend subpixel_threshold == 18 and subpixel_steps == 5.