-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 http://fortawesome.github.io/Font-Awesome/examples/ 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:
    !http://image-upload.de/image/Y6I7MC/bd214882c9.png(withfontsmoothing)!

    With disabled font smoothing:
    !http://image-upload.de/image/5E2US1/897bd60898.png(withoutfontsmoothing)!
    *left is rendered by chrome, right by QWebView

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

    #include <QWebView>
    #include <QWebSettings>

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

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

    m_webView->setUrl(QUrl("http://fortawesome.github.io/Font-Awesome/examples/"));
    m_webView->setRenderHints(QPainter::Antialiasing |
    QPainter::TextAntialiasing |
    QPainter::HighQualityAntialiasing |
    QPainter::SmoothPixmapTransform);
    }@

    mainwindow.h
    @#ifndef MAINWINDOW_H

    #include <QMainWindow>

    class QWebView;

    class MainWindow : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit MainWindow(QWidget *parent = NULL);

    private:
    QWebView *m_webView;
    };

    #endif //MAINWINDOW_H
    @

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

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

    @

    I hope this helps you to understand the problem.

    Thanks in Advance
    Timo



  • Hello Timo,
    I see your post is about a year ago.
    But currently i have a same situation concerning webview. see my *pdf
    http://www.adesys.nl/download/QWebViewFontIssue.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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.