Fix render issues on macOS (#845)

Parts of neighboring glyphs in the atlas were being rendered
incorrectly. The issue is resolved by aligning cells to the pixel grid.

This behavior was achieved previously by first applying integer
truncation before casting to a float.

Fixes #844.
This commit is contained in:
Joe Wilm 2017-10-17 10:15:24 -07:00 committed by GitHub
parent d3151dfbf9
commit 5ac42bb13b
1 changed files with 2 additions and 2 deletions

View File

@ -247,8 +247,8 @@ impl Display {
});
let metrics = cache.font_metrics();
self.size_info.cell_width = (metrics.average_advance + config.font().offset().x as f64) as f32;
self.size_info.cell_height = (metrics.line_height + config.font().offset().y as f64) as f32;
self.size_info.cell_width = ((metrics.average_advance + config.font().offset().x as f64) as f32).floor();
self.size_info.cell_height = ((metrics.line_height + config.font().offset().y as f64) as f32).floor();
}
#[inline]