mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #4944 from Snuffleupagus/issue-4934
Don't blindly trust toUnicode when building toFontChar for non-standard fonts without a font file (issue 4934)
This commit is contained in:
commit
c28839b2f3
4 changed files with 21 additions and 4 deletions
|
@ -2172,7 +2172,7 @@ var Glyph = (function GlyphClosure() {
|
|||
*/
|
||||
var Font = (function FontClosure() {
|
||||
function Font(name, file, properties) {
|
||||
var charCode;
|
||||
var charCode, glyphName;
|
||||
|
||||
this.name = name;
|
||||
this.loadedName = properties.loadedName;
|
||||
|
@ -2273,13 +2273,20 @@ var Font = (function FontClosure() {
|
|||
} else if (isStandardFont) {
|
||||
this.toFontChar = [];
|
||||
for (charCode in properties.defaultEncoding) {
|
||||
var glyphName = properties.differences[charCode] ||
|
||||
properties.defaultEncoding[charCode];
|
||||
glyphName = (properties.differences[charCode] ||
|
||||
properties.defaultEncoding[charCode]);
|
||||
this.toFontChar[charCode] = GlyphsUnicode[glyphName];
|
||||
}
|
||||
} else {
|
||||
var unicodeCharCode, notCidFont = (type.indexOf('CIDFontType') === -1);
|
||||
for (charCode in this.toUnicode) {
|
||||
this.toFontChar[charCode] = this.toUnicode[charCode].charCodeAt(0);
|
||||
unicodeCharCode = this.toUnicode[charCode].charCodeAt(0);
|
||||
if (notCidFont) {
|
||||
glyphName = (properties.differences[charCode] ||
|
||||
properties.defaultEncoding[charCode]);
|
||||
unicodeCharCode = (GlyphsUnicode[glyphName] || unicodeCharCode);
|
||||
}
|
||||
this.toFontChar[charCode] = unicodeCharCode;
|
||||
}
|
||||
}
|
||||
this.loadedName = fontName.split('-')[0];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue