@@ -59,14 +59,15 @@ FontWorker.prototype = {
59
59
"fonts" : function (data ) {
60
60
// console.log("got processed fonts from worker", Object.keys(data));
61
61
for (name in data ) {
62
- // Update the
63
- Fonts [name ].properties = {
62
+ // Update the encoding property.
63
+ var font = Fonts .lookup (name );
64
+ font .properties = {
64
65
encoding : data [name ].encoding
65
66
}
66
-
67
+
67
68
// Call `Font.prototype.bindDOM` to make the font get loaded on the page.
68
69
Font .prototype .bindDOM .call (
69
- Fonts [ name ] ,
70
+ font ,
70
71
data [name ].str ,
71
72
// IsLoadedCallback.
72
73
this .$handleFontLoadedCallback
@@ -84,19 +85,9 @@ FontWorker.prototype = {
84
85
continue ;
85
86
}
86
87
87
- // Store only the data on Fonts that is needed later on, such that we
88
- // hold track on as lease memory as possible.
89
- Fonts [font .name ] = {
90
- name : font .name ,
91
- mimetype : font .mimetype ,
92
- // This is set later on the worker replay. For some fonts, the encoding
93
- // is calculated during the conversion process happening on the worker
94
- // and therefore is not available right now.
95
- // properties: {
96
- // encoding: font.properties.encoding
97
- // },
98
- cache : Object .create (null )
99
- };
88
+ // Register the font but don't pass in any real data. The idea is to
89
+ // store as less data as possible to reduce memory usage.
90
+ Fonts .registerFont (font .name , Object .create (null ), Object .create (null ));
100
91
101
92
// Mark this font to be handled later.
102
93
notLoaded .push (font );
0 commit comments