Using a UIWebView, can I use a custom font?

Moshe picture Moshe · Mar 29, 2010 · Viewed 14.4k times · Source

I've seen all the talk on the web about the difficulty of using a custom font in iPhone OS. Is it possible, to load a font from within my bundle into the UIWebView component?

EDIT: I saw it in the app called "Omer" by "Rusty Brick"... It seems to be a web view, because I see a delay and during the loading delay the custom area is white. What other component could this have been?

EDIT2: I contacted Rusty Brick. They told me which font it was. A standard font.

Answer

Willster picture Willster · Feb 9, 2011

It is possible to load custom fonts into your UIWebView in iOS3.2 and above. Add the font to your bundle (see here) then just reference the font in your UIWebView's stylesheet like you would any other font:

<style type='text/css'>font { font-family: DroidSerif; } </style>