summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-02-03 03:22:28 +0300
committerKirill Chibisov <contact@kchibisov.com>2022-02-10 03:17:21 +0300
commit5c9fa470732b5742d6c14a89245007b6a8340f57 (patch)
tree0c04d6a117b07b3dde33b0f8a15c238d07168fd0
parentc313b5b2c78cb0ae0de68b3c702d90e4bc61be28 (diff)
downloadalacritty-5c9fa470732b5742d6c14a89245007b6a8340f57.tar.gz
alacritty-5c9fa470732b5742d6c14a89245007b6a8340f57.zip
Fix builtin font block elements going invisible
-rw-r--r--alacritty/src/renderer/builtin_font.rs15
1 files changed, 11 insertions, 4 deletions
diff --git a/alacritty/src/renderer/builtin_font.rs b/alacritty/src/renderer/builtin_font.rs
index f3dbe9bb..6074f80f 100644
--- a/alacritty/src/renderer/builtin_font.rs
+++ b/alacritty/src/renderer/builtin_font.rs
@@ -385,7 +385,7 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> Raster
'\u{2580}'..='\u{2587}' | '\u{2589}'..='\u{2590}' | '\u{2594}' | '\u{2595}' => {
let width = width as f32;
let height = height as f32;
- let rect_width = match character {
+ let mut rect_width = match character {
'\u{2589}' => width * 7. / 8.,
'\u{258a}' => width * 6. / 8.,
'\u{258b}' => width * 5. / 8.,
@@ -397,7 +397,8 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> Raster
'\u{2595}' => width * 1. / 8.,
_ => width,
};
- let (rect_height, y) = match character {
+
+ let (mut rect_height, mut y) = match character {
'\u{2580}' => (height * 4. / 8., height * 8. / 8.),
'\u{2581}' => (height * 1. / 8., height * 1. / 8.),
'\u{2582}' => (height * 2. / 8., height * 2. / 8.),
@@ -409,12 +410,18 @@ fn box_drawing(character: char, metrics: &Metrics, offset: &Delta<i8>) -> Raster
'\u{2594}' => (height * 1. / 8., height * 8. / 8.),
_ => (height, height),
};
+
// Fix `y` coordinates.
- let y = height - y;
+ y = height - y;
+
+ // Ensure that resulted glyph will be visible and also round sizes instead of straight
+ // flooring them.
+ rect_width = cmp::max(rect_width.round() as i32, 1) as f32;
+ rect_height = cmp::max(rect_height.round() as i32, 1) as f32;
let x = match character {
'\u{2590}' => canvas.x_center(),
- '\u{2595}' => width as f32 - width / 8.,
+ '\u{2595}' => width as f32 - rect_width,
_ => 0.,
};