From 37f3af1139906df9837ce9de12c05606f4a28d10 Mon Sep 17 00:00:00 2001 From: Dimitur Kirov Date: Sat, 17 Sep 2005 08:32:55 +0000 Subject: [PATCH] added get_theme_font_for_option function --- src/gtkgui_helpers.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index c80ffbe4b..23704ecc7 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -21,6 +21,7 @@ import xml.sax.saxutils import gtk import gobject +import pango import os import sys from common import i18n @@ -31,7 +32,20 @@ from common import helpers screen_w = gtk.gdk.screen_width() screen_h = gtk.gdk.screen_height() - +def get_theme_font_for_option(theme, option): + ''' return string description of the font, stored in + theme preferences''' + font_name = gajim.config.get_per('themes', theme, option) + font_desc = pango.FontDescription() + font_prop_str = gajim.config.get_per('themes', theme, option + 'attrs') + if font_prop_str.find('B') != -1: + font_desc.set_weight(pango.WEIGHT_BOLD) + if font_prop_str.find('I') != -1: + font_desc.set_style(pango.STYLE_ITALIC) + fd = pango.FontDescription(font_name) + fd.merge(font_desc, True) + return fd.to_string() + def get_default_font(): ''' Get the desktop setting for application font first check for GNOME, then XFCE and last KDE