Problem with Arabic text appearing on WebView
I use WebView
When using it on Android the font appears beautiful
But when applying the same code on b4j the font overlaps, especially the vowels
I also saved the page as an HTML file and it works fine I think. The problem is in WebView b4j.
b4a
b4j
I use WebView
When using it on Android the font appears beautiful
But when applying the same code on b4j the font overlaps, especially the vowels
I also saved the page as an HTML file and it works fine I think. The problem is in WebView b4j.
b4a
b4j
B4X:
Dim Font_Naskh As String="naskh.ttf"
Dim Text As String=$"<p class=MsoNormal dir=RTL style='margin-top:6.0pt;margin-right:14.2pt;
margin-bottom:3.0pt;margin-left:0cm;line-height:normal;
page-break-after:avoid'><a name="_Toc97034699"><span lang=AR-SA style='font-family:Font_Naskh'>
الْجُغْرَافِيَّا الطَّبِيعِيَّةِ وهِي الَّتِي تَهْتِمُ بِدِرَاسَةِ طَبِيعَةِ الْأَرَضِ مِن حَيْث الْبِنْيَةِ الْجِيُولُوجِيَّةِ وَالظَّوَاهِرِ الْجَوِّيَّةِ وَالنَّبَاتِ وَالْحَيَوَانِ الطَّبِيعِيِّ أَو
ومِنهَا أَيْضا الْجُغْرَافِيَا الْفَلَكِيَّةِ وَتَهْتِمُ بِدِرَاسَةِ شَكْلِ الْأرْضِ وَحَجْمِهَا وَحَرَكَتِهَا وَكُرَوِيَّتِهَا وَعَلَاَّقَاتِهَا بِالْكَوَاكِبِ الْأُخْرَى
</span ></a></p>
<p class=MsoNormal dir=RTL><span dir=LTR> </span ></p>
</div>
"$
Dim myHtmlString,code As String
code = $"
<html dir='rtl'>
<head>
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'/>
<style Type='text/css'>
@font-face {font-family: Font_Naskh;src: url('${ xui.FileUri(File.DirAssets,Font_Naskh) }');}
body {
font-family: 'Font_Naskh', sans-serif;
font-size: ${16}pt;
text-align: justify;
}
</style>
</head>
<body> "$
''Log(B4XPages.MainPage.TypF_WebView1)
myHtmlString = code &Text & "</body></html>"
Log(myHtmlString)
' myInterface.addJavascriptInterface(WebView1, "B4A")
WebView1.LoadHtml(myHtmlString)