apply pdfjs font patch

https://github.com/mozilla/pdf.js/issues/2594#issuecomment-247644205
This commit is contained in:
Brian Gough 2016-09-19 10:30:34 +01:00
parent dd4a509d51
commit 6f50d56ceb

View file

@ -18017,7 +18017,7 @@ var Font = (function FontClosure() {
}
/**
* Helper function for |adjustMapping|.
* Helper function for `adjustMapping`.
* @return {boolean}
*/
function isProblematicUnicodeLocation(code) {
@ -18060,12 +18060,18 @@ var Font = (function FontClosure() {
var fontCharCode = originalCharCode;
// First try to map the value to a unicode position if a non identity map
// was created.
var hasUnicodeValue = false;
if (!isIdentityUnicode && toUnicode.has(originalCharCode)) {
var unicode = toUnicode.get(fontCharCode);
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
fontCharCode = unicode.charCodeAt(0);
}
// For Symbolic fonts, we trust the `unicode` value if and only if the
// font includes either `ToUnicode` or `Encoding` data, since otherwise
// `toUnicode` may not be correct.
hasUnicodeValue = properties.hasIncludedToUnicodeMap ||
properties.hasEncoding;
}
// Try to move control characters, special characters and already mapped
// characters to the private use area since they will not be drawn by
@ -18075,7 +18081,7 @@ var Font = (function FontClosure() {
// with firefox and thuluthfont).
if ((usedFontCharCodes[fontCharCode] !== undefined ||
isProblematicUnicodeLocation(fontCharCode) ||
(isSymbolic && isIdentityUnicode)) &&
(isSymbolic && !hasUnicodeValue)) &&
nextAvailableFontCharCode <= PRIVATE_USE_OFFSET_END) { // Room left.
// Loop to try and find a free spot in the private use area.
do {