FEATURE: Forcing DPI setting for fonts

Simon Edwards simon at simonzone.com
Sun Sep 3 16:17:19 BST 2006


On Sunday 27 August 2006 11:31, Germain Garand wrote:
> I heard it does.. and some distributors add their own fixed Xft.dpi value in 
> Xresources files.

Kubuntu Dapper Drake fiddles with the DPI setting to improve font rendering. 
In practice it seems to work out quite well. Here are the details of what it 
does exactly for anyone interested:

############################################################################
# FixXorgDPI
# ==========
# The idea here is to ensure that applications use a sensible DPI setting
# for fonts. When Xorg starts up it tries to detect the size of the attached
# monitor and calculate the real DPI from there and use that. Problems are:
#
#   * if the monitor size can not be detect then Xorg uses 75dpi. This is
#     usually far too low.
#
#   * if the monitor size is not accurately detected then you get bad a DPI.
#
#   * most fonts are optimised to work at a handful of standard DPIs. 96dpi,
#     120dpi and printer resolution 300dpi and 600dpi. Fonts rendered in
#     non-standard DPIs often look bad and jagged. This is a real problem
#     when rendering fonts on low resolution devices. (i.e. a computer
#     monitor).
#
# Although it is desirable in theory to use the real DPI of the monitor, in
# practice it is more important to ensure that fonts are well rendered even
# if the DPI in use is not correct.
#
# What this function does is read the display size from the X server and
# if it is lower than 140dpi then 'round' it to either 96dpi or 120dpi.
# (A dpi greater or equal to 140 is assumed to be high enough to render fonts
# well.) The new dpi is then loaded with the xrdb command into the X server
# resource database. Most X applications (Qt and GTK apps at least) will then
# use this DPI for font rendering.
#

cheers,

-- 
Simon Edwards             | KDE-NL, Guidance tools, Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."




More information about the kde-core-devel mailing list