Fonts as sharp as razors: Crux ports for -LCD patches

Edit: Unfortunately, the images originally included in this post are gone, because of hosting problems in late 2009. My apologies.

One of the things I always find amazing when I install Arch Linux is the patches for cairo, fontconfig and libxft that are specific to LCDs. Install those packages on a laptop, adjust the X settings to your hardware and it’s like you installed a new screen. Simply beautiful stuff.

Looking to mimic the same razor-sharp edges on my Crux system, I came up with three ports and hijacked two others, all of which I’ll duplicate here, just for future reference. I don’t maintain a Crux repository, so if you’re interested, you’ll have to copy-and-paste, manually update and then compile. But you might end up doing that anyway, so it probably won’t bother you.

Another over-exuberant thank-you to Colin Zheng, whose PKGBUILD2Pkgfile script was, once again, simply invaluable in this process. Two seconds and a brief edit, and these Pkgfiles were done.

Cairo-LCD.

# Description: Cairo vector graphics library (with custom LCD filter).
# URL: http://cairographics.org/
# Maintainer: 
# Depends on: libpng xorg-libxrender fontconfig xorg-libpixman xorg-libxcb pkg-config

name=cairo-lcd
version=1.8.0
release=1
source=(http://cairographics.org/releases/cairo-$version.tar.gz lcd-filter.patch)
build () 
{ 
    cd cairo-$version;
    patch -p1 < ../lcd-filter.patch || return 1;
    ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-xcb --disable-static || return 1;
    make || return 1;
    make DESTDIR=$PKG install || return 1
}

LibXft-LCD. I have my CHOST variable set to i686-pc-gnu-linux or whatever, but I don’t think it’s truly necessary for this. Let me know if I’m wrong and I’ll trim those parts out.

# Description: FreeType-based font drawing library for X (with custom LCD filter)
# URL: http://xorg.freedesktop.org/
# Maintainer: 
# Depends on: fontconfig xorg-libxrender pkg-config

name=libxft-lcd
version=2.1.11
release=1
source=(http://xorg.freedesktop.org//releases/individual/lib/libXft-$version.tar.bz2 libxft_export.diff xorg-lib-libXft-lcd-filter.patch)
build () 
{ 
    cd libXft-${version};
    patch -Np0 -i ../libxft_export.diff || return 1;
    patch -Np1 -i ../xorg-lib-libXft-lcd-filter.patch || return 1;
    ./configure --prefix=/usr --sysconfdir=/etc --build=${CHOST} --host=${CHOST};
    make || return 1;
    make DESTDIR=$PKG install || return 1
}

FontConfig-LCD.

# Description: A library for configuring and customizing font access (custom LCD filter).
# URL: http://www.fontconfig.org/release/
# Maintainer: 
# Depends on: fontconfig

name=fontconfig-lcd
version=2.6.0
release=1
source=(10-lcd-filter.conf)
build () 
{ 
    install -D -m644 10-lcd-filter.conf $PKG/etc/fonts/conf.avail/10-lcd-filter.conf || return 1
}

Note that Cairo-LCD depends on xcb-util, which in turn is dependent on gperf. Both of those I found in the mxq repository, and I’ll copy here, just in case that’s not available.

xcb-util.

# Description: number of libraries which sit on top of libxcb
# URL: http://xcb.freedesktop.org/
# Maintainer: Bartlomiej Palmowski, maks1k at wp dot pl
# Depends on: xorg-libxcb gperf

name=xcb-util
version=0.3.0
release=1
source=(http://${name/-util}.freedesktop.org/dist/$name-$version.tar.bz2)

build() {
    cd $name-$version
    ./configure --prefix=/usr --disable-static
    make
    make DESTDIR=$PKG install
}

gperf.

# Description: perfect hash function generator
# URL: http://www.gnu.org/software/gperf/
# Packager: Mattias Hedenskog <mattias@hedenskog.se>
# Maintainer: Bartlomiej Palmowski, maks1k at wp dot pl

name=gperf
version=3.0.3
release=1
source=(ftp://mirrors.kernel.org/gnu/$name/$name-$version.tar.gz)

build() {
    cd $name-$version
    ./configure --prefix=/usr \
        --mandir=/usr/man



    make
    make DESTDIR=$PKG install
    rm -rf $PKG/usr/share
}

Thanks to the real maintainer for those.

Oh, and how do they look, you ask?

That’s probably not a very good example. And the JPG conversion loses some quality. But it should give you an idea.

P.S.: Don’t forget to download the actual patches, probably from the Arch repositories, and include them in the port directory. Otherwise, these just plain won’t work. :mrgreen:

Edit: Here’s the LM Roman 10 at 10-point in Leafpad. The image doesn’t really look as good as what’s on my screen, and I seem to have the best luck with 9-point fonts, but this isn’t bad for a 96dpi 1600×1200 screen. In my own humble opinion, of course. 😉

5 thoughts on “Fonts as sharp as razors: Crux ports for -LCD patches

  1. Colin Zheng

    Hi kmandla,

    When I was using Arch, I was able to get xft+freetype to render the Latin Modern opentype fonts (almost) as perfectly as Xpdf renders Computer Modern.

    http://www.ctan.org/tex-archive/fonts/lm/fonts/opentype/public/lm/

    When I switched to CRUX, somehow, even after rebuilding patched libxft, freetype2 with BCI, etc, I could never get the same nice-looking result anymore.

    Since you have the patched versions, could you help me see how those odf fonts look on you X? (say lmroman10-regular.otf from that link)

    P.S it’ll be good to have Pkgfile for freetype with BCI enabled.
    P.P.S it’s good to see that the converter script is put to work

    Reply
  2. K.Mandla Post author

    I use that script all the time, Colin. Thanks a million for that. 😀

    I’ll tack a second screenshot on the post. I don’t think images are allowed in comments.

    Reply
  3. Colin Zheng

    🙂 glad to know, you are very welcome
    You could also email me the screenshot, when you have time for it. It’s not at all urgent for me

    Reply
  4. Colin Zheng

    Thanks, I saw it. Looks the same as what I had on CRUX though. Never mind, I’ve bid farewell to all serif fonts and anti-aliasing now. They simply look horrible on a 32″ LCD at the resolution of 1360×768, lol.

    Reply
  5. tkovacs

    On your menubar S and O are so smudged… same goes for all CAPS and then those ugly bastard combinations like “mp”, “na”, “BU”… (all on first ss, second is so ugly it hurt my eyes).

    I’ve never understood Linux haters whose main argument are smudged fonts (besides everyone has their own idea how fonts should look like), same goes for those LCD patches. Because I always had good results on Linux with a little tweaking and without BCI or any LCD patches. I belive good results can be made with what we have now (without any specialised patches) for linux desktop to look crisp.

    Nice little operation your have going on, cheers.

    Reply

Leave a comment