Hi there, I’m new to this, probably this is a beginner level thing, but I can’t do it alone. I love InkyPhat display, but I need some help in printing longer texts in it.
Of course,
import sys
from PIL import ImageFont
import inkyphat
font = ImageFont.truetype(inkyphat.fonts.FredokaOne, 16)
name = "text example"
w, h = font.getsize(name)
x = (inkyphat.WIDTH / 2) - (w / 2)
y = (inkyphat.HEIGHT / 2) - (h / 2)
inkyphat.text((x, y), name, inkyphat.BLACK, font)
inkyphat.show()
will print a perfectly centred single black line text on the InkyPhat display, but limited to this single line and the display width, longer texts will be truncated.
Starting from above, I need to know if there’s a possibility to print longer texts in several lines, somehow auto-adjusted (warped) to the display size, eventually dynamically centred (keeping all the possibilities from a single centred line to several centred lines when the text is large than a single line).
Thank you,
Alex