Using TTX to rename fonts

Posted by scottstoel on August 27, 2010 at 7:15 am.

One of the most problematic issues associated with font management is how to manage font conflicts. Font conflicts come about when you activate a font with the same name as a font that is currently activated. If you have seen an alert like the one below you know what I am talking about.

picture-167

Your operating system and your applications recognize fonts by name and name alone. So even if you have two very different versions of a font, but they have the same name, the operating system cannot discern between them.

This font name has nothing to so with the font in question’s file name. If the issue were that easy we could rename fonts in the Finder and the problem would be solved. It just isn’t that easy.

There are tools available that allow you to rename a font, such as FontLab Studio or Fontographer, but those tools can be cost prohibitive and oftentimes might not be worth the investment to make changes on just a handful of fonts.

There is an option in the open source world that can help. FontTools/TTX is a tool that converts OpenType and TrueType fonts to XML and back again. You can download FontTools/TTX here.

FontTools/TTX is a command line tool that once set up can be very easy to use. In our example we are going to use an OpenType version of Helvetica Neue Roman.

picture-172

Ordinarily, activating this font in a third-party font manager would result in an alert that the font conflicts with the Helvetica Neue font that resides in the /System/Library/Fonts/ folder. What we are going to do is change the internal name of the font so it will no longer conflict with the system version of the font and can appear in our font menus, along with the system version of Helvetica Neue.

Since TTX is a command line tool, we will need to launch Terminal, which is found in the Utilities folder in your Applications folder.

Once you launch Terminal, type “ttx” (no quotes) and  space, then drag the font from the Finder into the Terminal window. Terminal will automatically add the path to the font file. The results in in the Terminal will look like the screenshot below:

picture-174

Once the path is added, hit return. TTX dumps the font tables into XML and saves the file in the same folder containing the original font.

picture-175

This new .ttx file can be viewed in any text editor. In our example we are going to use TextEdit.

Once the file is open in TextEdit we need to find the name of the font. The quickest way to find this is to search the document for “fullname” (no quotes). If your search is successful you will find a line like the one below:

picture-176

This is the name of the font as it appears in the font menus.

The next step is to carefully select the font name inside the quotes. Then, we want to replace all the instances of where the previous name is referred to with our own. I opted to annotate the name with two letters “FG,” so the new font will be named “HelveticaNeueFG” and appear in our application’s font menus as such.

In order to do this we use TextEdit’s Find and Replace feature to change every instance of the name as shown in the screenshot below:

picture-177

Once you have entered our search and replace criteria, select “Replace All.”

Note: If your font has a name that would commonly be used in a font file such as “Glyph” or “Asterisk” you may get some unwanted text replacement and possibly produce an unusable .ttx file. In these cases you should manually scroll through the font file and replace the instances where the name listed.

Then save the file. Make sure it is saved as plain text with the extension .ttx. I also opted to change the font file name in order to differentiate the font from the original in the Finder.

picture-178

Because TTX is smart enough to know the difference between a font file and an XML file, we can run the same command we used earlier to convert the XML file to a font. To do this, Open Terminal, type in “ttx” (no quotes) at the prompt with a space, then drag the newly created .ttx file into the Terminal window.

picture-179

TTX converts the XML to a new OpenType font file in the same folder as a .ttx file.

picture-184

The newly created font can be added to one of your system font folders or to a third-party font manager and be activated without conflict.

The font will now also appear in your font menus under it’s new name, as it appears in Adobe InDesign in the screenshot below.

picture-185

While this is not an ideal solution, and there are certain problems that will be created  if you rename fonts in this manner (such as possibly violating the terms of your font license agreement), this is one way to address issues such as one reported in an earlier FontGeek post concerning Snow Leopard, InDesign and Helvetica Neue.

Note: I mentioned earlier in this post that TTX is easy to use once it is installed. I did not have any luck using the binary installer available on the download page and only got the app installed after downloading the source files, running the python install script, then running TTX and moving the files to the locations required on the drive as I ran into error messages. While this was somewhat difficult, I did get it to finally run.

Another Note: Since this article was posted, we have added a new post that guides you through the steps of installing TTX that hopefully will take some of the pain away. That post can be found here.