2001-10-24 06:09:21 +08:00
|
|
|
#include "FTLibrary.h"
|
|
|
|
|
|
|
|
|
|
|
|
FTLibrary& FTLibrary::Instance()
|
|
|
|
{
|
|
|
|
static FTLibrary ftlib;
|
|
|
|
return ftlib;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FTLibrary::~FTLibrary()
|
|
|
|
{
|
|
|
|
if( lib != 0)
|
|
|
|
{
|
|
|
|
FT_Done_FreeType( *lib);
|
|
|
|
|
2002-03-27 07:52:52 +08:00
|
|
|
osgDelete lib;
|
2001-10-24 06:09:21 +08:00
|
|
|
lib= 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if( manager != 0)
|
|
|
|
// {
|
|
|
|
// FTC_Manager_Done( manager );
|
|
|
|
//
|
2002-03-27 07:52:52 +08:00
|
|
|
// osgDelete manager;
|
2001-10-24 06:09:21 +08:00
|
|
|
// manager= 0;
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FTLibrary::FTLibrary()
|
|
|
|
: lib(0),
|
|
|
|
err(0)
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool FTLibrary::Init()
|
|
|
|
{
|
|
|
|
if( lib != 0 )
|
|
|
|
return true;
|
|
|
|
|
2002-03-27 07:52:52 +08:00
|
|
|
lib = osgNew FT_Library;
|
2001-10-24 06:09:21 +08:00
|
|
|
|
|
|
|
err = FT_Init_FreeType( lib);
|
|
|
|
if( err)
|
|
|
|
{
|
2002-03-27 07:52:52 +08:00
|
|
|
osgDelete lib;
|
2001-10-24 06:09:21 +08:00
|
|
|
lib = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FTC_Manager* manager;
|
|
|
|
//
|
|
|
|
// if( FTC_Manager_New( lib, 0, 0, 0, my_face_requester, 0, manager )
|
|
|
|
// {
|
2002-03-27 07:52:52 +08:00
|
|
|
// osgDelete manager;
|
2001-10-24 06:09:21 +08:00
|
|
|
// manager= 0;
|
|
|
|
// return false;
|
|
|
|
// }
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|