1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 07:03:14 -04:00

Use ascent of the first font instead

This commit is contained in:
Emil Ernerfeldt
2024-09-19 08:36:18 +02:00
parent f051f96b73
commit 1398ff5678

View File

@@ -469,14 +469,10 @@ impl Font {
}
pub(crate) fn ascent(&self) -> f32 {
if self.fonts.is_empty() {
self.row_height
if let Some(first) = self.fonts.first() {
first.ascent()
} else {
let mut max_ascent = 0.0;
for font in &self.fonts {
max_ascent = f32::max(max_ascent, font.ascent());
}
max_ascent
self.row_height
}
}