Replace magic boolean with new Hinting enum

This commit is contained in:
Héctor Ramón Jiménez 2025-11-23 20:43:33 +01:00 committed by Jeremy Soller
parent 48eda6bd7d
commit d779057d9c
16 changed files with 96 additions and 50 deletions

View file

@ -151,3 +151,28 @@ impl Display for Align {
}
}
}
/// Metrics hinting strategy
#[derive(Debug, Eq, PartialEq, Clone, Copy, Default)]
pub enum Hinting {
/// No metrics hinting.
///
/// Glyphs will have subpixel coordinates.
///
/// This is the default.
#[default]
Disabled,
/// Metrics hinting.
///
/// Glyphs will be snapped to integral coordinates in the X-axis during layout.
/// This can improve readability for smaller text and/or low-DPI screens.
///
/// However, in order to get the right effect, you must use physical coordinates
/// during layout and avoid further scaling when rendering. Otherwise, the rounding
/// errors can accumulate and glyph distances may look erratic.
///
/// In other words, metrics hinting makes layouting dependent of the target
/// resolution.
Enabled,
}