Fontconfig error: Cannot load default config file #46

Closed
BackOrder opened this Issue Jan 27, 2015 · 13 comments

Comments

Projects
None yet
2 participants
@BackOrder
Collaborator

BackOrder commented Jan 27, 2015

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.

@BackOrder BackOrder added the Windows label Jan 27, 2015

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jan 27, 2015

Contributor

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?

Contributor

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?

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 27, 2015

Collaborator

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>
Collaborator

BackOrder commented Jan 27, 2015

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>
@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 27, 2015

Collaborator

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.

Collaborator

BackOrder commented Jan 27, 2015

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

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jan 27, 2015

Contributor

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

Contributor

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

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 27, 2015

Collaborator

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.

Collaborator

BackOrder commented Jan 27, 2015

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

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Jan 27, 2015

Contributor

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.

Contributor

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

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Jan 28, 2015

Collaborator

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:

Collaborator

BackOrder commented Jan 28, 2015

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 added a commit that referenced this issue Feb 1, 2015

@BackOrder BackOrder added this to the 3.2.21 milestone Feb 1, 2015

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Feb 9, 2015

Collaborator

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

Collaborator

BackOrder commented Feb 9, 2015

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

@BackOrder BackOrder closed this Feb 9, 2015

@ccoupe ccoupe reopened this Feb 13, 2015

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Feb 13, 2015

Contributor

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

Contributor

ccoupe commented Feb 13, 2015

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

@ccoupe

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Feb 13, 2015

Contributor

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.

Contributor

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 in f6b7741 Feb 13, 2015

@ccoupe ccoupe reopened this Feb 13, 2015

@BackOrder

This comment has been minimized.

Show comment
Hide comment
@BackOrder

BackOrder Feb 13, 2015

Collaborator

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?

Collaborator

BackOrder commented Feb 13, 2015

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

This comment has been minimized.

Show comment
Hide comment
@ccoupe

ccoupe Feb 13, 2015

Contributor

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.

Contributor

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.

@ccoupe ccoupe closed this Feb 13, 2015

@liZe liZe referenced this issue in Kozea/WeasyPrint Nov 26, 2016

Closed

Support @font-face on Windows #376

@pkulchenko pkulchenko referenced this issue in simoncozens/sile Feb 1, 2017

Open

Windows binary distribution #410

0 of 4 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment