Italic font in MessageBox?

Hi, Jules

Re-compile my project after update to the latest version (Git: 75ad35f7…), I found the message window’s font become italic.

I didn’t do any settings about font and labels, buttons etc. no this change.

This is normal?

Please see:

Switch to use the Chinese font (微软雅黑), labels and buttons font also become italic, and bold. but message window’s title font no change.

The label to display time (00:00:00), its font have been set ‘bold’, no change. In addition, no any extra settings.

see:

I’ve been tinkering with the fonts over the last couple of days… Try it again now, I just made another update.

So fast! Thanks!

Has been updated (23c46c…)

The font of labels and buttons recover normal. But the font of message window still italic.

I guess because the message window using the operating system default font.

In my case, even if I do not specify the Chinese font, message window can also display the correct Chinese. However, in this case, the buttons and labels etc., can not display Chinese, I had to specify the global Chinese font in JUCEApplication.

The question is: the default font names are different under each operating system, must to write several lines of code.

I have mentioned this problem few days ago, but apparently didn’t get a satisfactory solution.
http://www.rawmaterialsoftware.com/viewtopic.php?f=2&t=8716&p=49190#p49190

In other words, how to do this: all of widgets can use the operating system default font without having to do any setting?

Thanks, it was just a mistake in the latest font changes. Fixed now!

EDIT…

Italics issue has been resolved! thanks!

However, before problem still not clue: If don’t specify the Chinese font in global nature, all of widgets can’t display Chinese. but, the message window can be displayed correctly:
[attachment=0]04.png[/attachment]

Now, the other question is: how to make other widgets can also use the message window font by default without having to explicitly specify the application’s font?

Or the next best thing: How to get the typeface (font name) of the operating system default?
I didn’t found a similar function in JUCE library. Maybe I missed anything?

The title and message text of the MessageBox are displaying text using a TextLayout. Every other widget in Juce (Button, Label, Etc) does not use TextLayout to display text.
TextLayout has automatic font fallback on Windows (Vista PU and higher) and OS X. If the font you specify does not contain the glyphs you need, another font (likely Arial Unicode MS) will automatically be used that does contain the glyphs.

You really only have two options:

  1. Create your own set of Widgets based on TextLayout. You can then use whatever font you want and it will auto font fallback for glyphs that aren’t present.
  2. Use the existing set of Juce Widgets with a font that you know contains all the glyphs you want.

Arial Unicode MS contains characters from almost every language and should be available on both Windows and Mac OS X.

Thanks sonic59.

Has confirmed, whether or not to specify the font of Chinese, the message window always using "Arial Unicode MS "font.
This font to display Chinese looks not clear, smaller size and more ambiguous. Please see the button’s text:

[attachment=1]05.png[/attachment]

if use the font (Microsoft yahei, 微软雅黑) which is operating system default font, the situation has improved, although still not clear enough:

[attachment=0]06.png[/attachment]

Thank you given me two solutions, obviously, the first most suitable for me.

If (maybe temporarily) don’t want to take the first option, choose above two fonts, I’ll give priority to use the operating system default font, but I still have ​​the original question: how to get the name of the operating system default font without specify its name? For example:

static const String LookAndfeel::getOsDefaultTypefaceName()
{
    // ...???
}
// get the OS default font (typeface name).
const Sting fontName(LookAndFeel::getOsDefaultTypefaceName());

// set global font in this application.
LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName(fontName);

//LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName("Arial Unicode MS");
//LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName(L"微软雅黑");

Or my understanding is wrong, each operating system is simply haven’t the default font, all of applications must needs to specify the font that it uses?

Thanks!

You can’t. There is no such thing as a single operating system default font. Operating Systems have their own internal font fallback lists to guide what fonts should be used if glyphs are not found. It is not possible to access this list in Windows.
You must specify the font you want to use by name, you don’t really have any other choice.

You can’t. There is no such thing as a single operating system default font. Operating Systems have their own internal font fallback lists to guide what fonts should be used if glyphs are not found. It is not possible to access this list in Windows.
You must specify the font you want to use by name, you don’t really have any other choice.[/quote]

Thanks! I see.