commit eaec1e5a39b6de1ed7c4c0e57b46c9e2de230ce3 from: rsc date: Sun Mar 19 06:13:42 2006 UTC junk commit - 5af8dd63eb193290c1f9c316012eb14d538569f1 commit + eaec1e5a39b6de1ed7c4c0e57b46c9e2de230ce3 blob - /dev/null blob + 80fbccb96fd57c7210754d60010d75bd2d66bfc4 (mode 644) --- /dev/null +++ dist/troff/README @@ -0,0 +1,4 @@ +This directory contains tools used to import fonts for use in troff. + +afm2troff.c - simple AFM file reader, generates desc for troff/font/devutf. +tfont - simple TTF or SFD converter blob - /dev/null blob + da185230fba69a5f087abcd25efe7f63d289d01e (mode 644) --- /dev/null +++ dist/troff/afm2troff.c @@ -0,0 +1,93 @@ +#include +#include +#include + +int didname; +int didfontname; +int offset; +void run(char*, int); +Biobuf bout; + +void +usage(void) +{ + fprint(2, "usage: afm2troff [-h] [-o offset] [file...]\n"); + exits("usage"); +} + +void +main(int argc, char **argv) +{ + int i, fd; + + ARGBEGIN{ + case 'h': + didname = 1; + didfontname = 1; + break; + case 'o': + offset = atoi(EARGF(usage())); + break; + default: + usage(); + }ARGEND + + Binit(&bout, 1, OWRITE); + if(argc == 0) + run("", 0); + else{ + for(i=0; i 600) + ad |= 2; + if(code == ' ') + Bprint(&bout, "spacewidth %d\ncharset\n", wid); + else + Bprint(&bout, "%C\t%d\t%d\t%d %04x\n", code, wid, ad, code, code); + } + } +} blob - /dev/null blob + 4d4239715c83ade8425491dc15b69f811e9f0c0b (mode 644) --- /dev/null +++ dist/troff/devutf.sam @@ -0,0 +1,67 @@ +,s/^`.*\n// +,s/^'.*\n// +,s/^‘.*/&\n` "/ +,s/^’.*/&\n' "/ +,s/^".*/&\ndq "/ +,s/^".*/&\ndq "/ +,s/^'.*/&\n’ "/ +,s/^\\.*/&\nbs "/ +,s/^`.*/&\n‘ "/ +,s/^\\`.*/&\nga "/ +,s/^­.*/&\nhy "/ +,s/^®.*/&\nrg "/ +,s/^±.*/&\n+- "/ +,s/^´.*/&\naa "/ +,s/^×.*/&\nmu "/ +,s/^÷.*/&\n-: "/ +,s/^-:.*/&\ndi "/ +,s/^–.*/&\nen "/ +,s/^en.*/&\n\\- "/ +,s/^—.*/&\nem "/ +,s/^em.*/&\n-- "/ +,s/^™.*/&\ntm "/ +,s/^←.*/&\n<- "/ +,s/^↑.*/&\nua "/ +,s/^→.*/&\n-> "/ +,s/^↓.*/&\nda "/ +,s/^↔.*/&\nab "/ +,s/^∀.*/&\nfa "/ +,s/^∂.*/&\npd "/ +,s/^∃.*/&\nte "/ +,s/^∅.*/&\nes "/ +,s/^∇.*/&\ngr "/ +,s/^∉.*/&\n!m "/ +,s/^∍.*/&\nst "/ +,s/^∗.*/&\n** "/ +,s/^∙.*/&\nbu "/ +,s/^√.*/&\nsr "/ +,s/^∝.*/&\npt "/ +,s/^∞.*/&\nif "/ +,s/^∠.*/&\nan "/ +,s/^∧.*/&\nl& "/ +,s/^∨.*/&\nl| "/ +,s/^∩.*/&\nca "/ +,s/^∪.*/&\ncu "/ +,s/^∫.*/&\nis "/ +,s/^∴.*/&\ntf "/ +,s/^≃.*/&\n~= "/ +,s/^≅.*/&\ncg "/ +,s/^≈.*/&\n~~ "/ +,s/^≠.*/&\n!= "/ +,s/^≡.*/&\n== "/ +,s/^≦.*/&\n<= "/ +,s/^≧.*/&\n>= "/ +,s/^⊂.*/&\nsb "/ +,s/^⊃.*/&\nsp "/ +,s/^⊄.*/&\n!b "/ +,s/^⊆.*/&\nib "/ +,s/^⊇.*/&\nip "/ +,s/^⊕.*/&\nO+ "/ +,s/^⊖.*/&\nO- "/ +,s/^⊗.*/&\nOx "/ +,s/^⊢.*/&\ntu "/ +,s/^⊨.*/&\nTu "/ +,s/^⋄.*/&\nlz "/ +,s/^⋯.*/&\nel "/ +w +q blob - /dev/null blob + 48bd9362c51c6425576ac7133f452d2516fa2010 (mode 644) --- /dev/null +++ dist/troff/mono.sam @@ -0,0 +1,4 @@ +,s/^hy "\n//g +,s/^-.*/&\nhy "/ +w +q blob - /dev/null blob + ea99641cc0532d0672b7be6e74284bb308ff0682 (mode 755) --- /dev/null +++ dist/troff/tfont @@ -0,0 +1,43 @@ +#!/usr/local/plan9/bin/rc + +rm *.tpost *.troff *.pfb *.pfa *.afm map.sfd + +hex1=(0 1 2 3 4 5 6 7 8 9 A B C D E F) +hex=() +for(i in $hex1) for(j in $hex1) hex=($hex $i$j) +{ + for(h in $hex) + echo $h 0x$h^00_0x$h^FF +} >map.sfd +for(font){ + f0=$font + if(~ $font *.ttf) + font=`{9 basename $font .ttf} + if not if(~ $font *.sfd) + font=`{9 basename $font .sfd} + fontforge -c 'Open($1); Generate($2, "", -1, 72, "map.sfd")' \ + $f0 $font^%s.pfb map.sfd + { + echo name $font + echo fontname $font + } >$font.troff + >$font.tpost + for(h in $hex){ + if(test -f $font$h.pfb){ + pfb2pfa $font$h.pfb $font$h.pfa + mv $font$h.pfa /usr/local/plan9/postscript/font/dejavu/$font$h + afm2troff -h -o 0x$h^00 $font$h.afm >>$font.troff + echo 0x$h^00 0x$h^FF $font$h >>$font.tpost + } + } + { + echo '0x0027 0x0027 0x19 '$font'20 # map apostrophe to right quote' + echo '0x0060 0x0060 0x18 '$font'20 # map grave to left quote' + } >>$font.tpost + + sam -d $font.troff <$PLAN9/dist/troff/devutf.sam + if(~ $font *Mono*) + sam -d $font.troff <$PLAN9/dist/troff/mono.sam + cp $font.troff /usr/local/plan9/troff/font/devutf/$font + cp $font.tpost /usr/local/plan9/postscript/troff/$font +}