Re: [Lazarus] Controlling DPI
On Sun, Mar 29, 2009 at 4:17 PM, Hans-Peter Diettrich wrote: > > On KDE e.g. Firefox only allows to adjust the font size, and the font > sizes in HTML documents are application dependent, not expressed in > points. The text in the title bar etc. are not affected by such an > adjustment. If none of the above or variations thereof work, as a last resort, you can use the brute force method of forcing Mozilla to use a particular DPI directly. Edit your user.js file and add: user_pref("layout.css.dpi", 108); You may change the DPI number to any resolution you like. Setting it to 0 will restore Mozilla's use of the X Server DPI. Like prefs.js, user.js is a plain text file in your profile directory. If it doesn't exist, create it with your choice of text editor. As an alternative to editing user.js, you can change layout.css.dpi by entering about:config in the urlbar, right clicking the current value, and changing it to any number you like. == For more information on correctly setting your DPI system wide. http://www.mozilla.org/unix/dpi.html Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
David W Noon schrieb: > Specifically, the font engine uses the DPI provided by the video (or > printer) driver. In general: of the given Device Context (Windows: DC). >> 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. Most Microsoft languages (VB, VC...) scale all visual elements in "twips" (1/20 point), but the Delphi VCL uses pixels for everything but fonts. As long as the LCL is Delphi compatible, it must behave in the same way. >> 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. For pixel based output devices, the graphic system converts all units into pixels, based on the DPI value of the given device context. Then it depends on the actual device, how big the output will appear. At least on Windows a logical inch on the screen is larger than a physical inch, and the user can change that ratio by adjusting the DPI factor (accessibility option). > 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. The established font sizes are essential for print media. Computer monitors have such a poor resolution, that in most cases the font size has to be increased for readable output. When you measure the font height on a monitor, it typically will be larger than the given (point) size of the font. On my Linux system 10cm really are 11cm on screen, independent of the screen size and geometry. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
Graeme Geldenhuys schrieb: >> Changing the screen resolution, for one or more monitors, requires an >> restart of the graphics system (GDI, X11...), of course, because it >> affects the desktop and all windows on the monitor(s). > > In Gnome you can select the DPI and it will affect all Gnome based > applications - without a restart. Well, it can be a soft restart, where all affected elements of the screen are repositioned and repainted in the new scaling. > Firefox and Thunderbird also allow > you to select a specific DPI which then only applies to the > application. On KDE e.g. Firefox only allows to adjust the font size, and the font sizes in HTML documents are application dependent, not expressed in points. The text in the title bar etc. are not affected by such an adjustment. > But I think with all these, they simply take the real > screen dpi and calculate the zoom factor for the applications. > > All this is doable in FPC/Lazarus already. The OP asked *how* to do that. When it depends on the screen manager (Windows/KDE/Gnome...), the procedures may depend on the selected widgetset in Lazarus? DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
On Sat, Mar 28, 2009 at 8:17 PM, Hans-Peter Diettrich wrote: > > Changing the screen resolution, for one or more monitors, requires an > restart of the graphics system (GDI, X11...), of course, because it > affects the desktop and all windows on the monitor(s). In Gnome you can select the DPI and it will affect all Gnome based applications - without a restart. Firefox and Thunderbird also allow you to select a specific DPI which then only applies to the application. But I think with all these, they simply take the real screen dpi and calculate the zoom factor for the applications. All this is doable in FPC/Lazarus already. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
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.n...@ntlworld.com (David W Noon) === ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
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. 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. If you want to change that DPI factor, your application can scale the size of every used font accordingly. Please specify if you have something else in mind, like an zoom factor for *all* elements of your application. DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
Am Samstag, 28. März 2009 19:17:55 schrieb Hans-Peter Diettrich: > Changing the screen resolution, for one or more monitors, requires an > restart of the graphics system (GDI, X11...), of course, because it > affects the desktop and all windows on the monitor(s). > > DoDi Actual Distros use Randr (and Krandr for KDE) http://en.wikipedia.org/wiki/XRandR so no restart is needed ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
On Sat, 2009-03-28 at 19:17 +0100, Hans-Peter Diettrich wrote: > David W Noon schrieb: > > >> I prefer the latter, but the zoon factor can also do the trick. > > > > The DPI is controlled by the hardware driver for the video card. > > That's a matter of definition of "DPI". There is only one definition of DPI for any given device. Moreover, what you have written below isn't it -- for any device. > 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. There are approximately 72 pica points to an inch, regardless of the DPI of the device on which the text is being rendered. See: http://en.wikipedia.org/wiki/Pica_(unit_of_measure) [The pica has also been "Americanized" to be exactly 1/72nd of an inch within the computer industry, but the classic definition if picas/didots and ciceros does not fit easily in Imperial Measures.] -- Regards, Dave [RLU #314465] === david.w.n...@ntlworld.com (David W Noon) === ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
David W Noon schrieb: >> I prefer the latter, but the zoon factor can also do the trick. > > The DPI is controlled by the hardware driver for the video card. That's a matter of definition of "DPI". 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. > It > applies to the entire screen and cannot be changed for a particular > window on the screen. The only way to alter it is to restart the video > driver with different initialization parameters. [For a UNIX-like system > (e.g. Linux, FreeBSD), this means altering the X11 configuration and > restarting the X11 daemon.] Changing the screen resolution, for one or more monitors, requires an restart of the graphics system (GDI, X11...), of course, because it affects the desktop and all windows on the monitor(s). DoDi ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
On Sat, 2009-03-28 at 18:41 +0300, ik wrote: > > I prefer the latter, but the zoon factor can also do the trick. The DPI is controlled by the hardware driver for the video card. It applies to the entire screen and cannot be changed for a particular window on the screen. The only way to alter it is to restart the video driver with different initialization parameters. [For a UNIX-like system (e.g. Linux, FreeBSD), this means altering the X11 configuration and restarting the X11 daemon.] A zoom factor applies to an image, either pictorial or rendered text. You can do whatever you want with that within your application. -- Regards, Dave [RLU #314465] === david.w.n...@ntlworld.com (David W Noon) === ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
I prefer the latter, but the zoon factor can also do the trick. IDo On Sat, Mar 28, 2009 at 6:26 PM, Michael Van Canneyt wrote: > > > On Sat, 28 Mar 2009, ik wrote: > > > I would like to allow users to set their own DPI as they think it best > for > > them. > > A zoom factor or the actual DPI ? The former is possible, the latter I have > no idea how to do this. > > Michael. > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
On Sat, 28 Mar 2009, ik wrote: > I would like to allow users to set their own DPI as they think it best for > them. A zoom factor or the actual DPI ? The former is possible, the latter I have no idea how to do this. Michael. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
I would like to allow users to set their own DPI as they think it best for them. Ido On Sat, Mar 28, 2009 at 3:50 PM, Michael Van Canneyt wrote: > > > On Sat, 28 Mar 2009, Graeme Geldenhuys wrote: > > > 2009/3/28 ik : > > > > > > How can I control the DPI of a Lazarus based application regardless of > the > > > environment (gnome/kde etc..) DPI ? > > > > Umm, good question. I thought there was a Screen.DPI or > > Screen.DotsPerInch setting, but I can't find it. Maybe I'm getting > > confused with Kylix. > > it is > > Screen.PixelsPerInch > > But this is read-only. For the rest, the answer depends entirely on what > you want to do. > > Michael. > ___ > Lazarus mailing list > Lazarus@lazarus.freepascal.org > http://www.lazarus.freepascal.org/mailman/listinfo/lazarus > ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
On Sat, 28 Mar 2009, Graeme Geldenhuys wrote: > 2009/3/28 ik : > > > > How can I control the DPI of a Lazarus based application regardless of the > > environment (gnome/kde etc..) DPI ? > > Umm, good question. I thought there was a Screen.DPI or > Screen.DotsPerInch setting, but I can't find it. Maybe I'm getting > confused with Kylix. it is Screen.PixelsPerInch But this is read-only. For the rest, the answer depends entirely on what you want to do. Michael. ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Re: [Lazarus] Controlling DPI
2009/3/28 ik : > > How can I control the DPI of a Lazarus based application regardless of the > environment (gnome/kde etc..) DPI ? Umm, good question. I thought there was a Screen.DPI or Screen.DotsPerInch setting, but I can't find it. Maybe I'm getting confused with Kylix. Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
[Lazarus] Controlling DPI
Hello, How can I control the DPI of a Lazarus based application regardless of the environment (gnome/kde etc..) DPI ? Thanks, Ido ___ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus