i finally took the time to write the much awaited tutorial describing the process of porting fonts for iPhone.. this is important as iPhone users have many requests for fonts of their choice and as much as i’d like to, i simply don’t have the time to fulfill all these demands..
to cut a long story short..
“Give a man a fish, he’ll eat for a day, teach a man to fish and he’ll eat for a lifetime.”
Terms for this tutorial:
default font is the unmodified font that is present on your iPhone
custom font is the font that you are going to port for your iPhone
ported font is the result of the process that will be placed on your iPhone
Let’s see what all we need to begin with the process.. Check list:
- 1. The font you want to port.
- 2. The font you want to replace on the iPhone.
- 3. FontLab Studio
- 4. The desire to change things..
If you’re porting the Myriad font to the System [Helvetica] font, make sure you have the files [TTF or PFB/PFM or other] for both the Myriad Regular font and the Myriad Bold font.. if you don’t have the bold font file, you can convert the Regular font to the Bold font with FontLab Studio [using the Transformations panel] but the conversion might not be perfect.
You will need the default font for some important information like metadata and some glyphs that the custom font may not have. Make a new folder on your desktop “Custom Fonts” for your custom font work and keep the original default fonts in that folder. Keep the custom fonts in folders with their names under this folder, you can export the ported font to the corresponding folder as well.. [this is the convention i follow, you are free to think of something better]
You can copy the default fonts from this folder on your iPhone /System/Library/Fonts/Cache/
You need the full registered version of FontLab Studio. The demo version will generate only 20 glyphs in a font. FontLab Studio costs $649, although there are a few alternative means of obtaining the software which i will not discuss here [Google is your friend, so are Demonoid and ThePirateBay]..
[you might want to keep FontCreator as a backup software. i tried to open Calibri font with FontLab Studio and it crashed everytime i tried.. FontCreator is not as feature rich but you can export the font and then use it in FontLab Studio.]
First let’s take a look at the metadata of default fonts that may be replaced, these are the ones that are usually replaced, though all of them can be easily replaced..
The screenshots show the metadata that is embedded in the fonts. If you replace a default font with a custom font with incorrect metadata, the iPhone OS will load the font but it will not find the data it is looking for and the application will most likely crash. Incorrect metadata in MarkerFeltThin.ttf will cause MobileNotes to crash, incorrect data in LockClock.ttf will cause SWOD, incorrect metadata in Helvetica.ttf or HelveticaBold.ttf will cause SpringBoard to crash.
So if you make any custom font to replace the default fonts, you must take care to maintain the correct metadata. It is therefore a good idea to start with the default font and to copy glyphs from the custom font over glyphs of the default font, this way you also maintain any extra glyphs the default font has that the custom font doesn’t, so it makes the font more complete.
NOTE: If you’re porting a system font, it is *absolutely essential* that you copy the glyphs from custom font over the default font. Helvetica and HelvetivaBold have around 2135 glyphs, a huge majority of which will not be present in the custom font you’re going to port. Missing glyphs in system font will totally ruin the purpose of porting it.
Important things to do before the actual port:
- 1. Change Metrics and Dimensions of the default fonts.
- 2. Make sure you have a proper folder structure to handle the default fonts and custom fonts. This is important because very soon you’ll have dozens of fonts with the same name.
iPhone default fonts have a UPM size of 2048, which makes working with Metrics & Dimensions a bit of a hassle, setting this value to 1000 makes life simpler. We will also edit some other Metrics & Dimensions here. Set values as shown in the screenshots.
alternatively you can download the default fonts i’ve attached here and use them as templates. they have all the required settings and glyphs. setting vary for the system fonts, notes font and lock clock font. so it’s better to use the templates..
a. Open the default font with FontLab Studio.
b. File > Font Info
c. Metrics & Dimensions
Make sure the checkbox for “Scale all glyphs according to UPM size change” is checked.
d. Metrics & Dimensions > Key Dimensions
e. Metrics & Dimensions > TrueType-specific metrics
f. Metrics & Dimensions > Subscript and Superscript
g. For Helvetica.ttf and HelveticaBold.ttf make sure the glyph uni25CF [black circle] is present in the font. otherwise the password field will show up empty on the iPhone. you can get this glyph from fonts on your system. see here: http://www.fileformat.info/info/unicode/char/25cf/fontsupport.htm
h. File > Generate Font
i. Overwrite the default font that you opened for editing. Otherwise use a label in your filenames for default fonts that you’ve modified, so that they’re easy to recognize. We will work only with these modified fonts.
The port process:
- 1. Open both the default font and the custom font in FontLab Studio.
- 2. Change the UPM size of custom font to 1000.
- 3. Select all glyphs of custom font.
- 4. Copy selected glyphs.
- 5. Select the default font window and paste glyphs.
- 6. Select layers for Paste Special.
- a. Outline
- b. Left sidebearing
- c. Right sidebearing
- d. Adv. width
- e. Left Kerning
- f. Right Kerning
- g. Ignore destination selection, map glyphs by name
- 7. Generate the font.
- 8. Save the ported font.
- Done. 🙂
This is the main step that you need to take care of, these setting have to exactly as shown in the screenshot or you’ll mess up the default font and have to start over again.
These checkboxes must be checked:
if it’s the system font you’re porting and you’re not using the template i’ve attached here, make sure you copy the glyph uni25CF to the font [using the same paste special settings as above] before going any further.
We’ve finished copying the glyphs. Check once for any errors or glitches in the font that you may easily notice by just scanning the glyphs once..
Once certain that the glyphs are okay we can generate the font by File > Generate Font
Simply copy the ported font to the fonts folder [/System/Library/Fonts/Cache/] on your iPhone and reboot once for it to take effect.. make sure you keep backup of original fonts in case something goes wrong..