Those god dammned ellipses!

Hi, has anyone ever come up with a way of not displaying these horrible things when text can’t fit into a box without modifying the source code?

Thx

Yeah, both this and all the drawFittedText stuff are poor UX defaults which IMO need to be updated. Very 1990s programmer-y. I end up rolling most of my own components to avoid undesirable defaults like this. Or I use g.drawText directly, setting useEllipsesIfTooBig to false.

1 Like

@sudara What’s your approach with text too large (instead of ellipsis/fitted)?

Making the component bigger! :laughing: Or make the font smaller. Or reduce the amount of text.

But I guess you are asking about the case where the design expects text to be too large for the area, such as a user-entered preset name. In this case truncation with ellipses makes 100% sense to opt-in to.

But as a default for something like slider label, fitted text or ellipsis is always unhelpful — never the “solution” one purposely would design for or ship with, and ironically makes the resolution to the actual problem (increasing the component size, reducing the text size) more difficult to assess.

Ideally the framework would warn the user and instruct to use ellipsis, increase the component size or reduce the text size (which in complex “widgets” can be non-trivial). FittedText should be deprecated altogether…feeling opinionated today!

3 Likes

To avoid fitted text in Labels, you can use Label::setMinimumHorizontalScale, calling myLabel.setMinimumHorizontalScale (1.0f) in the ctor or wherever.

I don’t think that stops the ellipses though – you’ve just got to leave enough room for your text to avoid that.

But it does stop an annoying habit of the drawFittedText algorithm – even if your Label has enough vertical room to display several lines of text, drawFittedText will prefer to squish it all into one line rather than break it over multiple lines.

1 Like

thanks - yeah, i know how to stop the scaling, just want truncated text. makes everything look so amateur hour.

1 Like

So do i.
It’s common in JUCE that the font’s size depends of the component size ; whereas i would always prefer the component’s size to depend of the font size.
Fitted text looks bad. I never use it ; i was pretty shocked how ugly it is!

I’m agree ; In my case ellipsis are used for user defined entries (that could be arbitrary long).

1 Like

idk if this is any help for you all but i made my own label class and it has this method here, which basically trys to figure out how it has to setHeight() of the current font in order to maximize its size so that it just fits into those bounds. it works with multiline text as well. i use it all the time, because then i can just define the bounds of a label and it works perfectly fine already. my only problem with it is that i can’t let multiple labels that are next to each other have the same size

2 Likes