Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2017-02

Detecting anomalous DPI

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mark Morgan Lloyd

I've just been rereading the recent discussion on Hi-DPI, and the relevant bits of the Wiki.

I've got a user with eyesight problems, who put a 48" TV on his desk as a monitor to a Linux system with KDE. Then he set the "Force fonts DPI" setting to something like 200, this increases the text size enormously but- obviously- messes up layout.

Is there any way that a standard application can pick up that an anomalous setting is being used? Screen.PixelsPer Inch is still 96, ditto for Screen.SystemFont.Pixels, Screen.SystemFont.Size is zero.

I'm not looking for a fix at this point, which I presume will be provided by the Hi-DPI support. But it would be very useful if a program could log the /actual/ DPI for support purposes.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Ondrej Pokorny
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
But it would be very useful if a program could log the /actual/ DPI for support purposes.

You have these properties: TScreen.PixelsPerInch and TMonitor.PixelsPerInch. You surely can log them.

Ondrej

Reply by email

Mark Morgan Lloyd
to Ondrej Pokorny
Ondrej Pokorny wrote 6 lines
On 25.02.2017 16:16, Mark Morgan Lloyd via Lazarus wrote:> But it would be very useful if a program could log the /actual/ DPI > for support purposes. You have these properties: TScreen.PixelsPerInch and TMonitor.PixelsPerInch. You surely can log them. Ondrej--

As I said in my original note, Screen.PixelsPerInch returns the nominal DPI not the override. I don't see TMonitor.PixelsPerInch documented.

So I've got a test system in front of me where the "Force fonts DPI" is set to 108 but Screen.PixelsPerInch still returns 96 as does GetDeviceCaps(dc, LOGPIXELSX).

The only thing I've found so far that does appear to vary predictably is the ascent and descent returned by GetTextMetrics, but I think that describes the fount that has been selected since it doesn't have a linear relationship to the DPI.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email