mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Ignore invalid /CIDToGIDMap-entries when parsing fonts (issue 15139)
In the referenced PDF document the fonts have /CIDToGIDMap-entries that cannot be loaded. Hence, only when `ignoreErrors` is set, we'll now ignore these corrupt /CIDToGIDMap-entries and fallback to simply assume that no such data is available. Given that this is *clearly* a case of a corrupt PDF document, there's no guarantee that this will "fix" things in the general case since a /CIDToGIDMap may be *required* in order for some composite fonts to render correctly. However, attempting to render *something* is surely better than skipping a font altogether.
This commit is contained in:
parent
7a4b72ed11
commit
60bd9580e2
3 changed files with 19 additions and 3 deletions
|
@ -3373,9 +3373,16 @@ class PartialEvaluator {
|
|||
};
|
||||
}
|
||||
|
||||
const cidToGidMap = dict.get("CIDToGIDMap");
|
||||
if (cidToGidMap instanceof BaseStream) {
|
||||
cidToGidBytes = cidToGidMap.getBytes();
|
||||
try {
|
||||
const cidToGidMap = dict.get("CIDToGIDMap");
|
||||
if (cidToGidMap instanceof BaseStream) {
|
||||
cidToGidBytes = cidToGidMap.getBytes();
|
||||
}
|
||||
} catch (ex) {
|
||||
if (!this.options.ignoreErrors) {
|
||||
throw ex;
|
||||
}
|
||||
warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue