Get any width (if one is present) in CFF parser

- in charstring specs at page 21 (section 4.2): "Also, it may appear in the charstring as the difference from nominalWidthX" so the number we've on the stack doesn't have to be positive.
  - currently this bug has probably no visible effect
  - but when the font is loaded to be used with XFA, then the rendering is incorrect.
This commit is contained in:
Calixte Denizet 2021-05-17 14:16:57 +02:00
parent 2fc9f39436
commit d394188835

View File

@ -640,7 +640,9 @@ const CFFParser = (function CFFParserClosure() {
} else if (stackSize > 1) {
warn("Found too many parameters for stack-clearing command");
}
if (stackSize > 0 && stack[stackSize - 1] >= 0) {
if (stackSize > 0) {
// Width can be any number since its the difference
// from nominalWidthX.
state.width = stack[stackSize - 1];
}
}