Bug 472316

Summary: SVG line-height cannot go smaller than a certain value
Product: [Applications] krita Reporter: Alvin Wong <alvin>
Component: Tool/TextAssignee: wolthera <griffinvalley>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alvin Wong 2023-07-17 07:48:31 UTC
SUMMARY

Line-height appears to be capped at a minimum.


STEPS TO REPRODUCE
1. Use SVG for text:
```
<text style="fill:#000000; letter-spacing:0; font-family:Noto Sans; stroke-width:0; line-height:0; white-space: pre"><tspan x="0">Line 1
</tspan><tspan x="0">Line 2</tspan></text>
```

OBSERVED RESULT
The two lines of text does not overlap.

EXPECTED RESULT
The two lines of text should overlap and rendered on the same y position.
Comment 1 wolthera 2023-08-02 15:37:16 UTC
Git commit b90110d3e0420eed1e258f3178f2a89660cedefe by Wolthera van Hövell tot Westerflier.
Committed on 02/08/2023 at 17:36.
Pushed by woltherav into branch 'master'.

Fix line-height being capped due to naive handling of negative ascent.

Because ascent and descent can be negative or positive depending on the
writing mode, the intial code attempted to regard them somewhat agnostic
until it was time to calculate the precise offset. This however capped
the offset to 0, and made it impossible to have negative line-offsets.

The code now considers negative values appropriately.

M  +45   -26   libs/flake/text/KoSvgTextShape.cpp

https://invent.kde.org/graphics/krita/-/commit/b90110d3e0420eed1e258f3178f2a89660cedefe
Comment 2 wolthera 2023-08-02 16:20:58 UTC
Git commit de2549670876392fb9c46dc1842245482a0bb428 by Wolthera van Hövell, on behalf of Wolthera van Hövell tot Westerflier.
Committed on 02/08/2023 at 17:53.
Pushed by woltherav into branch 'krita/5.2'.

Fix line-height being capped due to naive handling of negative ascent.

Because ascent and descent can be negative or positive depending on the
writing mode, the intial code attempted to regard them somewhat agnostic
until it was time to calculate the precise offset. This however capped
the offset to 0, and made it impossible to have negative line-offsets.

The code now considers negative values appropriately.


(cherry picked from commit b90110d3e0420eed1e258f3178f2a89660cedefe)

M  +45   -26   libs/flake/text/KoSvgTextShape.cpp

https://invent.kde.org/graphics/krita/-/commit/de2549670876392fb9c46dc1842245482a0bb428