diff --git a/crates/epaint/src/text/font.rs b/crates/epaint/src/text/font.rs index 0210f902f..68cbe8412 100644 --- a/crates/epaint/src/text/font.rs +++ b/crates/epaint/src/text/font.rs @@ -231,10 +231,8 @@ impl FontImpl { /// `\n` will result in `None` pub(super) fn glyph_info(&mut self, c: char) -> Option { - { - if let Some(glyph_info) = self.glyph_info_cache.get(&c) { - return Some(*glyph_info); - } + if let Some(glyph_info) = self.glyph_info_cache.get(&c) { + return Some(*glyph_info); } if self.ignore_character(c) { diff --git a/crates/epaint/src/text/text_layout.rs b/crates/epaint/src/text/text_layout.rs index 193e74b49..e65f10701 100644 --- a/crates/epaint/src/text/text_layout.rs +++ b/crates/epaint/src/text/text_layout.rs @@ -209,15 +209,16 @@ fn layout_section( paragraph.cursor_x_px += extra_letter_spacing * pixels_per_point; } - let (glyph_alloc, physical_x) = match font_impl.as_mut() { - Some(font_impl) => font_impl.allocate_glyph( + let (glyph_alloc, physical_x) = if let Some(font_impl) = font_impl.as_mut() { + font_impl.allocate_glyph( font.atlas, ¤t_font_impl_metrics, glyph_info, chr, paragraph.cursor_x_px, - ), - None => Default::default(), + ) + } else { + Default::default() }; paragraph.glyphs.push(Glyph {