diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp index 6b47f85997..869f2b5fd7 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/OpenType/Font.cpp @@ -671,11 +671,9 @@ Gfx::ScaledGlyphMetrics Font::glyph_metrics(u32 glyph_id, float x_scale, float y auto horizontal_metrics = m_hmtx.get_glyph_horizontal_metrics(glyph_id); auto glyph_offset = m_loca->get_glyph_offset(glyph_id); auto glyph = m_glyf->glyph(glyph_offset); - if (!glyph.has_value()) - return {}; return Gfx::ScaledGlyphMetrics { - .ascender = static_cast(glyph->ascender()) * y_scale, - .descender = static_cast(glyph->descender()) * y_scale, + .ascender = glyph.has_value() ? static_cast(glyph->ascender()) * y_scale : 0, + .descender = glyph.has_value() ? static_cast(glyph->descender()) * y_scale : 0, .advance_width = static_cast(horizontal_metrics.advance_width) * x_scale, .left_side_bearing = static_cast(horizontal_metrics.left_side_bearing) * x_scale, };