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:
- Find yourself a readable font in Truetype or PostScript format. Note that a fixed-width font is preferred since efix does not support variable-width fonts. A good site with such fonts is oldtype.8m.com.
-
Now use the fax script (also included in the efax package)
to convert the Truetype or PostScript font to a PBM file.
export GS_FONTPATH=<path> fax makefont <fontname> <size> <width> <height> myfont.pbmwhere <path> is the directory containing your PostScript font, <fontname> the name of the PostScript font (NOT the filename), <size> the size of your font in points and <width> and <height> the pixel size reserved for each character. - Now use Gimp or a similar program to visually correct or edit the result. You may need to repeat the above process several times until you have the correct width/height values.
-
You can now use your font file with efix:
efix -fmyfont.pbm ...
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