Funny fonts in Leopard/Safari

After upgrading my iBook to Leopard, I noticed that the default font in Safari looked funny—smaller than before and with weird spacing. As a temporary improvement, I bumped up the font size by one point, from Times 18 to Times 19. This seemed to increase the displayed size of the font by a heck of a lot more than just one point, but I put the matter aside to get on with other things.

When I saw this hint about fixing corrupt font caches, I figured I’d give it a try, even though I didn’t know what a corrupt font cache was. It worked! Now I’m back using Times 18 with the proper size and spacing.

Here’s a warning, though. The command in the hint for deleting the user font cache

sudo rm -rf `lsof | grep com.apple.ATS/annex.aux | grep Finder | cut -c 66-139`

was wrong for my system and may be wrong for yours. In particular, the 66-139 argument to the cut command at the end of the backticked pipeline didn’t pluck out the name of the directory that needed to be deleted. Here’s what I did and the background info you should have before running this destructive command.

There are basically three parts to the command: the sudo, the rm -rf, and all the stuff between the backticks. The sudo means that the command will be run with superuser privileges. It turns out (as the first comment on the hint pointed out) that this is not necessary, because it’s a user directory that will be deleted, not a system directory. The rm -rf is a command to delete the directory and all the files and directories inside it, and to do this without any warnings. It can be a very dangerous command, which is why I didn’t just copy it from the hint and paste it into Terminal.

The stuff in the backticks is supposed to provide the name of the cache directory to be deleted. The lsof command lists all the open files on the system, one per line. This is piped to the first grep command, which collects only those lines that include the text com.apple.ATS/annex.aux. These lines are then piped to another grep command that collects only the line that also contain the text Finder. Running

lsof | grep com.apple.ATS/annex.aux | grep Finder

on my system gives this long line

Finder    120 drang txt      REG      14,2  16194932  6875373 /private/var/folders/wr/wrtD4aw62RaFKE+F74sG9U+++TI/-Caches-/com.apple.ATS/annex_aux

The full path to the cache directory is the part that starts at /private and ends at com.apple.ATS. The cut command is supposed to pluck just that part out of the line, but on my system that part doesn’t run from characters 66 to 139. So I just swiped the mouse through the correct part and pasted it into a new command:

rm -rf /private/var/folders/wr/wrtD4aw62RaFKE+F74sG9U+++TI/-Caches-/com.apple.ATS

This worked perfectly. But don’t just copy and paste this line and run it in the Terminal! Your cache folder probably has a different name! Run the lsof command with the two greps (that line you can copy and paste), select and copy the part from /private through com.apple.ATS, then paste it after rm -rf and run the command.

The second command given in the hint

sudo rm -rf /private/var/folders/*/*/-Caches-/com.apple.ATS

is correct and is what you should use if you have a multi-user computer and you want to delete the font caches for everyone. In this case, the sudo is needed because you’ll be deleting files and directories you don’t own, and only the superuser can do that.

Tags: