summaryrefslogtreecommitdiff
path: root/docs/reference/gtk/question_index.sgml
diff options
context:
space:
mode:
authorMatthias Clasen <maclas@gmx.de>2003-06-18 22:08:42 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2003-06-18 22:08:42 +0000
commit247c311bd8fda86dd3970d86808d78b0a4835cc8 (patch)
tree8f6997009dc53c3bacc8a13347f99dd69b88c081 /docs/reference/gtk/question_index.sgml
parent36485f1ce1e6b411022e7fcb609e182ce4bc9637 (diff)
downloadgdk-pixbuf-247c311bd8fda86dd3970d86808d78b0a4835cc8.tar.gz
Add a question about changing fonts. (#114747)
2003-06-19 Matthias Clasen <maclas@gmx.de> * gtk/question_index.sgml: Add a question about changing fonts. (#114747)
Diffstat (limited to 'docs/reference/gtk/question_index.sgml')
-rw-r--r--docs/reference/gtk/question_index.sgml42
1 files changed, 42 insertions, 0 deletions
diff --git a/docs/reference/gtk/question_index.sgml b/docs/reference/gtk/question_index.sgml
index 6dc03c6d3..faf59fbe5 100644
--- a/docs/reference/gtk/question_index.sgml
+++ b/docs/reference/gtk/question_index.sgml
@@ -617,6 +617,48 @@ background of the event box.
<qandaentry>
<question><para>
+How do I change the font of a widget?
+</para></question>
+
+<answer><para>
+This has several possible answers, depending on what exactly you want to
+achieve. One option is <link
+linkend="gtk-widget-modify-font">gtk_widget_modify_font()</link>. Note that this function can be used to change only the font size, as in the following example:
+<programlisting>
+ PangoFontDesc *font_desc = pango_font_description_new ();
+ pango_font_description_set_size (font_desc, 40);
+ gtk_widget_modify_font (widget, font);
+ pango_font_description_free (font_desc);
+</programlisting>
+</para>
+<para>
+If you want to make the text of a label larger, you can use <link
+linkend="gtk-label-set-markup">gtk_label_set_markup()</link>:
+<programlisting>
+gtk_label_set_markup (label, "&lt;big&gt;big text&lt;/big&gt;");
+</programlisting>
+This is preferred for many apps because it's a relative size to the
+user's chosen font size. See <link
+linkend="g-markup-escape-text">g_markup_escape_text()</link>
+if you are constructing such strings on the fly.
+</para>
+<para>
+You can also change the font of a widget by putting
+<programlisting>
+ gtk-font-name = "Sans 30"
+</programlisting>
+in a resource file and parsing it with <link
+linkend="gtk-rc-add-default-file">gtk_rc_add_default_file()</link>.
+The advantage of a resource file is that users can then override the
+font you've chosen. See
+<link linkend="gtk-Resource-Files">GTK+ resource files</link> for more
+discussion.
+</para>
+</answer>
+</qandaentry>
+
+<qandaentry>
+<question><para>
How do I disable/ghost/desensitize a widget?
</para></question>