Shiny Language Reference
Language Reference > User Interface > Static Text
setstatictextfont
setstatictextfont(int ID, string Font, int Size, int RGBCol, bool Bold, bool Italic);
Synonyms:
int settextfont(int ID, string Font, int Size, int RGBCol, bool Bold, bool Italic);
Sets the font used for the static text caption
The SETSTATICTEXTFONT statement sets the font used for the text of a static text control previously created with createstatictext. Refer to setcaption for further information on setting captions.
Any change to the font is carried out immediately, and the control is redrawn to reflect the new font style.
Note that the setstatictextfontcol statement is approximately 4 times faster than this statement if the only requirement is to change the RGB colour of the font.
Parameters
ID
The control ID of the static text control you wish to change the style of
Font
The name of the font typeface
Size
The point size of the font
RGBCol
An integer representing a packed RGB colour value (refer to the RGB statement) specifying the colour of the caption textBold
True if the caption text should be bold, otherwise False.
Italic
True if the caption text should be italic, otherwise False.
Return Value
None
Example Code
// Create a 150*40 control at 10, 10 and store its ID
int FirstTextID = createstatictext(1, 10, 10, 150, 40);
// Set the text to have a horizontal, grey shaded background with border
setstatictextstyle(FirstTextID, CTRL_HGRAD, True, RGB(100, 100, 100), RGB(200, 200, 200));
// Set a caption for the control
setcaption(FirstTextID, "Here's some text");
// Set the caption font to red, 10pt Times New Roman Italic.
setstatictextfont(FirstTextID, "Times New Roman", 10, RGB(255, 0, 0), False, True);