Bug 440826 - [Windows only] Krita 5 renders text differently from Krita 4.4.7
Summary: [Windows only] Krita 5 renders text differently from Krita 4.4.7
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (show other bugs)
Version: git master (please specify the git hash!)
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Dmitry Kazakov
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2021-08-10 10:05 UTC by Dmitry Kazakov
Modified: 2021-12-02 14:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Screenshot of the problem (59.07 KB, image/png)
2021-08-10 10:08 UTC, Dmitry Kazakov
Details
Qt patches between v4.4.7 and v5.0.0-beta2 (29.52 KB, patch)
2021-10-14 14:18 UTC, amyspark
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitry Kazakov 2021-08-10 10:05:45 UTC
SUMMARY

When trying to open a document created in 4.4.7 the text has a different letter intervals, which makes the text longer.

STEPS TO REPRODUCE
1. Open Krita 4.4.7
2. Create some text on a vector layer
3. Create a copy of vector layer and rasterize it via 'Convert->to Paint Layer'
4. Save the document
5. Open in Krita 5
6. See that the vector text is not the same as in the rasterized layer

Mind you, both Krita 4.4.7 and Krita 5 should run on exactly the same PC with the same display. The display resolution is used for the text size in 4.4.7.

This bug is reproducible **on Windows only**. On Linux it works perfectly fine.
Comment 1 Dmitry Kazakov 2021-08-10 10:08:08 UTC
Created attachment 140627 [details]
Screenshot of the problem

Green is a rasterized version rendered in Krita 4.4.7. Red is how it is rendered in Krita 5.0
Comment 2 Ahab Greybeard 2021-08-10 14:31:29 UTC
I can confirm this for the Aug 10 5.0.0-prealpha (git 25469210a1) portable .zip on Windows 10.
I notice that a warning statement is shown when opening the .kra file.
Comment 3 amyspark 2021-10-14 14:18:56 UTC
Created attachment 142432 [details]
Qt patches between v4.4.7 and v5.0.0-beta2

git diff v4.4.7 v5.0.0-beta2 -- 3rdparty\ext_qt\CMakeLists.txt

shows that there are a few patches on windows related to fractional DPI?
Comment 4 Dmitry Kazakov 2021-11-26 08:28:22 UTC
Hm... hidpi patches is a good hypothesis... I will check it by trying to compile Krita 4.4.8 with the current state of dependencies
Comment 5 Dmitry Kazakov 2021-11-26 11:08:20 UTC
Hi, Amyspark!

Your hypothesis seems to be somewhat correct. I have done several tests and got the following results:

1) Two options "Enable HiDPI Scaling" and "Enable Fractional Scaling" influence on how Krita 4.4.7 renders text on the canvas. Basically, all three combinations generate different result in 4.4.7 :(
2) When both options are enabled (both, in Krita 4.4.7 and in Krita 5.0), Krita 5.0 can open the saved file perfectly.
3) If at least one option is disabled, then Krita 5.0 renders the text 1.5%-2% smaller than the original, even when the options have the same value in Krita 5.0
Comment 6 Dmitry Kazakov 2021-11-26 11:54:28 UTC
Okay, I have finally built 4.4.7 with the current set of dependencies, and I cannot reproduce the issue there. So the problem is not really in different patchset over Qt, but in the way how we treat hidpi settings when converting legacy text into the new format.
Comment 7 Dmitry Kazakov 2021-12-02 12:24:19 UTC
Git commit b2052de3f9e4b764dd098c5d1555bceab1e97b68 by Dmitry Kazakov.
Committed on 02/12/2021 at 12:24.
Pushed by dkazakov into branch 'master'.

Fix text size regression in Krita 5.0

QFont's constructor accepts pointSize as 'integer', so it truncates
the value we pass. Therefore we need to set it separately.

M  +7    -1    libs/flake/text/KoSvgTextProperties.cpp

https://invent.kde.org/graphics/krita/commit/b2052de3f9e4b764dd098c5d1555bceab1e97b68
Comment 8 Dmitry Kazakov 2021-12-02 14:20:34 UTC
Git commit 6b01116bede9460e150137ce4449c6859e0484e6 by Dmitry Kazakov.
Committed on 02/12/2021 at 14:17.
Pushed by dkazakov into branch 'krita/5.0'.

Fix text size regression in Krita 5.0

QFont's constructor accepts pointSize as 'integer', so it truncates
the value we pass. Therefore we need to set it separately.

M  +7    -1    libs/flake/text/KoSvgTextProperties.cpp

https://invent.kde.org/graphics/krita/commit/6b01116bede9460e150137ce4449c6859e0484e6