The layer has a property "bounds" from which you can calculate the width.
var width = textLayer.bounds[2] - textLayer.bounds[0];
The layer has a property "bounds" from which you can calculate the width.
var width = textLayer.bounds[2] - textLayer.bounds[0];