diff options
author | cynecx <cynecx@users.noreply.github.com> | 2020-07-14 03:13:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-14 01:13:19 +0000 |
commit | 68209e88fd8c8b092785aaadfaea8ef7d4a4e2cf (patch) | |
tree | b4cdc832226bde8bc7680854d40865f38cb51f49 /font | |
parent | 5424b30d228816de4a40c610915789db254a0e34 (diff) | |
download | alacritty-68209e88fd8c8b092785aaadfaea8ef7d4a4e2cf.tar.gz alacritty-68209e88fd8c8b092785aaadfaea8ef7d4a4e2cf.zip |
Fix freetype 26.6 format conversion
This resolves a rounding issue when converting to the 26.6 format used
by freetype for character sizes.
This rounding behavior is taken from cairo:
https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src/cairo-ft-font.c#L900-903
There are various different implementations of the F26Dot6 conversion
online, but the rounding that cairo does seems to be the most common.
Since cairo is very commonly used, it should produce good results
compared with the rest of Linux text rendering.
Fixes #2780.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Diffstat (limited to 'font')
-rw-r--r-- | font/src/ft/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 07d5729b..dd15c4bb 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -86,7 +86,7 @@ pub struct FreeTypeRasterizer { #[inline] fn to_freetype_26_6(f: f32) -> isize { - ((1i32 << 6) as f32 * f) as isize + ((1i32 << 6) as f32 * f).round() as isize } #[inline] |