Skip to content

Add ReportLab cubic path support#230

Merged
tshead2 merged 1 commit intosandialabs:mainfrom
eaton-lab:pdf_path_C_support
Mar 19, 2026
Merged

Add ReportLab cubic path support#230
tshead2 merged 1 commit intosandialabs:mainfrom
eaton-lab:pdf_path_C_support

Conversation

@eaton-lab
Copy link
Contributor

Hi @tshead2, this is a simple feature addition I would love to have supported.

Summary

  • add ReportLab support for SVG cubic path C commands and close-path Z / z
  • factor SVG path command translation into a shared helper in the ReportLab renderer
  • add a Behave feature that verifies the expected ReportLab path calls for move, line, cubic, and close commands

Details

Toyplot's ReportLab backend already handled simple SVG path commands, but it did not translate cubic Bezier
segments. This PR adds support for cubic path rendering so SVG paths that include C commands can be converted
into the corresponding ReportLab curveTo() calls.

The change also covers path closing, and adds a focused regression test that checks the backend issues the
expected beginPath(), moveTo(), lineTo(), curveTo(), close(), and drawPath() calls.

Testing

  • python -m behave features/reportlab.feature --logging-level INFO --no-logcapture

Notes

  • no public API changes
  • scoped to ReportLab path rendering and its regression coverage

Example

Its useful for creating some cool plots like this and ensuring they can render to PDF.

image

@coveralls
Copy link

coveralls commented Mar 19, 2026

Coverage Status

coverage: 94.508% (+0.005%) from 94.503%
when pulling cb1acd2 on eaton-lab:pdf_path_C_support
into d06e432 on sandialabs:main.

@tshead2 tshead2 merged commit 20c3750 into sandialabs:main Mar 19, 2026
7 checks passed
@tshead2
Copy link
Member

tshead2 commented Mar 19, 2026

Looks like a winner, many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants