Liberty BASIC Community Forum
« high dpi issues »

Welcome Guest. Please Login or Register.
Jul 26th, 2017, 05:53am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: high dpi issues  (Read 1514 times)
Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5293
xx Re: high dpi issues
« Reply #11 on: Aug 2nd, 2016, 3:41pm »

The function I posted is not a hack, it is the only way to reliably get the scaling factor from the DPI settings.
If it doesn't work for you, then you are not scaling every aspect of the window and its controls.
You need to scale not only the size, but also the position of windows and controls.
In addition you need to scale the fonts, but there is a problem if Windows doesn't find the correct size of the font and therefore uses an approximation, mostly it is the next bigger font.
You may want to create the scaling based on the dialog-base-units too, but I think I skipped that due to being more complex.
If you use a window of type dialog, the scaling is done by Windows and you don't have to scale as much as with a regular window type window, see http://basic.wikispaces.com/HelpSearch_Pendl_new
« Last Edit: Aug 2nd, 2016, 3:42pm by Stefan Pendl » User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #12 on: Aug 2nd, 2016, 5:04pm »

on Aug 2nd, 2016, 3:41pm, Stefan Pendl wrote:
The function I posted is not a hack, it is the only way to reliably get the scaling factor from the DPI settings.
If it doesn't work for you, then you are not scaling every aspect of the window and its controls.
You need to scale not only the size, but also the position of windows and controls.
In addition you need to scale the fonts, but there is a problem if Windows doesn't find the correct size of the font and therefore uses an approximation, mostly it is the next bigger font.
You may want to create the scaling based on the dialog-base-units too, but I think I skipped that due to being more complex.
If you use a window of type dialog, the scaling is done by Windows and you don't have to scale as much as with a regular window type window, see http://basic.wikispaces.com/HelpSearch_Pendl_new


Hi Steph.

I noticed here you are pinning the DPI to a maximum of 1.25 because you know about the issue with dialog windows? Am I correct?

GetScreenScaleForDialog = min(1.25, ScreenScaleTmp)

As soon as you go to 150% on a dialog (windows7) the text starts to get clipped.

But anyway there is a better solution IF WE WANT TO RELY ON WINDOWS. We can change all fonts in the program to pixels regardless of whether it's a dialog or window. That way a scan loop wouldn't be needed.

As an aside... if we do not want to rely on windows and do everything manually (which according to some comments (rumors) about windows 10 anniversary edition that just came out) because right now at 225% scale factor on windows 10 explorer buttons look readable but very big and ugly compared to non-microsoft apps. I suppose Microsoft will fix this... but I wonder if it has anything to do with LB dialog DPI problems?

Is dialog box units really that great compared to just changing the fonts to pixels? This is getting complicated! Are you talking about this?:

https://support.microsoft.com/en-us/kb/145994
User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #13 on: Aug 5th, 2016, 5:13pm »

on Aug 2nd, 2016, 08:37am, CarlGundel wrote:
Can you post a real simple example program? Not the scanning stuff, just of a window that doesn't scale well?

-Carl


I have isolated the bug more. If you use lucida_console it looks right at 150%. If you use ms_sans_serif at 150% it buggers up bad in dialog windows.

Do you still need a code snippet? I might post one anyway.
User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #14 on: Aug 11th, 2016, 10:18am »

Dear oh dear. I just saw lucida_console break (in a button) at 150% in dialog windows (on w7) too.

What hell.
« Last Edit: Aug 11th, 2016, 12:20pm by hooshnik » User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
CarlGundel
Administrator
ImageImageImageImageImage


member is offline

Avatar

author of Liberty BASIC


Homepage PM


Posts: 2830
xx Re: high dpi issues
« Reply #15 on: Aug 11th, 2016, 12:49pm »

on Aug 11th, 2016, 10:18am, hooshnik wrote:
Dear oh dear. I just saw lucida_console break (in a button) at 150% in dialog windows (on w7) too.

What hell.

What do you mean by break? Screenshot?

-Carl
User IP Logged

author of Liberty BASIC
http://www.libertybasic.com
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5366
xx Re: high dpi issues
« Reply #16 on: Aug 11th, 2016, 1:25pm »

I simply don't believe it, my PC works fine at 150% though I don't know why you would waste a perfectly good hires screen by running it at 150%.

Code would be good but we have asked for that before and it has never been offered.
User IP Logged

hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #17 on: Aug 11th, 2016, 2:56pm »

on Aug 2nd, 2016, 3:41pm, Stefan Pendl wrote:
In addition you need to scale the fonts, but there is a problem if Windows doesn't find the correct size of the font and therefore uses an approximation, mostly it is the next bigger font.


Ok buttons are displaying correctly. I was confusing some special code I had written for dynamic window generation and forgot to convert points to pixels.

However I am seeing the problem above that Stefan said. It is happening with ms_sans_serif and lucida_console with statictext. So really there is nothing new under the sun here.

What I will do is look at the dpi scale factor and somehow try to scale back the points if I see it getting high so that windows doesn't choose the next highest font. Why did Microsoft do that? Why didn't they pick the next lowest instead?!

As for what Rod said I don't understand. Some people have vision problems or they have to look at a monitor that is far away. That's the whole point of magnifying things. I have a monitor myself that is 25.5" and goes to 1920x1200. At the resolution I can't read a damn thing if I use applications at 96 DPI. I end up bumping down the resolution to 1680x1050 on linux as DPI support on linux is behind compared to windows.

Rod do you mean give the user the option of changing the DPI or not for only the program? Also about posting that code. I was asked once yes, but the situation changed. Do you still want me to post the code in light of what Stefan and I have just confirmed?
User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #18 on: Aug 11th, 2016, 3:11pm »

I have a WIP dialog window showing the (known) problem with the fonts. Using "font lucida_console 12"

100%
User Image

150%
User Image
« Last Edit: Aug 11th, 2016, 5:03pm by hooshnik » User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5293
xx Re: high dpi issues
« Reply #19 on: Aug 13th, 2016, 06:03am »

Are you using "font lucida_console 18" for 150%?

I was not aware of any problem with 150%, the program was just written on a screen with 125%, if I remember correctly.
« Last Edit: Aug 13th, 2016, 06:08am by Stefan Pendl » User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
hooshnik
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 105
xx Re: high dpi issues
« Reply #20 on: Aug 15th, 2016, 09:23am »

on Aug 13th, 2016, 06:03am, Stefan Pendl wrote:
Are you using "font lucida_console 18" for 150%?

I was not aware of any problem with 150%, the program was just written on a screen with 125%, if I remember correctly.


I don't know what you mean lol. I went and modified the screenshot window with the font I was using but I did it before you posted this. Are you saying to just avoid point sizes that cause this problem with type dialog?

In other news I have decided to dump the idea of using dialog windows everywhere. I will leave it up to the reader to draw their own conclusions.
User IP Logged

looking for file "include" support? Check out Aplomb Scribe http://libertybasic.conforums.com/index.cgi?action=display&board=open&num=1434746448
Stefan Pendl
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Computers are like babies, you must teach them what you like them to do ...


Homepage PM

Gender: Male
Posts: 5293
xx Re: high dpi issues
« Reply #21 on: Sep 3rd, 2016, 05:01am »

Dialog type windows are always scaling text and controls correctly on their own, which is done by Windows automatically for these types of windows.
You only need to scale content of any other window type.
The exception is graphics, which must be scaled in any type of window, despite of being a dialog type or not.
User IP Logged

Stefan

Make sure to read and follow the Forum Guidelines

Liberty BASIC Pro 4.04, Windows 10 Professional x64, Intel Core i7-4710MQ 2.5GHz, 16GB RAM
Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5366
xx Re: high dpi issues
« Reply #22 on: Oct 23rd, 2016, 07:50am »

Having reread this a couple of times I think the problem is that when scaling, Windows "may" replace the chosen font with one of a larger size than you would expect. So the answer is to allow some white space for this to happen. So make the buttons and controls a little wider than you would normally. Perhaps some fonts will scale better than others.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls