I have an application that I want to show Punjabi text. The text is in HTML file. I have custom font "Anmol.ttf" under css/style. The text appears fine in devices that are above 3.0 Android Version. However, in lower versions it has mistakes almost everywhere and plus in some phones it appears as boxes. Other apps with the same language is easily viewable, I am not sure how should I approach on fixing this. I have spent almost over 4 months finding the solution but have no luck. Please see the images below difference between the lower version text and the upper version text.
Below is "0.html" file that I am trying to upload.
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView webview = (WebView)findViewById(R.id.webview);
webview.loadUrl("file:///android_asset/0.html");
}
}
How it should look:
How it looks (needs to be fixed):
You need to add proper or pre formatted punjabi text in your html file. If the punjabi text does not show in your html file then use Punjabi Font Converter
: http://www.sikhmarg.com/converter/
Here you can convert your punjabi font from one to another encoding
eg: if your font is Anmollipi the you can translate it to Unicode Correction (Because Java supports Unicode encoding)
Tip: (first change to your font in which the text is typed then copy the text and again convert to Unicode)
after this paste the punjabi text to your html file and save it with encoding of utf 8
see the image, how to change encoding
Best of luck
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.