Html with Custom font in android -
i programmatically creating html file , storing same in sdcard custom font.
for on first run of android application storing html file , customfont.otf in same location (i.e inside sd card).
so question when pullout html file sd card , open on desktop not able see html content custom font.its opening default font of browser.
when copy html file desktop want open html file custom font only
how can achieve programmatically,
any appreciated,
thanks
somewhat had similar scenario, need load html content in custom font. stored ttf (or otf) file in asset folder. created string css as
private final string css = "<style type=\"text/css\">@font-face {font-family: mycustomfont;src: url(\"file:///android_asset/fonts/mycustomfont.ttf\");}body {font-family: the-2k12;}}</style>";
then while loading webview, appended string html string
webview.loaddatawithbaseurl(" ", css + my_html_data, mime, encoding, "");
hope helpful...
Comments
Post a Comment