Use ttf font in a standalone game


#1

Hi !
Is there any way to work with a ttf font file instead of a bitmapped font ?
I tried to simply change “bigchars.tga” by “DejaVuMono.ttf” which was in the same directory, but, of course, it doesn’t work well…

I enabled freetype with

make USE_FREETYPE=1

in the terminal.

Thanks in advance


#2

For compatibility with quake3 / ioquake3 engines it would probably be best to just create a replace 2d/gfx/bigchars.tga using a tools such as Quake 3 Arena Font Builder (which seems to have an expired HTTPS certificate at the moment).

Quake III: Team Arena uses pre-rendered TrueType fonts (fonts/*.dat for font information and fonts/*.tga for image data) to avoid shipping the actually TTF file as id Software was not permitted to by the font copyright holder. make USE_FREETYPE=1 allows converting TrueType font to Team Arena font by setting r_saveFontData to 1 and loading font using

fontInfo_t font;
int pointSize=16;
trap_R_RegisterFont("fonts/myfont.ttf", pointSize, &font);

Using Team Arena fonts / TrueType in Quake 3 (or actually everywhere in Team Arena) requires extensive code changes. For best results you would need to change both the engine (to render TrueType to screen resolution at run-time) and mod code to use fontInfo_t. (Note: It’s limited to the first 256 Unicode code points / ISO 8859-1.)

I’ve implemented TrueType fonts everywhere in Spearmint Quake 3 which replaces 2d/gfx/bigchars.tga with a TrueType by default. The mod code (mint-arena) is licensed as GPLv3+ with ZeniMax’s additional terms from RTCW/ET.


#3

Thanks for your interest in my problems.
I will search for a custom and a bit more modern implementation if this awesome game engine.

Thanks for your two answers and your explainations.

Have a good day !


#4

And your flavour of quake looks very nice…

I will test Spearmint on Sunday.

Have a great day !