forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with text scaling under Windows 10

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
dgurok



Joined: 26 May 2011
Posts: 56

PostPosted: Mon Jul 29, 2019 2:18 pm    Post subject: Problem with text scaling under Windows 10 Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6037
Location: Salford, UK

PostPosted: Mon Jul 29, 2019 3:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
dgurok



Joined: 26 May 2011
Posts: 56

PostPosted: Mon Jul 29, 2019 3:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2042
Location: Yateley, Hants, UK

PostPosted: Mon Jul 29, 2019 4:14 pm    Post subject: Reply with quote

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
View user's profile Send private message
dgurok



Joined: 26 May 2011
Posts: 56

PostPosted: Wed Jul 31, 2019 10:09 am    Post subject: Reply with quote

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
View user's profile Send private message
dgurok



Joined: 26 May 2011
Posts: 56

PostPosted: Wed Jul 31, 2019 11:11 am    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6037
Location: Salford, UK

PostPosted: Wed Jul 31, 2019 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group