Sg2.9
Find width of text frame
Recent RSS
Find width of text frame
From:  p0r1
Date:  29. May 2007, 17:07

Hiya,

I'm a newbie to scriptographer, and I can't quite figure out how to find out the width of some text. I tried to extract it by using the width of its bounding box, but had no joy and the values in this rect appear to be uninitalized (0, or -32766)...

For example:

var pos = new Point(0.0, 0.0);
var someText = new PointText(pos);
someText.content = "Please help me";
someText.characterStyle.fontSize = 24.0;
var textWidth = someText.bounds.width;
print("someText width is " + textWidth);

I also tried using geometricBounds and controlBounds to find the width but still could not get it working. I am using Scriptographer 2.0.023 with CS3 on an intel mac.

Cheers, p0r1

Re: Find width of text frame
Date:  1. June 2007, 16:27

Hmm I was going to propose to use someText.createOutline() as a workaround to get the bounds, but it doesn't seem to be working either. I'll post a bugreport.

Scripts
08.08.14, 15:24
15.05.14, 14:23
02.03.14, 19:16
18.11.13, 14:48
22.03.13, 03:05
22.02.13, 15:45
Posts
10.01.17, 16:37
19.02.16, 06:03
19.02.16, 06:00
17.01.16, 11:00
12.01.16, 13:10
25.11.15, 08:19
Script of the Moment
Cross Hatch Raster 15.03.12