Add DISABLE_HINTING cache flag
This commit is contained in:
parent
b7eb658166
commit
4de1b13494
3 changed files with 16 additions and 4 deletions
|
|
@ -94,6 +94,7 @@ fn set_buffer_text(buffer: &mut BorrowedWithFontSystem<'_, Buffer>) {
|
||||||
.weight(Weight::BOLD)
|
.weight(Weight::BOLD)
|
||||||
.style(Style::Italic),
|
.style(Style::Italic),
|
||||||
),
|
),
|
||||||
|
("🌈", attrs.clone()),
|
||||||
("R", attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00))),
|
("R", attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00))),
|
||||||
("A", attrs.clone().color(Color::rgb(0xFF, 0x7F, 0x00))),
|
("A", attrs.clone().color(Color::rgb(0xFF, 0x7F, 0x00))),
|
||||||
("I", attrs.clone().color(Color::rgb(0xFF, 0xFF, 0x00))),
|
("I", attrs.clone().color(Color::rgb(0xFF, 0xFF, 0x00))),
|
||||||
|
|
@ -114,11 +115,20 @@ fn set_buffer_text(buffer: &mut BorrowedWithFontSystem<'_, Buffer>) {
|
||||||
("C", attrs.clone().color(Color::rgb(0x00, 0xFF, 0x00))),
|
("C", attrs.clone().color(Color::rgb(0x00, 0xFF, 0x00))),
|
||||||
("O", attrs.clone().color(Color::rgb(0xFF, 0xFF, 0x00))),
|
("O", attrs.clone().color(Color::rgb(0xFF, 0xFF, 0x00))),
|
||||||
("R", attrs.clone().color(Color::rgb(0xFF, 0x7F, 0x00))),
|
("R", attrs.clone().color(Color::rgb(0xFF, 0x7F, 0x00))),
|
||||||
("N\n", attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00))),
|
("N", attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00))),
|
||||||
|
("🦄\n", attrs.clone()),
|
||||||
(
|
(
|
||||||
"生活,삶,जिंदगी 😀 FPS\n",
|
"生活,삶,जिंदगी 😀\n",
|
||||||
attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00)),
|
attrs.clone().color(Color::rgb(0xFF, 0x00, 0x00)),
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
"Hinting enabled, ",
|
||||||
|
attrs.clone()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"Hinting disabled\n",
|
||||||
|
attrs.clone().cache_key_flags(CacheKeyFlags::DISABLE_HINTING),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
buffer.set_rich_text(
|
buffer.set_rich_text(
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ bitflags::bitflags! {
|
||||||
pub struct CacheKeyFlags: u32 {
|
pub struct CacheKeyFlags: u32 {
|
||||||
/// Skew by 14 degrees to synthesize italic
|
/// Skew by 14 degrees to synthesize italic
|
||||||
const FAKE_ITALIC = 1;
|
const FAKE_ITALIC = 1;
|
||||||
|
// Disable hinting
|
||||||
|
const DISABLE_HINTING = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ fn swash_image(
|
||||||
let mut scaler = context
|
let mut scaler = context
|
||||||
.builder(font.as_swash())
|
.builder(font.as_swash())
|
||||||
.size(f32::from_bits(cache_key.font_size_bits))
|
.size(f32::from_bits(cache_key.font_size_bits))
|
||||||
.hint(true)
|
.hint(!cache_key.flags.contains(CacheKeyFlags::DISABLE_HINTING))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Compute the fractional offset-- you'll likely want to quantize this
|
// Compute the fractional offset-- you'll likely want to quantize this
|
||||||
|
|
@ -80,7 +80,7 @@ fn swash_outline_commands(
|
||||||
let mut scaler = context
|
let mut scaler = context
|
||||||
.builder(font.as_swash())
|
.builder(font.as_swash())
|
||||||
.size(f32::from_bits(cache_key.font_size_bits))
|
.size(f32::from_bits(cache_key.font_size_bits))
|
||||||
.hint(true)
|
.hint(!cache_key.flags.contains(CacheKeyFlags::DISABLE_HINTING))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Scale the outline
|
// Scale the outline
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue