Full justification

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Full justification

jim hurley-3
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"

Jim

P.S. Thanks to Phil Davis for pointing out that the formattedText of
a field separates the lines. Thanks Phil.
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

Ken Ray
On 7/30/05 9:06 AM, "Jim Hurley" <[hidden email]> 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: [hidden email]


_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

capellan
In reply to this post by jim hurley-3
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


Visit my site:
http://www.geocities.com/capellan2000/


               
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs 
 
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

jim hurley-3
In reply to this post by jim hurley-3
>
>Message: 11
>Date: Sat, 30 Jul 2005 22:27:43 -0500
>From: Ken Ray <[hidden email]>
>Subject: Re: Full justification
>To: Use Revolution List <[hidden email]>
>Message-ID: <BF11AF5F.26D58%[hidden email]>
>Content-Type: text/plain; charset="US-ASCII"
>
>On 7/30/05 9:06 AM, "Jim Hurley" <[hidden email]> 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: [hidden email]
>
>

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 <[hidden email]>
>Subject: Re: Full justification
>To: [hidden email]
>Message-ID: <[hidden email]>
>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
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

jim hurley-3
In reply to this post by jim hurley-3
P.S. To my previous post.

Re: Restoring original text

It would be a trivial task to restore the original text by deleting
all multiple space sequences and replace them with a single
space--unless the original already contained desirable, multiple
spaces.
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

Thomas McGrath III
In reply to this post by capellan
This will take care of the extra spaces just create another button and
put this in it:


on mouseUp
   repeat for each word theword in field "field"
     put theword & space after field "flush"
   end repeat
   beep
end mouseUp

Then copy the text from field "field"


Tom

On Jul 31, 2005, at 12:17 AM, Alejandro Tejada wrote:

> 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
>
>
> Visit my site:
> http://www.geocities.com/capellan2000/
>
>
>
> ____________________________________________________
> Start your day with Yahoo! - make it your home page
> http://www.yahoo.com/r/hs
>
> _______________________________________________
> use-revolution mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>


Macintosh PowerBook G-4 OSX 10.3.9, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev
2.6


Advanced Media Group
Eagle Works Art & Sculpture
Semantic Compaction Systems
Prentke Romich Company
Prentke Romich International
SCIconics, LLC
Artist
Thomas J McGrath III
[hidden email]



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

Alex Tweedly
Thomas McGrath III wrote:

> This will take care of the extra spaces just create another button and
> put this in it:
>
>
> on mouseUp
>   repeat for each word theword in field "field"
>     put theword & space after field "flush"
>   end repeat
>   beep
> end mouseUp
>
Won't that get confused by CRs and TABs (which are word boundary
characters) and double-quoted strings (which are a single word, even if
they contain spaces) ?

--
Alex Tweedly       http://www.tweedly.net



--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.338 / Virus Database: 267.9.6/59 - Release Date: 27/07/2005

_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Reply | Threaded
Open this post in threaded view
|

Re: Full justification

jim hurley-3
In reply to this post by jim hurley-3
>
>Message: 1
>Date: Sun, 31 Jul 2005 11:17:40 -0400
>From: Thomas McGrath III <[hidden email]>
>Subject: Re: Full justification
>To: How to use Revolution <[hidden email]>
>Message-ID: <[hidden email]>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>This will take care of the extra spaces just create another button and
>put this in it:
>
>
>on mouseUp
>    repeat for each word theword in field "field"
>      put theword & space after field "flush"
>    end repeat
>    beep
>end mouseUp
>
>Then copy the text from field "field"
>
>Tom


Tom,

Good. But to avoid the problems that Alex mentions, I was thinking of
something like the following:

on mouseUp
   get the htmltext of  field 1

   repeat
     replace "  " with space in it--Replace double space with single
     if offset("  ",it) is 0 then exit repeat
   end repeat

   set the htmltext of field 1 to  it
end mouseUp

Replace is very fast. It is best to work with the htmlText to avoid
changing the formatting. (It is pretty much what I do in MS Word:
replace double spaces with single spaces until Word reports no
changes.)

Jim
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution