I've noticed a post about this in the archives, but it was described as a
Mac issue and I'm getting it on a PC. I'm trying to use TextFormat.getTextExtent() to do some image calculations, but I'm getting enormous values. I suspect it's because my text includes newline characters, but that's just a guess.

The docs say the function is deprecated, but the liveDocs emphatically deny this. Anyone got any suggestions?

I've found a few more posts in the archives about this. Everyone says, essentially, don't use it - and it looks like it won't solve my problem in any case, because it essentially returns the same values as field.textHeight / textWidth.

Maybe someone can offer some alternative suggestions. I need to get a bitmap representing a menu. It will contain n lines of text, and needs to be resized automatically to the extent of the text. So far so simple. But the problem I'm having is that field.textWidth (and autosize too) crops the text too close, with the result that the top and bottom lines of text are both hard up against the edge of the image, so that the size of the image is not equal to n* the line height, as I need. And without getTextExtent I can't see any simple method for finding the height of the line - and in other circumstances I might not even know how many lines there are, although of course if I know the lineHeight I can get this by ceil(textHeight/lineHeight)

Thoughts welcome
To change your subscription options or search the archive:

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training

Reply via email to