November 2005 Archives

2005-11-07

How to properly configure displayed fonts in Debian GNU/Linux

One may experience strange font sizes in X Window (e.g. “logically 8 point fonts” characters that are physically displayed at 15 points or more), or when printing. For instance, in KDE problems like those described in some KDE bug reports may appear.

The problem is that the precision of the display (in dpi) is not configured, which makes Wysiwyg display of fonts impossible. Actually, it appears that most GNU/Linux distributions do not configure the display precision, which seems to be set to 75 dpi by default. This must be configured by hand.

One must define the physical dimensions of the screen, in millimeters, by adding a DisplaySize entry in the "Monitor" section of the X11 server configuration file (/etc/X11/XF86Config-4 for the XFree86 server version 4, or /etc/X11/xorg.conf for the X.org server). For instance, the width of my IBM ThinkPad X31 is 246 mm, and its height is 185 mm (this is a 12 inch screen). Therefore, I have added the following line into my /etc/X11/xorg.conf file, in the "Monitor" section:

        DisplaySize     246 185

Depending on the screen resolution (e.g. 1024x768 dots or 800x600 dots, etc.), the precision of the display (in dpi) is automatically calculated by the X server. To get the resolution, execute:

> xdpyinfo | grep resolution

For example, for the IBM ThinkPad X31, the resolution for 1024x768 dots is 105x105 dpi (in that case, the precision is the same vertically and horizontally).

One still must configure the fontconfig system to set the resolution of fonts to display. This should be done by editing the /etc/fonts/local.conf file to add the following lines:

  <match target="pattern">
    <edit name="dpi" mode="assign"><double>105</double></edit>
  </match>

Alternatively, since in Debian GNU/Linux this configuration file is modularized, one can instead create a new file in /etc/fonts/conf.d, called for instance screen-dpi.conf, that contains the following lines:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match target="pattern">
    <edit name="dpi" mode="assign"><double>105</double></edit>
  </match>
</fontconfig>

And a symbolic link must be created to take that new configuration file into account:

> cd /etc/fonts/conf.d
> sudo ln -s screen-dpi.conf 10-screen-dpi.conf

Then, the X server must be restarted.

After configuring the X server as described above, one gets a real Wysiwyg display, e.g. 8 point fonts characters are actually displayed as pysically 8 point sized characters.


Posted by Romain Lenglet | Permanent Link | Categories: Debian GNU/Linux | Comments

2005-11-07

How to disable a plugin in NanoBlogger in Debian GNU/Linux

To disable a plugin in NanoBlogger version 3.2 one must rename the plugin script, e.g. tidy.sh, to modify its extension (by convention into .off).

In the nanoblogger Debian GNU/Linux package, plugins are installed in the /usr/share/nanoblogger/plugins/ directory. In order to enable/disable plugins, it is therefore necessary to rename files in that directory, e.g. for the tidy.sh plugin:

sudo mv /usr/share/nanoblogger/plugins/makepage/tidy.sh \
        /usr/share/nanoblogger/plugins/makepage/tidy.off

The problem with that method is that when the nanoblogger package is updated, the tidy.sh file is reinstalled in /usr/share/nanoblogger/plugins/makepage/ along with the tidy.off file, which re-enables the plugin. To make the renaming permanent accross package updates, one must use Debian's diversion mechanism:

sudo dpkg-divert --divert /usr/share/nanoblogger/plugins/makepage/tidy.off \
    --rename --add /usr/share/nanoblogger/plugins/makepage/tidy.sh

This renames the tidy.sh file into tidy.off, and in all subsequent updates of the package the new tidy.sh files will also be renamed automatically.

To re-enable the plugin, simply remove the diversion:

sudo dpkg-divert --divert /usr/share/nanoblogger/plugins/makepage/tidy.off \
    --rename --remove /usr/share/nanoblogger/plugins/makepage/tidy.sh

Posted by Romain Lenglet | Permanent Link | Categories: Web, Debian GNU/Linux | Comments