Readable Fonts for efax

Using the efix program from the efax package, text files can be converted to G3 fax files. However, the builtin font is pretty unreadable, especially on cheap fax machines. Using another font is quite straightforward:

Unprintable Characters Produce Small Boxes

With some fonts, unprintable characters result in small boxes being printed instead of white space. This problem can be avoided by simply editing the resulting font file in Gimp, or by using the following modified script instead of the fax script explained above:

#!/bin/bash

FNTFMT=pbmraw
pelwidth=`expr 256 \* $3`
gs -q -sDEVICE=$FNTFMT -r204x196 -g${pelwidth}x$4 -sOutputFile=$5 - <<EOF
/$1 findfont $2 scalefont setfont 
/buf 1 string def
/dx $3 204 div 72 mul def       % x offset per character
33 1 126 { 
  dup dx mul 0.7 add 3 moveto
  buf exch 0 exch put 
  buf show
} for
160 1 255 { 
  dup dx mul 0.7 add 3 moveto
  buf exch 0 exch put 
  buf show
} for
showpage
EOF

This script is invoked as:

export GS_FONTPATH=<path>
<scriptname> <fontname> <size> <width> <height> myfont.pbm