bool GUISetFontInfo( gui_window *wnd, char *fontinfo ) { #ifndef __OS2_PM__ HFONT font; LOGFONT lf; if( fontinfo == NULL ) { return( false ); } GetLogFontFromString( &lf, fontinfo ); font = CreateFontIndirect( &lf ); if( font == NULL ) { return( false ); } if( wnd->font != NULL ) { DeleteObject( wnd->font ); } SetFont( wnd, font ); return( true ); #else wnd = wnd; fontinfo = fontinfo; return( false ); #endif }
/* * InitMonoFont - find a mono font */ void InitMonoFont( char *app, char *inifile, int default_font, HANDLE inst ) { char str[MAX_STR]; bool need_stock; need_stock = true; GetPrivateProfileString( app, fontKey, "", str, sizeof( str ), inifile ); if( str[0] != 0 ) { if( GetLogFontFromString( &logFont, str ) ) { fixedFont = CreateFontIndirect( &logFont ); if( fixedFont != NULL ) { need_stock = false; } } } getCourierFont( inst ); if( need_stock ) { #if defined( __NT__ ) fixedFont = courierFont; #endif if( fixedFont == (HFONT)0 ) { #if defined( __NT__ ) fixedFont = GetStockObject( ANSI_FIXED_FONT ); #endif fixedFont = GetStockObject( default_font ); GetObject( fixedFont, sizeof( LOGFONT ), &logFont ); fixedFont = CreateFontIndirect( &logFont ); } else { GetObject( fixedFont, sizeof( LOGFONT ), &logFont ); } } } /* InitMonoFont */
char *GUIGetFontFromUser( char *fontinfo ) { #ifndef __OS2_PM__ LOGFONT lf; HFONT font; font = NULL; if( fontinfo != NULL ) { GetLogFontFromString( &lf, fontinfo ); font = CreateFontIndirect( &lf ); fontinfo = NULL; } if( GUIChooseFont( font, &lf, NULL ) ) { fontinfo = GetFontInfo( &lf ); } if( font != NULL ) { DeleteObject( font ); } return( fontinfo ); #else fontinfo = fontinfo; return( NULL ); #endif }