在CentOS中安装arial字体

Gnuplot是一个用C编写的用于生成二维和三维图命令行程序,对于脚本驱动的图形,gnuplot是迄今为止最受欢迎的程序。在Centos安装gnuplot,如下所示:

[yhwang@yhwang ~]$ yum install gnuplot -y

在运行一些生物信息软件的时候,提示:Could not find/open font when opening font “arial”, using internal non-scalable font 等信息。此时,表示CentOS系统缺乏arial字体文件。需要安装,这里我们复制windows下font字体库,就可以完成安装,如下:

  windows下font字体库通常在路径“C:WindowsFonts”下;Centos6.8中的字体库在路径“/usr/share/fonts/”下。

# 在/usr/share/fonts/目录下创建目录arial
[yhwang@yhwang ~]$ mkdir arial

   然后如下图所示,将Windows C:WindowsFonts目录下的arial*.tff文件上传到Centos6.8 /usr/share/fonts/arial目录下

  接着,按如下步骤将刚加入的字体设置缓存使之生效

[yhwang@yhwang ~]$ cd /usr/share/font/arial
[yhwang@yhwang ~]$ mkfontscale
[yhwang@yhwang ~]$ mkfontdir
[yhwang@yhwang ~]$ fc-cache -fv

   最后,设置gunplot对arial的选择路径

# 修改~/.bashrc文件,添加如下内容
[yhwang@yhwang ~]$ vim ~/.bashrc

export GDFONTPATH=/usr/share/fonts/arial
export GNUPLOT_DEFAULT_GDFONT="arial

# source ~/.bashrc保存
[yhwang@yhwang ~]$ source ~/.bashrc

参考资料

http://www.chenlianfu.com/?p=1496

原文地址:https://www.cnblogs.com/yahengwang/p/9669453.html