0

Fonts help
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Fonts help

by QQuazar on Fri Jan 01, 2021 7:16 pm

Got my first curcuit python all soldered up and the first test worked!
Trying to get some fancy text, but when I try and call a font I get an error
Here is my code
font = bitmap_font.load_font("fonts/Arial-16.bdf")

here is the error
OSError: [Errno 2] No such file/directory: 'fonts/Arial-16.bdf'

I have the library installed, do I need to install individual fonts too?
What fonts are available in the library I do not see any documentation on that

This is the library
https://circuitpython.readthedocs.io/pr ... en/latest/

Thanks, this place is a wealth of information!

QQuazar
 
Posts: 3
Joined: Fri Dec 18, 2020 7:15 pm

Re: Fonts help

by hugodahl on Fri Jan 01, 2021 8:55 pm

Hey QQuazar! I've been bitten by something similar recently, and one thing you might want to make sure, is that your path to the font file is fully qualified. So for your sample line, try adding a forward slash to the path. And make sure you don't have a leading (accidental) whitespace (I learned 2 lessons on that one!)

So you'd end up with `font = bitmap_font.load_font("/fonts/Arial-16.bdf")`. Finally, make sure that the casing of the file name and the path in your code matches.

HTH
Hugo

hugodahl
 
Posts: 5
Joined: Thu Oct 04, 2018 12:04 am

Re: Fonts help

by QQuazar on Sat Jan 02, 2021 10:59 am

I did have to add the font files to my device
I downloaded this font as a test, put it in a fonts folder and it started working.
https://github.com/slavfox/Cozette/releases

QQuazar
 
Posts: 3
Joined: Fri Dec 18, 2020 7:15 pm

Re: Fonts help

by hugodahl on Sat Jan 02, 2021 1:15 pm

That's awesome QQuazar! I just downloaded the font to have a look on my device and check, and it's quite nice! Now I need a 64x35 LED panel instead of 32, so that I can get all characters on there correctly!

hugodahl
 
Posts: 5
Joined: Thu Oct 04, 2018 12:04 am

Re: Fonts help

by Powderjockey on Sun Jan 10, 2021 2:43 pm

Where can one find these fonts for curcuitpython? I've searched around and haven't found anything.

Powderjockey
 
Posts: 136
Joined: Fri Mar 31, 2017 10:14 pm

Re: Fonts help

by hugodahl on Sun Jan 10, 2021 3:17 pm

You can use fonts that come in either .bdf or .pcf formats, for any source. QQuazar posted a link to a font that fits those parameters called "Cozette".

hugodahl
 
Posts: 5
Joined: Thu Oct 04, 2018 12:04 am

Re: Fonts help

by Powderjockey on Sun Jan 10, 2021 8:30 pm

Thanks Hugo, I'm looking for helvR10.bdf. I did try placing the cozette.bdf but is made no difference in the problems.

That's why I was wondering where to grab the fonts from.

Powderjockey
 
Posts: 136
Joined: Fri Mar 31, 2017 10:14 pm

Re: Fonts help

by hugodahl on Sun Jan 10, 2021 8:38 pm

Oh, I see @Powderjockey, my mistake. I know that the MatrixPortal Moon Clock demo uses that font, so you can find it in that project's directory on GitHub, here: https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/Matrix_Portal_Moon_Clock

hugodahl
 
Posts: 5
Joined: Thu Oct 04, 2018 12:04 am

Re: Fonts help

by Powderjockey on Sun Jan 10, 2021 9:49 pm

@Hugo, thanks for the lead on those fonts.

Powderjockey
 
Posts: 136
Joined: Fri Mar 31, 2017 10:14 pm

Please be positive and constructive with your questions and comments.