Blitz3D. Will the "Loadfont" function load .ttf font files?

Started by Randall_Flagg, March 05, 2025, 21:34:41

Previous topic - Next topic

Randall_Flagg

Hi all,

I am trying to use the LoadFont function to load a .ttf font file that is sat in the game directory.

I may be remembering incorrectly but I was sure that this had worked previously, but all I seem to be able to load is the fonts already installed in windows.

e.g.

example_font=loadfont("Arial",24,1); This Works

example_font=loadfont("fonts\font_file.ttf",24,1); This doesn't work but really thought that it used to... although I may be wrong about this

Any advice / explanations would be much appreciated.

Matty

Unfortunately no, the font has to be already installed on your PC in Windows in blitz3d/blitzplus to be able to load/setfont it.

Yes, it would be nice to specify  a ttf filename rather than the internal name of the font installed on your machine.

In my own games I use a number of custom fonts from time to time, but have to assume that they don't exist on other users machines and have a fallback to fonts that I believe probably do exist.

Henri

I don't have Blitz3D, but have you tried without the file extension (and maybe in the same folder as exe) ?

-Henri
- Got 01100011 problems, but the bit ain't 00000001

Randall_Flagg

Quote from: Matty on March 06, 2025, 02:44:20Unfortunately no, the font has to be already installed on your PC in Windows in blitz3d/blitzplus to be able to load/setfont it.

Yes, it would be nice to specify  a ttf filename rather than the internal name of the font installed on your machine.

In my own games I use a number of custom fonts from time to time, but have to assume that they don't exist on other users machines and have a fallback to fonts that I believe probably do exist.
Thanks for the reply and thanks for confirming.

Quote from: Henri on March 06, 2025, 11:37:41I don't have Blitz3D, but have you tried without the file extension (and maybe in the same folder as exe) ?

-Henri
Thanks for suggestion. I will give it a try.