Archive: Use the default Vista font?


Use the default Vista font?
Is there a chance that NSIS can be fixed to use the default font for the OS instead of "MS Shell Dlg" or "MS Shell Dlg 2" fonts. For instance the default on Vista is Segoe UI 9.75pt.

The setting is stored in the Advanced Appearance dialog; the "Message Box Text".

I did a bit of research and I found out that the only way you can retrieve the User's Font and Font size preferences (Vista and above) is by using the GetThemeFont API.

(From: msdn2.microsoft.com/en-us/library/aa511282.aspx )

And here's the MSDN page for the GetThemeFont API:

msdn2.microsoft.com/en-us/library/bb759745(VS.85).aspx

I know this will probably take a big code change, but the Font subtleties would be a nice thing to have in NSIS.


the problem afaik, is that not only is it a different font (if that was the only problem, MS Shell Dlg would have worked) it is also a different size, so you need a special set of dialog resources just for Vista (or tweak the resource in memory)


Originally posted by Anders
the problem afaik, is that not only is it a different font (if that was the only problem, MS Shell Dlg would have worked) it is also a different size, so you need a special set of dialog resources just for Vista (or tweak the resource in memory)
Well, doesn't NSIS already do that on non-Vista systems? That is, isn't the the installer dialog (and all its children like buttons, etc.) dynamically resized based on the user's font selection and DPI selection?

Because if it already does dynamically resize, then it's just a matter of reading in the user's font preference using the GetThemeFont API for Vista+ systems.

If NSIS doesn't dynamically resize based on font size and DPI settings, then perhaps this is a bigger problem that needs to be addressed first.

Though, this is easy for a backseat programmer to say. If I have some time I might start fiddling with the source to see if I can come up with anything.

MS Shell Dlg maps to MS Sans Serif on 9x/NT4 and Tahoma on 2k/XP. NSIS does not do any kind of font selection, its done by the dialog manager.

NSIS dialog resources (like most) contain the line: FONT 8, "MS Shell Dlg"
this is part of the problem, Segoe must be used at 9pt and larger to look good. Dialog/control size is based on dialog units, and dialog units are based on the size of the current font. So, you can't change the font after the dialog has been created since its created with a 8pt font size.

I don't know a good solution.


Originally posted by Anders
MS Shell Dlg maps to MS Sans Serif on 9x/NT4 and Tahoma on 2k/XP. NSIS does not do any kind of font selection, its done by the dialog manager.

NSIS dialog resources (like most) contain the line: FONT 8, "MS Shell Dlg"
this is part of the problem, Segoe must be used at 9pt and larger to look good. Dialog/control size is based on dialog units, and dialog units are based on the size of the current font. So, you can't change the font after the dialog has been created since its created with a 8pt font size.

I don't know a good solution.
I've been looking around some in MSDN blogs and the MSDN library, and found that there isn't a silver bullet. There's no equivalent to "MS Shell Dlg" for Vista's Segoe UI, and if you hard code Segoe UI you lose pre-Vista OS's (i.e. a majority of the users).

There's some interesting discussion here:
http://blogs.msdn.com/michkap/archive/2006/06/11/626100.aspx

Is there a way to modify the dialog resource's font before it's loaded, that way all child controls inherit the set font? If that were possible, then the only other (mountainous) hurdle would be to scale the dialog size, buttons size, and text box sizes.

It seems even the easy solutions are a lot of work. I'd forgotten how much a pain working with raw windows resource is. C# has softened me.

There is: you have to set "MS Shell Dlg 2" in dialog resources. And for e.g. the MUI you can select a different modiyfied dialog resource, see somewhere in documentation.

TIP:
Somtimes if you install fonts, the Windows fontcache get corrupted. Clear you fontcache on the machine you test your installer on.

Best to test your script on a separate clean PC, where you know nothing is tweaked or otherwise broken.

Give a sample script and I'll see what I can do...


AFAIK, MS Shell Dlg 2 does not translate into Segoe UI


Originally posted by onad
There is: you have to set "MS Shell Dlg 2" in dialog resources. And for e.g. the MUI you can select a different modiyfied dialog resource, see somewhere in documentation.

TIP:
Somtimes if you install fonts, the Windows fontcache get corrupted. Clear you fontcache on the machine you test your installer on.

Best to test your script on a separate clean PC, where you know nothing is tweaked or otherwise broken.

Give a sample script and I'll see what I can do...
I don't have a script, I was suggesting that maybe in a future version of NSIS the installer would automatically detect the user's selected font on Vista (and newer OS) and adjust the dialog accordingly.

Originally posted by Anders
AFAIK, MS Shell Dlg 2 does not translate into Segoe UI
That's right, it doesn't. Nor does the original "MS Shell Dlg" pseudofont.