Updating the ChangeLog file
[enscript.git] / tools / convertfontto.sh
1 #!/usr/bin/env bash
2 # Small bashscript to convert a font to another encoding.
3 # USAGE 
4 #       convertfontto fontname outputfontname encoding destination
5 #       place the destination into your .enscriptrc file or enscript.cfg
6 #       Defaults are :  encoding - Latin9
7 #                       outputfontname: fontname-encoding.afm
8 #                       destination: $HOME/.config/enscript/afm
9 #
10 set -eu
11 font=${1?Please give a font};
12 encoding=${3:-iso8859-15};
13 outputfile=${2:-"${font%.*}-$encoding"}
14 destination=${4:-~/.config/enscript/afm};
15 fontforge -lang=ff -c "Open(\"$font\");Reencode(\"$encoding\");Generate(\"$outputfile.pfa\")";
16 mkdir -p $destination
17 cp "$outputfile.pfa" "$destination/"
18 cp "$outputfile.afm" "$destination/"
19 cd $destination
20 mkafmmap *.afm