C++ Windows API - How to retrieve font scaling percentage

Viewed 753

I want to retrieve the "Make text bigger" percentage in C++ Windows API application. I know how to retrieve the scaling (DPI) factor, but I also want to include the font scaling percentage (see the attached image, the upper value, not the lower one).

Ultimately, I want to make application that preserves user font and DPI scaling settings in order to fully support accessibility features. Currently, the font is specified in .rc file like so

FONT 8, "MS Shell Dlg 2", 0, 0, 0x0

but even omitting the FONT statement, the font still does not change when changing "Make text bigger" setting.

enter image description here

1 Answers

For the "Make everything bigger" section, you can use GetScaleFactorForMonitor

Gets the scale factor of a specific monitor.

For the "Make text bigger" section, you can use a WinRT static property: UISettings.TextScaleFactor

Gets the value of the system text size setting.

Otherwise the latter can also be read using the TextScaleFactor DWORD attribute in the HKEY_CURRENT_USER\SOFTWARE\Microsoft\Accessibility registry key (but this is not officially documented).

Related