欢迎访问我的个人博客:https://xiaohuilee.github.io/

1. 从Windows中取出字体并上传到服务器
1.1 进入C:\Winodws\Fonts目录下。
在右上角的搜索框中输入你要添加的字体名称(Consolas),在众多字体中找到它,将其移动到另一个文件夹——share
文件夹中。
注意,虽然在字体目录中只显示为一个Consolas字体,实际包括四个字体文件。


1.2 上传到服务器(CentOs)
1.2.1 安装lrzsz包
lrzsz
is a unix communication package providing the XMODEM, YMODEM ZMODEM file transfer protocols. lrzsz is a heavily rehacked version of the last public domain release of Omen Technologies rzsz package, and is now free software and released under the GNU General Public Licence.
使用以下命令安装lrzsz:
yum install -y lrzsz

1.2.2 上传字体
lrzsz用于上传的命令是rz
,与之对应的下载命令是sz
,在终端中输入rz -y
,终端会弹出上传窗口,定位到share
文件夹,将字体选中,点击确定上传。

上传完毕后,输入命令ls
可以查看字体文件。

2. 向CentOS添加字体
2.1 添加字体到系统文件夹
启动终端,进入共享文件夹目录。切换到 root 帐户,然后键入命令
#新建目录newFont以存放新字体
mkdir /usr/share/fonts/newFont/
#拷贝当前目录下的字体到/usr/share/fonts/newFont中
cp *.ttf /usr/share/fonts/newFont/
使用
ls -al /usr/share/fonts/newFont/
查看对应字体文件是否已经复制到系统文件夹。

2.1 建立字体缓存
建立字体缓存,命令如下(;
表示在同一行内书写多条命令,依次执行)
cd /usr/share/fonts/newFont/
mkfontscale; mkfontdir; fc-cache -fv
执行完毕之后,字体就安装好了。

3. 设置系统字体
字体安装成功之后,我们就可以让系统使用新安装的字体了。在图形界面点击“系统”-“偏好”-“外观”,将弹出如下设置框。

这时,点击相应条目的字体,我们就可以根据自己的喜好设置为刚才添加的字体。


下面是更改字体后的终端效果。

完。
网友评论