This seems to have changed between JUCE 7 and JUCE 8 but because of the difficulty of switching between versions, I don’t provide screenshots.
Problem
Let’s say I have a long string without spaces, like a file path, e.g., “/Users/foo/2025-04-19-14-39-36-0e074089-0ffc-41ff-abcf-ecc5ba38d14b/2025-04-19-14-39-36-0e074089-0ffc-41ff-abcf-ecc5ba38d14b.wav”
I want to have a juce::Label
of fixed size displaying that string by breaking it into at most 2 lines and using maximum width available on the first line to minimize the risk of displaying ellipsis at the end. I also don’t want to squash the text; for this, I call setMinimumHorizontalScale (1.f);
So in this example, I would expect something like
/Users/foo/2025-04-19-14-39-36-0e074089-0ffc-41ff-abcf-ecc5ba38d1
4b/2025-04-19-14-39-36-0e074089-0ffc-41ff-abcf-ecc5ba38d14b.wav
to be displayed, rather than
/Users/foo/
2025-04-19-14-39-36-0e074089-0ffc-41ff-abcf-ecc5ba38d14b/2025-...
How can I achieve this? I have tried using TextEditor
but I cannot limit the number of lines to 2 there (we always get scrollable behavior). I am not saying this must be achieved with a juce::Label
.
Any help or pointers much appreciated