mozilla/pdf.js — pull request #4373 by chriskr (2014-03-03 16:42:32+00:00)
Title: Store the loaded font in the font descriptor too to prevent recreation o...

...f the same font

This is a fix for "Poor performance on NASA Budget #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 get the fontDescriptor 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.