makhidkarun / traveller_pyroute

Traveller trade route generator
MIT License
14 stars 5 forks source link

Switch PDF generation package #118

Closed CyberiaResurrection closed 3 months ago

CyberiaResurrection commented 4 months ago

As @tjoneslo has pointed out, PyPDFLite is fairly moribund. Switching to a PDF package that is actively supported (ReportLab) means there will be a lot less (if none at all) patches to carry out-of-tree, thus cut sector map generation over from PyPDFLite to ReportLab.

Before-and-after tests (before with PyPDFLite, after with ReportLab) are enabled via PyMuPDF generating PNG renders of each file, then comparing the before-and-after renders with numpy. Such before-and-after tests include: Verify solo empty-sector write; Verify solo single-subsector trade, comm and xboat write; Verify coreward-rimward and spinward-trailing sector name additions; Verify trade routes in the subsectors immediately adjacent to where Corridor, Deneb, Provence and Tuglikki meet with borders added;

@tjoneslo , any other before-and-after tests you can think of or would like to see added?

For whatever reason, the rimward-sector names weren't centre-aligned, instead being left aligned at 306 pixels - I've replicated that behaviour as-is in PDFHexMap.