var sizes = current.sizes;
if (!(measureCache = sizes[size]))
measureCache = sizes[size] = Object.create(null);
+ } else {
+ charsCache = null;
+ measureCache = null
}
+
ctx.font = (size * kScalePrecision) + 'px "' + fontName + '"';
},
charsToUnicode: function fonts_chars2Unicode(chars) {
text = Fonts.charsToUnicode(text);
this.ctx.translate(this.current.x, -1 * this.current.y);
- var font = Fonts.lookupById(this.current.font.id);
- if (font && font.properties.textMatrix)
- this.ctx.transform.apply(this.ctx, font.properties.textMatrix);
-
+ var font = this.current.font;
+ if (font) {
+ var fontInfo = Fonts.lookupById(font.id);
+ if (fontInfo && fontInfo.properties.textMatrix)
+ this.ctx.transform.apply(this.ctx, fontInfo.properties.textMatrix);
+ }
this.ctx.fillText(text, 0, 0);
this.current.x += Fonts.measureText(text);
}