# Setting default font?

**URL:** <https://forum.juce.com/t/setting-default-font/3790>\
**Category:** General JUCE discussion\
**Created:** [March 27, 2009, 7:00am UTC](https://forum.juce.com/t/setting-default-font/3790 "2009-03-27T07:00:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![spiderman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/spiderman/32/431_2.png) [@spiderman](https://forum.juce.com/u/spiderman)\
**Post date:** [March 27, 2009, 7:00am UTC](https://forum.juce.com/t/setting-default-font/3790/1 "2009-03-27T07:00:59Z")

</div>

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:

```auto
	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

---

<div class="post-metadata">

**Author:** ![amcleran](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@amcleran](https://forum.juce.com/u/amcleran)\
**Post date:** [March 27, 2009, 8:57pm UTC](https://forum.juce.com/t/setting-default-font/3790/2 "2009-03-27T20:57:13Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![spiderman](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/spiderman/32/431_2.png) [@spiderman](https://forum.juce.com/u/spiderman)\
**Post date:** [March 27, 2009, 11:14pm UTC](https://forum.juce.com/t/setting-default-font/3790/3 "2009-03-27T23:14:16Z")

</div>

[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](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.

---

<div class="post-metadata">

**Author:** ![amcleran](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@amcleran](https://forum.juce.com/u/amcleran)\
**Post date:** [March 28, 2009, 12:31am UTC](https://forum.juce.com/t/setting-default-font/3790/4 "2009-03-28T00:31:34Z")

</div>

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

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