diff --git a/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp b/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp index 20004833ee..2606bd1afb 100644 --- a/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp +++ b/Userland/Libraries/LibGfx/Font/TrueType/Font.cpp @@ -489,9 +489,9 @@ ErrorOr> Font::try_load_from_offset(ReadonlyBytes buffer, u3 return Error::from_string_literal("Could not load Glyf"); auto glyf = Glyf(opt_glyf_slice.value()); - if (!opt_os2_slice.has_value()) - return Error::from_string_literal("Could not load OS/2"); - auto os2 = OS2(opt_os2_slice.value()); + OS2 os2(TRY(ByteBuffer::create_zeroed(static_cast(OS2::Offsets::End)))); + if (opt_os2_slice.has_value()) + os2 = OS2(opt_os2_slice.value()); Optional kern {}; if (opt_kern_slice.has_value()) diff --git a/Userland/Libraries/LibGfx/Font/TrueType/Tables.h b/Userland/Libraries/LibGfx/Font/TrueType/Tables.h index 73cbf998f9..a5c1886a72 100644 --- a/Userland/Libraries/LibGfx/Font/TrueType/Tables.h +++ b/Userland/Libraries/LibGfx/Font/TrueType/Tables.h @@ -140,6 +140,7 @@ public: TypographicAscender = 68, TypographicDescender = 70, TypographicLineGap = 72, + End = 78, }; u16 weight_class() const;