Mapping Arabic Fonts in QtWebKit

I wrote a program with QtWebkit. I used Arabic fonts in this application. But the text shown below was not applicable. Is there a solution to fix this? text shown inapplicable in QtWebkit:
(source: shiaupload.ir )

text shown inapplicable:

sample code here

HTML code: {

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html>
 <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 </head>


<style>
/*Twe Arabic font for test:*/
@font-face {
        font-family: '__me_quran';
        src: url(me_quran.ttf) format('truetype');
    }
@font-face {
        font-family: '__traditionalArabic';
        src: url(trado.ttf) format('truetype');
    }
 #para1
{
 font-family :/*__me_quran*/__traditionalArabic;
 text-align : justify;/*In this project i need justify alinement*/
 direction:rtl;
}


</style>
<script type="text/javascript" >
    var step=1;
    function plusZoom1(){
        document.getElementById("para1").style.zoom = parseFloat(step);
        step +=0.5;
    }

    function minusZoom1(){
        step -=0.5;
        document.getElementById("para1").style.zoom = parseFloat(step);
    }
</script>
<body>
<input type="button" value="+" onclick="plusZoom1();" />
<input type="button" value="-" onclick="minusZoom1();" />
<p id="para1">
       ุจูุณู’ู…ู ุงูŽู„ู„ู‘ูฐู‡ู ุงูŽู„ุฑู‘ูŽุญู’ู…ูฐู†ู ุงูŽู„ุฑู‘ูŽุญููŠู…ู ( 1 )  ุงูŽู„ู’ุญูŽู…ู’ุฏู ู„ูู„ู‘ูฐู‡ู ุฑูŽุจู‘ู ุงูŽู„ู’ุนูฐุงู„ูŽู…ููŠู†ูŽ ( 2 )  ุงูŽู„ุฑู‘ูŽุญู’ู…ูฐู†ู ุงูŽู„ุฑู‘ูŽุญููŠู…ู ( 3 )  ู…ูฐุงู„ููƒู ูŠูŽูˆู’ู…ู ุงูŽู„ุฏู‘ููŠู†ู ( 4 )  ุฅููŠู‘ูฐุงูƒูŽ ู†ูŽุนู’ุจูุฏู ูˆูŽ ุฅููŠู‘ูฐุงูƒูŽ ู†ูŽุณู’ุชูŽุนููŠู†ู ( 5 )  ุงูู‡ู’ุฏูู†ูŽุง ุงูŽู„ุตู‘ูุฑูฐุงุทูŽ ุงูŽู„ู’ู…ูุณู’ุชูŽู‚ููŠู…ูŽ ( 6 )  ุตูุฑูฐุงุทูŽ ุงูŽู„ู‘ูŽุฐููŠู†ูŽ ุฃูŽู†ู’ุนูŽู…ู’ุชูŽ ุนูŽู„ูŽูŠู’ู‡ูู…ู’ ุบูŽูŠู’ุฑู ุงูŽู„ู’ู…ูŽุบู’ุถููˆุจู ุนูŽู„ูŽูŠู’ู‡ูู…ู’ ูˆูŽ ู„ุงูŽ ุงูŽู„ุถู‘ูฐุงู„ู‘ููŠู†ูŽ ( 7 ) 
</p>
</body>
</html>

}

QT code: {

#include <QtGui/QApplication>
#include <QWebView>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QWebView wv;
    wv.setUrl(QUrl::QUrl("qrc:/rc/a.html"));
    wv.show();

    return a.exec();
}

}

+6
source share
1 answer

I encountered a similar problem a long time ago. Qt did not display some Arabic characters as they should appear. I had to change the mechanism for drawing Qt fonts and use the FreeType font library to draw fonts. You can use FreeType. Further information here: http://freetype.sourceforge.net/index2.html

- Qt, .

+1

All Articles