1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Handle having no fonts (missing "default_fonts" feature) without a crash

This commit is contained in:
Emil Ernerfeldt
2021-10-20 15:40:06 +02:00
parent 19a2a57f80
commit 087c6695bb
2 changed files with 10 additions and 5 deletions

View File

@@ -72,8 +72,10 @@ fn layout_section(
paragraph.empty_paragraph_height = font_height; // TODO: replace this hack with actually including `\n` in the glyphs?
} else {
let (font_impl, glyph_info) = font.glyph_info_and_font_impl(chr);
if let Some(last_glyph_id) = last_glyph_id {
paragraph.cursor_x += font_impl.pair_kerning(last_glyph_id, glyph_info.id)
if let Some(font_impl) = font_impl {
if let Some(last_glyph_id) = last_glyph_id {
paragraph.cursor_x += font_impl.pair_kerning(last_glyph_id, glyph_info.id)
}
}
paragraph.glyphs.push(Glyph {