Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

No space between letters in text



  • Hi!

    I'm facing issue with fonts after migration from 5.14 to 6.2. After fixing all compile issues and starting APP there were not a single font showing.

    I tried to start a simple example application from qt creator that simply show ScrollView:

    import QtQuick
    import QtQuick.Controls
    ApplicationWindow {
     id: root
     width: 480
     height: 272
     visible: true
     font.family: "DejaVu Serif";
     ScrollView {
         width: 480
         height: 272
         clip: true
    
         Label {
             text: "A\nBC\tGD"
             font.pixelSize: 24
         }
     }
     Component.onCompleted: console.log("Application font: " + root.font.family + "\n" + "Fonts available: " + Qt.fontFamilies())
    }
    

    And here is output in console:

    QML debugging is enabled. Only use this in a safe environment.
    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
    qml: Application font: DejaVu Serif
    Fonts available: DejaVu Sans,DejaVu Sans Mono,DejaVu Serif,Monospace,Sans Serif,Serif
    

    This told me that all the fonts are correct. But text on screen renders as if font.letterSpacing set to zero. If I set font.letterSpacing manually to 20 text is displayed again.

    App is running on Yocto, Qt is build from meta-qt6. Qt was tested with and without fontconfig support.

    Any thoughts what I'm missing?



  • I have had another experiment with fonts. FontsMetrics gives me next results for text with letterSpacing set:

    qml: Font metrics: averageCharacterWidth: 12.84375| boundingRect("AAA"):QRectF(0, -22.0781, 51, 28.7969)
    

    And for letterSpacing not set:

    qml: Font metrics: averageCharacterWidth: 12.84375| boundingRect("AAA"):QRectF(100000, -22.0781, 0, 28.7969)
    

Log in to reply