Fonts in Blitzmax?

Member
Posts: 30
Joined: 2002.10
Post: #1
I don't quite get the concept of using fonts in Blitzmax.
What I want to accomplish is the following:

- When running, the program should at first analyze which fonts are installed on the system (and this has to work on both Mac OS and Windooze), then create a list of those fonts, so the user can later be presented a "choose a font" dullpown, eh pulldown.

Any ideas?

Mac games free download: http://www.zhanggames.com
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #2
Something like:

Code:
local fontsdir$
local fontslist:tlist=new tlist()
local font$

?MAC
fontsdir="~/Library/Fonts"
?WIN
fontsdir="Windows/Fonts"
?

changedir fontsdir

repeat
  font$=nextfile(fontsdir)
  if font$="" then exit
  listaddlast(fontslist,t$)
forever

Or something like that.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Member
Posts: 30
Joined: 2002.10
Post: #3
Yes, that should read out the content of the directory and store it in the list.

Questions:

a) Can I assume that the fonts-directory is the same on all systems / has a fixed place depending on the system?

b) Can I assume that the created list of fonts now contains the real names of the fonts? Or can I readout the names somehow?

c) Can I use those fonts in Blitzmax to create text on a pic? That's the main point I didn't understand yet, it seems to me like Blitzmax allows only a special format of fonts or something. Couldn't find any documentation except the reference.

What I want to create is some kind of prog which allows the user to easily design a birthdaycard using a background pic and write some text on it in different fonts, sizes and such.

Mac games free download: http://www.zhanggames.com
Quote this message in a reply
Moderator
Posts: 529
Joined: 2003.03
Post: #4
kemalyun Wrote:Yes, that should read out the content of the directory and store it in the list.

Questions:

a) Can I assume that the fonts-directory is the same on all systems / has a fixed place depending on the system?

I am not 100% on Windows. On my work PC, they are in \WINDOWS\Fonts.

On the Mac, I think you will have them in both username/Library/Fonts and /Library/Fonts...at least that's how it is on mine.

Quote:b) Can I assume that the created list of fonts now contains the real names of the fonts? Or can I readout the names somehow?

Should be the full name of the font file: i.e. whateverfont.ttf. I don't think Blitz can handle Postscript, so you might not want to add any not ending in ttf.

Quote:c) Can I use those fonts in Blitzmax to create text on a pic? That's the main point I didn't understand yet, it seems to me like Blitzmax allows only a special format of fonts or something. Couldn't find any documentation except the reference.

You can certainly do that. Blitz can even calculate the line breaks for you so you know what will fit.

As far as I know, any TrueType font is fine. Those are standard on Mac and PC.

Quote:What I want to create is some kind of prog which allows the user to easily design a birthdaycard using a background pic and write some text on it in different fonts, sizes and such.

I should mention that Blitz will have a GUI module in the next few months which would make some of this ridiculously easy for you. Maybe you might want to put this on the backburner for a bit.

If not, I'll try to help as best I can.

Good luck with it.

"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  BlitzMax tutorial? dogone 4 6,031 Oct 3, 2008 09:15 PM
Last Post: stevejohnson
  blitzmax vs flash hertzcastle 1 3,533 Apr 3, 2008 04:38 PM
Last Post: OneSadCookie
  does blitzmax still support lua? rward 5 3,911 Apr 29, 2006 09:29 AM
Last Post: Leisure Suit Lurie
  drawtext in blitzmax Najdorf 2 3,724 Sep 21, 2005 06:06 AM
Last Post: unknown
  BlitzMax Pixmap Bits Per Pixel Nick 4 5,209 Jul 22, 2005 04:03 PM
Last Post: NCarter