Alan W. Irwin
2011-Sep-19 20:41 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
I have recently had a fair amount of success (e.g., ephcom-2.0.2) testing software packages I have developed on Linux to make sure they also work on the MinGW/MSYS/Wine Windows platform. However, I have run into a snag with such a Wine (1.3.26) build test for libLASi. That library depends on the pango/cairo stack of libraries including font-config and builds without obvious issues under Wine using the all-in-one Windows package http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.22/gtk+-bundle_2.22.1-20101227_win32.zip for GTK+ 2.22.1 recommended at http://www.gtk.org/download/win32.php. The fontconfig version in that bundle is "fontconfig version 2.8.0" according to "fc-list --version". However, the issue is libLASi test applications built by the same build under Wine fail to run under Wine because they cannot find any TrueType fonts. That font finding problem appears to be confirmed by fc-list which produces absolutely empty results from wine. So I ran fc-cache --really-force --verbose z:/usr/share/fonts from the Wine (SYS-bash) environment since /usr/share/fonts (the Linux equivalent of that Wine directory) are where many TrueType fonts are located on my system. That gave very promising results with many fonts found and cached in the Wine C:/users/wine/Temp/fontconfig/cache directory. BUT fc-list continues to give completely empty results and the libLASi test applications continue to fail because no fonts are found. Anybody here have a clue why fc-list gives empty results under these circumstances where fc-cache appears to be succeeding? My Linux system is 64-bit while the wine system is 32-bit (as is version of GTK+ I downloaded). I assumed since Debian stored the fonts in architecture-independent /usr/share/fonts that 64-bit versus 32-bit issues would not matter here, but is that assumption incorrect? Any advice as to the best way to access Linux-installed fonts from the Wine platform using the Windows version of fontconfig would be most appreciated. 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 __________________________
Behdad Esfahbod
2011-Sep-19 21:22 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
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.... behdad
Alan W. Irwin
2011-Sep-19 23:57 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
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 __________________________
Behdad Esfahbod
2011-Sep-20 00:30 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
On 09/19/11 19:57, Alan W. Irwin wrote:> > <dir>WINDOWSFONTDIR</dir>So, technically fontconfig is supposed to look in the windows font dir for fonts. And apparently it does, but by default Wine has no fonts there. See the first few paragraphs here: http://wiki.jswindle.com/index.php/Fonts One way to fix this would be to include /usr/share/fonts even on Windows. It''s harmless, right? behdad
Alan W. Irwin
2011-Sep-20 01:37 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
On 2011-09-19 20:30-0400 Behdad Esfahbod wrote:> On 09/19/11 19:57, Alan W. Irwin wrote: >> >> <dir>WINDOWSFONTDIR</dir> > > So, technically fontconfig is supposed to look in the windows font dir for > fonts. And apparently it does, but by default Wine has no fonts there. See > the first few paragraphs here: > > http://wiki.jswindle.com/index.php/Fonts > > One way to fix this would be to include /usr/share/fonts even on Windows. > It''s harmless, right?Probably, but I just don''t have the Wine experience (and no Windows experience at all) to give you a definitive response about what the best fix should be. One important issue is the above wiki seems quite dated in spots so I don''t know how much you should trust it. Also, you don''t want to have fontconfig do something brute force for Wine when there might be a much better way to get the job done. Note under Wine you can look at the registry since it is in human readable form (as .wine/system.reg). By removing all of .wine and starting fresh with winecfg (which recreates that registry file and which knows nothing about GTK+ at that stage) I discovered all my _Linux_ /usr/share/fonts/truetype fonts mentioned there before any attempts to run fc-cache. This is for wine-1.3.26 which I built myself on Linux. So obviously Wine knows where to find Linux TrueType fonts for that case, but somehow that information is not being used by font-config until you also tell it via the patch to font.conf where to find them as well. I think you need a Wine expert to give you advice on the best fix, but the patch is a useful workaround until that happens. 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 __________________________
Behdad Esfahbod
2011-Sep-20 02:03 UTC
[Fontconfig] fc-cache succeeds, but fc-list still gives empty result on Wine
On 09/19/11 21:37, Alan W. Irwin wrote:> > I think you need a Wine expert to give you advice on the best fix, but > the patch is a useful workaround until that happens.Right. I see the [Software\\Wine\\Fonts\\External Fonts] section in wine''s user.reg. I guess I just leave this slip until someone with a better understanding of wine comes by. behdad