Installing own fonts and applying config changes without reboot

Discussion as to what further enhancements people would like to see in the software
rosenrost
Posts: 9
Joined: Sat Nov 26, 2022 6:12 pm

Installing own fonts and applying config changes without reboot

Post by rosenrost »

Dear RWAP,

you may know me from Github where I added some improvements to PrinterToPDF a few months ago.

I received my Retro Printer yesterday and I have two suggestions for a new version of the Retro Printer software:

1: It would be nice to be able to install own fonts. I am using the Retro Printer with my Atari MegaSTE. The Atari character set has the German sharp s (ß) located on another position than CP437. CP437 simply uses the Greek letter Beta (ASCII code 225) whereas the Atari uses ASCII code 158. For that reason it would be nice if I could install my Atari font to font/Courier/Epson-AtariST-DE.bin or something like that. But it seems as if the Retro Printer software uses hard-wired charset values and file locations. As a workaround I copied my font over Epson-CP437-US.bin, but that is not really satisfying. Not to forget to mention that the Atari character set provides Hebrew letters on the positions of the CP437 graphic characters.

2: Is it possible to implement a signal handler that reloads the configuration when catching the SIGHUP signal like Apache does? That would make testing new configurations much easier, at least for advanced users.
RWAP
Site Admin
Posts: 405
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Installing own fonts and applying config changes without reboot

Post by RWAP »

rosenrost wrote: Sat Nov 26, 2022 6:28 pm
1: It would be nice to be able to install own fonts. I am using the Retro Printer with my Atari MegaSTE. The Atari character set has the German sharp s (ß) located on another position than CP437. CP437 simply uses the Greek letter Beta (ASCII code 225) whereas the Atari uses ASCII code 158. For that reason it would be nice if I could install my Atari font to font/Courier/Epson-AtariST-DE.bin or something like that. But it seems as if the Retro Printer software uses hard-wired charset values and file locations. As a workaround I copied my font over Epson-CP437-US.bin, but that is not really satisfying. Not to forget to mention that the Atari character set provides Hebrew letters on the positions of the CP437 graphic characters.
You should be able to change the fonts, by using the settings in :
/root/config/charset
/root/config/epson_font

both are case sensitive

We simply load /home/pi/temp/sdl/escparser/fonts/[charset]/epson_font.bin

Fonts need to be 16 bit format.
2: Is it possible to implement a signal handler that reloads the configuration when catching the SIGHUP signal like Apache does? That would make testing new configurations much easier, at least for advanced users.
Potentially - I have no idea how you read the SIGHUP signal?

In the meantime, you can reset the retro-printer from the console with:

Code: Select all

/home/pi/temp/sdl/escparser/retroprinter-restart.sh
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
rosenrost
Posts: 9
Joined: Sat Nov 26, 2022 6:12 pm

Re: Installing own fonts and applying config changes without reboot

Post by rosenrost »

2:
That's okay for me. I just wanted a way to reload the configuration without having to reboot. No need to waste any more time on this.


1:
Unfortunately, that does not work.

Code: Select all

# cat /root/config/charset
AtariST
# cat /root/config/epson_font
Courier
# ls -l /home/pi/temp/sdl/escparser/fonts/AtariST
insgesamt 8
-rw-r--r-- 1 root root 4096 Apr 13  2022 Courier.bin
-rw-r--r-- 1 root root 4096 Apr 13  2022 epson_font.bin
# ls -l /home/pi/temp/sdl/escparser/fonts/Courier | grep AtariST
-rw-r--r-- 1 root root 4096 Apr 13  2022 AtariST.bin
The output is always Epson-PC437-US.
RWAP
Site Admin
Posts: 405
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Installing own fonts and applying config changes without reboot

Post by RWAP »

rosenrost wrote: Mon Nov 28, 2022 1:59 pm 2:
That's okay for me. I just wanted a way to reload the configuration without having to reboot. No need to waste any more time on this.


1:
Unfortunately, that does not work.

Code: Select all

# cat /root/config/charset
AtariST
# cat /root/config/epson_font
Courier
# ls -l /home/pi/temp/sdl/escparser/fonts/AtariST
insgesamt 8
-rw-r--r-- 1 root root 4096 Apr 13  2022 Courier.bin
-rw-r--r-- 1 root root 4096 Apr 13  2022 epson_font.bin
# ls -l /home/pi/temp/sdl/escparser/fonts/Courier | grep AtariST
-rw-r--r-- 1 root root 4096 Apr 13  2022 AtariST.bin
The output is always Epson-PC437-US.
Send me the font to try :)

With:

Code: Select all

# cat /root/config/charset
AtariST
# cat /root/config/epson_font
Courier
That should load the font:
/home/pi/temp/sdl/escparser/fonts/charset/Courier.bin
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
rosenrost
Posts: 9
Joined: Sat Nov 26, 2022 6:12 pm

Re: Installing own fonts and applying config changes without reboot

Post by rosenrost »

RWAP wrote: Mon Nov 28, 2022 6:42 pmSend me the font to try :)
Here you are!
AtariST.zip
(1.34 KiB) Downloaded 545 times
RWAP
Site Admin
Posts: 405
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Installing own fonts and applying config changes without reboot

Post by RWAP »

rosenrost wrote: Tue Nov 29, 2022 7:23 am
RWAP wrote: Mon Nov 28, 2022 6:42 pmSend me the font to try :)
Here you are!

AtariST.zip
Ah that made me look more closely at the sources now I have time - you are correct, at the moment, the charset only supports:
Epson-PC437-US
Epson-PC437-GR
Epson-PC850-INT
Epson-PC851-GR
Epson-PC853-TR

epson_font only supports:
Roman T
Sans Serif
Courier
Prestige
Sans Serif H

These are of course based on the fonts built into Epson printers.

We could allow for custom charsets and maybe font names, but the issue with the latter, is we need a set of predefined character widths to support proportional fonts - ie which column (0 to 8) each character starts in and which column it ends in.

Or, should we just do fixed width fonts for custom fonts (8 columns).

If you have based the Atari font on one of the Epson fonts, then it would not be much to add it as a standard font using the same widths for the characters as the original font you used to base it on.
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
RWAP
Site Admin
Posts: 405
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Installing own fonts and applying config changes without reboot

Post by RWAP »

The other option is to add a new emulation "Epson-Atari" and just swap the character codes as required. Perhaps the better option as it still leaves the choice of fonts, and it means we can swap the characters in teh raw data also to match with the Windows equivalent ASCII codes.

What exactly are the character codes which need to be swapped?
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
rosenrost
Posts: 9
Joined: Sat Nov 26, 2022 6:12 pm

Re: Installing own fonts and applying config changes without reboot

Post by rosenrost »

Allowing custom font names is not necessary, at least not for me. Simply replacing the hard-wired character sets by using the value from config/charset would do the job:

/home/pi/temp/sdl/escparser/fonts/[Roman|Courier|Prestige|Sans Serif|Roman T|Sans Serif H]/<charset>.bin

with a fallback to Epson-PC437-US.bin in case that <charset>.bin cannot be found.
RWAP
Site Admin
Posts: 405
Joined: Wed Sep 13, 2017 9:20 pm
Location: Oswestry, Shropshire
Contact:

Re: Installing own fonts and applying config changes without reboot

Post by RWAP »

The problem is coming up with a solution which works for everyone.

- Does the Atari only support Atari branded printers?
- Are they fixed sized fonts?

As I said, because you are replacing the character set itself, it means having specific start and end columns for each character, if we need to support proportional fonts....

If the Atari ONLY supports fixed width fonts and Atari printers, then the solution is easier - we create a specific emulator for Ataris. Is there an online character table for the Atari - as I said, ideally the emulator would swap the raw Atari characters for the standard ASCII equivalent, so that the captured output could be used on standard text editors under Windows..

Maybe supply the .fon file which you used to create the 16 byte .bin file would help.
Retro-Printer Specialists
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module

Also Involved in:
Icephorm
rosenrost
Posts: 9
Joined: Sat Nov 26, 2022 6:12 pm

Re: Installing own fonts and applying config changes without reboot

Post by rosenrost »

The Atari natively supports Epson ESC/P, but it is possible to load drivers for any other printer. The character set is based on Codepage 437. The full set is described here.

I don't think that built-in proportional fonts were a thing on the Atari back then. All the word processors and DTP software (like Calamus) used the Graphics mode for printing.
Post Reply