Bug 473164 - Lines missing from bounding box after inline-size wrapping
Summary: Lines missing from bounding box after inline-size wrapping
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Tool/Text (show other bugs)
Version: git master (please specify the git hash!)
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-08 17:40 UTC by Alvin Wong
Modified: 2023-08-09 12:22 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alvin Wong 2023-08-08 17:40:25 UTC
With https://bugs.kde.org/attachment.cgi?id=160749 (attachment from bug 473026), edit the bottom-right text shape and reduce the inline-size (to about 33pt), the bottommost 2 lines will disappear and the text shape bounding box will include only the first 2 lines (wrapped into 4 lines).

This can be reproduced with nightly 5dce46d2f6, so this is not a regression from the fix to bug 473026.
Comment 1 wolthera 2023-08-09 12:09:06 UTC
Git commit 59137b2c8b99ce94fbc66dd86389fccbf8f14138 by Wolthera van Hövell tot Westerflier.
Committed on 09/08/2023 at 14:05.
Pushed by woltherav into branch 'master'.

Stablize the outline code a little.

The outline code sometimes gives bad results, so by making the operation
less complex, we'll get better results and less trouble with the shape
not drawing.

M  +2    -2    libs/flake/text/KoSvgTextChunkShape.cpp

https://invent.kde.org/graphics/krita/-/commit/59137b2c8b99ce94fbc66dd86389fccbf8f14138
Comment 2 wolthera 2023-08-09 12:16:05 UTC
So basically, when I was testing this, it seemed that the shape-select/default tool knew what the proper outline is, and converting to path seemed to work. So the outline was occasionally wrong.

I still get 'flickers' where Krita will also complain about "KoRTree::insert boundingBox isNull setting size to QSizeF(0, 0)", which I initially thought was related, but no matter how late I put 'clearAssociatedOutlines' in the textLayout code, the flickers would happen, so my current theory is that they're caused by the combo of (parsing svg and populating the kotextshape) + (text layout), which means that direct editing of the inline-size property and having that emit shapeChanged() signal might be a good next step, but I guess I'll get to that during phase 1.
Comment 3 wolthera 2023-08-09 12:16:46 UTC
Git commit 50038dbd400c57ae8a2df068cd13fb3403a95530 by Wolthera van Hövell, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 09/08/2023 at 14:16.
Pushed by woltherav into branch 'krita/5.2'.

Stablize the outline code a little.

The outline code sometimes gives bad results, so by making the operation
less complex, we'll get better results and less trouble with the shape
not drawing.


(cherry picked from commit 59137b2c8b99ce94fbc66dd86389fccbf8f14138)

M  +2    -2    libs/flake/text/KoSvgTextChunkShape.cpp

https://invent.kde.org/graphics/krita/-/commit/50038dbd400c57ae8a2df068cd13fb3403a95530
Comment 4 Alvin Wong 2023-08-09 12:22:56 UTC
(In reply to wolthera from comment #2)
> I still get 'flickers' where Krita will also complain about "KoRTree::insert
> boundingBox isNull setting size to QSizeF(0, 0)", which I initially thought
> was related, but no matter how late I put 'clearAssociatedOutlines' in the
> textLayout code, the flickers would happen, so my current theory is that
> they're caused by the combo of (parsing svg and populating the kotextshape)
> + (text layout), which means that direct editing of the inline-size property
> and having that emit shapeChanged() signal might be a good next step, but I
> guess I'll get to that during phase 1.

I know what causes this, it's that SvgParser::addToGroup (called from SvgParser::parseTextElement) uses KoShapeGroupCommand which triggers the update/repaint of the shape, combined with how the shape update compressor works, and this results in the shape sometimes being painted when the shape is still empty. I asked Dmitry about this some time ago but it didn't went far.