Adjust which TrueType (3, 1) glyphs we attempt to skip mapping of (issue 6336)

Fixes 6336.
This commit is contained in:
Jonas Jenwald 2015-08-09 12:31:05 +02:00
parent 26b9205c7e
commit 99d29487ab
4 changed files with 15 additions and 3 deletions

View File

@ -4236,9 +4236,10 @@ var Font = (function FontClosure() {
if (!glyphName) { if (!glyphName) {
continue; continue;
} }
var unicodeOrCharCode; var unicodeOrCharCode, isUnicode = false;
if (cmapPlatformId === 3 && cmapEncodingId === 1) { if (cmapPlatformId === 3 && cmapEncodingId === 1) {
unicodeOrCharCode = GlyphsUnicode[glyphName]; unicodeOrCharCode = GlyphsUnicode[glyphName];
isUnicode = true;
} else if (cmapPlatformId === 1 && cmapEncodingId === 0) { } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
// TODO: the encoding needs to be updated with mac os table. // TODO: the encoding needs to be updated with mac os table.
unicodeOrCharCode = Encodings.MacRomanEncoding.indexOf(glyphName); unicodeOrCharCode = Encodings.MacRomanEncoding.indexOf(glyphName);
@ -4246,8 +4247,11 @@ var Font = (function FontClosure() {
var found = false; var found = false;
for (i = 0; i < cmapMappingsLength; ++i) { for (i = 0; i < cmapMappingsLength; ++i) {
if (cmapMappings[i].charCode === unicodeOrCharCode && if (cmapMappings[i].charCode !== unicodeOrCharCode) {
hasGlyph(cmapMappings[i].glyphId, unicodeOrCharCode, -1)) { continue;
}
var code = isUnicode ? charCode : unicodeOrCharCode;
if (hasGlyph(cmapMappings[i].glyphId, code, -1)) {
charCodeToGlyphId[charCode] = cmapMappings[i].glyphId; charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
found = true; found = true;
break; break;

View File

@ -95,6 +95,7 @@
!issue5599.pdf !issue5599.pdf
!issue5747.pdf !issue5747.pdf
!issue6099.pdf !issue6099.pdf
!issue6336.pdf
!gradientfill.pdf !gradientfill.pdf
!bug903856.pdf !bug903856.pdf
!bug850854.pdf !bug850854.pdf

BIN
test/pdfs/issue6336.pdf Normal file

Binary file not shown.

View File

@ -1182,6 +1182,13 @@
"link": false, "link": false,
"type": "eq" "type": "eq"
}, },
{ "id": "issue6336",
"file": "pdfs/issue6336.pdf",
"md5": "1c457c12b3606e1de610235d6768bd78",
"rounds": 1,
"link": false,
"type": "eq"
},
{ "id": "issue5801", { "id": "issue5801",
"file": "pdfs/issue5801.pdf", "file": "pdfs/issue5801.pdf",
"md5": "e9548650ad40e13e00d2a486bbc2bb1b", "md5": "e9548650ad40e13e00d2a486bbc2bb1b",