钱包包包妮 發表於 2019-8-28 12:19:00

Fedora、CentOS install TTF/otf fonts

<p>Step 1:切换至字体下载目录:</p>
<div class="cnblogs_code">
<pre>$ 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</pre>
</div>
<p>Step 2:切换至root用户:</p>
<div class="cnblogs_code">
<pre>$ su
密码:
# </pre>
</div>
<p>Step 3:新建/usr/share/fonts/default/TrueType目录</p>
<div class="cnblogs_code">
<pre># mkdir /usr/share/fonts/default/TrueType</pre>
</div>
<p>Step 4:把字体拷贝到新建的目录下</p>
<div class="cnblogs_code">
<pre># cp RBNo2Light*.otf /usr/share/fonts/default/TrueType/</pre>
</div>
<p>Step 5:切换至字体所在目录</p>
<div class="cnblogs_code">
<pre># cd /usr/share/fonts/default/TrueType/</pre>
</div>
<p>Step 6:创建fonts.scale</p>
<div class="cnblogs_code">
<pre># 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
# ttmkfdir
# 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</pre>
</div>
<p>Step 7:创建fonts.dir</p>
<div class="cnblogs_code">
<pre># mkfontdir
# 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</pre>
</div>
<p>Step 8: 将字体路径添加到X Font serve 路径(或者# /usr/sbin/chkfontpath --add /usr/share/fonts/default/TrueType):</p>
<div class="cnblogs_code">
<pre># chkfontpath --add /usr/share/fonts/default/TrueType</pre>
</div>
<p>Step 9:更新字体信息cache</p>
<div class="cnblogs_code">
<pre># fc-cache</pre>
</div>
<p>Step 10:查看字体</p>
<div class="cnblogs_code">
<pre>$ 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</pre>
</div>
<p>&nbsp;</p>
<p>备注:如果没有chkfontpath,则安装chkfontpath(chkfontpath依赖xfs),安装方法如下:</p>
<p>Step 1:&nbsp;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,然后安装。</p>
<p>Step 2:rpm安装chkfontpath(可能缺少依赖)</p>
<div class="cnblogs_code">
<pre>$ chmod +x chkfontpath-1.10.1-1.1.x86_64.rpm
$ sudo rpm -ivh chkfontpath-1.10.1-1.1.x86_64.rpm
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 需要</pre>
</div>
<p>Step 3:安装xfs依赖</p>
<div class="cnblogs_code">
<pre>$ 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
正在解决依赖关系
--&gt; 正在检查事务
---&gt; 软件包 xorg-x11-xfs.x86_64.1.1.1.2-4.fc20 将被 安装
--&gt; 解决依赖关系完成

依赖关系解决

================================================================================
Package             架构          版本                     源             大小
================================================================================
正在安装:
xorg-x11-xfs      x86_64      1:1.1.2-4.fc20         fedora         75 k

事务概要
================================================================================
安装1 软件包

总下载量:75 k
安装大小:136 k
Is this ok : y
Downloading packages:
xorg-x11-xfs-1.1.2-4.fc20.x86_64.rpm                        |75 kB00: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                                          

完毕!</pre>
</div>
<p>Step 4:使用RPM安装chkfontpath:</p>
<div class="cnblogs_code">
<pre>$ 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
准备中...                        #################################
正在升级/安装...
   1:chkfontpath-1.10.1-1.1         #################################
$ </pre>
</div>
<p>参考:http://vijayk.blogspot.jp/2005/05/how-to-install-ttfotf-fonts-in-linux.html</p><br><br>
来源:https://www.cnblogs.com/dfsxh/p/11423319.html
頁: [1]
查看完整版本: Fedora、CentOS install TTF/otf fonts