首页 > 代码库 > Fedora、CentOS install TTF/otf fonts
Fedora、CentOS install TTF/otf fonts
Step 1:切换至字体下载目录:
[Richard@localhost Downloads]$ ll | grep otf-rw-rw-r--. 1 Richard Richard 16676 7月 19 2011 RBNo2Light_a.otf-rw-rw-r--. 1 Richard Richard 17912 7月 19 2011 RBNo2Light.otf
Step 2:切换至root用户:
[Richard@localhost Downloads]$ su密码:[root@localhost Downloads]#
Step 3:新建/usr/share/fonts/default/TrueType目录
[root@localhost Downloads]# mkdir /usr/share/fonts/default/TrueType
Step 4:把字体拷贝到新建的目录下
[root@localhost Downloads]# cp RBNo2Light*.otf /usr/share/fonts/default/TrueType/
Step 5:切换至字体所在目录
[root@localhost Downloads]# cd /usr/share/fonts/default/TrueType/
Step 6:创建fonts.scale
[root@localhost TrueType]# ll总用量 40-rw-r--r--. 1 root root 16676 12月 1 20:59 RBNo2Light_a.otf-rw-r--r--. 1 root root 17912 12月 1 20:59 RBNo2Light.otf[root@localhost TrueType]# ttmkfdir [root@localhost TrueType]# ll总用量 44-rw-r--r--. 1 root root 2 12月 1 21:00 fonts.scale-rw-r--r--. 1 root root 16676 12月 1 20:59 RBNo2Light_a.otf-rw-r--r--. 1 root root 17912 12月 1 20:59 RBNo2Light.otf
Step 7:创建fonts.dir
[root@localhost TrueType]# mkfontdir [root@localhost TrueType]# ll总用量 48-rw-r--r--. 1 root root 2 12月 1 21:00 fonts.dir-rw-r--r--. 1 root root 2 12月 1 21:00 fonts.scale-rw-r--r--. 1 root root 16676 12月 1 20:59 RBNo2Light_a.otf-rw-r--r--. 1 root root 17912 12月 1 20:59 RBNo2Light.otf
Step 8: 将字体路径添加到X Font serve 路径(或者[root@localhost Downloads]# /usr/sbin/chkfontpath --add /usr/share/fonts/default/TrueType):
[root@localhost TrueType]# chkfontpath --add /usr/share/fonts/default/TrueType
Step 9:更新字体信息cache
[root@localhost TrueType]# fc-cache
Step 10:查看字体
[Richard@localhost Downloads]$ fc-list :lang=en | grep RB/usr/share/fonts/default/TrueType/RBNo2Light.otf: RBNo2 Light:style=Regular/usr/share/fonts/default/TrueType/RBNo2Light_a.otf: RBNo2 Light Alternative :style=Regular
备注:如果没有chkfontpath,则安装chkfontpath(chkfontpath依赖xfs),安装方法如下:
Step 1: http://rpm.pbone.net/index.php3/stat/4/idpl/13943722/dir/centos_5/com/chkfontpath-1.10.1-1.1.x86_64.rpm.html下载chkfontpath-1.10.1-1.1.x86_64.rpm,然后安装。
Step 2:rpm安装chkfontpath(可能缺少依赖)
[Richard@localhost Downloads]$ chmod +x chkfontpath-1.10.1-1.1.x86_64.rpm [Richard@localhost Downloads]$ sudo rpm -ivh chkfontpath-1.10.1-1.1.x86_64.rpm [sudo] password for Richard: 警告:chkfontpath-1.10.1-1.1.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID e8562897: NOKEY错误:依赖检测失败: xfs 被 chkfontpath-1.10.1-1.1.x86_64 需要
Step 3:安装xfs依赖
[Richard@localhost Downloads]$ sudo yum install xfs已加载插件:fastestmirror, langpacks, refresh-packagekitRepository updates is listed more than once in the configurationRepository updates-debuginfo is listed more than once in the configurationRepository updates-source is listed more than once in the configurationRepository updates is listed more than once in the configurationRepository updates-debuginfo is listed more than once in the configurationRepository updates-source is listed more than once in the configurationRepository fedora is listed more than once in the configurationRepository fedora-debuginfo is listed more than once in the configurationRepository fedora-source is listed more than once in the configurationRepository fedora is listed more than once in the configurationRepository fedora-debuginfo is listed more than once in the configurationRepository fedora-source is listed more than once in the configurationLoading mirror speeds from cached hostfile * fedora: mirrors.163.com * rpmfusion-free-rawhide: ftp.sjtu.edu.cn * rpmfusion-nonfree-rawhide: mirrors.163.com * updates: mirrors.163.com正在解决依赖关系--> 正在检查事务---> 软件包 xorg-x11-xfs.x86_64.1.1.1.2-4.fc20 将被 安装--> 解决依赖关系完成依赖关系解决================================================================================ Package 架构 版本 源 大小================================================================================正在安装: xorg-x11-xfs x86_64 1:1.1.2-4.fc20 fedora 75 k事务概要================================================================================安装 1 软件包总下载量:75 k安装大小:136 kIs this ok [y/d/N]: yDownloading packages:xorg-x11-xfs-1.1.2-4.fc20.x86_64.rpm | 75 kB 00:00 Running transaction checkRunning transaction testTransaction test succeededRunning transaction (shutdown inhibited) 正在安装 : 1:xorg-x11-xfs-1.1.2-4.fc20.x86_64 1/1 验证中 : 1:xorg-x11-xfs-1.1.2-4.fc20.x86_64 1/1 已安装: xorg-x11-xfs.x86_64 1:1.1.2-4.fc20 完毕!
Step 4:使用RPM安装chkfontpath:
[Richard@localhost Downloads]$ sudo rpm -ivh chkfontpath-1.10.1-1.1.x86_64.rpm 警告:chkfontpath-1.10.1-1.1.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID e8562897: NOKEY准备中... ################################# [100%]正在升级/安装... 1:chkfontpath-1.10.1-1.1 ################################# [100%][Richard@localhost Downloads]$
参考:http://vijayk.blogspot.jp/2005/05/how-to-install-ttfotf-fonts-in-linux.html
Fedora、CentOS install TTF/otf fonts