I did some debugging: The LookAndFeel of both the TabBarButton and the Tooltip use a TextLayout::draw and AttributedString in order to draw its text. Whereas other components, such as labels use Graphics::drawFittedText. It seems, AttributedString (or maybe TextLayout) is using different font setting methods than Graphics. And therfore it seems, it does not react to LookAndFeel::setDefaultSansSerifTypefaceName. That in turn results in TabBarButton and Tooltip getting the wrong font.
Here is some code I used to test that. First I instantiate my main Component and set the LookAndFeel:
class FontTestApplication : public JUCEApplication
void initialise (const String& commandLine) override
mainWindow = new MainWindow (getApplicationName());
... more code here ...
In the MainWindow's paint routine I create two different text strings. One using Graphics::drawFittedText and another one using TextLayout::draw. Both functions get to use the same font:
void MainContentComponent::paint (Graphics& g)
g.fillAll (Colour (0xff001F36));
Font font(15); //same font for both string-drawing methods
g.drawFittedText("This is a test string.", juce::Rectangle<int>(10, 100, 200, 25), Justification::centred, 1);
s.append("This is a test string.");
textLayout.draw(g, juce::Rectangle<float>(10, 140, 200, 25));
But: only the "drawFittedText" string is correctly drawn in "Wingdings". The other string is drawn in normal text. I think, this must be a bug? I mean: two methods, which use the same font should also display the same font, I would assume. Both should display the Wingdings symbols. Or is there something wrong with my code?
I have attached a screenshot of the result. And I have attached the source files used in my test application.
My Environment: JUCE 4 on Win 7 under VS2015.