[Cross-posted to the plib list, as this isn't entirely FlightGear
 specific.  Dunno if that list allows posts from non-subscribers or
 not.]

The recent discussion about fonts got me interested in actually trying
something, so I put together a perl utility that generates an
antialiased Glut .txf font from any font that can be rendered in
Postscript.  It's worked out really well, so I generated .txf files
for 33 standard postscript fonts (no Symbol or Dingbats, since those
don't have ASCII encodings) and put them up with previewable images
at:

   http://www.plausible.org/glut-fonts/

   [Note: please be gentle with my cable modem and don't wget the
    whole page -- that's 2M of data or so and it will hose my 128kbps
    upload cap.  Just look at the images and grab a few fonts that you
    intend to use.  Or if you must grab everything at least mirror it
    somewhere. :)]

I'm really happy with them.  Things that make them better than
existing fonts:

+ They are complete.  Each one has glyphs rendered for every printable
  ASCII character.  No more property confusion from different strings
  rendering identically due to missing glyphs.  This alone is enough
  to make them worth the price of admission. :)

+ There is no reason in principle that other encodings (Latin-1, for
  example) couldn't be used instead.  I was too lazy to look up the
  postscript glyph name to character ID mapping.  The layout code
  doesn't care how many glyphs there are.

+ They are rendered and antialiased from vector descriptions, instead
  of being pixel-for-pixel copies of X11 screen fonts.  So they look a
  lot better under most conditions (at very small sizes the difference
  is negligible as mipmapping does the antialiasing for you).

+ They have more space around the glyphs.  Mark's program packed the
  glyphs too tightly togther; at small sizes, you could see "bleeding"
  in the textures from nearby characters.

+ They make better use of space in general. The characters are drawn
  as large as practical for simple layout code (i.e., I scale them up,
  but don't do any gymnastics like recursive packing or
  non-rectangular layout).  So you get more font for your texture
  byte.  Most of the existing plib fonts use only about half of the
  available texture space.

+ They're professional fonts.  I don't know where "typewriter.txf"
  came from, but it's awfully ugly.  I replaced it with the
  antialiased Helvetica, and things look *so* much nicer.  The
  specific fonts used are the freely available URW fonts distributed
  with Ghostscript (and every Linux distribution), in case anyone is
  worried about the legality of redistributing font images.

Stuff that isn't ideal:

+ They're stored as 8 bit gray scale images instead of bitmaps, which
  means that the files are significantly larger.  The texture memory
  footprint is the same, however.

+ There's a bug in plib.  The .txf format allows you to specify a
  logical "step" size (distance to the start of the next character)
  for each character, but plib ignores it.  Instead, it uses the
  *physical* width of the character's bounding box, which isn't the
  same thing.  Due to integer rounding errors at pixel boundaries,
  this means that some characters in some fonts get clipped at their
  edges because I can't pad the box size horizontally (I do pad it
  vertically).  It also means that italic fonts (whose bounding boxes
  slant and thus pack together more tightly than their widths would
  indicate) tend to render badly in plib in general.  I'll see about
  getting a patch to the plib folks for this.  For most of the fonts,
  it's a minor issue.

Anyway, try them out and have fun.  Just copy "Helvetica.txf" on top
of "typewriter.txf" in the Fonts directory of your base package.  I
won't check this change in because of naming -- Helvetica isn't
monospaced, and shouldn't be called typewriter.  The right thing to do
would be to propertize/unhardcode the default font in the GUI code.

The perl/postscript code is available too, if anyone wants to try
generating their own font files.  Be warned that it's a classic duct
tape job, which expects to run on a reasonably recent Linux
distribution and find ghostscript and

Andy

-- 
Andrew J. Ross                NextBus Information Systems
Senior Software Engineer      Emeryville, CA
[EMAIL PROTECTED]              http://www.nextbus.com
"Men go crazy in conflagrations.  They only get better one by one."
 - Sting (misquoted)


_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to