[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Sep 19 16:57:58 PDT 2011


On 2011-09-19 17:22-0400 Behdad Esfahbod wrote:

> On 09/19/11 16:41, Alan W. Irwin wrote:
>>
>> Anybody here have a clue why fc-list gives empty results under these
>> circumstances where fc-cache appears to be succeeding?
>
> You gave a path to fc-cache.  fc-list doesn't have that path.  You need to
> figure out where the fonts.conf lies in that setting and add the correct font
> path in there.  Something along those lines.  Or read fontconfig source code
> to see what it does on Windows....

Hi Behdad:

Thanks for your help which lead me to the solution.

What initially confused me was The fc-cache man page which says

"A cache is created which contains properties of each font and the
associated filename."

So I assumed that meant the full path name, but after reading your
remarks above I used fc-cat to access information in some of those
cache files.  It appears the cache simply identifies the filename
without path consistent with what you said.  So that filename is a
useful identifier for the font but not useful for actually helping
fontconfig to find where that font file is located (!)

I therefore pursued your idea of modifying the system fonts.conf which
on my system is located at $prefix/gtkplus-2.22.1/etc/fonts/fonts.conf,
where prefix is the directory where I unpacked the all-in-one Windows
binary for GTK+.

This patch to that file worked.

--- fonts.conf.original 2010-02-05 12:55:42.000000000 -0800
+++ fonts.conf  2011-09-19 15:58:14.000000000 -0700
@@ -23,8 +23,8 @@

  <!-- Font directory list -->

+       <dir>z:/usr/share/fonts</dir>
         <dir>WINDOWSFONTDIR</dir>
-
         <dir>~/.fonts</dir>

  <!--

Note, that drive-letter form was essential.  MSYS-bash also honors the
alternative /z/usr/share/fonts form specifying the full path to the
file, but that form does not work in the above file.

After the above change, under wine I ran

"fc-cache" with no options, and after that "fc-list" gave lots of
results, and my test applications for libLASi worked fine as well.

So thanks very much for your essential help that lead me to the
solution, but I do feel editing an installed system file like 
$prefix/gtkplus-2.22.1/etc/fonts/fonts.conf has the feel of a
workaround for a fontconfig issue that should be addressed to make it
easier for users to specify alternative font locations on Windows
platforms such as Wine.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the Fontconfig mailing list