Full justification

Jim Hurley jhurley at infostations.com
Sun Jul 31 10:51:55 EDT 2005


>
>Message: 11
>Date: Sat, 30 Jul 2005 22:27:43 -0500
>From: Ken Ray <kray at sonsothunder.com>
>Subject: Re: Full justification
>To: Use Revolution List <use-revolution at lists.runrev.com>
>Message-ID: <BF11AF5F.26D58%kray at sonsothunder.com>
>Content-Type: text/plain;	charset="US-ASCII"
>
>On 7/30/05 9:06 AM, "Jim Hurley" <jhurley at infostations.com> wrote:
>
>>  Perhaps another way to approach the problem of full justification for
>>  non-proportional fonts is to insert spaces whose width is set to 1
>>  point.
>>
>>  It turns out that the formatted width of the 2 point space character,
>>  with the points size set to 2 pts, (at least in Times font)  is 1
>>  point. (Pardon the dual use of the word "point.")
>>
>>  If the width needed to fill in the line, so that the text is also
>>  right-justified, is say N points, then one might distribute N spaces
>>  between intervening words (each insert is one point in width.)
>>
>>  (I ran into one of the few instances where recursion is truly
>>  useful--beside fractals and the Tower of Hanoi.)
>>
>>  To see this try (in the message box):
>>
>>  go stack url "http://home.infostations.net/jhurley/JustifyText.rev"
>
>Nicely done, Jim! Now is there was some way to determine the number of
>points needed based on different fonts and sizes, we could have a general
>purpose justification routine!
>
>
>Ken Ray
>Sons of Thunder Software
>Web site: http://www.sonsothunder.com/
>Email: kray at sonsothunder.com
>
>

Ken,

Thanks.

I am having trouble getting Run Rev to change the textfont by script. 
If one types into the msg box: "set the textfont of field 1 to 
"courier", nothing happens. Maybe it is necessary to first "select" 
the text?

I would like to be able to script:

put the textfont of field 1 into tFont
set the textfont of field 2 to tFont

But that doesn't work.

In all those instances where I have been able to get the text fonts 
the same for the two fields, the justification algorithm works just 
fine. I am justifiably pleased.

But I need to find a faithful way to get the two fields to agree. I 
am leery of making changes to the original text and applying the 
results to that field. The text is changed with the added (one point 
textsize) spaces. Maybe I'll put  the original text into a custom 
property. Maybe I'll ask the script to clone the original field.

Jim



>
>------------------------------
>
>Message: 12
>Date: Sat, 30 Jul 2005 21:17:55 -0700 (PDT)
>From: Alejandro Tejada <capellan2000 at yahoo.com>
>Subject: Re: Full justification
>To: use-revolution at lists.runrev.com
>Message-ID: <20050731041755.76016.qmail at web40511.mail.yahoo.com>
>Content-Type: text/plain; charset=iso-8859-1
>
>Hi Jim,
>
>on Sat, 30 Jul 2005
>Jim Hurley wrote:
>
>>  go stack url
>>"http://home.infostations.net/jhurley/JustifyText.rev"
>
>Jim, this is an excellent example of the problems
>that were pointed in this list, while trying to
>full justify a text field.
>
>If i copy this justified text field, all the extras
>spaces are carried with the text. :-o
>
>A handler or function that clean up the text in the
>clipboard, before pasting it, could make this
>justify handler transparent to the users. ;-)
>
>Thanks a lot for posting this stack!
>Have a nice weekend
>
>al
>


Al,

The problem with copy and paste is that it doesn't faithfully retain 
all the text properties. It would be best to apply the algorithm 
directly to the field of interest rather than paste from another 
utility field.

And the text is changed with my algorithm--extra spaces are inserted 
and they have to retain their text size, in my case that is 3, in 
order to preserve full justification.

I think what is necessary is a plug-in with a drag and drop facility. 
It should also take the original text, without the added spaces, and 
put it into a custom property so that you would be able to retrieve 
the original text if things didn't work out.  You would need that for 
protection.

Right now I am having trouble with Rev's textfont function.

Jim



More information about the use-livecode mailing list