Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. India
  4. [solved] how to set local fonts
Forum Updated to NodeBB v4.3 + New Features

[solved] how to set local fonts

Scheduled Pinned Locked Moved India
21 Posts 3 Posters 11.0k Views 1 Watching
  • 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
    sasireka
    wrote on last edited by
    #1

    hi all,
    how to set local fonts. I am trying with this code. this is working for english but not for “lohit tamil”.

       @ ui->label1->setStyleSheet ("font: 40pt \"Lohit Tamil\";");
            ui->label1->setText("சென்னை");
            //ui->label1->setText("tamil");
            ui->label1->show();@
    

    .................................
    Thanks & Regards

    Sasi

    .................................
    Go Green

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Is that fond known to the system ? If it's custom, did you register it with QFontDatabase ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sasireka
        wrote on last edited by
        #3

        how to do it. I am not getting.

        [quote author="SGaist" date="1411588373"]Hi,

        Is that fond known to the system ? If it's custom, did you register it with QFontDatabase ?[/quote]

        .................................
        Thanks & Regards

        Sasi

        .................................
        Go Green

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          Hi,

          Check "QFontDatabase::addApplicationFont":http://qt-project.org/doc/qt-5/qfontdatabase.html#addApplicationFont.

          157

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sasireka
            wrote on last edited by
            #5

            I am new to Qt. I am not understanding. Please give me some guide.

            [quote author="p3c0" date="1411640348"]Hi,

            Check "QFontDatabase::addApplicationFont":http://qt-project.org/doc/qt-5/qfontdatabase.html#addApplicationFont.[/quote]

            .................................
            Thanks & Regards

            Sasi

            .................................
            Go Green

            1 Reply Last reply
            0
            • p3c0P Offline
              p3c0P Offline
              p3c0
              Moderators
              wrote on last edited by
              #6

              Do you have a .ttf file for your font ?
              Or have you made sure that the font is already available inside Qt ?

              157

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sasireka
                wrote on last edited by
                #7

                yes i checked tamit fonts (Lohit Tamil) available in qt.

                [quote author="p3c0" date="1411709461"]Do you have a .ttf file for your font ?
                Or have you made sure that the font is already available inside Qt ?[/quote]

                .................................
                Thanks & Regards

                Sasi

                .................................
                Go Green

                1 Reply Last reply
                0
                • p3c0P Offline
                  p3c0P Offline
                  p3c0
                  Moderators
                  wrote on last edited by
                  #8

                  What does this output ?
                  @
                  QFontDatabase d;
                  foreach(QString fmly, d.families(QFontDatabase::Tamil))
                  {
                  qDebug() << fmly;
                  }
                  @

                  157

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sasireka
                    wrote on last edited by
                    #9

                    @QFontDatabase d;
                    foreach(QString fmly, d.families(QFontDatabase::Tamil))
                    {
                    qDebug("சென்னை") << fmly;
                    ui->label1->show();
                    }@

                    error:--
                    /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:43: error: no match for 'operator<<' in 'qDebug(((const char*)"\37777777740\37777777656\37777777632\37777777740\37777777657\37777777606\37777777740\37777777656\37777777651\37777777740\37777777657\37777777615\37777777740\37777777656\37777777651\37777777740\37777777657\37777777610")) << fmly'-

                    [quote author="p3c0" date="1411714136"]What does this output ?
                    @
                    QFontDatabase d;
                    foreach(QString fmly, d.families(QFontDatabase::Tamil))
                    {
                    qDebug() << fmly;
                    }
                    @[/quote]

                    .................................
                    Thanks & Regards

                    Sasi

                    .................................
                    Go Green

                    1 Reply Last reply
                    0
                    • p3c0P Offline
                      p3c0P Offline
                      p3c0
                      Moderators
                      wrote on last edited by
                      #10

                      No.. Just use as it is as shown earlier. It will just print a list of fonts available under Tamil Writingsystem.

                      157

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        sasireka
                        wrote on last edited by
                        #11

                        @QFontDatabase label1;
                        foreach(QString fmly, label1.families(QFontDatabase::Tamil))
                        {
                        //qDebug("சென்னை") << fmly;
                        qDebug("சென்னை");
                        ui->label1->show();
                        }@

                        no output. getting blank.

                        bq. bq. bq. Application output:

                        Starting /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/animation...
                        சென்னை
                        சென்னை
                        சென்னை
                        சென்னை
                        சென்னை
                        சென்னை
                        சென்னை
                        சென்னை bq.

                        [quote author="p3c0" date="1411714136"]What does this output ?
                        @
                        QFontDatabase d;
                        foreach(QString fmly, d.families(QFontDatabase::Tamil))
                        {
                        qDebug() << fmly;
                        }
                        @[/quote]

                        .................................
                        Thanks & Regards

                        Sasi

                        .................................
                        Go Green

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          sasireka
                          wrote on last edited by
                          #12

                          okay i will try now

                          .................................
                          Thanks & Regards

                          Sasi

                          .................................
                          Go Green

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            sasireka
                            wrote on last edited by
                            #13

                            bq. 3 errors:

                            /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/../animation/dialog.cpp:43: error: invalid use of incomplete type 'struct QDebug'

                            /usr/include/qt4/QtCore/qglobal.h:1764: error: forward declaration of 'struct QDebug'

                            /usr/include/qt4/QtCore/qglobal.h:1767: warning: inline function 'QDebug qDebug()' used but never defined [enabled by default]

                            [quote author="p3c0" date="1411717583"]No.. Just use as it is as shown earlier. It will just print a list of fonts available under Tamil Writingsystem.[/quote]

                            .................................
                            Thanks & Regards

                            Sasi

                            .................................
                            Go Green

                            1 Reply Last reply
                            0
                            • p3c0P Offline
                              p3c0P Offline
                              p3c0
                              Moderators
                              wrote on last edited by
                              #14

                              #include <QDebug>

                              157

                              1 Reply Last reply
                              0
                              • S Offline
                                S Offline
                                sasireka
                                wrote on last edited by
                                #15

                                Starting /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/animation...
                                "Lohit Tamil"
                                "TAMu_Kadambri"
                                "TAMu_Kalyani"
                                "TAMu_Maduram"
                                "TSCu_Comic"
                                "TSCu_Paranar [macromedia]"
                                "TSCu_Paranar [unknown]"
                                "TSCu_Times"
                                /home/dev6/Desktop/animation-build-desktop-Qt_4_8_1_in_PATH__System__Release/animation exited with code 0

                                [quote author="p3c0" date="1411718354"]#include <QDebug>[/quote]

                                .................................
                                Thanks & Regards

                                Sasi

                                .................................
                                Go Green

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  sasireka
                                  wrote on last edited by
                                  #16

                                  Now what i have to do

                                  .................................
                                  Thanks & Regards

                                  Sasi

                                  .................................
                                  Go Green

                                  1 Reply Last reply
                                  0
                                  • S Offline
                                    S Offline
                                    sasireka
                                    wrote on last edited by
                                    #17

                                    tamil fonts are available. now what i have to do. help me please

                                    .................................
                                    Thanks & Regards

                                    Sasi

                                    .................................
                                    Go Green

                                    1 Reply Last reply
                                    0
                                    • p3c0P Offline
                                      p3c0P Offline
                                      p3c0
                                      Moderators
                                      wrote on last edited by
                                      #18

                                      Try this:
                                      @
                                      ui->label->setText(QString::fromUtf8("சென்னை"));
                                      @

                                      157

                                      1 Reply Last reply
                                      0
                                      • S Offline
                                        S Offline
                                        sasireka
                                        wrote on last edited by
                                        #19

                                        Yes i got it now :)
                                        Thank you somuch.. I dont have words.. thank you somuch.. thanks to you all.

                                        [quote author="p3c0" date="1411721384"]Try this:
                                        @
                                        ui->label->setText(QString::fromUtf8("சென்னை"));
                                        @[/quote]

                                        .................................
                                        Thanks & Regards

                                        Sasi

                                        .................................
                                        Go Green

                                        1 Reply Last reply
                                        0
                                        • p3c0P Offline
                                          p3c0P Offline
                                          p3c0
                                          Moderators
                                          wrote on last edited by
                                          #20

                                          That's fine :)
                                          Please mark the post as solved.
                                          Happy Coding...

                                          157

                                          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