Results 1 to 5 of 5

Thread: Text rendered as squares

  1. #1
    Join Date
    Mar 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Text rendered as squares

    When I try to run my application on an embedded linux machine, all text is rendered as squares. Does anybody have an idea how I can fix this?

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Text rendered as squares

    My guess is: You use a custom font which is not installed/found on your device, thus the default font is used. But since you use non-ASCII characters the default font can't render them... That's what my crystal ball is saying.

    So try simple 1234abcd with a default font and see if you can see them.

  3. #3
    Join Date
    Mar 2009
    Posts
    9
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Text rendered as squares

    I did not choose any specific font in the application. Just added some QLabels and a QPushButton with ASCII text (label->setText("Hello Qt!!").

  4. #4
    Join Date
    Aug 2011
    Location
    East Sussex
    Posts
    3
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Text rendered as squares

    Fonts are stored by default in something like /usr/local/Trolltech/your-qt-sdk-version/lib/fonts, depending on the structure of your SDK directory when you make'd the source.

    Clearly, you can run against the Qt libs, so just try mkdir fonts/ in your Qt lib directory and dump the fonts there (or symlink it to your preferred userspace directory).

    Qt Embedded supports TrueType fonts (.ttf), so perhaps copy something familiar like Arial onto your device and specify that. In my experience, not specifying fonts yielded exactly the same issues you're suffering from.

    And obviously check permissions, turn it on and off again blah blah blah.

    DaRab.

  5. #5
    Join Date
    Nov 2011
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Text rendered as squares

    Quote Originally Posted by Lykurg View Post
    My guess is: You use a custom font which is not installed/found on your device, thus the default font is used. But since you use non-ASCII characters the default font can't render them... That's what my crystal ball is saying.

    So try simple 1234abcd with a default font and see if you can see them.
    Hi. I have quite the same problem using a buildroot-compiled qt-everywhere 4.7.1. Fonts are installed in /usr/lib/fonts on the arm target.
    I tried the mousecalibration demo :

    # setting some variables
    QT_SOURCE_DIR=$BUILDROOT_DIR/output/build/$QT_VERSION
    COMPILER_DIR=$BUILDROOT_DIR/output/host/usr/bin/
    export PATH=$COMPILER_DIR:$PATH
    export QMAKEPATH=$QT_SOURCE_DIR/bin
    export QMAKESPEC=$QT_SOURCE_DIR/mkspecs/default
    QMAKE=$QMAKEPATH/qmake

    # create makefile
    $QMAKE

    # build application
    make -k

    When running on the embedded devices glyphs were shown as squares.
    Using strace on the program seems to indicate that /usr/lib/fonts is
    correctly detected.

    I wondered if the default font was not the right one for the demo's specified
    text (but it shouldn't : the text is latin1/ascii) so I modified the code to add :
    message.setFont(QFont("helvetica", 12));


    However, as still no text was correctly displayed I added a few lines of
    code :
    {
    QFontDatabase *fdb = new QFontDatabase ;
    QStringList fam = fdb->families();

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

    I got the following result :
    # ./mousecalibration -qws
    QFontDatabase::Any: available font families
    "fixed"
    "helvetica"
    "micro"
    "unifont"
    .

    What am I missing here ?


    Thomas.

Similar Threads

  1. variable matrix of squares,which QWidget ?
    By salmanmanekia in forum Newbie
    Replies: 5
    Last Post: 5th June 2010, 16:08
  2. Packing known number of uniform-sized squares into a known rect
    By momesana in forum General Programming
    Replies: 2
    Last Post: 17th March 2010, 15:09
  3. Replies: 2
    Last Post: 24th January 2009, 18:30
  4. changing svg graphic attributes once rendered
    By barrygp in forum Qt Programming
    Replies: 0
    Last Post: 13th December 2008, 02:09
  5. Webkit rendered fonts
    By carl in forum Qt Programming
    Replies: 0
    Last Post: 5th September 2008, 16:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.