I've programmed all day, so I must be tired!
I don't understand why the font size is not taken into account in this program!!!
Thank you for your help
Code: Select all
EnableExplicit
InitSprite()
Enumeration
#FenetreWindows
#Bouton
#FenetreScreen
EndEnumeration
Global Event.i
Global Police.w
Global Libelle.s, Largeur.w, Hauteur.w
Global y.w
Global Dim TPolices.w(30)
For Police=1 To 30
TPolices(Police)=LoadFont(#PB_Any, "Calibri", Police+1)
Next Police
OpenWindow(#FenetreWindows, 0, 0, 800, 600, "Test taille polices", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#Bouton, 750, 0, 45, 20, "Quitter")
OpenWindowedScreen(WindowID(#FenetreWindows), 0, 0, 700, 550)
Libelle="Ceci est un test de police"
Repeat
Repeat
Event = WindowEvent()
Select Event
Case #PB_Event_Gadget
If EventGadget() = #Bouton
End
EndIf
Case #PB_Event_CloseWindow
End
EndSelect
Until Event = 0
ClearScreen(#White)
y=10
For Police=1 To 30
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent)
DrawingFont(TPolices(Police))
Largeur=TextWidth(Libelle)
Hauteur=TextHeight(Libelle)
DrawText(10,y,"Police=" + Str(police+9) + " " + Libelle + " = " + Str(largeur) + " pixels", #Black)
StopDrawing()
y+Hauteur+2
Next Police
FlipBuffers()
ForEver