From 946f152d4fb622fdc9b5deca11b7fc6b6a024f5a Mon Sep 17 00:00:00 2001 From: Dmitry Stepanov Date: Sat, 26 Sep 2026 11:57:53 +0300 Subject: [PATCH] fixed incorrect line height calculation for inline text elements --- fyrox-ui/src/formatted_text.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fyrox-ui/src/formatted_text.rs b/fyrox-ui/src/formatted_text.rs index 2586b41ef..3e8d5fe49 100644 --- a/fyrox-ui/src/formatted_text.rs +++ b/fyrox-ui/src/formatted_text.rs @@ -987,23 +987,27 @@ impl FormattedText { // Calculate line height for line in lines.iter_mut() { + for (pos, size) in inline_bounds.iter() { + if (line.begin..line.end).contains(pos) { + line.height = size.y; + } + } + if self.mask_char.is_some() || self.runs.is_empty() { - line.height = GlyphMetrics { + let ascender = GlyphMetrics { font: &mut self.get_font().data_ref(), size: **self.font_size, } .ascender(); + line.height = line.height.max(ascender); } else { for i in line.begin..line.end { - let h = GlyphMetrics { + let ascender = GlyphMetrics { font: &mut self.font_at(i).data_ref(), size: self.font_size_at(i), } .ascender(); - line.height = line.height.max(h); - if let Some(inline) = inline_bounds.get(&i) { - line.height = line.height.max(inline.y); - } + line.height = line.height.max(ascender); } } self.total_height += line.height + self.line_space();