ASCII-generator
ASCII-generator copied to clipboard
The FreeTypeFont object from the PIL library no longer has the getsize() method
The FreeTypeFont object from the PIL library no longer has the getsize() method, use the getbbox() method instead.
To anyone facing this issue the best way is to use getbox instead of getsize
- getsize would return a tuple
(23,1) - getbox return a tuple of 4 values
(0,0,23,1)
it is therefore best to use the code from @ace-shang Branch with updates changes
or you can copy this code and paste this code and remove the getbox line
bbox = font.getbbox(sample_character)
char_width = bbox[2] - bbox[0]
char_height = bbox[3] - bbox[1]
credit : @ace-shang