[Lazarus] Controlling DPI

David W Noon david.w.noon at ntlworld.com
Sun Mar 29 01:14:36 CET 2009


On Sat, 2009-03-28 at 23:30 +0100, Hans-Peter Diettrich wrote:

> David W Noon schrieb:
> 
> >> Windows allows to change the font size (DPI) at any time, and most other 
> >> systems have similar capabilities. Since Delphi has its roots in 
> >> Windows, this definition also should apply to FPC/Lazarus.
> > 
> > The *point size* of the font has nothing whatsoever to do with the DPI
> > of the screen or printer, other than the rendering engine querying the
> > DPI of the device in order to render the text to the appropriate size in
> > pica points.
> 
> Right. The application provides a font size, and the system translates 
> it into pixels, based on the Screen.DPI value.

Specifically, the font engine uses the DPI provided by the video (or
printer) driver. The application doesn't need to consider the DPI value,
as fonts are specified in points and the font engine renders them
appropriately. For example, a 12-point font should render to 1/6th of an
inch high, regardless of the device's DPI.

>  Pixel based sizes, as 
> used in the LCL for the origin and extent of the forms and controls, are 
> not affected by the DPI settings.

I am not sure about this. I think they could well be affected by DPI,
but the Lazarus developers could say for sure.

> If you want to change that DPI factor, your application can scale the 
> size of every used font accordingly.

No, this is wrong. The fonts do not need to be rescaled.

The point size required for a font to render to a particular size on
screen or paper is independent of the DPI of the device. Point sizes are
based on 1/72nd of an inch, regardless of how many device dots are in
that inch. It is the American inch (slightly larger than the traditional
Imperial inch, which it has largely supplanted) that is the defining
factor, and this is fixed.

> Please specify if you have something else in mind, like an zoom factor 
> for *all* elements of your application.

It's not my application, so I presume this is intended for the o.p.

-- 
Regards,

Dave  [RLU #314465]
=======================================================================
david.w.noon at ntlworld.com (David W Noon)
=======================================================================



More information about the Lazarus mailing list