; ; ------------------------------------------------------------ ; ; 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, #PB_Window_SystemMenu, "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_EventRepaint ; 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()) ; DrawingMode(1) ; Transparent TextBackground DrawingFont(UseFont(0)) ; Use the 'Courier' font Locate(10, 10) ; Set x,y position DrawText("Font: Courier - Size: 15") ; Print our text DrawingFont(UseFont(1)) ; Use the Arial font Locate(10, 40) ; Set x,y position DrawText("Font: Arial - Size: 30") ; Print our text StopDrawing() ; This is absolutely needed when the drawing operations are EndIf ; finished !!! Never forget it ! Return ; ExecutableFormat=Windows ; EOF