mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 10:08:06 +02:00
Use same obj/font id counter for all partial evaluators on page
This commit is contained in:
parent
8ae5d2745c
commit
d69f14328c
2 changed files with 25 additions and 23 deletions
|
@ -25,7 +25,7 @@
|
|||
|
||||
var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
function PartialEvaluator(pdfManager, xref, handler, pageIndex,
|
||||
uniquePrefix) {
|
||||
uniquePrefix, idCounters) {
|
||||
this.state = new EvalState();
|
||||
this.stateStack = [];
|
||||
|
||||
|
@ -34,8 +34,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
this.handler = handler;
|
||||
this.pageIndex = pageIndex;
|
||||
this.uniquePrefix = uniquePrefix;
|
||||
this.objIdCounter = 0;
|
||||
this.fontIdCounter = 0;
|
||||
this.idCounters = idCounters;
|
||||
}
|
||||
|
||||
// Specifies properties for each command
|
||||
|
@ -277,7 +276,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
// If there is no imageMask, create the PDFImage and a lot
|
||||
// of image processing can be done here.
|
||||
var uniquePrefix = this.uniquePrefix || '';
|
||||
var objId = 'img_' + uniquePrefix + (++this.objIdCounter);
|
||||
var objId = 'img_' + uniquePrefix + (++this.idCounters.obj);
|
||||
dependencies[objId] = true;
|
||||
retData.args = [objId, w, h];
|
||||
|
||||
|
@ -510,11 +509,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
|
||||
font = xref.fetchIfRef(font) || fontRes.get(fontName);
|
||||
if (!isDict(font)) {
|
||||
++this.fontIdCounter;
|
||||
++this.idCounters.font;
|
||||
promise.resolve({
|
||||
font: {
|
||||
translated: new ErrorFont('Font ' + fontName + ' is not available'),
|
||||
loadedName: 'g_font_' + this.uniquePrefix + this.fontIdCounter
|
||||
loadedName: 'g_font_' + this.uniquePrefix + this.idCounters.obj
|
||||
},
|
||||
dependencies: {}
|
||||
});
|
||||
|
@ -525,7 +524,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
if (!loadedName) {
|
||||
// keep track of each font we translated so the caller can
|
||||
// load them asynchronously before calling display on a page
|
||||
loadedName = 'g_font_' + this.uniquePrefix + (this.fontIdCounter + 1);
|
||||
loadedName = 'g_font_' + this.uniquePrefix + (this.idCounters.font + 1);
|
||||
font.loadedName = loadedName;
|
||||
|
||||
var translated;
|
||||
|
@ -575,7 +574,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
|||
});
|
||||
}
|
||||
|
||||
++this.fontIdCounter;
|
||||
++this.idCounters.font;
|
||||
} else {
|
||||
promise.resolve({
|
||||
font: font,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue