[reportlab-users] MediaWiki's "Download as PDF" feature uses ReportLab but has a problem

Ziyuan Yao yaoziyuan at gmail.com
Tue Jan 10 11:19:30 EST 2012




On Monday, January 2, 2012 7:39:21 PM UTC+8, Andy Robinson wrote:

>

> On 2 January 2012 11:33, Yao Ziyuan <yaoz... at gmail.com> wrote:

> > So now I'm confused. Is it MediaWiki's or ReportLab's fault for the

> > line wrapping problem described in the above bug report

> > (https://bugzilla.wikimedia.org/show_bug.cgi?id=33430)?

> >

>

> MediaWiki (actually PediaPress.de) decided to use our library a few years

> ago;

> we did some work to improve inline images to support equations, but

> they did not mention Asian line wrapping at the time and I did not know

> about this limitation.

>

> I guess they are simply not using our wordwrap=CJK option. Our library

> needs to be told "this is Japanese/Chinese, use a different algorithm";

> it does not auto-detect based on the encoding.

>

> Also, until some time last year, we could not properly handle mixed text

> in the same sentence. We have improved this now.

>


We have found a new issue with your solution (wordwrap=CJK). It seems, with
wordwrap=CJK enabled, Western text won't be wrapped correctly (a Western
word can be broken into two lines); with wordwrap=CJK disabled,
Chinese/Japense text won't be wrapped at all.

Actually, ReportLab doesn't need a wordwrap=CJK option. Instead, ReportLab
can wrap text (Western or CJK or mixed) in a unified manner:

IF there is a whitespace near the page's right margin THEN
wrap after that whitespace;
ELSE IF there is a CJK character near the page's right margin THEN
wrap after that CJK character;
ELSE
wrap forcibly at the page's right margin.





>

> - Andy

> _______________________________________________

> reportlab-users mailing list

> reportl... at lists2.reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20120110/904ee910/attachment.htm>


More information about the reportlab-users mailing list