; FontWidth Example ; ----------------- Graphics 640,480,0,2 SetBuffer BackBuffer() ; A small font for the info overlay info_font=LoadFont("Arial",14) size=24 font=LoadFont("Arial",size) While Not KeyDown(1) ; [ / ] shrink or grow the font (reloaded at the new size) If KeyHit(27) And size<36 Then FreeFont font size=size+6 font=LoadFont("Arial",size) End If If KeyHit(26) And size>12 Then FreeFont font size=size-6 font=LoadFont("Arial",size) End If Cls SetFont font ; FontWidth returns the pixel width of the font's WIDEST character - ; a safe fixed cell size, so score digits line up in neat columns w=FontWidth() h=FontHeight() score$="0057200" For i=1 To Len(score$) x=140+(i-1)*w Color 60,90,140 Rect x,200,w,h,False Color 255,255,255 Text x,200,Mid$(score$,i,1) Next SetFont info_font Color 255,255,255 Text 0,0,"[ / ] change font size Esc: exit" Text 0,20,"Arial "+size+"pt: FontWidth() = "+w+" pixel cells" Flip Wend End