- 论坛徽章:
- 0
|
GtkWidget *dialog;
dialog=gtk_font_selection_dialog_new(" lease select a font:" ;
gtk_window_set_position(GTK_WINDOW (dialog),GTK_WIN_POS_CENTER);
gtk_signal_connect(GTK_OBJECT(dialog),"destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroy),&dialog);
gtk_signal_connect(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(dialog)->;ok_button),
"clicked",GTK_SIGNAL_FUNC(on_font_select_ok),
GTK_FONT_SELECTION_DIALOG(dialog));
gtk_signal_connect_object(GTK_OBJECT(GTK_FONT_SELECTION_DIALOG(dialog)->;cancel_button),
"clicked",GTK_SIGNAL_FUNC(gtk_widget_destroy),
GTK_OBJECT(dialog));
gtk_widget_show(dialog);
}
void on_font_select_ok(GtkWidget *button,GtkFontSelectionDialog *fs)
{
GdkFont *font;
font=gtk_font_selection_dialog_get_font(fs);
if(!font)
{
printf("unknow font type\n" ;
gtk_widget_destroy(GTK_WIDGET(fs));
return;
}
gtk_widget_destroy(GTK_WIDGET(fs));
}
在弹出的字体选择对话框中有ZYSong18030字体,但在on_font_selection_ok中由font=gtk_font_selection_dialog_get_font(fs);得到却是unknown font type,为什么?我的系统是Red hat9.0 环境,多谢了!!!! |
|