FedoraCentOS install TTF/otf fonts

Posted dfsxh

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FedoraCentOS 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-packagekit
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository updates-debuginfo is listed more than once in the configuration
Repository updates-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Repository fedora is listed more than once in the configuration
Repository fedora-debuginfo is listed more than once in the configuration
Repository fedora-source is listed more than once in the configuration
Loading 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 k
Is this ok [y/d/N]: y
Downloading packages:
xorg-x11-xfs-1.1.2-4.fc20.x86_64.rpm                        |  75 kB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running 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

以上是关于FedoraCentOS install TTF/otf fonts的主要内容,如果未能解决你的问题,请参考以下文章

使用命令行安装 .ttf 字体

Kubuntu的一些常用配置

安装 ttf mscorefonts安装程序后的软件安装"下载额外数据文件失败"

安装 ttf mscorefonts安装程序后的软件安装"下载额外数据文件失败"

Windows Installer:哪些文件被视为“版本化”[关闭]

子进程 已安装 post-installation 脚本 返回错误状态 1 解决办法