Description:
The following issue is appeared in Frame with Paragraph if setMaxWidth > 0.
Depends on alignment:
left: all ok
center: text moved to the right a bit
right: text moved again to the right and overlaps frame border
Investigation:
The frame border width is based on inner.getWidth() (see: TextSequenceUtil.getWidth()) which can be less then maxWidth.
At the same time in TextSequenceUtil.drawText() the maxLineWidth variable is a max of getMaxWidth(lines) and maxWidth. It means that variable in common case is equal to maxWidth.
As result frame width < maxLineWidth (used for text positioning)
Workaround - set paragraph maxWidth the same as width :
paragraph.setMaxWidth(width); paragraph.setMaxWidth(paragraph.getWidth());
Possible fixes (frame border should be equal to max line width) :
draw frame border based on inner.getMaxWidth() instead of inner.getWidth()
fix TextSequenceUtil.drawText() and use min() function to calculate maxLineWidth
Hi,
Description: The following issue is appeared in Frame with Paragraph if setMaxWidth > 0. Depends on alignment:
Investigation: The frame border width is based on inner.getWidth() (see: TextSequenceUtil.getWidth()) which can be less then maxWidth. At the same time in TextSequenceUtil.drawText() the maxLineWidth variable is a max of getMaxWidth(lines) and maxWidth. It means that variable in common case is equal to maxWidth. As result frame width < maxLineWidth (used for text positioning)
Workaround - set paragraph maxWidth the same as width :
paragraph.setMaxWidth(width); paragraph.setMaxWidth(paragraph.getWidth());
Possible fixes (frame border should be equal to max line width) :