Re: [evolution-patches] Fix printing problem of calendar.
- From: "jack jia sun com" <jack jia sun com>
- To: Yong Sun sun com
- Cc: evolution-patches lists ximian com, antonio xu sun com
- Subject: Re: [evolution-patches] Fix printing problem of calendar.
- Date: Wed, 04 Feb 2004 14:10:38 +0800
commited in trunk and 1-4-branch.
Yong Sun wrote:
Hi, guys,
Please help to review this patch. This patch is for 1.4 branch and HEAD
branch.
There is 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, e.g.:
1.Invoke your evolution.
2.Create a new appointment and input 12 chinese characters in summery
area
3.Save and close it
4.Print preview it
Actual result:
After #4,the summery can't be displayed.
And, if you input 11 chinese characters in summery ,it can be displayed.
if you insert a space in the chinese string ,the first string can be
displayed.
------------------------------------------------------------------------
Index: print.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/print.c,v
retrieving revision 1.50
diff -u -p -r1.50 print.c
--- print.c 23 Jun 2003 20:27:31 -0000 1.50
+++ print.c 2 Feb 2004 09:53:35 -0000
@@ -709,11 +709,15 @@ bound_text(GnomePrintContext *pc, GnomeF
*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)
@@ -738,8 +742,9 @@ bound_text(GnomePrintContext *pc, GnomeF
maxwidth -= indent;
first=0;
}
+ } else {
+ p++;
}
- p++;
}
if (dump==0) {
*o=0;
@@ -748,6 +753,7 @@ bound_text(GnomePrintContext *pc, GnomeF
top -= gnome_font_get_size (font);
}
g_free(outbuffer);
+
return top;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]