Importing or converting .ttf font.

Kernel, Main, Utilities & Applications, Miscellaneous Devices.
Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Importing or converting .ttf font.

Unread post by Sliff2000 »

I've noticed all the fonts for the menu end with .pf. I have a few .ttf fonts I would like to bring over to my mister. Is there a tool? I have looked to no avail. I am including the two fonts I would like to add/convert -- maybe someone will sprinkle some faery dust on them ;) . Thanks.
Attachments
mk2-4_font.zip
(36.42 KiB) Downloaded 142 times
bbond007
Top Contributor
Posts: 531
Joined: Tue May 26, 2020 5:06 am
Has thanked: 87 times
Been thanked: 211 times

Re: Importing or converting .ttf font.

Unread post by bbond007 »

Sliff2000 wrote: Mon Nov 15, 2021 4:28 am I've noticed all the fonts for the menu end with .pf. I have a few .ttf fonts I would like to bring over to my mister. Is there a tool? I have looked to no avail. I am including the two fonts I would like to add/convert -- maybe someone will sprinkle some faery dust on them ;) . Thanks.

TTF fonts are vector font and MiSTer takes bitmap fonts, but I thought I'd try and make a tool to convert them. Keep in mind that not all vector fonts are going to scale down well to 8x8 pix.
FontConverter.png
FontConverter.png (10.69 KiB) Viewed 3587 times
First step: Convert TFF to PNG

Load TFF file
Make tweaks (size)
Save PNG file

Second step: Convert PNG to PF

Code: Select all

py png2pf.py -i FONT.PNG -o FONT.PF -p PREVIEW.PNG
if you get an error about 'PNG':

Code: Select all

pip install pypng
Hope that helps:
MiSTerFontConverter.zip
(10.42 KiB) Downloaded 173 times
--> https://github.com/bbond007/MiSTerFontConverter
Python --> https://www.python.org/downloads/
png2pf.py --> https://github.com/MiSTer-devel/Fonts_M ... /png2pf.py
Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Re: Importing or converting .ttf font.

Unread post by Sliff2000 »

Wow, pretty awesome. Fantastic start -- Thank you!
Sliff2000
Posts: 28
Joined: Mon Nov 15, 2021 4:18 am
Has thanked: 6 times
Been thanked: 6 times

Re: Importing or converting .ttf font.

Unread post by Sliff2000 »

I am including in my finds an 8x8 pf editor. You can also open multiple instances and copy and paste between them so you can add the system icons ((status bars, wifi, etc..)).

https://www.min.at/prinz/o/software/pixelfont/
Post Reply