Example #1
0
static TWindow *select_font (ttk_menu_item *item) 
{
    ttk_fontinfo *fi = (ttk_fontinfo *)item->data;

    ttk_done_font (ttk_textfont);
    ttk_done_font (ttk_menufont);

    ttk_textfont = ttk_get_font (fi->name, fi->size);
    ttk_menufont = ttk_get_font (fi->name, fi->size);
    ttk_epoch++;
    save_font (fi);
    return TTK_MENU_UPONE;
}
Example #2
0
static void choose_font(void)
{
    CHOOSEFONT cf;

    memset(&cf, 0, sizeof(CHOOSEFONT));
    cf.lStructSize=sizeof(CHOOSEFONT);
    cf.hwndOwner=wndMain;
    cf.Flags=CF_FIXEDPITCHONLY|CF_NOSCRIPTSEL|CF_SCREENFONTS|CF_INITTOLOGFONTSTRUCT;
    cf.lpLogFont=&df;
    if (!ChooseFont(&cf))
        return;
    save_font();
    draw_free();
    draw_init(&df);
    InvalidateRect(termwnd, 0, 1);
}
Example #3
0
File: FED.C Project: MegaGod/TW
void file_menu( void ) {
	static saved = 1;
	char *buff, ans[2] = "y";
	static char *menu[] = {
		"Main Menu",
		" 1.load screen font",
		" 2.load italic screen font",
		" 3.load 9 pins font",
		" 4.load italic 9 pins font",
		" 5.load 24 pins font",
		" 6.load italic 24 pins font",
		" 7.load super&subscript font",
		" 8.load italic superscript",
		" 9.load .FED file",
		"10.save font file",
		"11.continue working",
		"12.exit",
		0 };
	while ( 1 ) {
		switch ( popup_menu( menu, &buff ) ) {
		case 0:
			new_load = SCR_FONT;
			break;
		case 1:
			new_load = ITALIC_SCR_FONT;
			break;
		case 2:
			new_load = PRN_FONT;
			break;
		case 3:
			new_load = ITALIC_PRN_FONT;
			break;
		case 4:
			new_load = LQ_FONT;
			break;
		case 5:
			new_load = ITALIC_LQ_FONT;
			break;
		case 6:
			new_load = SUP_SUB_LQ_FONT;
			break;
		case 7:
			new_load = ITALIC_SUP_SUB_LQ_FONT;
			break;
		case 8:
			new_load = FED_FONT;
			break;
		case 9:
			if ( loaded ) {
				if ( save_font( ) ) {
					saved = !0;
				}
			} else {
				error_message( "You haven't load font yet!" );
			}
			remove_menu( &buff );
			continue;
		case 10:
			if ( first_file ) {
				error_message( "You haven't load font yet!" );
				remove_menu( &buff );
				continue;
			}
			remove_menu( &buff );
			new_load = 0;
			first_file = 0;
			return;
		case 11:
			if ( !saved ) {
				switch ( immediatebox( 40, 10, NOTSAVEPROMPT, ans ) ) {
				case 1:
					if ( save_font( ) ) {
						terminate( );
						exit( 0 );
					} else {
						remove_menu( &buff );
						continue;
					}
				case 0:
					terminate( );
					exit( 0 );
				case -1:
					remove_menu( &buff );
					return;
				}
			} else {
				terminate( );
				exit( 0 );
			}
		}

		if ( new_load ) {
			if ( !saved ) {
				switch ( immediatebox( 40, 10, NOTSAVEPROMPT, ans ) ) {
				case 1:
					if ( save_font( ) ) {
						saved = !0;
					} else {
						remove_menu( &buff );
						new_load = 0;
						continue;
					}
					break;
				case 0:
					break;
				case -1:remove_menu( &buff );
					new_load = 0;
					continue;
				}
			}

			if ( load_font( ) ) {
				clearworkarea( );
				print_table( 0 );
				loaded = new_load;
				new_load = 0;
				first_file = 0;
				saved = 0;
				free( buff );
				return;
			} else {
				remove_menu( &buff );
				continue;
			}
		}
	}
}
Example #4
0
File: svg.hpp Project: respu/niji
 void text(dpoint const& pt, std::string const& str, font const& f)
 {
     out << "<text x=\"" << pt.x << "\" y=\"" << pt.y << "\" ";
     save_font(out, f);
     out << " >" << str << "</text>";
 }