1. win32lib - is it possible to find out users font display size
- Posted by marky1124 Oct 16, 2015
- 1677 views
In Windows 7's control panel you can choose Appearance and Personalization and then Display. The choices are 'Smaller - 100%', 'Medium - 125% (default)' and 'Larger - 150%'. Is it possible through win32lib v0.70.04a to determine which of these the user has selected?
Cheers, Mark
2. Re: win32lib - is it possible to find out users font display size
- Posted by ghaberek (admin) Oct 16, 2015
- 1726 views
You can use queryDevice() with LOGPIXELSX and LOGPIXELSY to get the screen DPI.
- Small = 96 DPI
- Medium = 120 DPI
- Large = 144 DPI
include Win32Lib.ew sequence logpixelsx = queryDevice( Screen, LOGPIXELSX ) if length( logpixelsx ) = 1 then logpixelsx = sprintf( "LOGPIXELSX = %d", logpixelsx[1] ) end if sequence logpixelsy = queryDevice( Screen, LOGPIXELSY ) if length( logpixelsy ) = 1 then logpixelsy = sprintf( "LOGPIXELSY = %d", logpixelsy[1] ) end if constant Main = create( Window, "Screen DPI", 0, Default, Default, 360, 240, 0 ), LabelX = create( LText, logpixelsx, Main, 10, 10, 100, 20, 0 ), LabelY = create( LText, logpixelsy, Main, 10, 40, 100, 20, 0 ), $ WinMain( Main, Normal )
-Greg
3. Re: win32lib - is it possible to find out users font display size
- Posted by ne1uno Oct 16, 2015
- 1667 views
In Windows 7's control panel you can choose Appearance and Personalization and then Display. The choices are 'Smaller - 100%', 'Medium - 125% (default)' and 'Larger - 150%'. Is it possible through win32lib v0.70.04a to determine which of these the user has selected?
this is a great question, there is hardly any support in any of the toolkits to respect the user theme on colors, font, font size, positioning. in addition to font size, the DPI setting can be changed. not sure if this is what is changed in win7 Appearance.
so many programs I use have cut off text in status bars and dialogs because I have a higher DPI setting. even the programs like PSPad that now say they respect the DPI still have text too wide or too narrow but at least in PSPad it's not clipped off at the top of each character. other programs go extreme in the other direction with insanely tiny text and menu because they over compensate.
the internet browsers get it all wrong. complicated by CSS on each page wanting to set their own forced theme. there are some options and extensions to force minimum and maximum font sizes that just barely make things readable.
a test on as many systems as possible is still the best option, I always like programs more when they have a font size option, even better if they let you set font for other areas like menu and status dialogs. punt to the user at least recognizes that there could be preferences. newer toolkits make it easy to put a plus/minus font anywhere you would want them. probably an age/eye strain component. larger monitor, younger eyes don't really get the problem.
4. Re: win32lib - is it possible to find out users font display size
- Posted by ghaberek (admin) Oct 16, 2015
- 1646 views
this is a great question, there is hardly any support in any of the toolkits to respect the user theme on colors, font, font size, positioning. in addition to font size, the DPI setting can be changed. not sure if this is what is changed in win7 Appearance.
so many programs I use have cut off text in status bars and dialogs because I have a higher DPI setting. even the programs like PSPad that now say they respect the DPI still have text too wide or too narrow but at least in PSPad it's not clipped off at the top of each character. other programs go extreme in the other direction with insanely tiny text and menu because they over compensate.
the internet browsers get it all wrong. complicated by CSS on each page wanting to set their own forced theme. there are some options and extensions to force minimum and maximum font sizes that just barely make things readable.
a test on as many systems as possible is still the best option, I always like programs more when they have a font size option, even better if they let you set font for other areas like menu and status dialogs. punt to the user at least recognizes that there could be preferences. newer toolkits make it easy to put a plus/minus font anywhere you would want them. probably an age/eye strain component. larger monitor, younger eyes don't really get the problem.
This is where automatic sizers come into play. Once the font size is scaled to the current DPI, all controls are sized and aligned based on their relative "best fit size" based on the font.
wxEuphoria and EuGTK both support the concept of sizers. Win32Lib does not. IUP sort-of supports this. I'm not sure about other toolkits.
-Greg
5. Re: win32lib - is it possible to find out users font display size
- Posted by PeteE Oct 16, 2015
- 1693 views
You could call SystemParametersInfo with SPI_GETNONCLIENTMETRICS to fill a NONCLIENTMETRICS structure that has several LOGFONT structures with all the info you need.
I have a function here that shows how to use it.
6. Re: win32lib - is it possible to find out users font display size
- Posted by marky1124 Oct 19, 2015
- 1598 views
Thank you very much everyone for your answers. Your code examples are excellent. Thank you.