[metapost] Metafont: editing CM source files (was: [OT]: Where to ask for help with metafont?)

Dan Luecking luecking at uark.edu
Wed Apr 4 18:46:30 CEST 2007


At 04:20 AM 4/4/2007, you wrote:

>I wanted to edit cmr12.mf to see what happens.
>So I copied the original file into a work directory, changed its name and ran
>metafont on it:
>
>  $ mf my-cmr12.mf
>  $ gftopk my-cmr12.2602gf

That numerical extension should match the resolution
of your printer. Also, a tfm file should be created.
The number 2602 means that no printer mode was selected;
that is the resolution Knuth assigned to "proof" mode.
In proof mode, a tfm file is not created.

You should have written something like:

$ mf \mode:=ljfour; input my-cmr12

[note: the backslash may need to be "escaped" or quoted.]
In this example "ljfour" mode is selected and it is defined
to produce a 600dpi font. You should scan modes.mf in your
texmf tree for a mode with a dpi that matches your printer.

>. Then, in my-file.tex I put:
>
>\font\myfont=my-cmr12
>\myfont
>Hallo
>\vfill\eject\end
>
>, and then I do:
>
>  $ tex my-file

Now, since a tfm file was not created, probably a script named
something like maketfm or mktextfm is invoked that tries to
create the tfm file. This script will likely run the command
I suggested above (or something like it). The tfm file might
automatically be moved to a writable portion of a texmf tree
(perhaps in some place like fonts/tfm/public/).

>. Now, the changes I do in my-cmr12.mf seem to produce no effect at all in the
>my-file.dvi output file.  For example, if I change the 12pt size into 50pt, in
>dvi file the characters are always 12pt small.

If you examine the dvi file with a viewer like xdvi, or make
postscript with dvips, a pk file will usually be generated
automatically. It, too, may be automatically moved to some
part of a texmf tree (perhaps in fonts/pk/ljfour/public).

If you now edit my-cmr12 and run mf without a proper
font-making mode, there will be no new tfm created. TeX
will use the tfm it automatically created on the earlier run.

What your dvi viewer will do, I don't know, but one of two
things: it will find the previously created pk file (because
it parallels the tfm file that was used by TeX) or it will
search the current directory first and use the pk file there.
Since you saw no change, chances are the former.

If you are creating a font and still editing it, there are two
ways to proceed: 1) use proof mode (the default, and what you
have been getting). In that case there is a utility called
gftodvi that creates a dvi file with one large character on
each page, allowing you to evaluate each character design in
isolation.

Or 2) you can evaluate your font in a document, but in that
case you don't want proof mode, but rather a mode that will
match your printer and/or dvi viewing software. A typical
edit/view cycle is:

1. mf \mode:=localfont; input my-cmr12
2. gftopk my-cmf12.600gf
3. tex testfile
4. view texfile

[The mode localfont is a default defined at the very end of
modes.mf. Typically it is equated to ljfour. If that doesn't
match the dpi of your printer, change its definition and
remake the mf format.]

While testing is going on, always make sure a new tfm file
and new pk file have been created by _your_ commands. If you
skip a step, an automatic mktex* script might create a tfm or
pk file for you, and move it to some other location. In that
case, those might get re-used next time instead of your newly
edited version.

What you need to do now is search texmf-var (or wherever newly
created files are placed by mktex*) and delete occurances of
my-cmr12.*. Then follow the cycle above.

One final note: if you change the magnification in your .tex file
(to \magstep1 for example), your dvi viewer will want a different
size pk file. In the above example, it will need my-cmr12.720pk.
You can anticipate this by running mf with an appropriate mag
command:
  $ mf \mode:=localfont; mag:=magstep(1); input mycmr12
If you don't, again an automatic script may be run and the
resulting pk cached for later use.

N.B. The backslash in these commands is for metafont to read. If
your shell interprets backslashes as an escape character, you
will need to escape or quote it as is appropriate for your shell.


Regards,
Dan


Daniel H. Luecking
Department of Mathematical Sciences
University of Arkansas
"I reject your reality, and substitute my own" --Adam Savage



More information about the metapost mailing list