Global Font scale factor


#1

I’m trying to implement a global font scale factor so the font size in our app can easily be enlarged or reduced with one slider but I,m having troubles finding one point in the Juce source code where this could be applied so it has effect on all the font rendering.

Any ideas on where to implement a global font scale factor?


#2

I’m not crazy about the idea of a global font scale, because it’d make a mess of things like TextButtons, labels, window title bars, etc, when you change it. Why not just have your own scale factor, and apply it to the components that you want to be affected?


#3

We are using the Jucer to layout all the components so it’s not so easy to implement a scale factor there right?

I have found a way to do it but it’s not ideal because the text is scaled from the bottom up and not the middle.

float Font::getHeight() const throw()
{
	return height * scale;
}

#4

Well yes - you would expect fonts to scale around their baseline. There’s not really such a thing as a ‘middle’ when you’re talking about fonts, just a baseline, ascent and descent.


#5

I second the idea of font scaling, but for a different reason.

I use Jucer for a gui that runs on vastly different screen sizes. The Jucer can produce fluid controls, but it’s very hard to change the font size for a lot of controls in runtime. A scale factor (defaulting to 1.0f) would be handy. We could design the GUI for say 1280x1024 screen then apply an optional scale factor based on the current screen resolution. Wouldn’t break any existing code.

Any thoughts?