Bug 156206 - The attributes svg:rx and svg:ry of e.g. <draw:rect> element are not implemented
Summary: The attributes svg:rx and svg:ry of e.g. <draw:rect> element are not implemented
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
24.2.0.0 alpha0+
Hardware: x86-64 (AMD64) All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:odf
Depends on:
Blocks: ODF-import
  Show dependency treegraph
 
Reported: 2023-07-09 10:18 UTC by Regina Henschel
Modified: 2023-07-11 12:43 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
three examples (15.83 KB, application/vnd.oasis.opendocument.presentation)
2023-07-10 12:23 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2023-07-09 10:18:10 UTC
The attributes svg:rx and svg:ry specify a corner rounding of the element <draw:rectangle>. In ODF 1.4 they will be allowed on <draw:caption>, <draw:text-box> and <office:annotation> in addition. LibreOffice has currently only the draw:corner-radius attribute implemented. That specifies the radius for a circle as corner rounding. If a shape has svg:rx or svg:ry attributes and no draw:corner-radius attribute, the rectangle is currently not rounded at all in LibreOffice.

LibreOffice does not restrict the rounding to the minimum of half width and half height but allows larger values for draw:corner-radius. But those are not possible to be rendered as circle. Indeed LibreOffice renders the rounding as ellipse in such cases. But an ellipse would require the use of svg:rx and svg:ry.

So the request has several parts:
(1) When the corner rounding is rendered as ellipse, then on export to ODF the attributes svg:rx and svg:ry have to be written. That includes, that they are read on opening.
(2) Implement svg:rx and svg:ry for <draw:rectangle>. Those belong to ODF since ODF 1.2.
(3) Implement svg:rx and svg:ry for <draw:caption>, <draw:text-box> and <office:annotation>. That belongs to ODF 1.4.
Comment 1 Regina Henschel 2023-07-09 11:07:53 UTC
<draw:rectangle> -> <draw:rect>
Comment 2 Roman Kuznetsov 2023-07-09 13:04:15 UTC
Set to NEW
Comment 3 Regina Henschel 2023-07-09 13:07:18 UTC
It might be relevant for the SVG filter too. But this is about ODF.
Comment 4 Stéphane Guillou (stragu) 2023-07-09 20:34:34 UTC
Regina, do you have an example file?
Comment 5 Regina Henschel 2023-07-10 12:23:22 UTC
Created attachment 188296 [details]
three examples

green shape:
svg:rx="2cm" svg:ry is missing. In such case ry gets the same value as rx. That results in a circle. LibreOffice would be able to render this circle, but it ignores the attributes. PowerPoint renders it correctly.

yellow shape:
draw:corner-radius="2.5cm". LibreOffice renders it as ellipse. But that cannot be described by the attribute draw:corner-radius. Instead LibreOffice should have written svg:rx="2.5cm" and svg:ry="2cm" to describe the actual rendering.

The corner-radius is larger than the height. The ODF standard does not explicitly define how to render it, but it could not be an ellipse. PowerPoint renders circles which overlap.

violet shape:
svg:rx="2cm" svg:ry="1cm". The corner rounding should be an ellipse. LibreOffice does not interpret the attributes and does not generate a corner rounding. PowerPoint renders it correctly.

These problems already exist for ODF 1.2 and are inherit from OOo. With ODF 1.4 the attributes svg:rx and svg:ry are allowed on all objects which currently have a draw:corner-radius attribute. We need not implement it for those objects too, but at least for <draw:rect> the implementation should be improved.
Comment 6 Stéphane Guillou (stragu) 2023-07-11 10:31:36 UTC
Thanks Regina.
I guess this is also about OOXML filters then.
With the attachment, saving as PPTX results in tighter corners for the yellow shape.

And import of this example SVG results in rounded corners for the bottom-left rect: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx

<rect x="20" y="120" width="60" height="60" rx="0" ry="15"></rect>

Are these two issues part of the same problem you describe? (i.e. are the three keywords filter:odf, filter:svg and filter:ooxml relevant?)
Comment 7 Regina Henschel 2023-07-11 11:21:44 UTC
No this is neither about filter:svg nor about filter:ooxml. I have removed them.

The export to svg produces path elements and not rect elements. That is valid. Inkscape produces always path elements too. The attributes svg:rx and svg:ry do not exist for path elements.

The export of the yellow shape to ooxml is wrong, but that is a different topic. An ellipse-kind corner rounding cannot be expressed with a prstGeom but needs a custGeom. Such implementation is missing. But this issue is only about ODF. When I mentioned MS Office, I meant, that you open the .odp file in MS Office.
Comment 8 Stéphane Guillou (stragu) 2023-07-11 12:34:06 UTC
Thank you very much for clarifying and cleaning up the keywords/metas, Regina!
I opened bug 156236 for the SVG import issue.