From ddbcd901d1fe451767da58bc6ce7098a17e6197c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 12 Feb 2024 19:40:49 -0500 Subject: [PATCH] LibPDF: Separate Type0 CMap errors No behavior change, just more granular "not implemented" diagnostics. --- Userland/Libraries/LibPDF/Fonts/Type0Font.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp index 674ac47e80..4a27d5c352 100644 --- a/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp +++ b/Userland/Libraries/LibPDF/Fonts/Type0Font.cpp @@ -142,8 +142,13 @@ PDFErrorOr Type0Font::initialize(Document* document, NonnullRefPtrget_object(document, CommonNames::Encoding)); - if (!cmap_value->is() || cmap_value->cast()->name() != CommonNames::IdentityH) - return Error::rendering_unsupported_error("Type0 font: support for general Encodings not yet implemented"); + if (!cmap_value->is()) + return Error::rendering_unsupported_error("Type0 font: support for general type 0 cmaps not yet implemented"); + + auto cmap_name = cmap_value->cast()->name(); + if (cmap_name != CommonNames::IdentityH) { + return Error::rendering_unsupported_error("Type0 font: unimplemented named type 0 cmap {}", cmap_name); + } auto descendant_font_value = TRY(dict->get_array(document, CommonNames::DescendantFonts)); auto descendant_font = TRY(descendant_font_value->get_dict_at(document, 0));