View previous topic :: View next topic |
Author |
Message |
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Mon Jul 29, 2019 2:18 pm Post subject: Problem with text scaling under Windows 10 |
|
|
Dear all,
normally for regognicing if a user uses a text scalling I have used method “CLEARWIN_INFO@( 'SYSTEM_FONT_HEIGHT' )” until now. It seems that under Windows 10 the function returns value 16 always. In this case I can’t distinguish if a text scallig is used or not.
Does someone have observed the same behavior and can tell me a workaround?
I work with FTN95 Ver. 7.10.0
Last edited by dgurok on Wed Jul 31, 2019 10:04 am; edited 1 time in total |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Jul 29, 2019 3:25 pm Post subject: |
|
|
The result of this call is based on a Windows API call to GetStockObject(SYSTEM_FONT). The Microsoft help says "By default, the system uses the system font to draw menus, dialog box controls, and text".
It also says: "It is not recommended that you employ this method to obtain the current font used by dialogs and windows. Instead, use the SystemParametersInfo function with the SPI_GETNONCLIENTMETRICS parameter to retrieve the current font."
Maybe I should add a new CLEARWIN_INFO@ value that uses the Microsoft recommended method of retrieving the current font. |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Mon Jul 29, 2019 3:38 pm Post subject: |
|
|
Next strange behavior:
My desktop resolution is 1920*1080. When Scalling is set to 125%
CLEARWIN_INFO@('SCREEN_WIDTH')
CLEARWIN_INFO@('SCREEN_DEPTH')
return a resulution 1536*864. Under Windows 7 I get resolution 1920*1080.
It looks for my like Windows 10 is using a complete different scalling mechanism? Like a zoom effect? |
|
Back to top |
|
|
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2388 Location: Yateley, Hants, UK
|
Posted: Mon Jul 29, 2019 4:14 pm Post subject: |
|
|
If you do the necessary research you will find that MS have been at work tinkering with this scaling business, to the confusion of all of us.
When you use the Clearwin+ method of spacing out controls as a function of the average character size, everything always fits - except things like icons and bitmaps in toolbars, which get weird spacing.
Those increased dpi settings are for physically small displays like tablets, and for very high dpi displays. Since windows tablets are utter rubbish, and high dpi displays - like electric cars - are there to let rich idiots look down their noses at us plebs, a good strategy is to sample the logical dpi, and if it isn't 96, to tell the would-be user that you don't support it!
Eddie |
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Wed Jul 31, 2019 10:09 am Post subject: |
|
|
I tried to use SPI_GETNONCLIENTMETRICS this way. Is that okay?:
Code: |
#include <windows.h>
#include <stdio.h>
#pragma comment(lib, "user32.lib")
void main()
{
BOOL fResult;
NONCLIENTMETRICS ncm;
fResult = SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
sizeof(NONCLIENTMETRICS),
&ncm,
0);
if( fResult )
{
}
}
|
Are the results good? I have no idea how I recognize scaling 125% is set...
|
|
Back to top |
|
|
dgurok
Joined: 26 May 2011 Posts: 66
|
Posted: Wed Jul 31, 2019 11:11 am Post subject: |
|
|
This solution provides the expected scaling result 100, 125, 150:
Code: | HDC desktopDc;
desktopDc = GetDC(NULL);
int virtualWidth = GetDeviceCaps(desktopDc, HORZRES);
int physicalWidth = GetDeviceCaps(desktopDc, DESKTOPHORZRES);
int dpi = (int)(96.0 * physicalWidth / virtualWidth);
int sf = 100.0 / 96.0 * dpi; |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Wed Jul 31, 2019 1:33 pm Post subject: |
|
|
dgurok
I had already looked at the first of your two approaches and it didn't seem to provide anything useful.
Your second approach looks more hopeful. |
|
Back to top |
|
|
|