mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 16:48:08 +02:00
Fallback to a standard font if a font-file entry doesn't contain a Stream (issue 18941)
The PDF document is clearly corrupt, since it has /FontFile2 entries that are Dictionaries which obviously isn't correct. While there's obviously no guarantee that things will look perfect this way, actually rendering the text at all should be an improvement in general.
This commit is contained in:
parent
d37e4b08e4
commit
63b34114b1
3 changed files with 20 additions and 0 deletions
|
@ -4436,6 +4436,16 @@ class PartialEvaluator {
|
|||
let glyphScaleFactors = null;
|
||||
let systemFontInfo = null;
|
||||
if (fontFile) {
|
||||
if (!(fontFile instanceof BaseStream)) {
|
||||
const msg = `Font file should be a Stream in "${fontName.name}".`;
|
||||
|
||||
if (!this.options.ignoreErrors) {
|
||||
throw new FormatError(msg);
|
||||
}
|
||||
warn(msg);
|
||||
fontFile = new NullStream();
|
||||
}
|
||||
|
||||
if (fontFile.dict) {
|
||||
const subtypeEntry = fontFile.dict.get("Subtype");
|
||||
if (subtypeEntry instanceof Name) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue