Bug 84507 - FORMATING: Text does not fit to contour in rotated polygon or bézier curve
Summary: FORMATING: Text does not fit to contour in rotated polygon or bézier curve
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:24.8.0
Keywords:
: 44225 (view as bug list)
Depends on:
Blocks: Shapes
  Show dependency treegraph
 
Reported: 2014-09-30 12:21 UTC by Janusz
Modified: 2024-05-14 09:57 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshot presenting the bug (164.08 KB, image/png)
2014-09-30 12:21 UTC, Janusz
Details
Screenshot presenting the bug (164.08 KB, image/png)
2014-09-30 12:26 UTC, Janusz
Details
Document with presentation of the bug (34.53 KB, application/vnd.oasis.opendocument.presentation)
2014-09-30 12:31 UTC, Janusz
Details
Document with presentation of the bug (34.62 KB, application/vnd.oasis.opendocument.presentation)
2014-09-30 12:35 UTC, Janusz
Details
Screenshot from LOv4162 showing alternate rendering (52.85 KB, image/png)
2014-09-30 13:07 UTC, Owen Genat (retired)
Details
text in original and in rotated polygon (9.01 KB, image/png)
2018-11-02 12:57 UTC, Regina Henschel
Details
The process of rotation (1.35 MB, image/gif)
2024-05-03 17:32 UTC, Mike Kaganski
Details
A sample for comparison (49.61 KB, application/vnd.oasis.opendocument.graphics)
2024-05-04 05:49 UTC, Mike Kaganski
Details
A screencast of rotation the polyline with a mentioned experimental zero-rotation change (6.81 MB, image/gif)
2024-05-04 05:57 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Janusz 2014-09-30 12:21:26 UTC
Created attachment 107120 [details]
Screenshot presenting the bug

Option "Fit text to contour" in Impress causes text to appear somewhere else. In old presentations text disappears completely - this is why I've  assigned "critical" attribute. In freshly edited text boxes text appears outside the shape!
This bug is not only annoying but compromising as well.
Comment 1 Janusz 2014-09-30 12:26:07 UTC
Created attachment 107121 [details]
Screenshot presenting the bug
Comment 2 Janusz 2014-09-30 12:31:27 UTC
Created attachment 107122 [details]
Document with presentation of the bug

Win7/LO 4.3.1(4.3.2 Portable), PL_pl
Comment 3 Janusz 2014-09-30 12:35:55 UTC
Created attachment 107123 [details]
Document with presentation of the bug
Comment 4 Owen Genat (retired) 2014-09-30 13:07:47 UTC
Created attachment 107126 [details]
Screenshot from LOv4162 showing alternate rendering

Opened attached ODP under GNU/Linux using:

v3.3.4.1 OOO330m19 Build: 401
v3.4.6.2 OOO340m1 Build: 602
v3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b
v3.6.7.2 Build ID: e183d5b
v4.0.6.2 Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24
v4.1.6.2 Build ID: 40ff705089295be5be0aae9b15123f687c05b0a
v4.2.6.3 Build ID: 3fd416d4c6db7d3204c17ce57a1d70f6e531ee21
v4.3.2.2 Build ID: edfb5295ba211bd31ad47d0bad0118690f76407d
v4.4.0.0.alpha0+ Build ID: df73f4115cfe4d07e4159adf087571687eb173ec TinderBox: Linux-rpm_deb-x86_64@46-TDF, Branch:master, Time: 2014-09-25_23:06:16

In all cases, with the exception of v4.1 (refer attached) the rendering is problematic. Under v4.1 the rendering is as expected.
Comment 5 Owen Genat (retired) 2014-09-30 13:12:52 UTC
This issue is possibly related to one of the numerous Draw rotation bugs. As per comment 1, confirmed. Status set to NEW. Summary amended for clarity. Version set to 4.2.6.3. Platform to All/All. Severity to normal per the QA flowchart:

https://wiki.documentfoundation.org/File:Prioritizing_Bugs_Flowchart.jpg
Comment 6 Owen Genat (retired) 2014-10-01 11:58:14 UTC
Comment on attachment 107126 [details]
Screenshot from LOv4162 showing alternate rendering

(In reply to comment #4)
> Under v4.1 the rendering is as expected.

This statement may not be accurate, as the text is not rotated as in the original. I initially overlooked this and am not clear as to how rotated text should be rendered when wrapped inside a custom shape of the indicated nature. Attachment description amended to be clearer.
Comment 7 Janusz 2014-10-01 15:31:07 UTC
Hi Owen,
I was trying to insert text in HORIZONTAL orientation, but this bug
causes it to rotate to VERTICAL and places outside the contour.

Greets,
J.
Comment 8 tommy27 2016-04-16 07:28:13 UTC Comment hidden (obsolete)
Comment 9 Kris 2017-04-10 21:27:32 UTC
Bug still present, both in Impress and Draw.

Version: 5.2.6.2  (x64)
Build ID: a3100ed2409ebf1c212f5048fbe377c281438fdc
OS Version: Windows 10; 
UI Render: GL;
Comment 10 Regina Henschel 2017-11-01 21:56:13 UTC
Changed subject, because "Adjust to contour" is not available for custom shapes, but only for polygons, bézier curves and legacy rectangle and circles.

For legacy rectangles and circles the text position is correct, but not for polygons and bézier curves. I see the error in Version: 6.0.0.0.alpha1+
Build ID: d30522e46ca884e9bc74af21711d9537e8118859
CPU threads: 4; OS: Windows 6.1; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-10-29_23:13:14
Locale: de-DE (de_DE); Calc: group
Comment 11 QA Administrators 2018-11-02 03:51:01 UTC Comment hidden (obsolete)
Comment 12 Regina Henschel 2018-11-02 12:57:32 UTC
Created attachment 146254 [details]
text in original and in rotated polygon

The error still exists in Version: 6.2.0.0.alpha1+ (x64)
Build ID: e33424dd887cb1a11a3dba2513ef0f4bf93a6dbe
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-11-01_00:43:29
Locale: de-DE (en_US); Calc: CL
Comment 13 Regina Henschel 2019-10-09 16:26:01 UTC
"Adjust to contour" is still wrong for rotated polygons in Version: 6.4.0.0.alpha0+ (x64)
Build ID: b2d8093b19642038631dfb8f1ab6745a380a652c
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2019-09-23_22:42:37
Locale: de-DE (en_US); UI-Language: en-US
Calc: threaded
Comment 14 QA Administrators 2021-10-09 03:43:57 UTC Comment hidden (obsolete)
Comment 15 Regina Henschel 2021-10-09 10:50:56 UTC
"Adjust to contour" is still broken for polygons.
Tested in Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 93115d2c54d645bcf2f80fde325e3ede39dee4d5
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL
Comment 16 Janusz 2021-10-09 20:11:29 UTC
Bug still present and very vivid.
Version: 7.2.1.2 (x64) / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win
Locale: pl-PL (pl_PL); UI: pl-PL
Calc: CL
Comment 17 QA Administrators 2023-10-10 03:14:42 UTC Comment hidden (obsolete)
Comment 18 Regina Henschel 2023-10-10 07:21:44 UTC
Currently the fit-to-contour feature is totally broken, see bug 152906.
Comment 19 Mike Kaganski 2024-05-03 17:32:38 UTC
Created attachment 193955 [details]
The process of rotation
Comment 20 Mike Kaganski 2024-05-04 05:49:34 UTC
Created attachment 193957 [details]
A sample for comparison

The attachment is proposed for comparative debugging of the problem. I failed to comprehend how to fix this, so here are some notes, in the hope that they may help more knowledgeable people (Regina? Armin?) to not waste time for preparational routine.

The file has a *legacy* rectangle, and a identically sized polygon, both created horizontally (long side X, short side Y). Both have text adjusted to contour, and both rotated 90 degrees. This allows to see the difference, but also to see where the similarity and difference of of processing is.

Both are processed by SdrTextObj::impDecomposeContourTextPrimitive, where the passed SdrContourTextPrimitive2D provides the transformation and the unit polypolygon. In case of the rectangle, the transformation is:

Scale     18000 x 11000
Translate 10000 x 18000
Rotate    -pi/2
Shear     0

while for the polyline:

Scale     11000 x 18000
Translate     0 x 11700
Rotate    -pi/2
Shear     0

The unit polypolygon passed for the rectangle case has five points (unimportant, one extra point is in the middle of a long side), covering the range of [0.0, 0.0 ,1.0, 1.0] (a square). In the polyline case, the unit polypolygon has four points, and unexpectedly covers the range of [-1.6363636363636362, 0.0, 0.0, 0.61111111111111105]. This is actually not a *unit* polypolygon, because its size is not 1.

Applying the transformation, the rectangle case gives the polypolygon covering [0.0, 0.0, 18000.0, 11000.0], while the polyline case covers [-18000.0, 0.0, 0.0. 10999]. The latter has correct dimensions, but is placed differently. Possibly this is the problem.

The creation of the unit polypolygon for rectangle happens in SdrRectanglePrimitive2D::create2DDecomposition. For polyline, this happens in ViewContactOfSdrPathObj::createViewIndependentPrimitive2DSequence; and there, I had an interesting result, when simply replaced rotation used to create aObjectMatrix [1] with 0. Then, the text was always in the correct place, correctly fitting the contour - but it was always vertical. I couldn't figure, what is needed to create the correct transformation.

Hope this helps.

[1] https://opengrok.libreoffice.org/xref/core/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx?r=ebae130b#119
Comment 21 Mike Kaganski 2024-05-04 05:57:41 UTC
Created attachment 193958 [details]
A screencast of rotation the polyline with a mentioned experimental zero-rotation change
Comment 22 Regina Henschel 2024-05-07 22:00:42 UTC
*** Bug 44225 has been marked as a duplicate of this bug. ***
Comment 23 Regina Henschel 2024-05-07 22:09:21 UTC
I have uploaded my experiments to
https://gerrit.libreoffice.org/c/core/+/167299
With the code it is easier to discuss the problems.

With the patch, the text is at the correct position in the rotated path objects. But sometimes more text is shown as in the unrotated path object and sometimes text is missing. I have no idea what happens in those cases.

I do not even know at all, whether the patch is the correct way to go. Hopefully Armin has some time to look at the problem.
Comment 24 Commit Notification 2024-05-13 22:25:58 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/47664e282da4999b8e471a6a916d7ec80414ac18

tdf#84507 move contour text to correct place in rotated...

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 25 Stéphane Guillou (stragu) 2024-05-14 03:23:27 UTC
Thanks Regina. Could that commit tie into bug 82627 at all, or are the issues completely unrelated?
Comment 26 Regina Henschel 2024-05-14 09:57:27 UTC
(In reply to Stéphane Guillou (stragu) from comment #25)
> Thanks Regina. Could that commit tie into bug 82627 at all, or are the
> issues completely unrelated?

Bug 82627 is completely unrelated. Bug 82627 is about custom shapes in Writer, where the import from docx adds a bundled text frame and that is unable to rotate.