2005-01-23 18:54:20 +01:00
|
|
|
// $Id$
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
#ifndef __UNIFONT_H__
|
|
|
|
#define __UNIFONT_H__
|
|
|
|
|
2005-01-23 18:54:20 +01:00
|
|
|
#include <stdarg.h> // va_list
|
2004-06-16 17:36:49 +02:00
|
|
|
|
2005-01-23 18:54:20 +01: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"
|
2005-01-23 18:54:20 +01:00
|
|
|
extern 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
|
2005-01-23 18:54:20 +01:00
|
|
|
extern int unifont_unload(Handle& h);
|
2004-07-12 22:08:34 +02:00
|
|
|
|
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().
|
2005-01-23 18:54:20 +01:00
|
|
|
extern int unifont_bind(Handle h);
|
2004-06-16 17:36:49 +02:00
|
|
|
|
|
|
|
// Output text at current OpenGL modelview pos.
|
2005-01-23 18:54:20 +01:00
|
|
|
extern void glvwprintf(const wchar_t* fmt, va_list args);
|
|
|
|
extern 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-10-14 12:09:51 +02:00
|
|
|
// Get only the height
|
|
|
|
int unifont_height(const Handle h);
|
|
|
|
|
2004-11-25 00:47:48 +01:00
|
|
|
// Get only the width of one character
|
|
|
|
int unifont_character_width(const Handle h, const wchar_t& c);
|
|
|
|
|
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__
|