diff --git a/src/core/fonts.js b/src/core/fonts.js index 0146151e6..3562a7dc9 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -2690,6 +2690,7 @@ var Font = (function FontClosure() { fontCharCode <= 0x1f || // Control chars fontCharCode === 0x7F || // Control char fontCharCode === 0xAD || // Soft hyphen + fontCharCode === 0xA0 || // Non breaking space (fontCharCode >= 0x80 && fontCharCode <= 0x9F) || // Control chars // Prevent drawing characters in the specials unicode block. (fontCharCode >= 0xFFF0 && fontCharCode <= 0xFFFF) || @@ -4708,6 +4709,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { glyphId = glyphNames.indexOf(baseEncoding[charCode]); if (glyphId >= 0) { charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef } } } else if (!!(properties.flags & FontFlags.Symbolic)) { @@ -4724,6 +4727,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { glyphId = glyphNames.indexOf(baseEncoding[charCode]); if (glyphId >= 0) { charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef } } } @@ -4736,6 +4741,8 @@ function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) { glyphId = glyphNames.indexOf(glyphName); if (glyphId >= 0) { charCodeToGlyphId[charCode] = glyphId; + } else { + charCodeToGlyphId[charCode] = 0; // notdef } } } diff --git a/test/pdfs/issue5138.pdf b/test/pdfs/issue5138.pdf new file mode 100644 index 000000000..715ddf31f Binary files /dev/null and b/test/pdfs/issue5138.pdf differ diff --git a/test/test_manifest.json b/test/test_manifest.json index ed4bec3a6..05a69ce4a 100644 --- a/test/test_manifest.json +++ b/test/test_manifest.json @@ -615,6 +615,14 @@ "type": "eq", "about": "Glyph accent drawn as curves." }, + { "id": "issue5138", + "file": "pdfs/issue5138.pdf", + "md5": "9931686d7dee0df62640fbf58bed3323", + "link": false, + "rounds": 1, + "type": "eq", + "about": "Glyph that gets mapped to unicode non-breaking-space." + }, { "id": "simpletype3font", "file": "pdfs/simpletype3font.pdf", "md5": "b374c7543920840c61999e9e86939f99",