summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-02-15 22:56:52 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-02-15 22:56:52 +0100
commit77ca8de9b3fd241e3191441a5cbde69fad2bf375 (patch)
treee53cc1172beb106ec1e6b0a727cfb27b2a8f1ce3 /src/fe-gtk
parent6d894ac586a45a1651b02d3818d286fbf1b3def5 (diff)
provide a GUI field for alternative fonts, pango.aliases replacement
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/setup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 497d012d..243ebfbf 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -102,7 +102,12 @@ typedef struct
 static const setting textbox_settings[] =
 {
 	{ST_HEADER,	N_("Text Box Appearance"),0,0,0},
+#ifdef WIN32
+	{ST_EFONT,  N_("Main font:"), P_OFFSETNL(font_main), 0, 0, sizeof prefs.font_main},
+	{ST_ENTRY,  N_("Alternative fonts:"), P_OFFSETNL(font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.font_alternative},
+#else
 	{ST_EFONT,  N_("Font:"), P_OFFSETNL(font_normal), 0, 0, sizeof prefs.font_normal},
+#endif
 	{ST_EFILE,  N_("Background image:"), P_OFFSETNL(background), 0, 0, sizeof prefs.background},
 	{ST_NUMBER,	N_("Scrollback lines:"), P_OFFINTNL(max_lines),0,0,100000},
 	{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(colorednicks),
@@ -2056,6 +2061,11 @@ setup_apply_real (int new_pix, int do_ulist, int do_layout)
 static void
 setup_apply (struct xchatprefs *pr)
 {
+#ifdef WIN32
+	PangoFontDescription *old_desc;
+	PangoFontDescription *new_desc;
+	char buffer[4 * FONTNAMELEN + 1];
+#endif
 	int new_pix = FALSE;
 	int noapply = FALSE;
 	int do_ulist = FALSE;
@@ -2099,6 +2109,19 @@ setup_apply (struct xchatprefs *pr)
 
 	memcpy (&prefs, pr, sizeof (prefs));
 
+#ifdef WIN32	/* merge font_main and font_alternative into font_normal */
+	old_desc = pango_font_description_from_string (prefs.font_main);
+	sprintf (buffer, "%s,%s", pango_font_description_get_family (old_desc), prefs.font_alternative);
+	new_desc = pango_font_description_from_string (buffer);
+	pango_font_description_set_weight (new_desc, pango_font_description_get_weight (old_desc));
+	pango_font_description_set_style (new_desc, pango_font_description_get_style (old_desc));
+	pango_font_description_set_size (new_desc, pango_font_description_get_size (old_desc));
+	sprintf (prefs.font_normal, "%s", pango_font_description_to_string (new_desc));
+
+	g_free (old_desc);
+	g_free (new_desc);
+#endif
+
 	setup_apply_real (new_pix, do_ulist, do_layout);
 
 	if (noapply)