Name
SetFontStyle -- change the style of the current font
Synopsis
SetFontStyle(style[, t])
Deprecated syntax
SetFontStyle(#SHADOW, color, distance, direction) (V2.5)
SetFontStyle(#BORDER, color, size) (V2.5)
Function
This function changes the current font's style to the one specified by style which must be any combination of the following text styles:

#NORMAL:
Reset the font style to normal. This cannot be combined with any other style flags.

#BOLD:
Set the font style to bold.

#ITALIC:
Set the font style to italic.

#UNDERLINED:
Set the font style to underlined.

#ANTIALIAS:
Set the font style to anti-alias; please note that anti-aliasing is only available for true type fonts (V2.0)

#SHADOW:
Add a shadow effect to the text. If you set this style, you can pass additional arguments in the optional table argument to control the appearance of the shadow effect. See below for details. (V2.5)

#BORDER:
Add a border effect to the text. If you set this style, you can pass additional arguments in the optional table argument to control the appearance of the border effect. See below for details. (V2.5)

To combine multiple font styles in a single call simply bit-or them with another, e.g. a call to SetFontStyle(#BOLD|#ITALIC) will set the font style to bold and italic. Obviously, the style #NORMAL is mutually exclusive and cannot be combined with any other style.

Starting with Hollywood 9.0, SetFontStyle() uses a new syntax that accepts an optional table argument that supports the following tags:

ShadowDir:
Specifies the direction of the shadow. This must be set to one of Hollywood's directional constants. This tag is only handled when the #SHADOW style has been set (see above). (V9.0)

ShadowColor:
Specifies the color of the shadow. This must be an ARGB value that can contain a transparency setting. This tag is only handled when the #SHADOW style has been set (see above). (V9.0)

ShadowSize:
Specifies the length of the shadow. This tag is only handled when the #SHADOW style has been set (see above). (V9.0)

BorderColor:
Specifies the color of the border. This must be an ARGB value that can contain a transparency setting. This tag is only handled when the #BORDER style has been set (see above). (V9.0)

BorderSize:
Specifies the size of the border. This tag is only handled when the #BORDER style has been set (see above). (V9.0)

Please note that TrueType fonts often have separate font faces for their respective styles. In that case, you should always use these specifically designed font faces because SetFontStyle() will create bold and italic styles using a custom algorithm that often does not look as good as hand-crafted bold or italic font faces do. Thus, if you are planning to use Arial in bold style, you should better use "Arial Bold" when calling SetFont() (or OpenFont() / @FONT) than using "Arial" and calling SetFontStyle() with #BOLD set afterwards.

Inputs
style
special style constant (see list above)
t
optional: table containing additional arguments (see above) (V9.0)
Example
SetFontStyle(#BOLD|#ITALIC)
The above code sets the font style to bold and italic.


SetFontStyle(#SHADOW, {ShadowColor = ARGB(128, $939393),
    ShadowSize = 16, ShadowDir = #SHDWSOUTHEAST})
The above code enables a half-transparent grey shadow which will be positioned 16 pixels to the south-east of the main text.

Show TOC