memory manager published at flipcode.com. This can be turned on with the OSG_USE_MEMORY_MANGER option which then uses custom global new and delete operators as well as provide osgNew and osgDelete macro's which add ability to log line and file from which calls are made. Updated osg,osgUtil,osgDB,osgText and osgPlugins/osg to use osgNew/osgDelete, and fixed memory leaks highlighted by the new memory manager.
71 lines
1.6 KiB
C++
71 lines
1.6 KiB
C++
#include "FTGLOutlineFont.h"
|
|
#include "FTGlyphContainer.h"
|
|
#include "FTGL.h"
|
|
#include "FTOutlineGlyph.h"
|
|
|
|
|
|
FTGLOutlineFont::FTGLOutlineFont()
|
|
{}
|
|
|
|
|
|
FTGLOutlineFont::~FTGLOutlineFont()
|
|
{}
|
|
|
|
|
|
// mrn@changes
|
|
bool FTGLOutlineFont::MakeGlyphList( unsigned int renderContext)
|
|
{
|
|
FTGlyphContainer* glyphList=_contextGlyphList[renderContext];
|
|
|
|
for( unsigned int n = 0; n < numGlyphs; ++n)
|
|
{
|
|
FT_Glyph* ftGlyph = face.Glyph( n, FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP);
|
|
|
|
if( ftGlyph)
|
|
{
|
|
FTOutlineGlyph* tempGlyph = osgNew FTOutlineGlyph( *ftGlyph);
|
|
glyphList->Add( tempGlyph);
|
|
}
|
|
else
|
|
{
|
|
err = face.Error();
|
|
}
|
|
}
|
|
|
|
return !err;
|
|
}
|
|
|
|
|
|
// mrn@changes
|
|
void FTGLOutlineFont::render( const char* string, unsigned int renderContext)
|
|
{
|
|
glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_PIXEL_MODE_BIT);
|
|
|
|
glEnable( GL_LINE_SMOOTH);
|
|
glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
|
|
|
FTFont::render( string,renderContext);
|
|
|
|
glPopAttrib();
|
|
|
|
}
|
|
|
|
|
|
// mrn@changes
|
|
void FTGLOutlineFont::render( const wchar_t* string, unsigned int renderContext)
|
|
{
|
|
glPushAttrib( GL_ENABLE_BIT | GL_HINT_BIT | GL_LINE_BIT | GL_PIXEL_MODE_BIT);
|
|
|
|
glEnable( GL_LINE_SMOOTH);
|
|
glHint( GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
|
|
glEnable(GL_BLEND);
|
|
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // GL_ONE
|
|
|
|
FTFont::render( string,renderContext);
|
|
|
|
glPopAttrib();
|
|
|
|
}
|