Basically, I have a lot of drawings in a lot of files for a typeface revival I'm working on --- it's optically-sized, and I only have a couple of complete sets (from memory, 28 and 72 pt.) and only one pair of letters where I have all the sizes (cap and lowercase N/n) so what I want to do is work up a system which allows me to:

  • design letters as strokes in METAFONT w/ an adjustment for optical size (and maybe some others)
  • proof these letters on-screen easily / automatically / at least somewhat interactively
  • overlay the proof letters w/ the outlines which I do have
  • get a nice outline from the METAFONT design which I can then use to make an Opentype font

I'm stuck at the step of making a proof and overlaying it --- is there some easy / elegant way to do this? I've managed to use METAFONT to make a .2602gf file, and then used gftodvi to make a .dvi which I can view, but that comes out much larger than a page.

Then, once I've got a METAFONT I'll have to work out getting nice outlines from it and making an OpenType font, but first I need to design the design.

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

Ideally I'd like a solution which makes use of lualatex and PDF.

  • 2
    Fascinating what you're doing! Someone turning an existing typeface into Metafont descriptions seems to be rare (I asked a question about it), but everyone who's tried reports it being fun (e.g. this) and I hope it is for you too. Watch out for the last step: getting an outline out of Metafont and making it an OpenType font may be nontrivial though it can be done; see this&this by K Píška – ShreevatsaR Jun 26 '17 at 15:04
  • 2
    Coming to your actual question: can you clarify what you mean by the DVI coming out much larger than a page? Actually a DVI file doesn't contain any information about the page size (that comes from your printer or your DVI→PS or DVI→PDF converter), so the solution here may just be a matter of changing the paper size during the DVI conversion, and/or scaling it after the conversion. If you give an actual example DVI (or gf or mf) file, it will be easier for someone to help you overlay it. – ShreevatsaR Jun 26 '17 at 15:06
  • I don't think forcing LuaTeX to use .mf is the best idea. And many PDF viewers have problems with bitmap fonts. ('Many' being Adobe's, of course.) Not that I know anything about it, but TeX and DVI seems a better bet (even if your viewer then converts the DVI to display it, as it may do). – cfr Jun 28 '17 at 3:59
  • @ShreevatsaR Are you sure about that? TeX must know the page size in order to layout the text, whether it is producing DVI or PDF. It may not know the paper size or, rather, that nominal paper size may not match the paper size used by the backend. – cfr Jun 28 '17 at 4:02
  • @cfr Yes I'm very sure about the DVI format. TeX knows the \hsize and \vsize in which it must lay out its text, also the \hoffset and \voffset by which that text must be placed w.r.t. to the top-left corner of the page, but the paper size itself is not contained in the DVI format. (I am using "page size" and "paper size" interchangeably; perhaps you're making a distinction restricting "page size" to only the \hsize by \vsize area on the page.) – ShreevatsaR Jun 28 '17 at 5:13
up vote 4 down vote accepted

With your eight.mf, we can do the following:

  1. First run mf and then gftodvi, to generate eight.dvi:

    mf-nowin eight.mf && gftodvi eight.2602gf
    
  2. Generate a PDF file out of eight.dvi, with a large enough (which in this case means really large) paper size:

    dvipdfmx -p a0 eight.dvi
    

(Note that A0 is 16 times the area of A4: it's four times larger in each dimension.)

This produces eight.pdf that looks like:

eight.pdf at less than 200 dpi

(Note the size of the text "METAFONT output…" in the top-left corner; click on the image to see it at larger size: but what's uploaded here is a rasterized image not the PDF.)

Instead of specifying the paper size manually, you can also use a DVI driver that can compute the bounding box automatically. I cannot find such an option in dvipdfmx, but dvips has a -E option documented as Try to create EPSF (whatever "try" means), which seems to work:

dvips -E eight.dvi
epstopdf eight.ps

Once you have this PDF file eight.pdf, you can then include it in lualatex with any of the usual ways images or PDF pages are included. For example:

\documentclass{article}
\usepackage{pdfpages}
\begin{document}
\includepdf{eight.pdf}
\end{document}

The included PDF is "transparent", so if you'd like to overlay it over an existing image, I think you can put that image as a background. There are many questions on this site on how to do that (with different and confusing answers); here's one way that worked for me:

\documentclass{article}
\usepackage{pdfpages}
\usepackage{graphicx}

\usepackage{eso-pic}
\newcommand\BackgroundPic{
  \put(0,0){
    \includegraphics[width=\paperwidth]{Jersey.pdf}
  }}

\begin{document}
\AddToShipoutPictureBG{\BackgroundPic}
\includepdf{eight.pdf}
\end{document}

(Here Jersey.pdf is just something random I generated by opening this svg in my browser and using the browser's print functionality to "Save as PDF".) This produces something like:

overlaid 8

  • Yes! That's a huge help! Hopefully I can work out something which will let me make the balance of this work --- possible to make the METAFONT stuff transparent? – WillAdams Jun 28 '17 at 19:32
  • One question --- does anyone have a list of platforms where the -nowin is actually applicable? Conversely --- what platforms still have a graphical METAFONT? – WillAdams Jun 28 '17 at 19:48
  • 1
    @WillAdams The METAFONT output all the way to eight.pdf (or whatever) is still transparent, so getting your other image as the background is a possible trick. I've added an example. (As for mf-nowin I don't know… on my computer (TeX Live 2017 on macOS Sierra), mf without mf-nowin brings up a graphical window which just briefly displays each character and closes itself, which is not very useful.) – ShreevatsaR Jun 28 '17 at 21:38

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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