Creating TeX Fonts and Symbols

Glen's picture

I am a math student with a type obsession. I've searched just about every place I could think of for information on how to create fonts that can be used in TeX and have not had any luck. I run Linux and have played around with FontForge, but do not see a clear way of getting everything to work with TeX. I must admit, it is really difficult to make a decent glyph and I really appreciate your craft! Even though I have had no success making anything appealing in FontForge, I still am interested in how everything works. What are some good references for this?

Thanks!!!

JBlock's picture

What specifically are you trying to do? Use existing fonts in TeX, or create your own? And text mode or math mode?

If all you're looking to do is use an existing font in text mode, I can highly recommend fontools' autoinst script (http://www.ctan.org/tex-archive/fonts/utilities/fontools/); installing OpenType fonts with this script actually just works (believe it or not), and you get access to all of the OpenType goodness present in these fonts--text figures, small capitals, weight and width changes; the works. autoinst doesn't do anything about math mode fonts; they're a black art that I haven't had sufficient need to figure out yet. autoinst also only works for OpenType font, which has never been a problem for me; I vastly prefer OpenType format for all my fonts anyway.

If you want to make your own fonts and use them in TeX, I would recommend just crafting an OpenType font in FontForge (or FontLab, or whatever you can get your hands on), and using autoinst above to import it as a text font. But, again, this won't work for math fonts. I suspect just adding a math symbol or two would be fairly easy, but every symbol I've ever needed has already been created by someone else (just look at them all!).

Whatever you do, you'll probably need a copy of The LaTeX Companion, second edition (if you don't already have it). My poor copy isn't that old and it's already starting to grow dog ears....

philippe_g's picture

A good reference on how fonts work with TeX is the book Fonts and Encoding by Haralambous. It explains in detail all the steps to make a postscript font work with LaTeX. If you want to do everything by hand, these steps are:

  • Step 1: make a .pfb file out of your font.
  • Step 2: make a corresponding .tfm file; this can be done with fontforge, but you might fint it easier to do it by hand.
  • Step 3: choose an encoding or make a new .enc file for your font; this depends whether the glyphs you are making are standard or not.
  • Step 4: make a .map file to tell dvips or pdftex that they must use your .pfb file with the corresponding .tfm file and the encoding you chose.
  • Step 5: make a .fd file (font definition file) for latex to be aware of the font.
  • Step 6: make a .sty file (a LaTeX package) which will give the user shortcuts for the symbols in your font (or which will swich the text font to your new font if you made a text font).

You must then install the font on your system in order to test it. The procedure depends on your TeX distribution, but typically, you must put all the preceding files into a local texmf tree following the TDS specification, then tell LaTeX that it must must use the .map file you made and finally update the file name database with a texhash and a updmap.

It might seem a bit complicated, but once you've done it a couple of time, you'll get used to it.

charles ellertson's picture

Plain TeX or LaTeX? Are you familiar with the TeX User's Group? If not, you should join.

Scott Thatcher's picture

I spent the summer before my son was born obsessing about creating a companion math font to go with Aldus. After my son was born, well it didn't seem quite so important. :)

In addition to the resources mentioned above, you can look up the fontinst script, which has been the standard method to install Type 1 fonts for use with LaTeX. Philipp Lehmann's tutorial (found at the link above) has been especially helpful. The otftotfm software is another way to install OpenType fonts for TeX (perhaps not as automatic as the tool mentioned above).

When I tried creating a Math Font, I remember that I started by finding the pfb files for 10-point Computer Modern and altering the glyph shapes without altering the spacing of the characters (I wanted to start on the glyphs before worrying about how to correctly space the math fonts--I knew I could use the font metric files for Computer Modern while I was working on the glyphs). That method also helped me really learn what was in each file. Check out cmex10.pfb, cmsy10.pfb and cmmi10 (I think). I also found the source for the psnfss package (psnfss-source is what is looks like in my files right now) and looked at the code that generates the mathppl or mathpazo fonts. I think the file pazofnst.tex was the one I looked at because I wanted to basically recreate the mathpazo package using math fonts other than the computer modern ones. I did a lot of looking and a lot of pondering, but I eventually was able to understand most of what was going on (unfortunately, now I've lost many of the details).

One resource I found really helpful was the book TEX Unbound: Latex and TEX Strategies for Fonts, Graphics, and More by Alan Hoenig. Math fonts in TeX really do seem to be something of a mysterious thing (especially at first), and this was the first book I found that gave information about them in a more digestible form.

I'd be happy to send you the files I created in trying to make my math font--not because they're at all perfect, but they might show the things you have to look at to get started.

I second the idea of getting involved in TUG, and I assume that you are aware of usenet groups like comp.text.tex (I think) and other mailing lists that can be found through TUG or CTAN. I'm subscribed to the tex-fonts mailing list through math.utah.edu, and TUG seems to have a math-font-discuss list (which might really be the same list?). The tex-fonts list doesn't get a lot of traffic, but questions are usually quickly addressed.

As an aside, I've always thought it would be great for someone to make a multiple-master font just for mathematical symbols--nothing that requires too much design skill, just so that it would be possible to quickly generate a math font that matches the weight of any particular text font. I think someone did this with metafont, but the result at the time was the generation of bitmapped fonts, not scalable fonts.

Finally, I've also noted that the beamer package has code that automatically substitutes your chosen text font for the letters (not symbols) when you use math mode. This isn't standard behavior in LaTeX, and I've always meant to check out how it's done automatically (whether it's easy or hard). It _is_ fairly easy (after you start to understand what's going on) to copy a file like mathpazo.sty and by hand replace the references so that the letters in math mode will match another typeface, even if you don't create a new symbol font to go along with it.

This may be more than you want, but do feel free to contact me if you have specific questions that I might be able to answer.

st

Glen's picture

Thank you very much for all the help! I am looking forward to going over all the resources more in depth this weekend.

@Charles: I use LaTeX. Are the differences between TeX / LaTeX / LaTeX2e / ... spelled out in one of the resources?

@Scott: Thank you for the great suggestions! Would you be able to send me the files you worked on? That would be really helpful as I try to sort through everything. My email is wilson47@tcnj.edu .

Thanks again!

charles ellertson's picture

@Charles: I use LaTeX. Are the differences between TeX / LaTeX / LaTeX2e / ... spelled out in one of the resources?

I flat don't know. We started with plain TeX -- could never abide LaTeX -- and wrote our own macros, including pagination. That took Larry Tseng several years all told, but did give us control.

Scott Thatcher's picture

Glen,

I'll send something in the next couple days--after I look through what I have and see what I remember about it.

st

Syndicate content Syndicate content