mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:37:35 +00:00
LibGfx: Don't require the OS/2 table for ttf files
This table seems to only exist for OpenType compatibility. There are some font files, including most embedded fonts in PDF documents, that don't include one. For those cases, we now just zero-initialize one to the largest supported size.
This commit is contained in:
parent
703b85b916
commit
8fd4e2ee40
2 changed files with 4 additions and 3 deletions
|
@ -489,9 +489,9 @@ ErrorOr<NonnullRefPtr<Font>> 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<size_t>(OS2::Offsets::End))));
|
||||
if (opt_os2_slice.has_value())
|
||||
os2 = OS2(opt_os2_slice.value());
|
||||
|
||||
Optional<Kern> kern {};
|
||||
if (opt_kern_slice.has_value())
|
||||
|
|
|
@ -140,6 +140,7 @@ public:
|
|||
TypographicAscender = 68,
|
||||
TypographicDescender = 70,
|
||||
TypographicLineGap = 72,
|
||||
End = 78,
|
||||
};
|
||||
|
||||
u16 weight_class() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue