Skip to main content
Inspiring
August 29, 2009
Question

How to determine exact dimensions and position of characters.

  • August 29, 2009
  • 1 reply
  • 529 views

I need to determine the exact dimensions of a specific line of text within a ContainerController.  I want to specify the y coordinate (relative to the top of the ContainerController), and deal with the line of text nearest to that point.

Prior to Flash 10 text capabilities, when I wrote my own primitive linked containers based on TextFields, I was able to utilise TextField methods such as getCharBoundaries(), getLineIndexAtPoint(), getLineOffset(), getLineLength(), etc... to obtain precise measurements about characters and lines.

Does the Text Layout Framework have equivalent methods?  Or is it just a matter of working out which TextLine object is nearest to a particular y-coordinate (is there a method that does that efficiently?), and using various getAtom... methods?

. . . . . . . . . . . . . . . .

For an overview of my e2publish application (which I abandoned a couple of years ago, and I'm now looking at reviving using the Text Layout Framework) - see http://www.e2easy.co.cc/e2publish.html

This topic has been closed for replies.

1 reply

August 31, 2009

flashx.textLayout.edit.SelectionManager seems to have a lot of that functionality.  I'd look at the code and see how they do it, particularly the functions that start with "computeSelectionIndex".  It doesn't look too pretty (although there are a fair amount of comments) and I would guess that adobe would have used simpler functions if they had built them.  I'm not an expert on TLF yet, so someone else may still have a better idea.

- Daniel Freiman