New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blured fonts on Windows with scale setting #213

Open
vatavale opened this Issue Mar 31, 2018 · 30 comments

Comments

Projects
None yet
10 participants
@vatavale

vatavale commented Mar 31, 2018

Current behavior

Fonts are blured on Windows systems (with high resolustion screens) with font scale settings.

Expected behavior

Sharp fonts with any scale factor in Windows settings.

Possible solution

With scale 100% fonts are too small on hires displays.

  • HeidiSQL version:
    9.5.0.5264
  • Operating system:
    Windows 10
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 1, 2018

HeidiSQL has to be DPI aware to avoid this scaling done by Windows. This is not possible with Delphi XE5. I already tried to pretend HS were DPI aware, in build 5078, but that only revealed a lot of problems HeidiSQL has. See also this forum thread: https://www.heidisql.com/forum.php?t=21287

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 1, 2018

This screenshot is a good overall review of the issues introduced when scaling with pretending DPI awareness:
grafik

@crewone

This comment has been minimized.

crewone commented Apr 5, 2018

This gets my vote. With high dpi laptops and monitors being more common and almost common these days, it would be important to be high-dpi aware. I for one have stopped using HeidiSQL after I got 4K screens because of this.

The fact that this has been an issue for over 2 years now makes this even more important.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 5, 2018

Well it's still not fixable yet, due to the above mentioned scaling problems of the underlying Delphi XE5 library. Look at the above screenshot. I have no clue how to fix that.

@Andrzej-W

This comment has been minimized.

Andrzej-W commented Apr 6, 2018

According to this page:
https://www.embarcadero.com/products/rad-studio/whats-new-in-10-2-tokyo
you have to buy new Delphi to have support for HighDPI screens in VCL library.

@energizer77

This comment has been minimized.

energizer77 commented Apr 10, 2018

For me this helped:
Go to the heidisql.exe file => Properties => Compatibility => Check "Override high DPI scaling behaviour" and selecting "System (Enhanced)"

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 10, 2018

@energizer77 could you please post a screenshot of HeidiSQL, how that looks like with that "enhanced" setting?

@vatavale

This comment has been minimized.

vatavale commented Apr 10, 2018

@energizer77 Wow! Thank you! It's not perfect sharp and smooth, but it's for sure better than nothing.

@energizer77

This comment has been minimized.

energizer77 commented Apr 10, 2018

3200 x 1800 with 175% zoom
heididpicomp

Left is with DPI system enhancement, right is without.
For me it looks a bit more sharp.

EDIT: I don't know if the upload is compressed but it seems less easy to see than on actual screen.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 10, 2018

Nice finding!

I also just see that the free Lazarus IDE has a "Hi-DPI" project setting. So, buying a new expensive Delphi license does not seem to be the only alternative.
grafik

@energizer77

This comment has been minimized.

energizer77 commented Apr 13, 2018

Just to come back to this, I actually switched to "Application" in the Override high DPI scaling behaviour, seems the best quality, and also my query editor seemed to become unresponsive/not updating with the "System (Enhanced)" setting.
Was working fine before so I checked with previous versions of HeidiSQL but same problem, so I suspect there was a recent change in Windows' override behaviour.

EDIT: now if I move HeidiSQL to a low-res screen everything is huge, and scaling seems messed up, so there is no perfect option for the moment, might be interesting trying out Lazarus IDE.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Apr 18, 2018

Yes, just keep in mind that the Lazarus idea requires an entire rewrite of the whole HeidiSQL code. This won't be part of this particular ticket. Even I'm very unsure if I shall do that at all, due to very few time. But it's a very cool idea, as this would solve some other problems as well, and HeidiSQL would run natively on Linux and Mac finally.

@glen-84

This comment has been minimized.

glen-84 commented Apr 21, 2018

@ansgarbecker,

Are you able to build HeidiSQL on a trial of the latest version of Delphi, to see if there are any improvements?

The quality is perfect when the application takes care of scaling, but I suppose it has to be updated to use scalable fonts, high-resolution icons, updated GUI components that understand pixel ratios, etc.

@danieldjewell

This comment has been minimized.

danieldjewell commented Jun 28, 2018

As of HeidiSQL Build 9.5.0.5280 with Windows 10 (1803 // 17134.112), the DPI scaling appears to be working? I can move an active instance of the program between 2 monitors with different Zoom % set (different DPI) and the program automatically readjusts. This is with the Windows DPI settings completely turned off (e.g. the application compatibility dialog has nothing checked.)

I'm moving the app between a 27" desk monitor (2560x1440 resolution at 100% zoom) and my 15" laptop monitor (4K / 3840x2160 resolution and 175% zoom set).

From my point, the only thing that remains a challenge is the font in the SQL Log (at the bottom) and the SQL Editor - there is not an option to enable ClearType or Antialiasing (e.g. as in PuTTY and/or Sublime Text).

This appears to be the same for general UI fonts - (which might be related to an actual DPI scaling problem.) On a display with 100% zoom set (96 dpi on Windows), the display fonts for the entire UI look good (with the exception of a few font options for the editor). However, after moving to the 175% zoom display, the UI fonts are indeed blurry - which I would guess means that the UI isn't activating ClearType to do the necessary font antialiasing/hinting/sub-pixel rendering necessary to create a clear render on a 4K display).

@v7a

This comment has been minimized.

v7a commented Jul 5, 2018

If you really plan to re-write the code for HeidiSQL, I would recommend switching to C++ and Qt. I suppose Qt even supports all drivers HeidiSQL supports now and can easily be extended by registering custom ones. I'd be willing to help!

@danieldjewell

This comment has been minimized.

danieldjewell commented Jul 10, 2018

@v7a If you (collectively) do decide to rewrite like that, we'll need to setup a beer savings account or something. Given the complexity already, that would be a massive undertaking.

I just looked up a new Delphi/RAD Studio 10.2 License from Embarcadero... I was shocked. $2000 - 5000 USD. As @Andrzej-W pointed out - the newer version have HiDPI support. It's a real shame but that's the way it is.

Maybe we (users of HeidiSQL) can get together and get the money to buy @ansgarbecker the new version? I mean, yeah, it's a lot of money ... but this is not going to be a problem that (a) solves itself or (b) is going away any time soon - high resolution and high DPI displays are just going to become more common.

@jamesvl

This comment has been minimized.

jamesvl commented Sep 10, 2018

Seems like the free Lazarus IDE 1.8.x has gotten better support for compiling High DPI aware applications: http://wiki.lazarus.freepascal.org/High_DPI#High_DPI_in_Lazarus_1.8_and_above

Any chance we could get some builds with those settings enabled? I'm sure we'd love to test it out.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Sep 30, 2018

Heidi is written in Delphi XE5, not Lazarus. Probably I should migrate to Lazarus at some point. But I fear all the effort and new bugs this involves.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 18, 2018

I just installed a trial of Embarcadero Rad Studio 10 on a virtual machine, to check whether it has some solutions to the above mentioned issues. And it indeed has some!
See the screenshot for some critical components which draw wrong in the current HeidiSQL, in high-dpi mode.
rx10-sample-program

We have

  • high dpi: fixed height of menu items with 16x16px icons
  • high dpi: fixed size of toolbar buttons with the same icons
  • even various themes are available (screen shows the "carbon" theme). See #8

Probably I should really buy a license.
*Edit: current price for Delphi 10.2 Professional: 1719€
*Edit2: for HeidiSQL as a non-commercial projects I can use the Community Edition for free, which has the same features as the Pro version

By the way, I also gave Lazarus another chance, yesterday, while trying to convert the basic components to Lazarus packages, and/or by finding replacements. This is all a mess - outdated packages, no clear documentation on them, and many VCL units without usable LCL replacement. Means a lot of conversion work, which I am not willing to spend to much time on.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 19, 2018

Next step for me is to load Heidi sources into that trial version of RAD Studio 10, and to compile the project. We will see how that looks like. Ugh...

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 19, 2018

Here we go - HeidiSQL compiled with Rad Studio 10.2, Carbon Style selected, and Windows set to 150% (high dpi):

Fixed:

  • toolbar buttons and icons
  • database and table filter boxes
  • height of main menu items (see second screen)

New issues:

  • style related: lightgrey column background (custom code, easy to fix)
  • dpi related: many non-scaled controls, like the search box at the bottom. Probably missing "Scaled" properties to be set, not sure.
  • style related: Broken main menu items (not in the screen). Items are invisible but preserve space.

tokyo-carbon-database-highdpi

tokyo-windows-mainmenu-highdpi

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 23, 2018

Quite useful article and comments here: http://zarko-gajic.iz.hr/delphi-high-dpi-road-ensuring-your-ui-looks-correctly/

Also, I see that Screen.PixelsPerInch is always 96 for me, while Monitor.PixelsPerInch reflects the scale factor set by the user (e.g. 100%, 125%, ...)

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 23, 2018

Here's an issue report regarding controls on a pagecontrol, scaled right out of the tabsheet when switching to higher DPI setting: https://quality.embarcadero.com/browse/RSP-15365
High DPI scaling in Delphi is still broken in various places.

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 23, 2018

I spent some time on dpi scaling and committed relevant fixes for HeidiSQL. Don't expect wonders for now, there are still quite a few things to fix in the nightly builds. But I think I am on the right way this time.

ansgarbecker added a commit that referenced this issue Oct 24, 2018

ansgarbecker added a commit that referenced this issue Oct 24, 2018

Issue #213: remove no longer required code for scaling the status bar…
… on the main window, which is now done automatically somewhere in Delphi's VCL

ansgarbecker added a commit that referenced this issue Oct 24, 2018

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 24, 2018

Fixed today:

  • dimensions of status bar panels
  • size of various blue link-labels
  • upscale icons (ugly but hey)

Still broken in high dpi mode:

  • various controls on the right side of the session manager are scaled right out off the form
  • row height in table editor / columns list
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Oct 25, 2018

Also broken:

  • rows in right-sided helpers panel on any query tab are too small
  • table designer has very huge and misaligned controls, probably 2x scaled? => double-scaling fixed
  • font scaled too large in > 100% dpi. Have to adjust the scaling factor, or scale font.height instead of font.size probably. => done
  • table designer still has various messed up controls, partly out of screen (save button), or non-anchored edit controls
  • same goes for routine editor
  • same goes for preferences dialog
  • same goes for table tools dialog
  • find a more smooth image upscale logic
  • save/cancel buttons on table editor mostly off-screen (#380)

ansgarbecker added a commit that referenced this issue Oct 25, 2018

Issue #213: Assign system or custom font once, to the application, an…
…d let all forms inherit that font, so there is no need to call InheritFont() for each form.

@ansgarbecker ansgarbecker added this to the v9.6 milestone Oct 31, 2018

ansgarbecker added a commit that referenced this issue Nov 1, 2018

ansgarbecker added a commit that referenced this issue Nov 3, 2018

Issue #213: smoothly scale main image list for high-dpi mode, using a…
… method from an old snippet, written for the old PNGDelphi component

ansgarbecker added a commit that referenced this issue Nov 4, 2018

Issue #213: tweak TreeOptions.AutoOptions of query helpers tree, so t…
…he tree nodes have more height in high-dpi mode (toAutoScale=false, toAutoSort=true)
@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Nov 4, 2018

Any more issues in high DPI mode with HeidiSQL? Apart from unsupported different DPI settings on multiple monitors (#378).

@energizer77

This comment has been minimized.

energizer77 commented Nov 4, 2018

Wanted to try, but for me it hangs right after startup, tested previous versions and last I can run is 5321

Bug report:

date/time          : 2018-11-04, 22:51:44, 816ms
registered owner   : Windows User
operating system   : Windows 10 Tablet PC x64 build 17134
system language    : English
system up time     : 21 days
program up time    : 917 milliseconds
processors         : 8x Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
physical memory    : 6241/16112 MB (free/total)
free disk space    : (C:) 253.57 GB
display mode       : 1829x1029, 32 bit
process id         : $8430
allocated memory   : 77.96 MB
largest free block : 131025.96 GB
executable         : heidisql.exe
exec. date/time    : 2018-11-04 22:43
version            : 9.5.0.5325
compiled with      : Delphi 10.2 Tokyo
madExcept version  : 4.0.20
callstack crc      : $b251e01a, $96cc2c21, $96cc2c21
exception number   : 1
exception class    : EAccessViolation
exception message  : Access violation at address 00000000009B6674 in module 'heidisql.exe'. Read of address 0000000004FBFFD2.

main thread ($11414):
009b6674 heidisql.exe apphelpers 3089 +34 ResizePngImage
009b6059 heidisql.exe apphelpers 2967 +18 ScaleImageList
00d70c24 heidisql.exe Main       1600 +11 TMainForm.FormCreate
0080e9f3 heidisql.exe Vcl.Forms           TCustomForm.DoCreate
0080e249 heidisql.exe Vcl.Forms           TCustomForm.Create
0081ec36 heidisql.exe Vcl.Forms           TApplication.CreateForm
00db8409 heidisql.exe heidisql     80 +21 initialization
7ffec1c3 KERNEL32.DLL                     BaseThreadInitThunk
7ffec255 ntdll.dll                        RtlUserThreadStart
@fifonik

This comment has been minimized.

fifonik commented Nov 5, 2018

Any more issues in high DPI mode with HeidiSQL?

Yup. Crash popup is still have blured font :)

@ansgarbecker

This comment has been minimized.

Collaborator

ansgarbecker commented Nov 5, 2018

Ok, that crash should be fixed with the latest build now. But now the icons are slightly cut at the right and bottom edges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment