mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Clean up encoding parsing
This commit is contained in:
parent
6a7b37ab68
commit
341de1ff42
2 changed files with 10 additions and 4 deletions
11
fonts.js
11
fonts.js
|
@ -385,6 +385,7 @@ var Font = (function Font() {
|
|||
var constructor = function font_constructor(name, file, properties) {
|
||||
this.name = name;
|
||||
this.encoding = properties.encoding;
|
||||
this.glyphs = properties.glyphs;
|
||||
this.sizes = [];
|
||||
|
||||
// If the font is to be ignored, register it like an already loaded font
|
||||
|
@ -1271,6 +1272,10 @@ var Font = (function Font() {
|
|||
unicode = charcode;
|
||||
}
|
||||
|
||||
// Check if the glyph has already been converted
|
||||
if (!IsNum(unicode))
|
||||
unicode = encoding[charcode] = this.glyphs[unicode];
|
||||
|
||||
// Handle surrogate pairs
|
||||
if (unicode > 0xFFFF) {
|
||||
str += String.fromCharCode(unicode & 0xFFFF);
|
||||
|
@ -1703,9 +1708,9 @@ var Type1Parser = function() {
|
|||
var index = parseInt(getToken());
|
||||
var glyph = getToken();
|
||||
|
||||
if (!properties.encoding[index]) {
|
||||
var code = GlyphsUnicode[glyph];
|
||||
properties.glyphs[glyph] = properties.encoding[index] = code;
|
||||
if ('undefined' == typeof(properties.differences[index])) {
|
||||
properties.encoding[index] = glyph;
|
||||
properties.glyphs[glyph] = GlyphsUnicode[glyph];
|
||||
}
|
||||
getToken(); // read the in 'put'
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue