The EP-44 is a serial printer/terminal/typewriter made by Brother around 1984. Used as a printer, it can print ASCII text, though only the characters you can find on its keyboard, and possibly not all of them (eg I’m not sure about accents). Lines are 80 columns wide.
Here is Linux script to format for printing on the EP-44 (called ‘text file formatter’, tff):
$ cat ~/bin/tff sed ':a;N;/\n$/!s/\n/ /;ta' $1 | fold -s --width=70 | pr --header=$1 --indent=5
Call it like this:
$ tff textfile.txt > textfile.tff
Yes, it’s a trivial use of fold and pr, and a slightly less trivial use of sed, which I stole from here. And yes I know I could probably do it all in sed. But it works nicely.
How it works:
(1) The sed line joins non-empty lines until it finds an empty line, which it leaves alone. I’ve done this on the assumption that an empty line is a paragraph separator and I am printing text, not code or data. The result is piped into…
(2) fold, which cuts it into 70 character wide columns, breaking the line on spaces (-s). This could be done in sed pretty simply, but anyway…
(3) pr puts an indent of 5 spaces (so the text column is centred with 5 spaces to either side). The header bit is because the file name information is lost on piping the output.
The EP-44 has 80-character lines, but a 5 character margin gives much more readable output. That leaves a page width of 70.
The result looks something like this:
$ tff fallofforts.txt 2018-08-03 09:51 fallofforts.txt Page 1 This is a very fine book. Bendiner was not a famous pilot like Guy Gibson (Enemy Coast Ahead) -- he was a navigator who managed to complete a tour of 25 operations over occupied Europe in B-17 Flying Fortresses that steadfastly continued to attack during daylight hours, and suffered horrendous losses as a result. When 10% per mission was considered an acceptable loss rate, not many can have made it through 25. But what makes the...
Or, as printed on the EP-44:
But sending it to the printer is not as simple as I had hoped.
To print a substantial file to the EP-44, I run linebyline.sh, which looks like this:
stty -F /dev/ttyS1 1200 while IFS= read line do echo "$line" > /dev/ttyS1 sleep 6s done < $1
$ linebyline.sh filename.tff
Now, this is pretty nifty!
The problem with just sending the whole text file is that the printer cannot keep up; it does not have enough memory to buffer much text — about 4 or 5 lines. I found that even if I set the baud rate to 75 on each device, the bits still come too fast and eventually the output fragments as it just prints whatever characters it can make sense of. There might well be a serial port setting that can fix this. I have a vague idea I printed once before and all was well. Anyway, this might be a bodge, but it works.
linebyline.sh just sends one line at a time to the printer then waits 6s and sends the next one. The print speed is about 15 characters per second, and with a line 80 characters wide that means it takes a little under 5s to print a line. Add on the time it takes to return the print head and then a little margin for error and the 6s wait means it can keep up.
The computer only sends one line at a time. One line can fit easily in the printer’s memory, and it’s printed by the time the next line is sent.