Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

large system fonts in win7 overrides gui font size?


  • Please log in to reply
6 replies to this topic
gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009

I've noticed in some of my old scripts with hard-coded font sizes for gui labels, windows 7 enlarges the fonts differently somehow and doesn't respect the hard coded size...

 

can anyone recommend a solution?

 

can be seen as a reported bug for EitherMouse:

http://www.autohotke...leftys-anymore/

and i can repeat it on a windows 7 machine, but i was hoping there was a modern solution i'm not aware of

 

thanks in advance

- gwarble



noticz
  • Members
  • 8 posts
  • Last active: Aug 09 2013 03:28 AM
  • Joined: 24 Apr 2012

I am not sure this will work but think it may. Give it a shot and let me know if it does work since I am curious and to lazy to change my font dpi :)

 

            RegRead, DPI_value, HKEY_CURRENT_USER, Control Panel\Desktop\WindowMetrics, AppliedDPI
            factor = % DPI_Value/DPI_Value*7 ; Font size here
            Gui, 1: font, cBlack  s%factor%, MS sans serif



gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009

thanks for the tip, i will try it out

so is font DPI a new feature after XP? when large fonts are used in XP the font size is adjusted, but i've never seen the font DPI being affected...

 

thanks

gwarble



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

there also might be a difference from using "Large Fonts" and using "125% (120 DPI)". i'm pretty sure those two are located in different spots on the control panel

 

i've always used 125% (120 DPI) even in Win XP, and most AHK Gui's were broken. i dont remember the font sizes being broken. more often it was a problem with the width of the textboxes and labels.



gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009

i think its the same problem i'm having... because the gui labels and things are hard coded for size... but the font is bigger than expected (even with hard coded font size) so the label size created for it is too small... so the text wraps or gets cut off (or both)

 

i still mostly use xp, but don't remember ever seeing a seperate font dpi from font size... under display settings

 

in win 7, on a laptop we have, it gives normal and "medium text" (125%) but never mentioned dpi from what i saw

 

- gwarble



guest3456
  • Members
  • 1704 posts
  • Last active: Nov 19 2015 11:58 AM
  • Joined: 10 Mar 2011

on win7, there is a slider in the Control Panel for "smaller 100%", "medium 125%", and "larger 150%"

 

on XP, the only way you could change the DPI was in the Display control panel -> Advanced

http://helpdeskgeek....-on-windows-xp/

 

 

 

there are a couple of different ways to get the DPI, and i'm not sure which one is the best, but i have been using the last one:

 

RegRead, AppliedDPI, HKEY_CURRENT_USER, Control Panel\Desktop\WindowMetrics, AppliedDPI
msgbox, %AppliedDPI%

RegRead, LogPixels, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontDPI, LogPixels
msgbox, %LogPixels%

msgbox, % DllCall("GetDeviceCaps", "uint", DllCall("GetDC", "uint", 0), "uint", LOGPIXELSX := 0x58)

msgbox, % DllCall("GetDeviceCaps", "uint", DllCall("GetDC", "uint", 0), "uint", LOGPIXELSY := 0x5A)

 

microsoft used the last ones in their example here as well:

http://msdn.microsof...0(v=vs.85).aspx

 

 

since i always use 120 DPI (125% scaling), i don't even worry about any of this. because any GUIs that i design are obviously gonna fit for 120 DPI, and then if someone is using 96 DPI (100% scaling), then they will still be able to read everything, my GUI will just be larger and more spacious than necessary.

 

but i would run into problems if someone was using 150%, but i havent had a complaint yet

 

 

heres an old thread with a solution though:

http://www.autohotke...chines/?p=77893



gwarble
  • Members
  • 624 posts
  • Last active: Aug 12 2016 07:49 PM
  • Joined: 23 May 2009

thanks for all the info... perfect...

 

i never noticed/used the DPI setting in XP (but i just tried it and it would be useful actually)...

 

interesting that MS decided the DPI was the default way to enlarge text in later versions...

 

anyway, i guess gui's should be designed with this in mind, something i've not considered in previous scripts

- gwarble