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 know which fonts work in QTextEdit?
Forum Updated to NodeBB v4.3 + New Features

How to know which fonts work in QTextEdit?

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 1.1k 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.
  • L Offline
    L Offline
    legitnameyo
    wrote on last edited by
    #1

    The code

    QFontDatabase font_data_base;
    
    QStringList font_families = font_data_base.families();
    ui->font_box->addItems(font_families);
    

    I use this to allow users to select a font that is available in their system. Virtually NO font who's name start with a dot " . " works and most fonts doesn't make any apparent change at all. How do I add ONLY the one's that work? Also why are there fonts added that doesn't work from the beginning?

    raven-worxR 1 Reply Last reply
    0
    • L legitnameyo

      The code

      QFontDatabase font_data_base;
      
      QStringList font_families = font_data_base.families();
      ui->font_box->addItems(font_families);
      

      I use this to allow users to select a font that is available in their system. Virtually NO font who's name start with a dot " . " works and most fonts doesn't make any apparent change at all. How do I add ONLY the one's that work? Also why are there fonts added that doesn't work from the beginning?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @legitnameyo said in How to know which fonts work in QTextEdit?:

      How do I add ONLY the one's that work? Also why are there fonts added that doesn't work from the beginning?

      probably those fonts only show symbols/characters for certain unicode points?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      1
      • L Offline
        L Offline
        legitnameyo
        wrote on last edited by
        #3

        I've tried with every letter and symbol on my keyboard but it doesn't even change a little with most of the fonts that were added to my combo box, where I select font. I know the combo box works because it works for the "known" fonts, that I use in programs such as word when I write reports, etc.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          legitnameyo
          wrote on last edited by
          #4

          Every single one of OneNote's fonts are unique and distinct from one another. The question very literally is "How do I find those fonts?" Does anybody have any clues to go on? Have anyone successfully implemented a rather big font list of unique and distinct fonts into QTextEdit? An example would very much be appreciated, since I can't find any! The rich text edit example gave the same result btw...

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by Christian Ehrlicher
            #5

            To select a font out of the available font you can use QFontComboBox

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

            L 1 Reply Last reply
            2
            • Christian EhrlicherC Christian Ehrlicher

              To select a font out of the available font you can use QFontComboBox

              L Offline
              L Offline
              legitnameyo
              wrote on last edited by
              #6

              @Christian-Ehrlicher said in How to know which fonts work in QTextEdit?:

              To select a font out of the available font you can use QFontDatabase

              I have done that. See the initial post

              Christian EhrlicherC 1 Reply Last reply
              0
              • L legitnameyo

                @Christian-Ehrlicher said in How to know which fonts work in QTextEdit?:

                To select a font out of the available font you can use QFontDatabase

                I have done that. See the initial post

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

                @legitnameyo said in How to know which fonts work in QTextEdit?:

                I have done that. See the initial post

                Sorry, link was correct, but link name was QFontDatabase instead QFontComboBox

                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
                1
                • L Offline
                  L Offline
                  legitnameyo
                  wrote on last edited by
                  #8

                  QFontComboBox worked! Still a bit perplexed over why there's a difference between QFontDatabse and QFontComboBox, but I'll take it! :)

                  jsulmJ 1 Reply Last reply
                  0
                  • L legitnameyo

                    QFontComboBox worked! Still a bit perplexed over why there's a difference between QFontDatabse and QFontComboBox, but I'll take it! :)

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by jsulm
                    #9

                    @legitnameyo said in How to know which fonts work in QTextEdit?:

                    Still a bit perplexed over why there's a difference between QFontDatabse and QFontComboBox

                    QFontComboBox is a widget to select a font by user.
                    QFontDatabse is not a widget but provides information about available fonts. It is a good design to separate logic/databases from GUI.

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    2

                    • Login

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