Webview and CustomFont
Hi am using webview ,i need to use custom font(verdana.ttf) how can i do this.(AM using hone开发者_如何学Cycomb)
Am using following code for setting font
"<html><body><span style=\"font-size : 12pt;color : #333333;font-family: verdana; src: url('fonts/verdana.ttf');\" >"+data+"</span></body></html>"
to get custom font in Webview we need to specify url as follows ,we need to put the fonts in assets folder ,and webview check in files folder of application, ie it's like file:/data/data/packgname/files
"<html><body><span style=\"font-size : 12pt;color : #333333;font-family: verdana; src: url('file://"+ context.getFilesDir().getAbsolutePath()+ "/verdana.ttf');\" >"+data+"</span></body></html>"
you can use @font-face....
@font-face { font-family: verdana; src: url('verdana.ttf'); }
精彩评论