Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fontconfig error: Cannot load default config file #46

Closed
IanTrudel opened this issue Jan 27, 2015 · 13 comments
Closed

Fontconfig error: Cannot load default config file #46

IanTrudel opened this issue Jan 27, 2015 · 13 comments
Milestone

Comments

@IanTrudel
Copy link
Collaborator

Shoes.exe and cshoes.exe display this error on the console:

Fontconfig error: Cannot load default config file

Potential solution is to provide a fonts.conf file and including it in the Shoes directory and/or (perhaps) define environment variable FONTCONFIG_FILE to the fonts.conf path and name. On *NIX platforms, it is likely properly set to /etc/fonts/fonts.config or something alone this line.

@ccoupe
Copy link

ccoupe commented Jan 27, 2015

As I remember. the gtk2 doc (for windows) says fontconfig is not really used but it has to be there. Perhaps a static fonts.conf or is it some tailored monster like the pango.modules that has to be run on each users system?

@IanTrudel
Copy link
Collaborator Author

The solution is actually working on Windows. Concretely, FONTCONFIG_FILE will have to be defined in Shoes installer but to test on command line:

set FONTCONFIG_FILE=C:\Program Files (x86)\Shoes\fonts.config

Created a _fonts.conf_ based on https://code.google.com/p/servetome/source/browse/trunk/stm/bin/fonts-windows.conf?r=3

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>

<!-- Font directory list -->

    <dir>C:\Windows\Fonts</dir> 
    <dir>C:\WINNT\Fonts</dir> 

<!-- Font cache directory list -->

    <cachedir>~/.fontconfig</cachedir>

<!-- Accept deprecated 'mono' alias, replacing it with 'monospace' -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>mono</string>
        </test>
        <edit name="family" mode="assign">
            <string>monospace</string>
        </edit>
    </match>

<!-- Accept alternate 'sans serif' spelling, replacing it with 'sans-serif' -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans serif</string>
        </test>
        <edit name="family" mode="assign">
            <string>sans-serif</string>
        </edit>
    </match>

<!-- Accept deprecated 'sans' alias, replacing it with 'sans-serif' -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans</string>
        </test>
        <edit name="family" mode="assign">
            <string>sans-serif</string>
        </edit>
    </match>

</fontconfig>

@IanTrudel
Copy link
Collaborator Author

You may try set PANGO_WIN32_DEBUG=true on Windows command line for _Pango-WARNINGS_ while using cshoes.exe but at your own risk. It spew logs at a speed no man can read. Redirecting output to a file got to 9 MB in mere seconds.

@ccoupe
Copy link

ccoupe commented Jan 27, 2015

So all we need is a static fonts.conf ? Or does it have to be created at install time , or every time shoes runs like pango.rc and pango.modules have to run for every invocation of Shoes in Linux and OSX which is why they use launch scripts? We removed the shoes.bat in 3.2

@IanTrudel
Copy link
Collaborator Author

A static file is all you need to fix the for the fontconfig error. No idea what the launch scripts are for but they may be helpful to solve the Pango-WARNINGS. The warnings may otherwise be due to improper internal reference considering that Lacuna is indeed added to Shoes::FONTS. Pango-WARNINGS might need its own issue on this tracker. The fontconfig error is completely gone with the fonts.conf file above.

@ccoupe
Copy link

ccoupe commented Jan 27, 2015

Those pango warning are the same ones on linux and osx if there is no pangorc and pango.modules of pango-querymodules executable fails. Perhaps that could done at installation time by the installer but you'd have have all the files and dll's that pango-querymodules wants. Which we don't have because Windows doesn't use them.

@ccoupe ccoupe added the Low label Jan 27, 2015
@IanTrudel
Copy link
Collaborator Author

Alright. I will file an issue for Pango-WARNINGS with a recap as it seems to be unrelated to fontconfig error. Correct? To close this issue, it will be necessary to do the following:

ccoupe pushed a commit that referenced this issue Feb 1, 2015
@IanTrudel IanTrudel added this to the 3.2.21 milestone Feb 1, 2015
@IanTrudel
Copy link
Collaborator Author

The two commits from @ccoupe are effectively closing this issue.

@ccoupe ccoupe reopened this Feb 13, 2015
@ccoupe
Copy link

ccoupe commented Feb 13, 2015

I find the cure (slow startup) to be worse than the cshoes warning message.

@IanTrudel
Copy link
Collaborator Author

@ccoupe
Copy link

ccoupe commented Feb 13, 2015

We have also created .fontconfig in the users home dir instead of the localized AppData\Local\Shoes. Sigh.

To summarize - Shoes.FONTS is not filled in without the fonts.conf and env var. That's not good.

With those fixes, Shoes can be slow to startup (once or twice) and we get an unwanted file in user space. That's annoying.

I can live with annoying for 3.2.21 but is issue is not closed.

@ccoupe ccoupe closed this as completed in f6b7741 Feb 13, 2015
@ccoupe ccoupe reopened this Feb 13, 2015
@IanTrudel
Copy link
Collaborator Author

We have also created .fontconfig in the users home dir instead of the localized AppData\Local\Shoes. Sigh.

You are right. Maybe the tightmingw rakefile could use ERB on font.conf to replace the path. This is what I normally use in commercial software. In fonts.conf change the cachedir for <cachedir><%= @shoes_home %>/.fontconfig</cachedir>.

require 'erb'

@shoes_home = File.join(LIB_DIR, Shoes::RELEASE_NAME)

File.open("fonts.conf", "w") { |f|
   template = File.read("fonts_template.conf")

   f.write(ERB.new(template).result(binding))
}

I can live with annoying for 3.2.21 but is issue is not closed.

My recommendation is to close this issue because it is resolved. There are so many new issues that we should close what is fixed, it has deep psychological effects. However, in the process, we discovered additional issues. I will file a new issue with a summary of what we talked about. Would you agree to this?

@ccoupe
Copy link

ccoupe commented Feb 13, 2015

But for a simple Shoes install there is no erb. We don't even run a .bat to start shoes. No chance to do anything. Nor can the rakefile know what the localized name for AppData is.

It's a matter of definition on 'resolved'. #48 is open and any solution to this one will involve that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants