bash-3.2$ ./fc-cache.exe --force --really-force /usr/share/fonts/Type1 FC_DEBUG X: FcDirCacheWrite writing out cache... X: FcDirCacheWrite found dir to use for caching: /home/Mike/.fonts.cache-2 X: FcDirCacheWrite doing FcAtomicCreate X: FcAtomicCreate will use lock file: /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LC K X: FcDirCacheWrite doing FcAtomicLock X: .. using mkstemp on: /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TM P-XXXXXX X: .. fd=3 X: ..linking /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TM P-T7WqPU -> /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LC K X: ret=-1 errno=1 X: ..calling FcStat on /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LC K X: could not created lock. X: FcDirCacheValid /usr/share/fonts/Type1 X: FcDirCacheValidConfig calling through to FcDirCacheProcess X: FcDirCacheProcess cache_base=/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 X: FcDirCacheProcess cache_hashed=/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32 d8.cache-3 X: opening /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 O_RDONLY | O_BINARY X: FcDirCacheProcess fd=-1 /usr/share/fonts/Type1: failed to write cache bash-3.2$ Now if I try to do the hard link manually: link ~/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TMP-Wl6CrD ~/.fonts.cache-2/mike link: cannot create link `/home/Mike/.fonts.cache-2/mike'' to `/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.T MP-Wl6CrD'': Operation not permitted bash-3.2$ echo $? 1 I checked my umask and stuff and that looks fine; also nothing in FcAtomicLock changes the umask, so if it can create the temp file (and it can) it should be able to create a link to it in the same directory. Maybe this is a Cygwin limitation, hard links are not allowed? I think this may have to be done with directories on Cygwin. (^_^)/ Mike. From: fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org] On Behalf Of Michael Garvin Sent: November 29, 2010 2:39 AM To: fontconfig at lists.freedesktop.org Subject: Re: [Fontconfig] fc-cache does not work with Cygwin Looks like I can replicate the problem now; its trying to write the cache but the call to get a lock is failing, this code: FcDirCacheWrite (FcCache *cache, FcConfig *config) . if (!FcAtomicLock (atomic)) goto bail3; Is leading to a silent failure (just returns false), i.e. bail3 gets executed. I''ll try to dig a little deeper, maybe my Cygwin is not doing locks right or something. Would have been nice if there was some kind of visible error message about this. (^_^)/ Mike. From: fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org] On Behalf Of Michael Garvin Sent: November 29, 2010 2:24 AM To: fontconfig at lists.freedesktop.org Subject: Re: [Fontconfig] fc-cache does not work with Cygwin Some additional detail; I set FC_DEBUG=8063 and ran an unmodified version of fc-cache: FC_DEBUG=8063 Loading config file /etc/fonts/fonts.conf . cache scan dir /usr/share/fonts/Type1 using FreeType family "Utopia" using FreeType style "Bold Italic" Type1 weight Bold maps to 200 Style Bold Italic maps to width -1 Style Bold Italic maps to slant 100 Style Bold Italic maps to decorative 0 font charset 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff 0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000 . <does the build up of the font cache for that directory in memory> .. charsets 29 -> 4 leaves 251 -> 24 FcDirCacheWriteDir dir "/usr/share/fonts/Type1" file "/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-x86.cache-3" /usr/share/fonts/Type1: failed to write cache Fc Memory Usage: Which Alloc Free Active count bytes count bytes count bytes charset 3970 74626 3970 32362 0 42264 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. But.that is failing as well. I''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. I think the Cygwin one might be patched somehow. Still fails though L (^_^)/ Mike. From: fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=bell.net at lists.freedesktop.org] On Behalf Of Michael Garvin Sent: November 29, 2010 2:05 AM To: fontconfig at lists.freedesktop.org Subject: [Fontconfig] fc-cache does not work with Cygwin Hi, I''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). I''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.every time. 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: failed to write cache After googling around trying all the suggested solutions, nothing was helping, and I ran strace and looked through the detailed system calls. It turns out fc-cache tries to open cache files in read only mode. Which means there is no way it can create cache files L 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). This is what I see: bash-3.2$ ./fc-cache.exe --force --really-force /usr/share/fonts/Type1/ X: FcDirCacheValid /usr/share/fonts/Type1 X: FcDirCacheValidConfig calling through to FcDirCacheProcess X: FcDirCacheProcess cache_base=/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 X: FcDirCacheProcess cache_hashed=/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32 d8.cache-3 X: opening /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 O_RDONLY | O_BINARY X: FcDirCacheProcess fd=-1 /usr/share/fonts/Type1: failed to write cache bash-3.2$ The X: . lines are my printf statements I added to the code. 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. 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 "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). So from what I can tell, fc-cache is not the program to use to populate the font caches the very first time. My question is, what program do I use? Can you update your documentation to correctly point to the right program to use? This has been very frustrating to try and track down. I guess when I have time next, I''ll try to understand the "init" 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''t think I should have to do that. fc-cache should work as its manpage says L (^_^)/ Mike. Michael Garvin mgarvin at bell.net ------=_NextPart_000_0030_01CB8F77.3DFECCA0 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-microsoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http://www.w3.org/TR/REC-html40"> <head> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3Dus-ascii"> <meta name=3DGenerator content=3D"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; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle19 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle20 {mso-style-type:personal; font-family:"Calibri","sans-serif"; color:#1F497D;} span.EmailStyle21 {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=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3DEN-US link=3Dblue vlink=3Dpurple> <div class=3DSection1> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Hi again, ok the is resolved for me; I’m on Windows XP (FAT32 files sytem), so hard linking is not supported. For now, I’ve updated the file lock code like this:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>#undef HAVE_LINK<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>I wasn’t sure if using symlink would be valid in the context of lock files so I just switched it to using a directory. It works fine now </span><span style=3D''font-family:Wingdings; color:#1F497D''>J</span><span style=3D''color:#1F497D''><o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Not sure how many people out there are going to use this stuff on an XP machine with FAT32 file systems, under cygwin, but if you could add more verbose error messages around the failure conditions it would help debug things a lot quicker. It took me all night to bottom this out </span><span style=3D''font-family:Wingdings;color:#1F497D''>L</span><span style=3D''color:#1F497D''> I think a lot of people would have just disabled freetype. </span><span style=3D''font-family:Wingdings;color:#1F497D''>L</span><span style=3D''color:#1F497D''><o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>(^_^)/<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Mike.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <div> <div style=3D''border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm''> <p class=3DMsoNormal><b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''>From:</span></b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''> fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org] <b>On Behalf Of </b>Michael Garvin<br> <b>Sent:</b> November 29, 2010 3:30 AM<br> <b>To:</b> fontconfig at lists.freedesktop.org<br> <b>Subject:</b> Re: [Fontconfig] fc-cache does not work with Cygwin<o:p></o:p></span></p> </div> </div> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Hi, ok so I dug in deeper and it seems that fontconfig’s method of file locking isn’t really compatibile with cygwin (or cygwin doesn’t fully emulate Linux). <o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>When font config tries to “hard link” tempory lock file, cygwin gives a permission denied error. I can replicate it by commenting out the unlink() calls and then from the command line trying a ‘link’ from the mkstemp file to some name.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>From my printf’ized fc-cache:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>bash-3.2$ ./fc-cache.exe --force --really-force /usr/share/fonts/Type1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>FC_DEBUG=3D<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheWrite writing out cache...<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheWrite found dir to use for caching: /home/Mike/.fonts.cache-2<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheWrite doing FcAtomicCreate<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcAtomicCreate will use lock file: /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LCK<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheWrite doing FcAtomicLock<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: .. using mkstemp on: /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TMP-XXXXXX<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: .. fd=3D3<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: ..linking /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TMP-T7WqPU -> /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LCK<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: ret=3D-1 errno=3D1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: ..calling FcStat on /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.LCK<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: could not created lock.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheValid /usr/share/fonts/Type1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheValidConfig calling through to FcDirCacheProcess<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheProcess cache_base=3D/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheProcess cache_hashed=3D/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: opening /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 O_RDONLY | O_BINARY<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>X: FcDirCacheProcess fd=3D-1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>/usr/share/fonts/Type1: failed to write cache<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>bash-3.2$<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Now if I try to do the hard link manually:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>link ~/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TMP-Wl6CrD ~/.fonts.cache-2/mike<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>link: cannot create link `/home/Mike/.fonts.cache-2/mike'' to `/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3.TMP-Wl6CrD'': Operation not permitted<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>bash-3.2$ echo $?<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>I checked my umask and stuff and that looks fine; also nothing in FcAtomicLock changes the umask, so if it can create the temp file (and it can) it should be able to create a link to it in the same directory. <o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Maybe this is a Cygwin limitation, hard links are not allowed? I think this may have to be done with directories on Cygwin. <o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>(^_^)/<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Mike.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <div> <div style=3D''border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm''> <p class=3DMsoNormal><b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''>From:</span></b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''> fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org] <b>On Behalf Of </b>Michael Garvin<br> <b>Sent:</b> November 29, 2010 2:39 AM<br> <b>To:</b> fontconfig at lists.freedesktop.org<br> <b>Subject:</b> Re: [Fontconfig] fc-cache does not work with Cygwin<o:p></o:p></span></p> </div> </div> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Looks like I can replicate the problem now; its trying to write the cache but the call to get a lock is failing, this code:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>FcDirCacheWrite (FcCache *cache, FcConfig *config)<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>…<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> if (!FcAtomicLock (atomic))<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> goto bail3;<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Is leading to a silent failure (just returns false), i.e. bail3 gets executed. I’ll try to dig a little deeper, maybe my Cygwin is not doing locks right or something. Would have been nice if there was some kind of visible error message about this.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>(^_^)/<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Mike.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <div> <div style=3D''border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm''> <p class=3DMsoNormal><b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''>From:</span></b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''> fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org] <b>On Behalf Of </b>Michael Garvin<br> <b>Sent:</b> November 29, 2010 2:24 AM<br> <b>To:</b> fontconfig at lists.freedesktop.org<br> <b>Subject:</b> Re: [Fontconfig] fc-cache does not work with Cygwin<o:p></o:p></span></p> </div> </div> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Some additional detail; I set FC_DEBUG=3D8063 and ran an unmodified version of fc-cache:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>FC_DEBUG=3D8063<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Loading config file /etc/fonts/fonts.conf<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>…<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>cache scan dir /usr/share/fonts/Type1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>using FreeType family "Utopia"<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>using FreeType style "Bold Italic"<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Type1 weight Bold maps to 200<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Style Bold Italic maps to width -1<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Style Bold Italic maps to slant 100<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Style Bold Italic maps to decorative 0<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>font charset<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> 0000: 00000000 ffffffff ffffffff 7fffffff 00000000 ffffffff ffffffff ffffffff<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> 0001: 00000000 00020000 000c0006 61000003 00040000 00000000 00000000 00000000<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>…<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><does the build up of the font cache for that directory in memory><o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>….<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>charsets 29 -> 4 leaves 251 -> 24<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>FcDirCacheWriteDir dir "/usr/share/fonts/Type1" file "/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-x86.cache-3"<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>/usr/share/fonts/Type1: failed to write cache<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Fc Memory Usage:<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> Which Alloc Free Active<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> count bytes count bytes count bytes<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''> charset 3970 74626 3970 32362 0 42264<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''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. But…that is failing as well. I’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. I think the Cygwin one might be patched somehow. Still fails though </span><span style=3D''font-family:Wingdings; color:#1F497D''>L</span><span style=3D''color:#1F497D''><o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>(^_^)/<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''>Mike.<o:p></o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <p class=3DMsoNormal><span style=3D''color:#1F497D''><o:p> </o:p></span></p> <div> <div style=3D''border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm''> <p class=3DMsoNormal><b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''>From:</span></b><span style=3D''font-size:10.0pt;font-family:"Tahoma","sans-serif"''> fontconfig-bounces+mgarvin=3Dbell.net at lists.freedesktop.org [mailto:fontconfig-bounces+mgarvin=3Dbell.net at 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 at 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=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Hi, I’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). I’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…every time.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal> failed to write cache<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>After googling around trying all the suggested solutions, nothing was helping, and I ran strace and looked through the detailed system calls. It turns out fc-cache tries to open cache files in read only mode. Which means there is no way it can create cache files <span style=3D''font-family:Wingdings''>L</span> <o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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). This is what I see:<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>bash-3.2$ ./fc-cache.exe --force --really-force /usr/share/fonts/Type1/<o:p></o:p></p> <p class=3DMsoNormal>X: FcDirCacheValid /usr/share/fonts/Type1<o:p></o:p></p> <p class=3DMsoNormal>X: FcDirCacheValidConfig calling through to FcDirCacheProcess<o:p></o:p></p> <p class=3DMsoNormal>X: FcDirCacheProcess cache_base=3D/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></p> <p class=3DMsoNormal>X: FcDirCacheProcess cache_hashed=3D/home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3<o:p></o:p></p> <p class=3DMsoNormal>X: opening /home/Mike/.fonts.cache-2/d62e99ef547d1d24cdb1bd22ec1a2976-le32d8.cache-3 O_RDONLY | O_BINARY<o:p></o:p></p> <p class=3DMsoNormal>X: FcDirCacheProcess fd=3D-1<o:p></o:p></p> <p class=3DMsoNormal>/usr/share/fonts/Type1: failed to write cache<o:p></o:p></p> <p class=3DMsoNormal>bash-3.2$<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>The X: … lines are my printf statements I added to the code. <o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>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. 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 “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=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>So from what I can tell, fc-cache is not the program to use to populate the font caches the very first time. <o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>My question is, what program do I use? Can you update your documentation to correctly point to the right program to use? <o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>This has been very frustrating to try and track down. I guess when I have time next, I’ll try to understand the “init” 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’t think I should have to do that. fc-cache should work as its manpage says <span style=3D''font-family:Wingdings''>L</span> <o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>(^_^)/<o:p></o:p></p> <p class=3DMsoNormal>Mike.<o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal>Michael Garvin<o:p></o:p></p> <p class=3DMsoNormal><a href=3D"mailto:mgarvin at bell.net">mgarvin at bell.net</a><o:p></o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> <p class=3DMsoNormal><o:p> </o:p></p> </div> </body> </html> ------=_NextPart_000_0030_01CB8F77.3DFECCA0--