robhagemans / monobit

Tools for working with monochrome bitmap fonts
MIT License
208 stars 11 forks source link

Argument for encoding of the input font? #36

Closed malespiaut closed 3 months ago

malespiaut commented 3 months ago

Hello,

I've used monobit to convert some Windows FON to PSF to use them as console fonts on my Linux machine.

While monobit-convert font.fon to font.psf does work, monobit understands characters as bytes instead of unicode characters (ie: 0x01 is translated to 0x01, and not to ) which leads to certain characters being considered absent by the Linux console while they are indeed available.

It would be useful to have a --encoding=cp437 argument to solve that issue.

Best regards.

Bm437_DOS-V_re_JPN30.FON.gz (this font comes from The Ultimate Oldschool PC Font Pack (v2.2) https://int10h.org/oldschool-pc-fonts/)

robhagemans commented 3 months ago

Hi, monobit will use the dfCharSet value in a FON file to determine the code page - however CP437 is not one of the predefined values for the format so the fallback "OEM" charset is used, which can be any old OEM codepage.

However you can use the set operation to change the font's encoding:

./convert.py ~/Downloads/Bm437_DOS-V_re_JPN30.FON.gz set --encoding=cp437 to bm437.psf
malespiaut commented 3 months ago

I can confirm that this issue is fixed. Thank you very much for your precise answer.

monobit is a dream tool!