Welcome to MSDN Blogs Sign in | Join | Help

What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Among the things you can get with the GetStockObject function are two fonts called SYSTEM_FONT and DEFAULT_GUI_FONT. What are they?

They are fonts nobody uses any more.

Back in the old days of Windows 2.0, the font used for dialog boxes was a bitmap font called System. This is the font that SYSTEM_FONT retrieves, and it is still the default dialog box font for compatibility reasons. Of course, nobody nowadays would ever use such an ugly font for their dialog boxes. (Among other things, it's a bitmap font and therefore does not look good at high resolutions, nor can it be anti-aliased.)

DEFAULT_GUI_FONT has an even less illustrious history. It was created during Windows 95 development in the hopes of becoming the new default GUI font, but by July 1994, Windows itself stopped using it in favor of the various fonts returned by the SystemParametersInfo function. Its existence is now vestigial.

One major gotcha with SYSTEM_FONT and DEFAULT_GUI_FONT is that on a typical US-English machine, they map to bitmap fonts that do not support ClearType.

Published Thursday, July 07, 2005 7:00 AM by oldnewthing
Filed under:

Comments

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 10:46 AM by stock
I think a lot of people use DEFAULT_GUI_FONT after creating their windows with CreateWindowEx.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 11:32 AM by Mike J
What the Font used in XP for GUI ?

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 11:43 AM by AC
But what font should one use?
lfMessageFont you get from SPI_GETNONCLIENTMETRICS?

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 11:46 AM by Adrian
That sound you just heard was my jaw bouncing off my keyboard. DEFAULT_GUI_FONT seemed the best way to get an appropriate font regardless of the locale and version of Windows in use. So by the late 1990s, when I first discovered DEFAULT_GUI_FONT and started using it far and wide, it had already been deprecated for several years!?

Even though the documentation for GetStockObject has been updated for each version of Windows since, the explanation of SYSTEM_FONT is still wrong.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/devcons_1t10.asp

And as long as somebody is in there fixing the docs for SYSTEM_FONT, it would be nice if they'd indicate the deprecated status of DEFAULT_GUI_FONT and point us poor programmers to SystemParametersInfo SPI_GETNONCLIENTMETRICS, assuming that's now the "right" place to go for a font that matches the one used by the system.

Now I've gotta go fix some code...

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 12:05 PM by oldnewthing
Yes I filed doc correction request for that page.

The phrase "the font used by the system" is underspecified. As you can plainly see, the system uses several fonts. There's the menu font, the icon label font, the caption font, the message box font, the status bar font, multiple dialog box fonts... Choose the font for what you want.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 1:26 PM by Kevin Dente
Unfortunately, it seems no one told the original .NET team - they used DEFAULT_GUI_FONT for the standard Windows Forms dialog font, which results in apps that look wrong when run on XP (don't use Tahoma). And they still haven't fixed it in 2.0 - I blogged about it.

http://weblogs.asp.net/kdente/archive/2005/03/13/394499.aspx

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 1:53 PM by stock
Please tell us which font we should use for child-windows.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 2:02 PM by oldnewthing
I can't tell you; your question is still too vague. What is your child window being used for? If your child window is a status bar, use the status bar font. If it shows icons or a list of items, use the icon label font. If it's a dialog, use one of the dialog box fonts. If it's none of the above, then you get to decide for yourself whether your scenario matches one of the scenarios covered by the system fonts or is something entirely different and deserves its own special font. Clearly no single rule for fonts will cover all programs. (Maybe you're a mapping program and need fonts at different sizes depending on the population of the city you are labelling.)

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 2:19 PM by stock
I mean for example a simple button like Ok or Cancel!

I think the dialog box fonts would be right! But how can i retrieve them? Its not in NONCLIENTMETRICS.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 4:36 PM by oldnewthing
If you want it to look like a dialog box button, then use a dialog box font. I discussed dialog box fonts earlier this year.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Thursday, July 07, 2005 8:36 PM by mike
I've read the articles about dialog boxes. But is there a way (that preferrably works on all versions of windows) to find out the name of that dialog font used when DS_SHELLFONT is set (without using dialog boxes)?

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Friday, July 08, 2005 12:42 AM by oldnewthing
You shouldn't care what the name is. Just create MS Shell Dlg (or Dlg 2) and let it decide. If you really want to know the name, see the MSDN documentation for MS Shell Dlg.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Friday, July 08, 2005 1:59 AM by Andrew Fedoniouk
MSDN Article "MS Shell Dlg" starts from:

"MS Shell Dlg is a mapping mechanism that enables U.S. English Windows to support locales that have characters that are not contained in code page 1252...."

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_4qcn.asp)

I've found this article a bit scarry as e.g. we are sitting in Canada at it seems that MS Shell Dlg is not for us :)

I am using DEFAULT_GUI_FONT in
Harmonia Framework
http://www.terrainformatica.com/wiki/pmwiki.php?pagename=Harmonia.Harmonia.
to retrieve exactly "default GUI font".

I did not find more reliable way to retrieve dialog font from the system (Win95..WinXP).

My intention is to use as much OS agnostic code as possible so I would like to avoid
( os >= WinXP )? "MS Shell Dlg 2":"MS Shell Dlg" ...

Andrew.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Friday, July 08, 2005 2:00 AM by Andrew Fedoniouk
MSDN Article "MS Shell Dlg" starts from:

"MS Shell Dlg is a mapping mechanism that enables U.S. English Windows to support locales that have characters that are not contained in code page 1252...."

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_4qcn.asp)

I've found this article a bit scarry as e.g. we are sitting in Canada at it seems that MS Shell Dlg is not for us :)

I am using DEFAULT_GUI_FONT in
Harmonia Framework
http://www.terrainformatica.com/wiki/pmwiki.php?pagename=Harmonia.Harmonia.
to retrieve exactly "default GUI font".

I did not find more reliable way to retrieve dialog font from the system (Win95..WinXP).

My intention is to use as much OS agnostic code as possible so I would like to avoid
( os >= WinXP )? "MS Shell Dlg 2":"MS Shell Dlg" ...

Andrew.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Friday, July 08, 2005 2:53 PM by A
> Just create MS Shell Dlg (or Dlg 2) and let it decide.

There are two problems with the CreateFont(..., "MS Shell Dlg") approach:
- The "MS Shell Dlg" mapping doesn't exist on some Far East editions of Windows (e.g. Japanese Windows 98).
- On systems where the "MS Shell Dlg" mapping does exist, you don't know the correct point size to pass when creating the font. (Hard-coding 8 produces less-than-ideal results on Far East editions of Windows.)

GetStockObject(DEFAULT_GUI_FONT) doesn't suffer from these problems. However, as noted previously, it won't return Tahoma on 2000/XP.

# re: What are SYSTEM_FONT and DEFAULT_GUI_FONT?

Friday, July 08, 2005 3:48 PM by Andrew Fedoniouk
- "However, as noted previously, it won't return Tahoma on 2000/XP."

Yep, but:

LOGFONT lf;
::GetObject(::GetStockObject(DEFAULT_GUI_FONT),sizeof(lf),&lf);

returns "MS Shell Dlg" in font name field and valid font size on WinXP.

# Why don’t my fonts get bigger when I go Large Font?

Tuesday, July 12, 2005 2:25 AM by jfo's coding
It all stems back to a rather unfortunate implementation of Control.DefaultFont.   Raymond...

# GUI Confusion

Friday, July 15, 2005 11:26 AM by random ramblings....
And people wonder why user interface consistency is so difficult to achieve..... What are SYSTEM_FONT and DEFAULT_GUI_FONT. In everything I've produced, software wise, I've at least tried to keep a consistent look and feel from window to window, with particular...

# DEFAULT_GUI_FONT really stinks

Friday, April 28, 2006 3:51 AM by Sorting It All Out
You don't want to ever use DEFAULT_GUI_FONT. Just like the thread locale, AVICAP32.DLL, and SetLocaleInfo,...

# Light Up Your Fonts on Vista: Selecting Segoe UI Using GetThemeSysFont, NONCLIENTMETRICS, or SystemFonts.MessageBoxFont

Friday, June 02, 2006 3:32 PM by Evolving the Software Organism
Last time around, I suggested, "Let's see if I can talk about something other than rendering text next...

# SYSTEM_FONT hasn't been the system font since Reagan's first term in the White House

Thursday, August 14, 2008 4:27 PM by Sorting it all Out

When you call the WM_GETFONT message to get the font from a control, the documentation says: The return

New Comments to this post are disabled
 
Page view tracker