I noticed some strange behaviour of Pane
.
In the result from the following code, the line wrapping is not consistent: why do the first and last line contain four times "test" while the other lines only three times?
Secondly, why doesn't it fill up the green rectangle with text, as it is supposed to do with its width of 84?
Graphics[{
Nest[Lighter, Blue, 6], Rectangle[{0, 0}, {110, 70}],
Nest[Lighter, Green, 6], Rectangle[{16, 10}, {100, 60}],
Darker@Red,
Inset[
Pane[
Text["test test test test test test test test test test test test \
test test test test test", BaseStyle -> {12}]
, 84]
, {16, 60}, {Left, Top}]
}]
Am I using Pane
in a wrong way?
Many thanks in advance!
EDIT
As for the second question, I realised that the width I specify for Pane
(which is 84) is not in the same units as the rectangles, which becomes apparent by using Framed
around Pane
:
But this still leaves the question why the line wrapping doesn't work the same on all lines, and how to relate the point units of the width of Pane
to those used in the Graphics
environment. I'd like to be able to draw a rectangle of given width and height, and wrap text inside of it (possibly two or more panes in the same rectangle).
EDIT 2
Even stranger (as I just noticed): what I get on my screen differs from the exported image (using right-click); the line wrapping is again different. I made a screenshot to illustrate the difference:
This is from the same code (even from the same execution).. Does anybody know why this happens?
Thanks a lot!