Important: Please read the Qt Code of Conduct -

Font rendering issue in threaded mode

  • Hi,

    I have a mobile app, running on IOS, and using QML.
    I’ve just updated it to use the « threaded » mode of the QSG_RENDER_LOOP.

    However, I’m now running into an issue :
    After some time, the app seems to be losing its font, i.e. it’s displaying weird characters instead of the selected font.
    I’m not sure of what happens, nor of WHEN it actually happens. It seems to occur more often when I’m putting the app in background (by pressing home on my iPad for example and then going to my gallery, etc). This can affect any labels/texts in the app (they are all using the same font), and it has never impacted all of them at the same time so far. It appears quite randomly.
    Once, I've seen other resources disappear (qml buttons), but I'm not sure if it's related since it has only happened once.

    Here is the result :
    You can easily see that the text doesn’t appear as It should.

    When I switch back the app's "QSG_RENDER_LOOP" to basic, the issue disappears.

    Am I somehow corrupting the OpenGL State ? Am I missing a « refresh all resources »  function when going back to the app ?

    Here is my program skeleton :

    • My resources (Qml files, images, and fonts) are all in.qrc files.
    • My main.cpp loads a Main.qml file, which then instantiates a QQuickFrameBufferObject from C++.
    • This QQFBO creates a QQuickFrameBufferObject::Renderer, as shown in the doc.
    • All my rendering is done in the QQuickFrameBufferObject::Renderer::render() function
    • The rendering is ended with a QQuickWindow::resetOpenGLState(); in order to avoid issues with the rest of the QML rendering.
    • All my texts are embeded in a qsTr() in order to handle translations.

    Thanks in advance

  • Additional notes after more tests :

    This issue actually occurs even when I haven't set the application in background. I've even had it at startup.
    However, the QSG_RENDER_LOOP seems to be a good trigger.

    I'm starting to be convinced that I'm somehow corrupting my other qml elements from that qquickframebufferobject. However, I don't know how I could make sure of that, and more importantly, which specific data am I corrupting ?

    I thought I might be writing over QML's text texture, but if that was the case, I guess I would see parts of my OpenGL scene wouldn't I ? I don't know how QML renders its text though.

    Any help is welcome, thanks !

Log in to reply