Browse Source

Added textBaseline=

v1.x
Tj Holowaychuk 14 years ago
parent
commit
253e200957
  1. 30
      lib/canvas.js

30
lib/canvas.js

@ -41,6 +41,12 @@ exports.cairoVersion = cairoVersion;
var cache = {}; var cache = {};
/**
* Text baselines.
*/
var baselines = ['alphabetic', 'top', 'bottom', 'middle', 'ideographic', 'hanging'];
/** /**
* Font RegExp helpers. * Font RegExp helpers.
*/ */
@ -502,6 +508,30 @@ Context2d.prototype.__defineGetter__('font', function(){
return this.lastFontString || '10px sans-serif'; return this.lastFontString || '10px sans-serif';
}); });
/**
* Set text baseline.
*
* @api public
*/
Context2d.prototype.__defineSetter__('textBaseline', function(val){
var n = baselines.indexOf(val);
if (~n) {
this.lastBaseline = val;
this.setTextBaseline(n);
}
});
/**
* Get the current baseline setting.
*
* @api public
*/
Context2d.prototype.__defineGetter__('textAlign', function(){
return this.lastBaseline || 'alphabetic';
});
/** /**
* Set text alignment. * Set text alignment.
* *

Loading…
Cancel
Save