From 26fd29baf81bb695d111a93a679d9d24e043ab1e Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 14 Nov 2023 08:03:09 -0500 Subject: [PATCH] LibPDF: Give Type3 fonts a dedicated error message They're described in "5.5.4 Type 3 Fonts" in the PDF 1.7 spec, so we shouldn't `internal_error()` on them. They're just not implemented yet. --- Userland/Libraries/LibPDF/Fonts/PDFFont.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp b/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp index 0d89baa3bc9..2b58638239b 100644 --- a/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp +++ b/Userland/Libraries/LibPDF/Fonts/PDFFont.cpp @@ -41,9 +41,11 @@ PDFErrorOr> PDFFont::create(Document* document, NonnullRe font = adopt_ref(*new Type1Font()); } else if (subtype == "TrueType") { font = adopt_ref(*new TrueTypeFont()); - } else if (subtype == "Type0") + } else if (subtype == "Type0") { font = adopt_ref(*new Type0Font()); - else { + } else if (subtype == "Type3") { + return Error { Error::Type::RenderingUnsupported, "Type3 fonts not yet implemented" }; + } else { dbgln_if(PDF_DEBUG, "Unhandled font subtype: {}", subtype); return Error::internal_error("Unhandled font subtype"); }