
-----------------------------------
GlobeTrotter
Mon Jan 31, 2005 6:07 pm

Problem with Font.Draw, simple problem.
-----------------------------------

setscreen ("graphics:200,200")
var name : string := "1234567890"
var artistFont : int := Font.New ("Lucida Console:10x" + intstr (200 div length (name)) + "")
Font.Draw (name, 0, 0, artistFont, red)


In that code, why doesn't all of the text fit in?  It simply does not make sense to me.

-----------------------------------
person
Mon Jan 31, 2005 6:24 pm


-----------------------------------
it has to do with the font u r using

-----------------------------------
GlobeTrotter
Mon Jan 31, 2005 6:27 pm


-----------------------------------
Actually, I don't think so.  Its the same thing with Arial, and others.  I intentionally tried a font that is uniform, since I thought this might have been a solution to the problem, but it wasn't

-----------------------------------
Cervantes
Mon Jan 31, 2005 6:30 pm


-----------------------------------
Perhaps because of the spacing between the numbers?
Perhaps Font.Width will be useful:

setscreen ("graphics:200,200")
var name : string := "1234567890"
var font : int
for i : 1 .. 100
    font := Font.New ("Lucida Console:10x" + intstr (i))
    exit when Font.Width (name, font) >= maxx - 5 and Font.Width (name, font) = width - (length (name) div 2) and Font.Width (name, font) 