Bug 160593

Summary: SVG import: wrong calculation of tspan's dy using em
Product: LibreOffice Reporter: Mike Kaganski <mikekaganski>
Component: filters and storageAssignee: Mike Kaganski <mikekaganski>
Status: VERIFIED FIXED    
Severity: normal CC: xiscofauli
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=160594
https://bugs.documentfoundation.org/show_bug.cgi?id=160717
Whiteboard: target:24.8.0 target:24.2.4
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 88278    
Attachments: dy in em's

Description Mike Kaganski 2024-04-09 08:01:58 UTC
Created attachment 193580 [details]
dy in em's

The attached SVG has this markup:

  <text x="5" y="20" style="font-size:16px;font-family:Liberation Sans">foo
    <tspan x="5" dy="1.5em" style="font-size:0.5em">bar</tspan></text>

It sets the outer (text's) font-size to 16px, then in the inner tspan, it sets the font-size to 0.5em, and dy to 1.5em. According to spec, the font-size value of the tspan must be calculated as half of its inherited font-size (i.e., half of 16px); and in all other places inside tspan (e.g., in the dy), the em must refer to the current tspan's font-size (8px).

When opening the SVG in a browser (e.g., Chrome), the second line "bar" is rendered much closer to the first line, than in Draw.
Comment 1 Xisco FaulĂ­ 2024-04-09 10:50:06 UTC
Reproduced in

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: f3d0a184c4da57907a1fcf1ed784340be7d974d6
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded
Comment 2 Mike Kaganski 2024-04-18 09:26:03 UTC
https://gerrit.libreoffice.org/c/core/+/166233
Comment 3 Commit Notification 2024-04-18 16:22:12 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e27572686130df43d1d65c574b0c34f39fc0d1a9

tdf#160593: make sure to use current element's font size for em unit

It will be available in 24.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Commit Notification 2024-04-19 07:09:39 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/334446935b194ebdadb10004c01bff550f09838e

tdf#160593: make sure to use current element's font size for em unit

It will be available in 24.2.4.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Xisco FaulĂ­ 2024-04-19 08:32:47 UTC
Verified in

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8df17c340193c89549d8c563b04d015156afa3fb
CPU threads: 8; OS: Linux 6.1; UI render: default; VCL: gtk3
Locale: es-ES (es_ES.UTF-8); UI: en-US
Calc: threaded

@Mike, thanks for fixing the issue!!