Skip to content

Commit

Permalink
Ceil the font height to the nearest pixel
Browse files Browse the repository at this point in the history
This improves the quality and the performance of the font rendering.
  • Loading branch information
fredizzimo committed Apr 28, 2024
1 parent c3b4a8b commit 5c87045
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/renderer/fonts/caching_shaper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ impl CachingShaper {

let bare_font_height = metrics.ascent + metrics.descent + metrics.leading;
// assuming that linespace is checked on receive for validity
let font_height = bare_font_height + self.linespace;
let font_height = (bare_font_height + self.linespace).ceil();
let font_width = glyph_advance + self.options.width;

(font_width, font_height).into()
Expand Down

0 comments on commit 5c87045

Please sign in to comment.