Avoid rendering artifacts when label text is shaped with a non-integer width

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2021-09-30 13:28:45 -07:00
parent 6fba17a5e1
commit e37ea6c6c8

View File

@ -135,7 +135,10 @@ impl Element for Label {
);
let size = vec2f(
line.width().max(constraint.min.x()).min(constraint.max.x()),
line.width()
.ceil()
.max(constraint.min.x())
.min(constraint.max.x()),
cx.font_cache
.line_height(self.style.text.font_id, self.style.text.font_size),
);