[metapost] problem with 'dvips mproof'

Reinhard Kotucha reinhard.kotucha at web.de
Sun Oct 10 02:52:59 CEST 2010


On 9 October 2010 Stephan Hennig wrote:

 > Hi,
 > 
 > when processing a file s.mp containing the lines
 > 
 > prologues := 3;
 > beginfig(1);
 >    label("test", origin);
 > endfig;
 > end
 > 
 > as
 > 
 >    mpost s
 >    tex mproof s.1
 >    dvips mproof
 > 
 > I have difficulties watching the resulting file mproof.ps in GSview or 
 > PS_View (remember, this is dvips output).  Symptoms are different for 
 > different values of variable prologues.
 > 
 > 
 > PS_View
 > 
 >    0   -   The files looks fine with text "test" probably rendered in
 >            CMR.
 > 
 >    1   -   Fine again.  But at closer inspection the kerning between
 >            letters changes slightly in comparison to prologues:=0.
 > 
 >    2   -   Exactly the same as with prologues:=1.
 > 
 >    3   -   The text is visible, but rendered with something else than
 >            CMR (probably Courier).

If you want to post-process the file with dvips, set prologues := 0
(or not at all).  Then you'll see a comment line

%*Font: cmr10 9.96265 9.96265 65:8003

in the created PostScript file.  This line is evaluated by dvips and
allows dvips to insert the fonts.  Its format is explained on page 29
of the dvips manual.

With prologues > 0 metapost creates (more or less) standalone
PostScript files.  Standalone means that either the font is embedded
or is included by the PS interpreter itself.

PostScript doesn't know anything about kerning.  It just concatenates
glyphs.  Kerning information is provided in AFM files, but they are
not used by PS interpreters.

If you set prologues := 0, then dvips inserts the fonts itself.  dvips
looks for fonts and TFM files in texmf trees and therefore has access
to everything needed in order to typeset metapost labels perfectly.

As said before, PostScript doesn't support kerning itself, but kerning
can be applied by programs creating PS files.  In the example below
I inserted kerning information manually, but it's similar to what
dvips actually does.

------------------------------------------------------------
%!PS
/fontsize 200 def
/Palatino-Roman fontsize selectfont

% PS interpreters concatenate glphs, no kerning is applied.

100 400 moveto
(AV) show

% Kerning pair from the AFM file (unit is fontsize/1000):
% KPX A V -140

% Kerning manually inserted from the information provided 
% by the AFM file.  dvips retrieves kerning pairs from TFM files.
% dvips also provides a procedure which allows less verbose output
% than in this example.

% Just for convenience:
/kern { fontsize mul 1000 div 0 rmoveto } def

100 200 moveto
(A) show -140 kern (V) show

showpage
------------------------------------------------------------

BTW, the prologues variable might be confusing because you have to
remember what all the values are good for.  But it's probably helpful
to know that Metapost was designed to support dvips in the first
place, hence you don't have to set prologues at all for dvips.

Regards,
  Reinhard

-- 
----------------------------------------------------------------------------
Reinhard Kotucha			              Phone: +49-511-3373112
Marschnerstr. 25
D-30167 Hannover	                      mailto:reinhard.kotucha at web.de
----------------------------------------------------------------------------
Microsoft isn't the answer. Microsoft is the question, and the answer is NO.
----------------------------------------------------------------------------


More information about the metapost mailing list