font problem

Blitz3D Forums/Blitz3D Beginners Area/font problem

ryan scott(Posted 2006) [#1]
i have this code

fnt3x5=LoadFont("gfx\fonts\3X5_____.TTF",24)
Cls
SetFont fnt3x5
Text 0,0,"this is a TEST"
Text 0,30,fnt3x5

and a true type font in a subdir.

Is there something wrong with this method? It doesn't print in the font, that's for sure.

for the variable fnt3x5 it returns this: 11836000


Nicstt(Posted 2006) [#2]
i usually do something like this:

Global fntTimes20B = LoadFont("Times New Roman", 20, False, False, False) : If fntTimes20B = False Then RuntimeError "Can't locate the 'Font File'."

go into the font folder highlight font press f2 copy and past it to make sure have the correct name.

Docs state blitz wont work with symbol fonts (webdings and wingdings


GfK(Posted 2006) [#3]
IIRC, you have to load the font using its 'internal' name (which can be found by double-clicking a TTF file in Windows -- its shown at the very top i.e. "MyFont (TrueType)"). So, you would use:

fnt3x5=LoadFont("gfx\fonts\MyFont.TTF",24)

You might have further problems if your font's internal name contains spaces.

Oh, and I'd strongly recommend using FONText to get around the issue of TTF's all together.


big10p(Posted 2006) [#4]
Gfk in correct. The file name has to match the internal font name, or it won't load. I've just been working on getting this to work with Juicy Fonts, over the weekend. I had to read the internal name, and then make a temp copy of the file, giving it the same name as the font. Bit of a hack, but it seems to work OK.

I haven't had any problems with font names that contain spaces, though. Why could this be a problem, Gfk?


GfK(Posted 2006) [#5]
I haven't had any problems with font names that contain spaces, though. Why could this be a problem, Gfk?
Because they don't work ...or at least, they didn't. I'm going back about 4 years here.


big10p(Posted 2006) [#6]
Hmmm, It seemed to work with a test font I was using called "ace crikey", so the temp file name would have been 'ace crikey.ttf'. I think I'll go and test some more...

[edit] I've now tested with a font called "a charming font expanded" and it seems to work fine. Phew! :)


ryan scott(Posted 2006) [#7]
perfect, thanks!

that did it.