iOS 4.2.1 font porting tutorial
hello font enthusiasts! i've decided to write an in-depth tutorial on how to port custom fonts to iOS 4.2.1, as it is quite a complex process. failure to properly port your fonts can seriously mess up your device, i've had to restore twice in failed ports :P
try at your own risk!
tools you need:
(tool which allows you to use ttsdk on 64-bit windows)
(utility for packing/unpacking the .ttc)
(program for modifying the .ttf's)
-any sort of tool which allows you to SSH into your device (to access/replace the fonts)
font files: explained
the fonts files and their functions vary depending on what firmware you are running and what device you are using. this tutorial covers 4.2.1 on an iphone 4, but i am sure you can successfully port fonts to any existing iOS 4 firmware if you make slight modifications for your particular set-up. unfortunately, the fonts on iOS 4 are a little more complex than they were on 3.X.X. apple has decided to package most of the system fonts in a .ttc, which requires utilities to modify. the other files, which are .ttf's, simply need to be edited with fontlab. i have an iphone 4 running 4.2.1 and i had to do a lot of trial and error to discern which files to customize. some of these steps may be unnecessary, but this is the process that worked for me (i had to figure this out for 4.2.1). for my device, these are the font files i modified/how they function:
_H_Helvetica.ttc (_UH_ on 3GS)
- suprisingly, the only change i found after modifying this .ttc was the font in SBSettings. i'm sure it controls other aspects of the iOS, but this is the only one i've noticed. i suspect this .ttc themes minor system elements.
when this .ttc is unpacked, it creates:
the files i modified are FONT00.TTF and FONT01.TTF!
_H_HelveticaNeue.ttc (_UH_ on 3GS)
- this is the file which functions as your system font. (most significant port)
when this .ttc is unpacked, it creates:
the files i modifed are FONT04.TTF and FONT05.TTF!
- themes your device's keyboard. note: i had to navigate to /var/mobile/Library/Caches and delete com.apple.keyboards (a cache file, i suspect) then respring to get my port to function.
- pretty easy port, it replaces your lockclock font.
note: for the .ttc's, you are free to modify as many .ttf's as you wish. i modifed the most critical font files. you can see how my iphone turned out below!
performing the port
here, i will be explaining how to port the _H_HelveticaNeue.ttc! the naming of the files/directories are up to you, but you are free to use mine!
1. navigate to /System/Library/Fonts/Caches and acquire the font files which you wish to modify. for the port, rename your file to something easy to type (i named _H_HelveticaNeue.ttc to hneue.ttc).
2. install dosbox, and extract ttsdk to a directory which you can locate with ease. i used the directory c:\tools\ttsdk
(use mine if you want to use the commands below)
3. place your .ttc font file into the directory "TTC" (mine was: c:\tools\ttsdk\ttc
4. open up dosbox and enter the following commands:
a) mount c c:\tools\ttsdk
c) cd TTC
5. now we are ready to unpack our .ttc! to unpack, enter the command BREAKTTC hneue.ttc
dosbox should look like this:
you should now have 8 .ttf's in your TTC folder (FONT00.TTF-FONT07.TTF). now, for _H_HelveticaNeue.ttc, the files which you want to edit are FONT04.TTF and FONT05.TTF!
6. open up FONT04.TTF and FONT05.TTF in fontlab. also, open the font which you wish to port.
7. in fontlab, go to your custom font. press ctrl+alt+f and go to Metrics and Dimensions. change the UPM to 1000 and check the box which says "Scale all glyphs according to UPM size change". hit ok, then select all your glyphs will ctrl+a. the glyphs should now be highlighted turquoise. then copy the glyphs with ctrl+c.
note: regarding UPM size changing, MAKE SURE the box is checked on both fonts, AND that they have the same UPM. NEVER CHANGE THE DEFAULT FONT'S UPM. CHANGE YOUR CUSTOM FONTS UPM TO MATCH THE DEFAULT!
8. in fontlab, go to your FONT04/FONT05 and set the UPM to 1000 and check the box. select all the glyphs with ctrl+a
9. paste the custom glyphs with ctrl+alt+v. a window should pop up. check these boxes:
10. now, your custom glyphs should be appearing on FONT04/FONT05! generate your new fonts with ctrl+alt+g. make sure they are named FONT04.TTF/FONT05.TTF
11. paste FONT04.TTF/FONT05.TTF into c:\tools\ttsdk\ttc
. it should overwrite the old .ttf's
12. now we are going to repack our .ttc! use the following command to create your .ttc:
MAKETTC hneue.ttc FONT00.TTF FONT01.TTF FONT02.TTF FONT03.TTF FONT04.TTF FONT05.TTF FONT06.TTF FONT07.TTF
you should get a lot of output on dosbox. retrieve your custom .ttc from c:\tools\ttsdk\ttc
13. rename your .ttc to _H_HelveticaNeue.ttc
and replace the original file with your custom .ttc -- MAKE SURE TO BACKUP YOUR ORIGINAL FONT FILES!
14. respring your device. your font should now be successly ported.
much easier! for .ttf's, follow steps 6-10 and simply replace the corresponding .ttf located in /System/Library/Fonts
that's it! i based my tutorial off padhg's post here
(#112). i felt i could make it more detailed. i spent a lot of time writing this tutorial, please hit the thanks button!
i'll port your fonts if i'm not feeling lazy -- don't abuse this privelege. also, i will only port your font if you post all the files needed for the port (default and custom files)