In file libs/cs2d/openglcommon/gl2d_font.h:

class csGraphics2DOpenGLFontServer

This class contains basic code to read font information and build appropriate bitmaps in OpenGL

Public Methods

void AddFont(FontDef &addme)
Add more fonts to the font server by passing FontDef's into this method
int CountFonts()
Check how many fonts are stored in here
csGraphics2DOpenGLFontServer(FontDef *startfont = NULL)
The font server starts with 0 fonts in it, but you can pass one in immediately to the constructor and start with one font
void WriteCharacter(char writeme, int fontnumber = 0)
Draw a single character using OpenGL
void WriteCharacters(char *writeme, int fontnumber = 0)
Draw a string using OpenGL
~csGraphics2DOpenGLFontServer()
Destructor cleans up all the OpenGL mess we left around

Private Fields

int Font_Count
number of fonts currently stored here
GLuint* Font_Offsets
each font is stored as a set of opengl display lists, one per character

Private Methods

void BuildFont(FontDef &newfont)
Build a font from font data

Documentation

This class contains basic code to read font information and build appropriate bitmaps in OpenGL. It acts as a GL 'font server'. You add a font by passing in a FontDef struct (see graph2d.h), and the server will add it to the list of fonts. Destruction of the server will free up all the bitmaps currently in use. To write a series of characters, set the color and position using glColor(r,g,b) and glRasterPos2i(x,y) Note that the raster position points to the lower left corner of the first character! Then call WriteChars() with the string to print. If you want to use a different font than the default font (the first font built in the server) there exists a version of WriteChars() for that as well
int Font_Count
number of fonts currently stored here

GLuint* Font_Offsets
each font is stored as a set of opengl display lists, one per character. Each display list, or character, has a number; the number of the first character for each font is stored here

void BuildFont(FontDef &newfont)
Build a font from font data

csGraphics2DOpenGLFontServer(FontDef *startfont = NULL)
The font server starts with 0 fonts in it, but you can pass one in immediately to the constructor and start with one font. Additional fonts must be added via AddFont()

void AddFont(FontDef &addme)
Add more fonts to the font server by passing FontDef's into this method. The font bitmap data will be encoded into an openGL-friendly form

int CountFonts()
Check how many fonts are stored in here

void WriteCharacters(char *writeme, int fontnumber = 0)
Draw a string using OpenGL. It is assumed you have set up the render state using glColor and glRasterPos. to use a non-default font, pass in a second argument with the number of the font to use

void WriteCharacter(char writeme, int fontnumber = 0)
Draw a single character using OpenGL. It is assumed you have set up the render state using glColor and glRasterPos. to use a non-default font, pass in a second argument with the number of the font to use

~csGraphics2DOpenGLFontServer()
Destructor cleans up all the OpenGL mess we left around


This class has no child classes.

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de