|
|
@ -59,14 +59,15 @@ FontWorker.prototype = { |
|
|
|
"fonts": function(data) { |
|
|
|
"fonts": function(data) { |
|
|
|
// console.log("got processed fonts from worker", Object.keys(data));
|
|
|
|
// console.log("got processed fonts from worker", Object.keys(data));
|
|
|
|
for (name in data) { |
|
|
|
for (name in data) { |
|
|
|
// Update the
|
|
|
|
// Update the encoding property.
|
|
|
|
Fonts[name].properties = { |
|
|
|
var font = Fonts.lookup(name); |
|
|
|
|
|
|
|
font.properties = { |
|
|
|
encoding: data[name].encoding |
|
|
|
encoding: data[name].encoding |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Call `Font.prototype.bindDOM` to make the font get loaded on the page.
|
|
|
|
// Call `Font.prototype.bindDOM` to make the font get loaded on the page.
|
|
|
|
Font.prototype.bindDOM.call( |
|
|
|
Font.prototype.bindDOM.call( |
|
|
|
Fonts[name], |
|
|
|
font, |
|
|
|
data[name].str, |
|
|
|
data[name].str, |
|
|
|
// IsLoadedCallback.
|
|
|
|
// IsLoadedCallback.
|
|
|
|
this.$handleFontLoadedCallback |
|
|
|
this.$handleFontLoadedCallback |
|
|
@ -84,19 +85,9 @@ FontWorker.prototype = { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Store only the data on Fonts that is needed later on, such that we
|
|
|
|
// Register the font but don't pass in any real data. The idea is to
|
|
|
|
// hold track on as lease memory as possible.
|
|
|
|
// store as less data as possible to reduce memory usage.
|
|
|
|
Fonts[font.name] = { |
|
|
|
Fonts.registerFont(font.name, Object.create(null), Object.create(null)); |
|
|
|
name: font.name, |
|
|
|
|
|
|
|
mimetype: font.mimetype, |
|
|
|
|
|
|
|
// This is set later on the worker replay. For some fonts, the encoding
|
|
|
|
|
|
|
|
// is calculated during the conversion process happening on the worker
|
|
|
|
|
|
|
|
// and therefore is not available right now.
|
|
|
|
|
|
|
|
// properties: {
|
|
|
|
|
|
|
|
// encoding: font.properties.encoding
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
cache: Object.create(null) |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mark this font to be handled later.
|
|
|
|
// Mark this font to be handled later.
|
|
|
|
notLoaded.push(font); |
|
|
|
notLoaded.push(font); |
|
|
|