Using a UIWebView, can I use a custom font?

后端 未结 2 1634
说谎
说谎 2020-12-30 07:40

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 componen

相关标签:
2条回答
  • 2020-12-30 07:58

    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>
    
    0 讨论(0)
  • 2020-12-30 08:00

    It is possible, but you need to make certain to add the Fonts provided by application key-value pair to the Info.plist.

    I learned about it in this tutorial: http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/

    I tried it with a LWFM and a FFIL font suitcase, but this didn't work. In the end I needed the TTF file of the font.

    When referencing the font in your code use the PostScript name. To get the correct name for your font, open the Font Book application, select the font and click on the i in the upper left corner to open the information panel.

    Fontbook screenshot

    0 讨论(0)
提交回复
热议问题