This content has been marked as final. Show 4 replies
> Is there any easy way to get text to form around an image?
It can be done, but not "easily". As you say, you need to write code to
determine where to place hard returns - charPosToLoc() will likely
If you are *always* going to start with the first line and *always*
place the image to the left or right it becomes much easier. Take the
image width from your text member width and determine, using
charPosToLoc in a repeat loop, which whole word will fit in your given
width and place a return after it. Now do the same for as many lines as
required to cater for the image height and when done set the leftIndent
for those lines so treated.
> This should do what you want:
> and here's the source:
Hmm, snazzy as that is, I'm afraid it may be a bit of overkill for this
situation (I have one small square image to wrap around, always in the same
place in the upper-left corner, and only need to set the text up once at the
beginning.) I'd considered another method in my case, which would be to
break the text up into two separate, carefully lined up text objects, one
with just the three lines to the left of the image and the other below, and
then just use some sort of algorithm to determine how much of the text will
fit in the first one and dump the rest into the second. I don't want to go
really crazy with this, as it's a fairly minor design decision in this
project to even have text wrapping an image, so if it proves to be more
complicated than something I can do with a few simple tweaks, we'll probably
just change the design to make it not necessary instead.
well, it's there if you need it. Good luck on the project.