inkypHAT multi-line text
There have been many projects I have wanted to make and my first was a name badge I wore to BETT back in January.
A second project I have been keen to make was a Bible verse a day display screen for my desk to give me encouraging verses during the day. I soon discovered that this wasn't going to be the easiest task as I needed a simple way of converting long strings to multi line text.
If you would like a copy of the code it is available here on GitHub
This project can easily be used for other purposes and is very useful if you want to be able to display a long piece of text over the whole display at different font sizes. I have included a step which calculates the average character width for the current font so calculates automatically how many characters can fit onto one line and where to split the string into the correct line lengths.
Example 1: calculating the average character width and the number of characters which will fit on the display
Example 2: selecting a random verse from the list and splitting it into the correct length lines
Example 3: dealing with the ends of lines to ensure that split words have a dash