-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|376|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Article Home -> Graphics 2D


 
Jayenkai
Created : 28 May 2007
Edited : 28 May 2007
System : Windows
Language : Blitz

How to load Fonts!

The ludicrously complex method of loading a font in Blitz

Quite why Blitz is so awkward at loading fonts, I'm not sure. But it is, and always has been.

Here are the basic rules of Blitz Fonts.

Not all fonts will work.
Although most .ttf type fonts should work, Blitz will simply mess up certain fonts. I'm not sure why, it just does! If you try loading in a messed up font, you could end up with MAV's in your games. So be sure to double check each font before you package your final game.
Also, depending on the system, some fonts might even cause MAV's at certain sizes. For example, my old Celeron system used to have issues loading fonts at size 79! (But then, it also had issues with standard division, so..)

Name your fonts the name of the font!
That sounds obvious, but most fonts don't come packaged with the right title. It seems that most font designers still like to use 8.3 filenames, probably for extra compatibiltiy. Blitz doesn't like that, though.
Double click a font, and you'll see it's true name in the Windows Font Viewer.
Your font might be "fonta3.ttf", but in the Font Viewer it's title could be "JumboTron Happy Bold BRK (Truetype)"
You must rename your font exactly as it's shown in the Font Viewer (Which rather annoyingly doesn't let you Copy it's name!)
So your font's filename in this case should be set to "JumboTron Happy Bold BRK.ttf"

No paths in the filename.
You can't stick paths in the filename, otherwise Blitz can't find it. (Yeah... I know!!)
So when you're trying to load a font, use the ChangeDir command to hop into the directory, then load the font, then don't forget to change back to your main directory again.


Sorted!
Now you can happily use loads of fonts in your games.

 

Comments


Monday, 28 May 2007, 21:44
JL235
You can stick paths in the filename, like "fonts\myFont.ttf". I've done it, it works.