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 ARM Hindi font problem

Qt Embedded ARM Hindi font problem

Scheduled Pinned Locked Moved Mobile and Embedded
9 Posts 2 Posters 6.7k 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.
  • S Offline
    S Offline
    sgtHartman88
    wrote on last edited by
    #1

    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..

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sgtHartman88
      wrote on last edited by
      #2

      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?

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zhxt
        wrote on last edited by
        #3

        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.

        Qt Developer

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sgtHartman88
          wrote on last edited by
          #4

          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!

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zhxt
            wrote on last edited by
            #5

            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 :)

            Qt Developer

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sgtHartman88
              wrote on last edited by
              #6

              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?

              1. what TTF font did you use for your test? i'm trying with the Code2000 link:http://en.fonts2u.com/code2000.font
              2. what do you mean with "set codec"? the locale codec of mine application?

              Thanks again for your time, it's greatly appreciated! :)

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                zhxt
                wrote on last edited by
                #7

                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&#40;&#41;;
                

                }
                @

                fontdir:
                DroidSansDevanagari-Regular DroidSansDevanagari-Regular.ttf FT n 75 240 s

                Qt Developer

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  sgtHartman88
                  wrote on last edited by
                  #8

                  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!! :)

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    zhxt
                    wrote on last edited by
                    #9

                    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();
                    

                    }
                    @

                    Qt Developer

                    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