如何通过控制台配置qtwebkit中的显示字体?
我试图在 python 中的 qtwebkit 中渲染页面时达到最大的准确性(通过 xvfb)。我是字体有问题。
这是一个示例(图片)。 这个例子表明斜体显示有问题,但所有站点都不存在。系统是ubuntu 10.10服务器,它设置了标准字体包(msttcorefonts等),但似乎并不影响qtwebkit中字体的显示。谁知道如何配置这个?
谢谢!
I'm trying to achieve maximum accuracy in rendering pages in qtwebkit in python (via xvfb). I am I have a problem with fonts.
Here's an example (image).
This example shows that there is a problem with displaying in italics, but there is not at all sites. System is ubuntu 10.10 server and it set the standard packs of fonts (msttcorefonts and others), but it seems it does not affect the display of fonts in the qtwebkit. Who knows how to configure this?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题是:在这种情况下“最大准确度”是什么?
“真实”图像从何而来?我假设这就是您在浏览器中访问该网站时看到的内容。根据您的浏览器设置(您的个人设置和/或默认设置)以及网页提供的样式信息(CSS、样式属性...),它可能看起来有所不同。如果网站没有指定要使用的字体,您的浏览器将仅使用默认字体。如果是这种情况,“true”和“qtwebkit”渲染同样“准确”,尽管它们看起来不同。
这意味着您可能只需要相信 qtwebkit 就能正确渲染。
如果您绝对希望渲染看起来与您的浏览器中的相同,您可以尝试通过
QWebView.settings()
使用相同的设置配置您的 QWebView(请参阅< a href="http://www.pyside.org/docs/pyside/PySide/QtWebKit/QWebSettings.html" rel="nofollow">QWebSettings)。请注意,这并不意味着该页面对每个人来说都是这样的。
I think the problem is: what is "maximum accuracy" in this case?
Where does the "true" image come from? I assume that is what you saw when you visited the site in your browser. Depending on your browser's settings (your personal settings and/or default settings) and on what styling information (css, style attributes...) the web page provides, it may look different. If the site doesn't specify what fonts to use, your browser will just use the default. If this is the case, the "true" and the "qtwebkit" renderings are equally "accurate", even though they look different.
This means that you probably just have to trust qtwebkit to render correctly.
If you absolutely want to have the rendering look the same as in your browser, you can try to configure your QWebView with the same settings through
QWebView.settings()
(see QWebSettings).Note that this still doesn't imply that the page will look that way for everyone.