diff --git a/lib/canvas.js b/lib/canvas.js index 065ff6f..741f5fa 100644 --- a/lib/canvas.js +++ b/lib/canvas.js @@ -476,6 +476,8 @@ Context2d.prototype.__defineSetter__('font', function(val){ if ('string' == typeof val) { var font; if (font = parseFont(val)) { + // TODO: cache + // TODO: dpi this.lastFontString = val; switch (font.unit) { @@ -485,6 +487,12 @@ Context2d.prototype.__defineSetter__('font', function(val){ case 'in': font.size *= 96; break; + case 'mm': + font.size *= 96.0 / 25.4; + break; + case 'cm': + font.size *= 96.0 / 2.54; + break; } this.setFont(