python-barcode icon indicating copy to clipboard operation
python-barcode copied to clipboard

Fix size and text distance

Open fra87 opened this issue 2 years ago • 4 comments

I spotted two problems while writing a program:

  1. text_distance is not applied if guardbar is on
  2. the height calculation is not correct (it only accounts for half of the font width), and this caused the images being too short

I fixed the two issues in this PR

fra87 avatar Aug 26 '23 16:08 fra87

Needs rebase

WhyNotHugo avatar Aug 27 '25 11:08 WhyNotHugo

Rebased on latest main

fra87 avatar Aug 27 '25 22:08 fra87

the height calculation is not correct (it only accounts for half of the font width), and this caused the images being too short

Do you have an example that reproduces this problem?

I tried python-barcode create "123456789000" outfile -b ean --text "hello there", and the height is correct, the text fit fully.

Also tried generating a PNG (with pillow installed) with python-barcode create "123456789000" outfile -b ean --text "hello there" --type png. Text also fits fine.

WhyNotHugo avatar Aug 28 '25 08:08 WhyNotHugo

I'll try to get something in the next days. Honestly I don't have the build system ready anymore since it was a small project of mine done 2 years ago, but I'll try to reproduce it with a simple example and write it here

fra87 avatar Aug 28 '25 08:08 fra87