Struct kas_text::raster::Config

source ·
pub struct Config { /* private fields */ }
Expand description

Raster configuration

Implementations§

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): use ab_glyph for rastering
  • mode == 1: use ab_glyph and align glyphs to side bearings
  • mode == 2: use fontdue for 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.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Cast from Self to T Read more
Try converting from Self to T Read more
Try approximate conversion from Self to T Read more
Cast approximately from Self to T Read more
Cast to integer, truncating Read more
Cast to the nearest integer Read more
Cast the floor to an integer Read more
Cast the ceiling to an integer Read more
Try converting to integer with truncation Read more
Try converting to the nearest integer Read more
Try converting the floor to an integer Read more
Try convert the ceiling to an integer Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.