mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
Cache the "raw" standard font data in the worker-thread (PR 12726 follow-up)
*This implementation is basically a copy of the pre-existing `builtInCMapCache` implementation.* For some, badly generated, PDF documents it's possible that we'll end up having to fetch the *same* standard font data over and over (which is obviously inefficient). While not common, it's certainly possible that a PDF document uses *custom* font names where the actual font then references one of the standard fonts; see e.g. issue 11399 for one such example. Note that I did suggest adding worker-thread caching of standard font data in PR 12726, however it wasn't deemed necessary at the time. Now that we have a real-world example that benefit from caching, I think that we should simply implement this now.
This commit is contained in:
parent
6d88d8cdaa
commit
a01c599247
4 changed files with 46 additions and 17 deletions
|
@ -79,6 +79,7 @@ class Page {
|
|||
globalIdFactory,
|
||||
fontCache,
|
||||
builtInCMapCache,
|
||||
standardFontDataCache,
|
||||
globalImageCache,
|
||||
nonBlendModesSet,
|
||||
xfaFactory,
|
||||
|
@ -90,6 +91,7 @@ class Page {
|
|||
this.ref = ref;
|
||||
this.fontCache = fontCache;
|
||||
this.builtInCMapCache = builtInCMapCache;
|
||||
this.standardFontDataCache = standardFontDataCache;
|
||||
this.globalImageCache = globalImageCache;
|
||||
this.nonBlendModesSet = nonBlendModesSet;
|
||||
this.evaluatorOptions = pdfManager.evaluatorOptions;
|
||||
|
@ -255,6 +257,7 @@ class Page {
|
|||
idFactory: this._localIdFactory,
|
||||
fontCache: this.fontCache,
|
||||
builtInCMapCache: this.builtInCMapCache,
|
||||
standardFontDataCache: this.standardFontDataCache,
|
||||
globalImageCache: this.globalImageCache,
|
||||
options: this.evaluatorOptions,
|
||||
});
|
||||
|
@ -321,6 +324,7 @@ class Page {
|
|||
idFactory: this._localIdFactory,
|
||||
fontCache: this.fontCache,
|
||||
builtInCMapCache: this.builtInCMapCache,
|
||||
standardFontDataCache: this.standardFontDataCache,
|
||||
globalImageCache: this.globalImageCache,
|
||||
options: this.evaluatorOptions,
|
||||
});
|
||||
|
@ -425,6 +429,7 @@ class Page {
|
|||
idFactory: this._localIdFactory,
|
||||
fontCache: this.fontCache,
|
||||
builtInCMapCache: this.builtInCMapCache,
|
||||
standardFontDataCache: this.standardFontDataCache,
|
||||
globalImageCache: this.globalImageCache,
|
||||
options: this.evaluatorOptions,
|
||||
});
|
||||
|
@ -889,6 +894,7 @@ class PDFDocument {
|
|||
idFactory: this._globalIdFactory,
|
||||
fontCache: this.catalog.fontCache,
|
||||
builtInCMapCache: this.catalog.builtInCMapCache,
|
||||
standardFontDataCache: this.catalog.standardFontDataCache,
|
||||
options,
|
||||
});
|
||||
const operatorList = new OperatorList();
|
||||
|
@ -1148,6 +1154,7 @@ class PDFDocument {
|
|||
globalIdFactory: this._globalIdFactory,
|
||||
fontCache: catalog.fontCache,
|
||||
builtInCMapCache: catalog.builtInCMapCache,
|
||||
standardFontDataCache: catalog.standardFontDataCache,
|
||||
globalImageCache: catalog.globalImageCache,
|
||||
nonBlendModesSet: catalog.nonBlendModesSet,
|
||||
xfaFactory: this.xfaFactory,
|
||||
|
@ -1170,6 +1177,7 @@ class PDFDocument {
|
|||
globalIdFactory: this._globalIdFactory,
|
||||
fontCache: catalog.fontCache,
|
||||
builtInCMapCache: catalog.builtInCMapCache,
|
||||
standardFontDataCache: catalog.standardFontDataCache,
|
||||
globalImageCache: catalog.globalImageCache,
|
||||
nonBlendModesSet: catalog.nonBlendModesSet,
|
||||
xfaFactory: null,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue