Prosthetic Conscience
Jason McBrayer's weblog; occasional personal notes and commentary
Wed, 19 Apr 2006
Getting the best font rendering possible on Fedora Core 5
Every time I upgrade between FC versions, the freetype library gets updated. Because Fedora doesn’t ship freetype with the bytecode interpreter enabled (for patent reasons), getting the best out of your fonts may require some changes. This time, rather than just recompiling the freetype RPM, I messed around a bit more with font rendering, and came to some conclusions.
If all your apps use XFT/Fontconfig
There are three hinting methods available in Fontconfig: none, bytecode interpreter, and auto-hinter. The bytecode interpreter would normally be the default, but Fedora compiles it out. However, the autohinter does a very good job, as long as your fonts are antialiased. Most people will use antialiased fonts whenever they can, and there are relatively few apps still in wide use that do not support antialiased fonts. If this is the case for you, you don’t need to install a new freetype library. Just turn on autohinting by adding this to /etc/fonts/local.conf:
<!– Use the Autohinter –> <match target="pattern"> <edit name="autohint" mode="assign"> <bool>true</bool> </edit> </match>
If some of your apps use X core fonts
The above isn’t good enough for me, unfortunately, because I still use some apps that use X core fonts (not antialiased). Well, only one, actually — GNU Emacs. While the auto-hinter is plenty good for antialiased fonts, it doesn’t provide the pixel-perfect hinting that you really need to work with non-antialiased fonts. Straightforward to do:
- Download the freetype SRPM from your local Fedora mirror.
- Install it, and change the first line in the spec file from
%define withoutbytecodeinterpreter 1
to %define withoutbytecodeinterpreter 0 - Rebuild from the spec file, and install the new RPMs.
Then you’ll need to restart xfs, and possibly restart X (‘xset fp rehash’ may or may not allow your programs to work).
Now make sure your core-font-using programs are using programs with good hinting, such as the Vera fonts or the MS Web Fonts. You should now have properly shaped, minimally jaggy non-antialiased fonts.
[ Posted: 20:12] | [ Category: /computing] | Permalink | Comments: 0 ]
A very useful patch to django
The photo gallery application I’m working with allows you to upload batches of photographs as zip files, to populate a gallery all at once. As it stands in django, this zipfile is temporarily held entirely in memory. For substantially large zipfiles, as one might expect to upload to a photogallery, this will drive memory usage up quite a bit. An example file I was testing from here actually OOM-ed on the little server I’m running it on. Even for a file that does not OOM, it may easily cause the FastCGI connection to time-out (and I imagine the consequences could be even worse in mod_python).
While looking for a solution, I found this patch, which solves the issue. Moderately large files are processed reasonably quickly now, and server memory usage is much closer to what would normally be expected.
Consider this a vote for inclusion of this patch in trunk.
[ Posted: 15:43] | [ Category: /computing/django] | Permalink | Comments: 0 ]
Powered by PyBlosxom
Subscribe