1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Merge pull request #7705 from Snuffleupagus/issue-2594

Move symbolic font glyphs to private use area if they don't have unicode mappings (issue 2594, bug 789074, bug 865644)
This commit is contained in:
Tim van der Meij 2016-12-10 21:30:28 +01:00 committed by GitHub
commit 00a006e466
2 changed files with 123 additions and 2 deletions

View file

@ -879,7 +879,7 @@ var Font = (function FontClosure() {
}
/**
* Helper function for |adjustMapping|.
* Helper function for `adjustMapping`.
* @return {boolean}
*/
function isProblematicUnicodeLocation(code) {
@ -922,7 +922,9 @@ 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)) {
hasUnicodeValue = true;
var unicode = toUnicode.get(fontCharCode);
// TODO: Try to map ligatures to the correct spot.
if (unicode.length === 1) {
@ -937,7 +939,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 {