From e61c28e451526d396131b0a1e9598705d56b2714 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 22 Jan 2020 23:47:59 +0300 Subject: [PATCH] Fix underline position for bitmap fonts Fixes #3235. --- CHANGELOG.md | 1 + alacritty/src/renderer/rects.rs | 2 +- font/src/ft/mod.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a67a8303..2e9019f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Incorrect selection status of the first cell when selection is off screen - Backwards bracket selection - Stack overflow when printing shader creation error +- Underline position for bitmap fonts ### Removed diff --git a/alacritty/src/renderer/rects.rs b/alacritty/src/renderer/rects.rs index 5bc353ff..796abe6e 100644 --- a/alacritty/src/renderer/rects.rs +++ b/alacritty/src/renderer/rects.rs @@ -86,7 +86,7 @@ impl RenderLine { let line_bottom = (start.line.0 as f32 + 1.) * size.cell_height; let baseline = line_bottom + metrics.descent; - let mut y = baseline - position - height / 2.; + let mut y = (baseline - position - height / 2.).ceil(); let max_y = line_bottom - height; if y > max_y { y = max_y; diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs index 5c5c4a73..f91acd03 100644 --- a/font/src/ft/mod.rs +++ b/font/src/ft/mod.rs @@ -108,7 +108,7 @@ impl Rasterize for FreeTypeRasterizer { // Fallback for bitmap fonts which do not provide underline metrics if underline_position == 0. { - underline_thickness = (descent / 5.).round(); + underline_thickness = (descent.abs() / 5.).round(); underline_position = descent / 2.; }