Topic Options
#39529 - 05/10/12 02:25 AM Determining height of a word wrapped paragraph
ShaneC Offline
OL Newbie

Registered: 04/28/11
Posts: 7
Loc: Newcastle NSW Australia
Hi all.

I'm currently working on a job that requires shaded boxes to appear behind alternate lines of text on a page. The lines appear one after the other from top of the page to the bottom.

eg:

first line of text - no shaded box
second line of text - has a shaded box behind it
third line of text - no shaded box
fourth line of text - has a shaded box behind it
etc

I've got it working OK in a press talk object by drawing a shaded box of a specific height, then repositioning and printing the text over the top of the box.

The issue I have is when any of the lines reach the maximum width possible and wraps to the next line, which causes the box to be one line too short.

What I need to be able to do is determine how much height the text will take up (when output using begin paragraph...end paragraph) before I draw the background box or text, so I know how tall to make the box before I reposition and print on top of it.

Is there a way in talk code to create the paragraph of text so I can pick up the start and end vertical positions without actually printing anything?

Kind of like stringwidth(), but for the height of the paragraph.

Any help appreciated. Thanks guys.



Edited by ShaneC (05/10/12 02:27 AM)

Top
#39532 - 05/10/12 02:24 PM Re: Determining height of a word wrapped paragraph [Re: ShaneC]
Marc-André Offline
OL Expert

Registered: 05/27/10
Posts: 208
Loc: Objectif Lune Montréal
Hi Shane,

Is there a specific reason why you are doing this in PressTalk?

Have you tried to use the Gray Bar Wizard?

Maybe that can achieve what you are trying to do, without having to manage the box with a PressTalk routine.

If the Gray Bar wizard is not what you are looking for please let us know so we can give you another sugestions.

Best Regards,

Marc
_________________________
It’s always funny until someone gets hurt, then it’s absolutely freaking hysterical.

Top
#39542 - 05/10/12 11:12 PM Re: Determining height of a word wrapped paragraph [Re: Marc-André]
ShaneC Offline
OL Newbie

Registered: 04/28/11
Posts: 7
Loc: Newcastle NSW Australia
Hi Marc

I'm using press talk so I can have more control over the output. There can be page breaks and other content in between some of the sets of repeating lines, so I found it easier to do the lot in code.

Top
#39550 - 05/14/12 02:05 AM Re: Determining height of a word wrapped paragraph [Re: ShaneC]
ShaneC Offline
OL Newbie

Registered: 04/28/11
Posts: 7
Loc: Newcastle NSW Australia
Hi Marc

I've done some experimenting with the gray bar wizard, but I don't think it will be of use in this scenario.

Any other ideas would be helpful.

All I really need to do to get my code working perfectly is to be able to figure out how much vertical height a begin paragraph..end paragraph will take (without actually printing anything) so I can draw a box of that height, with the paragraph over the top of it.

Top