DzHTMLText icon indicating copy to clipboard operation
DzHTMLText copied to clipboard

Font.Size is wrong, in a per Monitor DPI environment

Open WeberAndre opened this issue 2 years ago • 1 comments

its quite good that your codes tries to utilizes Font.Size in points instead of Font.Height in pixels that lets expect to work with every DPI, but Delphi VCL TFont is a fool - this computes font.height from font.size with the DPI from Screen.PixelsPerInch of the current main monitor.
In my case the mainmonitor is a 4k @ 150%, and a secondary monitor ist 2k @ 100% - so if a form with your control is moved between these monitors the translation of font.Height contains the wrong result for every fs:## because the real text height is computed from Screen.PixelsPerInch instead of the controls FCurrentPPI. I think due this problem EMBA uses mostly TFont.Height for everything - because they know, that size isn't working well? So my Idea would be useing Height too - and translate fs:## to height useing FCurrentPPI from the Control.

WeberAndre avatar Mar 09 '22 15:03 WeberAndre

Hello

Can you please test this new feature?

Available at: https://github.com/digao-dalpiaz/DzHTMLText/tree/font-dpi

digao-dalpiaz avatar Mar 27 '22 19:03 digao-dalpiaz

I'm doing a new review on DPI support. VCL support is almost ready.

https://github.com/digao-dalpiaz/DzHTMLText/tree/dpi-support

digao-dalpiaz avatar Apr 10 '23 04:04 digao-dalpiaz

Done! Available in next version

digao-dalpiaz avatar Apr 11 '23 22:04 digao-dalpiaz