mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-04 17:21:09 +02:00
Merge pull request #21315 from calixteman/issue18548
Keep the first /Subrs and /CharStrings block
This commit is contained in:
commit
143a7244a3
@ -566,6 +566,13 @@ class Type1Parser {
|
||||
},
|
||||
};
|
||||
let token, length, data, lenIV;
|
||||
// Some fonts (e.g. those embedded in issue18548.pdf) define a second
|
||||
// `/Subrs` and `/CharStrings` block that the PostScript runtime selects
|
||||
// conditionally (e.g. high-resolution variants). Testing with other
|
||||
// viewers shows that none of them actually use these conditional blocks,
|
||||
// so we can "safely" ignore them.
|
||||
let subrsParsed = false;
|
||||
let charStringsParsed = false;
|
||||
while ((token = this.getToken()) !== null) {
|
||||
if (token !== "/") {
|
||||
continue;
|
||||
@ -573,6 +580,10 @@ class Type1Parser {
|
||||
token = this.getToken();
|
||||
switch (token) {
|
||||
case "CharStrings":
|
||||
if (charStringsParsed) {
|
||||
break;
|
||||
}
|
||||
charStringsParsed = true;
|
||||
// The number immediately following CharStrings must be greater or
|
||||
// equal to the number of CharStrings.
|
||||
this.getToken();
|
||||
@ -610,6 +621,10 @@ class Type1Parser {
|
||||
}
|
||||
break;
|
||||
case "Subrs":
|
||||
if (subrsParsed) {
|
||||
break;
|
||||
}
|
||||
subrsParsed = true;
|
||||
this.readInt(); // num
|
||||
this.getToken(); // read in 'array'
|
||||
while (this.getToken() === "dup") {
|
||||
|
||||
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -922,3 +922,4 @@
|
||||
!knockout_groups_test.pdf
|
||||
!issue18032.pdf
|
||||
!Embedded_font.pdf
|
||||
!issue18548_reduced.pdf
|
||||
|
||||
BIN
test/pdfs/issue18548_reduced.pdf
Normal file
BIN
test/pdfs/issue18548_reduced.pdf
Normal file
Binary file not shown.
@ -14303,5 +14303,12 @@
|
||||
"md5": "b68dd5a3e6833d1af94e295fe1d60285",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
},
|
||||
{
|
||||
"id": "issue18548_reduced",
|
||||
"file": "pdfs/issue18548_reduced.pdf",
|
||||
"md5": "39d15f7f810bd89a4e5858df9c75ca4e",
|
||||
"rounds": 1,
|
||||
"type": "eq"
|
||||
}
|
||||
]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user