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 warning: line 5: unknown element "description" #1474

Closed
cheenng opened this issue Oct 18, 2021 · 5 comments
Closed

Fontconfig warning: line 5: unknown element "description" #1474

cheenng opened this issue Oct 18, 2021 · 5 comments

Comments

@cheenng
Copy link

cheenng commented Oct 18, 2021

Hello Kozea,

I installed weasyprint today and got stuck on tackling a error:

C:\Users\ych>venv\Scripts\activate.bat
(venv) C:\Users\ych>weasyprint
Fontconfig warning: line 5: unknown element "description"

(venv) C:\Users\ych>python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from weasyprint import HTML
Fontconfig warning: line 5: unknown element "description"

(venv) C:\Users\ych>  /* python crashes and exits */

(venv) C:\Users\ych>python -m weasyprint --info
Fontconfig warning: line 5: unknown element "description"

(venv) C:\Users\ych>

This warning matters because it causes python crashes with "Process finished with exit code -1073741819 (0xC0000005)" .
It seems that the file:
"C:\Program Files\GTK3-Runtime Win64\etc\fonts\fonts.conf" cannot be read correctly. The tag description cannot be understood. Below are the first 5 lines in fonts.conf:

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

Even though I removed the line of "description", python still crashed.

What did I miss regarding the installation? Is there Anyone encountering the same problem?
Which program read fonts.conf?

I followed the instruction in here for windows
https://doc.courtbouillon.org/weasyprint/stable/first_steps.html#installation

My Enviroment:
Windows 10, Python Python 3.8.3 , GTK Installation by "gtk3-runtime-3.24.29-2021-04-29-ts-win64.exe"

Any responses would be very appreciated !
Thank you!

Best regards,
Yuan

@liZe
Copy link
Member

liZe commented Oct 18, 2021

Hello!

The amount of bugs reported lately by Windows users is insane, there’s definitely something wrong in the way WeasyPrint works and/or is documented for this platform. Maybe we should consider only supporting WSL…

Your problem probably comes from a mismatch between the version of fontconfig and the version of the configuration files, as explained in this bug report and in many other issues on the web.

How it’s possible? That’s a good question. Maybe there’s another version of fontconfig installed elsewhere on your system and used instead of GTK’s one. Maybe GTK’s version of fontconfig is used, but reads an old config file elsewhere.

What you can do is to try to add an empty line before <description>Default configuration file</description> and see if it changes the line number reported in the error. If it does, it means that the problem is actually in this config file, and that an old version of fontconfig is used instead of GTK’s one. If it doesn’t, it means that the problem is in another config file, and you have to find which one.

@cheenng
Copy link
Author

cheenng commented Oct 19, 2021

Hello!

The amount of bugs reported lately by Windows users is insane, there’s definitely something wrong in the way WeasyPrint works and/or is documented for this platform. Maybe we should consider only supporting WSL…

Your problem probably comes from a mismatch between the version of fontconfig and the version of the configuration files, as explained in this bug report and in many other issues on the web.

How it’s possible? That’s a good question. Maybe there’s another version of fontconfig installed elsewhere on your system and used instead of GTK’s one. Maybe GTK’s version of fontconfig is used, but reads an old config file elsewhere.

What you can do is to try to add an empty line before <description>Default configuration file</description> and see if it changes the line number reported in the error. If it does, it means that the problem is actually in this config file, and that an old version of fontconfig is used instead of GTK’s one. If it doesn’t, it means that the problem is in another config file, and you have to find which one.

Hi LiZe,
thank you for your reply.
I found another libconfig.dll in my environment, which is C:\Program Files\Graphviz\bin\fontconfig.dll and is also in my PATH.
If I rename it, the weasyprint will find the correct one in GTK and works.
Do you have an idea how can i solve this without renaming dll or uninstalling Graphviz?

Best regards,
Yuan

@liZe
Copy link
Member

liZe commented Oct 19, 2021

I found another libconfig.dll in my environment, which is C:\Program Files\Graphviz\bin\fontconfig.dll and is also in my PATH.
If I rename it, the weasyprint will find the correct one in GTK and works.
Do you have an idea how can i solve this without renaming dll or uninstalling Graphviz?

Then this bug is a new duplicate of #1435, and you’ll have to wait for a real fix.

Before that, you can try to use the same version libfontconfig.dll everywhere and see if it works.

@cheenng
Copy link
Author

cheenng commented Oct 19, 2021

I found another libconfig.dll in my environment, which is C:\Program Files\Graphviz\bin\fontconfig.dll and is also in my PATH.
If I rename it, the weasyprint will find the correct one in GTK and works.
Do you have an idea how can i solve this without renaming dll or uninstalling Graphviz?

Then this bug is a new duplicate of #1435, and you’ll have to wait for a real fix.

Before that, you can try to use the same version libfontconfig.dll everywhere and see if it works.

Thanks for the information. I will watch that issue.
At the moment I just changed the code in {my python}\Lib\site-packages\weasyprint\text\ffi.py to force that the libfontconfig.dll is loaded before fontconfig.dll.

@liZe
Copy link
Member

liZe commented Oct 19, 2021

At the moment I just changed the code in {my python}\Lib\site-packages\weasyprint\text\ffi.py to force that the libfontconfig.dll is loaded before fontconfig.dll.

OK, then I’ll close this issue and we’ll continue the discussion in #1435.

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

No branches or pull requests

2 participants