PDA

View Full Version : Text rendered as squares



SeppeVanNolle
3rd August 2011, 14:07
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!
http://www.pixosaur.com/textproblem

Lykurg
3rd August 2011, 14:54
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.

SeppeVanNolle
3rd August 2011, 15:00
I did not choose any specific font in the application. Just added some QLabels and a QPushButton with ASCII text (label->setText("Hello Qt!!").

DaRabman
10th August 2011, 15:00
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.

tn
9th November 2011, 15:17
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.