Browse Source

Added mm / cm

v1.x
Tj Holowaychuk 14 years ago
parent
commit
3e332c990a
  1. 8
      lib/canvas.js

8
lib/canvas.js

@ -476,6 +476,8 @@ Context2d.prototype.__defineSetter__('font', function(val){
if ('string' == typeof val) { if ('string' == typeof val) {
var font; var font;
if (font = parseFont(val)) { if (font = parseFont(val)) {
// TODO: cache
// TODO: dpi
this.lastFontString = val; this.lastFontString = val;
switch (font.unit) { switch (font.unit) {
@ -485,6 +487,12 @@ Context2d.prototype.__defineSetter__('font', function(val){
case 'in': case 'in':
font.size *= 96; font.size *= 96;
break; break;
case 'mm':
font.size *= 96.0 / 25.4;
break;
case 'cm':
font.size *= 96.0 / 2.54;
break;
} }
this.setFont( this.setFont(

Loading…
Cancel
Save