styling text within an LC script

Paul Dupuis paul at researchware.com
Tue Nov 10 07:39:13 EST 2015


Text in a variable (i.e "verse_line") can not be styled, at least in the
same what you style text in a field (i.e. setting the textStyle property)

To style text in a script, you either need to create the styling in a
variable as htmlText or in an array as the styledText. I think for what
you want htmlText is easier.

You example becomes something like the code below to set the 3rd item of
every lien to italics

put empty into tHTMLText
repeat for each line verse_line in field "original text"

  put "<i>"& item 3 of verse_line &"</i>" into item 3 of verse_line -- makes item 3 "italic"
  put "<p>"& verse_line &"</p>" after tHTMLText

end repeat
set the htmlText of field "original text" to tHTMLText -- or you could put the styled version in a new field if you want



On 11/10/2015 1:16 AM, Nicolas Cueto wrote:
>> Have you looked up the "HTMLText" in the dictionary.
> Yes. Thanks, though.
>
> I know LC objects can be styled. However, within a script itself? For
> example:
>
> put line verse_number of field "original text" into verse_line
> set the textStyle of item 3 of verse_line to "italic"
>
> Not that simple?
>
>
> On 10 November 2015 at 14:53, <dunbarx at aol.com> wrote:
>
>> Hi.
>>
>>
>> Have you looked up the "HTMLText" in the dictionary.
>>
>>
>> If I understand, this should help.
>>
>>
>> Craig Newman
>>
>>
>>
>> -----Original Message-----
>> From: Nicolas Cueto <niconiko at gmail.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Sent: Mon, Nov 9, 2015 9:24 pm
>> Subject: styling text within an LC script
>>
>>
>> I've a script that combines tab-delimited text. Next, how to modify my
>> script so
>> that parts of the combined text become italicized (or bold, or
>> underlined, or
>> ...)?
>>
>> The tab-delimited text is:
>>
>> -----------------------------
>> Paradiso.01 1
>> La gloria di colui che tutto move The glory of the One who
>> moves all
>> things
>> Paradiso.01 2 per l’universo penetra, e risplende permeates the
>> universe
>> and glows
>> Paradiso.01 3 in una parte più e meno altrove. in one part
>> more and in
>> another less.
>> -----------------------------
>>
>> This text
>> becomes:
>>
>> --------------------------
>> La gloria di colui che tutto move 01.1
>> per
>> l’universo penetra, e risplende
>> in una parte più e meno altrove.
>>      The glory
>> of the One who moves all things
>>      permeates the universe and glows
>>      in
>> one part more and in another less.
>> ------------------------------
>>
>> Can an LC
>> script italicize the Italian while leaving the English as is, so
>> that the
>> resulting multi-styled combined text can be copy-pasted from an LC
>> text-object
>> to another doc?
>>
>> Grazie mille.
>>
>> --
>> Nicolas
>> Cueto
>> _______________________________________________
>> 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