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.



