I've finished the design and implementation of two libraries for using
fonts.
Fontconfig
Fontconfig is a new library designed to centralize the configuration,
customization and installation of fonts. It features an XML-based
configuration file so that GUI agents can readily edit the file without
incorporating a custom parser. This library uses FreeType to identify
available fonts, but there is no requirement that applications layered on
top use FreeType.
Fontconfig is entirely independent of X; the build process uses autoconf
to make it easier to incorporate into non-X environments. I will create
an Imakefile for fontconfig when I merge it into the XFree86 CVS
repository.
Fontconfig now computes the set of unicode chars encoded by each font and
saves that in the font information cache (fonts.cache). This can be used
to match fonts based on needed characters. I've proposed a change to the
Freetype library to speed this computation up; without the change, it can
take several minutes to build the database the first time an application
attempts to access fonts. I expect this change (or something similar)
will be incorporated into the standard Freetype distribution in the near
future.
I'm not wild about the name, if others have suggestions, they would be
welcome. Any such should be presented soon; names have a habit of being
hard to change after any significant passage of time.
Xft
Xft is largely compatible with the current version; in fact, applications
using only the XftDraw-level APIs will find it binary compatible. However,
the other API changes necesitate a major version number change.
Significant architectural improvements made it impossible to retain full
binary compatibility at the XftRender level -- the XftFontStruct object has
disappeared. Similarly, applications groping inside the XftFont object
will find that fields which should have been private are now missing.
I anticipate providing the existing Xft library for the next release of
XFree86 (at least) so that applications can have some time to migrate.
I may switch that version to using fontconfig as well so that at least the
configuration files will be shared; there's no barrier to doing so that I
know of.
All support for server-side fonts has been excised; Xft now provides only
client-side fonts using the FreeType library. This dramatically simplifies
application development using the library as all fonts have an underlying
FreeType object and related files. Xft provides support for legacy X
servers by drawing text using the core protocol if necessary. Anti-aliasing
performance is adequate for local connections, non-anti-aliased
performance is acceptable even over relatively slow network links.
Xft now limits memory consumption both locally and within the X server.
Locally, it limits the number of FreeType FT_Face objects that are mapped,
within the X server, it limits the memory used by glyphs by freeing some
when too many are loaded. When using client-side rendering, this same
mechanism frees the local glyph images. The memory parameters are tunable
through X resources. The replacement policy is random, weighted by the
size of each glyph.
Epilogue
Qt3 and Mozilla have both been ported to this new set of libraries; Chris
Blizzard did most of the Mozilla work so that may well show up in that
project at some point. I intend to work with Trolltech to get their
Qt3 sources updated as well.
There are still a few outstanding projects to work on -- I haven't yet
settled on a design for creating subsets of the available fonts to limit
the size of font dialogs, nor have I finished the design of a mechanism to
provide a stable set of fonts for applications needing to use more than
one to present a document containing many languages. For the former, I
need some input on how people want subsets to work; for the later, I have
a proposal that needs more consideration before it's ready to submit for
comment.
This code is all available from my CVS server (http://keithp.com has a
pointer), and I hope to get it into XFree86 shortly.
Keith Packard XFree86 Core Team Compaq Cambridge Research Lab
_______________________________________________
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts