锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

linux系统添加中文字体后不生效

时间:2023-06-15 21:07:00 kum连接器插头

CentOS7.5—7.9 中文字体匹配错误问题 fontconfig-2.13.0
CentOS7.5—7.9系统fontconfig默认版本为2.13.0.这个版本的字体服务会导致中文字体匹配错误。即使在系统中成功添加中文字体,也不能使用中文字体
/usr/share/fonts创建/目录FangZheng、Windows相应的文件夹ttf、ttc将文件放入文件夹中
刷新系统字体缓存
$ fc-cache && mkfontscale && mkfontdir

查看字体支持的中文字体文件
$ fc-list :lang=zh
/usr/share/fonts/wps-office/FZXBSJW.TTF: FZXiaoBiaoSong-B05S:style=Regular

/usr/share/fonts/wps-office/FZKANGFW.TTF: FZKangTi-S07T:style=Regular

与中文字体显示(其他系统)正常匹配
$ fc-list :lang=zh
/usr/share/fonts/wps-office/FZXBSJW.TTF: 方正小标宋简体,FZXiaoBiaoSong-B05S:style=Regular
/usr/share/fonts/wps-office/FZHTK.TTF: 方正黑体_GBK,FZHei-B01:style=Regular
/usr/share/fonts/wps-office/FZXBSK.TTF: 方正小标宋_GBK,FZXiaoBiaoSong-B05:style=Regular

/usr/share/fonts/wps-office/FZSSK.TTF: 方正书宋_GBK,FZShuSong-Z01:style=Regular

看区别吧! 正常输出有中文字体名,根据中文字体名匹配相应的字体文件

$ fc-match -a <字体名> | head
$ fc-match -a 方正仿宋简体 | head
$ fc-match -a 方正小标宋简体 | head
$ fc-match -a 方正仿宋_GBK | head

下面 方正仿宋简体 没有匹配到
$ fc-match -a 方正仿宋简体 | head
NotoSansCJK-Regular.ttc: “Noto Sans CJK SC” “Regular”
NotoSansCJK-Medium.ttc: “Noto Sans CJK SC” “Medium”

与中文字体显示(其他系统)正常匹配
$ fc-match -a 方正小标宋简体 | head
FZXBSJW.TTF: 方正小标宋简体 “Regular”
NotoSansCJK-Regular.ttc: “Noto Sans CJK SC” “Regular”
$ fc-match -a 方正仿宋_GBK | head
FZFSK.TTF: “方正仿宋_GBK” “Regular”
NotoSansCJK-Regular.ttc: “Noto Sans CJK SC” “Regular”

查询字体文件的相关信息,字体文件中不显示中文名称等信息
$ fc-query /usr/share/fonts/wps-office/FZXBSJW.TTF
Pattern has 24 elts (size 32)
family: “FZXiaoBiaoSong-B05S”(s)
familylang: “en”(s)
style: “Regular”(s)
stylelang: “en”(s)
fullname: “FZXiaoBiaoSong-B05S”(s)
fullnamelang: “en”(s)
slant: 0(i)(s)
weight: 80(f)(s)
width: 100(f)(s)
foundry: “BDFZ”(s)
file: “/usr/share/fonts/wps-office/FZXBSJW.TTF”(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:

lang: bg|fj|ho|ia|ie|io|kum|nr|om|os|ru|sel|so|ss|st|sw|ts|uz|xh|zh-cn|zh-sg|zu|kj|kwm|ms|ng|rn|rw|sn|za(s)
fontversion: 0(i)(s)
capability: “otlayout:hani”(s)
fontformat: “TrueType”(s)
decorative: False(s)
postscriptname: “FZXBSJW–GB1-0”(s)
color: False(s)
symbol: False(s)
variable: False(s)

与中文字体显示(其他系统)正常匹配
$ fc-query /usr/share/fonts/wps-office/FZXBSJW.TTF
Pattern has 24 elts (size 32)
family: “FZXiaoBiaoSong-B05S”(s) 方正小标宋简体(s)
familylang: “en”(s) “zh-cn”(s)
style: “Regular”(s)
stylelang: “en”(s)
fullname: “FZXiaoBiaoSong-B05S”(s) 方正小标宋简体(s)
fullnamelang: “en”(s) “zh-cn”(s)
slant: 0(i)(s)
weight: 80(f)(s)
width: 100(f)(s)
foundry: “BDFZ”(s)
file: “/usr/share/fonts/wps-office/FZXBSJW.TTF”(s)
index: 0(i)(s)
outline: True(s)
scalable: True(s)
charset:

lang: bg|fj|ho|ia|ie|io|kum|nr|om|os|ru|sel|so|ss|st|sw|ts|uz|xh|zh-cn|zh-sg|zu|kj|kwm|ms|ng|rn|rw|sn|za(s)
fontversion: 0(i)(s)
capability: “otlayout:hani”(s)
fontformat: “TrueType”(s)
decorative: False(s)
postscriptname: “FZXBSJW–GB1-0”(s)
color: False(s)
symbol: False(s)
variable: False(s)

查询相同,字体文件相同,fontconfig-2.13.0不输出中文字体名
解决方法(降fontconfig版本):
1.卸载fontconfig-2.13.0
#yum list installed | grep fontconfig
#rpm -e --nodeps fontconfig
#yum list installed | grep fontconfig

2.安装fontconfig-2.10.95(fontconfig-2.10.95下载,可安装CentOS7.0—7.2系统,通过统yum源来下载fontconfig-2.10.95的rpm包)
#rpm -ivh fontconfig-2.10.95-11.el7.aarch64.rpm
#rpm -qi fontconfig

3.更新字体缓存和索引
#fc-cache && mkfontscale && mkfontdir

4.检查字体是否包含中文
#fc-query /usr/share/fonts/wps-office/FZXBSJW.TTF

5.检查能否与字体匹配
#fc-match -a 方正仿宋简体 | head
#fc-match -a 方正小标宋简体 | head
#fc-match -a 方正仿宋_GBK | head

fontconfig-2.13.1 这个问题也应该解决,升级过程中还有其他问题,操作不成功。

fontconfig降版后遗症
/sbin/ldconfig: /lib64/libstdc .so.6 不是符号链接

$ sudo ldconfig -v
$ sudo ln -sf /path/source.so.x.xxx /path/source.so.x

$ ll /lib64/libstdc .so*
$ sudo ln -sf /lib64/libstdc .so.6.0.19 /lib64/libstdc .so.6
这个库修改了吗? /usr/lib64/libfontconfig.so

ll /usr/lib64/libfontconfig.so*
lrwxrwxrwx. 1 root root 23 Jul 13 23:31 /usr/lib64/libfontconfig.so -> libfontconfig.so.1.11.1
lrwxrwxrwx. 1 root root 22 Aug 20 06:41 /usr/lib64/libfontconfig.so.1 -> libfontconfig.so.1.7.0
-rwxr-xr-x. 1 root root 272064 Aug 24 2018 /usr/lib64/libfontconfig.so.1.7.0

原文地址:htp://www.manongjc.com/detail/25-aetcdrhmtiauyin.html

锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章