Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. The cross-compiled program cannot display the added fonts
Forum Updated to NodeBB v4.3 + New Features

The cross-compiled program cannot display the added fonts

Scheduled Pinned Locked Moved Solved Mobile and Embedded
4 Posts 2 Posters 343 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • KutyusK Offline
    KutyusK Offline
    Kutyus
    wrote on last edited by Kutyus
    #1

    Hello!

    I ran into the following problem.
    I cross-compiled Qt 5.15.2 to Rasperry Pi 4 and added some truetype fonts in the main function:

        QApplication app(argc, argv);
        qint32 fontId;
        fontId = QFontDatabase::addApplicationFont(":/res/fonts/SourceCodePro-Bold.ttf");
        if (fontId > -1) qDebug() << QFontDatabase::applicationFontFamilies(fontId) << "added";
        fontId = QFontDatabase::addApplicationFont(":/res/fonts/SourceCodePro-BoldIt.ttf");
        if (fontId > -1) qDebug() << QFontDatabase::applicationFontFamilies(fontId) << "added";
        fontId = QFontDatabase::addApplicationFont(":/res/fonts/SourceCodePro-It.ttf");
        if (fontId > -1) qDebug() << QFontDatabase::applicationFontFamilies(fontId) << "added";
        fontId = QFontDatabase::addApplicationFont(":/res/fonts/SourceCodePro-Regular.ttf");
        if (fontId > -1) qDebug() << QFontDatabase::applicationFontFamilies(fontId) << "added";
        app.setFont(QFont(QFontDatabase::applicationFontFamilies(fontId).at(0), 10));
    

    The program is compiles and runs, it says on the output that the fonts are added, so the fontId is not -1, but everything is written in the program with the default DejaVu fonts.

    When cross-compiling Qt, Freetype, Use system freeteype and Fontconfig were set to yes.

    Thank you in advance for your help!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      m2dtkast
      wrote on last edited by
      #2

      I might be a bit shooting in the dark here;
      but is fontconfig the only component required? Or is there more?

      KutyusK 1 Reply Last reply
      0
      • M m2dtkast

        I might be a bit shooting in the dark here;
        but is fontconfig the only component required? Or is there more?

        KutyusK Offline
        KutyusK Offline
        Kutyus
        wrote on last edited by
        #3

        @m2dtkast Thanks for the reply.
        Of course there are more, I also use mysql, websocket and ble classes, now first I have to find the error in the display of truetype fonts, then ble follows. The rest works.

        1 Reply Last reply
        0
        • KutyusK Offline
          KutyusK Offline
          Kutyus
          wrote on last edited by
          #4

          I found what I did wrong, during all the copying back and forth, an old header file remained in which I had not yet used the loaded fonts.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved