FTGLPixmapFont.cpp
Go to the documentation of this file.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_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::Render( const char* string)
00035 {
00036 glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
00037 glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
00038
00039 glEnable(GL_BLEND);
00040 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00041
00042 glDisable( GL_TEXTURE_2D);
00043
00044 FTFont::Render( string);
00045
00046 glPopClientAttrib();
00047 glPopAttrib();
00048 }
00049
00050
00051 void FTGLPixmapFont::Render( const wchar_t* string)
00052 {
00053 glPushAttrib( GL_ENABLE_BIT | GL_PIXEL_MODE_BIT | GL_COLOR_BUFFER_BIT);
00054 glPushClientAttrib( GL_CLIENT_PIXEL_STORE_BIT);
00055
00056 glEnable(GL_BLEND);
00057 glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00058
00059 glDisable( GL_TEXTURE_2D);
00060
00061 FTFont::Render( string);
00062
00063 glPopClientAttrib();
00064 glPopAttrib();
00065 }
00066
00067
Generated on Sun Nov 21 06:30:04 2004 for FTGL by
1.3.7