1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

Cache fonts by reference.

This commit is contained in:
Brendan Dahl 2013-06-25 10:33:53 -07:00
parent d744be4af7
commit a8ad07ccbf
5 changed files with 62 additions and 21 deletions

View file

@ -187,6 +187,28 @@ var RefSet = (function RefSetClosure() {
return RefSet;
})();
var RefSetCache = (function RefSetCacheClosure() {
function RefSetCache() {
this.dict = {};
}
RefSetCache.prototype = {
get: function RefSetCache_get(ref) {
return this.dict['R' + ref.num + '.' + ref.gen];
},
has: function RefSetCache_has(ref) {
return ('R' + ref.num + '.' + ref.gen) in this.dict;
},
put: function RefSetCache_put(ref, obj) {
this.dict['R' + ref.num + '.' + ref.gen] = obj;
}
};
return RefSetCache;
})();
var Catalog = (function CatalogClosure() {
function Catalog(pdfManager, xref) {
this.pdfManager = pdfManager;