gpt4 book ai didi

qt - 在 QtWebKit 中显示阿拉伯字体

转载 作者:行者123 更新时间:2023-12-03 01:09:39 26 4
gpt4 key购买 nike

我用QtWebkit写了一个程序。我在此应用程序中使用了阿拉伯字体。但如下所示的文本不适用。是否有解决方案可以解决? text shown inapplicable in QtWebkit :
(来源:shiaupload.ir)

text shown inapplicable:

an example code in here

html代码:{

    <!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代码:{

#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();
}

}

最佳答案

我很久以前就遇到过类似的问题。 Qt 没有显示一些应该出现的阿拉伯字符。我不得不更改 Qt 的字体绘制机制并使用“FreeType”字体库来绘制字体。您可以使用 FreeType。更多信息请点击:http://freetype.sourceforge.net/index2.html

或者您可以使用其他图形引擎来绕过 Qt 的绘图 - 它可以显示这些字体。

关于qt - 在 QtWebKit 中显示阿拉伯字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12269764/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com