3
votes

I had a project on Qt 5.5.1 and all was fine but today i had upgraded Qt to 5.7 and then i had the following error on runtime it doesn't crash the app but it is making me crazy as it was not there before

DirectWrite: CreateFontFaceFromHDC() failed (Indicates an error in an input file such as a font file.) for QFontDef(Family="Small Fonts", pointsize=15, pixelsize=20, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("Small Fonts", lfWidth=0, lfHeight=-20) dpi=96 DirectWrite: CreateFontFaceFromHDC() failed (Indicates an error in an input file such as a font file.) for QFontDef(Family="System", pointsize=15, pixelsize=20, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("System", lfWidth=0, lfHeight=-20) dpi=96 How can I fix it

2
I would recommend reading up on the changes of 5.7 to see if anything that might in some way affect your code, has changed. Kind of a needless comment, but I'm just giving my thoughts.TimLayne
I think the problem could be that bitmap font got selected, and directwrite does not support them. Such failure is expected, but it's still a question for Qt people why such message is visible.bunglehead

2 Answers

1
votes

Had same issue. Had a singleton class with a QTextDocument which was created static and thereby being created before the QApplication which is required by the QFont class.

The problem could be resolved by setting the DefaultFont on the QTextDocument before you are doing anything with it.

0
votes

Just FYI. I had the same warning message when I used PyQt and QtAwesome for my app in Windows. But after I restart my laptop, this message was gone.