[id] = OpenFont(id, fontname$, size[, table])
fontname$
and makes it available
to your script under the specified id. If you pass Nil in id
,
OpenFont()
will automatically choose an identifier and return it. After
the font has been opened successfully, you can set it as the current font
using UseFont().
The font specified in fontname$
must adhere to the font specification.
See Font specification for details.
The optional table argument can be used to set further options. This is especially useful if you want to use Hollywood's inbuilt font engine which guarantees a pixel-perfect identical look across different platforms. See SetFont for information on what tags can be used in the optional table argument.
Normally, it is more convenient to open fonts using SetFont() directly
because it saves you the hassle of having to deal with font handles. But
in certain circumstances - for instance, if you need to switch between
different fonts a lot - it is handy to preload these fonts using OpenFont()
.
They are then available quicker to your script.
This command is also available from the preprocessor: Use @FONT to preload fonts! The advantage of using @FONT is that fonts specified in there are automatically linked to your applet/executable when compiling.
See Working with fonts for more information on using fonts in a platform-independent manner.
OpenFont(1, "Arial", 36) UseFont(1)Opens Arial in size 36 and makes it the current font.