where is the q3font 1.52 source


(Keymaster) #1

I’ve scoured the intarwubz looking for this and came up empty handed. Can anyone point me in the direction of the q3font 1.52 source? There’s a bug related to glyph offsets that I’d like to see if I can fix. I’m not terribly fond of tweaking the .fnt and recompiling for every new render :stuck_out_tongue: Okay thanks bye!

P.S. I thought about just fixing it in the 1.00 source but I like the way 1.52 renders the glyphs better


(Aarsbuds0r) #2

This program is absolutely great :smiley: Hope you can even further improve it.


(Ragnar_40k) #3

Afaik a font for q3 is just a dump of a fontInfo_t structure (defined in q_shared.h). And the letters are stored in the alpha channel of tga-files (these are the shaders). Take a look in the .dat-files and the corresponding .tga-files.

#define	MAX_QPATH			64		// max length of a quake game pathname
.
.
.
typedef int		qhandle_t;
.
.
.
// font support 

#define GLYPH_START 0
#define GLYPH_END 255
#define GLYPH_CHARSTART 32
#define GLYPH_CHAREND 127
#define GLYPHS_PER_FONT GLYPH_END - GLYPH_START + 1
typedef struct {
	int height;       // number of scan lines
	int top;          // top of glyph in buffer
	int bottom;       // bottom of glyph in buffer
	int pitch;        // width for copying
	int xSkip;        // x adjustment
	int imageWidth;   // width of actual image
	int imageHeight;  // height of actual image
	float s;          // x offset in image where glyph starts
	float t;          // y offset in image where glyph starts
	float s2;
	float t2;
	qhandle_t glyph;  // handle to the shader with the glyph
	char shaderName[32];
} glyphInfo_t;

typedef struct {
	glyphInfo_t glyphs [GLYPHS_PER_FONT];
	float glyphScale;
	char name[MAX_QPATH];
} fontInfo_t;