Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change different fonts when change to different language.
Forum Updated to NodeBB v4.3 + New Features

How to change different fonts when change to different language.

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 1.5k 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.
  • B Offline
    B Offline
    brucezcg
    wrote on 9 Aug 2018, 08:16 last edited by
    #1

    I have 4 fonts:
    When UI language is English, use
    font1.ttf
    font2.ttf
    When language is Chinese, Use:
    font3.ttf
    font4.ttf

    How to do this? Thanks

    1 Reply Last reply
    0
    • V Offline
      V Offline
      VRonin
      wrote on 9 Aug 2018, 08:28 last edited by
      #2

      After calling QApplication::installTranslator call QApplication::setFont

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      B 1 Reply Last reply 9 Aug 2018, 08:31
      1
      • V VRonin
        9 Aug 2018, 08:28

        After calling QApplication::installTranslator call QApplication::setFont

        B Offline
        B Offline
        brucezcg
        wrote on 9 Aug 2018, 08:31 last edited by
        #3

        @VRonin Thanks, but I have 2 different ttf fonts each Language, app.setFont(xxx) only change the default font.
        For example:
        All title use bold.ttf,
        others use regular.ttf

        1 Reply Last reply
        0
        • V Offline
          V Offline
          VRonin
          wrote on 9 Aug 2018, 09:55 last edited by
          #4

          There's no such a thing as a generic "title". What widgets are you using?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          B 1 Reply Last reply 10 Aug 2018, 05:40
          0
          • V VRonin
            9 Aug 2018, 09:55

            There's no such a thing as a generic "title". What widgets are you using?

            B Offline
            B Offline
            brucezcg
            wrote on 10 Aug 2018, 05:40 last edited by
            #5

            @VRonin Sorry for not clearly expressed.
            For example:

            1. English Language:
              QTabBar{font:"Font1_English"}
              Default text {font:"Font2_English"}

            2)Chinese:
            Change QTabBar{font:"Font1_CN"}
            Default {font:"Font2_CN"}

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 10 Aug 2018, 06:10 last edited by
              #6

              Hi,

              Are you using style sheet for that ?

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

              B 1 Reply Last reply 21 Aug 2018, 01:18
              0
              • S SGaist
                10 Aug 2018, 06:10

                Hi,

                Are you using style sheet for that ?

                B Offline
                B Offline
                brucezcg
                wrote on 21 Aug 2018, 01:18 last edited by
                #7

                @SGaist said in How to change different fonts when change to different language.:

                Yes SGaist

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 21 Aug 2018, 06:41 last edited by
                  #8

                  Then when the change language event happens, change the style sheet.

                  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
                  3

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved