如何给Linux安装新的字体

本文详细介绍如何在Linux系统中安装自定义字体,包括从Windows拷贝字体文件、上传到指定目录、创建新目录存放字体、加载字体以及验证字体安装是否成功等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

可能因为各种各样的原因,需要给linux安装我们自己所需要的字体,接下来写一下操作:

1、准备好字体,可以从网上下载,也可以直接从咱们的windows电脑中拷贝出来:

C:\Windows\Fonts 从这里拷贝windows上的字体;

2、上传到服务器上:

Linux字体目录是 /usr/share/fonts 我们在这个目录里面新建一个自己能够记住的目录,然后放入我们需要的字体;

[root@localhost ~]# cd /usr/share/fonts
[root@localhost fonts]# mkdir new
[root@localhost fonts]# ls
liberation  new
[root@localhost fonts]# cd new/
。。。。。。
然后将自己需要的字体传到这个目录下
。。。。。。

[root@localhost new]# ls
arialbd.ttf  ariali.ttf    ARIALNB.TTF  ARIALN.TTF  ariblk.ttf
arialbi.ttf  ARIALNBI.TTF  ARIALNI.TTF  arial.ttf   simfang.ttf
[root@localhost new]# 

3、加载这些字体:

如图所示就是成功的标志,可以从第三行信息看到加载到了咱们的10个ttf字体文件,以及最后一行的succeeded;

[root@localhost new]# fc-cache -fv
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/fonts/liberation: caching, new cache contents: 4 fonts, 0 dirs
/usr/share/fonts/new: caching, new cache contents: 10 fonts, 0 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/usr/share/fonts: caching, new cache contents: 0 fonts, 2 dirs
/usr/share/X11/fonts/Type1: skipping, no such directory
/usr/share/X11/fonts/TTF: skipping, no such directory
/usr/local/share/fonts: skipping, no such directory
/root/.local/share/fonts: skipping, no such directory
/root/.fonts: skipping, no such directory
/var/cache/fontconfig: cleaning cache directory
/root/.cache/fontconfig: not cleaning non-existent cache directory
/root/.fontconfig: not cleaning non-existent cache directory
fc-cache: succeeded
[root@localhost new]# 

4、查看linux上面的全部字体;

[root@localhost new]# fc-list
/usr/share/fonts/new/simfang.ttf: 仿宋,FangSong:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/liberation/LiberationSans-Bold.ttf: Liberation Sans:style=Bold
/usr/share/fonts/new/arialbd.ttf: Arial:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,đậm,Lodia
/usr/share/fonts/liberation/LiberationSans-BoldItalic.ttf: Liberation Sans:style=Bold Italic
/usr/share/fonts/new/ARIALNBI.TTF: Arial,Arial Narrow:style=Narrow Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Bold Italic,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,Lodi etzana
/usr/share/fonts/new/ARIALN.TTF: Arial,Arial Narrow:style=Narrow,Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/new/ariali.ttf: Arial:style=Italic,Cursiva,kurzíva,kursiv,Πλάγια,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,nghiêng,Etzana
/usr/share/fonts/new/ariblk.ttf: Arial,Arial Black:style=Black,Normal,obyčejné,Standard,Κανονικά,Regular,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
/usr/share/fonts/new/arial.ttf: Arial:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,thường,Arrunta
/usr/share/fonts/new/ARIALNB.TTF: Arial,Arial Narrow:style=Narrow Bold,Negreta,tučné,fed,Fett,Έντονα,Bold,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,Lodia
/usr/share/fonts/liberation/LiberationSans-Italic.ttf: Liberation Sans:style=Italic
/usr/share/fonts/new/ARIALNI.TTF: Arial,Arial Narrow:style=Narrow Italic,Cursiva,kurzíva,kursiv,Πλάγια,Italic,Kursivoitu,Italique,Dőlt,Corsivo,Cursief,Kursywa,Itálico,Курсив,İtalik,Poševno,Etzana
/usr/share/fonts/new/arialbi.ttf: Arial:style=Bold Italic,Negreta cursiva,tučné kurzíva,fed kursiv,Fett Kursiv,Έντονα Πλάγια,Negrita Cursiva,Lihavoitu Kursivoi,Gras Italique,Félkövér dőlt,Grassetto Corsivo,Vet Cursief,Halvfet Kursiv,Pogrubiona kursywa,Negrito Itálico,Полужирный Курсив,Tučná kurzíva,Fet Kursiv,Kalın İtalik,Krepko poševno,nghiêng đậm,Lodi etzana
/usr/share/fonts/liberation/LiberationSans-Regular.ttf: Liberation Sans:style=Regular
[root@localhost new]# 

5、成功咯!哇哈哈哈哈!

ps:

# mkfontscale (如果提示 mkfontscale: command not found,需自行安装 # yum install mkfontscale )
# mkfontdir 
# fc-cache -fv (如果提示 fc-cache: command not found,则需要安装# yum install fontconfig )

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

运维家

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值