00001 #include "FTGLPixmapFont.h"
00002 #include "FTPixmapGlyph.h"
00003
00004
00005 FTGLPixmapFont::FTGLPixmapFont( const char* fontname)
00006 : FTFont( fontname)
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_Glyph* 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::Render( const char* string)
00035 {
00036 glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
00037
00038 glEnable(GL_BLEND);
00039 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00040
00041 glDisable( GL_TEXTURE_2D);
00042
00043 FTFont::Render( string);
00044
00045 glPopAttrib();
00046
00047 }
00048
00049
00050 void FTGLPixmapFont::Render( const wchar_t* string)
00051 {
00052 glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
00053 glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
00054
00055 glEnable(GL_BLEND);
00056 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00057
00058 glDisable( GL_TEXTURE_2D);
00059
00060 FTFont::Render( string);
00061
00062 glPopClientAttrib();
00063 glPopAttrib();
00064
00065 }
00066
00067