Merge pull request #15397 from Snuffleupagus/getEexecBlock-empty
Fallback to a standard font when a Type1 font program is empty (issue 15292)
This commit is contained in:
commit
b4b9ce83ed
@ -24,11 +24,11 @@ import {
|
|||||||
CFFStrings,
|
CFFStrings,
|
||||||
CFFTopDict,
|
CFFTopDict,
|
||||||
} from "./cff_parser.js";
|
} from "./cff_parser.js";
|
||||||
|
import { FormatError, warn } from "../shared/util.js";
|
||||||
import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js";
|
import { SEAC_ANALYSIS_ENABLED, type1FontGlyphMapping } from "./fonts_utils.js";
|
||||||
import { isWhiteSpace } from "./core_utils.js";
|
import { isWhiteSpace } from "./core_utils.js";
|
||||||
import { Stream } from "./stream.js";
|
import { Stream } from "./stream.js";
|
||||||
import { Type1Parser } from "./type1_parser.js";
|
import { Type1Parser } from "./type1_parser.js";
|
||||||
import { warn } from "../shared/util.js";
|
|
||||||
|
|
||||||
function findBlock(streamBytes, signature, startIndex) {
|
function findBlock(streamBytes, signature, startIndex) {
|
||||||
const streamBytesLength = streamBytes.length;
|
const streamBytesLength = streamBytes.length;
|
||||||
@ -140,6 +140,9 @@ function getEexecBlock(stream, suggestedLength) {
|
|||||||
// in the returned eexec block. In practice this does *not* seem to matter,
|
// in the returned eexec block. In practice this does *not* seem to matter,
|
||||||
// since `Type1Parser_extractFontProgram` will skip over any non-commands.
|
// since `Type1Parser_extractFontProgram` will skip over any non-commands.
|
||||||
const eexecBytes = stream.getBytes();
|
const eexecBytes = stream.getBytes();
|
||||||
|
if (eexecBytes.length === 0) {
|
||||||
|
throw new FormatError("getEexecBlock - no font program found.");
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
stream: new Stream(eexecBytes),
|
stream: new Stream(eexecBytes),
|
||||||
length: eexecBytes.length,
|
length: eexecBytes.length,
|
||||||
|
1
test/pdfs/issue15292.pdf.link
Normal file
1
test/pdfs/issue15292.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
https://github.com/mozilla/pdf.js/files/9288663/issue15292.pdf
|
@ -153,6 +153,14 @@
|
|||||||
"lastPage": 1,
|
"lastPage": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue15292",
|
||||||
|
"file": "pdfs/issue15292.pdf",
|
||||||
|
"md5": "24297e183bf16cdd684dac8902e9fbe6",
|
||||||
|
"rounds": 1,
|
||||||
|
"link": true,
|
||||||
|
"lastPage": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "issue11549",
|
{ "id": "issue11549",
|
||||||
"file": "pdfs/issue11549_reduced.pdf",
|
"file": "pdfs/issue11549_reduced.pdf",
|
||||||
"md5": "a1ea636f413e02e10dbdf379ab4a99ae",
|
"md5": "a1ea636f413e02e10dbdf379ab4a99ae",
|
||||||
|
Loading…
Reference in New Issue
Block a user