Need to use font.translated.name as unique identifier

This commit is contained in:
Julian Viereck 2011-09-05 11:19:44 -07:00
parent 6dd82ad5d4
commit e9f4a3d8ee

31
pdf.js
View File

@ -4212,23 +4212,24 @@ var PartialEvaluator = (function() {
} else if (cmd == 'Tf') { // eagerly collect all fonts } else if (cmd == 'Tf') { // eagerly collect all fonts
var fontName = args[0].name; var fontName = args[0].name;
// Check if this font is known already and process it otherwise. var fontRes = resources.get('Font');
if (!FontsMap[fontName]) { if (fontRes) {
var fontRes = resources.get('Font'); fontRes = xref.fetchIfRef(fontRes);
if (fontRes) { var font = xref.fetchIfRef(fontRes.get(fontName));
fontRes = xref.fetchIfRef(fontRes); assertWellFormed(IsDict(font));
var font = xref.fetchIfRef(fontRes.get(fontName)); if (!font.translated) {
assertWellFormed(IsDict(font)); font.translated = this.translateFont(font, xref, resources);
if (!font.translated) { if (fonts && font.translated) {
font.translated = this.translateFont(font, xref, resources); // keep track of each font we translated so the caller can
if (fonts && font.translated) { // load them asynchronously before calling display on a page
// keep track of each font we translated so the caller can fonts.push(font.translated);
// load them asynchronously before calling display on a page FontsMap[font.translated.name] = font;
fonts.push(font.translated);
FontsMap[fontName] = 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???
} }
} }