Archive

Monthly Archives: May 2012

As the title of this post says, in other words xCode freaking out because you deleted/renamed/moved a file in Finder and not in xCode it self. And svn freaking out because the files have @’s in there names. Googling around and stackoverflowing I read out that xCode adds the files to svn automatically once the file is added to the project. And svn uses the @ internally for revision names.

In terminal it is quite easy to resolve, first if you want to see the status of each of the files you can type the command: svn status. All of the files that have an exclamation point at the beginning of the path were added to svn but removed/renamed/etc before committing to svn.

This post explains it quick and simple. You can revert each one of those by typing

svn revert [path_to_the_file]

And this stackoverflow answer explains very well how to deal with filenames containing @’s. Quick answer here: svn only takes care about the last @ so if you have for example icon@2x.png you just need to type in terminal following the previous example:

svn revert icon@2x.png@

 

 

Hi,

My previous post was a quick one to rescue a great post for editing font info with TTX FontTools.

I had the need of this tool because I was having troubles to make a UILabel getting the fontweight bold of a custom font of my current project. My project has a specific font with different weights, so different files and there was no way to make my UILabel getting a bold weight.

I tried to add a “-Bold” to the fontName, like this:

[UIFont fontWithName:@”Name of the font-Bold” size:15];

But this didn’t really work. With TTX I wanted to change the font name of family name so that I could just use a completely new one. What I realized with the xml generate from TTX is that the fontName wasn’t really the one displayed in FontBook window (on MAC).

In the xml try to use the font name under the item:

<CFFFont name=”MyFontName-Bold”>

This one is the that works with iOS labels!

This is a quick post mainly for me but may be useful for any other person. There was a great post in blog fontgeek.net which illustrated how to use TTX FontTools to edit any data of a given font. Fontgeek.net doesn’t seem to be operative anymore so I wanted to rescue this post for me and for anyone else who needed to know how to use this great tool. I am directly copying this post from the google cache so I hope the original author is ok with it, in case not please let me know and I can remove or unpublish this post, or add any reference to the author.

Installing TTX for the command-line challenged

In an earlier post, we showed you how to use TTX, an open source font editor, to rename a font in order to avoid font conflicts. This can be helpful because your operating system and your applications recognize fonts by name and name alone, and on occasion you may need to activate a font which conflicts with an installed system font. 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.

The biggest hurdle for most people, is that TTX is a command line tool, which adds one layer of difficulty, but the method of installation, which is very obvious to those acquainted with Python, is not readily apparent to the technologically challenged. But once the steps are explained, and carefully followed, you will get access to a powerful tool for editing fonts.

Why TTX?

First, TTX is free.

Secondly, when you process your fonts using TTX, there is no behind the scenes mystery to what is happening with the fonts. TTX is a tool to convert OpenType and TrueType fonts to and from XML. You could use tools like FontLab Studio or Fontographer to make changes to your fonts, but it is not always transparent what is happening to your fonts during this process. In short, changes made in those applications may include something you not readily apparent in the processed font. TTX is the least invasive option for those seeking to make simple (and sometimes very complex) changes in your font files.

Getting started

First you will need to have Xcode installed, and a download link to the version you require can be found here. Make sure you download the correct version for your OS, as the development tools for Snow Leopard cannot be installed on Leopard.

Then download TTX. A link to the files needed can be found here. Once downloaded, decompress the file and move the folder to the root level of your hard drive.

Next, launch Terminal, which can be found in the Utilities folder in your Applications folder.

Then at the prompt type “cd” (no quotes) and a space, then drag the fonttools folder onto the Terminal window. Terminal will automatically add the path to the folder, which saves us from possible typing errors. What you entered should look something like the line below:

cd /fonttools-2.3\ 3

If you would like to see a list of the contents of the folder in Terminal, just type “ls” (once again, no quotes) at the prompt, or just open the folder in Finder.

Now in Terminal, type the line below (or copy and paste)

sudo python setup.py install

What this command does is run the installer in the fonttools folder (setup.py). The command “sudo” (pronounced soo-doo) means you are running the command as the superuser, which is a special user account used to administer your Mac (or any Unix/Linux system). Because you are running the command as the superuser, you will be required to enter an administrator password. The item “install” is an option telling the setup script what to do.

After you have the command inserted at the prompt, hit return, then enter your password and hit return again.

If all is well, the Terminal will spit back a bunch of information describing what the script is doing, mainly that it is moving files to the locations needed to run TTX.

You are ready to roll

Once installed, your are ready to run TTX. To find out the options you can use with TTX, just type in “ttx” (still no quotes) in Terminal and it will list them all.

There are a lot of things you can do with TTX, including the post mentioned earlier on how to rename fonts with TTX here.

Hopefully, this article lowered a barrier of entry for those looking to work with TTX. It is a powerful tool, and like all powerful tools, it gives you the capability of really messing things up, so always back up your font files before getting too deep in editing them.

Aug 27 NO comments

Using TTX to rename fonts

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.