mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Remove bad chars instead of replaces all.
This commit is contained in:
parent
b6e4fc771f
commit
b9cd526a35
1 changed files with 24 additions and 4 deletions
28
src/fonts.js
28
src/fonts.js
|
@ -3699,10 +3699,30 @@ var Type2CFF = (function Type2CFFClosure() {
|
|||
var length = data.length;
|
||||
if (length > 127)
|
||||
warn('Font had name longer than 127 chars, will be rejected.');
|
||||
// Only certain chars are permitted in the font name. Set them all to
|
||||
// 'A' to avoid being rejected.
|
||||
for (var j = 0; j < length; ++j)
|
||||
data[j] = 65;
|
||||
// Only certain chars are permitted in the font name.
|
||||
for (var j = 0; j < length; ++j) {
|
||||
var c = data[j];
|
||||
if (j === 0 && c === 0)
|
||||
continue;
|
||||
if (c < 33 || c > 126) {
|
||||
data[j] = 95;
|
||||
continue;
|
||||
}
|
||||
switch (c) {
|
||||
case 91: // [
|
||||
case 93: // ]
|
||||
case 40: // (
|
||||
case 41: // )
|
||||
case 123: // {
|
||||
case 125: // }
|
||||
case 60: // <
|
||||
case 62: // >
|
||||
case 47: // /
|
||||
case 37: // %
|
||||
data[j] = 95;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
getStrings: function cff_getStrings(stringIndex) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue