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:
parent
010475176f
commit
d515d5ab7c
2 changed files with 81 additions and 77 deletions
6
fonts.js
6
fonts.js
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue