47.10 Font specification

The Hollywood font specification is the notation that needs to be used when opening new fonts using SetFont(), OpenFont(), or @FONT. These three commands require you to pass a string describing the font you would like to open. This string must follow these guidelines:

  1. Do not specify a file, specify a font name! e.g.

     
    SetFont("dh0:Fonts/Goudyb.font", 23)   ; --> wrong!
    SetFont("Goudyb", 23)                  ; --> right!
    OpenFont(1, "c:/Windows/Fonts/Arial.ttf", 36)  ; --> wrong!
    OpenFont(1, "Arial", 36)                       ; --> right!
    

    EXCEPTION: Starting with Hollywood 4.7, there is a new font engine called #FONTENGINE_INBUILT. If you are using this engine, you can specify the font file directly, but only for *.ttf fonts! So the following code is legal with Hollywood 4.7 and up:

     
    OpenFont(1, "c:/Windows/Fonts/Arial.ttf", 36, {Engine = #FONTENGINE_INBUILT})
    

  2. On some systems font names are case sensitive when you use #FONTENGINE_NATIVE (for example on Mac OS X). Thus, you should always specify the font name in exactly the same way as it appears in the font. This can avoid potential problems.

     
    SetFont("arial", 36)  ; --> wrong!
    SetFont("Arial", 36)  ; --> right!
    

  3. For TrueType fonts, the font specification consists of two parts: 1) The face name of the font and 2) its style parameters. There must be space between the face name and the style. Also, if there are multiple styles, they must be separated by spaces. E.g.

     
    SetFont("Arial", 36)
    SetFont("Arial Bold", 36)
    SetFont("Arial Bold Italic", 36)
    

    Of course, you could also open "Arial" and then call SetFontStyle() with #BOLD or #ITALIC set, but the advantage of using it directly with SetFont() is that this will open the designed bold/italic variant of the TrueType font. SetFontStyle() on the other hand, will create bold and italic using an algorithm which does not look as good as specifically designed bold/italic font faces.

  4. Special note for AmigaOS3, MorphOS, and AROS users: FTManager often uses very awkward names for fonts. For example, if you are trying to install the font "Adobe Caslon Pro Bold Italic" FTManager will install this font as "adobecaslonprobolditalic" by default. You will then be able to open "adobecaslonprobolditalic" on AmigaOS3/MorphOS/AROS with Hollywood but of course it will not work on AmigaOS4 or Win32 or Mac OS because of this awkward font name. Thus, you should edit the font name suggestion made by FTManager in the following way:

    1. Insert spaces between the different components:

       
      "adobecaslonprobolditalic" -> "adobe caslon pro bold italic"
      

    2. Adapt the spelling to the spelling of the face name (displayed in FTManager):

       
      "adobe caslon pro bold italic" -> "Adobe Caslon Pro bold italic"
      

    3. Capitalize all style settings:

       
      "Adobe Caslon Pro bold italic" -> "Adobe Caslon Pro Bold Italic"
      

    If you follow these guidelines, the font will also work on other systems than AmigaOS3, MorphOS, and AROS.


Show TOC