[metapost] Anyone have notes / test files for METAFONT?

luigi scarso luigi.scarso at gmail.com
Wed Jun 28 10:13:17 CEST 2017


On Wed, Jun 28, 2017 at 5:56 AM, William Adams <will.adams at frycomm.com> wrote:
> Thanks for the resources!
>
>
> Added the following to my tex.stackexchange query:
>
> Okay, given a `METAFONT` eight.mf:
>     mode_setup;
>     u# := 2mm#;
>     define_pixels(u);
>
>     beginchar("A", 8u#, 9u#, 5u#);
>       z1 = ( 0u,  0u);
>       z2 = ( 8u,  0u);
>       z3 = ( 1u,  8u);
>       z4 = ( 7u,  8u);
>       pickup pencircle scaled 1u#;
>       draw z4 ..  z1 .. z2 ..  z3 .. cycle;
>       pickup pencircle scaled 3u#;
>       drawdot z1;
>       drawdot z2;
>       drawdot z3;
>       drawdot z4;
>     endchar;
>
>     \end
> we process it using
>     mf eight.mf
> and get the file eight.2602gf
> we then run
>     gftodvi eight.2602gf
> which gets us eight.dvi, but when we open that we see:
> [![eight.dvi screengrab][1]][1]
>
>   [1]: https://i.stack.imgur.com/JrRQI.png
> Ideally I'd like a solution which makes use of lualatex and PDF --- I'd like
> to be able to open up a metafont file in a text editor, tweak / edit it,
> then compile the project and instantly see it overlaid on a pixel image (and
> possibly surprinted by a vector PDF.
>
> I think it's something basic and simple which I'm missing or failing to
> communicate.


GF fonts are bitmap fonts, you can inspect them with gftype -images
It's quite easy with lua to translate the output of gftype -images
into a metapost bitmap
graphics, but also it's not hard  to write a gftype program in lua.

In any case, The METAFONTbook ans a recent texlive (ie the latest
2017) are almost a must;
you can find more info on gftype  with texdoc -l gftype

In principle, wiht luatex  it's possible to use gf (or pk)  font files
directly without going to dvi:
it'a a matter of a proper encoding, and right resolution.
There is an example here, subsection 3
http://www.guitex.org/home/images/ArsTeXnica/AT021/latino-article.pdf
Of course, in most cases the same results can be obtained with Metapost,


-- 
luigi


More information about the metapost mailing list