Unsolved Qt 5.7.0 Font Rendering Problem
-
Hi there,
I got a QWidget / QPainter font rendering problem on Windows 10 64 bit desktop using Qt 5.7.0.
Look the following screenshots. Using Qt the space between 'tt' and 'ti' is missing at Calibri and Carlito font:
Qt: https://s19.postimg.org/dzl1pst8z/image.png
Wordpad (Windows): https://s19.postimg.org/9rq9h1rtf/Wordpad_Windows.png
LibreOffice: https://s19.postimg.org/9t07agtn7/Libre_Office.png
Sourcecode of the Qt screenshot:
#include <QApplication> #include <QWidget> #include <QPainter> class Widget : public QWidget { public: Widget(); protected: void paintEvent(QPaintEvent *); }; Widget::Widget() { setAutoFillBackground(true); setPalette(Qt::white); } void Widget::paintEvent(QPaintEvent *) { QPainter painter(this); painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing); QFont Calibri_18_Normal("Calibri", 22, QFont::Normal); QFont Calibri_18_Bold("Calibri", 22, QFont::Bold); QFont Arial_18_Normal("Arial", 22, QFont::Normal); QFont Arial_18_Bold("Arial", 22, QFont::Bold); QFont Carlito_18_Normal("Carlito", 22, QFont::Normal); QFont Carlito_18_Bold("Carlito", 22, QFont::Bold); int y = 100; painter.setFont(Calibri_18_Bold); painter.drawText(200, y += 40, "Qt: Look for missing space between 'tt' and 'ti'"); painter.setFont(Calibri_18_Normal); painter.drawText(200, y += 80, "Calibri: Rating Betting Setup - (Windows Clear Type)"); painter.setFont(Calibri_18_Bold); painter.drawText(200, y += 40, "Calibri: Rating Betting Setup - (Windows Clear Type)"); painter.setFont(Arial_18_Normal); painter.drawText(200, y += 80, "Arial: Rating Betting Setup - (Windows)"); painter.setFont(Arial_18_Bold); painter.drawText(200, y += 40, "Arial: Rating Betting Setup - (Windows)"); painter.setFont(Carlito_18_Normal); painter.drawText(200, y += 80, "Carlito: Rating Betting Setup - (Open Source, LibreOffice)"); painter.setFont(Carlito_18_Bold); painter.drawText(200, y += 40, "Carlito: Rating Betting Setup - (Open Source, LibreOffice)"); } int main(int argc, char *argv[]) { QApplication app(argc, argv); Widget widget; widget.showMaximized(); return app.exec(); }
-
-
@kshegunov
But why are doing the native Windows program 'WordPad' and 'LibreOffice' on Windows (based on JAVA) just fine? They all got spaces between 'tt' and 'ti'.Before I began Qt programming I did Microsoft MFC programming. MFC applications on Windows also got spaces between 'tt' and 'ti' using these fonts.
Without spaces between 'tt' and 'ti' the fonts looks ugly to me.
-
@mireiner said:
But why are doing the native Windows program 'WordPad' and 'LibreOffice' on Windows (based on JAVA) just fine?
No idea. My suspicion is that it depends how exactly the text rendering is done at the low-level (how the API is used). Sadly I don't know of a way to disable the ligatures in Qt.