I have a file say test.mp that contains:

outputtemplate := "%j-%c.eps";
input cmr10.mf;

When I run mpost as follow:

mpost &mfplain test.mp

Some of the glyphs contain some white parts (e.g. digits 1,2, 5, 7, ...). How can I remove this white parts from these glyphs?

  • 1
    if i understand correctly, what you are calling "white parts" are segments that are produced by metafont using the erase command. if that is so, you don't want to just remove the "white" effect, but to "cut out" those unwanted areas. (this is one of the features that made the creation of type 1 outlines for computer modern such an "interesting" project.) you might find some useful information in the tugboat article Generating Type 1 Fonts from METAFONT Sources by taco hoekwater. Commented Sep 17, 2014 at 15:28
  • 1
    It appears that the CM digits were defined in part using penpos, which Metapost doesn't really understand. I think @barbarabeeton is likely correct. Try commenting out those parts of the code and see if your result is consistent with that hypothesis. As for getting rid of it, you'd have to rewrite the code without those penpos directives. This would likely be a great deal of work, especially if you want high fidelity to the original shapes. (I think, but do not know, that the pos directives in the code are cmbase's version of penpos.) Commented Sep 17, 2014 at 15:39
  • I think both of the above comments are wide of the mark, although Barbara's has an interesting link. The comment about penpos is completely wrong! Both the plain format and the mfplain format used in the Q have a complete implementation of the penpos macros.
    – Thruston
    Commented Nov 2, 2022 at 22:34

1 Answer 1


I know this is old, and I expect that the original question has been solved, but I think I have a nice simple answer. (I am running an up to date TexLive 2022 system on a mac but this should work the same on any reasonably recent TeX environment.)

If I compile the OP example exactly as shown above I get dozens of eps files produced, with a lot of extra white space around them like this:

enter image description here

I have added the red rectangle by hand to show more clearly where the edges of the figure are. I think this is because the output is not a full Postscript EPS file with all the correct headers. And I think this is what the OP meant by "contains some white parts".

Fortunately it is very easy to fix this -- you just need to force mpost to create proper EPS files with prologues := 3 -- so if I amend the OP example to this:

prologues := 3;
outputtemplate := "%j-%c.eps";
input cmr10.mf;

then the files produced have a small extra block of resources at the top, and crucially they start with the correct header line (the first one):

%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 55 -23 485 677 
%%HiResBoundingBox: 55.33301 -22.22342 484.16058 676.85297 
%%Creator: MetaPost 2.02
%%CreationDate: 2022.11.02:2102
%%Pages: 1
%%DocumentResources: procset mpost-minimal
%%DocumentSuppliedResources: procset mpost-minimal
%%BeginResource: procset mpost-minimal
/bd{bind def}bind def/fshow {exch findfont exch scalefont setfont show}bd
/fcp{findfont dup length dict begin{1 index/FID ne{def}{pop pop}ifelse}forall}bd
/fmc{FontMatrix dup length array copy dup dup}bd/fmd{/FontMatrix exch def}bd
/Amul{4 -1 roll exch mul 1000 div}bd/ExtendFont{fmc 0 get Amul 0 exch put fmd}bd
/ScaleFont{dup fmc 0 get Amul 0 exch put dup dup 3 get Amul 3 exch put fmd}bd
/SlantFont{fmc 2 get dup 0 eq{pop 1}if Amul FontMatrix 0 get mul 2 exch put fmd}bd

This header line affects the way that the BBox info is used. With this change, then I think all the characters look like they should with no random white space around them.

enter image description here

I have again added a bounding box line by hand.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .