[gtkhtml/gnome-2-30] Bug #247302 - Wrong letter color with HTML content rendering
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkhtml/gnome-2-30] Bug #247302 - Wrong letter color with HTML content rendering
- Date: Fri, 23 Apr 2010 10:45:38 +0000 (UTC)
commit f76f4303573dd25c69d8a1245be8a845835deeab
Author: Milan Crha <mcrha redhat com>
Date: Fri Apr 23 12:45:03 2010 +0200
Bug #247302 - Wrong letter color with HTML content rendering
gtkhtml/htmlstyle.c | 31 ++++++++++++++++++++++++++++++-
1 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/gtkhtml/htmlstyle.c b/gtkhtml/htmlstyle.c
index 51119c1..f881b36 100644
--- a/gtkhtml/htmlstyle.c
+++ b/gtkhtml/htmlstyle.c
@@ -32,8 +32,37 @@ html_parse_color (const gchar *text,
gchar c [8];
gint len = strlen (text);
- if (gdk_color_parse (text, color))
+ if (gdk_color_parse (text, color)) {
return TRUE;
+ } else {
+ /* standard color names for HTML 4.01 */
+ static struct html_color_table {
+ const gchar *name, *value;
+ } color_tab[] = {
+ { "black", "#000000" },
+ { "silver", "#C0C0C0" },
+ { "gray", "#808080" },
+ { "white", "#FFFFFF" },
+ { "maroon", "#800000" },
+ { "red", "#FF0000" },
+ { "purple", "#800080" },
+ { "fuchsia", "#FF00FF" },
+ { "green", "#008000" },
+ { "lime", "#00FF00" },
+ { "olive", "#808000" },
+ { "yellow", "#FFFF00" },
+ { "navy", "#000080" },
+ { "blue", "#0000FF" },
+ { "teal", "#008080" },
+ { "aqua", "#00FFFF" }
+ };
+
+ gint i;
+ for (i = 0; i < G_N_ELEMENTS (color_tab); i++) {
+ if (g_ascii_strcasecmp (color_tab[i].name, text) == 0)
+ return gdk_color_parse (color_tab[i].value, color);
+ }
+ }
c [7] = 0;
if (*text != '#') {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]