Moving all symbolic font glyphs into 0xF000 - 0xF0FF range
This commit is contained in:
parent
2703f3f692
commit
a46a684935
17
src/fonts.js
17
src/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;
|
var kSizeOfGlyphArea = 0x1900;
|
||||||
|
var kSymbolicFontGlyphOffset = 0xF000;
|
||||||
|
|
||||||
// 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
|
||||||
@ -1888,7 +1889,7 @@ var Font = (function FontClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if it is, replacing with meaningful toUnicode values
|
// if it is, replacing with meaningful toUnicode values
|
||||||
if (isIdentity) {
|
if (isIdentity && !this.isSymbolicFont) {
|
||||||
var usedUnicodes = [], unassignedUnicodeItems = [];
|
var usedUnicodes = [], unassignedUnicodeItems = [];
|
||||||
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
||||||
var unicode = toUnicode[i + 1];
|
var unicode = toUnicode[i + 1];
|
||||||
@ -1940,11 +1941,15 @@ var Font = (function FontClosure() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If font is symbolic and cmap (3,0) present, the characters can be
|
// Moving all symbolic font glyphs into 0xF000 - 0xF0FF range.
|
||||||
// located in 0xF000 - 0xF0FF range. Using the first glyph code
|
this.symbolicGlyphsOffset = 0;
|
||||||
// to detect the base glyphs offset.
|
if (this.isSymbolicFont) {
|
||||||
this.symbolicGlyphsOffset = this.isSymbolicFont && !hasShortCmap ?
|
for (var i = 0, ii = glyphs.length; i < ii; i++) {
|
||||||
(glyphs[0].unicode & 0xFF00) : 0;
|
var code = glyphs[i].unicode;
|
||||||
|
glyphs[i].unicode = kSymbolicFontGlyphOffset | (code & 0xFF);
|
||||||
|
}
|
||||||
|
this.symbolicGlyphsOffset = kSymbolicFontGlyphOffset;
|
||||||
|
}
|
||||||
|
|
||||||
// remove glyph references outside range of avaialable glyphs
|
// remove glyph references outside range of avaialable glyphs
|
||||||
for (var i = 0, ii = ids.length; i < ii; i++) {
|
for (var i = 0, ii = ids.length; i < ii; i++) {
|
||||||
|
1
test/pdfs/issue1257.pdf.link
Normal file
1
test/pdfs/issue1257.pdf.link
Normal file
@ -0,0 +1 @@
|
|||||||
|
http://hse-econ.fi/tervio/MediocritiesAndSuperstars.pdf
|
@ -488,5 +488,13 @@
|
|||||||
"pageLimit": 2,
|
"pageLimit": 2,
|
||||||
"link": true,
|
"link": true,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
|
},
|
||||||
|
{ "id": "issue1257",
|
||||||
|
"file": "pdfs/issue1257.pdf",
|
||||||
|
"md5": "9111533826bc21ed774e8e01603a2f54",
|
||||||
|
"rounds": 1,
|
||||||
|
"pageLimit": 2,
|
||||||
|
"link": true,
|
||||||
|
"type": "eq"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user