1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-28 23:28:16 +02:00

handle surrogate pairs in glyph to unicode translation

This commit is contained in:
Andreas Gal 2011-06-19 15:14:07 -07:00
parent 010475176f
commit d515d5ab7c
2 changed files with 81 additions and 77 deletions

View file

@ -62,6 +62,10 @@ var Fonts = {
var uc = encoding[ch];
if (uc instanceof Name) // we didn't convert the glyph yet
uc = encoding[ch] = GlyphsUnicode[uc.name];
if (uc > 0xffff) { // handle surrogate pairs
ret += String.fromCharCode(uc & 0xffff);
uc >>= 16;
}
ret += String.fromCharCode(uc);
}
@ -83,7 +87,7 @@ var Fonts = {
var Font = function(aName, aFile, aProperties) {
this.name = aName;
// If the font has already been decoded simply return
// If the font has already been decoded simply return it
if (Fonts[aName]) {
this.font = Fonts[aName].data;
return;