From 247c311bd8fda86dd3970d86808d78b0a4835cc8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 18 Jun 2003 22:08:42 +0000 Subject: [PATCH] Add a question about changing fonts. (#114747) 2003-06-19 Matthias Clasen * gtk/question_index.sgml: Add a question about changing fonts. (#114747) --- docs/reference/ChangeLog | 5 +++ docs/reference/gtk/question_index.sgml | 42 ++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index dc87129ac1..55d652d1c8 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2003-06-19 Matthias Clasen + + * gtk/question_index.sgml: Add a question about changing fonts. + (#114747) + 2003-06-17 Matthias Clasen * gdk-pixbuf/Makefile.am: Add rule to regenerate man pages from diff --git a/docs/reference/gtk/question_index.sgml b/docs/reference/gtk/question_index.sgml index 6dc03c6d3d..faf59fbe52 100644 --- a/docs/reference/gtk/question_index.sgml +++ b/docs/reference/gtk/question_index.sgml @@ -615,6 +615,48 @@ background of the event box. + + +How do I change the font of a widget? + + + +This has several possible answers, depending on what exactly you want to +achieve. One option is gtk_widget_modify_font(). Note that this function can be used to change only the font size, as in the following example: + + 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); + + + +If you want to make the text of a label larger, you can use gtk_label_set_markup(): + +gtk_label_set_markup (label, "<big>big text</big>"); + +This is preferred for many apps because it's a relative size to the +user's chosen font size. See g_markup_escape_text() +if you are constructing such strings on the fly. + + +You can also change the font of a widget by putting + + gtk-font-name = "Sans 30" + +in a resource file and parsing it with gtk_rc_add_default_file(). +The advantage of a resource file is that users can then override the +font you've chosen. See +GTK+ resource files for more +discussion. + + + + How do I disable/ghost/desensitize a widget?