Flow/wrap text into an irregular shape

dunbarx at aol.com dunbarx at aol.com
Fri Dec 27 20:11:28 EST 2013


Roger.


Sure. You could calculate a table of left and right char counts on each line, since I guess the field and grc sizes do not change (?). And then place successive chars. You can still use keyDown (semi-pseudo):


on keyDown var
  put var into char nextCharLoc of me
end keyDown


Or something like that.  But you will have to first pad your entire field with spaces. If you take a new field and do this:


put "X" into char 5 of me


The "X" will go into the first char. Same with any additional ones; they will follow the existing text. Such a command will find the correct line:


put "X" into char 5 of line 4 of me


but not the correct char location. If the field is padded, though, it should work fine.


Craig



-----Original Message-----
From: Roger Eller <roger.e.eller at sealedair.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Fri, Dec 27, 2013 6:57 pm
Subject: Re: Flow/wrap text into an irregular shape


Thanks Craig. It might be simpler to just use a monospaced font, and know
beforehand how many chars will fit each line of text, and wrap accordingly.

~Roger

On Fri, Dec 27, 2013 at 5:22 PM, <dunbarx at aol.com> wrote:

> Hi.
>
>
> This is doable. There are functions, like "the selectedLoc" that will work
> for you. If you have a field with this in its script:
>
>
>
> on keyDown
>
>   put the selectedLoc
>
>
>   pass keyDown
> end keyDown
>
>
> You can see the loc of the insertion point within whatever you are typing.
> You can determine the X value of the triangle as it crosses each line of
> text, and if less than or greater than those values, you can, perhaps, pad
> the field text with spaces until you are on the correct side of the
> graphic. Much more management will be required, especially with long words
> that might start outside the grc boundary but cross it before that word is
> finished, but, hey, you asked for it.
>
>
> Craig
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: Roger Eller <roger.e.eller at sealedair.com>
> To: How to use LiveCode <use-livecode at lists.runrev.com>
> Sent: Fri, Dec 27, 2013 4:36 pm
> Subject: Flow/wrap text into an irregular shape
>
>
>  Imagine a multi-line text field which overlays a triangle polygon, which
> is wide at the top, and comes to a point at the bottom.  I want the text to
> detect the edges of the triangle and wrap at those edges.  The result would
> be a triangle shaped body of text (centered).  My question to you is "How
> can this be achieved?"
>
> ~Roger
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list