bp2008/BetterClearTypeTuner

[Request] "Factory" Defaults?

WhenJavaAttacks opened this issue · 1 comments

Your "ClearType Investigations" is a very good reference for what changes actually get made in the registry when changing ClearType settings. However, I was wondering if you knew what the default, "untouched" values were on a computer that had never run the ClearType Tuner wizard or otherwise ever changed ClearType or any related font settings. So, not just their default values but also which keys even exist in the registry in the first place prior to running the wizard or changing any related Font settings.

Ideally, something to reset all ClearType settings to their "untouched" defaults would be a nice feature to have in your software as well, though at least just knowing what the defaults are would be enough so anyone who wants them could do it manually.

It has been long enough now, I don't know for sure what the exact default state of the registry entries is. But more than likely I would have implemented the Restore Defaults button to set things to be as close to the default state as I knew how.

Restore Defaults deletes HKLM\Software\Microsoft\Avalon.Graphics and HKCU\Software\Microsoft\Avalon.Graphics registry keys and then using the windows API it enables ClearType with RGB subpixel orientation, and sets the contrast field to 0, and enables font antialiasing. In that order.

The code looks something like this (simplified for clarity):

DeleteRegistrySubkeys(Registry.LocalMachine, "Software\\Microsoft\\Avalon.Graphics");
DeleteRegistrySubkeys(Registry.CurrentUser, "Software\\Microsoft\\Avalon.Graphics");

User32.SystemParametersInfoW(SPI.SPI_SETFONTSMOOTHINGTYPE, 0, (uint)FontSmoothingType.ClearType, SPIF.SPIF_UPDATEINIFILE | SPIF.SPIF_SENDCHANGE);
User32.SystemParametersInfoW(SPI.SPI_SETFONTSMOOTHINGORIENTATION, 0, (uint)FontSmoothingOrientation.RGB, SPIF.SPIF_UPDATEINIFILE | SPIF.SPIF_SENDCHANGE);
User32.SystemParametersInfoW(SPI.SPI_SETFONTSMOOTHINGCONTRAST, 0, 0, SPIF.SPIF_UPDATEINIFILE | SPIF.SPIF_SENDCHANGE);
User32.SystemParametersInfoW(SPI.SPI_SETFONTSMOOTHING, true, IntPtr.Zero, SPIF.SPIF_UPDATEINIFILE | SPIF.SPIF_SENDCHANGE);

Actual code for reference:

https://github.com/bp2008/BetterClearTypeTuner/blob/master/BetterClearTypeTuner/MainForm.cs#L153
https://github.com/bp2008/BetterClearTypeTuner/blob/master/BetterClearTypeTuner/MainForm.cs#L106
https://github.com/bp2008/BetterClearTypeTuner/blob/master/BetterClearTypeTuner/MainForm.cs#L65