Shiny Language Reference

Language Reference > Font Functions


getfontheight

int getfontheight(font FontVar);

 

 

Returns the height in pixels of the specified font

GETFONTHEIGHT returns the height in pixels of the specified font previously created with CREATEFONT. It does not select the font for future use, so can be called at any time. Note that it is more efficient to call this function in the Render handler as it is then able to directly query Brass for the actual height of the font. Calling this function outside of the Render handler causes it to make a best-guess at the size of the font, however this "guess" will be accurate in almost all situations. Dual monitor displays and multiple resolutions are the only reasons this function will return an incorrect value.

 

Parameters

FontVar

The variable declared as type FONT to calculate the height of

 

Return Value

The height in pixels of the specified font. The height is calculated from this sample string:

AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789^,_

 

Example Code

font MyFont;
createfont(MyFont, "Arial", 12);

// Height will contain the height in pixels of the font
int Height = getfontheight(MyFont);