From dbcf6d23c77ec3256766e7756816037443eb9452 Mon Sep 17 00:00:00 2001 From: Tilman Hausherr Date: Wed, 27 Nov 2024 14:59:54 +0000 Subject: [PATCH] PDFBOX-5384: use workaround from PDF.js git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922164 13f79535-47bb-0310-9956-ffa450edef68 --- .../main/java/org/apache/pdfbox/pdmodel/font/PDFont.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java index 226a5e6e0fe..98364412078 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/PDFont.java @@ -144,7 +144,13 @@ private CMap loadUnicodeCmap() cmap = readCMap(toUnicode); if (cmap != null && !cmap.hasUnicodeMappings()) { - LOG.warn("Invalid ToUnicode CMap in font {}", getName()); + String name = getName(); + LOG.warn("Invalid ToUnicode CMap in font {}", name); + if (name != null && (name.startsWith("Tahoma") || name.startsWith("Verdana"))) + { + // PDFBOX-5384: workaround inspired by PDF.js 15719 and 11242 + return null; + } String cmapName = cmap.getName() != null ? cmap.getName() : ""; String ordering = cmap.getOrdering() != null ? cmap.getOrdering() : ""; COSName encoding = dict.getCOSName(COSName.ENCODING);