00001 #include "FTGLPixmapFont.h"
00002 #include "FTPixmapGlyph.h"
00003
00004
00005 FTGLPixmapFont::FTGLPixmapFont( const char* fontFilePath)
00006 : FTFont( fontFilePath)
00007 {}
00008
00009
00010 FTGLPixmapFont::FTGLPixmapFont( const unsigned char *pBufferBytes, size_t bufferSizeInBytes)
00011 : FTFont( pBufferBytes, bufferSizeInBytes)
00012 {}
00013
00014
00015 FTGLPixmapFont::~FTGLPixmapFont()
00016 {}
00017
00018
00019 FTGlyph* FTGLPixmapFont::MakeGlyph( unsigned int g)
00020 {
00021 FT_GlyphSlot ftGlyph = face.Glyph( g, FT_LOAD_NO_HINTING);
00022
00023 if( ftGlyph)
00024 {
00025 FTPixmapGlyph* tempGlyph = new FTPixmapGlyph( ftGlyph);
00026 return tempGlyph;
00027 }
00028
00029 err = face.Error();
00030 return NULL;
00031 }
00032
00033
00034 void FTGLPixmapFont::PreRender()
00035 {
00036 FTFont::PreRender();
00037 glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
00038 glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
00039
00040 glEnable(GL_BLEND);
00041 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00042 glEnable(GL_ALPHA_TEST);
00043 glAlphaFunc(GL_GEQUAL, 0.0625);
00044
00045 glDisable(GL_TEXTURE_2D);
00046
00047 GLfloat ftglColour[4];
00048 glGetFloatv( GL_CURRENT_RASTER_COLOR, ftglColour);
00049
00050 glPixelTransferf(GL_RED_SCALE, ftglColour[0]);
00051 glPixelTransferf(GL_GREEN_SCALE, ftglColour[1]);
00052 glPixelTransferf(GL_BLUE_SCALE, ftglColour[2]);
00053 glPixelTransferf(GL_ALPHA_SCALE, ftglColour[3]);
00054 }
00055
00056
00057 void FTGLPixmapFont::PostRender()
00058 {
00059 glPopClientAttrib();
00060 glPopAttrib();
00061 FTFont::PostRender();
00062 }