// ---------------------------------------------------------------------------- FTFont* GSystemGL::SetupFont( const char * inPath, int inFontSize ) const { FTFont * font = 0; char faceName2[40]; strcpy(faceName2, inPath); #ifdef WIN32 if( !strcmp(inPath,"Times") ) strcpy(faceName2, "times.ttf"); #endif switch (fFontType) { case kPixmapFont: // font = new FTGLPixmapFont(inPath); font = new FTGLPixmapFont((const char*)faceName2); break; case kBitmapFont: font = new FTGLBitmapFont((const char*)faceName2); break; case kOutlineFont: font = new FTGLOutlineFont((const char*)faceName2); break; case kPolygonFont: font = new FTGLPolygonFont((const char*)faceName2); glEnable( GL_TEXTURE_2D); // glBindTexture(GL_TEXTURE_2D, textureID); glDisable( GL_BLEND); break; case kExtrudeFont: font = new FTGLExtrdFont((const char*)faceName2); break; case kTextureFont: font = new FTGLTextureFont((const char*)faceName2); glEnable( GL_TEXTURE_2D); glDisable( GL_DEPTH_TEST); break; } if( !font || font->Error()) { cerr << "Failed to open font " << inPath << endl; delete font; return 0; } else { // font->Depth(20); // extrusion distance for the font. Only for FTGLExtrdFont int cmc = font->CharMapCount(); FT_Encoding encoding = ft_encoding_none; FT_Encoding* cml = font->CharMapList(); for (int i=0; i<cmc; i++) { if (i==0) encoding = cml[i]; if (cml[i] == ft_encoding_apple_roman) { encoding = ft_encoding_apple_roman; break; } } font->CharMap(encoding); font->FaceSize(inFontSize); } return font; }