Font sizes in TextPropertyComponent; altering size centrally



After looking at this I ended up wondering if there’s something I’m missing.

I wanted to change my Font sizes for the TextProperrtyComponent and came upon the following conundrum:

In the TextProperrtyComponent, there’s a private member Label. Two font sizes are related to that:

A: The size used to draw the label, which is easily enough changed by adding a drawLabel method in one’s LookAndFeel class, and using a size other than that of the Label’s font object.
B: The size of the font used in the label’s editor, which one can set only if one has access to the Label’s setFont function.

So now, if I want to change the font in the TextProperrtyComponent editor, the only recourse, due to B and the Label object being private, seems to be to copy-paste the TextProperrtyComponent code into my own new class, and change a few lines!

Have I missed something? Surely there should be a Juce(y)er way to have control over one’s font sizes?

I’m in the process of making a program where users have control over the UI’s font sizes, so that old myopic people, and varying screen size and pixel densities can be optimally supported.

Hiccups similar to the above will likely happen more than once I imagine, so my wider-scoping question would be: How do I centrally allow increasing/decreasing the size of fonts across my UI?



You could always create a custom lookandfeel that draws your labels, and apply it to the property components, can’t you?

But if you’re trying to rescale your entire UI, have you considered just applying a transform to the entire window, to scale everything up?


Thanks for the quick reply!

The custom look and feel as far as I’ve understood only contains an option for the appearance of the label itself, but not it’s editor, the editor appearance is coded into the Label class (createEditorComponent() ).

I thought about what you say with scaling, but in programs with touch interfaces (such as mine) this is not optimal, since you have two separate “worlds” to take into account, that of the eyes and that of the fingers.

I was thinking, I want to accommodate a user with fat fingers and great eye-sight, as well as one with slim fingers and bad eye-sight :slight_smile: In one case, I’d like big controls but smaller text, in the other the opposite. Both within certain reasonable margins of course or the program would be ridiculously unusable…

Perhaps scaling just a few components, those containing text, would help, but I intuitively think trying to selectively get to scale only some components and not others may end up in a bit of a mess with trying to preserve the layout, gaining access to all the components I want to scale, and other issues I haven’t yet thought of but might still encounter :slight_smile: …So left that solution for last.