2007年12月16日星期日

SubpixelHinting

Disclaimer

The subpixel hinting implementation in freetype2 might infringe Microsoft's ClearType patents, which is why it is disabled both upstream (by the freetype2freetype2 RPM packages that ship with openSUSE. authors)

Target Distributions

Only works on openSUSE 10.2 or later -- on older openSUSE versions, it might create issues because the following instructions also upgrade to the latest freetype2 library.

How to enable subpixel hinting

Rebuild freetype2 with subpixel hinting

Note: the following commands must be executed using your regular non-root account

The following commands will download a source package for freetype2 and rebuild the binary RPMs with subpixel hinting enabled:

mkdir -p ~/download/freetype2

cd ~/download/freetype2 wget http://ftp.skynet.be/pub/suser-guru/rpm/experimental/packages/freetype2/src/freetype2-2.3.5-0.1.guru.suse102.src.rpm TARGET_OPT=`case \`uname -m\` in i*86) echo --target=i586;; esac`

rpmbuild --rebuild $TARGET_OPT --with subpixel freetype2-*.guru.suse*.src.rpm

At this point, there must be a lot of output, with rpmbuild building the source package. Note that rpmbuild might complain about missing dependencies (gcc, make, python, glibc-devel, autoconf, automake and libtool are required). If so, install the missing packages and run the two last lines again (TARGET_OPT=... and rpmbuild --rebuild ...).

When the build succeeds, you will end up with the binary freetype2 RPM packages in /usr/src/packages/RPMS/i586/ (32bit system) or /usr/src/packages/RPMS/x86_64/ (64bit system).

Upgrade to the subpixel hinting enabled freetype2 packages

Note: the following commands will require access to the root account (which means you have to know the password of the root user)

To upgrade to the subpixel hinting enabled freetype2 packages, do as follows:

su - rpm --freshen -hv /usr/src/packages/RPMS/*/freetype2-*.rpm

Note: after the first line (su -), you will be prompted for the password of the root user, which is necessary to upgrade the RPM packages

KDE Configuration

Note: the following commands must be executed using your regular non-root account

Note: the KDE Control Center application must be installed on your system (packages: kdelibs3 and kdebase3)

If you're using the KDE desktop or any KDE-based application, here is how to set up subpixel hinting for KDE:

  • start the KDE font configuration with the following command:
    kcmshell fonts
  • enable the checkbox "Use anti-aliasing for fonts"
  • click on the "Configure" button next to the above mentioned checkbox
  • enable the checkbox "Use sub-pixel hinting:"
  • select "Medium" or "Full" from the Hinting style: list (the best settings is both a matter of taste and depending on your monitor, try the different hinting style options to see what suits you best)
  • click the "OK" button
  • click the "OK" button

GNOME Configuration

Note: the following commands must be executed using your regular non-root account

Note: the GNOME Control Center application must be installed on your system (package: control-center2)

If you're using the GNOME desktop or any GNOME/GTK2-based application (e.g. Firefox), here is how to set up subpixel hinting for GNOME/GTK:

  • start the GNOME font configuration with the following command:
    gnome-font-properties
  • in the "Font Rendering" section, select "Subpixel smoothing (LCDs)"
  • click on the "Details..." button below the above mentioned option
  • in the "Smoothing" section, select the option "Subpixel (LCDs)"
  • in the "Hinting" section, select the option that suits you best (the best settings is both a matter of taste and depending on your monitor)
  • click the "Close" button
  • click the "Close" button

Firefox Configuration

Type in about:config in the address box and search for freetype. By double-clicking on a specific setting you can change it. Apply the changes in bold as shown below.

If you experience an issue with the font sizes search for dpi and set it to 0. This will make Firefox use only X's dpi value.

For even better experience it is recommended that you install dejavu-fonts-ttf from Package Sources/Guru (see Installing Software) and set Firefox to use them by opening up Edit -> Preferences -> Content -> in the Fonts & Colors box -> Advanced and setting them up as follows.