1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-02 06:40:06 -04:00

Small code cleanup

This commit is contained in:
Emil Ernerfeldt
2025-09-08 15:28:32 +02:00
parent 80c00dfb16
commit 5b3c80a2ff
2 changed files with 7 additions and 8 deletions

View File

@@ -231,11 +231,9 @@ impl FontImpl {
/// `\n` will result in `None` /// `\n` will result in `None`
pub(super) fn glyph_info(&mut self, c: char) -> Option<GlyphInfo> { pub(super) fn glyph_info(&mut self, c: char) -> Option<GlyphInfo> {
{
if let Some(glyph_info) = self.glyph_info_cache.get(&c) { if let Some(glyph_info) = self.glyph_info_cache.get(&c) {
return Some(*glyph_info); return Some(*glyph_info);
} }
}
if self.ignore_character(c) { if self.ignore_character(c) {
return None; // these will result in the replacement character when rendering return None; // these will result in the replacement character when rendering

View File

@@ -209,15 +209,16 @@ fn layout_section(
paragraph.cursor_x_px += extra_letter_spacing * pixels_per_point; paragraph.cursor_x_px += extra_letter_spacing * pixels_per_point;
} }
let (glyph_alloc, physical_x) = match font_impl.as_mut() { let (glyph_alloc, physical_x) = if let Some(font_impl) = font_impl.as_mut() {
Some(font_impl) => font_impl.allocate_glyph( font_impl.allocate_glyph(
font.atlas, font.atlas,
&current_font_impl_metrics, &current_font_impl_metrics,
glyph_info, glyph_info,
chr, chr,
paragraph.cursor_x_px, paragraph.cursor_x_px,
), )
None => Default::default(), } else {
Default::default()
}; };
paragraph.glyphs.push(Glyph { paragraph.glyphs.push(Glyph {