From e9f4a3d8ee082011ccfeaba6fffa66fd2f022cfe Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Mon, 5 Sep 2011 11:19:44 -0700 Subject: [PATCH] Need to use font.translated.name as unique identifier --- pdf.js | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/pdf.js b/pdf.js index e53ff1cb3..13ec62e15 100644 --- a/pdf.js +++ b/pdf.js @@ -4212,23 +4212,24 @@ var PartialEvaluator = (function() { } else if (cmd == 'Tf') { // eagerly collect all fonts var fontName = args[0].name; - // Check if this font is known already and process it otherwise. - if (!FontsMap[fontName]) { - var fontRes = resources.get('Font'); - if (fontRes) { - fontRes = xref.fetchIfRef(fontRes); - var font = xref.fetchIfRef(fontRes.get(fontName)); - assertWellFormed(IsDict(font)); - if (!font.translated) { - font.translated = this.translateFont(font, xref, resources); - if (fonts && font.translated) { - // keep track of each font we translated so the caller can - // load them asynchronously before calling display on a page - fonts.push(font.translated); - FontsMap[fontName] = font; - } + var fontRes = resources.get('Font'); + if (fontRes) { + fontRes = xref.fetchIfRef(fontRes); + var font = xref.fetchIfRef(fontRes.get(fontName)); + assertWellFormed(IsDict(font)); + if (!font.translated) { + font.translated = this.translateFont(font, xref, resources); + if (fonts && font.translated) { + // keep track of each font we translated so the caller can + // load them asynchronously before calling display on a page + fonts.push(font.translated); + FontsMap[font.translated.name] = font; } } + args[0].name = font.translated.name; + } else { + // TODO: TOASK: Is it possible to get here? If so, what does + // args[0].name should be like??? } }