Install fonts using 'CopyFile'
BlitzPlus Forums/BlitzPlus Programming/Install fonts using 'CopyFile'
| ||
CopyFile "Libraries\Xenotron.TTF",((SystemProperty$("windowsdir") )+"\Fonts\Xenotron.TTF") or CopyFile "Libraries\Xenotron.TTF",((SystemProperty$("windowsdir") )+"\Fonts") or windows$=SystemProperty$("windowsdir") windows$=windows$+"\Fonts\Xenotron.TTF" CopyFile "Libraries\Xenotron.TTF",windows$ or windows$=SystemProperty$("windowsdir") windows$=windows$+"\Fonts" CopyFile "Libraries\Xenotron.TTF",windows$ Neither of these two work :( Anyone know why? |
| ||
The Font needs to be installed in a font "dbase". Thats why they call it installing the font.... int AddFontResource( LPCTSTR lpszFilename // address of font-resource filename ); BOOL RemoveFontResource( LPCTSTR lpFileName // address of font-resource filename ); try the above fuction instead. Use it in userlib form. Example create file (addfont.decls) ;file content .lib gdi32.dll AddFontResource%(filename$) RemoveFontResource%(filename$) ;end filecontent after copying the font to the fonts dir, simply run this command and it should work...you doon't realy need to copy it. Just install the font on init of your program and remove it afterwards.... works on NT/95 and all win32 systems... |
| ||
So if someone else wished to play my game, they would have to install the font separately? |
| ||
...you doon't realy need to copy it. Just install the font on init of your program and remove it afterwards.... ; Blitz Example with my above userlib Global fnt$ = "xxx.ttf" y = AddFontResource(ftn$) Select y Case 0 ; font was not installed End Select x = RemoveFontResource(fnt$) Select x Case x = 1 ; font is removed Case x = 0 ; font was not removed End Select to be honest it havent tried it. But acording to windows api thats what there fuctions are for |
| ||
I always thought the font could be in the save dir as your .exe, dont have to be in the Fonts dir. Could be an probably is wrong. I'll go back into my hole now. |
| ||
@coffebean we wount know until Malice tells us what he's got cuz i don't have time to test this... |
| ||
Coffeedotbean is right. |
| ||
You could also make the setup that comes with your final program to install the font (like Inno-Setup). No need for doing it in blitz. :) And why use normal fonts, BMPFonts are quite handy and need no extra installtion?!? |
| ||
You don't want to be installing stuff to your end-user's WINDOWS directory if you can possibly avoid it. <End User> What's this file? Don't remember installing that... *click* *delete* *empty recycle bin* *Start>All Programs>Soopa Doopa Game>Soopa Doopa Game.EXE* "Memory Access Violation" <End User> WTF?!! |