|
|
@ -520,28 +520,33 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
return promise; |
|
|
|
return promise; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var loadedName = font.loadedName; |
|
|
|
if (font.loaded) { |
|
|
|
if (!loadedName) { |
|
|
|
promise.resolve({ |
|
|
|
|
|
|
|
font: font, |
|
|
|
|
|
|
|
dependencies: {} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return promise; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// keep track of each font we translated so the caller can
|
|
|
|
// keep track of each font we translated so the caller can
|
|
|
|
// load them asynchronously before calling display on a page
|
|
|
|
// load them asynchronously before calling display on a page
|
|
|
|
loadedName = 'g_font_' + this.uniquePrefix + (this.idCounters.font + 1); |
|
|
|
font.loadedName = 'g_font_' + this.uniquePrefix + |
|
|
|
font.loadedName = loadedName; |
|
|
|
(this.idCounters.font + 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!font.translated) { |
|
|
|
var translated; |
|
|
|
var translated; |
|
|
|
try { |
|
|
|
try { |
|
|
|
translated = this.translateFont(font, xref); |
|
|
|
translated = this.translateFont(font, xref); |
|
|
|
} catch (e) { |
|
|
|
} catch (e) { |
|
|
|
if (e instanceof MissingDataException) { |
|
|
|
if (e instanceof MissingDataException) { |
|
|
|
font.loadedName = null; |
|
|
|
|
|
|
|
throw e; |
|
|
|
throw e; |
|
|
|
} |
|
|
|
} |
|
|
|
translated = new ErrorFont(e instanceof Error ? e.message : e); |
|
|
|
translated = new ErrorFont(e instanceof Error ? e.message : e); |
|
|
|
} |
|
|
|
} |
|
|
|
font.translated = translated; |
|
|
|
font.translated = translated; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (translated.loadCharProcs) { |
|
|
|
if (font.translated.loadCharProcs) { |
|
|
|
delete translated.loadCharProcs; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var charProcs = font.get('CharProcs').getAll(); |
|
|
|
var charProcs = font.get('CharProcs').getAll(); |
|
|
|
var fontResources = font.get('Resources') || resources; |
|
|
|
var fontResources = font.get('Resources') || resources; |
|
|
|
var opListPromises = []; |
|
|
|
var opListPromises = []; |
|
|
@ -561,21 +566,17 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
charProcOperatorList[key] = data.queue; |
|
|
|
charProcOperatorList[key] = data.queue; |
|
|
|
Util.extendObj(dependencies, data.dependencies); |
|
|
|
Util.extendObj(dependencies, data.dependencies); |
|
|
|
} |
|
|
|
} |
|
|
|
translated.charProcOperatorList = charProcOperatorList; |
|
|
|
font.translated.charProcOperatorList = charProcOperatorList; |
|
|
|
|
|
|
|
font.loaded = true; |
|
|
|
|
|
|
|
++this.idCounters.font; |
|
|
|
promise.resolve({ |
|
|
|
promise.resolve({ |
|
|
|
font: font, |
|
|
|
font: font, |
|
|
|
dependencies: dependencies |
|
|
|
dependencies: dependencies |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}.bind(this)); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
promise.resolve({ |
|
|
|
|
|
|
|
font: font, |
|
|
|
|
|
|
|
dependencies: {} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
++this.idCounters.font; |
|
|
|
++this.idCounters.font; |
|
|
|
} else { |
|
|
|
font.loaded = true; |
|
|
|
promise.resolve({ |
|
|
|
promise.resolve({ |
|
|
|
font: font, |
|
|
|
font: font, |
|
|
|
dependencies: {} |
|
|
|
dependencies: {} |
|
|
|