Font Editor

More details

Renderer

Our Java font renderer uses two painting styles:
  • It can paint onto MemoryImageSource images;
  • It can generate Image objects, which can be rendered using Graphics.drawImage(...);
Painting onto MemoryImageSource images allows the greatest flexibility - and facilitates background blending.

However on some VMs there is a performance penalty for the double-buffering this necessitates (though on some VMs this sort of painting appears to be faster).

Generation of Image objects allows rendering onto generic Graphics objects. However, no background blending is possible there - unless details of the background can be obtained through other channels.

Font sources

If run under Java 2, the renderer can access the same range of TrueType fonts available to all Java applications.

Under other versions of Java, it renders fonts from a proprietary format - a format which can be derived automatically from TrueType fonts while running under Java 2.

This allows a very compact distribution format to be used (compared to the original fonts) - which reduces download times.

One of the disadvantages of doing this is that some fonts are copyrighted - and are distributed under licenses that do not permit redistribution of modified versions.

Eventually we hope to write a parser to extract the relevant tables directly from TrueType font files - bypassing the code in Java 2 that is currently used to performs this task.

Hinting

Good hinting is one of the most critical aspects of rendering fonts.

Currently our hinting is still in a relatively primitive state - and there is a great deal of room for improvement.

Hinting philosophy

Currently we do all our hinting based on the font outlines.

All other potential sources of hinting information are currently ignored.

Eventually, we hope to be able to take advantage of the hinting information present in TrueType fonts.

However there is no guarantee that such hinting will be present - so the ability to render straight from font outlines will always be important.

Limitations

There are some areas of the TrueType specification that we will probably not adhere to - at least not a considerable time.

In particular, a low-level graphics primitive that implements a non-zero winding fill rule is not available under many forms of Java. Before Java 2D, even/odd was the only winding rule available.

We may eventually write our own polygon-fill routine - but the distortions of the (few) fonts that rely on the details of the winding rule is likely to remain as a known problem for some time.

Acknowledgements

TrueType is a registered trademark of Apple Computer, Inc.
Java is a registered trademark of Sun Microsystems.
Sun Microsystems and Apple Computer are also a registered trademarks.


Tim Tyler | tim@tt1.org | http://fonteditor.org/