可能因为各种各样的原因,需要给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 )

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐