#include "font.h" #pragma comment(lib,"freetype") using namespace std; static unsigned int __numttfonts=0; static bool __isftenabled=false; static FT_Library ftlib; TrueTypeFont::TrueTypeFont(const char *file,int pt) { is_valid=true; FILE *io_test=fopen(file,"rb"); if (!io_test) { cerr<<"Failed to load font, file could not be read!"<pt=(float)pt; __numttfonts++; } TrueTypeFont::~TrueTypeFont() { if (is_valid) FT_Done_Face(face); if ((!(--__numttfonts))&&__isftenabled) { FT_Done_FreeType(ftlib); __isftenabled=false; } }