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 can't 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 can 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)

Example:
   If OpenWindow(0, 0, 0, 270, 160, "Loading font...", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0)) 
    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 

NB: Under Windows the font mapper will always try to find a font for you. So, for example, if you try to open a font called "Tim Now Ronin" and that font name does not exist then the font mapper will try to find the closest match based on things such as name, font height, style, etc. So do not assume that a font will not be loaded if you give a bad name or size.

Supported OS

Windows, Linux, MacOS X, AmigaOS

<- IsFont() - Font Index