Bug 470782 - Changing font size in text tool does not update the canvas
Summary: Changing font size in text tool does not update the canvas
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: wolthera
URL:
Keywords:
: 465870 467848 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-06-08 11:45 UTC by Alvin Wong
Modified: 2023-07-22 10:26 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2023-06-08 11:45:59 UTC
SUMMARY

Changing font size in text tool does not update the text size on canvas.

STEPS TO REPRODUCE
1. Create a new file: 1280x1280 px, 300 ppi
2. Create a text element
3. Set font to "Noto Sans", font size should be "9" by default
4. Input the following text:
    The quick
    brown fox
    jumps over
    the lazy dog.
5. Click "Save".
6. Change font size to "12"
7. Click "Save".

OBSERVED RESULT

After changing the font size and pressing "Save" the second time, the line height updates with the new font size, but the text itself is still rendered in the previous font size.

EXPECTED RESULT

Font size of the text should update.

SOFTWARE/OS VERSIONS
Windows: Win10 21H2 (19044.2846)
Krita: krita-nightly-x64-5.2.0-prealpha-55965ad53a
Comment 1 wolthera 2023-06-08 11:54:20 UTC
I can reproduce. I think it might be caused by font-size adjust....
Comment 2 Bug Janitor Service 2023-06-22 16:55:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1832
Comment 3 Alvin Wong 2023-06-24 11:20:17 UTC
Git commit b3e539c3ede5aa6f8af578ac2e2acd0994181874 by Alvin Wong.
Committed on 24/06/2023 at 11:19.
Pushed by alvinwong into branch 'master'.

Fix font-size-adjust calculation from QTextDocument

The previous calculation was wrong, causing text to be stuck in a
specific size regardless of the actual font size setting in the rich
text editor.

When trying to fix it, I found that QFontMetricsF gives bogus values for
xHeight (at least on Windows) so it cannot be used. I ended up
calculating the value by reading the parameters with FreeType. If the
font does not have xHeight, then we just don't write the property.

The value of this property is calculated so that the font size of the
primary font is the same as when this property is not set.

M  +18   -3    libs/flake/text/KoSvgTextShapeMarkupConverter.cpp

https://invent.kde.org/graphics/krita/-/commit/b3e539c3ede5aa6f8af578ac2e2acd0994181874
Comment 4 Halla Rempt 2023-06-28 10:48:42 UTC
*** Bug 465870 has been marked as a duplicate of this bug. ***
Comment 5 Alvin Wong 2023-07-22 10:26:11 UTC
*** Bug 467848 has been marked as a duplicate of this bug. ***