Important: Please read the Qt Code of Conduct -

QML - letters randomly disappear when resizing label

  • Hi, I already created a Qt bug (#86633) on this, but maybe I'm doing something incorrectly, so that's why I'm also asking here. The issue is: when I resize a QML "Text" or "Label" element, some of the characters disappear completely.

    The behavior is pretty random

    • Different characters disappear each time I restart the application.
    • Changing the text/label content (let's say changing from "TEXT" to "BANANA" or other common word) causes it to break at a different font size
    • Changing the rendering type and QtQuick.Controls version also seems to play some role, but don't eliminate the problem.

    Please see this video for an example of the behavior:

    I also created a minimal reproducible example (reproduced on Qt 5.15.1 on Ubuntu 20.04):

    import QtQuick 2.11
    import QtQuick.Window 2.11
    import QtQuick.Controls 1.3
    Window {
        visible: true
        width: 800
        height: 480
        title: qsTr("Hello World")
        property int textSize: 107
        Text {
            id: text1
            text: "TEXT"
            renderType: Text.NativeRendering
            x: 50
            y: 50
            font.pixelSize: textSize
        Button {
            id: increase
            y: 300
            x: 400
            text: "INCREASE"
            onClicked: {
                textSize = textSize + 1
                console.log("Text size: " + textSize)
        Button {
            id: decrease
            y: 300
            text: "DECREASE"
            onClicked: {
                textSize = textSize - 1
                console.log("Text size: " + textSize)

    Steps to reproduce:

    1. Compile the QML above on the newest Qt on Ubuntu Linux.
    2. Run the application and increase the font size until one or more characters go missing.
    3. If the problem doesn't occur, change the text, the rendering type or the widgets version.

    Is this a bug or am I doing something wrong?

  • Bump.

    Is there anyone who experienced similar behavior?

    Thank you for your help.

  • I found out that I can reproduce this behavior by setting QT_DISTANCEFIELD_DEFAULT_BASEFONTSIZE, QT_DISTANCEFIELD_DEFAULT_SCALE and QT_DISTANCEFIELD_DEFAULT_RADIUS variables. With these, the problem occurs even on Windows.

    Not sure whether it's the same problem or not, but if QT_DISTANCEFIELD_DEFAULT_RADIUS is NOT DIVISIBLE by QT_DISTANCEFIELD_DEFAULT_SCALE, the problem occurs 100% of time (some letters will disappear).

    export QT_DISTANCEFIELD_DEFAULT_RADIUS=96 // If I set this to 95 or 97 or anything not divisible by 12, it will break.

    Can someone explain me what these distancefield environment variables do and whether this is an intended behavior?