By John Gruber
Building or remodeling a home? Use BuildZoom to get a free quote.
Lots of good reader feedback regarding last weeks’s “An Important Public Service Announcement Regarding Marker Felt on the iPhone”, the gist of which piece was that if you poked around your iPhone’s file system (after installing, say, an SSH server on the iPhone) and deleted the Marker Felt font files from /System/Library/Fonts/, the Notes app would use Arial instead.
That’s good. But, far from ideal, because everyone knows Arial is an inferior knock-off of Helvetica. One suggestion offered by many readers was to simply make copies of the Helvetica font files, rename them to match the Marker Felt font files, and replace Marker Felt with the Helvetica-with-a-different-file-name files. That doesn’t work, because font names are metadata contained within the files themselves; they don’t come from the file names. (Sort of like with music files in iTunes — the name of the MP3 or AAC file itself doesn’t matter, what matters for determining song, album, and artist names is the metadata.)
But so while simply renaming the font files won’t work, you could use font editing software to manipulate the font metadata itself, either by taking a copy of Helvetica and replacing the internal metadata to match Marker Felt’s, or, by taking a copy of Marker Felt and replacing all the glyphs with copies of the glyphs from Helvetica. A few readers even said this worked. The two font editing tools most-frequently recommended by readers: FontForge, an open source X11 application that, while ugly and ungraceful in the way that all X11 apps are, is useful and free; and TypeTool, a cross-platform $99 font editor from FontLab.
That seemed like overkill to me, though. I just wanted Notes to use Helvetica. So, rather than hacking the fonts, why not hack the Notes app? This turned out to be rather easy. It ends up the CSS rules specifying the styles used for the Notes editing view are hard-coded in the application binary. The Notes application bundle is at /Applications/MobileNotes.app/; inside the bundle, among other files, is a file named MobileNotes. That’s the application binary itself — the program file generated by the compiler from Apple’s Objective-C source code for the app.
I can’t recommend doing this. Binary files are fragile; make a mistake while editing and it’s likely, very likely, the application will no longer work properly. Plus, any changes you make to MobileNotes today are going to be overwritten before the end of the week, as Apple has already indicated that the next iPhone software update is imminent.
On the other hand, if you have the urge to hack around on your iPhone, you might as well do so now, as I strongly suspect that this week’s imminent iPhone software update is going to render inoperable the existing ways of hacking/jailbreaking the iPhone. Notice how no one’s yet figured out how to install or modify the software on the iPod Touch? Whatever Apple’s doing on the Touch in this regard, I expect them to begin doing on the iPhone this week. (I’d love to be proven wrong.)
So, anyway, how to hack your MobileNotes binary to use Helvetica:
Transfer a copy of the MobileNotes app binary from your iPhone to your Mac and open it with Hex Fiend, or whatever your favorite hex editor is. (But if your favorite hex editor isn’t Hex Fiend, there might be something wrong with you. And if you don’t know how to transfer a copy of the binary to your Mac, you shouldn’t be attempting this hack in the first place.) Search for “Marker Felt”. You should find a sequence of bytes that look like this:
font-family: Marker Felt;
Change that to:
font-family: Helvetica ;
Essential: You must type two spaces after “Helvetica”, so that the font name occupies the exact same number of bytes as “Marker Felt” (where each character, including spaces, is one byte). It’s regular CSS, so it’s perfectly valid to have spaces between the font name and the rule-ending semicolon. This hack wouldn’t work if Helvetica’s name were longer than Marker Felt’s.
Save the file, then copy it back to your iPhone, overwriting the original MobileNotes binary. Restart your iPhone, and there you go, Helvetica in Notes: