aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
authorRadek Doulik <rodo@ximian.com>2004-01-27 23:18:08 +0800
committerRadek Doulik <rodo@src.gnome.org>2004-01-27 23:18:08 +0800
commit398f56b8831ec87f455d25784b062485d3c18379 (patch)
tree1ef3f0b9d342f64682e1e5d830e4c94f884b09a0 /widgets/table
parent397a226fc953d9e3c43bf3636b1df81393fae500 (diff)
downloadgsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar.gz
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar.bz2
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar.lz
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar.xz
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.tar.zst
gsoc2013-evolution-398f56b8831ec87f455d25784b062485d3c18379.zip
print strikeout/underline
2004-01-27 Radek Doulik <rodo@ximian.com> * e-cell-text.c (ect_print): print strikeout/underline Fixes #32240 svn path=/trunk/; revision=24466
Diffstat (limited to 'widgets/table')
-rw-r--r--widgets/table/e-cell-text.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
index 11c5429754..d86d9a0f21 100644
--- a/widgets/table/e-cell-text.c
+++ b/widgets/table/e-cell-text.c
@@ -1304,6 +1304,9 @@ ect_print (ECellView *ecell_view, GnomePrintContext *context,
GnomeFont *font = get_font_for_size (16);
char *string;
ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
+ double ty, ly, text_width;
+ gboolean strikeout, underline;
+
string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
gnome_print_gsave(context);
if (gnome_print_moveto(context, 2, 2) == -1)
@@ -1318,8 +1321,34 @@ ect_print (ECellView *ecell_view, GnomePrintContext *context,
/* FIXME */;
if (gnome_print_clip(context) == -1)
/* FIXME */;
- gnome_print_moveto(context, 2, (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2);
+ ty = (height - gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2;
+ text_width = gnome_font_get_width_utf8 (font, string);
+
+ strikeout = ect->strikeout_column >= 0 && row >= 0 &&
+ e_table_model_value_at (ecell_view->e_table_model, ect->strikeout_column, row);
+ underline = ect->underline_column >= 0 && row >= 0 &&
+ e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
+
+ if (underline) {
+ ly = ty + gnome_font_get_underline_position (font);
+ gnome_print_newpath (context);
+ gnome_print_moveto (context, 2, ly);
+ gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
+ gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
+ gnome_print_stroke (context);
+ }
+
+ if (strikeout) {
+ ly = ty + (gnome_font_get_ascender (font) - gnome_font_get_underline_thickness (font))/ 2.0;
+ gnome_print_newpath (context);
+ gnome_print_moveto (context, 2, ly);
+ gnome_print_lineto (context, MIN (2 + text_width, width - 2), ly);
+ gnome_print_setlinewidth (context, gnome_font_get_underline_thickness (font));
+ gnome_print_stroke (context);
+ }
+
+ gnome_print_moveto(context, 2, ty);
gnome_print_setfont(context, font);
gnome_print_show(context, string);
gnome_print_grestore(context);