Blob


1 #!/usr/local/plan9/bin/rc
3 rm *.tpost *.troff *.pfb *.pfa *.afm map.sfd
5 hex1=(0 1 2 3 4 5 6 7 8 9 A B C D E F)
6 hex=()
7 for(i in $hex1) for(j in $hex1) hex=($hex $i$j)
8 {
9 for(h in $hex)
10 echo $h 0x$h^00_0x$h^FF
11 } >map.sfd
12 for(font){
13 f0=$font
14 if(~ $font *.ttf)
15 font=`{9 basename $font .ttf}
16 if not if(~ $font *.sfd)
17 font=`{9 basename $font .sfd}
18 fontforge -c 'Open($1); Generate($2, "", -1, 72, "map.sfd")' \
19 $f0 $font^%s.pfb map.sfd
20 {
21 echo name $font
22 echo fontname $font
23 } >$font.troff
24 >$font.tpost
25 for(h in $hex){
26 if(test -f $font$h.pfb){
27 pfb2pfa $font$h.pfb $font$h.pfa
28 mv $font$h.pfa /usr/local/plan9/postscript/font/dejavu/$font$h
29 afm2troff -h -o 0x$h^00 $font$h.afm >>$font.troff
30 echo 0x$h^00 0x$h^FF $font$h >>$font.tpost
31 }
32 }
33 {
34 echo '0x0027 0x0027 0x19 '$font'20 # map apostrophe to right quote'
35 echo '0x0060 0x0060 0x18 '$font'20 # map grave to left quote'
36 } >>$font.tpost
38 sam -d $font.troff <$PLAN9/dist/troff/devutf.sam
39 if(~ $font *Mono*)
40 sam -d $font.troff <$PLAN9/dist/troff/mono.sam
41 cp $font.troff /usr/local/plan9/troff/font/devutf/$font
42 cp $font.tpost /usr/local/plan9/postscript/troff/$font
43 }