Xbasic
TEXT_HEIGHT Function
Syntax
Height as N = TEXT_HEIGHT(C text)
Arguments
- text
Text The text to measure. Character
Description
Get the height of the text using the current font.
Discussion
TEXT_HEIGHT() returns the height in inches of text drawn on a bitmap. The height corresponds to the characters' cell, which includes white space above and below the visible character. Used only in the Code sections of UI_BITMAP_DRAW(), UI_SCREEN_DRAW(), and UI_PRINTER_DRAW().
The following example displays the text "Sample" centered vertically and horizontally on the bitmap. This is actually the more complicated way to write this code. Refer to BITMAP_HEIGHT()and BITMAP_WIDTH()for simpler examples.
ui_bitmap_create("test", 4, 1) ui_bitmap_draw("test", set_font("Verdana,20,biu", "blue", "white") inner_Rect(0, 0, 4, 1) text("Sample", bitmap_width("test")/2 - text_width("Sample")/2, bitmap_height("test")/2 - text_height("Sample")/2) %code%) ui_dlg_box("","{image=test}")
See Also