Merge pull request #622 from notmasteryet/fix599

Fixing #599: glyph remapping
This commit is contained in:
notmasteryet 2011-10-05 19:56:21 -07:00
commit af9506e55b
3 changed files with 12 additions and 3 deletions

View File

@ -11,6 +11,7 @@ var kMaxWaitForFontFace = 1000;
// Unicode Private Use Area
var kCmapGlyphOffset = 0xE000;
var kSizeOfGlyphArea = 0x1900;
// PDF Glyph Space Units are one Thousandth of a TextSpace Unit
// except for Type 3 fonts
@ -1217,18 +1218,21 @@ var Font = (function Font() {
}
var encoding = properties.encoding, i;
// offsetting glyphs to avoid problematic unicode ranges
for (i in encoding) {
if (encoding.hasOwnProperty(i)) {
var unicode = encoding[i].unicode;
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
encoding[i].unicode = unicode += kCmapGlyphOffset;
if (unicode <= 0x1f ||
(unicode >= 127 && unicode < kSizeOfGlyphArea))
encoding[i].unicode += kCmapGlyphOffset;
}
}
var glyphs = [];
for (i = 1; i < numGlyphs; i++) {
glyphs.push({
unicode: i <= 0x1f || (i >= 127 && i <= 255) ?
unicode: i <= 0x1f || (i >= 127 && i < kSizeOfGlyphArea) ?
i + kCmapGlyphOffset : i
});
}

BIN
test/pdfs/ThuluthFeatures.pdf Executable file

Binary file not shown.

View File

@ -69,6 +69,11 @@
"rounds": 1,
"type": "load"
},
{ "id": "thuluthfont-pdf",
"file": "pdfs/ThuluthFeatures.pdf",
"rounds": 1,
"type": "eq"
},
{ "id": "wnv_chinese-pdf",
"file": "pdfs/wnv_chinese.pdf",
"link": true,