mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
Repair CFF fonts if stem hints are in wrong order
This commit is contained in:
parent
6ebdbb244f
commit
9e990f6f3e
4 changed files with 18 additions and 0 deletions
|
@ -539,6 +539,16 @@ var CFFParser = (function CFFParserClosure() {
|
|||
if (validationCommand) {
|
||||
if (validationCommand.stem) {
|
||||
state.hints += stackSize >> 1;
|
||||
if (value === 3 || value === 23) {
|
||||
// vstem or vstemhm.
|
||||
state.hasVStems = true;
|
||||
} else if (state.hasVStems && (value === 1 || value === 18)) {
|
||||
// Some browsers don't draw glyphs that specify vstems before
|
||||
// hstems. As a workaround, replace hstem (1) and hstemhm (18)
|
||||
// with a pointless vstem (3) or vstemhm (23).
|
||||
warn('CFF stem hints are in wrong order');
|
||||
data[j - 1] = (value === 1) ? 3 : 23;
|
||||
}
|
||||
}
|
||||
if ('min' in validationCommand) {
|
||||
if (!state.undefStack && stackSize < validationCommand.min) {
|
||||
|
@ -599,6 +609,7 @@ var CFFParser = (function CFFParserClosure() {
|
|||
firstStackClearing: true,
|
||||
seac: null,
|
||||
width: null,
|
||||
hasVStems: false,
|
||||
};
|
||||
var valid = true;
|
||||
var localSubrToUse = null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue