Vincent Torri
2007-Oct-18 07:43 UTC
[Fontconfig] how to correctly set fontconfig on Windows
Hello, I would like to install a library that uses fontconfig on Windows. I have installed the true type fonts in: c:\Program Files\CommonFiles\Efl\share\fonts (Efl is the name of the package). Of course, if I just do that, fontconfig can not find the fonts and I get the error: Fontconfig error: Cannot load default config file What I would like to know is how I can correctly set fontconfig on Windows. I know that if I install gtk runtime (for gimp) or Xchat2 on Windows (well, xchat uses gtk but install fontconfig in its own directory), fontconfig can detect the font files. I know that I can use the environment variables FONTCONFIG_FILE = fonts.conf FONTCONFIG_PATH = $MY_PATH/fonts/conf FC_CACHEDIR = $MY_PATH/fonts/cache where MY_PATH is some dir. But I fear that it can create a conflict with the current fontconfig setup that gimp and/or xchat uses. Can someone tell what I have to do during the installation of that library to set up correctly fontconfig ? thank you Vincent Torri
Tor Lillqvist
2007-Oct-18 08:29 UTC
[Fontconfig] how to correctly set fontconfig on Windows
> I have installed the true type fonts in: > > c:\Program Files\CommonFiles\Efl\share\fonts > (Efl is the name of the package).Any particular reason why you don''t install them into Windows itself? Are they strictly for use by Efl only from licensing or usefulness point of view, and are there so many of them that having them visible in the normal font selection of Windows apps would just cause lots of clutter? Presumably the Efl code really *does* require fontconfig, either by using it directly or by using the pangoft2 library?> Of course, if I just do that,You didn''t tell where you installed fontconfig, and whether you used a prebuilt package like mine at http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig-2.4.2-tml-20071015.zip or from somewhere else, or whether you compiled fontconfig yourself?> fontconfig can not find the fonts and I get > the error: > > Fontconfig error: Cannot load default config fileWell, that message doesn''t say that it can''t find the fonts, it says that it can''t find the fonts.conf file. (But the end result of course is that no fonts are found either, as it is the fonts.conf file which tells where to look for fonts...)> What I would like to know is how I can correctly set fontconfig on > Windows.I would unzip the above zip file (or a newer version if/when one is available) into the c:\Program Files\CommonFiles\Efl folder, and not move the files thus unzipped around after that. Then in c:\Program Files\CommonFiles\Efl\etc\fonts\fonts.conf I would replace "<dir>~/.fonts</dir>" with "<dir>c:/program files/common files/efl/share/fonts</dir>. (Hmm, I hope it works to have spaces in there...)> I know that if I install gtk runtime (for gimp) or Xchat2 on > Windows (well, xchat uses gtk but install fontconfig in its own > directory), fontconfig can detect the font files.With "the" font files, do you mean the ones installed in the Windows font folder, or the ones you installed into Efl\share\fonts ? (Anyway, I wonder why Xchat2 comes bundled with fontconfig, does it really need it? GIMP does, but not GTK+ applications in general.)> I know that I can use the environment variablesSorry, I have never played with those, can''t say anything about them.> Can someone tell what I have to do during the installation of that library > to set up correctly fontconfig ?fontconfig as a concept is rather foreign to Windows, so using it on Windows is not really "correct" (in a more philosophical sense)... One should use fontconfig on Windows only if the code absolutely requires fontconfig. At least, that''s what Owen always says unless I''m mistaken. But anyway, hopefully the above should give you some help. The key point is that the location of the default fonts.conf file is constructed from the location of the fontconfig DLL. The DLlMain() function in the DLL asks the system where it is located. The DLL should be in "someprefix\bin" (or "someprefix\lib", although that is not really recommended), and the fonts.conf file then in "someprefix\etc\fonts". If the DLL is in a folder whose last component isn''t "bin" or "lib", then the fonts.conf file should be in "etc\fonts" directly under that folder. This is the same logic that GTK+ and all other related stuff I have ported to Windows use to find its installation location at run time. As far as I know it works fine, although in fontconfig''s case the code only uses the ANSI variants of the APIs so it won''t work if pathnames with characters not in the system codepage are involved. --tml
Vincent Torri
2007-Oct-18 11:00 UTC
[Fontconfig] {Spam?} Re: how to correctly set fontconfig on Windows
On Thu, 18 Oct 2007, Tor Lillqvist wrote:>> I have installed the true type fonts in: >> >> c:\Program Files\CommonFiles\Efl\share\fonts >> (Efl is the name of the package). > > Any particular reason why you don''t install them into Windows itself? > Are they strictly for use by Efl only from licensing or usefulness > point of view, and are there so many of them that having them visible > in the normal font selection of Windows apps would just cause lots of > clutter?About the licence, I don''t know. It''s the Vera (normal and bold) font files. I put them in a separate dir because i never liked programs that install everything in the c:\WINDOWS dir (dll, fonts, apps, etc...) Also, I would like to remove them when the uninstaller is launched. What if another program uses those fonts in c:\windows\fonts and I want to remove them ? The solution would be to not remove them, of course.> Presumably the Efl code really *does* require fontconfig, either by > using it directly or by using the pangoft2 library?I use it directly. I don''t use pangoft.> You didn''t tell where you installed fontconfig, and whether you used a > prebuilt package like mine at > http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/fontconfig-2.4.2-tml-20071015.zip > or from somewhere else, or whether you compiled fontconfig yourself?I compiled fontconfig myself. Last time I checked fontconfig on your website, it was an old version. I remark that, now, you have a modified version of 2.4.2. Maybe I can use it. Anyway, I installed the fontconfig dll in c:\program files\common files\efl\bin>> fontconfig can not find the fonts and I get >> the error: >> >> Fontconfig error: Cannot load default config file > > Well, that message doesn''t say that it can''t find the fonts, it says > that it can''t find the fonts.conf file. (But the end result of course > is that no fonts are found either, as it is the fonts.conf file which > tells where to look for fonts...)yes, I know :-)>> What I would like to know is how I can correctly set fontconfig on >> Windows. > > I would unzip the above zip file (or a newer version if/when one is > available) into the c:\Program Files\CommonFiles\Efl folder, and not > move the files thus unzipped around after that. Then in c:\Program > Files\CommonFiles\Efl\etc\fonts\fonts.conf I would replace > "<dir>~/.fonts</dir>" with "<dir>c:/program files/common > files/efl/share/fonts</dir>. (Hmm, I hope it works to have spaces in > there...)ha, the spaces... I''ll check. But actually, you gave the answer I wanted below.>> I know that if I install gtk runtime (for gimp) or Xchat2 on >> Windows (well, xchat uses gtk but install fontconfig in its own >> directory), fontconfig can detect the font files. > > With "the" font files, do you mean the ones installed in the Windows > font folder, or the ones you installed into Efl\share\fonts ?not those in Efl\share\fonts. I don''t know where xchat and gimp/gtk install the font files.> (Anyway, I wonder why Xchat2 comes bundled with fontconfig, does it > really need it? GIMP does, but not GTK+ applications in general.)I use xchat 2 from silverex.org>> I know that I can use the environment variables > > Sorry, I have never played with those, can''t say anything about them.ok>> Can someone tell what I have to do during the installation of that library >> to set up correctly fontconfig ? > > fontconfig as a concept is rather foreign to Windows, so using it on > Windows is not really "correct" (in a more philosophical sense)... One > should use fontconfig on Windows only if the code absolutely requires > fontconfig. At least, that''s what Owen always says unless I''m > mistaken. But anyway, hopefully the above should give you some help. > > The key point is that the location of the default fonts.conf file is > constructed from the location of the fontconfig DLL. The DLlMain() > function in the DLL asks the system where it is located. > > The DLL should be in "someprefix\bin" (or "someprefix\lib", although > that is not really recommended), and the fonts.conf file then in > "someprefix\etc\fonts". If the DLL is in a folder whose last component > isn''t "bin" or "lib", then the fonts.conf file should be in > "etc\fonts" directly under that folder.haaaa, that''s exactly what I wanted to know ! So as the fontconfig dll is in c:\program files\common files\efl\bin, I have to put the fonts.conf file in c:\program files\common files\efl\etc\fonts Also, it seems that I need to modify manually fonts.conf. I''ll check if I can do that automatically (I use nsis, and not inno) About the fact that I need fontconfig, well, it seems so, as the program fails because of fontconfig (I have ported to Windows the evas library and its bechmark test suite named expedite. Those are linux code). anyway, thank you very much for your useful answers ! regards Vincent Torri