[reportlab-users] More bugs with Paragraph, with underlined links

Robin Becker robin at reportlab.com
Wed Nov 7 06:19:19 EST 2007


Dinu Gherman wrote:

> Robin Becker:

>

>> Unfortunately, this is caused by a completely different and rather

>> stupid error. The first line is all one style and goes through a

>> completely different path to the other. I'll fix in SVN along with

>> various other worries.

>

> Well, then I guess this one is easier than the other (the Donaudampf-

> schiff example ;-) I can work around the last one above, but not the

> Donau (or 125) one.

>

> In fact, I would really like to have a clean(er) Paragraph class that

> allows for Hennings hyphenation for a project with a deadline by the

> end of november. Probably I'll need to pray for it to be solved by

> then...

>

......
Dinu, the problem is that your <link><font..>linktext</font></link> paragraph
goes through the so called simple paragraph flow (only one kind of style in the
whole paragraph). That particular path has the statements

line 0
if f.underline: _do_under_line(0, dx, ws, tx)
if f.strike: _do_under_line(0, dx, ws, tx, lm=0.125)
if f.link: _do_link_line(0, dx, ws, tx)

lines 1-n
if f.underline: _do_under_line(i, t_off+leftIndent, ws, tx)
if f.strike: _do_under_line(i, t_off+leftIndent, tx, ws, lm=0.125)
if f.link: _do_link_line(i, t_off+leftIndent, ws, tx)


there's a bug in here in the second strike. Problem is that _do_link_line
doesn't do underlining. So we could fix this (and make it compatible with the
other path) by using

if f.underline or f.link: _do_under_line(0, dx, ws, tx)

etc.

However, we already have applications which rely on the opposite behaviour. I
would prefer to remove automatic underlining of links entirely. It seems silly
to have to colour the link, but not to underline it explicitly if that is desired.

As a stopgap I'm adding an rl_config option to control the default behaviour;
this will be no underlining by default; to turn it on you'll need to add
platypus_link_underline=1 to the rl_config override module (local_rl_config.py).

An alternative would be to add more and more options to the link tag itself. It
already has enough, although sadly underline thickness and colour are not there.
--
Robin Becker


More information about the reportlab-users mailing list