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:
@@ -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
|
||||||
|
|||||||
@@ -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,
|
||||||
¤t_font_impl_metrics,
|
¤t_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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user