Is it possible to add .TTF fonts to Inky pHAT? Is it as simple as dropping a font file in the installed Python module, and if so where can I find it? (I have looked!)
I ask because I would like to install a bitmap-style font that might render better at small sizes so I can cram more text on the display.
I seem to have answered my own question. I downloaded a font (ChiKareGo.ttf), in a terminal window changed directory to the Downloads folder and copied it to the inkyphat module folder with sudo cp ChiKareGo.ttf /usr/lib/python3/dist-packages/inkyphat/fonts/
That’s great news that it’s so easy to reference fonts from anywhere - I will include that in my tide time project. The ChiKareGo font was made by me from the ground up but it is a pretty exact copy of Apple’s 68k Mac Chicago font - its designer Susan Kare is, I believe, aware of me doing this as I also recreated the original Mac Finder font and found she had left Easter eggs in it - we had a little chat on Twitter about it: http://www.suppertime.co.uk/blogmywiki/2017/04/finderskeepers/
That’s a great looking font on the inky! I’m using BMmini all in caps because I wanted to display quite a lot of info while remaining legible, and in the end I used the same thing you did: put the font in ttf in the inky font folder, and modified the init file for it to be recognized.
I don’t know PIL yet so I didn’t really understand how it could import fonts, maybe something to add to the documentation?
It’s quite easy. I just downloaded my Bauhaus TTF font and placed it in the same directory as my tide time program. I used the following command to load the font onto the Inky pHAT: font = ImageFont.truetype("/home/pi/Pimoroni/inkyphat/tides/Bauhaus2015.ttf", 16)
I’ve added a few lines to the getting started guide to clarify how to add additional fonts. :-)
If you want to add additional fonts, then you can drop them into both the /usr/lib/python2.7/dist-packages/inkyphat/fonts and /usr/lib/python3/dist-packages/inkyphat/fonts directories. They should be .ttf files, ideally. Or you can simply pass the path to your font into the font = ImageFont.truetype(“/path/to/font”, 22) line in your code.