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. Qt Embedded Font rendered as squares
QtWS25 Last Chance

Qt Embedded Font rendered as squares

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 4 Posters 4.3k 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.
  • B Offline
    B Offline
    btom
    wrote on last edited by
    #1

    Hi all !

    I've been developping using Qt 2.3 for a very long time and now as I switched
    to Qt 4.7, I have a small problem regarding to font rendering. I compiled Qt with
    the -prefix /usr option and, in the final target FS image, libraries are in /usr/lib
    and fonts are all in /usr/lib/fonts.

    I tried to compile the mousecalibration example and everything went fine until I
    wanted to launch the app: characters where rendered as squares. So I added
    a few lines of code to display what was happening:

    First of all I specified a default font (helvetica_120_50.qpf is present).

    @ QApplication::setFont(QFont("helvetica", 12));@

    Then I listed all the fonts available:

    @
    {
    QFontDatabase *fdb = new QFontDatabase ;
    QStringList fam = fdb->families();

        qDebug() << "QFontDatabase::Any: available font families -> " << fam.count();
        for (int i = 0 ; i < fam.count() ; i++)
        {
                qDebug() << fam[i];
        }
    }
    

    @

    Here is the output:

    QFontDatabase::Any: available font families -> 1
    "helvetica"
    .

    When I add more qpf fonts, they are all listed. However no TTF font
    (such as DejaVuSans) are listed... Not only that, but even specifying
    helvetica, which is a known font to the system, characters are still
    rendered as squares.

    After that I tried to explicitly load the DejaVuSans font:

    @
    int id = fdb->addApplicationFont("/usr/lib/fonts/DejaVuSans.ttf");
    qDebug() << "Loaded ttf font: " << id;
    @

    But the result was: "Loaded ttf font: -1"

    Does anyone know what I'm missing here ?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      btom
      wrote on last edited by
      #2

      I forgot to mention that the program is run on an embedded arm
      platform with buildroot 2011-02, and that freetype is installed and
      (possibly) used by Qt.

      Please, anyone ?

      1 Reply Last reply
      0
      • X Offline
        X Offline
        Xooch
        wrote on last edited by
        #3

        Did you ever resolve this issue? I have a similar problem, but with Qt 5.3.

        1 Reply Last reply
        0
        • K Offline
          K Offline
          kostyamaslyuk
          wrote on last edited by
          #4

          http://qt-project.org/doc/qt-4.8/qfontdatabase.html#addApplicationFont

          maybe this will be helpfull, doеs your system have fontconfig?
          Have you tried to addFromData ?

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kumararajas
            wrote on last edited by
            #5

            [quote author="Xooch" date="1415895249"]Did you ever resolve this issue? I have a similar problem, but with Qt 5.3.[/quote]

            This was discussed in other thread, see if this helps? "Link to other thread":http://qt-project.org/forums/viewthread/8331/

            --Kumar

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kumararajas
              wrote on last edited by
              #6

              [quote author="Xooch" date="1415895249"]Did you ever resolve this issue? I have a similar problem, but with Qt 5.3.[/quote]

              This was discussed in other thread, see if this helps? "Link to other thread":http://qt-project.org/forums/viewthread/8331/

              --Kumar

              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