Tuesday, November 17, 2009

Changing Internal Font names to match an MS Word Document using FontForge


A customer gave me an Microsoft Word .doc Document and wanted me to use the style as a template for others. He said I'd need to get the "FF Meta" font to render it properly.

Inside the document, the font was called "Metabook-Roman". But when I bought the "FF Meta" font from the "FontFont" online store the font family was "Meta OT" and the style was "Book". I downloaded the OpenType version from FontFont, so my file was named "MetaOT-Book.otf".

After I loaded the font using the Mac OS X FontBook Application, the font was visible as "Meta OT" in MS Word. But (apparently) because of the name mismatch, MS Word didn't recognize that I had the right font installed. It was looking for something called "Metabook-Roman".

I could think of two likely approaches:

A-1. Rename the font I had bought. You can't just change the filename; the font file has internal data that must be modified. And it's tough to find tools that just edit it directly.

A-2. Modify the MS Word document to use the "Meta OT > Book" font. If the document used styles consistently, this might not be too time consuming. But the downside is that I'd lose interoperability with the people who name the font "MetaBook-Roman", i.e., my customer. If I change the internal font to "Meta OT > Book" and send it back to him, MS Word will likely just render it as Arial.


The answer was found in the tool FontForge hosted on SourceForge. It's designed as a font editor. It can open OTF files, and export fonts to OTF files. It also allows you to edit the font metadata.

FontForge took quite a bit of work to make it run. The September 2009 Mac OS X build wouldn't work, because it was statically linked to a pango version I didn't have.

Dyld Error Message:
Symbol not found: _Arabic_Assign_Properties
Referenced from: /usr/local/lib/pango/1.6.0/modules/pango-arabic-fc.so
Expected in: flat namespace

I set about to upgrade pango hoping that'd fix things, but my MacPorts got stuck on a broken ncursesw. At the same time, I was installing Cygwin with X11 in a Windows XP virtual machine. I actually got the WinXP port to run before I got my local Mac OS X system to run. (Dynamic loadable libraries are pretty dumb in this day and age, folks.)

Within FontForge,

S-1. I opened the MetaOT-Book.otf,

S-2. In the "Font Info" dialog, I modified the Font name, family name, and "Name for Humans" to "MetaBook-Roman". In addition, I had to change the TTF Names section to apply the new name.

S-3. Allowed FontForge to regenerate the UUID for the font so nothing would confuse it with the original FontFont file.

S-4. Exported the Font as another OTF file, "MetaBook-Roman.otf".


Finally, I added the font "MetaBook-Roman" into Font Book.

No comments: