⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gtkfontsel.c

📁 这些GTK+程序都是基于常用的API来实现熟悉这些API为目的
💻 C
字号:
/* * * Sample Code for Gtk+ Programming in C, 1st Edition, Prentice Hall * * Copyright 2000 - 2002 Syd Logan, All Rights Reserved * * This code is distributed without warranty. You are free to use this * code for any purpose, however, if this code is republished or * redistributed in its original form, as hardcopy or electronically, * then you must include this copyright notice along with the code. * * Questions or comments regarding this code or any bugs it contains can * be directed to the author via e-mail at slogan@cts.com **/#include <gtk/gtk.h>#include <sys/stat.h>voidFontSelOk(GtkWidget *w, gpointer arg){	GtkFontSelectionDialog *fontSel = (GtkFontSelectionDialog *) arg;	char *fontName, *text;	GdkFont *font;	fontName = gtk_font_selection_dialog_get_font_name(fontSel);	printf( "font name is %s\n", fontName );	text = gtk_font_selection_dialog_get_preview_text(fontSel);	printf( "preview text is %s\n", text );	font = gtk_font_selection_dialog_get_font(fontSel);}main( int argc, char *argv[] ){	GtkWidget *fontSel;	gboolean ret;	char *foundries[] = { "bitstream", NULL };	char *weights[] = { "bitstream", NULL };	char *slants[] = { "bitstream", NULL };	char *setwidths[] = { "bitstream", NULL };	char *spacings[] = { "bitstream", NULL };	char *charsets[] = { "iso8859-1", NULL };	gtk_init( &argc, &argv );	fontSel = gtk_font_selection_dialog_new("Font Selection");	gtk_widget_show( fontSel );#if 1	gtk_font_selection_dialog_set_filter(GTK_FONT_SELECTION_DIALOG(fontSel),		GTK_FONT_FILTER_USER, GTK_FONT_ALL, 		foundries, NULL, NULL, NULL, NULL, charsets );#endif#if 0	ret = gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG( fontSel ),		"lalalalala" );#endif#if 0	ret = gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG( fontSel ),		"-urw-century schoolbook l-medium-r-normal--15-140-75-75-p-82-iso8859-1" );#endif	ret = gtk_font_selection_dialog_set_font_name( GTK_FONT_SELECTION_DIALOG( fontSel ),		"-bitstream-courier-medium-r-normal--15-140-75-75-m-90-iso8859-1" );	printf( "ret is %d\n", ret );	gtk_main();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -