[evolution-patches] [gtkhtml] #63508 email printout should use same type of font as displayed




Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/ChangeLog,v
retrieving revision 1.2035
diff -u -p -r1.2035 ChangeLog
--- ChangeLog	27 Aug 2004 12:08:27 -0000	1.2035
+++ ChangeLog	2 Sep 2004 09:24:23 -0000
@@ -1,3 +1,16 @@
+2004-09-02  Radek Doulik  <rodo ximian com>
+
+	* htmlprinter.c (process_attrs): get fixed style from pango family
+	attributes
+
+	* htmltextslave.c (draw_normal): add flow style when printing
+
+	* htmltext.c (html_text_change_attrs): make this method public so
+	that we can use it in htmltextslave.c
+	(html_text_calc_text_size): add flow style when printing
+
+	Fixes #63508
+
 2004-08-16  Radek Doulik  <rodo ximian com>
 
 	* htmliframe.c (html_iframe_init): load empty iframe if depth > 10
Index: htmlprinter.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmlprinter.c,v
retrieving revision 1.77
diff -u -p -r1.77 htmlprinter.c
--- htmlprinter.c	24 Jun 2004 16:34:19 -0000	1.77
+++ htmlprinter.c	2 Sep 2004 09:24:24 -0000
@@ -594,6 +594,14 @@ process_attrs (HTMLPrinter *printer, GSL
 			if (style)
 				*style |= ((HTMLPangoAttrFontSize *) attr)->style;
 			break;
+		case PANGO_ATTR_FAMILY: {
+			PangoAttrString *as = (PangoAttrString *) attr;
+
+			if (!strcmp (as->value, "Monospace")
+			    || (HTML_PAINTER (printer)->font_manager.fixed.face && !strcmp (as->value, HTML_PAINTER (printer)->font_manager.fixed.face)))
+				*style |= GTK_HTML_FONT_STYLE_FIXED;
+		}
+		break;
 		default:
 			break;
 		}
Index: htmltext.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltext.c,v
retrieving revision 1.260
diff -u -p -r1.260 htmltext.c
--- htmltext.c	4 Aug 2004 09:12:43 -0000	1.260
+++ htmltext.c	2 Sep 2004 09:24:25 -0000
@@ -57,7 +57,6 @@ static void         spell_error_destroy 
 static void         move_spell_errors       (GList *spell_errors, guint offset, gint delta);
 static GList *      remove_spell_errors     (GList *spell_errors, guint offset, guint len);
 static void         remove_text_slaves      (HTMLObject *self);
-static void         html_text_change_attrs  (PangoAttrList *attr_list, GtkHTMLFontStyle style, HTMLEngine *e, gint start_index, gint end_index, gboolean avoid_default_size);
 
 /* void
 debug_spell_errors (GList *se)
@@ -918,7 +917,19 @@ html_text_calc_text_size (HTMLText *t, H
 		char *text = t->text + start_byte_offset;
 
 		if (HTML_IS_PRINTER (painter)) {
+			HTMLClueFlow *flow = NULL;
+			HTMLEngine *e = NULL;
+
 			attrs = html_text_get_attr_list (t, start_byte_offset, start_byte_offset + (g_utf8_offset_to_pointer (text, len) - text));
+
+			if (painter->widget && GTK_IS_HTML (painter->widget))
+				e = GTK_HTML (painter->widget)->engine;
+
+			if (HTML_OBJECT (t)->parent && HTML_IS_CLUEFLOW (HTML_OBJECT (t)->parent))
+				flow = HTML_CLUEFLOW (HTML_OBJECT (t)->parent);
+
+			if (flow && e)
+				html_text_change_attrs (attrs, html_clueflow_get_default_font_style (flow), GTK_HTML (painter->widget)->engine, 0, t->text_bytes, TRUE);
 		}
 		
 		html_painter_calc_text_size (painter, text, len, pi, attrs, glyphs,
@@ -3212,7 +3223,7 @@ html_text_get_style_conflicts (HTMLText 
 	return conflicts;
 }
 
-static void
+void
 html_text_change_attrs (PangoAttrList *attr_list, GtkHTMLFontStyle style, HTMLEngine *e, gint start_index, gint end_index, gboolean avoid_default_size)
 {
 	PangoAttribute *attr;
Index: htmltext.h
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltext.h,v
retrieving revision 1.65
diff -u -p -r1.65 htmltext.h
--- htmltext.h	25 Jun 2004 15:59:12 -0000	1.65
+++ htmltext.h	2 Sep 2004 09:24:25 -0000
@@ -310,6 +310,12 @@ void               html_text_calc_text_s
 						    gint                  *width,
 						    gint                  *asc,
 						    gint                  *dsc);
+void               html_text_change_attrs          (PangoAttrList         *attr_list,
+						    GtkHTMLFontStyle       style,
+						    HTMLEngine            *e,
+						    gint                   start_index,
+						    gint                   end_index,
+						    gboolean               avoid_default_size);
 
 gboolean  html_text_is_line_break                (PangoLogAttr  attr);
 void      html_text_remove_unwanted_line_breaks  (char         *s,
Index: htmltextslave.c
===================================================================
RCS file: /cvs/gnome/gtkhtml/src/htmltextslave.c,v
retrieving revision 1.175
diff -u -p -r1.175 htmltextslave.c
--- htmltextslave.c	15 Jun 2004 15:17:24 -0000	1.175
+++ htmltextslave.c	2 Sep 2004 09:24:25 -0000
@@ -573,12 +573,26 @@ draw_normal (HTMLTextSlave *self,
 			glyphs = get_glyphs (self, p);
 
 		if (HTML_IS_PRINTER (p)) {
+			HTMLClueFlow *flow = NULL;
+			HTMLEngine *e = NULL;
+
 			gchar *text = html_text_slave_get_text (self);
 			gint start_index, end_index;
 
 			start_index = text - self->owner->text;
 			end_index = g_utf8_offset_to_pointer (text, self->posLen) - self->owner->text;
+
 			attrs = html_text_get_attr_list (self->owner, start_index, end_index);
+
+			if (p->widget && GTK_IS_HTML (p->widget))
+				e = GTK_HTML (p->widget)->engine;
+
+			if (HTML_OBJECT (self)->parent && HTML_IS_CLUEFLOW (HTML_OBJECT (self)->parent))
+				flow = HTML_CLUEFLOW (HTML_OBJECT (self)->parent);
+
+			if (flow && e)
+				html_text_change_attrs (attrs, html_clueflow_get_default_font_style (flow), GTK_HTML (p->widget)->engine,
+							start_index, end_index, TRUE);
 		}
 
 		html_painter_draw_text (p, obj->x + tx, obj->y + ty + get_ys (text, p),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]