LoadFont()

Syntax

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

Parameters

#Font A number to identify the new font. #PB_Any can be used to auto-generate this number.
Name$ The name of the font to load.
Height The vertical size of the font in points.
Flags (optional) A combination of the following constants:
  #PB_Font_Bold       : The font will be bold
  #PB_Font_Italic     : The font will be italic

Return value

Returns nonzero if the font was loaded successfully and zero if not. If #PB_Any was used for the #Font parameter then the generated number is returned on success.

Example

  If OpenWindow(0, 100, 200, 300, 200, "2D Drawing Test")
  
    If CreateImage(0, 300, 200)
      If StartDrawing(ImageOutput(0))
        DrawingMode(#PB_2DDrawing_Transparent)
        
        LoadFont(0, "times", 30)
        DrawingFont(FontID(0))
        DrawText(10, 50, "Hello world !", RGB(255, 0, 0))
        
        StopDrawing()
      EndIf
    EndIf
  
    ; Create a gadget to display the image
    ;  
    ImageGadget(0, 0, 0, 300, 200, ImageID(0))
  EndIf

See Also

FontID(), FreeFont()

Supported OS

All

<- IsFont() - Font Index