SetFont(font$, size[, table])
sizeargument specifies the desired font's height in pixels. The current font is used by commands like the Print() command but also by CreateTextObject(). The font specified in
font$must adhere to the Hollywood font specification. See Font specification for details.
The font style will be reset when calling this command.
Starting with Hollywood 4.7, there is an optional table argument which allows you to configure the following advanced options:
#FONTENGINE_NATIVE(uses the native font engine of the host OS) or
#FONTENGINE_INBUILT(uses the font engine built into Hollywood). If you are using TrueType fonts in your project and want your texts to look exactly the same on every platform, you must make sure that you use the
#FONTENGINE_INBUILTengine because otherwise the text look will be different from platform to platform. Another advantage of the
#FONTENGINE_INBUILTengine is that you can directly specify a
font$without the need of installing the font first on the local system. See Font specification for details. For compatibility reasons, this tag defaults to
#FONTENGINE_INBUILT). To disable glyph caching, set this tag to
False. Defaults to
Trueif you wish to pass a point size instead of a pixel size in the
sizeargument. If you set this tag to
SetFont()will interpret the value passed in
sizeas a value in points (pt) instead of pixels. Generally, it is not recommended to use this tag because point sizes always depend on the host display's dots-per-inch (DPI), but all your other graphics are typically pixel graphics which are independent of the host system's DPI settings. Thus, when integrating fonts opened using a point height with pixel graphics, those fonts can appear larger or smaller, depending on the host display's DPI settings, and mess up your design. That is why it is generally not recommended to specify the font height in points instead of pixels. Defaults to
Hollywood also comes with several inbuilt fonts which you can use. You can open these using the following special constants:
Using inbuilt fonts is helpful if you want to make sure your script works on other systems without having to install some fonts first. If you use inbuilt Hollywood fonts only your script will work immediately out of the box. Note that when you use one of the inbuilt fonts, Hollywood will automatically choose the inbuilt font engine to ensure that the font look is exactly the same on every system.
See Working with fonts for more information on using fonts in a platform-independent manner.
SetFont("times",18) Print("Hello World")This code sets the font to "times" with size 18 and prints "Hello World".