https://bugs.documentfoundation.org/show_bug.cgi?id=168385
Bug ID: 168385
Summary: Use all area in a Draw object for text, iteratively
adjusting text bbox while fitting the text
Product: LibreOffice
Version: 26.2.0.0 alpha0+ master
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: Draw
Assignee: [email protected]
Reporter: [email protected]
Description:
A Draw object may contain text with "Word wrap text in shape" enabled to
auto-fit the text to the shape. However in circles & ellipses the algorithm
often wastes lots of space, forcing undesirable wrapping.
I think the problem is that the the wrapping algorithm uses a fixed rectangular
bounding-box inscribed into the shape regardless of the text (fixed based on
the object size without taking the text into account). If the bounding box has
a given height then the width is implied (so the bbox barely fits inside the
shape). And vice-versa: Given a bbox width the bbox height is implied.
Instead, the word-wrap algorithm might start with the minimum-height bbox (the
height of a single line in current font) and increase the height only when
necessary to fit the text. So initially the *maximal* horizontal space would
be available; if the text fits in one line then stop; otherwise increase the
height of the bbox to 2 lines (reducing the width accordingly), and repeat the
word-wrap process; if it can wrap and fit in the new bbox which allows 2 lines,
then stop; otherwise increase the bbox height to 3 lines, and so-forth.
I think this would always find the optimal shape for the bbox, avoiding
unnecessary wrapping and word-breakage.
Steps to Reproduce:
1. Open attached demo.odg
2. Double-click in the bottom-wright circle: Observe the pink bounding box
which is so narrow that the text is wrapped unnecessarily (the text would fit
in two lines instead of three if the vertical bbox dimension were less, because
it would allow the horizontal dimension to be wider).
Actual Results:
Text is wrapped once in the rectangle, but is wrapped twice in the circle, even
though the circle is larger than the rectangle in both dimensions.
Expected Results:
Wrap text using only the minimum vertical space necessary to fit the text
horizontally (suggested algo above)
Reproducible: Always
User Profile Reset: No
Additional Info:
.
--
You are receiving this mail because:
You are the assignee for the bug.