//自动销毁字体 VOID AutoDestoryFont(HELE hEle) { HFONTX hFontx = XFont_Create(20); HFONTX hFontx1 = XFont_Create(30); XEle_SetFont(hEle,hFontx); XEle_SetFont(hEle,hFontx1); }
//手动销毁字体 VOID ManualDestoryFont(HELE hEle) { HFONTX hFontx = XFont_Create(20); XFont_EnableAutoDestroy(hFontx,FALSE); //允许手动销毁字体 HFONTX hFontx1 = XFont_Create(30); XEle_SetFont(hEle,hFontx); XEle_SetFont(hEle,hFontx1); XFont_Destroy(hFontx); }
int XFontMgr_LoadFont(XFontMgr* mgr, char *name, int size, geBoolean anti, geEngine* theEngine){ int index; geBoolean found = GE_FALSE; int i; for ( i = 0; i < kFontMax; i++ ){ // do we already have this font? if ( mgr->m_fonts[i] ){ if ( strcmp( XFont_GetName(mgr->m_fonts[i]), name ) == 0 ) if ( XFont_GetSize(mgr->m_fonts[i]) == size ) if ( XFont_IsAntiAliased(mgr->m_fonts[i]) == anti ) return i; // we've already loaded this one... } } for ( index = 0; index < kFontMax; index++ ){ if ( !mgr->m_fonts[index] ){ found = GE_TRUE; break; } } if (!found) return -1; mgr->m_fonts[index] = XFont_Font(); if( XFont_Create(mgr->m_fonts[index], name, size, anti, theEngine ) == GE_FALSE ) return -1; return index; }