TXH( ) |
Text Height |
TXH(string$[,chan][,ctrlopt])
Where:
chan |
Channel or logical file number of the device. | ||||||
ctrlopt |
Control options. Supported options for TXH( ) include:
| ||||||
string$ |
String expression. |
Text height in graphical units (i.e. @X(col) and @Y(line) values).
The TXH( ) function returns text height in graphical units for the given string$. By default, if no SIZ= is specified, this function returns the height of a single line of text in either the font specified or the current font on the device specified by chan.
If you set a size, TXH( ) returns the height required to print your given text with no line exceeding the size (with word wrap enabled). The SIZ= option can be used to determine the height of the text. If the font selected indicates that the & (ampersand) character is used to denote underscored characters, TXH( ) does not include the & character during its calculations.
If chan is omitted, the system assumes it is dealing with the main window.
print 'CS'
R$="Hello World"
W=txw(R$) ! Get width of text
if W>@x(40) \
then W=@x(40) ! Force <= 40 columns
H=txh(R$,siz=W) ! Make it fit in width
print 'text'(@x(20),@y(5),@x(20)+W,@y(5)+H,R$)