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
This commit is contained in:
Yong Sun
2004-02-04 05:12:47 +00:00
committed by Jack Jia
parent fcde0a6708
commit fdae6ceea2
2 changed files with 18 additions and 6 deletions

View File

@ -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

View File

@ -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;
}