mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
tfont: accomodate broken fonts with multiply-mapped glyphs
This commit is contained in:
parent
2af649f94c
commit
390c870c0f
1 changed files with 37 additions and 5 deletions
42
dist/troff/tfont
vendored
42
dist/troff/tfont
vendored
|
@ -16,10 +16,42 @@ for(font){
|
||||||
if not if(~ $font *.sfd)
|
if not if(~ $font *.sfd)
|
||||||
font=`{9 basename $font .sfd}
|
font=`{9 basename $font .sfd}
|
||||||
echo '
|
echo '
|
||||||
Open("'$f0'")
|
import fontforge
|
||||||
Generate("'$font^%s.pfb'", "", -1, 72, "map.sfd")
|
f = fontforge.open("'$f0'")
|
||||||
' >fontforge.in
|
ff = fontforge.open("./'$f0'")
|
||||||
fontforge -script fontforge.in
|
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 name $font
|
||||||
echo fontname $font
|
echo fontname $font
|
||||||
|
@ -27,7 +59,7 @@ for(font){
|
||||||
>$font.tpost
|
>$font.tpost
|
||||||
for(h in $hex){
|
for(h in $hex){
|
||||||
if(test -f $font$h.pfb){
|
if(test -f $font$h.pfb){
|
||||||
pfb2pfa $font$h.pfb $font$h.pfa
|
pfb2pfa $font$h.pfb
|
||||||
mv $font$h.pfa /usr/local/plan9/postscript/font/$font$h
|
mv $font$h.pfa /usr/local/plan9/postscript/font/$font$h
|
||||||
afm2troff -h -o 0x$h^00 $font$h.afm >>$font.troff
|
afm2troff -h -o 0x$h^00 $font$h.afm >>$font.troff
|
||||||
echo 0x$h^00 0x$h^FF $font$h >>$font.tpost
|
echo 0x$h^00 0x$h^FF $font$h >>$font.tpost
|
||||||
|
|
Loading…
Reference in a new issue