how to show foreign font in web view
Asked Answered
S

1

3

MY app has to show hindi text from the HtmlString in a web view

HtmlString ="<html><body style='background-color:#000000; color:ffffff; font-family:georgia,times new roman,times,seri,krutidev010; margin-top:0px; margin-bottom:0px; margin-right:0px; margin-left:0px; padding:0px;'><div style='padding:0px;'></div><div style='padding:5px;'><b>"+SharedVariables.ArrayOfNewsItems.get(SelectedRow).getTitle()+"</b><p align='justify'>"+SharedVariables.ArrayOfNewsItems.get(SelectedRow).getContent()+"</p></div><p></p></body></html>";
MyWebView.loadData(HtmlString, "contentType=text/html", "charset=UTF-8");

How can I do that.

Submediant answered 3/5, 2011 at 10:35 Comment(0)
S
6
 head="<head><style>@font-face {font-family: 'APARAJ';src: url('file:///android_asset/fonts/APARAJ.TTF');}body {font-family: 'APARAJ';}</style></head>";
                HtmlString = "<html>"+head+"<body>"+content+"</body></html>";  
MyWebView.loadData(HtmlString, "contentType=text/html", "charset=UTF-8");
Submediant answered 19/12, 2011 at 9:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.