diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-12-31 17:01:06 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-31 17:01:06 +0000 |
commit | 7275ecc282d29d1c67f700c01a399582ba052853 (patch) | |
tree | 836ccd5bc47c7f40cd22816f6a5b3376dd371661 /src | |
parent | 9ffaac8ee7c5586f0faa62401b9de76cff81130f (diff) | |
download | alacritty-7275ecc282d29d1c67f700c01a399582ba052853.tar.gz alacritty-7275ecc282d29d1c67f700c01a399582ba052853.zip |
Fix line metrics
Since bitmap fonts do not provide their own underline metrics, the
self-calculated metrics which have been used for rusttype are now also
used for bitmap fonts with freetype.
The rusttype and bitmap fallback metrics have incorrectly offset the
underline by the underline height. Since the position is already defined
as the center point, that is not necessary.
All rounding and clamping has also been removed from the font library,
so that the raw values are reported now. The clamping and rounding is
now done in the line renderer.
Diffstat (limited to 'src')
-rw-r--r-- | src/renderer/lines.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/renderer/lines.rs b/src/renderer/lines.rs index 99d1f28f..3c250caf 100644 --- a/src/renderer/lines.rs +++ b/src/renderer/lines.rs @@ -122,12 +122,15 @@ fn create_rect( let end_x = (end.column.0 + 1) as f32 * size.cell_width; let width = end_x - start_x; - let (position, height) = match flag { + let (position, mut height) = match flag { Flags::UNDERLINE => (metrics.underline_position, metrics.underline_thickness), Flags::STRIKEOUT => (metrics.strikeout_position, metrics.strikeout_thickness), _ => unimplemented!("Invalid flag for cell line drawing specified"), }; + // Make sure lines are always visible + height = height.max(1.); + let cell_bottom = (start.line.0 as f32 + 1.) * size.cell_height; let baseline = cell_bottom + metrics.descent; @@ -139,9 +142,9 @@ fn create_rect( let rect = Rect::new( start_x + size.padding_x, - y + size.padding_y, + y.round() + size.padding_y, width, - height, + height.round(), ); (rect, start.fg) |