Bug 161880 - Text labels in small objects are not centered
Summary: Text labels in small objects are not centered
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Anchor-and-Text-Wrap
  Show dependency treegraph
 
Reported: 2024-07-03 11:53 UTC by Edward Chan
Modified: 2024-12-01 17:42 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Edward Chan 2024-07-03 11:53:17 UTC
Description:
Text in small circles or rectangles is not centered - the text is offset to the right. It is though there is an error with calculating the center, such that it hits a limit and then keeps being offset more and more the smaller the object is.

Steps to Reproduce:
1. Draw a small circle, 0.8cm in diameter.
2. Double-click on the circle and add one character
3. Observe the character is not centered in the circle. Enlarge the circle to 2 cm. The text is centered.

Actual Results:
Text is offset to the right.

Expected Results:
Text should be in the center.


Reproducible: Always


User Profile Reset: No

Additional Info:
If the circle is bigger than 0.9cm, the text is centered.
If the circle is less than 0.5cm, the text is centered.
If the circle is between 0.5 and 0.9cm, the text is offset to the right(!!)
There seems to be a problem with centering text between 0.5 to 0.9 cm.
I am not sure when this problem began in LibreOffice, but I didn't observe this in previous versions.
Comment 1 Edward Chan 2024-07-03 12:02:07 UTC
Workaround:
Select object > Format > Text Attributes > untick Word wrap text in shape.

Anway there seems to be an error in the calculation for objects between 0.5 cm to 0.9 cm.
Comment 2 Edward Chan 2024-07-03 12:06:31 UTC
Confirmed that this is a new bug. Error does not occur in LibreOffice Draw 6.4.7.2.
Comment 3 Edward Chan 2024-07-04 12:28:53 UTC
The older versions of LibreOffice Draw don't enable Word Wrap in the default style, which is why the bug doesn't occur (unless you manually turn on Word Wrap).

Another strange thing is that you can't access the Word Wrap setting from the Properties Sidebar - I would have thought that the Text Attributes would be mostly accessible, especially something as important as Word Wrap.

Anyway the algorithm for Word Wrap should take into account small size objects between 0.5 to 0.8cm.
Comment 4 Regina Henschel 2024-07-04 12:52:35 UTC
You cannot confirm your own bug report. But I'll not set it back to "unconfirmed", because I can confirm your observation.

If the text area width is not wide enough, then the overflow should be handled according the anchor. In case of anchor "center" as in the default settings, the overflow should go to the right and the left. That is not the case.

Whether an overflow exists, depends not only on the shape size but on the font size as well. And for some shapes (e.g. circle, diamond, right triangle), the text area is smaller than the bounding rectangle of the shape. And the default settings of 2,5mm for left and right "Spacing to Border" reduce the effective text area in addition.