Bug 160594 - SVG import: wrong calculation of tspan's font-size using ex
Summary: SVG import: wrong calculation of tspan's font-size using ex
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:24.8.0 target:24.2.4
Keywords:
Depends on:
Blocks: SVG-Import
  Show dependency treegraph
 
Reported: 2024-04-09 08:12 UTC by Mike Kaganski
Modified: 2024-06-07 13:39 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
ex units (289 bytes, image/svg+xml)
2024-04-09 08:12 UTC, Mike Kaganski
Details
tdf#160594 SVG import wrong calculation of tspan's font-size using ex LO7.6.5 vs LO24.2.4.png (264.97 KB, image/png)
2024-06-07 13:39 UTC, Piotr Osada
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-04-09 08:12:58 UTC
Created attachment 193581 [details]
ex units

The attached SVG has this markup:

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

It sets the outer (text's) font-size to 16px, then in the inner tspan, it sets the font-size to 1ex, and dy to 3ex. According to spec, the font-size value of the tspan must be calculated as 1 x-height of the first available font with inherited font-size, with a fallback to 0.5em (i.e., roughly half of 16px).

When opening the SVG in a browser (e.g., Chrome), the second line "bar" is rendered with a smaller size than the first line. In Draw, the second line is incorrectly rendered using the same font size as the first line.
Comment 1 Xisco Faulí 2024-04-09 10:48:53 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:23 UTC
https://gerrit.libreoffice.org/c/core/+/166234
Comment 3 Commit Notification 2024-04-18 16:22:15 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/86a8a3a43b642fc13bae6a89720496285f8f73d7

tdf#160594: Use the recommended fallback of 0.5em for ex in font-size

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:42 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/97586e0b4712e44e360e6572af8483d81ac2346a

tdf#160594: Use the recommended fallback of 0.5em for ex in font-size

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:33:20 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!!
Comment 6 Piotr Osada 2024-06-07 13:39:29 UTC
Created attachment 194593 [details]
tdf#160594 SVG import wrong calculation of tspan's font-size using ex LO7.6.5 vs LO24.2.4.png

Version: 24.2.4.2 (X86_64) / LibreOffice Community
Build ID: 51a6219feb6075d9a4c46691dcfe0cd9c4fff3c2
CPU threads: 8; OS: Windows 10.0 Build 22631; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: en-US
Calc: threaded

Confirm: it's fixed now.