debian如何添加字体

2022年 7月 12日 80点热度 0人点赞

原文链接: https://blog.csdn.net/Yang838020787/article/details/118141643

查看 debian 的发行版本信息

cat /etc/os-release

更换 apt-get 的源:

修改源配置:vim /etc/apt/sources.list
根据 debian 的版本在配置中加入合适的阿里源 (也可选择其他源):

deb http://mirrors.ustc.edu.cn/debian buster main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-backports main contrib non-free
deb http://mirrors.ustc.edu.cn/debian buster-proposed-updates main contrib non-free
deb http://mirrors.ustc.edu.cn/debian-security buster/updates main contrib non-free

退出后更新源:

apt-get clean
apt-get update
apt-get upgrade

安装字体:

apt-get install ttf-mscorefonts-installer
apt-get install fontconfig

拷贝字体

/usr/share/fonts/truetype/ 目录下新建文件夹 myfonts, 将 *.ttf 文件复制到此文件夹下, 并修改字体文件的权限:

chmod 777 *.ttf

建立字体缓存

mkfontscale
mkfontdir
fc-cache -fv
fc-list

添加中文支持

安装 locale:

apt-get install locales

配置:

dpkg-reconfigure locales

选择以下编码并将 zh_CN UTF-8 UTF-8 设置为默认编码:

en_US ISO-8859-1
en_US.UTF8 UTF-8
zh_CN GB2312
zh_CN.GB18030 GB18030
zh_CN GBK GBK
zh_CN UTF-8 UTF-8

安装中文字库

apt-get install ttf-wqy-zenhei

重启系统

感觉可以不用重启, 毕竟已经建立了字体缓存吧.

rainbow

这个人很懒,什么都没留下

文章评论