1. 输出当前已安装的所有字体
➜ ~ fc-list
/usr/share/fonts/noto/NotoSansTaiLe-Regular.ttf: Noto Sans Tai Le:style=Regular
...
2. 过滤输出当前已安装的字体(也可以通过grep方式)
➜ ~ fc-list Ubuntu
/usr/share/fonts/TTF/Ubuntu-RI.ttf: Ubuntu:style=Italic
/usr/share/fonts/TTF/Ubuntu-B.ttf: Ubuntu:style=Bold
/usr/share/fonts/TTF/Ubuntu-LI.ttf: Ubuntu:style=Light Italic
/usr/share/fonts/TTF/Ubuntu-MI.ttf: Ubuntu:style=Medium Italic
/usr/share/fonts/TTF/Ubuntu-BI.ttf: Ubuntu:style=Bold Italic
/usr/share/fonts/TTF/Ubuntu-L.ttf: Ubuntu:style=Light
/usr/share/fonts/TTF/Ubuntu-R.ttf: Ubuntu:style=Regular
/usr/share/fonts/TTF/Ubuntu-M.ttf: Ubuntu:style=Medium
➜ ~ fc-list 'Ubuntu Mono'
/usr/share/fonts/TTF/UbuntuMono-R.ttf: Ubuntu Mono:style=Regular
/usr/share/fonts/TTF/UbuntuMono-BI.ttf: Ubuntu Mono:style=Bold Italic
/usr/share/fonts/TTF/UbuntuMono-B.ttf: Ubuntu Mono:style=Bold
/usr/share/fonts/TTF/UbuntuMono-RI.ttf: Ubuntu Mono:style=Italic
3. 手动安装字体
首先,下载字体文件,假设文件名为A.ttf,一般字体文件都是以ttf为后缀名。
然后,将A.ttf文件移动到~/.local/share/fonts/目录下,如果该目录不存在,则创建目录。
最后,在命令行下执行fc-cache命令,更新字体cache文件。
通过以上步骤,新的字体就已经安装好了。
如果是通过对话框来修改字体的软件,在打开切换字体的对话框时,应该就可以看到这个新的字体了。
如果是通过配置文件来修改字体的软件,则可以在配置文件中通过指定 family style size 等信息来修改字体。
4. 其他命令
linux下字体管理还有一些其他命令,大都以 fc- 开头,有兴趣的可以自己研究下。
本文分享自 Linux内核及JVM底层相关技术研究 微信公众号,前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有