CentOS Linux安装中文字体库,解决中文乱码问题
原因解决步骤fc-list原因
CentOS中没有安装中文字体库,会出现中文乱码问题,解决问题需安装中文字库
解决步骤
Centos7系统添加Windows中文字体
查看centos系统的字体库
fc-list :lang=zh
进入到该字体库的目录
cd /usr/share/fontsmkdir chinese
将本地windows 的字体库(C:\Windows\Fonts)拷贝至chinese目录下。
注意将ttc 后缀改为ttf
执行命令:mkfontscale
执行命令:mkfontdir
,执行此命令遇到入下错误时,可直接将vga936.fon文件删除。然后再开始
(按关键字查找扩展名的命令为:find / -name "*.fon"
删除查找出的内容命令为:find / -name "*.fon" | xargs rm -rf
)
执行命令:fc-cache
再次查看字体库,显示如下就安装成功
fc-list
fc-listFC-LIST(1) FC-LIST(1)NAMEfc-list - list available fontsSYNOPSISfc-list [ -vVh ] [ --verbose ] [ [ -f format ] [ --format format ]] [ [ -q ] [ --quiet ] ] [ --version ] [ --help ][ pattern [ element... ] ]DESCRIPTIONfc-list lists fonts and styles available on the system for applicationsusing fontconfig. If any elements are specified, only those areprinted. Otherwise family and style are printed, unless verbose outputis requested.OPTIONSThis program follows the usual GNU command line syntax, with longoptions starting with two dashes (`-'). A summary of options isincluded below.-vPrint verbose output of the whole font pattern for each match,or elements if any is provided.-fFormat output according to the format specifier format.-qSuppress all normal output. returns 1 as the error code if nofonts matched.-VShow version of the program and exit.-hShow summary of options.patternIf this argument is set, only fonts matching pattern are dis-played.elementIf set, the element property is displayed for matching fonts.EXAMPLESfc-listLists all font faces.fc-list :lang=hiLists font faces that cover Hindi.fc-list : family style file spacingLists the filename and spacing value for each font face. ``:''is an empty pattern that matches all fonts.SEE ALSOfc-match(1) FcFontList(3) FcPatternFormat(3) fc-cat(1) fc-cache(1) fc-pattern(1) fc-query(1) fc-scan(1)The fontconfig user's guide, in HTML format: /usr/share/doc/fontcon-fig/fontconfig-user.html.
如果觉得《CentOS Linux安装中文字体库 解决中文乱码问题》对你有帮助,请点赞、收藏,并留下你的观点哦!