gaurav’s rants

[Tutorial] Port Fonts to iPhone

by gaurav on Aug.30, 2008, under iPhone

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.”
haha.. :)

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.
  • 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.

  • 2. The font you want to replace on the iPhone.
  • 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/

  • 3. FontLab Studio
  • http://www.fontlab.com/font-editor/fontlab-studio/
    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.]

  • 4. The desire to change things..

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..
Helvetica.ttf

HelveticaBold.ttf

LockClock.ttf

MarkerFeltThin.ttf

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.
  • 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..
    Download: Font Templates for Port (1916)

    Steps:
    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.
    Download: Font Templates for Port (1916)

  • 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.

The port process:

  • 1. Open both the default font and the custom font in FontLab Studio.
  • Arrange font windows by Window > Tile Horizontally.

  • 2. Change the UPM size of custom font to 1000.
  • Glyphs can only be copied between fonts having the same UPM size.
    Open Font Info window File > Font Info.

  • 3. Select all glyphs of custom font.
  • 4. Copy selected glyphs.

  • Notice that i have deselected the .notdef glyph of custom font as it is blank. We will not copy this blank glyph so that we retain the glyph in the default font.

  • 5. Select the default font window and paste glyphs.
  • Click once in the default font window and paste the copied glyphs using Edit > Paste Special.

  • 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
  • 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:

    All other checkboxes must be unchecked.

    Result:

    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.

  • 7. Generate the font.
  • 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

  • 8. Save the ported font.

  • Done. :)

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..

Download: Font Templates for Port (1916)

Share and Enjoy:
  • Twitter
  • Digg
  • StumbleUpon
  • Reddit
  • del.icio.us
  • Technorati
  • NewsVine
  • Facebook
  • MySpace
  • Google Bookmarks
  • Slashdot
  • Mixx
  • LinkedIn
:, , , , , , , ,
35 comments for this entry:
  1. E

    This is an excellent tut, very well put 2gether. Its rather simple but intricate at the same time. I, like you would love to port a font over but this just seems to take a lot of time. At least now I know where to come when Im ready. Then again, if anyone wants to make a quick $ I can be lazy and spend time with the kids and u can do it 4 me ;-)

  2. CompC

    This is a great tutorial, and thank you.

    You might want to mention that FontLab Studio is $640????

  3. gaurav

    @CompC: yes i realize that. i did not want to get into a discussion of the rights and wrongs of using pirated software.. it’s upto the user to decide how to obtain the software.
    i have updated the post with info that the demo version generates only 20 glyphs. thanks for that info.. :)

  4. Khoa

    Hi, very good tutorial.
    But the app is to expensive for me.
    Can you port 1 font for me plz ?
    you can find it here http://www.khoa.fr/Fonts/Bradley_Hand_ITC.ttf

    Thanks you.

  5. gengstapo

    thanks man, u the man!!
    salute! kewL tutorial

  6. Sam

    Can you write up something for firmware 1.1.4? Somehow this doesn’t work on 1.1.4 and a LOT of us are still going with 1.1.4. Thanks.

    Also I tried putting your Calibri font on 1.1.4, doesn’t work. There’s something special about it. But someone already ported the Nokia font for it, it can be done but not sure how.

  7. Sam

    Ok, I finally got the hang of it. THANKS FOR NEOTECH 1.1.4

    The guide doesn’t fully work for 1.1.4. Can you tell us what are the differences if we want to port a font to 1.1.4?

  8. TatesMan

    am trying to make DejaVuSansMono.ttf
    i changed its UPM but still cant paste it to the template file (reason s not same UPM) but both is 1000 and checked the Scale all glyphs……

    any solution ?

  9. TIM

    You rock!! Sniff, sniff i love you man…
    Thanks!!

  10. memphis

    man, u have a tutorial 4 mac os?
    ive tried but cant get it

    pleeeeease port carbon font for the clock font
    http://www.1001freefonts.com/carbonphyber.php
    thats all i need, take ur time dont hurry, pleeeeease u rock

  11. Brinzei

    Since I posted on http://www.modmyi.com/forums/file-mods/265181-2-0-custom-fonts-iphone-2-0-a-3.html about some iPhone font modifications, many people asked me to write a detailed how-to; well, the truth is, I think your tutorial is very detailed and well put, so I took the liberty to redirect them here, I hope you don’t mind.

    Ah, and congratulations, man, your mods are great.

  12. pulp

    i get windows error when it hits 99% at final font generate

  13. gaurav

    @pulp: if you’re getting windows error and FontLab crashes when font generate reaches 99%, you must first save the project, as a .vfb file, then open that file and select generate..

  14. schnedi

    excuse but you know how can i make for port zapfino font cause ive tried it and its impossible for me i think ive to change the metrics and dimensions but…..

  15. gaurav’s rants » FontSwap icon and Package details

    [...] metadata will cause serious problems like app crashes or SWOD. here’s how to port fonts http://blog.gauravgiri.com/2008/08/tutorial-port-fonts-to-iphone/ this issue will be resolved in future versions of FontSwap so that fonts with incorrect metadata [...]

  16. FontSwap change your fonts - Page 8

    [...] can’t just copy & paste any font off your PC: gaurav’s rants

  17. Jack

    Hi,

    This is a great guide but I have problem when I am working on the LockClock.ttf, the time overwrite the date…

    Anyone know what is the problem?

    Thanks.

  18. Dr Lee Freedman

    I do not want to replace any font.
    I want to add a font of just circles.
    So that text converted to Kromofons,
    an alphabet of colors, will appear as a string of colored circles.

    See kfons.com

    Highly experimental. No explainations, but everything, Everything on the site is readable.

    Thanks.
    Our current plugin for Outlook converts email text to kfons, but colored letters defeats the purpose. It’s the colors themselves we are reading. So we need to eliminate the letter shapes. It’s a right-brained activity. Reading is currently left-brained.

  19. Nemesi

    Hi,
    I tried to use FontLab Studio on Linux with Wine and it seemed to work when I replace with the special paste the glyps.
    I don’t know if the number of glyps on edited Helvetica must to be the same of original one, anyway the number of glyps became more than 6000 and I cannot export this font.
    Do you know if I can delete some glyps?

  20. Ruda

    Hi man!

    Thank u a lot for this amazing tutorial.. worked perfect for me!
    I just got 1 question, the position of my font on the iPhone is allover a little bit too high, can I change the font-position on FontLap or would this crash my iPhone?

    Thanx and best whises!
    Ruda

  21. rudeboy

    oi~

    anybody willing to port a font for me ? this one: http://www.dafont.com/berlin-small-caps.font i would be very thankful…

    (webmaster@everythingberry.com)

  22. Will

    Excellent, Thank you so much for this great tutorial. One final thing was left out, how do you create preview.png to package the font?

    I’d really appreciate a reply.

    Kind Regards

    THX

  23. Hailee

    I’m having the same problem as “TatesMan”
    Any solution?

  24. dL

    Hey, thanks for the great tut….I am trying to open the default font in fontlab and I am getting “The parameter is incorrect” error…also I noticed on the side that it says Python is not installed. Could that be the reason?

  25. luke255

    I am trying to port a font called “Sassoon Infant” which has been converted from otf to ttf.

    I have spent several hours pulling my hair out because some numbers are out of alignment.

    I am using 3.1.2 and FontSwap.

    I am using FontLab Studio on Mac OS X.

    I see many people on forums having the same problem as me but they are always ignored or told to JUST MOVE THE GLYPHS UP!?!?! The very idea of that as a solution sickens me.

    The fonts that come with FontSwap (including the “Default” ones) also have this problem and it is well known but there doesn’t seem to be any new tutorials on the new way to port fonts which I find…unusual…frustrating. However, i was able to find a repo that has many 3.0 compatible fonts which are all aligned beautifully.

    I have tried every porting guide that I have found and I have yet to get all the numbers aligned correctly. It is most noticeable in icon badges and the status bar clock.

    I can post screenshots if anyone cares.

    I don’t expect anyone to reply to this as that seems to be the way people with this problem are treated. If you haven’t guessed i’m finding this really rather depressing! Why not cheer me up by pointing out a nice shiny new tutorial that Google has failed to find for me!

  26. Thac0xero

    This is a really nice tutorial on getting fonts ready but it seems a little out dated. There seems to be something that must be done with the CGFontCache.plist in order for iphone 3gs to work with the new font.

    I know this method still works because I can change fonts by renaming them, but I would like to add a new font all together.

    Any ideas on how to properly edit the CGFontCache.plist?

    Thanks.

  27. Ed

    Thanks for this. I was able to port Perpetua thanks to your tutorial, however the process was rather painstaking in FontForge.

  28. Ed

    “Any ideas on how to properly edit the CGFontCache.plist?”

    I was wondering the same.

  29. Free Fonts

    Brilliant absolutely.Great tutorial,I’ll definitely coming back to your blog.

  30. Dr Lee Freedman

    I believe I may have an exptremely interesting project for you – Professor Gaurav.

    I also believe that your skill level would enable this project to get completed in a week,

    whereas in may take me a year,
    and still not get it quite right.

    I am leaving my contact info, because I can find no other way to reach you directly.

    Thanks,

    and the icons are VERY cool !
    Dr Lee Freedman.
    kromofons@gmail.com
    954-560-1779

  31. free download winrar software

    The important vantage of using this site on a strict basis is that it seat provide you with convenient functions; this web site was fashioned to save your money and time and you are not likely to be scammed when trying to download digital data. This online directory john provide you with a genuine collection of PC political platforms; this collection will come along with a wide variety of benefits.

  32. Rushi

    Gaurav, any idea if it is possible to port a language pack ?
    I am thinking Devnagari ofcourse :)

  33. Jan Lanahan

    Looking at the time and effort you put into your site and elaborate info in the post you offer!

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...