📄 gtkfontselectiondialog.html
字号:
<HTML><HEAD><TITLE>GtkFontSelectionDialog</TITLE><METANAME="GENERATOR"CONTENT="Modular DocBook HTML Stylesheet Version 1.61"><LINKREL="HOME"TITLE="GTK+ Reference Manual"HREF="index.html"><LINKREL="UP"TITLE="GTK+ Widgets and Objects"HREF="gtkobjects.html"><LINKREL="PREVIOUS"TITLE="GtkFontSelection"HREF="gtkfontselection.html"><LINKREL="NEXT"TITLE="GtkFrame"HREF="gtkframe.html"></HEAD><BODYCLASS="REFENTRY"BGCOLOR="#FFFFFF"TEXT="#000000"LINK="#0000FF"VLINK="#840084"ALINK="#0000FF"><DIVCLASS="NAVHEADER"><TABLEWIDTH="100%"BORDER="0"BGCOLOR="#000000"CELLPADDING="1"CELLSPACING="0"><TR><THCOLSPAN="4"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="5">GTK+ Reference Manual</FONT></TH></TR><TR><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="left"><AHREF="gtkfontselection.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B><<< Previous Page</B></FONT></A></TD><TDWIDTH="25%"BGCOLOR="#0000C0"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="index.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Home</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#00C000"ALIGN="center"><FONTCOLOR="#FFFFFF"SIZE="3"><B><AHREF="gtkobjects.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Up</B></FONT></A></B></FONT></TD><TDWIDTH="25%"BGCOLOR="#C00000"ALIGN="right"><AHREF="gtkframe.html"><FONTCOLOR="#FFFFFF"SIZE="3"><B>Next Page >>></B></FONT></A></TD></TR></TABLE></DIV><H1><ANAME="GTKFONTSELECTIONDIALOG">GtkFontSelectionDialog</A></H1><DIVCLASS="REFNAMEDIV"><ANAME="AEN26330"></A><H2>Name</H2>GtkFontSelectionDialog -- a dialog box for selecting fonts.</DIV><DIVCLASS="REFSYNOPSISDIV"><ANAME="AEN26333"></A><H2>Synopsis</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> #include <gtk/gtk.h>struct <AHREF="gtkfontselectiondialog.html#GTKFONTSELECTIONDIALOG-STRUCT">GtkFontSelectionDialog</A>;<AHREF="gtkwidget.html">GtkWidget</A>* <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-NEW">gtk_font_selection_dialog_new</A> (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *title);<AHREF=../gdk/gdk-fonts.html#GDKFONT>GdkFont</A>* <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-GET-FONT">gtk_font_selection_dialog_get_font</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd);<AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A>* <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-GET-FONT-NAME">gtk_font_selection_dialog_get_font_name</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd);<AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-SET-FONT-NAME">gtk_font_selection_dialog_set_font_name</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *fontname);<AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A>* <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-GET-PREVIEW-TEXT">gtk_font_selection_dialog_get_preview_text</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd);void <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-SET-PREVIEW-TEXT">gtk_font_selection_dialog_set_preview_text</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *text);void <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-SET-FILTER">gtk_font_selection_dialog_set_filter</A> (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd, <AHREF="gtkfontselectiondialog.html#GTKFONTFILTERTYPE">GtkFontFilterType</A> filter_type, <AHREF="gtkfontselectiondialog.html#GTKFONTTYPE">GtkFontType</A> font_type, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **foundries, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **weights, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **slants, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **setwidths, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **spacings, <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> **charsets);enum <AHREF="gtkfontselectiondialog.html#GTKFONTTYPE">GtkFontType</A>;enum <AHREF="gtkfontselectiondialog.html#GTKFONTFILTERTYPE">GtkFontFilterType</A>; </PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN26368"></A><H2>Object Hierarchy</H2><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="SYNOPSIS"> <AHREF="gtkobject.html">GtkObject</A> +----<AHREF="gtkwidget.html">GtkWidget</A> +----<AHREF="gtkcontainer.html">GtkContainer</A> +----<AHREF="gtkbin.html">GtkBin</A> +----<AHREF="gtkwindow.html">GtkWindow</A> +----GtkFontSelectionDialog</PRE></TD></TR></TABLE></DIV><DIVCLASS="REFSECT1"><ANAME="AEN26376"></A><H2>Description</H2><P>The <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> widget is a dialog box for selecting a font.</P><P>To set the font which is initially selected, use<AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-SET-FONT-NAME">gtk_font_selection_dialog_set_font_name</A>().</P><P>To get the selected font use <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-GET-FONT">gtk_font_selection_dialog_get_font</A>()or <AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-GET-FONT-NAME">gtk_font_selection_dialog_get_font_name</A>().</P><P>To change the text which is shown in the preview area, use<AHREF="gtkfontselectiondialog.html#GTK-FONT-SELECTION-DIALOG-SET-PREVIEW-TEXT">gtk_font_selection_dialog_set_preview_text</A>().</P><P>Filters can be used to limit the fonts shown. There are 2 filters in the<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> - a base filter and a user filter. The base filtercan not be changed by the user, so this can be used when the user must choosefrom the restricted set of fonts (e.g. for a terminal-type application you maywant to force the user to select a fixed-width font). The user filter can bechanged or reset by the user, by using the 'Reset Filter' button or changingthe options on the 'Filter' page of the dialog.</P><DIVCLASS="EXAMPLE"><ANAME="AEN26389"></A><P><B>Example 1. Setting a filter to show only fixed-width fonts.</B></P><TABLEBORDER="0"BGCOLOR="#D8F8D8"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"> gchar *spacings[] = { "c", "m", NULL }; gtk_font_selection_dialog_set_filter (GTK_FONT_SELECTION_DIALOG (fontsel), GTK_FONT_FILTER_BASE, GTK_FONT_ALL, NULL, NULL, NULL, NULL, spacings, NULL);</PRE></TD></TR></TABLE></DIV><P>To allow only true scalable fonts to be selected use:</P><DIVCLASS="EXAMPLE"><ANAME="AEN26393"></A><P><B>Example 2. Setting a filter to show only true scalable fonts.</B></P><TABLEBORDER="0"BGCOLOR="#D8F8D8"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"> gtk_font_selection_dialog_set_filter (GTK_FONT_SELECTION_DIALOG (fontsel), GTK_FONT_FILTER_BASE, GTK_FONT_SCALABLE, NULL, NULL, NULL, NULL, NULL, NULL);</PRE></TD></TR></TABLE></DIV></DIV><DIVCLASS="REFSECT1"><ANAME="AEN26396"></A><H2>Details</H2><DIVCLASS="REFSECT2"><ANAME="AEN26398"></A><H3><ANAME="GTKFONTSELECTIONDIALOG-STRUCT"></A>struct GtkFontSelectionDialog</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING">struct GtkFontSelectionDialog;</PRE></TD></TR></TABLE><P>The <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> struct contains private data only, and shouldonly be accessed using the functions below.</P></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN26404"></A><H3><ANAME="GTK-FONT-SELECTION-DIALOG-NEW"></A>gtk_font_selection_dialog_new ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF="gtkwidget.html">GtkWidget</A>* gtk_font_selection_dialog_new (const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *title);</PRE></TD></TR></TABLE><P>Creates a new <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A>.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN26412"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>title</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the title of the dialog box.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a new <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A>. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN26426"></A><H3><ANAME="GTK-FONT-SELECTION-DIALOG-GET-FONT"></A>gtk_font_selection_dialog_get_font ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../gdk/gdk-fonts.html#GDKFONT>GdkFont</A>* gtk_font_selection_dialog_get_font (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd);</PRE></TD></TR></TABLE><P>Gets the currently-selected font.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN26433"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>fsd</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A>.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the currently-selected font, or NULL if no font is selected. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN26447"></A><H3><ANAME="GTK-FONT-SELECTION-DIALOG-GET-FONT-NAME"></A>gtk_font_selection_dialog_get_font_name ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A>* gtk_font_selection_dialog_get_font_name (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd);</PRE></TD></TR></TABLE><P>Gets the currently-selected font name.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN26454"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>fsd</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A>.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><ICLASS="EMPHASIS">Returns</I> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">the currently-selected font name, or NULL if no font is selected. </TD></TR></TBODY></TABLE><P></P></DIV></DIV><HR><DIVCLASS="REFSECT2"><ANAME="AEN26468"></A><H3><ANAME="GTK-FONT-SELECTION-DIALOG-SET-FONT-NAME"></A>gtk_font_selection_dialog_set_font_name ()</H3><TABLEBORDER="0"BGCOLOR="#D6E8FF"WIDTH="100%"CELLPADDING="6"><TR><TD><PRECLASS="PROGRAMLISTING"><AHREF=../glib/glib-basic-types.html#GBOOLEAN>gboolean</A> gtk_font_selection_dialog_set_font_name (<AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A> *fsd, const <AHREF=../glib/glib-basic-types.html#GCHAR>gchar</A> *fontname);</PRE></TD></TR></TABLE><P>Sets the currently-selected font.</P><DIVCLASS="INFORMALTABLE"><ANAME="AEN26476"></A><P></P><TABLEBORDER="0"WIDTH="100%"BGCOLOR="#FFD0D0"CELLSPACING="0"CELLPADDING="4"CLASS="CALSTABLE"><TBODY><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>fsd</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a <AHREF="gtkfontselectiondialog.html">GtkFontSelectionDialog</A>.</TD></TR><TR><TDWIDTH="20%"ALIGN="RIGHT"VALIGN="TOP"><TTCLASS="PARAMETER"><I>fontname</I></TT> :</TD><TDWIDTH="80%"ALIGN="LEFT"VALIGN="TOP">a fontname.</TD></TR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -