Commit 53b5235
committed
Fix deprecation warning about ImageFont.getsize
python-barcode/barcode/writer.py:441: DeprecationWarning: getsize is
deprecated and will be removed in Pillow 10 (2023-07-01). Use getbbox
or getlength instead.
width, height = font.getsize(subtext)
`ImageFont.getsize` is deprecated since the version 9.2 of Pillow. We
use anchor instead of computing the right position to have an aligned
text.
It is related to the issue #163.
The solution was suggested by nulano (contributor of Pillow).1 parent 77c902f commit 53b5235
1 file changed
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
441 | | - | |
442 | | - | |
443 | 441 | | |
444 | | - | |
445 | | - | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
446 | 447 | | |
447 | | - | |
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| |||
0 commit comments