;
; ------------------------------------------------------------
;
;   PureBasic - Font example file
;
;    (c) 2001 - Fantaisie Software
;
; ------------------------------------------------------------
;
; NOTE: This file doesn't compile with the demo version !
;

LoadFont (0, "Courier", 15)            ; Load Courrier Font, Size 15
LoadFont (1, "Arial", 30)              ; Load Arial Font, Size 30

;
;-------- Open our Window --------
;

If OpenWindow(0, 100, 200, 500, 150, "Font Test") = 0
    MessageRequester("Error", "Can't open Window", 0)
    End
EndIf

;
; This is the 'event loop'. All the user actions are processed here.
; It's very easy to understand: when an action occurs, the EventID
; isn't 0 and we just have to see what have happened...
;

Repeat
  ;
  Repeat
      EventID = WaitWindowEvent()
  Until EventID <> 0
  ;
  If EventID = #PB_Event_Repaint         ; If the user has resized the window or anything, 
      Gosub SomeGraphics                ; we will repaint our graphic
  EndIf
  ;
Until EventID = #PB_Event_CloseWindow    ; If the user has pressed on the close button

End                                         ; All the opened windows are closed automatically by PureBasic

;-----------------------------------------
; Subroutine -> Some 2D graphics functions
;-----------------------------------------
SomeGraphics:

  If StartDrawing(WindowOutput(0))            ;
    DrawingMode(1)                          ; Transparent TextBackground
  
    DrawingFont(FontID(0))                 ; Use the 'Courier' font

    DrawText(10,10, "Font: Courier - Size: 15")    ; Print our text
                
    DrawingFont(FontID(1))                 ; Use the Arial font
  
    DrawText(10,40, "Font: Arial - Size: 30")      ; Print our text

    StopDrawing()                           ; This is absolutely needed when the drawing operations are 
  EndIf                                    ; finished !!! Never forget it !
Return