Solved How to know which fonts work in QTextEdit?
-
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?
-
@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?
-
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.
-
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...
-
To select a font out of the available font you can use QFontComboBox
-
@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
-
@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
-
QFontComboBox worked! Still a bit perplexed over why there's a difference between QFontDatabse and QFontComboBox, but I'll take it! :)
-
@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.