lookupById: function fonts_lookupById(id) {
return fonts[id];
},
- setActive: function fonts_setActive(font, size) {
+ setActive: function fonts_setActive(fontName, fontObj, size) {
// |current| can be null is fontName is a built-in font
// (e.g. "sans-serif")
- if ((current = fonts[font.id])) {
+ if (fontObj && (current = fonts[fontObj.id])) {
charsCache = current.charsCache;
var sizes = current.sizes;
if (!(measureCache = sizes[size]))
measureCache = sizes[size] = Object.create(null);
}
- ctx.font = (size * kScalePrecision) + 'px "' + font.loadedName + '"';
+ ctx.font = (size * kScalePrecision) + 'px "' + fontName + '"';
},
charsToUnicode: function fonts_chars2Unicode(chars) {
if (!charsCache)
}
}
+ this.listeningForFontLoad = false;
if (!isWorker && rules.length) {
FontLoader.prepareFontLoadEvent(rules, names, ids);
}
div.innerHTML = html;
document.body.appendChild(div);
- if (!this.listeneningForFontLoad) {
+ if (!this.listeningForFontLoad) {
window.addEventListener(
'message',
function(e) {
document.documentElement.dispatchEvent(evt);
},
false);
- this.listeneningForFontLoad = true;
+ this.listeningForFontLoad = true;
}
// XXX we should have a time-out here too, and maybe fire
this.ctx.$setFont(fontName, size);
} else {
this.ctx.font = size + 'px "' + fontName + '"';
- Fonts.setActive(fontObj, size);
+ Fonts.setActive(fontName, fontObj, size);
}
},
setTextRenderingMode: function(mode) {