本文整理汇总了C++中FTFont::Error方法的典型用法代码示例。如果您正苦于以下问题:C++ FTFont::Error方法的具体用法?C++ FTFont::Error怎么用?C++ FTFont::Error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FTFont
的用法示例。
在下文中一共展示了FTFont::Error方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glPixelStorei
MOboolean
moFont::Init( moFontType p_Type, moText p_fontname, MOint p_size, MOuint glid ) {
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
switch( (int)p_Type ) {
case MO_FONT_OUTLINE://3d
m_pFace = (FTFont*)new FTGLOutlineFont( p_fontname );
break;
case MO_FONT_TRANSLUCENT://2d
m_pFace = (FTFont*)new FTGLBitmapFont( p_fontname );
break;
case MO_FONT_TRANSLUCENTTEXTURE://3d
m_pFace = (FTFont*)new FTGLTextureFont( p_fontname );
break;
case MO_FONT_GRAYSCALE://2d
m_pFace = (FTFont*)new FTGLPixmapFont( p_fontname );
break;
case MO_FONT_MONOCHROME://2d
m_pFace = (FTFont*)new FTGLPixmapFont( p_fontname );
break;
case MO_FONT_SOLID://3d extruded (depth)
m_pFace = (FTFont*)new FTGLExtrdFont( p_fontname );
break;
case MO_FONT_FILLED://3d
m_pFace = (FTFont*)new FTGLPolygonFont( p_fontname );
break;
case MO_FONT_GLBUILD:
m_FontGLId = glid;
BuildFont();
break;
case MO_FONT_UNDEFINED:
MODebug2->Error(moText(" FontManager:: UNDEFINED font type"));
m_pFace = NULL;
break;
}
FTFont* FF = (FTFont*) m_pFace;
FT_Error FontError;
if (FF)
FontError = FF->Error();
if ( ( p_Type!=MO_FONT_GLBUILD && ( FF == NULL || FontError!=0 ) ) ||
( p_Type==MO_FONT_UNDEFINED ) || (p_Type==MO_FONT_GLBUILD && (int)m_FontGLId==-1)) {
MODebug2->Error(moText("FontManager: Could not construct face from ")+(moText)p_fontname);
return false;
} else {
m_Name = p_fontname;
if (FF) {
SetSize(p_size);
FF->Depth(20);
//FF->CharMap(ft_encoding_unicode);
}
return true;
}
return false;
}
示例2: RegisterFont
const bool RegisterFont(const String& filename, int pointSize, const String& nickname)
{
std::map<String,FTFont*>::iterator it = _fontCache.find(nickname);
if(it != _fontCache.end())
{
UnRegisterFont(nickname);
}
if (theWorld.IsHighResScreen())
{
pointSize = pointSize * 2;
}
FTFont *font = new FTGLTextureFont(filename.c_str());
if(font->Error())
{
sysLog.Log("Failed to open font " + filename);
return false;
}
if(!font->FaceSize(pointSize))
{
sysLog.Log("Failed to set size.");
return false;
}
font->CharMap(FT_ENCODING_NONE);
font->UseDisplayList(true);
_fontCache[nickname] = font;
return true;
}
示例3: create
FTFont* FXFontManager::create(std::string font_file, int size) {
FTFont* ft = new FTTextureFont(font_file.c_str());
if(ft->Error() || !ft->FaceSize(size)) {
delete ft;
throw FXFontException(font_file);
}
return ft;
}
示例4: AddFont
void Writter::AddFont(string iname, string fontfile, int fontsize){
FTFont* nfont = new FTTextureFont(fontfile.c_str());
if(nfont->Error())
{
fprintf(stderr, "Failed to open font %s", fontfile);
exit(1);
}
nfont->FaceSize(fontsize);
m_font_list[iname] = nfont;
}
示例5: AudicleFTGLFont
AudicleFTGLFont( char * name ) {
glEnable ( GL_TEXTURE_2D );
char fontlocation[512];
strncpy ( fontlocation, fontpath, 512 );
strncat ( fontlocation, name, 512 - strlen ( fontlocation ) );
m_font = new FTGLTextureFont ( fontlocation );
if ( m_font->Error() ) {
fprintf(stderr, "AudicleFTGLFont: font load error %d - exiting\n", m_font->Error() );
exit(1);
}
else {
if ( !m_font->FaceSize(18) ) {
fprintf(stderr, "AudicleFTGLFont: font size error %d - exiting\n", m_font->Error() );
exit(1);
}
m_name = name;
m_font->Depth(2);
m_font->CharMap(ft_encoding_unicode);
glDisable ( GL_TEXTURE_2D );
float x1, y1, z1, x2, y2, z2;
m_font->BBox( samplestring , x1, y1, z1, x2, y2, z2);
m_height = y2;
m_line_height = m_font->LineHeight();
m_height_unit_scale = 1.0 / m_height ;
m_line_unit_scale = 1.0 / m_line_height ;
m_mono_width = m_height;
}
}
示例6: draw_text
int draw_text(int corner_x, int corner_y, int size, string text, int color){
if((size > 4 || size < 1) && size < 10 ){
cerr << "FutureGL Error: FutureGL only supports 4 core font sizes\nPlease adapt your code. Sorry.\n";
return -1;
}
colors(1, color);
glTranslated(corner_x, corner_y, 0);
// Create a texture font from a TrueType file.
FTFont *font;
bool font_loaded = false;
for(int i = 0; i < num_fonts; i++){
font = new FTTextureFont(fonts[i].c_str());
if(!(font->Error())){
font_loaded = true;
break;
}
}
if(!font_loaded){
cerr << "FutureGL Error: Font not found\nTried:\n";
for(int i = 0; i < num_fonts; i++) cerr << "\t" << fonts[i] << "\n";
return -1;
}
// Set the font size and render a small text.
if(size == 1) font->FaceSize(60);
else if(size == 2) font->FaceSize(29);
else if(size == 3) font->FaceSize(10);
else if(size == 4) font->FaceSize(10);
else font->FaceSize(size);
font->Render(text.c_str());
delete(font);
glTranslated(-corner_x, -corner_y, 0);
return 0;
}
示例7: FTGLPixmapFont
// ----------------------------------------------------------------------------
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;
}