You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However artefacts are visibles on line junctions when generating those shapes with start_from_center=True & end_at_center=True:
Whereas it should be like this (image from HexaPDF):
The solution here is probably to use the h path operator, intead of closing arcs with a line using l: cf.fpdf/fpdf.py#L1651
You will find all required information about path operators in the 1.7 PDF spec.
Reading the existing code of the arc() & solid_arc() methods should also help you understand how shapes are drawn.
This is also an opportunity to add unit tests combining start_from_center=True & end_at_center=True in test/shapes/test_arc.py.
Please read the related documentation to get information on how to add tests: https://pyfpdf.github.io/fpdf2/Development.html#testing
I suggest the following approach: taking inpiration from the existing test functions,
write a basic usage scenario that calls assert_pdf_equal(pdf, "new_test_name.pdf", tmp_path, generate=True), and run pytest -vv test/shape/test_arc.py -k new_test_name
The generate=True argument is very useful to write new tests as it will generate the reference PDF file.
Once you'll be happy with the PDF file generated, you will just have to remove generate=True and you'll get a fine non-regression unit test.
Pleae feel free to ask any question regarding this task or fpdf2 😊
By implementing this feature you, as a benevolent FLOSS developper, will improve a useful feature of this library, benefiting the large community of fpdf2 users.
As a contributor you will get review feedbacks from maintainers & other contributors, and learn about the lifecycle & structure of a Python library on the way.
You will also be added to the contributors list & map.
The text was updated successfully, but these errors were encountered:
There are currently two methods to render arcs with
fpdf2
:However artefacts are visibles on line junctions when generating those shapes with
start_from_center=True
&end_at_center=True
:Whereas it should be like this (image from HexaPDF):
The solution here is probably to use the
h
path operator, intead of closing arcs with a line usingl
:cf. fpdf/fpdf.py#L1651
You will find all required information about path operators in the 1.7 PDF spec.
Reading the existing code of the
arc()
&solid_arc()
methods should also help you understand how shapes are drawn.This is also an opportunity to add unit tests combining
start_from_center=True
&end_at_center=True
in test/shapes/test_arc.py.Please read the related documentation to get information on how to add tests: https://pyfpdf.github.io/fpdf2/Development.html#testing
I suggest the following approach: taking inpiration from the existing test functions,
write a basic usage scenario that calls
assert_pdf_equal(pdf, "new_test_name.pdf", tmp_path, generate=True)
, and runpytest -vv test/shape/test_arc.py -k new_test_name
The
generate=True
argument is very useful to write new tests as it will generate the reference PDF file.Once you'll be happy with the PDF file generated, you will just have to remove
generate=True
and you'll get a fine non-regression unit test.Check #258 for more context
Pleae feel free to ask any question regarding this task or
fpdf2
😊By implementing this feature you, as a benevolent FLOSS developper, will improve a useful feature of this library, benefiting the large community of fpdf2 users.
As a contributor you will get review feedbacks from maintainers & other contributors, and learn about the lifecycle & structure of a Python library on the way.
You will also be added to the contributors list & map.
The text was updated successfully, but these errors were encountered: