ldo / python_fontconfig Goto Github PK
View Code? Open in Web Editor NEWPython wrapper for Fontconfig
Python wrapper for Fontconfig
I installed python_config, but when I try to import the librairy in a file, I get this error:
Traceback (most recent call last):
File "fontCollector.py", line 402, in <module>
import fontconfig as fc
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\site-packages\fontconfig.py", line 35, in <module>
fc = ct.cdll.LoadLibrary("libfontconfig.so.1")
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python38\lib\ctypes\__init__.py", line 373, in __init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'libfontconfig.so.1' (or one of its dependencies). Try using the full path with constructor syntax.
I am on windows, so it is probably the reason why I have this issues.
It appears python_fontconfig
requires a newer version of libfontconfig
under Ubuntu 18.04.
After installing python_fontconfig
using pip, I can't import the module due to missing symbol FcConfigFileInfoIterInit
.
$ ipython
Python 3.6.9 (default, Nov 7 2019, 10:44:02)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.15.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: import fontconfig as fc
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-1-e5f1b0bd6fa9> in <module>
----> 1 import fontconfig as fc
~/.virtualenvs/test/lib/python3.6/site-packages/fontconfig.py in <module>
574 fc.FcConfigSetSysRoot.restype = None
575 fc.FcConfigSetSysRoot.argtypes = (ct.c_void_p, ct.c_void_p)
--> 576 fc.FcConfigFileInfoIterInit.restype = None
577 fc.FcConfigFileInfoIterInit.argtypes = (ct.c_void_p, ct.c_void_p)
578 fc.FcConfigFileInfoIterNext.restype = FC.Bool
/usr/lib/python3.6/ctypes/__init__.py in __getattr__(self, name)
359 if name.startswith('__') and name.endswith('__'):
360 raise AttributeError(name)
--> 361 func = self.__getitem__(name)
362 setattr(self, name, func)
363 return func
/usr/lib/python3.6/ctypes/__init__.py in __getitem__(self, name_or_ordinal)
364
365 def __getitem__(self, name_or_ordinal):
--> 366 func = self._FuncPtr((name_or_ordinal, self))
367 if not isinstance(name_or_ordinal, int):
368 func.__name__ = name_or_ordinal
AttributeError: /usr/lib/x86_64-linux-gnu/libfontconfig.so.1: undefined symbol: FcConfigFileInfoIterInit
Installed in Python3.6.9 virtualenv on Ubuntu 18.04. libfontconfig info:
$ apt show libfontconfig1
Package: libfontconfig1
Version: 2.12.6-0ubuntu2
Priority: optional
Section: libs
Source: fontconfig
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
According to the fontconfig docs that symbol is available since version 2.12.91 so I assume I need to install a newer version of libfontconfig
.
And indeed, the symbol doesn't exist in the installed libfontconfig.so.1
$ nm -gD /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 | grep ConfigFile
000000000000ce00 T FcConfigFilename
000000000000adb0 T FcConfigGetConfigFiles
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.