Now this may be old news to some of you, but since I just spent some time doing google searches and couldn't find any guides specifically about this I decided to write one.
Step one: find a ttf font to use (I got several nice ones from
Download Free Fonts @ 1001 Fonts .com)
load the font into your program with this:
Code:
myfont = Font.load("fontname.ttf")
you can replace "myfont" with whatever name you want
then, you need to use either one of these to set the font size(if you don't, you won't be able to see anyting printed with the font):
Code:
myfont:setCharSize(width, height, Dx, Dy)
myfont:setPixelSizes(width, height)
*edit* I didn't realize this before because I was using the variable name "font" for the fonts in my test program, but when setting the font size you need to use the variable name that you used to load the font - I.E., if you load a font into the variable verdana you set the size with verdana:setCharSize or verdana:setPixelSizes
the first goes by "point size", the second goes by actual pixels. Dx and Dy are the display resolution, not sure exactly how that part works
the following will print text using the font, then wait for input before ending the program:
Code:
green = Color.new(0,255,0)
screen:clear()
screen:fontPrint(myfont, 50, 100, "Font Test", green)
screen.flip()
while true do
pad = Controls.read()
if pad:start() then break
end
end