1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:17:44 +00:00

LibPDF+LibGfx: Do not try to read "hmtx" table for PDFs

It is sometimes truncated in fonts embedded in PDFs, and the data
is not needed to render PDFs. 26 of my 1000 test files complained
"Could not load Hmtx: Not enough data" before.

Increases number of PDFs that render without diagnostics from
743 to 764.
This commit is contained in:
Nico Weber 2024-02-20 11:42:59 -05:00 committed by Andreas Kling
parent 5efe80af7f
commit 0dee94ef40
3 changed files with 14 additions and 8 deletions

View file

@ -19,7 +19,7 @@ class Renderer;
// PDF files don't need most of the data in OpenType fonts, and even contain invalid data for
// these tables in some cases. Skip reading these tables.
constexpr u32 pdf_skipped_opentype_tables = OpenType::FontOptions::SkipTables::Name;
constexpr u32 pdf_skipped_opentype_tables = OpenType::FontOptions::SkipTables::Name | OpenType::FontOptions::SkipTables::Hmtx;
class PDFFont : public RefCounted<PDFFont> {
public: