Important: Please read the Qt Code of Conduct -

-webkit-font-smoothing has no effect on OS X 10.8.5 when "Use LCD font smoothing" is enabled

  • Hi,
    I'm currently building a Hybrid app, with Qt 5.2 (also tested it with 5.3.1) on OS X 10.8.5. It displays a local HTML file, which uses an icon font. The icons require that I set the css property -webkit-font-smoothing to antialiased. This works on Safari and Chrome but not in the QWebView. But in the QWebView it always looked like -webkit-font-smoothing is set to subpixel-antialiased.

    I have set the following rendering hints in the QWebView:
    Antialiasing,TextAntialiasing,HighQualityAntialiasing,SmoothPixmapTransform. (Tried it with different options there, it had no effect).

    But once I disable in the Mac System Preferences under Global the "Use LCD Font smoothing" option it works. So I'm guessing the QtWebkit somehow overrides the -webkit-font-smoothing property if the LCD Font Smoothing is enabled.

    Can you reproduce this issue. If yes, then I will open a bug.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    If you would like someone to help test your issue, you should at least provide a minimal example to reproduce your issue.

  • Hi,
    I was going to do this yesterday but time ran out. I thought I still post it maybe anyone else has encountered the same issue.

    So here we go:
    I used the site to showcase the issue. I guess you can notice the issue best at the home Icon, between the roof and the actual house. There should be some transparency but when LCD font smoothing is enabled it is covered by the antialiasing.

    With enabled font smoothing:

    With disabled font smoothing:
    *left is rendered by chrome, right by QWebView

    And now the source code:
    @#include "mainwindow.h"

    #include <QWebView>
    #include <QWebSettings>

    MainWindow::MainWindow(QWidget *parent) :
    m_webView = new QWebView(this);

    QWebSettings::globalSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);

    m_webView->setRenderHints(QPainter::Antialiasing |
    QPainter::TextAntialiasing |
    QPainter::HighQualityAntialiasing |

    @#ifndef MAINWINDOW_H

    #include <QMainWindow>

    class QWebView;

    class MainWindow : public QMainWindow

    explicit MainWindow(QWidget *parent = NULL);

    QWebView *m_webView;

    #endif //MAINWINDOW_H

    @#include "mainwindow.h"
    #include <QApplication>

    int main(int argc, char **argv)
    QApplication a(argc, argv);
    MainWindow m;;
    return a.exec();


    I hope this helps you to understand the problem.

    Thanks in Advance

  • Hello Timo,
    I see your post is about a year ago.
    But currently i have a same situation concerning webview. see my *pdf
    I also played with the rendiring hits etc. but no success,

    My question, did you succeed in solving your problem ?
    An have hint to solve my problem.

    Thanks in advance for your info.
    Kind regards
    Teun Grinwis

Log in to reply