bwipp / postscriptbarcode

Barcode Writer in Pure PostScript
https://bwipp.terryburton.co.uk
MIT License
463 stars 65 forks source link

EAN13 bbox out of bounds #249

Closed nicohein closed 1 year ago

nicohein commented 1 year ago

Hi @terryburton,

I noticed that after your commit to the EAN13.ps file https://github.com/bwipp/postscriptbarcode/commit/b4ae9e1bf1ea13c8ff1734e6d096b48222d0c429 and the changes made to the ean13.ps line 59 the first number is plotted out of bounds within the treepoem library.

Earlier today I have raised an issue with treepoem (https://github.com/adamchainz/treepoem/issues/495) and was asked to raise this issue here.

Here is an example (see the 4 at the very beginning):

4260661767605_8204

Before the change:

4260661767605_8204

So we can see that the initial character was shifted left, however it now results in a position negative to the coordinate roots which is not returned for the bbox device.

The command that returns the problematic bounds can be found here: https://github.com/adamchainz/treepoem/blob/main/src/treepoem/__init__.py#L89

Unfortunately, I am not familiar enough with postscript to attempt a contribution.

OS: MacOS 13.5 GS: 10.01.2

Thanks Nico

terryburton commented 1 year ago

BWIPP just plots on the canvas. Whatever application / wrapper creates the PS template that invokes BWIPP decides where the symbol is plotted and calculates the effective bounding box for cropping purposes.

So not a BWIPP issue.

terryburton commented 1 year ago

See https://github.com/adamchainz/treepoem/blob/main/src/treepoem/__init__.py#L25

The symbol should be plotted to ensure that all graphical elements fall within the first quadrant of the coordinate system due to limitation in GhostScript's bbox driver.

nicohein commented 1 year ago

Thanks for the explanation and hinting at the line! Very helpful!