Hi Rob,
RTF text is not helpful here.
Text in a field of Livecode has different levels of representation.
That means:
1. Text: if you say
Code: Select all
put the text of field "url" into field "showText"
then you will get the unformatted text, no style information no nothing. The style/textFont of a default Livecode text is inherited from the stack. The stack defaults to a platform specific font and fontsize.
Code: Select all
put field "url" into field "showText"
is a variant of above form and does the same.
2. You have the HTMLtext of a field.
Code: Select all
put the htmlText of field "url" into field "showText"
will show you the style information Livecode uses to represent the text. You can also use the htmlText to copy all style information along with the text to another field. You would say, and watch for "set" since now you set a property of a field:
Code: Select all
set the htmlText of field "showText" to the htmlText of field "url"
This gives you exactly the text and the style of the text of field "url" in field "showText".
3. You have the styledText. You can say:
Code: Select all
set the styledText of field "showText" to the styledText of field "url"
Field "showText" will look exactly as field "url" as far as styles are concerned. Since styledText is a multi-level array you can currently only see what styledText contains in the debugger.
4. You have RTFText. You can say
Code: Select all
put the rtfText of field "url" into field "showText"
This shows you what RTF looks like. RTF is a format that contains all formatting information of a text, similar to htmlText but it is mainly used as a means to export text plus styling information to other word processors. That way you preserve your styling information and pass it to a different program that understands RTF text. I think all word processors do.
similarly to htmlText you can
Code: Select all
set the rtfText of field "showText" to the rtfText of field "url"
This gives you the text and styles of field "url" in field "showText"
5. You have unicodeText. The unicodeText of a field is a unicode representation of the text. It has no styling information, only text information. It is used in unicode text manipulation. You can say
Code: Select all
set the unicodeText of field "showText" to the unicodeText of field "url"
-> just text without styles.
6. you have formattedText. FormattedText of a field is a special case. It gives you the text of a field without styling but it adds a return at every line break. Suppose you have a text field that has a certain width and the text you write is more than what fits into that width the text will continue on the next line. FormattedText would return the text as is but with a return at the line break. Can be useful if you operate on text by script.
All that is going on behind the scene. RTF text is not what you want to operate on, although you could if you know the rules of the RTF format. My advice: don't even try.
All you were trying to do is change the style of a field and there are enough possibilities to do that without the need to actually work in one of above formats, you just set the textStyle or textFont or textHeight etc.
If you try above examples on two fields you will see what each does. It gives you a pretty good understanding of the way Livecode treats text field information. You also might want to look this stuff up in the User Guide and Dictionary.
Kind regards
Bernd