mozilla/pdf.js — pull request #4380 by chriskr (2014-03-03 19:57:41+00:00)
Title: Store the loaded font in the font descriptor

This is a fix for "Poor performance on NASA Budget", issue #4339.

The main issue is that fonts are created based on font objects, but different font objects can reference the same font. In the mentioned document there are e.g. more than 50 font objects for the same font. The fix splits the translateFont function in two parts, one to pre evaluate the font and the other to do the actual translation. The translated font is then also stored on the fontDescriptor so it can be returned early if an other font object points to the same descriptor. This improves the performance in the above mentioned document dramatically.