5

On CTAN, AFM files are often provided along with type1 (PFB) and TFM files. I wonder if I should include AFM files in a font package for CTAN at all. I assume that the AFM files are included just in case you use the font with some other programs outside the TeX-world. Is this assumption correct or are there cases where AFM are needed in programs that are provided with a common TeX distribution (e.g. dvips)?

5
  • 3
    there are so many programs in the tex eco system that I wouldn't dare to claim than none uses afm files. Imho at some time of history context did read them, and luaotfload contains some references, but I don't know if that is still the case. If you have them it can't harm to provide them (and they can help to check details of the font). Aug 16, 2023 at 10:29
  • @UlrikeFischer The problem is that I have 260*3 MB AFM files since FontForge cannot truncate AFM to the first 256 glyphs. The TFM files are 10 times smaller. I would have to write a special script to optimize the AFM files. But if I won't hear from anybody that the AFM files are necessary I will tend to not include them. I have seen that the stix2-type1 package does not include AFM files neither. Aug 17, 2023 at 8:48
  • 1
    I wonder why you would use Type1 fonts. Why not OpenType? FontForge can create them well. The internal glyph outlines would use the same drawing technology as Type1 (if creating *otf) so there is no need to re-draw.
    – user287367
    Aug 25, 2023 at 0:15
  • 1
    @rallg it is impossible to use OpenType with dvips driver, and pdfTeX cannot read font metrics from OTF or TTF. It could be that OP converted the design to type1 so older TeX drivers can also use it.
    – LdBeth
    Aug 25, 2023 at 21:19
  • Thank you @LdBeth for pointing that out. I use only LuaLaTeX, no math, so I forget about what may well be the majority of TeX users.
    – user287367
    Aug 25, 2023 at 22:58

2 Answers 2

3

TFM files are able to encode only 256 characters per font. Type1 fonts and their AFM format can include unlimited number of characters, the standardized character-names are used in the format.

LuaTeX with luaotfload is able to load Type1 fonts directly without TFM, it reads AFM+PFB files. The standardized names of characters are mapped to Unicode in such case, so user can access all characters of the font, no limited to 256 characters like TFM.

If you are able to generate OTF format then it is much better choice. LuaTeX with luaotfload is able to load these fonts and all characters are accessible too. And all things are more simple and there can be more features ready to use in the font..

When OTF format is present in a font package then Type1 format (AFM+PFB) seems to be obsolete and there is no reason to use such format. Maybe, you want to provide it for users of obsolete TeX engines (like pdftex) where only TFM files are possible when loading the font. And users of such obsolete engines don't need the AFM format.

Note that AFM format includes data of kerning pairs. If it is generated automatically, then almost each character to each character has its kerning pair, much of them unnecessary. If you remove such unnecessary kerning pairs from AFM then you get "normal size" of these files.

1
  • Indeed, I will also provide OTF's, so luatex would not need the AFM's. Aug 26, 2023 at 7:18
3

For the orthodox TeX production chain, Neither DVIPS nor DVIPDF(M)(X) nor pdfTeX need AFM to work, and pdfTeX compatible processor would also work without AFM.

If you are distributing Type1 fonts and the user want to edit the font in a font editor that doesn’t know TeX’s TFM format, they can import the AFM into the editor when editing so the various font metric information can also be updated and after that TFM can be generated from the AFM.

luaotfload can load PFB with AFM in case there is no TFM provided.

If you can provide AFM from a separated download place, or the AFM is actually straight up generated from TFM, AFM might not needed be distributed with font uploaded to CTAN.

Another popular typesetting tool, UNIX troff, needs the AFM to generate font information to use type 1 font.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .