Debian Codegraph @

texmf-dist/doc/metapost/base/source-manual/mpman-app-legacy.tex

raw
1 \svnInfo $Id$
2 \section{Legacy Information}
3 \label{legacy}
4
5 \subsection{MetaPost Versus \MF}
6 \label{MPvsMF}
7
8 Since the \MF\index{metafont?\MF} and MetaPost languages have so much in
9 common, expert users of \MF\ will want to skip most of the explanations
10 in this document and concentrate on concepts that are unique to
11 MetaPost. The comparisons in this appendix are intended to help experts
12 that are familiar with {\sl The\ \MF book} as well as other users that
13 want to benefit from Knuth's more detailed explanations \cite{kn:c}.
14
15 Since \MF\ is intended for making \TeX\ fonts, it has a number of
16 primitives for generating the {\tt tfm}\index{tfm file?{\tt tfm}
17 file}\index{files!tfm?{\tt tfm}} files that \TeX\ needs for character
18 dimensions, spacing information, ligatures\index{ligatures} and
19 kerning\index{kerning}. MetaPost can also be used for generating fonts,
20 and it also has \MF's primitives for making {\tt tfm} files. These are
21 listed in Table~\ref{tfmprim}. Explanations can be found in the \MF\
22 documentation \cite{kn:c,kn:mf3}.
23
24 \begin{table}[htp]
25 $$\begin{tabular}{|l|l|} \hline
26 commands& {\tt charlist}, {\tt extensible},
27 {\tt fontdimen}, {\tt headerbyte} \\
28 & {\tt kern}, {\tt ligtable} \\ \hline
29 ligtable operators& \verb!::!, \verb!=:!, \verb!=:|!, \verb!=:|>!,
30 \verb!|=:!, \verb!|=:>!, \\
31 & \verb!|=:|!, \verb!|=:|>!, \verb!|=:|>>!,
32 \verb!||:! \\ \hline
33 internal variables\index{internal variables}\index{variables!internal}&
34 {\tt boundarychar}, {\tt chardp},
35 {\tt charext}, {\tt charht}, \\
36 & {\tt charic}, {\tt charwd},
37 {\tt designsize}, {\tt fontmaking} \\ \hline
38 other operators& {\tt charexists} \\ \hline
39 \end{tabular}
40 $$
41 \caption{MetaPost primitives for making {\tt tfm} files.}
42 \label{tfmprim}
43 \end{table}
44
45 Even though MetaPost has the primitives for generating fonts, many of
46 the font-making primitives and internal variables that are part of Plain
47 \MF\index{metafont?\MF} are not defined in Plain MetaPost\index{Plain
48 macros}. Instead, there is a separate macro package called {\tt
49 mfplain}\index{mfplain?\texttt{mfplain}} that defines the macros
50 required to allow MetaPost to process Knuth's Computer Modern fonts as
51 shown in Table~\ref{mfponly} \cite{kn:e}. To load these macros, put
52 ``\verb|&mfplain|'' before the name of the input file. This can be done
53 at the {\tt **} prompt after invoking the MetaPost interpreter with no
54 arguments, or on a command line that looks something like
55 this:\footnote{Command line syntax is system dependent. Quotes are
56 needed on most Unix systems to protect special characters like
57 {\tt\&}.}
58 $$ \hbox{\verb|mpost '&mfplain' cmr10|} $$
59 The analog of a \MF\ command line like
60 $$ \hbox{\verb|mf '\mode=lowres; mag=1.2; input cmr10'|} $$
61 is
62 $$ \hbox{\verb|mpost '&mfplain \mode=lowres; mag=1.2; input cmr10'|} $$
63 The result is a set of PostScript\index{PostScript} files, one for each
64 character in the font. Some editing would be required in order to
65 merge them into a downloadable Type~3 PostScript font~\cite{ad:red2}.
66
67 \begin{table}[htp]
68 $$
69 \renewcommand{\FancyVerbFormatLine}[1]{\hbox{#1}\strut}
70 \begin{tabular}{|l|} \hline
71 \multicolumn 1{|c|}
72 {Defined in the {\tt mfplain} package} \\ \hline
73 \begin{verbatim}
74 beginchar font_identifier
75 blacker font_normal_shrink
76 capsule_def font_normal_space
77 change_width font_normal_stretch
78 define_blacker_pixels font_quad
79 define_corrected_pixels font_size
80 define_good_x_pixels font_slant
81 define_good_y_pixels font_x_height
82 define_horizontal_corrected_pixels italcorr
83 define_pixels labelfont
84 define_whole_blacker_pixels makebox
85 define_whole_pixels makegrid
86 define_whole_vertical_blacker_pixels maketicks
87 define_whole_vertical_pixels mode_def
88 endchar mode_setup
89 extra_beginchar o_correction
90 extra_endchar proofrule
91 extra_setup proofrulethickness
92 font_coding_scheme rulepen
93 font_extra_space smode
94 \end{verbatim}
95 \\ \hline
96 \multicolumn 1{|c|}
97 {Defined as no-ops in the {\tt mfplain} package}\\ \hline
98 \begin{verbatim}
99 cullit proofoffset
100 currenttransform screenchars
101 gfcorners screenrule
102 grayfont screenstrokes
103 hround showit
104 imagerules slantfont
105 lowres_fix titlefont
106 nodisplays unitpixel
107 notransforms vround
108 openit
109 \end{verbatim}
110 \\ \hline
111 \end{tabular}
112 \renewcommand{\FancyVerbFormatLine}[1]{#1}
113 $$
114 \caption{Macros and internal variables defined only in the {\tt mfplain}
115 package.}
116 \label{mfponly}
117 \end{table}
118
119
120 \begin{table}
121 \centering
122 \begin{tabular}{|c|}\hline
123 MetaPost primitives not found in \MF\\\hline
124 \begin{minipage}[b]{.75\linewidth}\ttfamily
125 \begin{multicols}{3}
126 blackpart\\
127 bluepart\\
128 bounded\\
129 btex\\
130 clip\\
131 clipped\\
132 closefrom\\
133 cmykcolor\\
134 color\\
135 colormodel\\
136 cyanpart\\
137 dashed\\
138 dashpart\\
139 defaultcolormodel\\
140 etex\\
141 filenametemplate\\
142 filled\\
143 fontmapfile\\
144 fontmapline\\
145 fontpart\\
146 fontsize\\
147 for within\\
148 glyph of\\
149 greenpart\\
150 greypart\\
151 hour\\
152 infont\\
153 jobname\\
154 linecap\\
155 linejoin\\
156 llcorner\\
157 lrcorner\\
158 magentapart\\
159 minute\\
160 miterlimit\\
161 mpprocset\\
162 mpxbreak\\
163 numberprecision\\
164 numbersystem\\
165 outputfilename\\
166 outputformat\\
167 outputformatoptions\\
168 outputtemplate\\
169 pathpart\\
170 penpart\\
171 prologues\\
172 readfrom\\
173 redpart\\
174 restoreclipcolor\\
175 rgbcolor\\
176 setbounds\\
177 stroked\\
178 textpart\\
179 textual\\
180 tracinglostchars\\
181 troffmode\\
182 truecorners\\
183 ulcorner\\
184 urcorner\\
185 verbatimtex\\
186 withcmykcolor\\
187 withcolor\\
188 withgreyscale\\
189 withoutcolor\\
190 withpostscript\\
191 withprescript\\
192 withrgbcolor\\
193 write to\\
194 yellowpart
195 \end{multicols}
196 \end{minipage}\\\hline
197
198 Variables and Macros defined only in Plain MetaPost\\\hline
199 \begin{minipage}[b]{.75\linewidth}\ttfamily
200 \begin{multicols}{3}
201 ahangle\\
202 ahlength\\
203 background\\
204 bbox\\
205 bboxmargin\\
206 beginfig\\
207 beveled\\
208 black\\
209 blue\\
210 buildcycle\\
211 butt\\
212 center\\
213 colorpart\\
214 cutafter\\
215 cutbefore\\
216 cuttings\\
217 dashpattern\\
218 defaultfont\\
219 defaultpen\\
220 defaultscale\\
221 dotlabel\\
222 dotlabels\\
223 drawarrow\\
224 drawdblarrow\\
225 drawoptions\\
226 endfig\\
227 EOF\\
228 evenly\\
229 extra\_beginfig\\
230 extra\_endfig\\
231 green\\
232 image\\
233 label\\
234 labeloffset\\
235 mitered\\
236 red\\
237 rounded\\
238 squared\\
239 thelabel\\
240 white
241 \end{multicols}
242 \end{minipage}\\\hline
243 \end{tabular}
244 \caption{Macros and internal variables defined in MetaPost but not \MF.}
245 \label{mponly}
246 \end{table}
247
248 Another limitation of the {\tt mfplain} package is that certain internal
249 variables from Plain \MF\index{metafont?\MF} cannot be given reasonable
250 MetaPost definitions. These include {\tt displaying}, {\tt
251 currentwindow}, \verb|screen_rows|, and \verb|screen_cols| which depend
252 on \MF's ability to display images on the computer screen. In addition,
253 \verb|pixels_per_inch| is irrelevant since MetaPost uses fixed units of
254 PostScript\index{PostScript!point}\index{point!PostScript} points.
255
256 The reason why some macros and internal variables\index{internal
257 variables}\index{variables!internal} are not meaningful in MetaPost is
258 that \MF\ primitive commands {\tt cull}, {\tt display}, {\tt
259 openwindow}, {\tt numspecial} and {\tt totalweight} are not implemented
260 in MetaPost. Also not implemented are a number of internal variables as
261 well as the \tdescr{drawing option} {\tt withweight}. Here is a
262 complete listing of the internal variables whose primitive meanings in
263 \MF\ do not make sense in MetaPost:
264 $$\begin{verbatim}
265 autorounding fillin smoothing turningcheck
266 chardx granularity tracingedges xoffset
267 chardy proofing tracingpens yoffset
268 \end{verbatim}
269 $$
270
271 There is also one \MF\ primitive that has a slightly different meaning in
272 MetaPost. Both languages allow statements of the
273 form\index{special?\texttt{special}}\label{Dspecl}
274 $$ {\tt special}\, \descr{string expression} \hbox{\tt;} $$
275 but \MF\ copies the string into its ``generic font'' output file, while
276 MetaPost interprets the string as a sequence of PostScript\index{PostScript}
277 commands that are to be placed at the beginning of the next output file.
278
279 In this regard, it is worth mentioning that rules in \TeX\ material
280 included via {\tt btex..etex} in MetaPost are rounded to the correct
281 number of pixels according to PostScript\index{PostScript!conversion rules}
282 conversion rules~\cite{ad:red2}. In \MF, rules are not generated
283 directly, but simply included in specials and interpreted later by
284 other programs, such as {\tt gftodvi}\index{gftodvi?\ttt{gftodvi}},
285 so there is no special conversion.
286
287 All the other differences between \MF\ and MetaPost are features found
288 only in MetaPost. These are listed in Table~\ref{mponly}. The only
289 commands listed in this table that the preceding sections do not discuss
290 are
291 \verb|extra_beginfig|\index{extra_beginfig?\texttt{extra\_beginfig}}\label{Dxbfig},
292 \verb|extra_endfig|\index{extra_endfig?\texttt{extra\_endfig}}\label{Dxefig},
293 and {\tt mpxbreak}. The first two are strings that contain extra
294 commands to be processed by {\tt
295 beginfig}\index{beginfig?\texttt{beginfig}} and {\tt
296 endfig}\index{endfig?\texttt{endfig}} just as \verb|extra_beginchar| and
297 \verb|extra_endchar| are processed by {\tt beginchar} and {\tt endchar}.
298 (The file {\tt boxes.mp}\index{boxes.mp?\texttt{boxes.mp}} uses these
299 features).
300
301 The other new feature listed in Table~\ref{mponly} not listed in the
302 index is {\tt mpxbreak}\index{mpxbreak?\texttt{mpxbreak}}. This is used
303 to separate blocks of translated \TeX\index{TeX?\TeX} or
304 troff\index{troff} commands in {\tt mpx}\index{mpx file?{\tt mpx}
305 file}\index{files!mpx?{\tt mpx}} files. It should be of no concern to
306 users since {\tt mpx} files are generated automatically.
307
308 \subsection{File Name Templates}
309 \label{Dfilenametemplate}
310
311 The output file naming template mechanism introduced in MetaPost
312 version~1.000 originally used a primitive called
313 \ttindex{filenametemplate}, as opposed to the internal string variable
314 \ttt{outputtemplate}\index{outputtemplate?\texttt{outputtemplate}}
315 described in section~\ref{Doutputtemplate}. This primitive took a
316 string argument with the same syntax as \ttt{outputtemplate}, except
317 that it didn't know about the \verb|%{...}| escape sequence for
318 evaluating internal variables, e.g.,:
319
320 $$\begin{verbatim}
321 filenametemplate "%j-%c.mps";
322 \end{verbatim}
323 $$
324
325 The \verb|filenametemplate| primitive has been deprecated since the
326 introduction of \verb|outputtemplate| (version~1.200), but is still
327 supported. If you happen to need writing future-proof source files,
328 that at the same time are backwards compatible to MetaPost versions
329 between 1.000 and~1.200, this output filename template declaration might
330 help:
331
332 $$\begin{verbatim}
333 if scantokens(mpversion) < 1.200:
334 filenametemplate
335 else:
336 outputtemplate :=
337 fi
338 "%j-%c.mps";
339 \end{verbatim}
340 $$
341
342
343 %%% Local Variables:
344 %%% mode: latex
345 %%% TeX-PDF-mode: t
346 %%% TeX-master: "mpman"
347 %%% End: