mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
CFF parser didn't count hints defined by hstem/vstem
This commit is contained in:
parent
f7a0d6ccc4
commit
a254de86fb
2 changed files with 31 additions and 9 deletions
18
src/fonts.js
18
src/fonts.js
|
@ -5453,9 +5453,9 @@ var CFFFont = (function CFFFontClosure() {
|
|||
var CFFParser = (function CFFParserClosure() {
|
||||
var CharstringValidationData = [
|
||||
null,
|
||||
{ id: 'hstem', min: 2, resetStack: true },
|
||||
{ id: 'hstem', min: 2, resetStack: true, stem: true },
|
||||
null,
|
||||
{ id: 'vstem', min: 2, resetStack: true },
|
||||
{ id: 'vstem', min: 2, resetStack: true, stem: true },
|
||||
{ id: 'vmoveto', min: 1, resetStack: true },
|
||||
{ id: 'rlineto', min: 2, resetStack: true },
|
||||
{ id: 'hlineto', min: 1, resetStack: true },
|
||||
|
@ -5463,19 +5463,19 @@ var CFFParser = (function CFFParserClosure() {
|
|||
{ id: 'rrcurveto', min: 6, resetStack: true },
|
||||
null,
|
||||
{ id: 'callsubr', min: 1, undefStack: true },
|
||||
{ id: 'return', min: 0, resetStack: true },
|
||||
{ id: 'return', min: 0, undefStack: true },
|
||||
null, // 12
|
||||
null,
|
||||
null, // endchar
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
{ id: 'hstemhm', min: 2, resetStack: true },
|
||||
{ id: 'hstemhm', min: 2, resetStack: true, stem: true },
|
||||
null, // hintmask
|
||||
null, // cntrmask
|
||||
{ id: 'rmoveto', min: 2, resetStack: true },
|
||||
{ id: 'hmoveto', min: 1, resetStack: true },
|
||||
{ id: 'vstemhm', min: 2, resetStack: true },
|
||||
{ id: 'vstemhm', min: 2, resetStack: true, stem: true },
|
||||
{ id: 'rcurveline', min: 8, resetStack: true },
|
||||
{ id: 'rlinecurve', min: 8, resetStack: true },
|
||||
{ id: 'vvcurveto', min: 4, resetStack: true },
|
||||
|
@ -5491,7 +5491,7 @@ var CFFParser = (function CFFParserClosure() {
|
|||
null,
|
||||
{ id: 'and', min: 2, stackDelta: -1 },
|
||||
{ id: 'or', min: 2, stackDelta: -1 },
|
||||
{ id: 'not', min: 2, stackDelta: -1 },
|
||||
{ id: 'not', min: 1, stackDelta: 0 },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
@ -5811,9 +5811,6 @@ var CFFParser = (function CFFParserClosure() {
|
|||
} else if (value == 255) { // number (32 bit)
|
||||
j += 4;
|
||||
stackSize++;
|
||||
} else if (value == 18 || value == 23) {
|
||||
hints += stackSize >> 1;
|
||||
validationCommand = CharstringValidationData[value];
|
||||
} else if (value == 19 || value == 20) {
|
||||
hints += stackSize >> 1;
|
||||
j += (hints + 7) >> 3; // skipping right amount of hints flag data
|
||||
|
@ -5822,6 +5819,9 @@ var CFFParser = (function CFFParserClosure() {
|
|||
validationCommand = CharstringValidationData[value];
|
||||
}
|
||||
if (validationCommand) {
|
||||
if (validationCommand.stem) {
|
||||
hints += stackSize >> 1;
|
||||
}
|
||||
if ('min' in validationCommand) {
|
||||
if (!undefStack && stackSize < validationCommand.min) {
|
||||
warn('Not enough parameters for ' + validationCommand.id +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue