From 1398ff5678f7fac60cd9a3596b76cafc08ba300d Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Thu, 19 Sep 2024 08:36:18 +0200 Subject: [PATCH] Use ascent of the first font instead --- crates/epaint/src/text/font.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/epaint/src/text/font.rs b/crates/epaint/src/text/font.rs index 3b601847b..d717c3e73 100644 --- a/crates/epaint/src/text/font.rs +++ b/crates/epaint/src/text/font.rs @@ -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 } }