blob: 3b3e862dc5dc2cba8bda9dbe0cd86fbca9500258 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#!/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}
echo '
import fontforge
f = fontforge.open("'$f0'")
ff = fontforge.open("./'$f0'")
changed = True
while changed:
changed = False
for i in range(0, len(f)):
try:
f[i].temporary = [ ]
except:
pass
for i in range(0, len(f)):
try:
f[i].temporary.append(i)
except:
pass
for i in range(0, len(f)):
try:
g = f[i]
codes = g.temporary
if len(codes) > 1:
print "Doubled: ", g.temporary
gg = ff[i]
f.removeGlyph(g)
for j in range(1, len(codes)):
f.createMappedChar(codes[j])
f.createInterpolatedGlyph(gg, gg, 0)
changed = True
except:
pass
f.generate("'$font^%s.pfb'", "", ("afm",), 72, "map.sfd")
' >fontforge.in
fontforge '-lang=py' -script fontforge.in
{
echo name $font
echo fontname $font
} >$font.troff
>$font.tpost
for(h in $hex){
if(test -f $font$h.pfb){
pfb2pfa $font$h.pfb
mv $font$h.pfa /usr/local/plan9/postscript/font/$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
}
|