Add pixel font flag (#402)
This commit is contained in:
parent
a03faa654d
commit
85b07b4c8c
2 changed files with 10 additions and 1 deletions
|
|
@ -9,6 +9,8 @@ bitflags::bitflags! {
|
|||
const FAKE_ITALIC = 1;
|
||||
/// Disable hinting
|
||||
const DISABLE_HINTING = 2;
|
||||
/// Render as a pixel font
|
||||
const PIXEL_FONT = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,14 @@ fn swash_image(
|
|||
|
||||
// Compute the fractional offset-- you'll likely want to quantize this
|
||||
// in a real renderer
|
||||
let offset = Vector::new(cache_key.x_bin.as_float(), cache_key.y_bin.as_float());
|
||||
let offset = if cache_key.flags.contains(CacheKeyFlags::PIXEL_FONT) {
|
||||
Vector::new(
|
||||
cache_key.x_bin.as_float().round() + 1.0,
|
||||
cache_key.y_bin.as_float().round(),
|
||||
)
|
||||
} else {
|
||||
Vector::new(cache_key.x_bin.as_float(), cache_key.y_bin.as_float())
|
||||
};
|
||||
|
||||
// Select our source order
|
||||
Render::new(&[
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue