System Functions

TXH( )

Text Height

Format

TXH(string$[,chan][,ctrlopt])

Where: 

chan

Channel or logical file number of the device.

ctrlopt

Control options. Supported options for TXH( ) include:

ERR=stmtref

Error transfer

FNT="font,size[,attr]"

Font name, size, properties

SIZ="wrapwidth"

Word wrap to maximum width

string$

String expression.

Returns

Text height in graphical units (i.e. @X(col) and @Y(line) values).

Note:
For use in graphics mode along with TXW( ) Text Width.

Description

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.

Example

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$)