aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorYong Sun <Yong.Sun@sun.com>2004-02-04 13:12:47 +0800
committerJack Jia <jackjia@src.gnome.org>2004-02-04 13:12:47 +0800
commitfdae6ceea23bac44f86fc271612227ea53de2fef (patch)
tree68fc8538566aa1e8331cf21c6bf39b99358dbebd /calendar
parentfcde0a67082da640e5f92203ee9f7b55391185fb (diff)
downloadgsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar.gz
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar.bz2
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar.lz
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar.xz
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.tar.zst
gsoc2013-evolution-fdae6ceea23bac44f86fc271612227ea53de2fef.zip
Fix a bug in evolution/calendar/gui/print.c: bound_text(). It does not
2004-02-04 Yong Sun <Yong.Sun@sun.com> * gui/print.c: Fix a bug in evolution/calendar/gui/print.c: bound_text(). It does not break lines with the correct boundary of UTF-8 characters. So, for non-latin locales, it will cause printing issues. svn path=/trunk/; revision=24600
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog6
-rw-r--r--calendar/gui/print.c18
2 files changed, 18 insertions, 6 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e404f89c47..cfb76d99b3 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,9 @@
+2004-02-04 Yong Sun <Yong.Sun@sun.com>
+
+ * gui/print.c: Fix a bug in evolution/calendar/gui/print.c:
+ bound_text(). It does not break lines with the correct boundary of UTF-8
+ characters. So, for non-latin locales, it will cause printing issues.
+
2004-02-03 Dan Winship <danw@ximian.com>
* gui/tasks-component.h: Fix location of e-activity-handler.h
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index f83cb473b5..3c32ef1448 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -743,11 +743,15 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, const char *text,
*o++=c;
if (c==' ')
wordstart = o;
- width+=gnome_font_get_glyph_width(font, gnome_font_lookup_default (font, c));
- if (width>maxwidth)
- dump=1;
- else
- dump=0;
+
+ dump=0;
+ if (g_utf8_validate (p, strlen(p), NULL)) {
+ width+=gnome_font_get_glyph_width(font, gnome_font_lookup_default (font, c));
+ if (width>maxwidth) {
+ o--;
+ dump=1;
+ }
+ }
}
if (dump) {
if (wordstart==outbuffer)
@@ -772,8 +776,9 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, const char *text,
maxwidth -= indent;
first=0;
}
+ } else {
+ p++;
}
- p++;
}
if (dump==0) {
*o=0;
@@ -782,6 +787,7 @@ bound_text(GnomePrintContext *pc, GnomeFont *font, const char *text,
top -= gnome_font_get_size (font);
}
g_free(outbuffer);
+
return top;
}