Creating EOT files with TTF2EOT

 Aug, 05 - 2009   13 comments   Uncategorized

Continuing in the vein from yesterday, I wanted to post some findings about a great little utility called TTF2EOT. It's an open-source alternative to Microsoft's WEFT, which I'm not even able to compare it to because it crashes before I can export the first font! That's fine, I didn't want to use it anyway (I want to run on OS X for example).

The first issue is that you might want to convert an OTF (OpenType) font to EOT. TTF2EOT won't give you an error, but I wasn't able to get the outputted file to work. (Comments?) No problem, FontForge handles this nicely. You can even script this process so it's available from the command-line. Awesome.

So TTF2EOT should work now, right? Well, perhaps. It didn't for me with the font I'd chosen. I'm sure it varies greatly. I did some troubleshooting with FontForge and TTX and eventually determined that there was a problem in the resulting TTF's name table. If you don't get this part just right, you can expect problems with all sorts of downstream utilities, including the one we care about: TTF2EOT (which will fail silently. Very helpful.)

Paraphrasing O'Reilly's Fonts and Encodings here's the magic recipe to fix incorrect name tables with TTX.

Here's an example excerpt:
<namerecord nameID="1" platformID="3" platEncID="1" langID="0x409">
MyFont Std
</namerecord>
<namerecord nameID="2" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>
<namerecord nameID="3" platformID="3" platEncID="1" langID="0x409">
UniqueID
</namerecord>
<namerecord nameID="4" platformID="3" platEncID="1" langID="0x409">
MyFont Std-Regular
</namerecord>

The "font family name" in nameID 1 added to the "style" in nameID 2 should match the value in the "complete name" in nameID 4 (separated by a hyphen). NameID 6 is the "postscript name." I use the value from nameID 4.

EOT files run on Windows, where usually the following Windows-specific entries would be required as well. If I'm just interested in generating EOT outlines, I've had luck omitting them.

<namerecord nameID="16" platformID="3" platEncID="1" langID="0x409">
MyFont Std
</namerecord>
<namerecord nameID="17" platformID="3" platEncID="1" langID="0x409">
Regular
</namerecord>

I simply use the values from nameID 1 and nameID 2. You may have noticed a change of platformID, platEncID, and langID. Those refer to Windows, Unicode, and American English respectively.

To repeat, if you just want EOT outlines, I've had success with the minimum block including nameIDs 1, 2, 3, and 4. If you actually care to use the resulting TTF for anything else though, I highly recommend using the "full set", which I'll go out on a limb and specify as nameIDs 1, 2, 3, 4, 6 (PostScript Name), 16, 17, and 18 (Mac Family Name). In addition, you'll want to duplicate all namerecord entries using the following attributes:

Unicode, Version (use 0 or 3), and Language (supposedly unused, but TTX fails without it)
platformID="0" platEncID="0" langID="0x0"

Mac, Roman, and English
platformID="1" platEncID="0" langID="0x0"

Windows, Unicode, and American English
platformID="3" platEncID="1" langID="0x409"

I haven't (and can't) test every combination, so I'm not sure if including a malformed "optional" record would cause the output to fail. It's probably possible.

Again, I don't know whether the problem lies with FontForge (at the OTF to TTF conversion step) or the name table in the initial font. I have a feeling I'll find out.


Related articles

 Comments 13 comments

  • Ethan Dunham says:

    Thanks for posting this info. I have found that some of the fonts in our collection (http://www.fontsquirrel.com) just won’t convert to .eot and I haven’t figured out why. This hopefully will help. Have you developed any scripts to automate the “fixing” of the name table?

    ReplyReply
  • jon jon says:

    I hope to release just such a tool soon-ish as a web-based service ; )

    but no, i haven’t come across anything out there in the wild.

    ReplyReply
  • Kramer auto Pingback[...] finding an article that discussed some additional properties that need to be defined, I realized that FontForge can be used to define those settings. Go to the [...]

  • Kramer auto Pingback[...] essential to get an EOT rendering in Internet Explorer. I had previously installed a tool that converted TTF files into XML so I could pull off the namerecord change in text. No such luck. FontForge’s awful XWindows [...]

  • [...] essential to get an EOT rendering in Internet Explorer. I had previously installed a tool that converted TTF files into XML so I could pull off the namerecord change in text. No such luck. FontForge’s awful XWindows [...]

  • Kramer auto Pingback[...] with any of the fonts I was trying to work with, though. After finding an article that discussed some additional properties that need to be defined, I realized that FontForge can be used to define those settings. Go to the [...]

  • Oncle Tom says:

    Hello,

    thanks a lot for your investigations. I have troubles to convert an OTF to EOT for @font-face usage. I used your trick to fix the TTF file but after converting the TTF to EOT, the font still does not display within IE (it’s OK for FF3.5, with the fixed TTF).

    Any idea what to do ?
    Here are the data from the TTX:

    Seebad LT Std


    Regular


    Seebad LT Std Regular


    SeebadLTStd-Regular


    Version 2.00;2006


    SeebadLTStd-Regular



    Seebad LT Std


    Regular


    Seebad LT Std Regular

    Thanks a lot

    ReplyReply
  • [...] essential to get an EOT rendering in Internet Explorer. I had previously installed a tool that converted TTF files into XML so I could pull off the namerecord change in text. No such luck. FontForge’s awful XWindows [...]

  • Richard Fink says:

    There is a new tool called EOTFAST that creates true, natively compressed EOT files.
    http://eotfast.com

    In the download package, in the documentation, there is an explanation of the rules for naming that you have to take into account to create working EOT files. Plus a test page to verify that the EOT is working.

    ReplyReply
  • PandaWood says:

    Unfortunately, eotfast.com requires flash just to get to the download page.
    Richard, no offence intended, but your page looks like a scam. Can you not contribute to the community without requiring them to go through these hoops? Or have the documentation you refer to more easily available?

    ReplyReply
  • Kramer auto Pingback[...] finding an article that discussed some additional properties that need to be defined, I realized that FontForge can be used to define those settings. Go to the [...]


  • Leave a Reply

    Your email address will not be published. Fields with * are mandatory.

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>