Created attachment 161055 [details] Test file Here is a test file created in Inkscape 1.2.2 (with `white-space` manually changed to `pre-wrap`) containing two text nodes, placed so that the text should be approximately at the same y position. The left one is flowed in shape, while the right one uses inline-size. Both uses `line-height:1.25`. When opened in Krita, the text in shape is laid out differently with a y-offset on the first line and slightly larger line leading.
Created attachment 161056 [details] Render from Inkscape
Created attachment 161057 [details] Render from Krita
Probably caused by this line in specific: https://invent.kde.org/graphics/krita/-/blob/master/libs/flake/text/KoSvgTextShapeLayoutFunc_inShape.cpp#L104 I haven't had the energy to figure out the ideal value for that.
Changing that to 1e-6 only makes a very minor difference (the whole text block is shifted up by 1px).
It looks like maybe Inkscape is laying out the first line using the calculated line-height, but Krita is using the actual bounding boxes (or maybe ascent/descent). No clue what's going on with the leading. It looks like the actual line height stops scaling correctly once it's below a certain value.
Actually, it seems Inkscape places the first line way too high it looks like they are not using the proper ascent/descent. This is more obvious with line-height 0. I have recreated this in HTML using floating elements for reference. I also have a rough fix for Krita, so I'll open a draft MR with it.
Created attachment 161066 [details] HTML reproduction
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1908
Git commit 091bc5682063f76bb3e9d8f67d9467337a47aa3f by Alvin Wong. Committed on 30/08/2023 at 20:24. Pushed by alvinwong into branch 'master'. text: Use line-height when flowing text in shape Don't use the actual char bounding box, instead use (ascent - halfLeading, descent + halfLeading) which takes line-height into account. M +3 -3 libs/flake/text/KoSvgTextShapeLayoutFunc_inShape.cpp M +1 -0 libs/flake/text/KoSvgTextShape_p.h M +5 -0 libs/flake/text/KoSvgTextShape_p_glyphs.cpp https://invent.kde.org/graphics/krita/-/commit/091bc5682063f76bb3e9d8f67d9467337a47aa3f
Git commit 6be3971efc90e3f8245a96753b7daec0e417e9ae by Alvin Wong. Committed on 30/08/2023 at 20:43. Pushed by alvinwong into branch 'krita/5.2'. text: Use line-height when flowing text in shape Don't use the actual char bounding box, instead use (ascent - halfLeading, descent + halfLeading) which takes line-height into account. (cherry picked from commit 091bc5682063f76bb3e9d8f67d9467337a47aa3f) M +3 -3 libs/flake/text/KoSvgTextShapeLayoutFunc_inShape.cpp M +1 -0 libs/flake/text/KoSvgTextShape_p.h M +5 -0 libs/flake/text/KoSvgTextShape_p_glyphs.cpp https://invent.kde.org/graphics/krita/-/commit/6be3971efc90e3f8245a96753b7daec0e417e9ae