incbin font

BlitzMax Forums/BlitzMax Beginners Area/incbin font

Big_Dave(Posted 2005) [#1]
Hi,

I'm running Blitzmax 1.09 under OSX Tiger and I cannot get incbin working with fonts. My code is:

Incbin "davefont.ttf"
Global newfont=LoadImageFont("incbin::davefont.ttf", 20)

Everything works OK, but as soon as I move the executable out of the folder with the font file, the game reverts back to default Blitzmax font (ie it does not seem to be including the font with the executable). I thought this was implemented in 1.06 - have I just written it wrongly?

cheers,

Dave.


DannyD(Posted 2005) [#2]
The help file includes the example below.According to it, your implementation looks correct.

Rem
IncBin embeds an external data file in a BlitzMax program that can
then be read using the "incbin::" device name.
End Rem

' code snippet from demos/firepaint/firepaint.bmx

Incbin "stars.png"

Local stars=LoadImage( "incbin::stars.png" )


Perturbatio(Posted 2005) [#3]
This works for me:
Graphics 640,480,0,0

Incbin "c:\windows\fonts\times.ttf"

Global newfont:TImageFont = LoadImageFont("incbin::c:\windows\fonts\times.ttf",20)
SetImageFont(newfont)

While Not KeyDown(KEY_ESCAPE)
	Cls
	
	DrawText "Test", MouseX(), MouseY()
	
	Flip
Wend
End


*EDIT*
it also worked when I copied times.ttf to the source folder, removed the absolute pathing then moved the resulting exe to another folder.


DannyD(Posted 2005) [#4]
Maybe it's a Macos X tiger issue ?


DannyD(Posted 2005) [#5]
I get the same problem.I include the fonts as follows

Incbin "alex.ttf"
Incbin "sphere.png"
Incbin "turbogirl.ogg"
audio=LoadSound ("incbin::turbogirl.ogg")
alex=LoadImageFont("incbin::alex.ttf",200)


but the compiled app defaults to the basic system font.


DannyD(Posted 2005) [#6]
I'm pretty sure this is a Macos bug.

Graphics 640,480,0
Incbin "alex.ttf"
Local font:TImageFont=LoadImageFont("incbin::alex.ttf",200 )
SetImageFont font
While Not KeyHit( KEY_ESCAPE )
Cls
DrawText "This is test",0,0
Flip
Wend


Works fine when I click on compile and build.However when I move the .app file to another dir it defaults to the system font.If I copy the font to that location it works fine again.


Perturbatio(Posted 2005) [#7]
I'm pretty sure this is a Macos bug.

I don't have a Mac to play with but it's a little weird if it's OSX specific since the code for loading imagefonts and the incbin code doesn't appear to have anything mac specific.


Retro(Posted 2005) [#8]
I can't get it to work either with Blitz Max 1.10 on Mac OS X 10.4.2 (Tiger). Does anyone know for certain whether it's definitely a Mac OS bug?


HopeDagger(Posted 2005) [#9]
If it works fine on Windows for everybody and doesn't work for anyone on Mac, than yes, I'd say it smells like a Mac-specific issue. ;)


Who was John Galt?(Posted 2005) [#10]
Yeah - incbin'd fonts stopped working in my project with the latest update. They're in a separate folder, so this explains it. Stuck a bug report in about a month ago.

Works fine on my Windows box, no font on OSX.


Scott Shaver(Posted 2005) [#11]
Yep IGlass has the same issue, works on Windows not on OSX


Retro(Posted 2005) [#12]
Thanks guys, it appears that LoadFont (BRL.Font) is returning a Null. I'll do some more investigating tomorrow and see if I can come up with an interim patch.

Mac 12" PB G4/1.5GHz/1.25Gb/GeForce FX Go5200/Tiger 10.4.2/Blitz Max 1.10