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

Stop caching the *parsed* Font data on its Dict object (PR 7347 follow-up)

Given that *all* fonts are, ever since PR 7347, now cached in the "normal" `fontCache` there's actually no reason for the special `font.translated` construction. (Given how Objects in JavaScript are references, rather than raw values, the old code shouldn't have caused any significant memory overhead.)

Instead we can simply store the `cacheKey`, which is a simple string, on only the Font `Dict`s where it's needed and thus look-up all fonts using the `fontCache` instead.
This commit is contained in:
Jonas Jenwald 2020-10-16 17:45:01 +02:00
parent b710fbcb00
commit f956d0a96a
2 changed files with 19 additions and 24 deletions

View file

@ -908,7 +908,7 @@ class Catalog {
return Promise.all(promises).then(translatedFonts => {
for (const { dict } of translatedFonts) {
delete dict.translated;
delete dict.cacheKey;
}
this.fontCache.clear();
this.builtInCMapCache.clear();