Button font

Well actually, there is at least one technical reason… When you tell the child to repaint, then technically, it’s only a side-effect that causes the parent’s paint method to be called. If the parent was using an image cache, it wouldn’t actually update when you expect it to.

Yeah, I never leave repainting to the control that is doing the logic; that would be daft. On that we agree. Doing big AUv3s on iOS requires very strict attention be paid to the repainting, and we just carry that in to the desktops, because why not? It’s better.

Of course, the Beginner in your example isn’t shipping a warehouse full of products, and he or she will learn such things in time.

So what advice should I follow? :sweat_smile:

Since the original implementation using drawFittedText allows the font to shrink, but not to grow, is setting it to a huge font an option?

It’s to do with this function: The default return line is:

Font juce::disto_CustomLookAndFeel::getTextButtonFont(TextButton &, int buttonHeight)
{
	return { jmin(16.0f, buttonHeight * 0.6f) }; // default

As the UI gets bigger, the highest font size possible is 16. I just replaced it with:
return { buttonHeight * 0.8f };
Seems a bit more useful as a default to me.

Future people:
override the getTextButtonFont() in your custom look and feel class

4 Likes