09-19-2023, 12:38 AM
(09-18-2023, 11:57 PM)PhilOfPerth Wrote: Sorry to be a pain (again), but
I'm trying to come to grips with "Fonty" stuff, and am a bit (a lot) puzzled by the results of this code:
I would expect it to print a single, full line of X's. But it doesn't. I think it's to do with the font I've selected,Code: (Select All)Screen _NewImage(1024, 820, 32) ' Screen Width is 1024 pixels
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", 24, "monospace")
_Font f&
' width of "X" on current screen
CpL = _DesktopWidth \ _PrintWidth("X") ' chars per line on current screen
Print "Width of X is"; _PrintWidth("X"); ", and Chars per Line is"; CpL
Locate 10, 10
Print String$(CpL, "X");
Sleep
but I thought _PrintWidth considered that. Does it?
Divide screen Width by _PrintWidth not your whole DeskTopWidth
Code: (Select All)
Screen _NewImage(1024, 620, 32) ' Screen Width is 1024 pixels
SetFont: f& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", 24, "monospace")
_Font f&
' width of "X" on current screen
CpL = _DesktopWidth \ _PrintWidth("X") ' chars per line on current screen
Print "Width of X is"; _PrintWidth("X"); ", and Chars per Line is"; CpL
Locate 10, 10
Print String$(CpL, "X");
Sleep
CpL = _Width / _PrintWidth("W")
Print String$(CpL, "W");
b = b + ...