Scroll pHAT HD 3x5 font change


#1

Hello. I made a clock with Scroll pHAT HD using the 3x5 font. But the font is not monospaced and the digits jump around when the number 1 is displayed. I want to fix this. I guess I need to change the number 1 in the following file

github

from

0x00000031: [[0xff],
             [0xff],
             [0xff],
             [0xff],
             [0xff]],

to

0x00000031: [[0x00,0xff,0x00],
             [0x00,0xff,0x00],
             [0x00,0xff,0x00],
             [0x00,0xff,0x00],
             [0x00,0xff,0x00]],

But I cannot find in my system which file to change. I tried to change

/usr/lib/python3/dist-packages/scrollphathd/fonts/font3x5.py

but it has no effect. Any ideas?


Keeping an eye on a website with rpi0 and Scroll pHAT HD
#2

You should grab the code from GitHub, change the file there, and then install from the library folder using sudo python setup.py install and/or sudo python3 setup.py install which should put everything in the right place.

monospaced might be an interesting argument to add to the write_string method to take care of this automagically, though. I’ll look into it.


#3

Thanks for your help. I managed to fix it. Here are the exact steps I did if someone wonders.

mkdir ~/install
cd ~/install
wget https://github.com/pimoroni/scroll-phat-hd/archive/master.zip
unzip master.zip
cd ~/install/scroll-phat-hd-master/library/scrollphathd/fonts
nano font3x5.py

And then I made the change 0x00000031 I wrote in my original post. (See edit below.) Now

cd ~/install/scroll-phat-hd-master/library
sudo python setup.py install

And it worked like a charm. Thanks again.

Edit: The following digit 1 looks much better than the one in my original post:

0x00000031: [[0x00,0xff,0x00],
             [0xff,0xff,0x00],
             [0x00,0xff,0x00],
             [0x00,0xff,0x00],
             [0xff,0xff,0xff]],

#4

Great stuff. I added a monospaced option to the pending release, and updated the ‘1’ in font3x5 to, coincidentally, the same one you just mentioned!

Future versions of the library should include this tweak when you update.