PiSupply / PaPiRus

Resources for PaPiRus ePaper eInk displays
https://www.pi-supply.com/product/papirus-epaper-eink-screen-hat-for-raspberry-pi/
Other
347 stars 84 forks source link

Multiple spaces are stripped when using text API #210

Open jjcohen opened 5 years ago

jjcohen commented 5 years ago

Hi I recently set up a Papirus and Raspberry Pi 3 (not used for anything else, fresh install etc), both of which I bought a while back. Loving the display it's great however it seems that multiple spaces are swallowed by the PapirusTextPos. For instance "hello word" would be printed as "hello world".

text = PapirusTextPos()

text.AddText("hello world", 10, 10, Id="Start" )


-  Here is what is displayed on the physical device:
![20191023_084528](https://user-images.githubusercontent.com/1882987/67401615-4f486980-f5a7-11e9-8dd1-10e5b92a0c50.jpg)
tvoverbeek commented 5 years ago

Yes, the text is split into words to calculate how many words of the text fit on a single line before starting a new line. See the code of the addToImageText function around line 112 in textpos.py (https://github.com/PiSupply/PaPiRus/blob/master/papirus/textpos.py). If you really need that much space between words, use two separate calls to AddText with the same y but different x coordinates.