<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='color:#1F497D'>Some additional detail; I set
FC_DEBUG=8063 and ran an unmodified version of fc-cache:<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>FC_DEBUG=8063<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Loading config file /etc/fonts/fonts.conf<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&#8230;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>cache scan dir
/usr/share/fonts/Type1<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>using FreeType family
&quot;Utopia&quot;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>using FreeType style &quot;Bold
Italic&quot;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Type1 weight Bold maps to 200<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Style Bold Italic maps to width -1<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Style Bold Italic maps to slant 100<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Style Bold Italic maps to decorative 0<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>font charset<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&#8230;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&lt;does the build up of the
font cache for that directory in memory&gt;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&#8230;.<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>charsets 29 -&gt; 4 leaves 251
-&gt; 24<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>FcDirCacheWriteDir dir
&quot;/usr/share/fonts/Type1&quot; file
&quot;/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-x86.cache-3&quot;<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>/usr/share/fonts/Type1: failed
to write cache<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Fc Memory Usage:<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Which&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Alloc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Free&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Active<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
count&nbsp;&nbsp; bytes&nbsp;&nbsp; count&nbsp;&nbsp; bytes&nbsp;&nbsp;
count&nbsp;&nbsp; bytes<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
charset&nbsp;&nbsp;&nbsp; 3970&nbsp;&nbsp; 74626&nbsp;&nbsp;&nbsp;
3970&nbsp;&nbsp; 32362&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; 42264<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Some how (not sure how), it is
managing to get through to the section of code where it actually tries to write
out to disk.&nbsp; But&#8230;that is failing as well.&nbsp; I&#8217;ll dig
deeper to see if I can identify why the default Cygwin binary is getting to
that stage and the one compiled from source is not.&nbsp; I think the Cygwin
one might be patched somehow.&nbsp; Still fails though </span><span
style='font-family:Wingdings;color:#1F497D'>L</span><span style='color:#1F497D'><o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>(^_^)/<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'>Mike.<o:p></o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
fontconfig-bounces+mgarvin=bell.net@lists.freedesktop.org
[mailto:fontconfig-bounces+mgarvin=bell.net@lists.freedesktop.org] <b>On Behalf
Of </b>Michael Garvin<br>
<b>Sent:</b> November 29, 2010 2:05 AM<br>
<b>To:</b> fontconfig@lists.freedesktop.org<br>
<b>Subject:</b> [Fontconfig] fc-cache does not work with Cygwin<o:p></o:p></span></p>

</div>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Hi, I&#8217;ve been trying to fix the problem with all of my
Cygwin (Widnows XP) Gtk and Qt applications being slow (taking about 5minutes
to startup).&nbsp; I&#8217;ve been able to verify that the issue is due to
Freetype being used, and in turn; font-config being used to list off the
available fonts on startup. The problem is that font-config never actually caches
anything, so any font-config using application, has the same (realliy bad)
start up time&#8230;every time.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>I tried running fc-cache manually but to no avail; I double
checked time stamps, having write permission any problems with the
configuration file, bad install of the Cygwin packages etc, but no matter what,
fc-cache always fails on all possible font directories with:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>&nbsp; failed to write cache<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>After googling around trying all the suggested solutions,
nothing was helping, and I ran strace and looked through the detailed system
calls. &nbsp;It turns out fc-cache tries to open cache files in read only mode.
&nbsp;&nbsp;&nbsp;Which means there is no way it can create cache files <span
style='font-family:Wingdings'>L</span> <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>So, I downloaded the source, compiled it up and added printf
statements throughout the call chain from scanDirs() downwards, and picked a
single directory to try and cache (the Type1 fonts directory for Cygwin).&nbsp;
This is what I see:<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>bash-3.2$ ./fc-cache.exe --force --really-force
/usr/share/fonts/Type1/<o:p></o:p></p>

<p class=MsoNormal>X: FcDirCacheValid /usr/share/fonts/Type1<o:p></o:p></p>

<p class=MsoNormal>X: FcDirCacheValidConfig calling through to
FcDirCacheProcess<o:p></o:p></p>

<p class=MsoNormal>X: FcDirCacheProcess
cache_base=/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></p>

<p class=MsoNormal>X: FcDirCacheProcess
cache_hashed=/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></p>

<p class=MsoNormal>X: opening /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3
O_RDONLY | O_BINARY<o:p></o:p></p>

<p class=MsoNormal>X: FcDirCacheProcess fd=-1<o:p></o:p></p>

<p class=MsoNormal>/usr/share/fonts/Type1: failed to write cache<o:p></o:p></p>

<p class=MsoNormal>bash-3.2$<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>The X: &#8230; lines are my printf statements I added to the
code. <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>I looked through the code by hand, from main(), to
scanDirs() and downwards, there is no possible way that I can see for fc-cache
to actually create caches on disk.&nbsp; &nbsp;The code that prints out the
failed to write cache message is just calling FcDirCacheValid(), but this
function is not used to create cache files (the error message of &#8220;write
failed is meaningless), only to open then and check that they are valid (hence
strace shows opening of cache files in read only mode with no creat
flag..consistent at least).<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>So from what I can tell, fc-cache is not the program to use
to populate the font caches the very first time.&nbsp; <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>My question is, what program do I use?&nbsp; Can you update
your documentation to correctly point to the right program to use?&nbsp; <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>This has been very frustrating to try and track down.&nbsp;
&nbsp;I guess when I have time next, I&#8217;ll try to understand the
&#8220;init&#8221; call tree that actually does call the functions which build
cache files (FcDirCacheScan), and maybe write a little program that
specificalliy calls those functions so I can get my caches populated, but I
really don&#8217;t think I should have to do that. &nbsp;&nbsp;fc-cache should
work as its manpage says <span style='font-family:Wingdings'>L</span> <o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>(^_^)/<o:p></o:p></p>

<p class=MsoNormal>Mike.<o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal>Michael Garvin<o:p></o:p></p>

<p class=MsoNormal><a href="mailto:mgarvin@bell.net">mgarvin@bell.net</a><o:p></o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>