summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNelson Benítez León <nbenitezl@gmail.com>2024-04-06 21:52:05 +0100
committerNelson Benítez León <nbenitezl@gmail.com>2024-04-06 22:02:51 +0100
commita741a6ef9062ba3733f0cab7a6b1d55bec2b53df (patch)
tree80780d1b080473ea861b509f4b10705b571ccf60
parentbc3f42f45a15848aba686e7b493747c1a62b7c41 (diff)
Assume "Adobe-Identity" for character collection
When 'CIDSystemInfo' dictionary is absent or has invalid content, instead of aborting the font because we cannot read the character collection, let's assume in that case character collection to be "Adobe-Identity". Fixes #1465 - Does not show text of Apple-edited PDFs
-rw-r--r--poppler/GfxFont.cc22
1 files changed, 13 insertions, 9 deletions
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index 156d4fb6..811a4878 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -1770,17 +1770,21 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, std::optional<std:
// char collection
obj1 = desFontDict->lookup("CIDSystemInfo");
- if (!obj1.isDict()) {
+ if (obj1.isDict()) {
+ obj2 = obj1.dictLookup("Registry");
+ obj3 = obj1.dictLookup("Ordering");
+ if (!obj2.isString() || !obj3.isString()) {
+ error(errSyntaxError, -1, "Invalid CIDSystemInfo dictionary in Type 0 descendant font");
+ error(errSyntaxError, -1, "Assuming Adobe-Identity for character collection");
+ obj2 = Object(new GooString("Adobe"));
+ obj3 = Object(new GooString("Identity"));
+ }
+ collection = obj2.getString()->copy()->append('-')->append(obj3.getString());
+ } else {
error(errSyntaxError, -1, "Missing CIDSystemInfo dictionary in Type 0 descendant font");
- return;
- }
- obj2 = obj1.dictLookup("Registry");
- obj3 = obj1.dictLookup("Ordering");
- if (!obj2.isString() || !obj3.isString()) {
- error(errSyntaxError, -1, "Invalid CIDSystemInfo dictionary in Type 0 descendant font");
- return;
+ error(errSyntaxError, -1, "Assuming Adobe-Identity for character collection");
+ collection = new GooString("Adobe-Identity");
}
- collection = obj2.getString()->copy()->append('-')->append(obj3.getString());
// look for a ToUnicode CMap
if (!(ctu = readToUnicodeCMap(fontDict, 16, nullptr))) {