Help with using L&F in setting default fonts, and question

Hi all:

I’m having one of those moments where my relative lack of C++ skills is holding me back. I’m taking an online course, but right now we are spending our time learning how to work out our problems in UML, which doesn’t seem all that relevant for plugin development. Anyway…

How, exactly, do I change the default sans serif font by using LookAndFeel classes? I have my own look and feel class, but I am not sure about how to call the function to change the sans serif font in my code. A code example would be most excellent - not just pointing to the relevant member functions, but a few lines showing how it would be used.

My question: Why do some components allow you to change their font, but not others? It is really easy to change the fonts of Labels using the setFont() member function, so why not allow this function in Sliders and such?

Anyway, any help greatly appreciated. I’m trying to finish up a plugin and get it out the door (I need to send the proper paperwork to Jules this week as well).

Regards,

Sean Costello

I recently have to do just that, and I end up using this function “Font::setDefaultSansSerifFontName(const String& name)” from inside the L&F constructor.
Something like that in the L&F constructor code:

Font::setDefaultSansSerifFontName("Arial");
Hope this helps
Robert

I couldn’t find the setDefaultSansSerifFontName() function anywhere in Juce. I wonder if it has been depreciated in the latest tip.

Anyway, it turns out that putting this in my L&F constructor:

setDefaultSansSerifTypefaceName("Helvetica");

works for me. So thanks for pointing the way there.

The next question I have: Is this the proper place to implement the logic to determine if the desired font is present, and to choose a new font if not? I wish there was a CSS type function like

where you automagically can choose the preferred font, your less preferred but acceptable alternative (cough cough Microsoft cough), and the fallback if none of your preferred fonts are available.

Thanks,

Sean Costello