Distrotech / reportlab

Mirror of https://bitbucket.org/rptlab/reportlab
Other
59 stars 42 forks source link

Scaling/size issues of radio buttons with shapes "circle" and "square" #23

Open nico-benz-lci opened 1 year ago

nico-benz-lci commented 1 year ago

When using canvas.acroForm I get some problems with the shape "circle" compared to shape "square". The circle shape seems to scale differently with different sizes than square shape. Circle also behaves weirdly with all button styles except "circle". See the MWE or attached file:

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter

c = canvas.Canvas("radios.pdf", pagesize=letter)

sizes = [40, 20, 10]

style = "cross"

c.drawString(30, 650, "Too big at size=40:")
c.acroForm.radio(name="radio1", value="v1", x=30, y=600, size=sizes[0], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio1", value="v2", x=80, y=600, size=sizes[0], shape="square", buttonStyle=style)

c.drawString(30, 550, "Even at size=20:")
c.acroForm.radio(name="radio2", value="v1", x=30, y=500, size=sizes[1], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio2", value="v2", x=80, y=500, size=sizes[1], shape="square", buttonStyle=style)

c.drawString(30, 450, "Too small at size=10:")
c.acroForm.radio(name="radio3", value="v1", x=30, y=400, size=sizes[2], shape="circle", buttonStyle=style)
c.acroForm.radio(name="radio3", value="v2", x=80, y=400, size=sizes[2], shape="square", buttonStyle=style)

c.save()

radios.pdf

At size 40, "circle" seems to scale to double the correct size and at size 10 only to half of the correct size. 20 seems to be the sweet spot where everything is working properly. This is (incidentally?) also the base value for size of radio buttons.

Am I missing something here or is this a bug in scaling? If so, how can I fix this?

timobrembeck commented 11 months ago

This repository is only a mirror and not maintained by the reportlab team. Please describe your issue here if your problem still persists: https://groups.google.com/g/reportlab-users