Justify text in a field

Alejandro Tejada capellan2000 at yahoo.com
Wed Jul 27 18:23:18 EDT 2005

on Wed, 27 Jul 2005 
xavier wrote:

> only with monospace fonts...
> but it works horizontal or vertically ;)

Monospaced only! I hoped for a 
more proportional solution. ;-)

Jonathan Lynch wrote:
> You could have a script do this:
> - get the formattedrect of a block of text

Do you mean the formattedrect of a single line?

> - calculate how far from the left of the field that
> block of text needs to be
> - insert a few spaces to the left of the block of
> text

if i remember well, Colin inserted spaces between
words, and set the styles of words to extended and
condensed, but i could not find his code now. :-(

> - check the formattedrect of the block of text again
> - keep inserting (or deleting if you go too far to
> the right) spaces until item 1 of the formattedrect 
> of the block of text is close enough to be where it 
> needs to be.

In scrolling fields this could take a while.
Did you had some timings available for this
technique? In this way i could know beforehand if
it is user's friendly. 

> - if you really want to be neurotic, you can use
> spaces with a really small font size, so that the 
> width of a space is only 1 or 2 pixels!

This idea is fine and very precise,
but what will happen if you had to 
copy and paste this text elsewhere.

You'll be carrying a lot of empty space 
with the copied text, unless you perform
some cleaning up in copied text. :-(

Thanks a lot to Jonathan and Xavier for
sharing their insights!


Visit my site:

Start your day with Yahoo! - make it your home page 

More information about the Use-livecode mailing list