7

I need to generate a font from METAFONT file. I used mf2pt1 and generated PFB file and TFM file, but TFM file was incorrect.

I tried to generate TMF file of cmr10.mf by mf2pt1, then looked at cmr10.tmf by tftopl.

(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 16761661120)
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.020833)
   (STRETCH R 0.010417)
   (SHRINK R 0.006945)
   (XHEIGHT R 0.02691)
   (QUAD R 0.0625)
   (EXTRASPACE R 0.006945)
   )
(LIGTABLE
   (LABEL O 40)
   (KRN C l R -0.017362)
   (KRN C L R -0.019965)
   (STOP)
   (LABEL C f)
   (LIG C i O 14)
   (LIG C f O 13)
   (LIG C l O 15)
   (KRN O 47 R 0.004861)
   (KRN O 77 R 0.004861)
   (KRN O 41 R 0.004861)
   (KRN O 51 R 0.004861)
   (KRN O 135 R 0.004861)
   (STOP)

But looked at cmr10.tfm distributed by TeXLive 2013,

(FAMILY CMR)
(FACE O 352)
(CODINGSCHEME TEX TEXT)
(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 11374260171)
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.333334)
   (STRETCH R 0.166667)
   (SHRINK R 0.111112)
   (XHEIGHT R 0.430555)
   (QUAD R 1.000003)
   (EXTRASPACE R 0.111112)
   )
(LIGTABLE
   (LABEL O 40)
   (KRN C l R -0.277779)
   (KRN C L R -0.319446)
   (STOP)
   (LABEL C f)
   (LIG C i O 14)
   (LIG C f O 13)
   (LIG C l O 15)
   (KRN O 47 R 0.077779)
   (KRN O 77 R 0.077779)
   (KRN O 41 R 0.077779)
   (KRN O 51 R 0.077779)
   (KRN O 135 R 0.077779)
   (STOP)

Like this, kerning information are different in two files.

In addition, I tried to generate TFM file mf2pt1 in TeXLive 2012 and looked at this.

(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 11374260171)
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.333334)
   (STRETCH R 0.166667)
   (SHRINK R 0.111112)
   (XHEIGHT R 0.430555)
   (QUAD R 1.000003)
   (EXTRASPACE R 0.111112)
   )
(LIGTABLE
   (LABEL O 40)
   (KRN C l R -0.277779)
   (KRN C L R -0.319446)
   (STOP)
   (LABEL C f)
   (LIG C i O 14)
   (LIG C f O 13)
   (LIG C l O 15)
   (KRN O 47 R 0.077779)
   (KRN O 77 R 0.077779)
   (KRN O 41 R 0.077779)
   (KRN O 51 R 0.077779)
   (KRN O 135 R 0.077779)
   (STOP)

This TFM file is nearly equal what is distributed by TeXLive 2013.

mf2pt1 uses MetaPost(mpost) to generate TFM file, and MetaPost updated version 1.803 from version 1.504 in TeXLive 2013. So I think this problem is occurred by something bug of MetaPost 1.803.

Thanks.

P.S.(7/6)

I read Perl source code of mf2pt1.pl and checked a command which execute mpost to make TFM file. At lines 429-430 in mf2pt1.pl,

execute_command 1, ("mpost", "-mem=mf2pt1", "-progname=mpost",
                    "\\mode:=localfont; mag:=$mag; bpppix $bpppix; nonstopmode; input $mffile");

And generate following command (in this case to use cmr10.mf)

$ mpost -mem=mf2pt1 -progname=mpost '\mode:=localfont; mag:=100.375; bpppix 0.02; nonstopmode; input cmr10.mf'

I run this command with both mpost 1.803 and mpost 1.504, generated each TFM files, and compered these files. Then the kerning information of TMF file generated by mpost 1.803 was incorrect.

So I think why this problem occurred are some of

  • bugs of MetaPost (mpost) 1.803
  • errors of mf2pt1.mp (called by mf2pt1)

I would like to solve this problem, but I don't have knowledge enough to solve this...

P.S.(7/8)

I read mf2pt1.mp, then understood that mfplain.mp is called by mf2pt1.mp. According to MetaPost manual,

Even though MetaPost has the primitives for generating fonts, many of the font-making primitives and internal variables that are part of Plain METAFONT are not defined in Plain MetaPost. Instead, there is a separate macro package called mfplain that defines the macros required to allow MetaPost to process Knuth’s Computer Modern fonts

So I compered mfpain.mf in TeXLive 2012 with that in TeXLive 2013. But they are equal.

Therefore, I think the cause of generating wrong TFM files is MetaPost primitives for generating TFM files. I read change log of MetaPost, But I can't seem to change the primitives for generating TFM files.

  • 2
    I can confirm the output; the error might also depend on mf2pt1; possibly a bad interaction with the new version of mpost. – egreg Jul 5 '13 at 16:19
  • Any news about the issue? – egreg Jan 4 '14 at 23:24
3

I tried

mf2pt1 cmr10

with today's (2014-05-3) update available in the development version of TeX Live 2014. Doing tftopl cmr10 reveals the following file:

(DESIGNSIZE R 10.0)
(COMMENT DESIGNSIZE IS IN POINTS)
(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)
(CHECKSUM O 11374260171)
(FONTDIMEN
   (SLANT R 0.0)
   (SPACE R 0.333334)
   (STRETCH R 0.166667)
   (SHRINK R 0.111112)
   (XHEIGHT R 0.430555)
   (QUAD R 1.000003)
   (EXTRASPACE R 0.111112)
   )

and doing diff with the output of tftopl from the standard cmr10.tfm file shows that the newly generated one misses

(FAMILY CMR)
(FACE O 352)
(CODINGSCHEME TEX TEXT)

and for some characters the height is computed inaccurately: for characters

O 44   $
O 45   %
O 50   (
O 51   )
O 52   *
O 57   /
O 133  [
O 135  ]

the height is 0.75 in the original metrics, while it's not specified in the metric file produced by mf2pt1.

The log file has many warnings Replacing filldraw with fill.. There are also several internal errors in the run of fontforge, such as

Internal Error (overlap) in A: couldn't find a needed exit from an intersection
Internal Error (overlap) in A: couldn't find a needed exit from an intersection
Internal Error (overlap) in G: monotonic is both needed and unneeded (451,274)->(621,271). x=587.505 (prev=585.5)

However, the main issue seems to have been solved.

  • Thank you. In MetaPost ChangeLog > * Fixed TFM generation issues (various scale-related errors). at Version 1.890. So I think this issue was solved by this fix. – yyu May 5 '14 at 5:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.