fix: round subpixel coordinates for glyph background rectangles
`cosmic-term` currently has an issue where borders appear to separate some cells columnwise. This was caused due to the accumulation of floating point error when using font sizes that can't be fully represented in an f32. For example, a font size of 8.4x20 and a unique color per cell is enough to reproduce this. Essentially, the glyph background rectangles are being drawn slightly too narrow, causing the terminal background to leak through. This patch rounds the rectangles in such a way that we guarantee the drawing of that "border" pixel using floor() and ceil().
This commit is contained in:
parent
6bf0c65ca9
commit
7daf10e3b5
1 changed files with 6 additions and 2 deletions
|
|
@ -557,7 +557,7 @@ where
|
||||||
macro_rules! mk_pos_offset {
|
macro_rules! mk_pos_offset {
|
||||||
($x_offset:expr, $bottom_offset:expr) => {
|
($x_offset:expr, $bottom_offset:expr) => {
|
||||||
Vector::new(
|
Vector::new(
|
||||||
self.start_x + $x_offset,
|
(self.start_x + $x_offset).floor(),
|
||||||
self.line_top + self.line_height - $bottom_offset,
|
self.line_top + self.line_height - $bottom_offset,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
@ -574,7 +574,11 @@ where
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($pos_offset:expr, $style_line_height:expr) => {
|
($pos_offset:expr, $style_line_height:expr) => {
|
||||||
mk_quad!($pos_offset, $style_line_height, self.end_x - self.start_x)
|
mk_quad!(
|
||||||
|
$pos_offset,
|
||||||
|
$style_line_height,
|
||||||
|
(self.end_x - self.start_x).ceil()
|
||||||
|
)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue