Vertically center glyphs in Line::paint based on ascender/descender for line

This commit is contained in:
Nathan Sobo
2021-04-06 09:15:21 -06:00
parent fc4135d55b
commit 2a9e71d725
5 changed files with 18 additions and 14 deletions
+2 -2
View File
@@ -132,8 +132,8 @@ impl FontCache {
}
pub fn line_height(&self, font_id: FontId, font_size: f32) -> f32 {
let bounding_box = self.metric(font_id, |m| m.bounding_box);
self.scale_metric(bounding_box.height(), font_id, font_size)
let height = self.metric(font_id, |m| m.bounding_box.height());
self.scale_metric(height, font_id, font_size)
}
pub fn cap_height(&self, font_id: FontId, font_size: f32) -> f32 {