2004-10-06 16:00:43 +02:00
|
|
|
// $Id: unifont.h,v 1.7 2004/10/06 14:00:43 janwas Exp $
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
#ifndef __UNIFONT_H__
|
|
|
|
#define __UNIFONT_H__
|
|
|
|
|
2004-10-06 16:00:43 +02:00
|
|
|
#include "handle.h"
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Load and return a handle to the font defined
|
|
|
|
// in fn+".fnt" with texture fn+".tga"
|
2004-10-06 16:00:43 +02:00
|
|
|
Handle unifont_load(const char* fn, int scope = 0);
|
2004-06-16 17:36:49 +02:00
|
|
|
|
2004-07-12 22:08:34 +02:00
|
|
|
// Release a handle to a previously loaded font
|
|
|
|
int unifont_unload(Handle& h);
|
|
|
|
|
2004-06-16 17:36:49 +02:00
|
|
|
// Use the font referenced by h for all subsequent glwprintf() calls.
|
|
|
|
// Must be called before any glwprintf().
|
2004-09-04 22:35:12 +02:00
|
|
|
int unifont_bind(Handle h);
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
// Output text at current OpenGL modelview pos.
|
2004-09-04 22:35:12 +02:00
|
|
|
void glwprintf(const wchar_t* fmt, ...);
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
/*
|
2004-06-16 18:29:38 +02:00
|
|
|
glwprintf assumes an environment roughly like:
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
glDisable(GL_CULL_FACE);
|
|
|
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
glDisable(GL_ALPHA_TEST);
|
|
|
|
|
|
|
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
|
|
*/
|
|
|
|
|
2004-09-06 04:24:34 +02:00
|
|
|
// Intended for the GUI (hence Unicode). 'height' is roughly the height of
|
2004-09-04 22:35:12 +02:00
|
|
|
// a capital letter, for use when aligning text in an aesthetically pleasing way.
|
2004-09-06 04:24:34 +02:00
|
|
|
int unifont_stringsize(const Handle h, const wchar_t* text, int& width, int& height);
|
2004-07-14 00:48:53 +02:00
|
|
|
|
2004-06-16 17:36:49 +02:00
|
|
|
// Return spacing in pixels from one line of text to the next
|
|
|
|
int unifont_linespacing(const Handle h);
|
|
|
|
|
|
|
|
#endif // __UNIFONT_H__
|