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

Soft hyphen protrudes from rest of text

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P3: Somewhat important P3: Somewhat important
    • 5.15.0 Beta2
    • 5.4.0
    • GUI: Text handling
    • None
    • Arch Linux
    • bd3c82f8db4391fc1d6d3338827356143fd598dd (qt/qtbase/5.14)

      It seems the width of the soft hyphen is not considered in the line width calculation, making it protrude from the rest of the text:

      Test Case

      #include <QApplication>
      #include <QTextDocument>
      #include <QTextEdit>
      #include <QString>
      
      int main(int argc, char *argv[]) {
          QApplication app(argc, argv);
      
          QTextEdit edit("Soft hyphen pro" + QString(QChar::SoftHyphen) + "trudes from rest of text");
      
          edit.document()->setDocumentMargin(20);
          edit.setAlignment(Qt::AlignJustify);
          edit.resize(150, 100);
      
          edit.show();
      
          return app.exec();
      }
      

      Result

      Note: Until issue 44234 is fixed, you must run the above with QT_HARFBUZZ=old in the environment for the soft hyphen to appear at all on 5.x.

        1. bug.zip
          0.8 kB
          Elvis Stansvik
        2. soft-hyphen-qt-5.4.0.png
          12 kB
          Elvis Stansvik
        For Gerrit Dashboard: QTBUG-44257
        # Subject Branch Project Status CR V

            allan.jensen Allan Sandfeld Jensen
            estan Elvis Stansvik
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes