Subject: fontconfig needs another font path
To: None <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 03/17/2004 19:36:38
fontconfig/Makefile has:

CONFIGURE_ARGS+=        --with-default-fonts=${LOCALBASE}/lib/X11/fonts

FONT_PATH=
${X11PREFIX}/lib/X11/fonts/TTF,${X11PREFIX}/lib/X11/fonts/Type1
.if ${X11PREFIX} != ${X11BASE}
FONT_PATH2=
,${X11BASE}/lib/X11/fonts,${X11BASE}/lib/X11/fonts/TTF,${X11BASE}/lib/X11/fonts/Type1
.endif
CONFIGURE_ARGS+=        --with-add-fonts=${FONT_PATH}${FONT_PATH2}

This is used to create the default fontconfig/fonts.conf file. For
example:

        <dir>/usr/lib/X11/fonts</dir>
        <dir>/usr/X11R6/lib/X11/fonts/TTF</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
        <dir>~/.fonts</dir>

But on system without /usr/X11R6/lib/X11/fonts/Type1 and without
/usr/X11R6/lib/X11/fonts/TTF and nothing in /usr/lib/X11/fonts nor in
~/.fonts, then apps using fontconfig will not work (because fc-cache can't
build any cache).

An example of the above would be to have XFree86-fontsMisc-4.4.0,
XFree86-fonts100dpi-4.4.0, and XFree86-fonts75dpi-4.4.0 installed but no
XFree86-fontsScalable package.

To the Makefile, ${X11PREFIX}/lib/X11/fonts should be added to FONT_PATH.

(It is already in FONT_PATH2 if used.)

Or:

.if ${LOCALBASE} != {$X11PREFIX}
FONT_PATH=	${X11PREFIX}/lib/X11/fonts,${X11PREFIX}/lib/X11/fonts/TTF,${X11PREFIX}/lib/X11/fonts/Type1
.else
FONT_PATH=	${X11PREFIX}/lib/X11/fonts/TTF,${X11PREFIX}/lib/X11/fonts/Type1
.endif


Then now fontconfig works:

fc-cache: "/usr/X11R6/lib/X11/fonts/misc": skipping, 55 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/100dpi": skipping, 398 fonts, 0 dirs
fc-cache: "/usr/X11R6/lib/X11/fonts/75dpi": skipping, 398 fonts, 0 dirs

(That is a second run.)

   Jeremy C. Reed
   http://www.reedmedia.net/