summaryrefslogtreecommitdiff
path: root/fonts/utilities/mm/mmfont
blob: 0b9570ce762478c3cfbebd1cf8eb66476c77164d (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/usr/bin/bash 
#
#make a Minion or Myriad font instance
#-------------------------------------------------
#there are 3 axes in Minion:
#the weight ranges from 345 to 620
#the width ranges from 450 to 600
#the size varies from 6 to 72
#
#there are 2 axes in Myriad:
#the weight ranges from 215 to 830
#the width ranges from 300 to 750
#
TDS=/home/spqr/tds
MMHOME=/home/spqr/psfonts/mmafm
MMDEST=$TDS/dvips/mm
TFMDEST=$TDS/fonts/tfm/adobe/mm
VFDEST=$TDS/fonts/vf/adobe/mm
#
#option allows us just to generate the AFM files, not run fontinst
#
AFM=
while true; do
	case $1 in
          -afm) shift ; AFM=y ; break;;
	   *) break;;
        esac
done
FNAME=$1
FAM=`expr $FNAME : '^z\(..\).*$'`
IWEIGHT=`expr $FNAME : '^zm.\(.*\)[78]t.*$'`
WIDTH=`expr $FNAME : '^[a-z]*[78]t\([^0-9]*\).*$'`
SIZE=`expr $FNAME : '^.*[78]t[^0-9]*\([0-9]*\)$'`
ENCODING=`expr $FNAME : '^.*\([78]t\).*$'`
USESIZE=`echo $SIZE \* 1.095 | bc`
WEIGHT=`expr $IWEIGHT : '\(.\).*'`
SHAPE=`expr $IWEIGHT : '.\(.*\)'`
EXTRA=
case $FAM in
  mn) FULLFAM=Minion ; EXPERT=y;;
  my) FULLFAM=Myriad; EXPERT=;;
  *) echo Unknown MM family $FAM  >&2; exit 1;;
esac

if test "${SHAPE}" = "i"
then
  PFA=${FULLFAM}MM-It
  EPFA=${FULLFAM}MM-ItEp
  LSHAPE="it"
else
  PFA=${FULLFAM}MM
  EPFA=${FULLFAM}MM-Ep
 if test "${SHAPE}" = "c"
 then
  LSHAPE="sc"
  IWEIGHT=$WEIGHT
  EXTRA="c"
 else
  LSHAPE="n"
 fi
fi
if test "${WIDTH}x" = "x"
then
 REALWIDTH="r"
else
 REALWIDTH=$WIDTH
fi
case $WEIGHT in
	h) LWEIGHT="ul"; MINWEIGHT=345; MYWEIGHT=215;; #hairline
	j) LWEIGHT="el"; MINWEIGHT=360; MYWEIGHT=291;; #extralight
	l) LWEIGHT="l";  MINWEIGHT=380; MYWEIGHT=367;; #light
	k) LWEIGHT="sl"; MINWEIGHT=400; MYWEIGHT=443;; #book
	m) LWEIGHT="m";  MINWEIGHT=415; MYWEIGHT=519;; #Medium
	s) LWEIGHT="sb"; MINWEIGHT=500; MYWEIGHT=595;; #semibold
	b) LWEIGHT="b";  MINWEIGHT=580; MYWEIGHT=671;; #bold
	x) LWEIGHT="eb"; MINWEIGHT=600; MYWEIGHT=747;; #ExtraBold
	u) LWEIGHT="ub"; MINWEIGHT=620; MYWEIGHT=830;; #UltraBlack
	*) echo BAD WEIGHT  >&2; exit 1;;
esac
case $REALWIDTH in
	o) LWIDTH="uc"; MINWIDTH=450; MYWIDTH=300;; #UltraCondensed
	q) LWIDTH="ec"; MINWIDTH=468; MYWIDTH=350;; #ExtraCondensed
	c) LWIDTH="c"; MINWIDTH=490; MYWIDTH=400;; #Condensed
	n) LWIDTH="sc"; MINWIDTH=510; MYWIDTH=450;; #Narrow
	r) LWIDTH="m"; MINWIDTH=535; MYWIDTH=500;; #Regular
	x) LWIDTH="sx"; MINWIDTH=550; MYWIDTH=550;; #Extended
	e) LWIDTH="x"; MINWIDTH=565; MYWIDTH=600;; #Expanded
	v) LWIDTH="ex"; MINWIDTH=584; MYWIDTH=650;; #Extra Expanded
	w) LWIDTH="ux"; MINWIDTH=600; MYWIDTH=700;; #Wide
	*) echo BAD WIDTH >&2; exit 1;;
esac
ORID=`pwd`
cd $MMHOME
if test "$LWIDTH$LWEIGHT" = "mm"
then
 LSERIES="m"
else
 if test "$LWIDTH" = "m"
 then
  LWIDTH="" 
 fi
 if test "$LWEIGHT" = "m"
 then
  LWEIGHT=""
 fi
 LSERIES=$LWEIGHT$LWIDTH
fi
if test "$ENCODING" = "8t"
then
 LATEXENC=T1
 SUFFIX=8t
else
 LATEXENC=OT1
 SUFFIX=7t
fi
EFNAME=z$FAM${IWEIGHT}8x${WIDTH}${SIZE}
RNAME=z$FAM${IWEIGHT}8r${WIDTH}${SIZE}
FINALNAME=z$FAM${IWEIGHT}${EXTRA}${SUFFIX}${WIDTH}${SIZE}
RAWNAME=z$FAM${IWEIGHT}8a${WIDTH}${SIZE}
echo $RAWNAME: $EFNAME, $RNAME, $FINALNAME
#echo $FNAME: $FAM / $WEIGHT [ $IWEIGHT ] / $WIDTH / $SIZE / $SHAPE: $LSERIES / $LSHAPE >&2
if test "${SHAPE}" != "c"
then 
 echo "$RNAME $RAWNAME \" TeXBase1Encoding ReEncodeFont \" <8r.enc <$PFA.PFA <$RAWNAME.pro" > $RAWNAME.map
fi
makeinstance.sh $PFA $RAWNAME $MINWEIGHT $MINWIDTH $USESIZE 
if test "$EXPERT"x != "x"
then
 echo "$EFNAME $EFNAME <$EPFA.PFA <$EFNAME.pro" > $EFNAME.map
 makeinstance.sh $EPFA $EFNAME $MINWEIGHT $MINWIDTH $USESIZE >& /dev/null
fi
if test "$AFM"x != "x"
then
 exit 0
fi
cat > _min$$.tex <<HERE
\input fontinst.sty
\needsfontinstversion{1.5}
\installfonts
\installfamily{${LATEXENC}}{foo}{}
 \transformfont{$RNAME}{\reencodefont{8r}{\fromafm{$RAWNAME}}}
HERE
if test "$EXPERT"x != "x"
then
 if test "${SHAPE}" = "c"
 then
echo "\\installfont{$FINALNAME}{$RNAME,$EFNAME,latin}{${LATEXENC}c}{${LATEXENC}}{foo}{$LSERIES}{$LSHAPE}{}" >> _min$$.tex 
 else
 echo "\\installfont{$FINALNAME}{$RNAME,$EFNAME,latin}{${LATEXENC}}{${LATEXENC}}{foo}{$LSERIES}{$LSHAPE}{}" >> _min$$.tex
 fi
else
 if test "${SHAPE}" = "c"
 then
 echo " \\installfont{$FINALNAME}{$RNAME,latin}{${LATEXENC}c}{${LATEXENC}}{foo}{$LSERIES}{$LSHAPE}{}" >> _min$$.tex
 else
 echo "\\installfont{$FINALNAME}{$RNAME,latin}{${LATEXENC}}{${LATEXENC}}{foo}{$LSERIES}{$LSHAPE}{}" >> _min$$.tex
 fi
fi
cat >> _min$$.tex <<THERE
\endinstallfonts
\bye
THERE
tex _min$$ 
rm _min$$.*
pltotf $RNAME.pl $RNAME.tfm >& /dev/null
vptovf $FINALNAME.vpl $FINALNAME.vf $FINALNAME.tfm >& /dev/null
rm $RNAME.pl $FINALNAME.vpl 
rm ${LATEXENC}foo.fd 
rm $RAWNAME.afm
mv $RNAME.tfm $FINALNAME.tfm $TFMDEST 
mv $FINALNAME.vf $VFDEST
mv $RAWNAME.pro $MMDEST
cat z$FAM${IWEIGHT}8*${WIDTH}${SIZE}.map $MMDEST/mm.map | sort | uniq > $$.map
mv $$.map $MMDEST/mm.map
rm $RAWNAME.* 
if test "$EXPERT"x != "x"
then
 pltotf $EFNAME.pl $EFNAME.tfm >& /dev/null
 mv $EFNAME.pro $MMDEST
 mv $EFNAME.tfm $TFMDEST
 rm $EFNAME.*
fi
cd $ORID