Changing the global font

Hi,

first I have to say that I’m very impressed with JUCE; I’ve successfully transferred a quite elaborate VST plugin to the JUCE framework with surprisingly little effort. So thanks for this!

There’s one thing that I can’t seem to get my head around, though: why is it so (relatively) complicated to change the fonts in an application? Say, I have a slider and a combobox. Now if I want to change the fonts in the slider’s textbox and in the combobox, do I really have to subclass lookandfeel and make custom drawslider and drawcombobox methods? There should be something like editor->setFont(…), or am I overlooking something here?

Cheers, siedschl

Glad you like it!

The advantage of using a look+feel is that it lets you change the fonts for components that you don’t own - so you could change them for all the components inside, e.g. a juce-created dialog box, where those comps would otherwise be inaccessible. It also means you can set a single l+f for your whole app without having to set the fonts on every single comp you create individually. True, it’s more of a pain if you just need to tweak one item.

Okay, that makes me understand the advantages of lookandfeel; but then, wouldn’t it be nice to have a lookandfeel-font that’s automatically used in all components?

Yeah, that one’s been mentioned recently, I’m going to look into it when I get a chance.

You can use Font::setDefaultSerifFont() method if it’s just the general used font that you want to change.

Hmm… doesn’t do anything for me. First tried it in my dll project, then even in the hello world application. I must be missing something really stupid!

Also, I’ve now created a MyLookAndFeel with its own getComboBoxFont method. Then ComboBox* CB->setLookAndFeel(MyLookAndFeel), but it doesn’t use it. Is this not the right way to do it?

Sorry for these basic questions, I’m more the C type of guy… :slight_smile:

Probably setDefaultSansSerifFont would be a better idea…

That sounds like the right way to do a l+f, so you’re probably just making a silly mistake somewhere.

Oh yeah… never interchange * and & ! My bad… now it works like a charm!

Also, I’ve now created a MyLookAndFeel with its own getComboBoxFont method

Hi!

Can anybody help me, how can I change the font size of my juce::Slider? I’ve tried almost everything (and I didn’t find “setDefaultSansSerifFont” or “getSliderFont”…)

Regards

The size is probably calculated by the look and feel, so you might need to implement your own l+f to change something like that.

Hello Jules!

The size is probably calculated by the look and feel, so you might
need to implement your own l+f to change something like that.

Yes, I’ve seen l+f class, but it seems to me: I can’t use this properly. I have to create large GUI elements with large font size (because stereo shutterglasses make the resolution worse). For TextButtons I found LeoLookAndFeel::drawButtonText. But how can I change font size of Slider or FileTreeComponent? LookAndFeel::drawTreeviewPlusMinusBox can help me to increase “plusminusbox”, but I didn’t find the way to increase font size of filelist.
(Sorry about my low-level english :oops:, and thank you in anticipation).

Best regards

Well you’d want to look at LookAndFeel::createSliderTextBox() and drawFileBrowserRow(), I suppose.

Ooops… I was so unobservant! L+F is simpler (and what is more: better) than I could imagine! :smiley:
Thank you very much!