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

Broken font kerning when using scaled QGraphicsVIew



  • This is what drawing text via painter.drawText in a QGraphicsView that is scaled looks like. You can see that the 'w' character seems to have very broken font kerning, and there are other issues here as well, like 'as' is bunched together.

    f5da8b7e-4d0b-4023-a658-c4fd2a5718da-image.png

    It also breaks when scaled out, notice how "Output" is also rendering funny:
    1758bc09-47c9-420b-a8e0-18fa62dfaaa4-image.png

    For reference, it looks fine unscaled:
    091b704e-7867-40bb-a5d2-364a5f88eda5-image.png

    QGraphicsProxyWidget items suffer form the same problem, if this was a line edit widget it would also be weird. This kind of makes scaling a QGraphicsView fundamentally broken if your scene contains text, unless there is some magic flag somewhere I am missing that could help fix this (maybe just select the next font size and render that instead?)

    edit: I should mention we're using Qt 5.15.1 although it has been like this for as long as I have been using QGraphicsView


Log in to reply