Flow/wrap text into an irregular shape

Roger Eller roger.e.eller at sealedair.com
Fri Dec 27 21:10:20 EST 2013


Scott, yes.  I am just getting started with this "experiment".  This script
is just the basic setup.  Next, I want a block of text to "flow" into the
triangle, or at least appear to.  And what to do about text overflow?  Show
a custom scroller...  I haven't fully thought it through yet.

*on* mouseUp

   *set* the style of the templateGraphic to polygon

   *if* there is a grc "PolyTriangle" *then* *delete* grc "PolyTriangle"

   *create* grc "PolyTriangle"

   *set* the points of grc "PolyTriangle" to \

         "10,12" & cr \

         & "387,12" & cr \

         & "194,204" & cr \

         & "10,12"

   *if* there is a fld "triangleText" *then* *delete* fld "triangleText"

   *create* fld "triangleText"

   *set* the opaque of fld "triangleText" to false

   *set* the rect of fld "triangleText" to the rect of grc "PolyTriangle"

*end* mouseUp
~Roger


On Fri, Dec 27, 2013 at 9:01 PM, Scott Rossi <scott at tactilemedia.com> wrote:

> Hi Roger:
>
> I assume you're asking because you want to do this by script, rather than
> manually trimming text to fit.  I've done text wrapping before using a
> combination of the formattedText property and counting lines of text that
> are displayed, wordOffsets, etc.  The formattedRect property might be
> useful too.
>
> Two ways you might do this are 1) use a single field with htmlText and
> breaking lines using <br>, but you'll have to keep track of these
> (add/delete) if the text has to flow into the shape, or 2) use separate
> fields that vertically spaced using the desired line height of your text
> and break the text across the fields as needed.
>
> Regards,
>
> Scott Rossi
> Creative Director
> Tactile Media, UX/UI Design
>
>
>
>
> On 12/27/13 8:20 AM, "Roger Eller" <roger.e.eller at sealedair.com> wrote:
>
> > 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
>



More information about the use-livecode mailing list