CentOS Linux安装中文字体库,解决中文乱码问题
原因解决步骤fc-list
原因
CentOS中没有安装中文字体库,会出现中文乱码问题,解决问题需安装中文字库
解决步骤
Centos7系统添加Windows中文字体
查看centos系统的字体库
fc-list :lang
=zh
进入到该字体库的目录
cd /usr/share/fonts
mkdir 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-list
FC-LIST
(1
) FC-LIST
(1
)
NAME
fc-list - list available fonts
SYNOPSIS
fc-list
[ -vVh
] [ --verbose
] [ [ -f
format ] [ --format
format ]
] [ [ -q
] [ --quiet
] ] [ --version
] [ --help
]
[ pattern
[ element
...
] ]
DESCRIPTION
fc-list lists fonts and styles available on the system
for applications
using fontconfig. If any elements are specified, only those are
printed. Otherwise family and style are printed, unless verbose output
is requested.
OPTIONS
This program follows the usual GNU
command line syntax, with long
options starting with two dashes
(`-'). A summary of options is
included below.
-v Print verbose output of the whole font pattern for each match,
or elements if any is provided.
-f Format output according to the format specifier format.
-q Suppress all normal output. returns 1 as the error code if no
fonts matched.
-V Show version of the program and exit.
-h Show summary of options.
pattern
If this argument is set, only fonts matching pattern are dis-
played.
element
If set, the element property is displayed for matching fonts.
EXAMPLES
fc-list
Lists all font faces.
fc-list :lang=hi
Lists font faces that cover Hindi.
fc-list : family style file spacing
Lists the filename and spacing value for each font face. ``:
''
is an empty pattern that matches all fonts.
SEE ALSO
fc-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.