Alberto Mardegan
2018-11-25 21:46:46 UTC
Hi all!
I'm working on a desktop style for the QtQuick Controls 2 API [1], and
as I'm trying to achieve a pixel-by-pixel equivalence with QtWidgets,
I'm writing unit tests which graphically compare the output generated by
my controls versus that generated by QtWidgets.
I'm getting some issues with the fonts, for example in the buttons'
label: they just don't match, despite the fact that the QFont set on the
QPainter is exactly the same. For some reason, the lower levels of the
graphical stack (FontConfig, I presume) select a different font in
QtQuick, compared to the one used in QtWidgets.
The issue seems to go away if I run the tests under xvfb and specify a
different configuration file for FontConfig [2]. While this does the
trick, I'm left wondering whether (and where) QtWidgets somehow
initializes FontConfig differently from QtQuick. I guess I could get rid
of some hacks and truly achieve a pixel perfect replacement if I found
the way to replicate QtWidgets' font configuration in my QtQuick module.
Any ideas?
Ciao,
Alberto
[1]: https://gitlab.com/mardy/qqc2-desktop
[2]:
https://gitlab.com/mardy/qqc2-desktop/commit/caba6e67ce745d0653a10ccf8d801ad799129668
I'm working on a desktop style for the QtQuick Controls 2 API [1], and
as I'm trying to achieve a pixel-by-pixel equivalence with QtWidgets,
I'm writing unit tests which graphically compare the output generated by
my controls versus that generated by QtWidgets.
I'm getting some issues with the fonts, for example in the buttons'
label: they just don't match, despite the fact that the QFont set on the
QPainter is exactly the same. For some reason, the lower levels of the
graphical stack (FontConfig, I presume) select a different font in
QtQuick, compared to the one used in QtWidgets.
The issue seems to go away if I run the tests under xvfb and specify a
different configuration file for FontConfig [2]. While this does the
trick, I'm left wondering whether (and where) QtWidgets somehow
initializes FontConfig differently from QtQuick. I guess I could get rid
of some hacks and truly achieve a pixel perfect replacement if I found
the way to replicate QtWidgets' font configuration in my QtQuick module.
Any ideas?
Ciao,
Alberto
[1]: https://gitlab.com/mardy/qqc2-desktop
[2]:
https://gitlab.com/mardy/qqc2-desktop/commit/caba6e67ce745d0653a10ccf8d801ad799129668
--
http://blog.mardy.it - Geek in un lingua international
http://blog.mardy.it - Geek in un lingua international