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

QPdfWriter: Characters with ligature

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.7
    • GUI: Printing
    • None
    • Windows

    Description

      When a ligature is created between 2 characters, the generated PDF will not have them saved as text.

       

      Example: run the code below, open the PDF it generates, select the whole text, copy it and paste it in a text editor.

      The first word will be complete when pasted (at least with the default font used by my system) while the second, due to the font being Calibri Light, will be missing the linked `ti`.
      Because of that, the buggy "application" word cannot be searched (unless you only type "applica" but that is besides the point).

       

      #include <QtGui/QPdfWriter>
      #include <QtWidgets/QApplication>
      #include <QtWidgets/QLabel>
      
      int main(int argc, char *argv[]) {
          QApplication a(argc, argv);    
          QWidget w;
          QLabel l1(&w), l2(&w);
          l2.setStyleSheet("font: 11pt \"Calibri Light\";");
          l2.move(0, 50);
      
          l1.setText("application");
          l2.setText("application");
      
          QPdfWriter writer("Test.pdf");
          writer.setResolution(100);
          w.render(&writer);
      
          return 0;
      }
      

      The behavior does not depend on the type of widget being printed: the issue exists with e.g. `QTextEdit`, even though text can be selected/copied perfectly.

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            fx-david FX David
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes