Can't draw text bold AND italic

Hello Jules !

I'm trying on Windows XP with the last version of JUCE to write some text which is both bold and italic, but I have not found any way to make it work. I get plain text instead each time. Nevertheless, when I choose only the Font::bold, or the Font::italic attribute, they are considered and I get the expected result. I have tried several things like that :

// Everything here is working fine
void paint(Graphics &g)
    g.setFont (Font("Arial", 12, Font::bold));
    g.drawSingleLineText ("Sample Text", 0, 0);

    g.setFont (Font("Arial", 12, Font::italic)); 
    g.drawSingleLineText ("Sample Text", 0, 0);

    g.setFont (Font("Arial", 12, Font::plain).withTypefaceStyle("Bold"));
    g.drawSingleLineText ("Sample Text", 0, 0);

    g.setFont (Font("Arial", 12, Font::plain).withTypefaceStyle("Italic"));
    g.drawSingleLineText ("Sample Text", 0, 0);


// Everything here is not working as expected and rendered plain
void paint(Graphics &g)

    g.setFont (Font("Arial", 12, Font::bold + Font::italic)); 
    g.drawSingleLineText ("Sample Text", 0, 0); 
    g.setFont (Font("Arial", 12, Font::plain).withTypefaceStyle("Bold Italic")); 
    g.drawSingleLineText ("Sample Text", 0, 0);


Any idea ? Am I doing something wrong, of is there something wrong with Juce ?

Thanks in advance ;)

So, am I the only one who can't draw text bold and italic ?

Does Arial actually have the style "Bold Italic"? You can easily check in the juce demo fonts page.

Hi Jules !

I have just seen in the Juce Demo that the style "Bold Italic" exists for Arial and that the bug is there too. I can display Arial Bold, Arial Italic, but I can't display Arial Bold Italic.

And... I have the same problem with all the other fonts I have on my computer :(

Works ok for me (on OSX)..

I have compiled the last version of Juce Demo, and I can't display any font with bold + italic styles on Windows XP. There is a serious issue here...

If you'd pointed out that this only happens on XP, that would have saved some time..

It was just a mistake in the XP legacy font handling stuff. Should be ok now.

I didn't try on Mac OS X, but I told you from the beginning I'm working on Windows XP wink

Everything is working now, thanks !

1 Like

Juce does not create a bold or italic font for many fonts in Windows 8.

Just try it on all the fonts that come with Windows 8 in the demo.

This is not a problem in all other programs.

Was this fixed in an update recently that I missed?

Shouldn't you OR the styles together, anyway?

Font("Arial", 12, Font::Bold | Font::Italic)

In this case it probably works anyway, because Font::Bold (1) + Font::Italic (2) == 3, which is the same result if you had to OR (1 | 2 == 3) them.. but any other constant it wouldn't necessarily work.

It doesn't matter. Juce does not create a bold or italic or bold + italic font for a lot of the fonts in Windows 8.


Same problem on Window 7 & Windows 8. On MacOs it’s working.

Any hint how it can works on windows?

All that those “bold” and “italic” flags do is make it look for fonts whose style contains the word “bold” or “italic”. Unless you have a font that contains both those keywords, then it won’t find it.

Fonts should be referred to by the name of their style instead - that’s much more reliable, as typefaces have all kinds of style names.