How to use a custom font inside a UIWebView

隐身守侯 提交于 2019-12-24 18:38:37

问题


I'm working on an iPhone application that use UIWebView which load xhtml files the html file could include css file that use custom fonts, but it's look like that the web view doesn't support custom fonts since it doesn't render the custom font in the css file

example: xhtml file:

<head>   
    <link href="../Styles/p1.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <p class="line1">تجريب</p>
</body>
</html>

css file:

@font-face {
font-family: "AHRAM";
font-style: normal;
font-weight: bold;
src:url("../Fonts/andlso.ttf");
} 

p.line1 {
font-family: "AHRAM";
}

any suggestion? thnx in advance :)


回答1:


Are you adding the font to your info.plist (UIAppFonts key) ?

Here's a tutorial for this process, which shows how to use the font in a UIWebView.

http://tetontech.wordpress.com/2010/09/03/using-custom-fonts-in-your-ios-application/



来源:https://stackoverflow.com/questions/11066349/how-to-use-a-custom-font-inside-a-uiwebview

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