Merge pull request #18942 from Snuffleupagus/issue-18941
Fallback to a standard font if a font-file entry doesn't contain a Stream (issue 18941)
This commit is contained in:
commit
49c3dc9c5f
@ -63,7 +63,6 @@ import {
|
|||||||
LocalTilingPatternCache,
|
LocalTilingPatternCache,
|
||||||
RegionalImageCache,
|
RegionalImageCache,
|
||||||
} from "./image_utils.js";
|
} from "./image_utils.js";
|
||||||
import { NullStream, Stream } from "./stream.js";
|
|
||||||
import { BaseStream } from "./base_stream.js";
|
import { BaseStream } from "./base_stream.js";
|
||||||
import { bidi } from "./bidi.js";
|
import { bidi } from "./bidi.js";
|
||||||
import { ColorSpace } from "./colorspace.js";
|
import { ColorSpace } from "./colorspace.js";
|
||||||
@ -77,6 +76,7 @@ import { ImageResizer } from "./image_resizer.js";
|
|||||||
import { MurmurHash3_64 } from "../shared/murmurhash3.js";
|
import { MurmurHash3_64 } from "../shared/murmurhash3.js";
|
||||||
import { OperatorList } from "./operator_list.js";
|
import { OperatorList } from "./operator_list.js";
|
||||||
import { PDFImage } from "./image.js";
|
import { PDFImage } from "./image.js";
|
||||||
|
import { Stream } from "./stream.js";
|
||||||
|
|
||||||
const DefaultPartialEvaluatorOptions = Object.freeze({
|
const DefaultPartialEvaluatorOptions = Object.freeze({
|
||||||
maxImageSize: -1,
|
maxImageSize: -1,
|
||||||
@ -4425,12 +4425,20 @@ class PartialEvaluator {
|
|||||||
let fontFile, subtype, length1, length2, length3;
|
let fontFile, subtype, length1, length2, length3;
|
||||||
try {
|
try {
|
||||||
fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
|
fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
|
||||||
|
|
||||||
|
if (fontFile) {
|
||||||
|
if (!(fontFile instanceof BaseStream)) {
|
||||||
|
throw new FormatError("FontFile should be a stream");
|
||||||
|
} else if (fontFile.isEmpty) {
|
||||||
|
throw new FormatError("FontFile is empty");
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
if (!this.options.ignoreErrors) {
|
if (!this.options.ignoreErrors) {
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
|
warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
|
||||||
fontFile = new NullStream();
|
fontFile = null;
|
||||||
}
|
}
|
||||||
let isInternalFont = false;
|
let isInternalFont = false;
|
||||||
let glyphScaleFactors = null;
|
let glyphScaleFactors = null;
|
||||||
|
|||||||
1
test/pdfs/issue18941.pdf.link
Normal file
1
test/pdfs/issue18941.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/user-attachments/files/17473385/21_10_2024_FAMI.INVERSION.SAS_901060703_inicial.pdf
|
||||||
@ -2352,6 +2352,15 @@
|
|||||||
"lastPage": 3,
|
"lastPage": 3,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "issue18941",
|
||||||
|
"file": "pdfs/issue18941.pdf",
|
||||||
|
"md5": "6288e69c1dd240859c1d49c22a53a5c7",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "f1040",
|
"id": "f1040",
|
||||||
"file": "pdfs/f1040.pdf",
|
"file": "pdfs/f1040.pdf",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user