Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields

FreeType.h

00001 #ifndef FREE_NEHE_H
00002 #define FREE_NEHE_H
00003 
00004 //FreeType Headers
00005 #include <ft2build.h>
00006 #include <freetype/freetype.h>
00007 #include <freetype/ftglyph.h>
00008 #include <freetype/ftoutln.h>
00009 #include <freetype/fttrigon.h>
00010 
00011 //OpenGL Headers 
00012 #include "../constants.h"
00013 
00014 //Some STL headers
00015 #include <vector>
00016 #include <string>
00017 #include <iostream>
00018 
00019 using namespace std;
00020 
00021 //This holds all of the information related to any
00022 //freetype font that we want to create.  
00023 struct freetype_font_data {
00024   int width[128];
00025         float h;                        
00026         GLuint * textures;      
00027         GLuint list_base;       
00028 
00029         //The init function will create a font of
00030         //of the height h from the file fname.
00031         void init(const char * fname, unsigned int h);
00032 
00033         //Free all the resources assosiated with the font.
00034         void clean();
00035 };
00036 
00037 //The flagship function of the library - this thing will print
00038 //out text at window coordinates x,y, using the font ft_font.
00039 //The current modelview matrix will also be applied to the text. 
00040 void freetype_print(const freetype_font_data &ft_font, float x, float y, const char *fmt, ...) ;
00041 void freetype_print_simple(const freetype_font_data &ft_font, float x, float y, const char *str) ;
00042 int getTextLength(const freetype_font_data &ft_font, const char *fmt, ...);
00043 int getTextLengthSimple( const freetype_font_data &ft_font, char *text );
00044 inline int getCharWidth( const freetype_font_data &ft_font, char c ) {
00045   return ft_font.width[ (unsigned char)c ];
00046 }
00047 
00048 
00049 #endif

Generated on Thu Jun 16 21:50:43 2005 for scourge by  doxygen 1.4.0