diff --git a/fonts.js b/fonts.js index 343583acd..7d9b48465 100644 --- a/fonts.js +++ b/fonts.js @@ -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 }); } diff --git a/test/pdfs/ThuluthFeatures.pdf b/test/pdfs/ThuluthFeatures.pdf new file mode 100755 index 000000000..95e6b7419 Binary files /dev/null and b/test/pdfs/ThuluthFeatures.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index b45c9ac5c..d4936154c 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -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,