Just some things that may be of use to folks who read this thread. I have found working with text properties a little confusing at times, because it is easy to forget whether, say, the textFont you are seeing in the field is one you have set yourself for that chunk of text, or inherited from the field itself, or further up the “inheritance chain”. The section in the Rev user manual about “Inheritance” explains this well, especially the role of the key word “effective”.
You can apply text properties, for example textFont, directly to chunks of text in a field:
Code: Select all
set the textFont of char 1 to 20 of card field “MyText” to arial
... or all the chars in the field:
Code: Select all
set the textFont of char 1 to (the length of card field “MyText”) of card field “MyText” to arial
... or remove settings:
Code: Select all
set the textFont of char 1 to (the length of card field “MyText”) of card field “MyText” to empty
... in which case, the textFont you will see will be that set for the field itself, or if none is set for the field, the textFont inherited from further up the “chain”. It can be useful to try these lines out on a field, and watch how the htmlText of the field changes, e.g.
Code: Select all
set the textFont of char 1 to 20 of card field “MyText” to arial
put the htmlText of card field “MyText”
... to see the effect in the message box.
Another thing to notice is that if the fixedLineHeight of the field is false, setting the textHeight has no effect, because the height of each line is determined by the size of the text on the line. If the fixedLineHeight is true, you can set the textHeight. Notice that when you set the textSize, Rev automatically adjusts the textHeight to suit (see the dictionary for details). The thing to remember is that if you set the textHeight, then the textSize, the textHeight you will see will be that automatically calculated to suit the textSize. Your textHeight setting is overridden by the textSize/textHeight combination. The script examples earlier in this thread quite correctly get the order right- set the textSize, then set the textHeight. It’s worth knowing the importance of the order.
[I had to delete and re-post this, as it seemed to get truncated when forum was upgraded]