Date: | July 7, 2005 / year-entry #182 |
Tags: | history |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20050707-00/?p=35013 |
Comments: | 22 |
Summary: | 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... |
Among the things you can get with the 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 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 One major gotcha with |
Comments (22)
Comments are closed. |
I think a lot of people use DEFAULT_GUI_FONT after creating their windows with CreateWindowEx.
What the Font used in XP for GUI ?
But what font should one use?
lfMessageFont you get from SPI_GETNONCLIENTMETRICS?
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…
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.
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
Please tell us which font we should use for child-windows.
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.)
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.
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.
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)?
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.
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.
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.
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.
It all stems back to a rather unfortunate implementation of Control.DefaultFont.   Raymond…
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…
You don’t want to ever use DEFAULT_GUI_FONT. Just like the thread locale, AVICAP32.DLL, and SetLocaleInfo,…
Last time around, I suggested, "Let’s see if I can talk about something other than rendering text next…
PingBack from http://blog.m-ri.de/index.php/2008/03/02/system_font-default_gui_font-und-der-font-der-eigentlich-benutzt-wird/
When you call the WM_GETFONT message to get the font from a control, the documentation says: The return