diff src/conversation.c @ 2763:477a035d81e5

[gaim-migrate @ 2776] more font stuff! yay! committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Mon, 19 Nov 2001 12:03:38 +0000
parents 367d19133917
children e5e78d42e49e
line wrap: on
line diff
--- a/src/conversation.c	Mon Nov 19 11:19:52 2001 +0000
+++ b/src/conversation.c	Mon Nov 19 12:03:38 2001 +0000
@@ -70,7 +70,8 @@
 GtkWidget *all_convos = NULL;
 static GtkWidget *convo_notebook = NULL;
 
-char fontface[64];
+char fontface[128] = { 0 };
+char fontxfld[256] = { 0 };
 int fontsize = 3;
 extern GdkColor bgcolor;
 extern GdkColor fgcolor;
@@ -502,24 +503,24 @@
 void set_font_face(char *newfont, struct conversation *c)
 {
 	char *pre_fontface;
-	int alloc = 1;
-
-	pre_fontface = g_strconcat("<FONT FACE=\"", newfont, "\">", '\0');
-
-	if (!strcmp(pre_fontface, "<FONT FACE=\"\">")) {
-		g_free(pre_fontface);
-		alloc--;
-		pre_fontface = "<FONT FACE=\"" DEFAULT_FONT_FACE "\">";
+	int i, j = 0, k = 0;
+
+
+	sprintf(c->fontxfld, "%s", newfont && *newfont ? newfont : DEFAULT_FONT_XFLD);
+	for (i = 0; i < strlen(c->fontxfld); i++) {
+		if (c->fontxfld[i] == '-') {
+			if (++j > 2)
+				break;
+		} else if (j == 2)
+			c->fontface[k++] = c->fontxfld[i];
 	}
-
-	sprintf(c->fontface, "%s", newfont ?
-		(newfont[0] ? newfont : DEFAULT_FONT_FACE) : DEFAULT_FONT_FACE);
+	c->fontface[k] = '\0';
 	c->hasfont = 1;
+
+	pre_fontface = g_strconcat("<FONT FACE=\"", c->fontface, "\">", NULL);
 	surround(c->entry, pre_fontface, "</FONT>");
 	gtk_widget_grab_focus(c->entry);
-
-	if (alloc)
-		g_free(pre_fontface);
+	g_free(pre_fontface);
 }
 
 static gint delete_all_convo(GtkWidget *w, GdkEventAny *e, gpointer d)
@@ -2150,6 +2151,7 @@
 	c->smiley_dialog = NULL;
 	c->link_dialog = NULL;
 	c->log_dialog = NULL;
+	sprintf(c->fontxfld, "%s", fontxfld);
 	sprintf(c->fontface, "%s", fontface);
 	c->hasfont = 0;
 	c->bgcol = bgcolor;
@@ -2586,6 +2588,7 @@
 		if (b->hasfont)
 			continue;
 		sprintf(b->fontface, "%s", fontface);
+		sprintf(b->fontxfld, "%s", fontxfld);
 	}
 }