LoadFont()

Syntax

Result = LoadFont(#Font, Name$, YSize [, Flags])
Description
Tries to open the specified font.

If #PB_Any is used as '#Font' parameter, the new font number will be returned as 'Result'. If 'Result' is 0, the font may not be loaded.

If another font was previously loaded with the same #Font number, then the previous font is automatically freed.

The 'Flags' parameter is optional and may be a combination of the following constants:
  #PB_Font_Bold       : The font will be bold
  #PB_Font_Italic     : The font will be italic
  #PB_Font_Underline  : The font will be underlined
  #PB_Font_StrikeOut  : The font will be strikeout
  #PB_Font_HighQuality: The font will be in high-quality mode (slower)

Note: Only #PB_Font_Bold and #PB_Font_Italic are supported on all OS. The rest are supported on Windows only.

Example:

  If OpenWindow(0, 0, 0, 270, 160, "Loading font...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    If LoadFont(1, "Arial", 24)
      SetGadgetFont(#PB_Default, FontID(1))
      TextGadget(0, 10, 10, 250, 40, "Arial 24")
    EndIf
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

Note: Under Windows the font mapper will always attempt to locate a font. If a font name which does not exist such as: "Tim Now Ronin", is used, then the font mapper will attempt to find the closest match. This will be based upon such criteria as: the font name, the font height, the style and so forth. Therefore, the assumption can not be made that a font will not be loaded, due only to an incorrect font name, size, ect...

Supported OS

All

<- IsFont() - Font Index