Bug 148758 - Do not start enhanced-path with commands which require a current point
Summary: Do not start enhanced-path with commands which require a current point
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyMedium, easyHack, skillCpp
Depends on:
Blocks:
 
Reported: 2022-04-24 18:48 UTC by Regina Henschel
Modified: 2023-01-09 10:46 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
File with the mentioned shapes (32.50 KB, application/msword)
2022-04-24 18:48 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2022-04-24 18:48:24 UTC
Created attachment 179753 [details]
File with the mentioned shapes

The commands A (arcto) and W (clockwise-arcto) require a current point because they start with drawing a line from current point to start of arc. In case they are uses at start or after a N (endpath) command, there exist no current point and therefore the enhanced-path is faulty. Rendering of faulty enhanced-paths is undefined.

Unfortunately there are preset shapes, for which LibreOffice produces such faulty enhanced-path. LibreOffice itself is error tolerant and does an implied moveto on rendering. But for interoperability we should not write faulty paths.

Effected shapes are these shapes from binary MS Office import: EllipseRibbon, EllipseRibbon2, WedgeEllipseCallout, TextArchDownCurve, TextArchDownPour, TextArchUpCurve, TextArchUpPour, TextButtonCurve, TextButtonPour, TextCircleCurve, TextCirclePour.

The faulty path can be simply avoided for new documents converted from binary MS Office by using B (arc) instead of A and V (clockwise-arc) instead of W. This can be changed in
 https://opengrok.libreoffice.org/xref/core/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx
That is an easy-hack.

More effort would be to change our preset shapes provided in the UI and to change import filter, so that existing documents are repaired, or to change export filter to write correct enhanced-paths. However, I would not do that until there is a specific complaint from a user.
Comment 1 Buovjaga 2023-01-09 10:46:37 UTC
Let's make it an easy hack, then. Maybe some more description of what we should observe in the example document would be nice and some more specific code pointers.