mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-06 23:25:48 +02:00
Merge pull request #21544 from Snuffleupagus/extractFontProgram-lenIV
Lookup "lenIV" inline in the `Type1Parser.prototype.extractFontProgram` method
This commit is contained in:
commit
f03e18f336
@ -565,7 +565,7 @@ class Type1Parser {
|
|||||||
privateData,
|
privateData,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
let token, length, data, lenIV;
|
let token, length, data;
|
||||||
// Some fonts (e.g. those embedded in issue18548.pdf) define a second
|
// Some fonts (e.g. those embedded in issue18548.pdf) define a second
|
||||||
// `/Subrs` and `/CharStrings` block that the PostScript runtime selects
|
// `/Subrs` and `/CharStrings` block that the PostScript runtime selects
|
||||||
// conditionally (e.g. high-resolution variants). Testing with other
|
// conditionally (e.g. high-resolution variants). Testing with other
|
||||||
@ -603,8 +603,10 @@ class Type1Parser {
|
|||||||
length = this.readInt();
|
length = this.readInt();
|
||||||
this.getToken(); // read in 'RD' or '-|'
|
this.getToken(); // read in 'RD' or '-|'
|
||||||
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
||||||
lenIV = privateData.get("lenIV");
|
const encoded = this.readCharStrings(
|
||||||
const encoded = this.readCharStrings(data, lenIV);
|
data,
|
||||||
|
privateData.get("lenIV")
|
||||||
|
);
|
||||||
this.nextChar();
|
this.nextChar();
|
||||||
token = this.getToken(); // read in 'ND' or '|-'
|
token = this.getToken(); // read in 'ND' or '|-'
|
||||||
if (token === "noaccess") {
|
if (token === "noaccess") {
|
||||||
@ -632,8 +634,10 @@ class Type1Parser {
|
|||||||
length = this.readInt();
|
length = this.readInt();
|
||||||
this.getToken(); // read in 'RD' or '-|'
|
this.getToken(); // read in 'RD' or '-|'
|
||||||
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
|
||||||
lenIV = privateData.get("lenIV");
|
const encoded = this.readCharStrings(
|
||||||
const encoded = this.readCharStrings(data, lenIV);
|
data,
|
||||||
|
privateData.get("lenIV")
|
||||||
|
);
|
||||||
this.nextChar();
|
this.nextChar();
|
||||||
token = this.getToken(); // read in 'NP' or '|'
|
token = this.getToken(); // read in 'NP' or '|'
|
||||||
if (token === "noaccess") {
|
if (token === "noaccess") {
|
||||||
@ -650,9 +654,9 @@ class Type1Parser {
|
|||||||
// *Blue* values may contain invalid data: disables reading of
|
// *Blue* values may contain invalid data: disables reading of
|
||||||
// those values when hinting is disabled.
|
// those values when hinting is disabled.
|
||||||
if (
|
if (
|
||||||
|
HINTING_ENABLED &&
|
||||||
blueArray.length > 0 &&
|
blueArray.length > 0 &&
|
||||||
blueArray.length % 2 === 0 &&
|
blueArray.length % 2 === 0
|
||||||
HINTING_ENABLED
|
|
||||||
) {
|
) {
|
||||||
privateData.set(token, blueArray);
|
privateData.set(token, blueArray);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user