SetFont -- change the current font
SetFont(font$, size[, table])
This function changes the current font to the one specified by font$ and size. The size argument 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:

This tag specifies which font engine Hollywood should use for this font. This can be either #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_INBUILT engine because otherwise the text look will be different from platform to platform. Another advantage of the #FONTENGINE_INBUILT engine is that you can directly specify a *.ttf file as 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_NATIVE. (V4.7)

Specifies whether or not glyph caching should be employed. Glyph caching can radically increase performance, especially on slower systems like OS3, but of course it needs more memory. Glyph caching is currently only supported by the inbuilt font engine (i.e. #FONTENGINE_INBUILT). To disable glyph caching, set this tag to False. Defaults to True. (V4.7)

Set this tag to True if you wish to pass a point size instead of a pixel size in the size argument. If you set this tag to True, SetFont() will interpret the value passed in size as 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 False. (V7.0)

When Engine has been set to #FONTENGINE_INBUILT, the CharMap tag allows you to specify the char map that the font should use. Normally, it's not necessary to set this but some fonts (e.g. Wingdings, Webdings) use custom char maps that can't be consistently mapped to Unicode. In that case, explicitly telling the font engine which char map to use can be useful. CharMap can be set to the following char maps:


The default is #CHARMAP_DEFAULT. To find out the char maps supported by a font, use the GetCharMaps() command. (V9.0)

Hollywood also comes with several inbuilt fonts which you can use. You can open these using the following special constants:

Opens an inbuilt TrueType font without serifs.

Opens an inbuilt TrueType font with serifs.

Opens an inbuilt TrueType monospace font (all characters share the same width).

Opens the default inbuilt bitmap font. This font is currently only available in size 8, i.e. like the Amiga's default topaz font.

Opens the default inbuilt TrueType font. This is currently the same as #SANS.

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.

name of the font to load (or one of the special default constants)
desired y size of the font in pixels
optional: table with further options (see above) (V4.7)
Print("Hello World")
This code sets the font to "times" with size 18 and prints "Hello World".

Show TOC