Change the way we handle <span style='font-size: whatever;'> tags slightly.

Mon, 15 Dec 2008 01:13:17 +0000

author
Mark Doliner <markdoliner@pidgin.im>
date
Mon, 15 Dec 2008 01:13:17 +0000
changeset 25168
4f508dba5218
parent 25167
9045daa92e21
child 25169
a0b71a1e08e5

Change the way we handle <span style='font-size: whatever;'> tags slightly.
We really only support a few specific values for that css attribute--we
don't support things like "12pt" for example. But this code was setting
<font size="3"> for any unknown font-size css value. So if someone
specified a css font-size of 72px we set the font size to 3, which is
basically the default font size, which is clearly wrong.

So change this to just do nothing if we don't understand the value.

pidgin/gtkimhtml.c file | annotate | diff | comparison | revisions
--- a/pidgin/gtkimhtml.c	Mon Dec 15 00:40:36 2008 +0000
+++ b/pidgin/gtkimhtml.c	Mon Dec 15 01:13:17 2008 +0000
@@ -3126,9 +3126,15 @@
 								font->size = 6;
 							else if (g_ascii_strcasecmp(size, "xx-large") == 0)
 								font->size = 7;
-							else
-								font->size = 3;
-						    gtk_imhtml_font_set_size(imhtml, font->size);
+
+							/*
+							 * TODO: Handle other values, like percentages, or
+							 * lengths specified as em, ex, px, in, cm, mm, pt
+							 * or pc.  Or even better, use an actual HTML
+							 * renderer like webkit.
+							 */
+							if (font->size > 0)
+							    gtk_imhtml_font_set_size(imhtml, font->size);
 						}
 						else if (oldfont)
 						{

mercurial