Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-55477

QFont rendering problem (missing spaces between letters tt, ti, fl, and fi)

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 5.7.0
    • GUI: Font handling
    • None

    Description

      There might be a QFont / QPainter rendering problem on Windows 10 64 bit desktop when fonts like Calibri or Carlito are used (maybe some other too). Perhaps this is related to font ligatures in these fonts.

      Calibri is a Windows font. It's widely used and the standard font of Microsoft Word. Carlito is Open Source and comes with LibreOffice.

      All Windows 10 build in applications like Wordpad, Internet Explorer, Microsoft Edge Brower and the JAVA based LibreOffice do separate the letters tt, ti, fl and fi, like all applications based on Microsoft Visual C# do as well. But QPainter based applications as well as Google Chrome and Firefox browsers don't separate the letters.

      Because all Windows application do separate the mentioned letters, the separation is presumably the standard intended behavior for Windows.

      So its probably not a bug in Qt. But I think there is an option missing for turn off ligatures on Windows.

      Look at the following screenshots:

      Qt: https://s19.postimg.org/rm96yfaqb/image.png

      Visual C#: https://s19.postimg.org/kkfupywib/Microsoft_Visual_C.png

      Wordpad: https://s19.postimg.org/9rq9h1rtf/Wordpad_Windows.png

      LibreOffice: https://s19.postimg.org/9t07agtn7/Libre_Office.png

      Internet Explorer: https://s19.postimg.org/rot2l9edv/Internet_Explorer.png

      Microsoft Edge: https://s19.postimg.org/ybb50p6oj/Microsoft_Edge_Browser.png

      Google Chrome: https://s19.postimg.org/5my6xh4ib/Google_Chrome.png

      Firefox: https://s19.postimg.org/bcj0vj02b/Firefox_Browser.png

      (All applications tested with newest versions. Wordpad, Internet Explorer and Microsoft Edge Browser are Windows 10 build in applications).

      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_20_Normal("Calibri", 30, QFont::Normal);
          QFont Calibri_20_Bold("Calibri", 30, QFont::Bold);
          QFont Carlito_20_Normal("Carlito", 30, QFont::Normal);
          QFont Carlito_20_Bold("Carlito", 30, QFont::Bold);
      
          int y = 10;
      
          painter.setFont(Calibri_20_Normal);
          painter.drawText(20, y += 80, "Qt 5.7.0:");
      
          painter.setFont(Calibri_20_Normal);
          painter.drawText(20, y += 80, "Calibri: Rating Betting Setup flight fight");
          painter.setFont(Calibri_20_Bold);
          painter.drawText(20, y += 60, "Calibri: Rating Betting Setup flight fight");
      
          painter.setFont(Carlito_20_Normal);
          painter.drawText(20, y += 100, "Carlito: Rating Betting Setup flight fight");
          painter.setFont(Carlito_20_Bold);
          painter.drawText(20, y += 60, "Carlito: Rating Betting Setup flight fight");
      }
      
      int main(int argc, char *argv[])
      {
      	QApplication app(argc, argv);
      	Widget widget;
      	widget.showMaximized();
      	return app.exec();
      }
      

      HTML test code for Browsers (Calibri font has to be installed):

      <HTML> 
      <HEAD> 
      <style>
      body { font-family: Calibri !important;}
      </style>
      </HEAD> 
      
      <BODY> 
      Browser xxx: <br><br>
      
      Calibri: Rating Betting Setup flight fight
      </BODY> 
      
      </HTML>
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              mireiner Chris
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes