I'd like to represent a long String as Text in Graphics. The Graphics will only contain this text, or possibly a list of texts. I'd like to automatically fit all the text within the PlotRange.
For my specific application, the following criteria must also be met:
- The method must not impose any line wrapping of the text.
- I need to be able to specify the FontSize.
- The Graphics PlotRange must not cut off the text.
- The PlotRange must minimize padding.
- The method should work for any ImageSize.
Essentially, I'd like the PlotRange to shrinkwrap around the text boxes.
How can one achieve this?
Illustration of the issue:
Graphics[Text[Style[StringRiffle[RandomWord[100],", "], {Bold}, FontSize -> 20]],
Frame -> True]
Fontsize->Scaled[0.005]
as long as your text is consistent in length. There are probably even better and more automatic ways. Or do you want to actually scale the Graphics to the text? That's probably not so easy because the text is only anchored to a single point. $\endgroup$Graphics[{..., Text["something very long"]},PlotRange->something]
and have the resulting Graphics show the full text without imposing any line wrapping, and without any unnecessary white space or padding around the text. $\endgroup$