Add DISABLE_HINTING cache flag

This commit is contained in:
Jeremy Soller 2025-07-02 10:58:08 -06:00
parent b7eb658166
commit 4de1b13494
No known key found for this signature in database
GPG key ID: 670FDFB5428E05CA
3 changed files with 16 additions and 4 deletions

View file

@ -7,6 +7,8 @@ bitflags::bitflags! {
pub struct CacheKeyFlags: u32 {
/// Skew by 14 degrees to synthesize italic
const FAKE_ITALIC = 1;
// Disable hinting
const DISABLE_HINTING = 2;
}
}

View file

@ -29,7 +29,7 @@ fn swash_image(
let mut scaler = context
.builder(font.as_swash())
.size(f32::from_bits(cache_key.font_size_bits))
.hint(true)
.hint(!cache_key.flags.contains(CacheKeyFlags::DISABLE_HINTING))
.build();
// Compute the fractional offset-- you'll likely want to quantize this
@ -80,7 +80,7 @@ fn swash_outline_commands(
let mut scaler = context
.builder(font.as_swash())
.size(f32::from_bits(cache_key.font_size_bits))
.hint(true)
.hint(!cache_key.flags.contains(CacheKeyFlags::DISABLE_HINTING))
.build();
// Scale the outline