# Can't draw text bold AND italic

**URL:** <https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320>\
**Category:** General JUCE discussion\
**Created:** [August 7, 2014, 3:54pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320 "2014-08-07T15:54:56Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![IvanC](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivanc/32/685_2.png) [@IvanC](https://forum.juce.com/u/IvanC)\
**Post date:** [August 7, 2014, 3:54pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/1 "2014-08-07T15:54:56Z")

</div>

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 ;)

---

<div class="post-metadata">

**Author:** ![IvanC](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivanc/32/685_2.png) [@IvanC](https://forum.juce.com/u/IvanC)\
**Post date:** [August 12, 2014, 4:54pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/2 "2014-08-12T16:54:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 12, 2014, 5:02pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/3 "2014-08-12T17:02:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![IvanC](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivanc/32/685_2.png) [@IvanC](https://forum.juce.com/u/IvanC)\
**Post date:** [August 12, 2014, 5:07pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/4 "2014-08-12T17:07:00Z")

</div>

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 :(

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 12, 2014, 5:49pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/5 "2014-08-12T17:49:31Z")

</div>

Works ok for me (on OSX)..

---

<div class="post-metadata">

**Author:** ![IvanC](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivanc/32/685_2.png) [@IvanC](https://forum.juce.com/u/IvanC)\
**Post date:** [August 13, 2014, 4:57am UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/6 "2014-08-13T04:57:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [August 13, 2014, 7:55am UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/7 "2014-08-13T07:55:28Z")

</div>

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.&nbsp;Should be ok now.

---

<div class="post-metadata">

**Author:** ![IvanC](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ivanc/32/685_2.png) [@IvanC](https://forum.juce.com/u/IvanC)\
**Post date:** [August 13, 2014, 8:37am UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/8 "2014-08-13T08:37:28Z")

</div>

I didn't try on Mac OS X, but I told you from the beginning I'm working on Windows XP ![wink](http://www.juce.com/sites/all/libraries/ckeditor/plugins/smiley/images/wink_smile.gif "wink")

Everything is working now, thanks !

---

<div class="post-metadata">

**Author:** ![fireplayer](https://avatars.discourse-cdn.com/v4/letter/f/48db29/32.png) [@fireplayer](https://forum.juce.com/u/fireplayer)\
**Post date:** [February 21, 2015, 3:18pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/9 "2015-02-21T15:18:00Z")

</div>

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

Just try it on all the fonts that come&nbsp;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?

---

<div class="post-metadata">

**Author:** ![mayae](https://avatars.discourse-cdn.com/v4/letter/m/9fc29f/32.png) [@mayae](https://forum.juce.com/u/mayae)\
**Post date:** [February 21, 2015, 8:51pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/10 "2015-02-21T20:51:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fireplayer](https://avatars.discourse-cdn.com/v4/letter/f/48db29/32.png) [@fireplayer](https://forum.juce.com/u/fireplayer)\
**Post date:** [February 21, 2015, 9:47pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/11 "2015-02-21T21:47:34Z")

</div>

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.

&nbsp;

---

<div class="post-metadata">

**Author:** ![antonio77](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@antonio77](https://forum.juce.com/u/antonio77)\
**Post date:** [March 28, 2017, 2:38pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/12 "2017-03-28T14:38:21Z")

</div>

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

Any hint how it can works on windows?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [March 28, 2017, 2:52pm UTC](https://forum.juce.com/t/cant-draw-text-bold-and-italic/13320/13 "2017-03-28T14:52:20Z")

</div>

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.
