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

using SourceCodePro font

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.2
    • None
    • Linux/Wayland

      setting application wide font with

          QApplication app(argc, argv);
          int fontId = QFontDatabase::addApplicationFont(":/fonts/SourceCodePro-Light.ttf");
          // int fontId = QFontDatabase::addApplicationFont(":/fonts/lte50331.ttf");

          if (fontId != -1) {
              // Get the font family name
              QStringList fontFamilies = QFontDatabase::applicationFontFamilies(fontId);

              if (!fontFamilies.isEmpty())

      {             QString fontFamily = fontFamilies.at(0);             // Create and set the font             QFont customFont(fontFamily);             customFont.setPointSize(10); // Optional: set size             app.setFont(customFont);         }

          } else

      {         qWarning() << "Failed to load custom font from resources";     }

      results in random black areas while printing with KDReports or 

          QPrinter printer;
          printer.setFontEmbeddingEnabled(true);

          // Show print dialog
          QPrintDialog dialog(&printer, this);
          if (dialog.exec() == QDialog::Accepted)

      {         // Print the content         ui->textEdit->print(&printer);     }

        1. test.pdf
          12 kB
          Dietmar
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            esabraha Eskil Abrahamsen Blomfeldt
            erni35 Dietmar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes