High DPI on Linux
lazarus / 32-Linux
----------------------------------------------------------------------
tk · 2014-07-10 15:02
Hi
do you know how to activate high DPI in Lazarus app on Linux?
http://wiki.lazarus.freepascal.org/High_DPI
This works on Windows but not on Linux.
Interesting is that the Lazarus program itself has bigger fonts on
Linux when I change DPI in KDE.
But I cannot achieve this in my program.
The program I write now is very often used by older ppl where bigger
fonts matter.
(true, those ppl use Windows in most cases)
I use Kubuntu v14.
Thanks
----------------------------------------------------------------------
marcov · 2014-07-10 15:31
Afaik that is for Windows only.
I don't know how deep such settings in KDE go, if its only for KDE
using apps, or for all QT apps, or for all X apps.
----------------------------------------------------------------------
tk · 2014-07-10 15:38
I think it is not finished in Lazarus yet.
When compiled under QT the app gets scaled but font size remains
small.
In GTK2 the app is the same as with default DPI.
Never mind, will use always default DPI on Linux.
----------------------------------------------------------------------
Rails · 2014-07-10 18:08
QT provides a tool called "QT Configuration" which can be used to set
such things as fonts and widgetry for those desktop applications using
QT. KDE has the equivalent built in AFAIK. For non QT desktops, the
configurator can usually be found in the distro's repositories. In my
experience, installing and using it can make a substantial impact on
how a QT app appears on a non-QT desktop. The package name will vary
between distros. For my Debian unstable system, it is currently named
qt4-qtconfig.
Edit:
Laz's graphics unit has a record that provides the actual monitor DPI
if it is reporting it via EDID and the OS is passing it on (not always
a sure bet).
Code: [Select] ScreenInfo.PixelsPerInchX
ScreenInfo.PixelsPerInchY
If the monitor isn't reporting it or the OS is not passing it on, you
will usually get 96 DPI. If the OS is not providing any DPI info at
all, Lazarus will return a default of 72 DPI.
The screen on the laptop I am writing this on returns 118 DPI to my
Laz application, which is accurate.
----------------------------------------------------------------------
JD · 2014-07-10 23:20
Quote from: tk on July 10, 2014, 05:38:10 pmI think it is not finished
in Lazarus yet.
When compiled under QT the app gets scaled but font size remains
small.
In GTK2 the app is the same as with default DPI.
Never mind, will use always default DPI on Linux.
That is the best thing to do. For instance your KGrid demos use Tahoma
fonts with size 8 & they look tiny in Linux (see screenshot GTK 2
Linux Cinnamon 17) but look OK in Windows. If you left it at default,
it will be displayed with system font size.
----------------------------------------------------------------------
tk · 2014-07-11 08:51
Thanks JD you are damn right!
The Tahoma font messed it up.
However, still I am not able to scale the form correctly in GTK2, in
QT it now runs like a charm!
The Tahoma font is default font in Delphi AFAIK and stored in the
forms. As you know I make the components cross IDE but it is true the
lfm files should contain default font.
This app I am writing now has common DFM files both for Lazarus and
Delphi (I need Delphi for Win because of missing alphacontrols in
Lazarus).
Delphi stores default font name. Delphi messes this up.
However, isn't it a bug that Lazarus does not scale custom fonts under
Linux?
Will probably deploy 2 binaries (QT and GTK2).
tk
----------------------------------------------------------------------
taazz · 2014-07-11 10:07
Quote from: tk on July 11, 2014, 10:51:28 am
However, isn't it a bug that Lazarus does not scale custom fonts under
Linux?
Will probably deploy 2 binaries (QT and GTK2).
no linux does not scale any fonts custom or otherwise it just uses the
default settings for the DM adn thats it it is a linux limitation not
a lazarus one.
----------------------------------------------------------------------
JD · 2014-07-11 15:52
Quote from: tk on July 11, 2014, 10:51:28 amHowever, isn't it a bug
that Lazarus does not scale custom fonts under Linux?
Will probably deploy 2 binaries (QT and GTK2).
tk
Fonts have always been my biggest issue with Linux. I'm never
satisfied with the way the fonts are rendered. So I spend time
tweaking configuration files anytime I change themes in Linux. I
actually edit the GTK configuation files by hand.
See
GTK+
https://wiki.archlinux.org/index.php/GTK+
Uniform Look for Qt and GTK Applications
https://wiki.archlinux.org/index.php/Uniform_Look_for_Qt_and_GTK_Appli
cations
GTK Fonts Are Too Big
http://superuser.com/questions/425018/gtk-fonts-are-too-big
How do I enlarge fonts for GTK applications?
http://superuser.com/questions/103022/how-do-i-enlarge-fonts-for-gtk-
applications?rq=1
JD
----------------------------------------------------------------------
Graeme · 2014-07-30 20:18
Quote from: JD on July 11, 2014, 05:52:08 pmFonts have always been my
biggest issue with Linux. I'm never satisfied with the way the fonts
are rendered.
Strange, I have the opposite experience again. My fonts under Linux
and FreeBSD look absolutely beautiful and sharp. Yet under Windows and
OSX (except on my MacBook Pro Retina) it looks fuzzy, fat and
generally crap.
I have a standard .fonts.conf file I use in my $HOME directory for
many years. See text pasted below. For me the key ingredient was the
hintstyle and lcdfilter setting.
Code: [Select]
~/.fonts
rgb
true
hintfull
lcddefault
Helvetica
Liberation
Sans
Verdana
Cursiva
Liberation
Sans
----------------------------------------------------------------------
Graeme · 2014-07-30 21:04
Quote from: taazz on July 11, 2014, 12:07:38 pmno linux does not scale
any fonts custom or otherwise it just uses the default settings for
the DM and thats it it is a linux limitation not a lazarus one.
I'm sorry, but that is total rubbish. GTK2 and QT4 can scale widgets
and fonts perfectly for lower or higher DPI settings. So too can the
fpGUI Toolkit (see a quick test I put together - original form was
designed at 96 dpi).
The bug is with LCL, not Linux, FreeBSD or any other X11 based system.
----------------------------------------------------------------------
JD · 2014-07-30 21:28
Thanks for sharing. How do I use this? Do I just put your .fonts.conf
file in my $HOME directory OR is there anything else I need to do?
BTW Even if I'm not totally satisfied with Linux fonts, it doesn't
stop me from using it extensively. My major work is done in Linux
nowadays using cross-platform software (Win/Linux) so that I can
switch easily if the need arises.
JD
Quote from: Graeme Geldenhuys on July 30, 2014, 10:18:43 pmQuote from:
JD on July 11, 2014, 05:52:08 pmFonts have always been my biggest
issue with Linux. I'm never satisfied with the way the fonts are
rendered.
Strange, I have the opposite experience again. My fonts under Linux
and FreeBSD look absolutely beautiful and sharp. Yet under Windows and
OSX (except on my MacBook Pro Retina) it looks fuzzy, fat and
generally crap.
I have a standard .fonts.conf file I use in my $HOME directory for
many years. See text pasted below. For me the key ingredient was the
hintstyle and lcdfilter setting.
Code: [Select]
~/.fonts
rgb
true
hintfull
lcddefault
Helvetica
Liberation
Sans
Verdana
Cursiva
Liberation
Sans
----------------------------------------------------------------------
Graeme · 2014-07-30 21:52
Quote from: JD on July 30, 2014, 11:28:00 pmThanks for sharing. How do
I use this? Do I just put your .fonts.conf file in my $HOME directory
OR is there anything else I need to do?
That's all there is to it! I can't remember if the effect is
immediate, or if you need to restart your apps, or the whole desktop
environment. I think it was immediate.
Optional:
You can then copy any extra fonts you want into the $HOME/.fonts/
directory, and your X11 will immediately see them. For example, I have
the MS Web Fonts copied in there, plus a few others I use. Liberation
Sans is also a very nice font - a good free Helvetica or Arial
replacement. I don't know if it already comes standard with Linux
distros or not - if not, it is in the package repositories and easy to
install.
----------------------------------------------------------------------
JD · 2014-07-31 10:07
The Liberation fonts are standard on most distros nowadays.
LibreOffice uses them as its default fonts even on Windows!
There is an even more comprehensive enhancement to the fonts.conf file
at
http://www.binarytides.com/gorgeous-looking-fonts-ubuntu-linux/ &
https://gist.github.com/silv3rm00n/5599072.
Alternatively, instead of saving the file as fonts.conf in the $HOME
directory one can save the file as ~/.config/.fontconfig/conf.d
JD
----------------------------------------------------------------------
Graeme · 2014-07-31 12:47
On my system (FreeBSD 10) the actual path is
$HOME/.config/fontconfig/fonts.conf but the $HOME/.fonts.conf still
works too. In fact, I made the $HOME/.fonts.conf a symbolic link to
the one in .config/ directory.
----------------------------------------------------------------------
JD · 2014-07-31 14:41
Quote from: Graeme Geldenhuys on July 31, 2014, 02:47:55 pmOn my
system (FreeBSD 10) the actual path is
$HOME/.config/fontconfig/fonts.conf but the $HOME/.fonts.conf still
works too. In fact, I made the $HOME/.fonts.conf a symbolic link to
the one in .config/ directory.
After doing all this (with a few hits & misses provoking reinstalling
my Linux system), I'm quite pleased with the results. It looks very
good now. Maybe not as good as on a Mac (the ultimate - in my opinion)
but for something free is more than worth it.
----------------------------------------------------------------------
Fred vS · 2014-07-31 16:07
Quote (with a few hits & misses provoking reinstalling my Linux
system)
Hum, you are welcome to share your solutions...
Thanks.