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

Soft hyphen protrudes from rest of text

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        1. bug.zip
          0.8 kB
        2. soft-hyphen-qt-5.4.0.png
          soft-hyphen-qt-5.4.0.png
          12 kB

        Issue Links

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

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes