From 98eb3d2a2c1e3938b8beb227d3e2bc6274ca71f4 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Fri, 21 Mar 2008 12:15:32 +0000 Subject: [PATCH] some experimental and pretty evil code which reduces the font size in 2008-03-21 Michael Natterer * app/widgets/gimpdock.c (gimp_dock_style_set): some experimental and pretty evil code which reduces the font size in docks by 20%. svn path=/trunk/; revision=25150 --- ChangeLog | 5 +++++ app/widgets/gimpdock.c | 30 +++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7392228d1d..36dd05ddee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-03-21 Michael Natterer + + * app/widgets/gimpdock.c (gimp_dock_style_set): some experimental + and pretty evil code which reduces the font size in docks by 20%. + 2008-03-21 Michael Natterer * app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): make sure diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c index fc65a367fe..31bd07b903 100644 --- a/app/widgets/gimpdock.c +++ b/app/widgets/gimpdock.c @@ -358,7 +358,12 @@ static void gimp_dock_style_set (GtkWidget *widget, GtkStyle *prev_style) { - gint default_height; + PangoContext *context; + PangoFontDescription *font_desc; + gint font_size; + gint default_height; + gchar *font_str; + gchar *rc_string; if (GTK_WIDGET_CLASS (parent_class)->style_set) GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style); @@ -366,6 +371,29 @@ gimp_dock_style_set (GtkWidget *widget, gtk_widget_style_get (widget, "default-height", &default_height, NULL); gtk_window_set_default_size (GTK_WINDOW (widget), -1, default_height); + + context = gtk_widget_get_pango_context (widget); + font_desc = pango_context_get_font_description (context); + font_desc = pango_font_description_copy (font_desc); + + font_size = pango_font_description_get_size (font_desc); + font_size = 0.8 * font_size; + pango_font_description_set_size (font_desc, font_size); + + font_str = pango_font_description_to_string (font_desc); + pango_font_description_free (font_desc); + + rc_string = + g_strdup_printf ("style \"gimp-dock-style\"" + "{" + " font_name = \"%s\"" + "}" + "widget_class \".*\" style \"gimp-dock-style\"", + font_str); + g_free (font_str); + + gtk_rc_parse_string (rc_string); + g_free (rc_string); } static void