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. DirectWrite: CreateFontFaceFromHDC() failed
Forum Updated to NodeBB v4.3 + New Features

DirectWrite: CreateFontFaceFromHDC() failed

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 7.8k 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.
  • D Offline
    D Offline
    dr3mro
    wrote on last edited by dr3mro
    #1

    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?
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      Have you tried on other Pc?

      G 1 Reply Last reply
      0
      • G Offline
        G Offline
        Galbarad
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • mrjjM mrjj

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

          Have you tried on other Pc?

          G Offline
          G Offline
          Galbarad
          wrote on last edited by
          #4

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

          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