Merge pull request #622 from notmasteryet/fix599
Fixing #599: glyph remapping
This commit is contained in:
commit
af9506e55b
10
fonts.js
10
fonts.js
@ -11,6 +11,7 @@ var kMaxWaitForFontFace = 1000;
|
|||||||
|
|
||||||
// Unicode Private Use Area
|
// Unicode Private Use Area
|
||||||
var kCmapGlyphOffset = 0xE000;
|
var kCmapGlyphOffset = 0xE000;
|
||||||
|
var kSizeOfGlyphArea = 0x1900;
|
||||||
|
|
||||||
// PDF Glyph Space Units are one Thousandth of a TextSpace Unit
|
// PDF Glyph Space Units are one Thousandth of a TextSpace Unit
|
||||||
// except for Type 3 fonts
|
// except for Type 3 fonts
|
||||||
@ -1217,18 +1218,21 @@ var Font = (function Font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var encoding = properties.encoding, i;
|
var encoding = properties.encoding, i;
|
||||||
|
|
||||||
|
// offsetting glyphs to avoid problematic unicode ranges
|
||||||
for (i in encoding) {
|
for (i in encoding) {
|
||||||
if (encoding.hasOwnProperty(i)) {
|
if (encoding.hasOwnProperty(i)) {
|
||||||
var unicode = encoding[i].unicode;
|
var unicode = encoding[i].unicode;
|
||||||
if (unicode <= 0x1f || (unicode >= 127 && unicode <= 255))
|
if (unicode <= 0x1f ||
|
||||||
encoding[i].unicode = unicode += kCmapGlyphOffset;
|
(unicode >= 127 && unicode < kSizeOfGlyphArea))
|
||||||
|
encoding[i].unicode += kCmapGlyphOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var glyphs = [];
|
var glyphs = [];
|
||||||
for (i = 1; i < numGlyphs; i++) {
|
for (i = 1; i < numGlyphs; i++) {
|
||||||
glyphs.push({
|
glyphs.push({
|
||||||
unicode: i <= 0x1f || (i >= 127 && i <= 255) ?
|
unicode: i <= 0x1f || (i >= 127 && i < kSizeOfGlyphArea) ?
|
||||||
i + kCmapGlyphOffset : i
|
i + kCmapGlyphOffset : i
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
BIN
test/pdfs/ThuluthFeatures.pdf
Executable file
BIN
test/pdfs/ThuluthFeatures.pdf
Executable file
Binary file not shown.
@ -69,6 +69,11 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
|
{ "id": "thuluthfont-pdf",
|
||||||
|
"file": "pdfs/ThuluthFeatures.pdf",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "eq"
|
||||||
|
},
|
||||||
{ "id": "wnv_chinese-pdf",
|
{ "id": "wnv_chinese-pdf",
|
||||||
"file": "pdfs/wnv_chinese.pdf",
|
"file": "pdfs/wnv_chinese.pdf",
|
||||||
"link": true,
|
"link": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user