grafic function ttg_textsize()

T&T Grafic function ttg_textsize

This procedure immediateley returns the width and height of a text string in pixels as a string (width/height). The return value is the same format as bitmap creating commands return and you may extract the numbers using get_x() and get_y(). Check the example please.

You need not define or open a bitmap for this command and no ttg_execute() is necessary. Very helpful to right allign or center a text.

ttg_textsize() receives information about the font to be used. Please read and understand the concept of defining different fonts using ttg_font() and selecting for the text to write by ttg_fontselect(). If you want to choose a font form your Windows® font definitions, use the FoxPro® command getfont(). It returns exactly the three parameters you have to supply to ttg_textsize(). Please add the weight or normal and bold characters. A good default is 100 for normal and 300 for bold. Do not forget to set the font using ttg_font() before you print at the determined position.


1. Name of the font
2. Size of font in points
3. Attributes (B->Bold, N->Normal, I->Italic, U->Underline)
4. String to recon size for