UIWebView内にカスタムフォントを表示したいのですが。私はすでに「アプリケーションによって提供されるフォント」の下のplistにフォントを入れました。使用中のコード:
UIWebView *webView = [[UIWebView alloc] initWithFrame:myRect];
NSURL *baseURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
[webView loadHTMLString:html baseURL:baseURL];
[self addSubview:webView];
ここで、htmlは次の内容のNSStringです。
<html><head>
<style type="text/css">
@font-face {
font-family: gotham_symbol;
src: local('GOTHAMboldSymbol_0.tff'), format('truetype')
}
body {
font-family: gotham_symbol;
font-size: 50pt;
}
</style>
</head><body leftmargin="0" topmargin="0">
This is <i>italic</i> and this is <b>bold</b> and this is some unicode: э
</body></html>
iOS 4.2を使用しているので、TTFをサポートする必要があります。実際に機能するhtml/codeを少しいただければ幸いです。