https://bugs.documentfoundation.org/show_bug.cgi?id=84507

--- Comment #20 from Mike Kaganski <[email protected]> ---
Created attachment 193957
  --> https://bugs.documentfoundation.org/attachment.cgi?id=193957&action=edit
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

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to