Open tytouf opened 2 years ago
There have been changes to how text is aligned and how it's size is calculated since 0.14. Do you still have the same issue on main
?
See https://github.com/WhyNotHugo/python-barcode/pull/165 for discussion on this.
I didn't test with the source but it should be equivalent.
I believe text is incorrectly located in barcode when using ImageWriter as of 0.14.0. This is mainly due to a wrong computation of text height which is a very common problem due to the fact that total height for a font is different from the height of rendered glyphs for most of the ascii characters.
Attached is a proposed patch to place text correctly. Note that because most of the time a barcode is followed by a text with capital letters, the blank space at the bottom is more that 1mm (which would be nice to set as an option). It should be closer to 1mm when using letters that goes below the font baseline ('p', 'q', etc).
text_placement.patch.txt