DirectWrite: CreateFontFaceFromHDC() failed



  • 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?

  • Qt Champions 2017

    Hi
    Never saw such message before.
    Can you make a small test that give this error/warning?

    Have you tried on other Pc?



  • Hi @mrjj
    I take same error code when try to use custom font
    there simple code
    Desktop_Qt_5_10_1_MSVC2017_64bit Windows 10

    import QtQuick 2.9
    import QtQuick.Window 2.2
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
    
    
        Text {
            id: tMain
            font.family: flMain.name
            anchors.centerIn: parent
            text: "Hello world"
            font.pixelSize: 0.05 * parent.height
        }
    
        FontLoader {
            id: flMain
            //source: "qrc:///Chibola.ttf"
            onStatusChanged: {
                console.log("flMain.onStatusChanged", flMain.status, flMain.name);
            }
        }
    
        Component.onCompleted: {
            flMain.source = "qrc:///Chibola.ttf";
        }
    }
    
    
    QML debugging is enabled. Only use this in a safe environment.
    DirectWrite: CreateFontFaceFromHDC() failed (Indicates an error in an input file such as a font file.) for QFontDef(Family="", pointsize=8.5, pixelsize=11, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("MS Sans Serif", lfWidth=0, lfHeight=-11) dpi=96
    DirectWrite: CreateFontFaceFromHDC() failed (Indicates an error in an input file such as a font file.) for QFontDef(Family="", pointsize=8.5, pixelsize=11, styleHint=5, weight=50, stretch=100, hintingPreference=0) LOGFONT("MS Sans Serif", lfWidth=0, lfHeight=-11) dpi=96
    qml: flMain.onStatusChanged 1 Chibola 
    

    there project with font file
    https://www.dropbox.com/s/7l2ol7dw1uywoji/TestFont.zip?dl=0



  • @mrjj uh sorry I already found bug
    https://bugreports.qt.io/browse/QTBUG-57180


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.