pub struct RasterPolicy {
pub symmetric_smoothing: bool,
pub grid_fit: bool,
}Expand description
The smoothing and grid fitting a font requests at a given size.
A rasterizer needs both properties. Self::symmetric_smoothing selects
antialiasing along both axes or only horizontally. Self::grid_fit
selects whether to hint at all. Windows reads the same two properties from
the same source, so honoring them makes text match Windows.
See https://learn.microsoft.com/en-us/typography/opentype/spec/gasp.
Fields§
§symmetric_smoothing: boolTrue if the rasterizer should smooth along both axes.
When false, the font expects antialiasing only in the horizontal direction. A rasterizer that smooths in both directions produces softer horizontal edges than the font expects.
This also sets the symmetric rendering bit of the GETINFO
instruction.
grid_fit: boolTrue if TrueType grid fitting should be applied.
Implementations§
Source§impl RasterPolicy
impl RasterPolicy
Sourcepub(crate) fn fallback(has_glyph_instructions: bool, ppem: u16) -> Self
pub(crate) fn fallback(has_glyph_instructions: bool, ppem: u16) -> Self
Returns the policy DirectWrite applies when no version 1 gasp range
covers the size.
This is asymmetric smoothing through 20 ppem for a font that has glyph instructions, and symmetric smoothing for everything else.
Sourcepub(crate) fn resolve<'a>(font: &impl TableProvider<'a>, ppem: u16) -> Self
pub(crate) fn resolve<'a>(font: &impl TableProvider<'a>, ppem: u16) -> Self
Resolves the policy for the given font at the given nominal ppem.
Trait Implementations§
Source§impl Clone for RasterPolicy
impl Clone for RasterPolicy
Source§fn clone(&self) -> RasterPolicy
fn clone(&self) -> RasterPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more