Qt Embedded ARM Hindi font problem
-
Hi all,
i'm trying to display some hindi font in my Qt application and i get a problem: if i run my application in a UNIX OS i can display all the hindi characters but if i run the same application on an ARM device i cannot display anything.I'm using Qt 4.7.3 in both systems, i would like to know if anyone had any idea about this.. Maybe i had to configure Qt qith some font support?
Also i gave a look at this "link":http://harmattan-dev.nokia.com/docs/library/html/qt4/internationalization.html#languages-and-writing-systems and i find that Devanagari can also be supported by Qt.. But how? I cannot find any FontConfig utility for Qt Embedded..
-
Hi,
did anyone ever try to display Devanagari on a Qt Embedded device?I can't understand what i have to do to fixing this problem.. Is there anybody that could help me?
-
http://harmattan-dev.nokia.com/docs/library/html/qt4/qt-embedded-fonts.html
When Qt for Embedded Linux applications run, they look for fonts in Qt's lib/fonts/ directory. Qt for Embedded Linux will automatically detect prerendered fonts and TrueType fonts. For compatibility, it will also read the legacy lib/fonts/fontdir file.
-
Hi Xingtao,
of course i put my TTF fonts in the lib/fonts/ directory but i didn't resolve the problem. Also, i tried to use a lot of TTF that support Hindi characters but i can't get through this.Recently i've tried to use QPF Font but also this didn't resolve anything.
I wonder if some kind of qt configuration could resolve this.. Did you have any suggestions?
Thanks a lot!
-
I wrote a simple test.
Is this what you want ? http://imgur.com/vX8sFYl
(I have no idea about what that string exactly means, just copied from http://www.bbc.co.uk/hindi/ )I just:
1, add that font.ttf to $QT_QWS_FONTDIR (here it's $QTDIR/lib/fonts);
2, add font defination to the file named "fontdir" in that directory(create one if not exsits);
3, set codec and font in source file.hope it's helpful :)
-
Hi Xingtao,
thank you very much! Yeah, it's what i want on my application.
Now, i'm trying to do what you've done but i still have some issues. Can i asked you some things?- what TTF font did you use for your test? i'm trying with the Code2000 link:http://en.fonts2u.com/code2000.font
- what do you mean with "set codec"? the locale codec of mine application?
Thanks again for your time, it's greatly appreciated! :)
-
1, I used DroidSansDevanagari-Regular.ttf, comes from android repo.
2, QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));main.cpp:
@
#include <QApplication>
#include <QPushButton>
#include <QFont>
#include <QTextCodec>int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));QFont font; font.setFamily("DroidSansDevanagari-Regular"); app.setFont(font); QPushButton b(QObject::tr("जोड़े आपको दुनिया से")); b.show(); return app.exec();
}
@fontdir:
DroidSansDevanagari-Regular DroidSansDevanagari-Regular.ttf FT n 75 240 s -
Thanks a lot Xingtao!!
With your simple example i found the way to display Hindi characters on my device! What i didn't done before your help was to set the codec and to set the font of mine application.Now i have one last question: is there a way to use the font without have to set the Hindi font in my program? Because i've already a font setted and if possibile i would not modify that in my application.
Thanks again, you help me a lot!! :)
-
stylesheet could be one way to do that. also, with stylesheet you can set different font for different widget.
@
#include <QApplication>
#include <QPushButton>
#include <QFont>
#include <QTextCodec>int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));QPushButton b(QObject::tr("जोड़े आपको दुनिया से")); b.setStyleSheet("QPushButton { font-family: \"DroidSansDevanagari-Regular\"; }"); b.show(); return app.exec();
}
@