[reportlab-users] suggested patch to reportlab.platypus.paragraph._drawBullet

Robin Becker robin at reportlab.com
Wed Oct 3 06:32:25 EDT 2007


Harald Armin Massa wrote:

> Hello,

>

> in an actual projet I ran into the challenge to have the bullet text "moved

> up" a little ... the bullet is a smaller fontsize ZapfDingbats-chr(110)

> [=filled square], which must be pushed "higher" to be centered with the

> text.

>

> The required changes are minimal:

>

> def _drawBullet(canvas, offset, cur_y, bulletText, style):

> '''draw a bullet text could be a simple string or a frag list'''

.........

>

> style grews a new possible attribute "bulletOffsetY", which makes it

> possible to offset the bullet-text up and down.

>

> this patch is put into public domain, and I would be very honoured if it

> gets integrated into core reportlab.

>

> Harald

......

Honoured to include your patch Harald :)

It's now in the trunk. I added back in the bulletFont settings though, so the
beginning of _drawBullet reads

tx2 = canvas.beginText(style.bulletIndent, cur_y+getattr(style,"bulletOffsetY",0))
tx2.setFont(style.bulletFontName, style.bulletFontSize)
tx2.setFillColor(hasattr(style,'bulletColor') and style.bulletColor or
style.textColor)

and the attributes are also allowed in the paraparser.
--
Robin Becker


More information about the reportlab-users mailing list