[tex-live] linking with fontconfig (xetex and xdvipdfmx)
Jonathan Kew
jonathan_kew at sil.org
Tue Oct 3 23:13:16 CEST 2006
I have been looking into the issue of linking with fontconfig, which
xetex and its output driver xdvipdfmx both use to locate "installed"
fonts on the host system. (This ability to directly "see" and use the
same fonts as mainstream GUI applications, with no special conversion/
configuration/installation for TeX use, is one of the xetex features
that many users find very attractive.)
Currently, xetex and xdvipdfmx are dynamically linked with
libfontconfig, which means that the fontconfig headers and library
must be present at build time, and /usr/lib/libfontconfig.so must be
present at runtime. This is in contrast to other libraries, where (by
default) we build and (statically) link entirely within TL, so there
is no runtime dependency.
I've been wondering if it would be good to treat fontconfig in this
same way, but have been concerned that it could lead to problems.
Fontconfig is in effect the "bridge" between xetex and the user's
desktop "world" of fonts, and if xetex is not using the same
fontconfig library as the desktop applications, the resulting
mismatch in behavior will be confusing and frustrating. For example,
if a distributor has customized the location of fontconfig's primary
configuration files in their build, only their library will know
about this, and a private version built as part of TL will not access
the same configuration.
I don't know whether distributors do ever change the location of
fonts.conf in their build, but it is surely possible -- just as
likely, perhaps, as changing the installed location of
libfontconfig.so, which of course could prevent TL's xetex and
xdvipdfmx binaries from running.
A more serious issue, though (in that it will *definitely* be a
problem if we static-link libfontconfig) is that fontconfig relies on
cache files that it builds in each font directory. Looking at the
fontconfig documentation and release notes, I have realized that
these cache files are *not* necessarily compatible across fontconfig
versions. The newly-released version 2.4 has changed the version
number (and default name) from that used by version 2.3.x.
It is inevitable, then, that if we static-link with libfontconfig,
there will be users for whom the TL programs don't work because they
don't use the right cache files. To make things at all usable, we'd
have to provide TL-specific versions of the fontconfig utilities such
as fc-list, fc-match, fc-cache, to work with "our" caches which might
be different from those used by everything else on the system -- and
the benefit of integration with the desktop world of fonts would be
gone.
(Some time ago, I did try building a version of xetex with a static
"private" copy of libfontconfig, and the resulting binary did not
work correctly -- it was unable to find the "installed" fonts as
expected. At the time, I did not investigate this further, but I
suspect that a cache file version mismatch may have been the reason.)
I therefore suggest that xetex and xdvipdfmx should *not* use a
static fontconfig library; they should continue to link with /usr/lib/
libfontconfig.so (or equivalent on other OS's).
Comments welcome!
JK
More information about the tex-live
mailing list