-1
I would like to know how to make a code in Python that checks the size of a string (in pixels).
Guess: we have a string 'ALCON BOTTON FISH 50G' I would like to know what its pixel size to center in a square I’m filling with reportlab (I’m using absolute plotting - informing the x and y position - for not finding an automatic way to do this centralization)
If the source is
monospace
maybe I can, if it’s not gonna get complicated.– fernandosavio
Was your question "pixel size" a little confusing? the size of a pixel will depend on the resolution and/or the device being displayed to the image, no matter if the image represents a string or a bird, the same string that vc da as an example can be "built", and/or plotted in different resolutions (pixels per inch), forget the string represented in the image and focus on the image characteristics (size, resolution, etc)
– Sidon
Some technologies, like Qt, have this feature, but it only makes sense using the same functions of who will plot/draw the text in definitive. You have to see if this reportlab has a proper function.
– Bacco