4.4 Linking fonts

By default, Hollywood's linker will automatically link all fonts declared using the @FONT preprocessor command to the output executable or applet. If your script looks like below, for example, the font Arial will automatically be linked to your executable or applet:

@FONT 1, "Arial", 36

If you don't want that, you can set the Link tag, which is accepted by the @FONT preprocessor command, to False. In that case, the font specified in the preprocessor command will not be linked. The code looks like this then:

@FONT 1, "Arial", 36, {Link = False}

Sometimes, you might also want to link fonts that are loaded by your script at runtime into your executable or applet. Consider the following code for example:

SetFont("Arial", 36)

By default, font Arial won't be linked to your executable or applet because it wasn't declared in a preprocessor command but it is loaded at runtime using SetFont() instead. Still, it is possible to link Arial font to your executable or applet. This can be achieved by using either the ‘-linkfonts’ compiler option or the @LINKER preprocessor command.

If you choose the use the ‘-linkfonts’ compiler option, you need to pass a database file to it. The database file is a simple UTF-8 text file which contains a list of fonts to link into the applet or executable that will be compiled by Hollywood. You must only specify one font per line in the database file. Please note that you must not specify a file here, you must only specify a font name. If you specify a complete path to a font here it will not work! Just pass a list of fonts that you wish to have linked into your script. Hollywood will then automatically find the corresponding font files on your system. A font database could look like the following:

"Times New Roman"

Do not forget to use quotes when passing font names that have spaces in them!

The same can be achieved by using the @LINKER preprocessor command. The only difference is that the fonts to be linked don't have to be passed in an external database file to Hollywood, but they must be stored directly in your script as part of the @LINKER preprocessor command instead. All other rules are the same as with ‘-linkfonts’. So if you don't want to use ‘-linkfonts’ like above, you could also just add the following line to your script and achieve the same:

@LINKER {Fonts = {"Arial", "Times New Roman", "FuturaL", "helvetica"}}

You can add as many fonts as you want to have linked to your applet or executable to the Fonts tag that is part of the @LINKER preprocessor command.

Important note: Please note that most fonts are copyrighted and it is not allowed to link them into your programs without acquiring a licence. So make sure you check the licence of the font you are going to link into your program! If you do not want to pay for font licences, it is advised to use a free font such as DejaVu or Bitstream Vera or use one of the TrueType fonts that are inbuilt into Hollywood (#SANS, #SERIF, #MONOSPACE, cf. SetFont())

Show TOC