I need to enable/disable ClearType (or "Adjust the appearance and performance of Windows > Smooth edges of screen fonts") via cmd
(or any script like VBS/JS) or from the registry without logging out or restarting Windows.
Maybe it's possible to enable ClearType only for one application.
Click on Advanced display settings followed by ClearType text link at the bottom of the right panel. Step 4. On the screen that follows is where you can enable the option. Put a tickmark in the box that says Turn on ClearType and click on the Next button.
ClearType is enabled by default in Windows 7, 8, and 10. To turn ClearType on or off, you'll need to launch the ClearType Text Tuner.
Here's a PowerShell way to do it:
Set-ItemProperty 'HKCU:\Control Panel\Desktop\' -Name FontSmoothing -Value "2"
You'll need to log off and back on for it to take effect.
NOTE: strangely the setting doesn't show up as enabled in Performance Options, even though it's clearly turned on:
Just to add more options, I have the C# version, adding GetFontSmoothing to it.
[DllImport("user32.dll", SetLastError = true)]
static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni);
const uint SPI_GETFONTSMOOTHING = 74;
const uint SPI_SETFONTSMOOTHING = 75;
const uint SPI_UPDATEINI = 0x1;
const UInt32 SPIF_UPDATEINIFILE = 0x1;
private Boolean GetFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to get the font smoothing value. */
iResult = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, ref pv, 0);
if (pv > 0)
{
//pv > 0 means font smoothing is on.
return true;
}
else
{
//pv == 0 means font smoothing is off.
return false;
}
}
private void DisableFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to set the font smoothing value. */
iResult = SystemParametersInfo(SPI_SETFONTSMOOTHING, 0, ref pv, SPIF_UPDATEINIFILE);
Console.WriteLine("Disabled: {0}", iResult);
}
private void EnableFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to set the font smoothing value. */
iResult = SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, ref pv, SPIF_UPDATEINIFILE);
Console.WriteLine("Enabled: {0}", iResult);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With