[tex-live] How to use MFTOEPS? (noob)

Zdenek Wagner zdenek.wagner at gmail.com
Thu Mar 15 10:31:36 CET 2012


2012/3/15 Reinhard Kotucha <reinhard.kotucha at web.de>:
> On 2012-03-14 at 23:24:09 +0100, Zdenek Wagner wrote:
>
>  > 2012/3/14 Reinhard Kotucha <reinhard.kotucha at web.de>:
>  > > On 2012-03-14 at 16:47:59 +0200, Khaled Hosny wrote:
>  > >
>  > > > On Wed, Mar 14, 2012 at 05:01:05PM +0530, Shriramana Sharma wrote:
>  > > > > 2012/3/14 Zdenek Wagner <zdenek.wagner at gmail.com>:
>
>  > > > > > First, although I appreciate Anshu's work, I do not think
>  > > > > > that this is the right tool for producing fonts.
>  > > > >
>  > > > > Meta*Font* is not the right tool to produce fonts?!
>  > > >
>  > > > Yes. MataFont produces bitmaps (and IIAC, often optimised to the target
>  > > > output device), in this time and age you need scalable outlines that
>  > > > would be rasterised on the target device. MataFont as a language might
>  > > > still superior for meta design, and then a MetaPost-based solution would
>  > > > be the logical choice (e.g. the Latin Modern fonts).
>  > >
>  > > The Latin Modern fonts were created with MetaType1.  I suppose that they
>  > > were created from the Metafont sources but I don't know anything about
>  > > the Metafont => MetaPost conversion.  Maybe there are a few things you
>  > > have to be aware of before you begin drawing the glyphs.
>  > >
>  > What is needed nowadays is an outline font, not arbitrary
>  > postscript description of glyphs. You can create vector fonts with
>  > strokes but they are allowed only in Type3 fonts that have certain
>  > limitation, for instance they cannot be hinted. That's why outline
>  > fonts are required.
>
> But MetaType1 does *not* create arbitrary Type3 fonts.  It creates
> outlines suitable for Type1 fonts.  It actually *creates* high quality
> hinted Type1 fonts.
>
I know. That's why I suggested metatype1 in one of my previous posts.

>  > Metafont takes the vector description but works with bitmaps. If
>  > you want to convert an old font, it is a (not very good) choice. It
>  > is definitely not a good tool for designing outline fonts from
>  > scratch.  The bitmap can be converted to an outline by several
>  > tools, eg by mftrace which is a python script that calls metafont
>  > in order to obtain a bitmap at very high resolution, vectorizes it
>  > by potrace and finally has the font autohinted by fontforge. Since
>  > the outline is obtained by vectorizin a bitmap, the straight lines
>  > are not straight but curved and thence difficult to be properly
>  > autohinted. Experts as Karel Piska can look at all these artifacts
>  > created by vectorizing the bitmap and can tell you what tools were
>  > used in the vectorization process. (Many years ago Velthuis
>  > Devanagari fonts were converted to PFB this way and the result was
>  > really ugly.) The right way is to use a proper tool capable of the
>  > creation of the outlines directly from the mathematical description
>  > without the bitmap step.
>
> Yes, tracing bitmaps is problematic, especially because potrace isn't
> designed for tracing glyphs.  A dedicated program could determine
> extremas first and make sure that these coordinates are always end
> points of bezier curves.  On the other hand, Tigran Aivazian once
> converted a Hebrew font written by Yannis Haralambous in Metafont to
> Type1.  He used Peter Szabo's textrace program and the result was
> incredibly good.  I'm still quite amazed.
>
Strange. I have seen Velthuis Devanagari converted by textrace and it
was unusable. All devanagari characters have horizontal bar in the
same vertical position so that if forms a line when a words is
composed. After conversion by textrace the position was different at
each glyph. I have not done it myself so I cannot say what was the
reason (old version, bad values of some parameters).

> But I'm not talking about deriving outlines from bitmaps.  Here is the
> example I mentioned in my previous mail.  The MataPost code for the
> '+'-sign is:
>
>  encode ("cross") (1); introduce "cross" (store+utilize) (0) ();
>  beginglyph("cross");
>    save pa, pb, r;
>    path pa, pb;
>    pa=unitsquare xscaled band yscaled size shifted -1/2(band,size);;
>    pb=unitsquare yscaled band xscaled size shifted -1/2(size,band);;
>    find_outlines(pa,pb) (r);
>    Fill r1;
>    fix_hstem(band,r1); fix_vstem(band,r1);
>    fix_hsbw(size,0,0);
>    fix_hsbw(0,0,0);
>  endglyph;
>
>
> Please note that pa and pb are two overlapping rectangles, and
> MetaPost usually creates two overlapping rectangles in its PostScript
> output, not suitable for creating Type1 fonts.
>
> MetaType1, however, provides the function find_outlines(), which
> creates exactly what's needed, namely a single path:
>
>  %!PS
>  %%BoundingBox: -500 -500 500 500
>  %%HiResBoundingBox: -500 -500 500 500
>  %%Creator: MetaPost 0.993
>  %%CreationDate: 2007.02.12:2129
>  %%Pages: 1
>  %%BeginProlog
>  %%EndProlog
>  %%Page: 1 1
>  %GLYNFO: NAME cross 1
>  %GLYNFO: HSBW * 0
>  %GLYNFO: HINT-TRIPLE 1 1
>  %GLYNFO: HINT-FLEX 0 0
>  %GLYNFO: VHINT -50 100
>  %GLYNFO: HHINT -50 100
>  %GLYNFO: BEGINCHAR
>   0 0 0 setrgbcolor
>  newpath 500 -50 moveto
>  500 50 lineto
>  50 50 lineto
>  50 500 lineto
>  -50 500 lineto
>  -50 50 lineto
>  -500 50 lineto
>  -500 -50 lineto
>  -50 -50 lineto
>  -50 -500 lineto
>  50 -500 lineto
>  50 -50 lineto
>   closepath fill
>  showpage
>  %%EOF
>
> And finally it creates a valid Type1 font:
>
> /cross {
>        -500 0 hsbw
>        -50 100 hstem
>        450 100 vstem
>        1000 -50 rmoveto
>        100 vlineto
>        -450 hlineto
>        450 vlineto
>        -100 hlineto
>        -450 vlineto
>        -450 hlineto
>        -100 vlineto
>        450 hlineto
>        -450 vlineto
>        100 hlineto
>        450 vlineto
>        closepath
>        endchar
>        } ND
>
>
> As you can see, though MetaType1 is based on MetaPost, it does much
> more than MetaPost itself.  There is only one instance of closepath.
> And please note the hstem and vstem operators.  No need to use
> FontForge in order to add hints.
>
> If MetaType1 can create outlines from more or less arbitrary MetaPost
> code, I'm sure that it understands Metafont code as well.
>
Almost any MF code. It does not (and in principle cannot) understand
cull. There is a big chance that MF code will be usable.

>  > As I wrote in my previous mail, you cannot use the cull operator,
>  > it works with bitmaps and therefore is not available in metapost.
>
> This is why I said that there are probably things you should better be
> aware of in advance.  But I'm convinced that Jacko provided reasonable
> solutions for most problems.
>
> BTW, don't worry about negative coordinates and zero width glyphs in
> the example above.  This was done deliberately and is not a fault of
> MetaType1.  The glyphs were supposed to be used as plot markers.
> Therefore they are centered at the origin and claim that their size is
> zero.  MetaType1 creates fonts with correct metrics by default.
>
> I'm sure that MetaType1 is exactly what Shriramana is looking for.
>
> Regards,
>  Reinhard
>
>
>  > > I only created a very simple symbol font a few years ago.  In order to
>  > > create a '+'-sign, for instance, I had to draw two lines with a
>  > > particular width and MetaType1/MetaPost determined all intersection
>  > > points and finally created a single contour in Postscript.  MetaType1
>  > > also converts the intermediate EPS files to a valid Type1 font.
>  > >
>  > > IMO MetaType1 is the best choice if you don't want to draw the
>  > > outlines directly.  You can download MetaType1 from CTAN.  Though the
>  > > author is using Windows, it works on Linux almost out of the box.
>  > > Only one or two minor adaptions were necessary.  I don't remember the
>  > > details but I vaguely remember it was related to different filename
>  > > conventions on Unix/Windows or something similar.  Just start the
>  > > script and see where it complains.
>  > >
>  > > Shriramana, you first asked on the MetaPost mailing list.  This is the
>  > > most appropriate place and the author of MetaType1, Bogusław Jackowski,
>  > > is also listening there, although he isn't reading mails every day.
>  > > [...]
>
> --
> ----------------------------------------------------------------------------
> 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.
> ----------------------------------------------------------------------------



-- 
Zdeněk Wagner
http://hroch486.icpf.cas.cz/wagner/
http://icebearsoft.euweb.cz



More information about the tex-live mailing list