slavfox / Cozette

A bitmap programming font optimized for coziness 💜
MIT License
2.83k stars 42 forks source link

.psf files seem to be wrong #112

Open justus2510 opened 12 months ago

justus2510 commented 12 months ago

The .psf file seems to be twice as wide as it actually should be. The PSF header also reports cozette.psf to be of size 12x13 when it should be 6x13.

The glyphs look like this (I wrote a quick program that extracts the glyphs and prints them out in ASCII):

image

You can also easily confirm this by opening cozette.psf in a hex editor and looking at bytes 28-32, which is the width of each glyph as an unsigned 32-bit integer.

The problem seems to be that the input file gets misinterpreted somehow. This command reproduces the error: java -jar BitsNPicas.jar convertbitmap -f psf2 -o BAD.psf cozette.bdf Same thing happens with the .sfd file. I couldn't test .otf because BitsNPicas doesn't seem to accept it. The .dfont file just straight up crashes.

However, if you use the .fnt file instead, it's at least a little better, with the font now being reported at 7x14: java -jar BitsNPicas.jar convertbitmap -f psf2 -o BETTER.psf cozette.fnt

If I understand correctly (from briefly looking at build.py), the .psf file is built from the .bdf file through fontforge. I unfortunately can't get fontforge to work at all, so I can't test anything related to that. But my guess is that fontforge is having the same problem as BitsNPicas.

Marie-Joseph commented 2 months ago

I generated bdf files from the sdf file using fontforge and still got the wrong widths. If I knew more about the file format, I'd try to fix the issue by hand, but alas I have no idea how any of these file formats work.