TTF to Subf font converter for Plan 9 -- provides antialiased fonts.


News:
4-May-2005: 23-Feb-2004: 13-Feb-2004:

This is a fairly simple port of the FreeType font engine for Plan 9. The port was done by Latchezar Ionkov and was slightly modified by Andrey Mirtchovski to add more friendliness.


Why?

We did this because we wanted antialiased fonts in Plan 9, because it'd be a nice side project and because it's easy! The most interesting part is the fact that to make it work in Plan 9 we didn't have to do anything in particular, besides creating images that looked reasonably like TrueType antialiased fonts -- everything else came as a bonus from the Plan 9 creators ensuring that the font subsystem in Plan 9 is simple and well designed (i.e. it did all the work for us).

ttf2subf works similar to bdf2subf, the only difference being that it uses the utilities provided by the FreeType library to generate Subfont images out of .ttf files.

The FreeType version used is 2.1.4.


Why is it better?

[skip long introduction to antialiased fonts]

It comes down to this: if you like antialiased fonts you'll be happy with this little utility program. If you don't -- you can still use the other font sets provided by Plan 9, or here.

Compare the same font, luximb from the XFree86 distribution, at size 50 generated as a mono (1-bit) font and as an antialiased one (nevermind the artifacts -- the screenshot was taken from drawterm):

(click to enlarge)


Why is it worse?

The main problem with the Plan 9 font system is that it doesn't generate images on the fly (which presumably would slow down the rendering of text even more) so one is required to store the same font over and over again for all different sizes that it uses.

Another problem we're seeing is the lack of support for subpixel fonts. Fortunately we may be able to do something about it. Stay tuned...


License:

There is a potential problem with using TTF fonts due to the patents and copyrights claimed over some of the algorithms used therein. Please read the relevant information provided on FreeType's site: http://www.freetype.org/patents.html


Download:

Warning: The code you're about to download is not 'production grade' material. It's written hastily and does the job only as much as we can say it works. In other words it's a hack. (Just now, as I write this, I found out that we'll crash if we can't find the font file, instead of retiring gracefully -- very likely nobody's going to fix this).

freetype-plan9.tgz -- the freetype package + ttf2subf. 1.1MB


Compilation Instructions:

Should be as simple as 'mk':

    % gunzip < freetype-plan9.tgz | tar xv
    % cd freetype-2.1.4
    % mk
    [gobbles of warnings you should not pay attention to]
    % mk install
    %
Note that the binary will be put in your $home/bin/$objtype directory. If you want to put it in the more common /$objtype/bin change BIN= in the mkfile.

"Documentation":

The options accepted by ttf2subf are:

    -h                              - print help message
    -s size                         - point size
    -f fname                        - ttf file name
    -n name                         - font name
    -m mono|antialias|subpixel      - rendering mode
    -r rgb|bgr|vrgb|vbgr            - LCD display type 

Using ttf2subf:

Here is a sample session with ttf2subf:

    % ttf2subf -s 14 -f somefont.ttf -n somefont -m antialias
    [some text]
    % cd somefont
    % font=somefont.14.font rio 
    [rio starts with new font]

Download ready-to-use fonts:


The fonts here are converted from /usr/X11R6/lib/X11/fonts/TTF and as such are covered by the XFree86 license, which is liberal enough to allow me to make the conversion and put them here, however it may not be liberal enough to let me add those fonts to the Plan 9 distribution.

Uncompress in /lib/font/bit, fonts will appear in/lib/font/bit/ttf.

It contains the following fonts in sizes 14 (if you need others feel free to use ttf2subf to create them):


Screenshots:

Click to enlarge:

Cyberbit.20.font (not included here):

LuxiMB.20.font:

LuxiSR.20.font:


Last Modified: May 4, 2004
mirtchovski at gmail