Linux 下安装中文字体
发布时间:2020-12-14 00:42:08 所属栏目:Linux 来源:网络整理
导读:本文以安装黑体为例,简单演示如何在Linux下安装中文字体。 环境信息介绍 [[email?protected] ~]# cat /etc/redhat-releaseCentOS Linux release 7.1.1503 (Core)[[email?protected] ~]#[[email?protected] ~]# uname -r3.10.0-229.el7.x86_64[[email?protec
本文以安装黑体为例,简单演示如何在Linux下安装中文字体。 环境信息介绍[[email?protected] ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [[email?protected] ~]# [[email?protected] ~]# uname -r 3.10.0-229.el7.x86_64 [[email?protected] ~]# [[email?protected] ~]# echo $LANG en_US.UTF-8 [[email?protected] ~]# cat /etc/locale.conf LANG="zh_CN.UTF-8" [[email?protected] ~]# [[email?protected] ~]# locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= [[email?protected] ~]# 依赖的命令操作依赖几个命令,如果系统中不存在需要手动安装下。
这两个命令包含在fontconfig包里,可以通过下面的命令进行安装。 yum install fontconfig
这个命令属于xorg-x11-font-utils工具包,可以通过下面的命令进行安装。 yum install mkfontscale 操作步骤
mkdir /usr/share/fonts/zh_CN PS:
mkfontscale mkfontdir fc-cache -fv 执行上述命令之后,在目录下可以看到一个fonts.dir和一个fonts.scale文件 [[email?protected] zh_CN]# pwd /usr/share/fonts/zh_CN [[email?protected] zh_CN]# ll total 9532 -rw-r--r-- 1 root root 66 Sep 4 11:39 fonts.dir -rw-r--r-- 1 root root 66 Sep 4 11:39 fonts.scale -rwxrw-rw- 1 root root 9751960 Sep 4 11:38 simhei.ttf [[email?protected] zh_CN]# 文件内容 [[email?protected] zh_CN]# cat fonts.dir 1 simhei.ttf -misc-simhei-medium-r-normal--0-0-0-0-p-0-iso10646-1 [[email?protected] zh_CN]# cat fonts.scale 1 simhei.ttf -misc-simhei-medium-r-normal--0-0-0-0-p-0-iso10646-1 [[email?protected] zh_CN]#
# 查看所有可用字体 [[email?protected] zh_CN]# fc-list /usr/share/fonts/dejavu/DejaVuSansCondensed-Oblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique /usr/share/fonts/dejavu/DejaVuSansCondensed-Bold.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold /usr/share/fonts/dejavu/DejaVuSans.ttf: DejaVu Sans:style=Book /usr/share/fonts/zh_CN/simhei.ttf: SimHei:style=Regular,Normal /usr/share/fonts/dejavu/DejaVuSans-Bold.ttf: DejaVu Sans:style=Bold /usr/share/fonts/dejavu/DejaVuSansCondensed.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book /usr/share/fonts/dejavu/DejaVuSans-ExtraLight.ttf: DejaVu Sans,DejaVu Sans Light:style=ExtraLight /usr/share/fonts/dejavu/DejaVuSansCondensed-BoldOblique.ttf: DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique /usr/share/fonts/dejavu/DejaVuSans-Oblique.ttf: DejaVu Sans:style=Oblique /usr/share/fonts/dejavu/DejaVuSans-BoldOblique.ttf: DejaVu Sans:style=Bold Oblique [[email?protected] zh_CN]# # 只查看中文字体,SimHei字体安装成功。 [[email?protected] zh_CN]# fc-list :lang=zh /usr/share/fonts/zh_CN/simhei.ttf: SimHei:style=Regular,Normal [[email?protected] zh_CN]# (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |