How do I display a custom Arabic font in my iPhone app?

南笙酒味 提交于 2019-12-24 11:18:57

问题


How do I display a custom Arabic font (Quran in Uthmani) in my iPhone app?


回答1:


Core Text allows you to embed fonts and render custom glyphs.




回答2:


You just need to drag the font’s ttf file in your resource folder and do this following entry in your info.plist file –

<key>UIAppFonts</key>
<array>
        <string>CloisterBlack.ttf</string>
</array>

UIAppFonts key accept a array so you can pass multiple fonts in it.

Now wherever you want to use the font in your application you can call:

[UIFont fontWithName:@"Cloister Black" size:64.0]

Just make sure you give the real font name in above code. The font file name and its “real font name” can be different, so just open the font in FontBook app and there you can see the real name of the font.

you can read my blog entry on using custom fonts in iphone app here - http://www.makebetterthings.com/blogs/iphone/how-to-use-custom-fonts-in-iphone/




回答3:


This works fine for Roman text but not for Arabic text. If I load English text with two distinct fonts they are different, if I load Arabic text using those same fonts they show the same, except for some spacing.

Smells like a bug.



来源:https://stackoverflow.com/questions/6481599/how-do-i-display-a-custom-arabic-font-in-my-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!