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. Multilingual UI and Fonts?
Forum Updated to NodeBB v4.3 + New Features

Multilingual UI and Fonts?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 4 Posters 868 Views 2 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.
  • T Offline
    T Offline
    Taytoo
    wrote on last edited by
    #1

    Currently, I'm using specific open-source fonts for UI elements to make the app cross-platform e.g. Open Sans.

    If I use Qt Linguist to create translation files, then how would Qt choose which font to use when the language is switched from English to Arabic, Japanese etc which aren't supported by Open Sans?

    Christian EhrlicherC 1 Reply Last reply
    0
    • T Taytoo

      Currently, I'm using specific open-source fonts for UI elements to make the app cross-platform e.g. Open Sans.

      If I use Qt Linguist to create translation files, then how would Qt choose which font to use when the language is switched from English to Arabic, Japanese etc which aren't supported by Open Sans?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It does not - linguist only translates texts. If you hard-copde your font in your app and the characters are not available for this font then nothing is drawn. So hard-coding is maybe not the best idea unless you make sure the selected font fits to your language.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      T 1 Reply Last reply
      0
      • Christian EhrlicherC Christian Ehrlicher

        It does not - linguist only translates texts. If you hard-copde your font in your app and the characters are not available for this font then nothing is drawn. So hard-coding is maybe not the best idea unless you make sure the selected font fits to your language.

        T Offline
        T Offline
        Taytoo
        wrote on last edited by
        #3

        @Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.

        Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?

        If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?

        Christian EhrlicherC T 2 Replies Last reply
        0
        • T Taytoo

          @Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.

          Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?

          If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Taytoo said in Multilingual UI and Fonts?:

          Are default font names specified for each platform in framework?so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?

          It's using the font from the OS.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • T Taytoo

            @Christian-Ehrlicher What's Qt's strategy for choosing a font? When I open a form in Qt Designer on Windows. It shows "Segoe UI" as the font for every control, but this font isn't isn't available on Mac and can't be distributed either.

            Are default font names specified for each platform in framework? so if I don't set one in Qt Designer then it'll use one of the hardcoded ones depending on the platform?

            If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UIs when language is switched e.g. switch OpenSans with font A, Roboto with font B? without having to do it for each individual widget?

            T Offline
            T Offline
            Taytoo
            wrote on last edited by
            #5

            If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?

            JonBJ SGaistS 2 Replies Last reply
            0
            • T Taytoo

              If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #6

              @Taytoo
              So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?

              T 1 Reply Last reply
              0
              • T Taytoo

                If I decide to go with hardcoded fonts and I have multiple fonts e.g. different fonts for buttons and labels etc. Is there an easy way to substitute fonts across all UI widgets/application when language is switched e.g. switch OpenSans with font A, Roboto with font B etc without having to do it for each individual widget?

                SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                QApplication::setFont should do the job. That said, take into account the warning about mixing that method and 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
                0
                • JonBJ JonB

                  @Taytoo
                  So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?

                  T Offline
                  T Offline
                  Taytoo
                  wrote on last edited by
                  #8

                  @JonB said in Multilingual UI and Fonts?:

                  @Taytoo
                  So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?

                  Think this might be a better option, and easy to manage as well.

                  @SGaist said in Multilingual UI and Fonts?:

                  Hi,

                  QApplication::setFont should do the job. That said, take into account the warning about mixing that method and style sheet.

                  Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K

                  SGaistS 1 Reply Last reply
                  0
                  • T Taytoo

                    @JonB said in Multilingual UI and Fonts?:

                    @Taytoo
                    So far as I know, if a widget has an explicit font set on it you would have to change that at runtime, on each widget. Could you use stylesheets for all your font rules instead, it would be easier to change that once at runtime?

                    Think this might be a better option, and easy to manage as well.

                    @SGaist said in Multilingual UI and Fonts?:

                    Hi,

                    QApplication::setFont should do the job. That said, take into account the warning about mixing that method and style sheet.

                    Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K

                    SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    @Taytoo said in [Multilingual UI and Fonts?]:

                    Wouldn't that just set specified font for all widgets? I'like to substitute different fonts. I use three font styles so need to substitute them accordingly e.g. Font A -> B, Font X -> Y, Font J -> K

                    Indeed, my bad, I misunderstood the scope of your issue.

                    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

                    • Login

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