diagnostic
diagnostic

Reputation: 1

QT the pixel difference that occurs when drawing a font table on the screen and on an image with drawText

I am drawing a font table in Qt. I noticed that when I draw the table directly on the screen and when I draw it first on an qimage and then draw this image on the screen, the letters are shifted a few pixels.

When I draw directly on the screen, drawText draws at the coordinate I want, but when I draw on the image, drawText draws 2 pixels right and 2 pixels down from the coordinate I want. My coordinates are float. I use the same coordinates in both drawings.

I create an Arial 16 font and set HintingPreference::PreferNoHinting. Both painters use this font. Also, when I use font metrics values, I use QFontMetricsF. Thank you for your help. Version Qt 5.13.2.

pixel shift in the photo below

result image

Upvotes: 0

Views: 46

Answers (0)

Related Questions