Changing Font Style of Text Already in a Field
J. Landman Gay
jacque at hyperactivesw.com
Fri Oct 28 21:59:25 EDT 2005
Dave Cragg wrote:
>
> On 28 Oct 2005, at 20:48, Chipp Walters wrote:
>
>> Both Klaus and Signe Marie Sanne have good suggestions for doing this:
>>
>> set the textfont of char 1 to -1 of fld "X" to to "Lucida Grande"
>>
>> Both of their solutions involve explicitly set the font of the
>> characters. Another way is to do as you do:
>>
>> set the textFont of fld "X" to "Lucida Grande"
>> put the text of fld "X" into fld "X"
>>
>> This has the added advantage if you cut and paste the text from fld
>> "X" to another fld, it doesn't automatically take the font settings
>> with it.
>
>
> And just for variety (or confusion perhaps), this will do essentially
> the same as Chipp's suggestion.
>
> set the textfont of char 1 to -1 of fld "X" to empty
> set the textFont of fld "X" to "Lucida Grande"
And, just for more variety, this will salvage any existing text styling
while changing the font. Note that it only works if the text has no font
settings at the character level:
put the htmlText of fld "x" into tText
set the textFont of fld "x" to "Lucida Grande"
set the htmlText of fld "x" to tText
If the original text has both style and font settings at the character
level, then the font setting of the characters will take precedence. The
above only works with text that inherits its font from the field.
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list