Setting default font?


#1

Now that the good old Font::setDefaultSansSerifFontName() is gone, how am I supposed to do it? The following doesn’t seem to work for me:

	LookAndFeel lf;
	lf.setDefaultSansSerifTypefaceName (String(T("Arial")));
	lf.setColour (ComboBox::backgroundColourId, Colours::red);
	setLookAndFeel (&lf);

The colour change is just there to check that the new l&f is really in effect. And yes, it is.

Thanks


#2

Looks to me like the static method you are referring to is still (basically) in use:

Here’s a link to the static method:
http://www.rawmaterialsoftware.com/juce/api/classFont.html#d3d6f8cc9c79d176d6e35693272f4b63

It’s just called:
Font::setDefaultSansSerifFontName(const String & name) throw ()

And the first place you should’ve looked is the LookAndFeel class – there is no method called setDefaultSansSerifTypefaceName(). So, um, of course it won’t work.


#3

[quote=“amcleran”]Looks to me like the static method you are referring to is still (basically) in use:

Here’s a link to the static method:
http://www.rawmaterialsoftware.com/juce/api/classFont.html#d3d6f8cc9c79d176d6e35693272f4b63

It’s just called:
Font::setDefaultSansSerifFontName(const String & name) throw ()

And the first place you should’ve looked is the LookAndFeel class – there is no method called setDefaultSansSerifTypefaceName(). So, um, of course it won’t work.[/quote]

No, the method’s not in the svn anymore, Jules has recently changed this stuff. The api doc on the RMS site you’re referring to is quite outdated, I’m afraid. The new approach should allow using embedded fonts for default typeface, which would be great, btw.


#4

Sorry about that… just realized this is outdated. I just now tried to use it myself and discovered it wasn’t working… :slight_smile:

Should’ve figured you had read the doc. Sorry!