系统在运行一些程序时出现了fontconfig error的问题,经排查在python的matplot语句运行时会报这类错,虽然对结果没有什么影响,但这一堆报错不是强迫症看着都难受
于此同时,发现启动gedit时也会报此类错误
网上查找该类错误,发现这是一个悬而未决的问题,有帖子讨论过此问题,但并没有找到解决方案。
wangyihu2020@wangyihu2020-LEGION-REN7000K-26IOB:~$ gedit test
Fontconfig warning: "/etc/fonts/fonts.conf", line 5: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/fonts.conf", line 6: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/fonts.conf", line 9: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/conf.d/20-unhint-small-vera.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/conf.d/25-unhint-nonlatin.conf", line 8: unknown element "description"
Fontconfig warning: "/etc/fonts/conf.d/30-metric-aliases.conf", line 4: unknown element "its:rules"
Fontconfig warning: "/etc/fonts/conf.d/30-metric-aliases.conf", line 5: unknown element "its:translateRule"
Fontconfig error: "/etc/fonts/conf.d/30-metric-aliases.conf", line 5: invalid attribute 'translate'
Fontconfig error: "/etc/fonts/conf.d/30-metric-aliases.conf", line 5: invalid attribute 'selector'
Fontconfig error: "/etc/fonts/conf.d/30-metric-aliases.conf", line 6: invalid attribute 'xmlns:its'
Fontconfig error: "/etc/fonts/conf.d/30-metric-aliases.conf", line 6: invalid attribute 'version'
Fontconfig warning: "/etc/fonts/conf.d/30-metric-aliases.conf", line 8: unknown element "description"
.....
从错误信息看,应该是调包时候不认识一些固定的代码格式,那么问题可能出在版本不匹配上
故猜想gedit及一些代码运行环境中调的fontconfig包与系统fontconfig包版本不一致
通过在根目录搜索libfontconfig包,找到了libfontconfig.so.1, libfontconfig.so.1.10.1, libfontconfig.so.1.12.1等文件,而且数目很多,经过观察他们分属于不同的软件环境中,即许多软件在调用时会调用自己的libfontconfig库
第一个想法是用.so.1.12.0替换.so.10.1,但试了好几个名为.so.12.0的文件,都有不同的报错。
突然想起来fontconfig库每个ubuntu系统都是有的,但只有本人报这类错,于是乎比较了同事主机上的该库文件与本人主机上的该库,发现文件有细微不同
如下:
图上看,确实是本人主机上的文件多了几行,而这几行正是报错信息提示的一些tag,仔细看了下这句里有个网址,点进去是w3c官网的ITS标准,原来本人主机此库的代码多包含的几行为ITS版本信息,属于开发者添加的描述信息,而这些描述信息不能被旧的libfontconfig.so.1.10.1正确识别,故报错。但由于描述信息不影响正常信息,所以运行结果除了一堆报错外没有其它问题。
故解决方案很简单,同事电脑上的库文件是没有问题的,把/etc/fonts/用upan拷过来替换就完事了hhh
这次调fontconfig库用了一天多,经历了卸载fontconfig库时把桌面卸掉、修改了fonts.conf文件某几行导致系统全部乱码等问题,在重装系统的边缘反复横跳~
这一坨报错虽然没有任何不良影响,但如果初学者遇到了还是挺搞心态的,写此文记录此类报错对系统没有影响之说明及解决方案。
相关帖:https://bbs.archlinux.org/viewtopic.php?id=235643