0

In many canvas frameworks there is a maxWidth and maxHeight to control word wrapping.

In EaselJS setting maxWidth is trivial but is there a way to set a maxHeight to text? (Efficiently)

user1002346
  • 57
  • 1
  • 9
  • What would you wish to achieve with a maxHeight? - Automatically smaller font-size, or just clipping of the text? If you just want the text to be clipped, you could use the `mask`-property: http://www.createjs.com/Docs/EaselJS/classes/Text.html#property_mask – olsn Aug 17 '13 at 19:48

2 Answers2

0

For anyone else, olsn's comment is the answer... just use mask: createjs.com/Docs/EaselJS/classes/Text.html#property_mask

user1002346
  • 57
  • 1
  • 9
0
txt.lineWidth = 200; 

var txt = new createjs.Text( 'txt sdfj sdfks dflkjsd flksdjf sdklfj sdlkfjsd fkljsdfsdjkf', "21px Arial", "#000" );
container.addChild( txt );
var w = ( txt.getMeasuredWidth() ) * txt.scaleX;
var h = ( txt.getMeasuredHeight() ) * txt.scaleY; 
txt.regY = h / 2;
txt.textAlign = 'center' 
txt.lineWidth = 200;
txt.x = __shape.x;
txt.y = __shape.y;
txt.color = 'black';