mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
LibGfx/OpenType: Undo minor deletion in #23225
Check if we have a cmap before dereferencing it again. Fixes a crash on page 8 of 0000188.pdf now that the font no longer fails to load to due to a missing name table. Looks like this is a Type2 truetype font, where we don't provide an external cmap. How this font is supposed to work without a cmap I don't know -- but for now, we no longer crash on it, and draw some of the text with the previous font (which happens to work fine in this particular case).
This commit is contained in:
parent
08381b20e0
commit
e8133c8297
1 changed files with 2 additions and 0 deletions
|
@ -278,6 +278,8 @@ ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_offset(ReadonlyBytes buffer, u3
|
|||
hmtx = TRY(Hmtx::from_slice(opt_hmtx_slice.value(), maxp.num_glyphs(), hhea.number_of_h_metrics()));
|
||||
}
|
||||
|
||||
if (!options.external_cmap && !opt_cmap_slice.has_value())
|
||||
return Error::from_string_literal("Font is missing Cmap");
|
||||
NonnullOwnPtr<CharCodeToGlyphIndex> cmap = options.external_cmap ? options.external_cmap.release_nonnull() : TRY(CmapCharCodeToGlyphIndex::from_slice(opt_cmap_slice.value()));
|
||||
|
||||
Optional<Loca> loca;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue